Package org.serviceconnector

Examples of org.serviceconnector.TestCallback


  public void t01_StringMessageCompressed() throws Exception {
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setMessageInfo(TestConstants.echoCmd);
    clnExecuteCall.setRequestBody(TestConstants.stringLength257);
    clnExecuteCall.setCompressed(true);
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 3000);
    SCMPMessage scmpReply = cbk.getMessageSync(3000);
    Assert.assertEquals(TestConstants.stringLength257, scmpReply.getBody());
    Assert.assertEquals(SCMPBodyType.TEXT.getValue(), scmpReply.getHeader(SCMPHeaderAttributeKey.BODY_TYPE));
  }
View Full Code Here


    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setMessageInfo(TestConstants.echoCmd);
    String largeString = TestUtil.getLargeString();
    clnExecuteCall.setRequestBody(largeString.getBytes());
    clnExecuteCall.setCompressed(true);
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 3000);
    SCMPMessage scmpReply = cbk.getMessageSync(3000);
    Assert.assertEquals(largeString, new String((byte[]) scmpReply.getBody()));
  }
View Full Code Here

    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setMessageInfo(TestConstants.echoCmd);
    String largeString = TestUtil.getLargeString();
    ByteArrayInputStream in = new ByteArrayInputStream(largeString.getBytes());
    clnExecuteCall.setRequestBody(in);
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 300000);
    SCMPMessage scmpReply = cbk.getMessageSync(300000);
    Assert.assertEquals(new String(largeString.getBytes()), new String((byte[]) scmpReply.getBody()));
  }
View Full Code Here

   */
  @Test
  public void t20_EXCOnServer() throws Exception {
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setMessageInfo(TestConstants.raiseExceptionCmd);
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 3000);
    SCMPMessage scmpReply = cbk.getMessageSync(3000);
    Assert.assertTrue(scmpReply.isFault());
    Assert.assertEquals(SCMPError.SERVER_ERROR.getErrorCode(), scmpReply.getHeaderInt(SCMPHeaderAttributeKey.SC_ERROR_CODE)
        .intValue());
  }
View Full Code Here

   */
  @Test
  public void t30_AppErrorCodeText() throws Exception {
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setMessageInfo(TestConstants.echoAppErrorCmd);
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 3000);
    SCMPMessage scmpReply = cbk.getMessageSync(3000);
    TestUtil.checkReply(scmpReply);
    Assert.assertEquals(TestConstants.appErrorCode + "", scmpReply.getHeader(SCMPHeaderAttributeKey.APP_ERROR_CODE));
    Assert.assertEquals(TestConstants.appErrorText, scmpReply.getHeader(SCMPHeaderAttributeKey.APP_ERROR_TEXT));
  }
View Full Code Here

  public void t40_SmallRequestLargeResponseUncompressed() throws Exception {
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setMessageInfo(TestConstants.largeResponseCmd);
    clnExecuteCall.setRequestBody("test body");
    clnExecuteCall.setCompressed(false);
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 3000);
    SCMPMessage scmpReply = cbk.getMessageSync(3000);

    String expectedResponse = TestUtil.getLargeString();
    Assert.assertEquals(expectedResponse.length() + "", scmpReply.getBodyLength() + "");
    Assert.assertEquals(expectedResponse, scmpReply.getBody());
    Assert.assertEquals(SCMPBodyType.TEXT.getValue(), scmpReply.getHeader(SCMPHeaderAttributeKey.BODY_TYPE));
View Full Code Here

  public void t41_LargeRequestSmallResponseUncompressed() throws Exception {
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    String largeString = TestUtil.getLargeString();
    clnExecuteCall.setRequestBody(largeString);
    clnExecuteCall.setCompressed(false);
    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

    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    String largeString = TestUtil.getLargeString();
    clnExecuteCall.setMessageInfo(TestConstants.largeResponseCmd);
    clnExecuteCall.setRequestBody(largeString);
    clnExecuteCall.setCompressed(false);
    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();
View Full Code Here

  @Test
  public void t50_SmallRequestLargeResponseCompressed() throws Exception {
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setMessageInfo(TestConstants.largeResponseCmd);
    clnExecuteCall.setRequestBody("test body");
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 3000);
    SCMPMessage scmpReply = cbk.getMessageSync(3000);

    String expectedResponse = TestUtil.getLargeString();
    Assert.assertEquals(expectedResponse.length(), scmpReply.getBodyLength());
    Assert.assertEquals(expectedResponse, scmpReply.getBody());
    Assert.assertEquals(SCMPBodyType.TEXT.getValue(), scmpReply.getHeader(SCMPHeaderAttributeKey.BODY_TYPE));
View Full Code Here

  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));
View Full Code Here

TOP

Related Classes of org.serviceconnector.TestCallback

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.