Package org.serviceconnector.call

Examples of org.serviceconnector.call.SCMPClnExecuteCall


    deleteSessionCall.invoke(cbk, 3000);
    cbk.getMessageSync(3000);
  }

  private void checkCacheContent(String cacheId, Object body) throws Exception {
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setCacheId(cacheId);
    clnExecuteCall.setMessageInfo(TestConstants.echoCmd);
    clnExecuteCall.setRequestBody("checkCacheContent");
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 30000);
    SCMPMessage scmpReply = cbk.getMessageSync(30000);

    String expected = "expected";
    String received = "received";
    if (body instanceof String) {
View Full Code Here


   * Description: execute group call - open group send each letter alone and close group<br>
   * Expectation: passes
   */
  @Test
  public void t01_GroupCall() throws Exception {
    SCMPClnExecuteCall executeCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    executeCall.setMessageInfo(TestConstants.echoCmd);
    ISCMPCall groupCall = executeCall.openGroup();

    TestCallback cbk = new TestCallback(true);
    groupCall.invoke(cbk, 3000);
    TestUtil.checkReply(cbk.getMessageSync(3000));

View Full Code Here

   * Description: execute group call - open group send a large message over group call and close group<br>
   * Expectation: passes
   */
  @Test
  public void t10_GroupCallLargeRequest() throws Exception {
    SCMPClnExecuteCall executeCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    executeCall.setMessageInfo(TestConstants.echoCmd);
    ISCMPCall groupCall = executeCall.openGroup();

    String largeString = TestUtil.getLargeString();
    groupCall.setRequestBody(largeString);
    TestCallback cbk = new TestCallback(true);
    groupCall.invoke(cbk, 1000);
View Full Code Here

   * Description: execute - compressed message of type string is exchanged<br>
   * Expectation: passes
   */
  @Test
  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

   * Description: execute - compressed message of type byte is exchanged<br>
   * Expectation: passes
   */
  @Test
  public void t02_ByteMessageCompressed() throws Exception {
    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

   * uncompressed, ignores compression<br>
   * Expectation: passes
   */
  @Test
  public void t10_StreamMessage() throws Exception {
    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, 3000000);
    SCMPMessage scmpReply = cbk.getMessageSync(300000);
    Assert.assertEquals(new String(largeString.getBytes()), new String((byte[]) scmpReply.getBody()));
  }
View Full Code Here

   * Description: execute 100 times - message received by callback<br>
   * Expectation: passes
   */
  @Test
  public void t15_100AsynchronousMessages() throws Exception {
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setMessageInfo(TestConstants.echoCmd);
    clnExecuteCall.setRequestBody(TestConstants.pangram);
    ExecuteCallback callback = new ExecuteCallback();

    for (int i = 0; i < 100; i++) {
      callback.messageReceived = false;
      clnExecuteCall.invoke(callback, 3000);
      while (callback.messageReceived == false)
        ;
      Assert.assertEquals(TestConstants.pangram, callback.reply.getBody());
      Assert.assertEquals(SCMPBodyType.TEXT.getValue(), callback.reply.getHeader(SCMPHeaderAttributeKey.BODY_TYPE));
      Assert.assertEquals(SCMPMsgType.CLN_EXECUTE.getValue(), callback.reply.getMessageType());
View Full Code Here

   * callback<br>
   * Expectation: passes
   */
  @Test
  public void t16_100LargeMessagesAsynchronous() throws Exception {
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setMessageInfo(TestConstants.echoCmd);
    String largeString = TestUtil.getLargeString();
    clnExecuteCall.setRequestBody(largeString);
    ExecuteCallback callback = new ExecuteCallback();

    for (int i = 0; i < 100; i++) {
      callback.messageReceived = false;
      clnExecuteCall.invoke(callback, 3000);
      while (callback.messageReceived == false)
        ;
      Assert.assertEquals(largeString, callback.reply.getBody());
      Assert.assertEquals(SCMPBodyType.TEXT.getValue(), callback.reply.getHeader(SCMPHeaderAttributeKey.BODY_TYPE));
      Assert.assertEquals(SCMPMsgType.CLN_EXECUTE.getValue(), callback.reply.getMessageType());
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);
    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

   * returned by server<br>
   * Expectation: passes
   */
  @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

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.