Examples of SCPublishService


Examples of org.serviceconnector.api.cln.SCPublishService

      SCSubscribeMessage subscibeMessage = new SCSubscribeMessage();
      subscibeMessage.setMask(TestConstants.mask);
      subscibeMessage.setSessionInfo("sessionInfo");

      if (getMethodName() == "subscribe_serviceNameValidMaskSameAsInServer_isSubscribedSessionIdExists") {
        SCPublishService service = sc.newPublishService(TestConstants.pubServiceName1);
        service.subscribe(subscibeMessage, new TestPublishServiceMessageCallback(service));
        service.unsubscribe();

      } else if (getMethodName() == "subscribe_timeoutMaxAllowed_isSubscribedSessionIdExists") {
        SCPublishService service = sc.newPublishService(TestConstants.pubServiceName1);
        service.subscribe(3600, subscibeMessage, new TestPublishServiceMessageCallback(service));
        service.unsubscribe();

      } else if (getMethodName() == "changeSubscription_toMaskWhiteSpace_passes") {
        SCPublishService service = sc.newPublishService(TestConstants.pubServiceName1);
        service.subscribe(subscibeMessage, new TestPublishServiceMessageCallback(service));
        subscibeMessage.setMask(" ");
        service.changeSubscription(subscibeMessage);
        service.unsubscribe();

      } else if (getMethodName() == "subscribeUnsubscribe_twice_isSubscribedThenNot") {
        SCPublishService service = sc.newPublishService(TestConstants.pubServiceName1);
        service.subscribe(subscibeMessage, new TestPublishServiceMessageCallback(service));
        service.unsubscribe();
        service.subscribe(subscibeMessage, new TestPublishServiceMessageCallback(service));
        service.unsubscribe();

      } else if (getMethodName() == "changeSubscription_twice_passes") {
        SCPublishService service = sc.newPublishService(TestConstants.pubServiceName1);
        service.subscribe(subscibeMessage, new TestPublishServiceMessageCallback(service));

        service.changeSubscription(subscibeMessage);
        service.changeSubscription(subscibeMessage);

        service.unsubscribe();

      } else if (getMethodName() == "unsubscribe_serviceNameValid_notSubscribedEmptySessionId") {
        SCPublishService service = sc.newPublishService(TestConstants.pubServiceName1);
        service.unsubscribe();

      } else if (getMethodName() == "createSession_rejectTheSessionThenCreateValidSessionThenExecuteAMessage_passes") {
        SCSessionService sessionService = sc.newSessionService(TestConstants.pubServiceName1);

        try {
View Full Code Here

Examples of org.serviceconnector.api.cln.SCPublishService

   * Description: receive 2x100 messages in two subscriptions of the same client<br>
   * Expectation: passes
   */
  @Test
  public void t10_receiveTwoSubscriptions() throws Exception {
    SCPublishService service1 = client.newPublishService(TestConstants.pubServiceName1);
    SCPublishService service2 = client.newPublishService(TestConstants.pubServiceName1);

    int nrMessages = 100;
    MsgCallback cbk1 = new MsgCallback(service1);
    cbk1.setExpectedMessages(nrMessages);
    MsgCallback cbk2 = new MsgCallback(service2);
    cbk2.setExpectedMessages(nrMessages);

    SCSubscribeMessage subMsgRequest = new SCSubscribeMessage();
    SCSubscribeMessage subMsgResponse = null;
    subMsgRequest.setMask(TestConstants.mask);
    subMsgRequest.setData(Integer.toString(nrMessages));
    subMsgRequest.setDataLength(((String) subMsgRequest.getData()).length());

    subMsgResponse = service1.subscribe(subMsgRequest, cbk1);
    Assert.assertNotNull("the session ID is null", service1.getSessionId());
    Assert.assertEquals("message body is not the same length", subMsgRequest.getDataLength(), subMsgResponse.getDataLength());
    Assert.assertEquals("compression is not the same", subMsgRequest.isCompressed(), subMsgResponse.isCompressed());
    Assert.assertTrue("is not subscribed", service1.isSubscribed());

    subMsgRequest.setSessionInfo(TestConstants.publishCompressedMsgCmd);
    subMsgResponse = service2.subscribe(subMsgRequest, cbk2);
    Assert.assertNotNull("the session ID is null", service2.getSessionId());
    Assert.assertEquals("message body is not the same length", subMsgRequest.getDataLength(), subMsgResponse.getDataLength());
    Assert.assertEquals("compression is not the same", subMsgRequest.isCompressed(), subMsgResponse.isCompressed());
    Assert.assertTrue("is not subscribed", service2.isSubscribed());

    cbk1.waitForMessage(200);
    Assert.assertEquals("Nr messages does not match", nrMessages, cbk1.getMessageCount());
    SCMessage response = cbk1.getMessage();
    Assert.assertEquals("message body is empty", true, response.getDataLength() > 0);
    cbk2.waitForMessage(200);
    Assert.assertEquals("Nr messages does not match", nrMessages, cbk2.getMessageCount());
    response = cbk2.getMessage();
    Assert.assertEquals("message body is empty", true, response.getDataLength() > 0);

    service1.unsubscribe(4);
    Assert.assertNull("the session ID is not null)", service1.getSessionId());
    service2.unsubscribe(4);
    Assert.assertNull("the session ID is not null)", service2.getSessionId());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.