Package org.serviceconnector

Examples of org.serviceconnector.TestCallback


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

    // reserve connection 2 with session2
    clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, sessionId2);
    clnExecuteCall.setMessageInfo(TestConstants.sleepCmd);
    clnExecuteCall.setRequestBody("3000");
    clnExecuteCall.setCacheId("700");
    TestCallback cbk4 = new TestCallback();
    clnExecuteCall.invoke(cbk4, 10000);
    SCMPMessage reply = cbk4.getMessageSync(4000);
    TestUtil.verifyError(reply, SCMPError.CACHE_LOADING, SCMPMsgType.CLN_EXECUTE);
    TestUtil.checkReply(cbk.getMessageSync(4000));
  }
View Full Code Here


  public void t80_OTITimesOut() throws Exception {
    SCMPClnExecuteCall clnExecuteCall = new SCMPClnExecuteCall(this.requester, TestConstants.sesServerName1, this.sessionId);
    clnExecuteCall.setRequestBody("cacheTimeoutReply");
    clnExecuteCall.setMessageInfo(TestConstants.cacheCmd);
    clnExecuteCall.setCacheId("700");
    TestCallback cbk = new TestCallback();
    clnExecuteCall.invoke(cbk, 1000);
    SCMPMessage responseMessage = cbk.getMessageSync(1000);
    TestUtil.verifyError(responseMessage, SCMPError.OPERATION_TIMEOUT, SCMPMsgType.CLN_EXECUTE);
    this.checkCacheContent("700", "checkCacheContent");
  }
View Full Code Here

   */
  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

   *             the exception
   */
  private void deleteSession() throws Exception {
    SCMPClnDeleteSessionCall deleteSessionCall = new SCMPClnDeleteSessionCall(this.requester, TestConstants.sesServerName1,
        this.sessionId);
    TestCallback cbk = new TestCallback();
    deleteSessionCall.invoke(cbk, 3000);
    cbk.getMessageSync(3000);
  }
View Full Code Here

  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) {
      expected = (String) body;
View Full Code Here

    message.setHeader(SCMPHeaderAttributeKey.SC_VERSION, SCVersion.CURRENT.toString());
    message.setHeader(SCMPHeaderAttributeKey.LOCAL_DATE_TIME, ldt);

    for (int i = 0; i < 10000; i++) {
      IConnection connection = connectionPool.getConnection();
      TestCallback cbk = new TestCallback();
      connection.send(message, cbk);
      cbk.getMessageSync(1000);
      connectionPool.freeConnection(connection);
      if ((i + 1) % 5000 == 0) {
        testLogger.info("connection nr " + (i + 1) + "...");
      }
    }
View Full Code Here

    for (int i = 0; i < 10000; i++) {
      ConnectionPool cp = new ConnectionPool(TestConstants.HOST, this.port, this.connectionType.getValue(),
          this.keepAliveSeconds, this.keepAliveOTIMillis);
      IConnection connection = cp.getConnection();
      TestCallback cbk = new TestCallback();
      connection.send(message, cbk);
      cbk.getMessageSync(1000);
      cp.freeConnection(connection);
      cp.destroy();
      if ((i + 1) % 5000 == 0) {
        testLogger.info("connection nr " + (i + 1) + "...");
      }
View Full Code Here

    message.setHeader(SCMPHeaderAttributeKey.SC_VERSION, SCVersion.CURRENT.toString());
    message.setHeader(SCMPHeaderAttributeKey.LOCAL_DATE_TIME, ldt);
    connection.connect();

    for (int i = 0; i < 50000; i++) {
      TestCallback cbk = new TestCallback();
      connection.send(message, cbk);
      TestUtil.checkReply(cbk.getMessageSync(3000));
      if ((i + 1) % 10000 == 0) {
        testLogger.info("message nr " + (i + 1) + "...");
      }
    }
    connection.disconnect();
View Full Code Here

    message.setHeader(SCMPHeaderAttributeKey.SC_VERSION, SCVersion.CURRENT.toString());
    message.setHeader(SCMPHeaderAttributeKey.LOCAL_DATE_TIME, ldt);

    for (int i = 0; i < 50000; i++) {
      connection.connect();
      TestCallback cbk = new TestCallback();
      connection.send(message, cbk);
      TestUtil.checkReply(cbk.getMessageSync(3000));
      connection.disconnect();
      if ((i + 1) % 1000 == 0) {
        testLogger.info("connection nr " + (i + 1) + "...");
      }
    }
View Full Code Here

      connection.setIdleTimeoutSeconds(0);
      IIdleConnectionCallback idleCallback = new IdleCallback();
      ConnectionContext connectionContext = new ConnectionContext(connection, idleCallback, 0);
      connection.setContext(connectionContext);
      connection.connect();
      TestCallback cbk = new TestCallback();
      connection.send(message, cbk);
      TestUtil.checkReply(cbk.getMessageSync(3000));
      if ((i + 1) % 100 == 0) {
        testLogger.info("connection nr " + (i + 1) + "...");
      }
    }
    for (int i = 0; i < numberOfConnections; i++) {
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.