Package org.serviceconnector.call

Examples of org.serviceconnector.call.SCMPClnExecuteCall


   * Description: execute small request - larger response both compressed<br>
   * Expectation: passes
   */
  @Test
  public void t51_SmallRequest10MBLargeResponseCompressed() throws Exception {
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setMessageInfo(TestConstants.largeResponse10MBCmd);
    clnExecuteCall.setRequestBody("test body");
    clnExecuteCall.setCompressed(true);
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 300000);
    SCMPMessage scmpReply = cbk.getMessageSync(300000);

    String expectedResponse = TestUtil.get10MBString();
    Assert.assertEquals("unequal length", expectedResponse.length(), scmpReply.getBodyLength());
    Assert.assertEquals(expectedResponse, scmpReply.getBody());
    Assert.assertEquals(SCMPBodyType.TEXT.getValue(), scmpReply.getHeader(SCMPHeaderAttributeKey.BODY_TYPE));
    Assert.assertEquals(SCMPMsgType.CLN_EXECUTE.getValue(), scmpReply.getMessageType());
    String serviceName = clnExecuteCall.getRequest().getServiceName();
    String sessionId = clnExecuteCall.getRequest().getSessionId();
    Assert.assertEquals(serviceName, scmpReply.getServiceName());
    Assert.assertEquals(sessionId, scmpReply.getSessionId());
  }
View Full Code Here


   * Description: execute large request - small response both compressed<br>
   * Expectation: passes
   */
  @Test
  public void t52_LargeRequestSmallResponseCompressed() throws Exception {
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    String largeString = TestUtil.getLargeString();
    clnExecuteCall.setRequestBody(largeString);
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 3000);
    SCMPMessage scmpReply = cbk.getMessageSync(3000);
    Assert.assertNotNull(scmpReply.getSessionId());
    Assert.assertEquals(0, scmpReply.getBodyLength());
    Assert.assertEquals(null, scmpReply.getBody());
  }
View Full Code Here

   * Description: execute large request - large response both compressed<br>
   * Expectation: passes
   */
  @Test
  public void t53_LargeRequestLargeResponseCompressed() throws Exception {
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    String largeString = TestUtil.getLargeString();
    clnExecuteCall.setMessageInfo(TestConstants.largeResponseCmd);
    clnExecuteCall.setRequestBody(largeString);
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 3000);
    SCMPMessage scmpReply = cbk.getMessageSync(3000);
    Assert.assertEquals(largeString.length() + "", scmpReply.getBodyLength() + "");
    Assert.assertEquals(largeString, scmpReply.getBody());
    Assert.assertEquals(SCMPBodyType.TEXT.getValue(), scmpReply.getHeader(SCMPHeaderAttributeKey.BODY_TYPE));
    Assert.assertEquals(SCMPMsgType.CLN_EXECUTE.getValue(), scmpReply.getMessageType());
    String serviceName = clnExecuteCall.getRequest().getServiceName();
    String sessionId = clnExecuteCall.getRequest().getSessionId();
    Assert.assertEquals(serviceName, scmpReply.getServiceName());
    Assert.assertEquals(sessionId, scmpReply.getSessionId());
  }
View Full Code Here

   */
  @Test
  public void t70_WaitsForConnectionTimeout() throws Exception {

    // reserve connection 1 with standard session
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setMessageInfo(TestConstants.sleepCmd);
    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);
    clnExecuteCall.setMessageInfo(TestConstants.sleepCmd);
    clnExecuteCall.setRequestBody("3000");
    TestCallback cbk4 = new TestCallback();
    clnExecuteCall.invoke(cbk4, 10000);

    // to assure second create is not faster
    Thread.sleep(20);
    // try to get a third connection with a third session - should not work
    clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, sessionId2);
    TestCallback cbk5 = new TestCallback();
    clnExecuteCall.invoke(cbk5, 2000);

    SCMPMessage reply = cbk4.getMessageSync(4000);
    SCMPMessage reply1 = cbk5.getMessageSync(4000);

    TestUtil.checkReply(reply);
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t71_LoopsForFreeConnectionAndWorksFineAfter() throws Exception {
    // reserve connection 1 with standard session
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setMessageInfo(TestConstants.sleepCmd);
    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);
    clnExecuteCall.setMessageInfo(TestConstants.sleepCmd);
    clnExecuteCall.setRequestBody("3000");
    TestCallback cbk4 = new TestCallback();
    clnExecuteCall.invoke(cbk4, 10000);

    // to assure second create is not faster
    Thread.sleep(20);
    // try to get a third connection with a third session - should work with the wait mec for free connections
    clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, sessionId2);
    TestCallback cbk5 = new TestCallback();
    clnExecuteCall.invoke(cbk5, 7000);

    SCMPMessage reply = cbk4.getMessageSync(4000);
    SCMPMessage reply1 = cbk5.getMessageSync(7000);

    TestUtil.checkReply(reply);
View Full Code Here

   * Description: execute - waits 2 seconds, OTI runs out on SC<br>
   * Expectation: passes
   */
  @Test
  public void t80_OTITimesOut() throws Exception {
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setMessageInfo(TestConstants.sleepCmd);
    clnExecuteCall.setRequestBody("2000");
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 2000);
    SCMPMessage responseMessage = cbk.getMessageSync(2000);
    TestUtil.verifyError(responseMessage, SCMPError.OPERATION_TIMEOUT, SCMPMsgType.CLN_EXECUTE);
  }
View Full Code Here

   * Expectation: throws parallel request error
   */
  @Test
  public void t81_PendingRequestError() throws Exception {

    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setMessageInfo(TestConstants.sleepCmd);
    clnExecuteCall.setRequestBody("3000");
    TestCallback cbk2 = new TestCallback();
    clnExecuteCall.invoke(cbk2, 10000);

    // to assure second create is not faster
    Thread.sleep(20);
    clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    TestCallback cbk1 = new TestCallback();
    clnExecuteCall.invoke(cbk1, 2000);

    SCMPMessage reply = cbk2.getMessageSync(4000);
    SCMPMessage reply1 = cbk1.getMessageSync(4000);

    TestUtil.checkReply(reply);
View Full Code Here

   * Description: execute - uncompressed message of type string is exchanged and cached<br>
   * Expectation: passes
   */
  @Test
  public void t01_StringMessageUnCompressed() throws Exception {
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setMessageInfo(TestConstants.cacheCmd);
    clnExecuteCall.setRequestBody(TestConstants.stringLength257);
    clnExecuteCall.setCompressed(false);
    clnExecuteCall.setCacheId("700");
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 3000);
    cbk.getMessageSync(3000);
    this.checkCacheContent("700", TestConstants.stringLength257);
  }
View Full Code Here

   * Description: execute - exception on server - hand over to client<br>
   * Expectation: passes
   */
  @Test
  public void t20_EXCOnServer() throws Exception {
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setMessageInfo(TestConstants.raiseExceptionCmd);
    clnExecuteCall.setCacheId("700");
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 3000);
    cbk.getMessageSync(3000);
    this.checkCacheContent("700", "checkCacheContent");
  }
View Full Code Here

   * Description: execute small request - large response both uncompressed, cached<br>
   * Expectation: passes
   */
  @Test
  public void t40_SmallRequestLargeResponseUncompressed() throws Exception {
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setMessageInfo(TestConstants.cacheCmd);
    clnExecuteCall.setCacheId("700");
    clnExecuteCall.setRequestBody("cacheLargeMessageFor1Hour");
    clnExecuteCall.setCompressed(false);
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 3000);
    cbk.getMessageSync(3000);
    this.checkCacheContent("700", TestUtil.getLargeString());
  }
View Full Code Here

TOP

Related Classes of org.serviceconnector.call.SCMPClnExecuteCall

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.