Package org.serviceconnector

Examples of org.serviceconnector.TestCallback


        this.requestMessage.setMessageType(this.getMessageType());
        this.requester.send(this.requestMessage, timeoutMillis, scmpCallback);
        return;
      }
    };
    TestCallback cbk = new TestCallback(true);
    attachCall.invoke(cbk, 1000);
    SCMPMessage result = cbk.getMessageSync(3000);
    Assert.assertFalse(result.isFault());
  }
View Full Code Here


   * Expectation: passes
   */
  @Test
  public void t01_RegisterServerCallKeepAliveIntervalNotSet() throws Exception {
    SCMPRegisterServerCall registerServerCall = new SCMPRegisterServerCall(this.requester, TestConstants.sesServerName1);
    TestCallback cbk = new TestCallback();

    registerServerCall.setMaxSessions(10);
    registerServerCall.setMaxConnections(10);
    registerServerCall.setPortNumber(9100);
    registerServerCall.setCheckRegistrationIntervalSeconds(0);
    registerServerCall.setImmediateConnect(true);
    registerServerCall.setVersion(SCMPMessage.SC_VERSION.toString());
    registerServerCall.setLocalDateTime(DateTimeUtility.getCurrentTimeZoneMillis());
    registerServerCall.invoke(cbk, 1000);
    SCMPMessage reply = cbk.getMessageSync(3000);
    Assert.assertTrue(reply.isFault());
    TestUtil.verifyError(reply, SCMPError.HV_WRONG_KEEPALIVE_INTERVAL, SCMPMsgType.REGISTER_SERVER);
  }
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t02_RegisterServerCallInvalidMaxSessions() throws Exception {
    SCMPRegisterServerCall registerServerCall = new SCMPRegisterServerCall(this.requester, TestConstants.sesServerName1);
    TestCallback cbk = new TestCallback();

    registerServerCall.setPortNumber(9100);
    registerServerCall.setMaxSessions(0);
    registerServerCall.setMaxConnections(10);
    registerServerCall.setCheckRegistrationIntervalSeconds(0);
    registerServerCall.setImmediateConnect(true);
    registerServerCall.setKeepAliveIntervalSeconds(360);
    registerServerCall.setVersion(SCMPMessage.SC_VERSION.toString());
    registerServerCall.setLocalDateTime(DateTimeUtility.getCurrentTimeZoneMillis());
    registerServerCall.invoke(cbk, 1000);
    SCMPMessage reply = cbk.getMessageSync(3000);
    Assert.assertTrue(reply.isFault());
    TestUtil.verifyError(reply, SCMPError.HV_WRONG_MAX_SESSIONS, SCMPMsgType.REGISTER_SERVER);
  }
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t03_RegisterServerCallInvalidMaxConnections() throws Exception {
    SCMPRegisterServerCall registerServerCall = new SCMPRegisterServerCall(this.requester, TestConstants.sesServerName1);
    TestCallback cbk = new TestCallback();

    registerServerCall.setPortNumber(9100);
    registerServerCall.setMaxSessions(10);
    registerServerCall.setCheckRegistrationIntervalSeconds(0);
    registerServerCall.setMaxConnections(0);
    registerServerCall.setImmediateConnect(true);
    registerServerCall.setKeepAliveIntervalSeconds(360);
    registerServerCall.setVersion(SCMPMessage.SC_VERSION.toString());
    registerServerCall.setLocalDateTime(DateTimeUtility.getCurrentTimeZoneMillis());
    registerServerCall.invoke(cbk, 1000);
    SCMPMessage reply = cbk.getMessageSync(3000);
    Assert.assertTrue(reply.isFault());
    TestUtil.verifyError(reply, SCMPError.HV_WRONG_MAX_CONNECTIONS, SCMPMsgType.REGISTER_SERVER);
  }
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t04_RegisterServerCallInvalidPortNumber() throws Exception {
    SCMPRegisterServerCall registerServerCall = new SCMPRegisterServerCall(this.requester, TestConstants.sesServerName1);
    TestCallback cbk = new TestCallback();

    registerServerCall.setPortNumber(910000);
    registerServerCall.setMaxSessions(10);
    registerServerCall.setMaxConnections(10);
    registerServerCall.setCheckRegistrationIntervalSeconds(0);
    registerServerCall.setImmediateConnect(true);
    registerServerCall.setKeepAliveIntervalSeconds(360);
    registerServerCall.setVersion(SCMPMessage.SC_VERSION.toString());
    registerServerCall.setLocalDateTime(DateTimeUtility.getCurrentTimeZoneMillis());
    registerServerCall.invoke(cbk, 1000);
    SCMPMessage reply = cbk.getMessageSync(3000);
    Assert.assertTrue(reply.isFault());
    TestUtil.verifyError(reply, SCMPError.HV_WRONG_PORTNR, SCMPMsgType.REGISTER_SERVER);
  }
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t05_RegisterServerCallForUnknownService() throws Exception {
    SCMPRegisterServerCall registerServerCall = new SCMPRegisterServerCall(this.requester, "notConfiguredServiceName");
    TestCallback cbk = new TestCallback();

    registerServerCall.setMaxSessions(10);
    registerServerCall.setMaxConnections(10);
    registerServerCall.setCheckRegistrationIntervalSeconds(0);
    registerServerCall.setPortNumber(TestConstants.PORT_SES_SRV_TCP);
    registerServerCall.setImmediateConnect(true);
    registerServerCall.setKeepAliveIntervalSeconds(360);
    registerServerCall.setVersion(SCMPMessage.SC_VERSION.toString());
    registerServerCall.setLocalDateTime(DateTimeUtility.getCurrentTimeZoneMillis());

    registerServerCall.invoke(cbk, 1000);
    SCMPMessage reply = cbk.getMessageSync(3000);
    Assert.assertTrue(reply.isFault());
    TestUtil.verifyError(reply, SCMPError.SERVICE_NOT_FOUND, SCMPMsgType.REGISTER_SERVER);
  }
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t06_RegisterServerCallCheckRegistrationIntervalNotSet() throws Exception {
    SCMPRegisterServerCall registerServerCall = new SCMPRegisterServerCall(this.requester, TestConstants.sesServerName1);
    TestCallback cbk = new TestCallback();

    registerServerCall.setMaxSessions(10);
    registerServerCall.setMaxConnections(10);
    registerServerCall.setPortNumber(9100);
    registerServerCall.setKeepAliveIntervalSeconds(0);
    registerServerCall.setImmediateConnect(true);
    registerServerCall.setVersion(SCMPMessage.SC_VERSION.toString());
    registerServerCall.setLocalDateTime(DateTimeUtility.getCurrentTimeZoneMillis());
    registerServerCall.invoke(cbk, 1000);
    SCMPMessage reply = cbk.getMessageSync(3000);
    Assert.assertTrue(reply.isFault());
    TestUtil.verifyError(reply, SCMPError.HV_WRONG_CHECK_REGISTRATION_INTERVAL, SCMPMsgType.REGISTER_SERVER);
  }
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t20_RegisterServerCallDeregisterServerCall() throws Exception {
    SCMPRegisterServerCall registerServerCall = new SCMPRegisterServerCall(this.requester, TestConstants.pubServerName1);
    TestCallback cbk = new TestCallback();

    registerServerCall.setMaxSessions(10);
    registerServerCall.setMaxConnections(10);
    registerServerCall.setPortNumber(51000);
    registerServerCall.setCheckRegistrationIntervalSeconds(0);
    registerServerCall.setImmediateConnect(true);
    registerServerCall.setKeepAliveIntervalSeconds(360);
    registerServerCall.setVersion(SCMPMessage.SC_VERSION.toString());
    registerServerCall.setLocalDateTime(DateTimeUtility.getCurrentTimeZoneMillis());

    registerServerCall.invoke(cbk, 8000);
    TestUtil.checkReply(cbk.getMessageSync(10000));

    SCMPDeRegisterServerCall deRegisterServerCall = new SCMPDeRegisterServerCall(this.requester, TestConstants.pubServerName1);
    cbk = new TestCallback();
    deRegisterServerCall.invoke(cbk, 8000);
    TestUtil.checkReply(cbk.getMessageSync(10000));
  }
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t30_DeRegisterServerCallTwice() throws Exception {
    SCMPRegisterServerCall registerServerCall = new SCMPRegisterServerCall(this.requester, TestConstants.pubServerName1);
    TestCallback cbk = new TestCallback();

    registerServerCall.setMaxSessions(10);
    registerServerCall.setMaxConnections(10);
    registerServerCall.setCheckRegistrationIntervalSeconds(0);
    registerServerCall.setPortNumber(51000);
    registerServerCall.setImmediateConnect(true);
    registerServerCall.setKeepAliveIntervalSeconds(360);
    registerServerCall.setVersion(SCMPMessage.SC_VERSION.toString());
    registerServerCall.setLocalDateTime(DateTimeUtility.getCurrentTimeZoneMillis());

    registerServerCall.invoke(cbk, 10000);
    TestUtil.checkReply(cbk.getMessageSync(10000));
    // first deregister server call
    SCMPDeRegisterServerCall deRegisterServerCall = new SCMPDeRegisterServerCall(this.requester, TestConstants.pubServerName1);
    cbk = new TestCallback();
    deRegisterServerCall.invoke(cbk, 10000);
    TestUtil.checkReply(cbk.getMessageSync(10000));
    // second deregister server call
    cbk = new TestCallback();
    deRegisterServerCall.invoke(cbk, 10000);
    SCMPMessage reply = cbk.getMessageSync(10000);
    Assert.assertTrue(reply.isFault());
    Assert.assertEquals(SCMPMsgType.DEREGISTER_SERVER.getValue(), reply.getHeader(SCMPHeaderAttributeKey.MSG_TYPE));
    Assert.assertEquals(SCMPError.SERVER_NOT_FOUND.getErrorCode(), reply.getHeaderInt(SCMPHeaderAttributeKey.SC_ERROR_CODE)
        .intValue());
  }
View Full Code Here

    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

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.