Package org.serviceconnector.call

Examples of org.serviceconnector.call.SCMPClnCreateSessionCall


  private void createFileSession(int operationTimeoutSeconds) throws SCServiceException {
    // 1. checking preconditions and initialize
    this.requester.getSCMPMsgSequenceNr().reset();
    // 2. initialize call & invoke
    SCServiceCallback callback = new SCServiceCallback(true);
    SCMPClnCreateSessionCall createSessionCall = new SCMPClnCreateSessionCall(this.requester, this.serviceName);
    createSessionCall.setEchoIntervalSeconds(Constants.DEFAULT_FILE_SESSION_TIMEOUT_SECONDS);
    try {
      createSessionCall.invoke(callback, operationTimeoutSeconds * Constants.SEC_TO_MILLISEC_FACTOR);
    } catch (Exception e) {
      throw new SCServiceException("Create file session on SC failed. ", e);
    }
    // 3. receiving reply and error handling
    SCMPMessage reply = callback.getMessageSync(operationTimeoutSeconds * Constants.SEC_TO_MILLISEC_FACTOR);
 
View Full Code Here


    // reset pendingRequest - necessary if service instances reused
    this.pendingRequest = false;
    this.messageCallback = messageCallback;
    this.requester.getSCMPMsgSequenceNr().reset();
    // 2. initialize call & invoke
    SCMPClnCreateSessionCall createSessionCall = new SCMPClnCreateSessionCall(this.requester, this.serviceName);
    createSessionCall.setRequestBody(scMessage.getData());
    createSessionCall.setCompressed(scMessage.isCompressed());
    createSessionCall.setSessionInfo(scMessage.getSessionInfo());
    createSessionCall.setEchoIntervalSeconds(this.echoIntervalSeconds);
    SCServiceCallback callback = new SCServiceCallback(true);
    try {
      createSessionCall.invoke(callback, operationTimeoutSeconds * Constants.SEC_TO_MILLISEC_FACTOR);
    } catch (Exception e) {
      throw new SCServiceException("Create session failed. ", e);
    }
    // 3. receiving reply and error handling
    SCMPMessage reply = callback.getMessageSync(operationTimeoutSeconds * Constants.SEC_TO_MILLISEC_FACTOR);
 
View Full Code Here

    clnExecuteCall.setRequestBody("3000");
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 10000);

    // create another session2
    SCMPClnCreateSessionCall createSessionCall = new SCMPClnCreateSessionCall(this.requester, TestConstants.sesServerName1);
    createSessionCall.setSessionInfo("sessionInfo");
    createSessionCall.setEchoIntervalSeconds(3600);
    TestCallback cbk2 = new TestCallback();
    createSessionCall.invoke(cbk2, 3000);
    SCMPMessage resp = cbk2.getMessageSync(3000);
    String sessionId2 = resp.getSessionId();

    // create another session3
    createSessionCall = new SCMPClnCreateSessionCall(this.requester, TestConstants.sesServerName1);
    createSessionCall.setSessionInfo("sessionInfo");
    createSessionCall.setEchoIntervalSeconds(3600);
    TestCallback cbk3 = new TestCallback();
    createSessionCall.invoke(cbk3, 3000);
    resp = cbk3.getMessageSync(3000);
    String sessionId3 = resp.getSessionId();

    // reserve connection 2 with session2
    clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, sessionId3);
View Full Code Here

    clnExecuteCall.setRequestBody("3000");
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 10000);

    // create another session2
    SCMPClnCreateSessionCall createSessionCall = new SCMPClnCreateSessionCall(this.requester, TestConstants.sesServerName1);
    createSessionCall.setSessionInfo("sessionInfo");
    createSessionCall.setEchoIntervalSeconds(3600);
    TestCallback cbk2 = new TestCallback();
    createSessionCall.invoke(cbk2, 3000);
    SCMPMessage resp = cbk2.getMessageSync(3000);
    String sessionId2 = resp.getSessionId();

    // create another session3
    createSessionCall = new SCMPClnCreateSessionCall(this.requester, TestConstants.sesServerName1);
    createSessionCall.setSessionInfo("sessionInfo");
    createSessionCall.setEchoIntervalSeconds(3600);
    TestCallback cbk3 = new TestCallback();
    createSessionCall.invoke(cbk3, 3000);
    resp = cbk3.getMessageSync(3000);
    String sessionId3 = resp.getSessionId();

    // reserve connection 2 with session2
    clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, sessionId3);
View Full Code Here

   *
   * @throws Exception
   *             the exception
   */
  protected void createSession() throws Exception {
    SCMPClnCreateSessionCall createSessionCall = new SCMPClnCreateSessionCall(this.requester, TestConstants.sesServerName1);
    createSessionCall.setSessionInfo("sessionInfo");
    createSessionCall.setEchoIntervalSeconds(3600);
    TestCallback cbk = new TestCallback();
    createSessionCall.invoke(cbk, 3000);
    SCMPMessage resp = cbk.getMessageSync(3000);
    this.sessionId = resp.getSessionId();
  }
View Full Code Here

   * Description: create session - echo time interval wrong<br>
   * Expectation: passes, returns error
   */
  @Test
  public void t01_WrongECI() throws Exception {
    SCMPClnCreateSessionCall createSessionCall = new SCMPClnCreateSessionCall(this.requester, TestConstants.sesServerName1);
    createSessionCall.setSessionInfo("SNBZHP - TradingClientGUI 10.2.7");
    createSessionCall.setEchoIntervalSeconds(0);
    createSessionCall.getRequest().setServiceName("session-1");
    TestCallback cbk = new TestCallback();
    createSessionCall.invoke(cbk, 3000);
    SCMPMessage fault = cbk.getMessageSync(3000);
    Assert.assertTrue(fault.isFault());
    TestUtil.verifyError(fault, SCMPError.HV_WRONG_ECHO_INTERVAL, SCMPMsgType.CLN_CREATE_SESSION);
  }
View Full Code Here

   * Description: create session - serviceName not set<br>
   * Expectation: passes, returns error
   */
  @Test
  public void t02_ServiceNameMissing() throws Exception {
    SCMPClnCreateSessionCall createSessionCall = new SCMPClnCreateSessionCall(this.requester, TestConstants.sesServerName1);
    createSessionCall.setSessionInfo("SNBZHP - TradingClientGUI 10.2.7");
    // set serviceName null
    createSessionCall.getRequest().setServiceName(null);
    createSessionCall.setEchoIntervalSeconds(300);
    TestCallback cbk = new TestCallback();
    createSessionCall.invoke(cbk, 1000);
    SCMPMessage fault = cbk.getMessageSync(3000);
    Assert.assertTrue(fault.isFault());
    TestUtil.verifyError(fault, SCMPError.HV_WRONG_SERVICE_NAME, SCMPMsgType.CLN_CREATE_SESSION);
  }
View Full Code Here

   * Description: create session - service name = ""<br>
   * Expectation: passes, returns error
   */
  @Test
  public void t03_ServiceNameEmpty() throws Exception {
    SCMPClnCreateSessionCall createSessionCall = new SCMPClnCreateSessionCall(this.requester, TestConstants.sesServerName1);
    createSessionCall.getRequest().setServiceName("");
    createSessionCall.setEchoIntervalSeconds(300);
    TestCallback cbk = new TestCallback();
    createSessionCall.invoke(cbk, 1000);
    SCMPMessage fault = cbk.getMessageSync(3000);
    Assert.assertTrue(fault.isFault());
    TestUtil.verifyError(fault, SCMPError.HV_WRONG_SERVICE_NAME, SCMPMsgType.CLN_CREATE_SESSION);
  }
View Full Code Here

   * Description: create session - service name = " "<br>
   * Expectation: passes, returns error
   */
  @Test
  public void t04_ServiceNameBlank() throws Exception {
    SCMPClnCreateSessionCall createSessionCall = new SCMPClnCreateSessionCall(this.requester, TestConstants.sesServerName1);
    createSessionCall.getRequest().setServiceName(" ");
    createSessionCall.setEchoIntervalSeconds(300);
    TestCallback cbk = new TestCallback();
    createSessionCall.invoke(cbk, 1000);
    SCMPMessage fault = cbk.getMessageSync(3000);
    Assert.assertTrue(fault.isFault());
    TestUtil.verifyError(fault, SCMPError.HV_WRONG_SERVICE_NAME, SCMPMsgType.CLN_CREATE_SESSION);
  }
View Full Code Here

   * Description: create session - serviceName too long<br>
   * Expectation: passes, returns error
   */
  @Test
  public void t05_ServiceNameTooLong() throws Exception {
    SCMPClnCreateSessionCall createSessionCall = new SCMPClnCreateSessionCall(this.requester, TestConstants.sesServerName1);
    createSessionCall.setSessionInfo("SNBZHP - TradingClientGUI 10.2.7");
    // set serviceName null
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < 98 << 10; i++) {
      sb.append(i);
      if (sb.length() > 10000)
        break;
    }
    createSessionCall.getRequest().setServiceName(sb.toString());
    createSessionCall.setEchoIntervalSeconds(300);
    TestCallback cbk = new TestCallback();
    createSessionCall.invoke(cbk, 1000);
    SCMPMessage fault = cbk.getMessageSync(3000);
    Assert.assertTrue(fault.isFault());
    TestUtil.verifyError(fault, SCMPError.HV_WRONG_SERVICE_NAME, SCMPMsgType.CLN_CREATE_SESSION);
  }
View Full Code Here

TOP

Related Classes of org.serviceconnector.call.SCMPClnCreateSessionCall

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.