Package org.serviceconnector.call

Examples of org.serviceconnector.call.SCMPAttachCall


      AppContext.init();
      RemoteNodeConfiguration remoteNodeConf = new RemoteNodeConfiguration(this.port + "client", this.host, this.port,
          this.connectionType.getValue(), this.keepAliveIntervalSeconds, 0, this.maxConnections);
      this.requester = new SCRequester(remoteNodeConf, this.keepAliveTimeoutSeconds * Constants.SEC_TO_MILLISEC_FACTOR);
      SCServiceCallback callback = new SCServiceCallback(true);
      SCMPAttachCall attachCall = new SCMPAttachCall(this.requester);
      try {
        attachCall.invoke(callback, operationTimeoutSeconds * Constants.SEC_TO_MILLISEC_FACTOR);
      } catch (Exception e) {
        this.requester.destroy();
        // release resources
        AppContext.destroy();
        throw new SCServiceException("Attach to " + host + ":" + port + " failed. ", e);
View Full Code Here


      AppContext.init();
      RemoteNodeConfiguration remoteNodeConf = new RemoteNodeConfiguration(this.port + "client", this.host, this.port,
          this.connectionType.getValue(), this.keepAliveIntervalSeconds, 0, this.maxConnections);
      this.requester = new SCRequester(remoteNodeConf, this.keepAliveTimeoutSeconds * Constants.SEC_TO_MILLISEC_FACTOR);
      SCServiceCallback callback = new SCServiceCallback(true);
      SCMPAttachCall attachCall = new SCMPAttachCall(this.requester);
      try {
        attachCall.invoke(callback, operationTimeoutSeconds * Constants.SEC_TO_MILLISEC_FACTOR);
      } catch (Exception e) {
        this.requester.destroy();
        // release resources
        AppContext.destroy();
        throw new SCServiceException("Attach to " + host + ":" + port + " failed. ", e);
View Full Code Here

      Enumeration<InetAddress> inetAdresses = netint.getInetAddresses();
      for (InetAddress inetAddress : Collections.list(inetAdresses)) {
        try {
          IRequester req = new Requester(new RemoteNodeConfiguration(TestConstants.RemoteNodeName, TestConstants.HOST,
              TestConstants.PORT_SC0_HTTP, ConnectionType.NETTY_HTTP.getValue(), 0, 0, 1));
          SCMPAttachCall attachCall = new SCMPAttachCall(req);
          attachCall.invoke(cbk, 1000);
          TestUtil.checkReply(cbk.getMessageSync(1000));

          SCMPDetachCall detachCall = new SCMPDetachCall(req);
          detachCall.invoke(cbk, 1000);
          TestUtil.checkReply(cbk.getMessageSync(1000));
View Full Code Here

      AppContext.init();
      RemoteNodeConfiguration remoteNodeConf = new RemoteNodeConfiguration(this.port + "client", this.host, this.port,
          this.connectionType.getValue(), this.keepAliveIntervalSeconds, 0, this.maxConnections);
      this.requester = new SCRequester(remoteNodeConf, this.keepAliveTimeoutSeconds * Constants.SEC_TO_MILLISEC_FACTOR);
      SCServiceCallback callback = new SCServiceCallback(true);
      SCMPAttachCall attachCall = new SCMPAttachCall(this.requester);
      try {
        attachCall.invoke(callback, operationTimeoutSeconds * Constants.SEC_TO_MILLISEC_FACTOR);
      } catch (Exception e) {
        this.requester.destroy();
        // release resources
        AppContext.destroy();
        throw new SCServiceException("Attach to " + host + ":" + port + " failed. ", e);
View Full Code Here

   */
  @Test
  public void t01_AttachDetach() throws Exception {
    this.requester = new SCRequester(new RemoteNodeConfiguration(TestConstants.RemoteNodeName, TestConstants.HOST, this.port,
        this.connectionType.getValue(), 0, 0, 1), 0);
    SCMPAttachCall attachCall = new SCMPAttachCall(this.requester);
    TestCallback callback1 = new TestCallback();
    attachCall.invoke(callback1, 10000);
    SCMPMessage result = callback1.getMessageSync(10000);
    TestUtil.checkReply(result);

    Assert.assertNull(result.getBody());
    Assert.assertNull(result.getMessageSequenceNr());
View Full Code Here

   * Description: attach call - SC version is empty<br>
   * Expectation: passes
   */
  @Test
  public void t01_AttachCallSCVersionIsEmpty() throws Exception {
    SCMPAttachCall attachCall = new SCMPAttachCall(this.requester) {
      @Override
      public void invoke(ISCMPMessageCallback scmpCallback, int timeoutMillis) throws Exception {
        String dateTime = DateTimeUtility.getCurrentTimeZoneMillis();
        String version = "";
        this.requestMessage.setHeader(SCMPHeaderAttributeKey.SC_VERSION, version);
        this.requestMessage.setHeader(SCMPHeaderAttributeKey.LOCAL_DATE_TIME, dateTime);
        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);
    TestUtil.verifyError(result, SCMPError.HV_WRONG_SC_VERSION_FORMAT, SCMPMsgType.ATTACH);
  }
View Full Code Here

   * Description: attach call - SC version is incompatible<br>
   * Expectation: passes
   */
  @Test
  public void t02_AttachCallSCVersionIsIncompatible() throws Exception {
    SCMPAttachCall attachCall = new SCMPAttachCall(this.requester) {
      @Override
      public void invoke(ISCMPMessageCallback scmpCallback, int timeoutMillis) throws Exception {
        String dateTime = DateTimeUtility.getCurrentTimeZoneMillis();
        String version = "2.0-000";
        this.requestMessage.setHeader(SCMPHeaderAttributeKey.SC_VERSION, version);
        this.requestMessage.setHeader(SCMPHeaderAttributeKey.LOCAL_DATE_TIME, dateTime);
        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);
    TestUtil.verifyError(result, SCMPError.HV_WRONG_SC_RELEASE_NR, SCMPMsgType.ATTACH);
  }
View Full Code Here

   * Description: attach call - SC version is wrong format<br>
   * Expectation: passes
   */
  @Test
  public void t03_AttachCallSCVersionWrongFormat() throws Exception {
    SCMPAttachCall attachCall = new SCMPAttachCall(this.requester) {
      @Override
      public void invoke(ISCMPMessageCallback scmpCallback, int timeoutMillis) throws Exception {

        String dateTime = DateTimeUtility.getCurrentTimeZoneMillis();
        String version = "1.1000";
        this.requestMessage.setHeader(SCMPHeaderAttributeKey.SC_VERSION, version);
        this.requestMessage.setHeader(SCMPHeaderAttributeKey.LOCAL_DATE_TIME, dateTime);
        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);
    TestUtil.verifyError(result, SCMPError.HV_WRONG_SC_VERSION_FORMAT, SCMPMsgType.ATTACH);
  }
View Full Code Here

   * Description: attach call - SC version is compatible<br>
   * Expectation: passes
   */
  @Test
  public void t04_AttachCallSCVersionCompatible() throws Exception {
    SCMPAttachCall attachCall = new SCMPAttachCall(this.requester) {
      @Override
      public void invoke(ISCMPMessageCallback scmpCallback, int timeoutMillis) throws Exception {

        String dateTime = DateTimeUtility.getCurrentTimeZoneMillis();
        String version = "1.0-000";
        this.requestMessage.setHeader(SCMPHeaderAttributeKey.SC_VERSION, version);
        this.requestMessage.setHeader(SCMPHeaderAttributeKey.LOCAL_DATE_TIME, dateTime);
        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

TOP

Related Classes of org.serviceconnector.call.SCMPAttachCall

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.