Package org.serviceconnector.call

Examples of org.serviceconnector.call.SCMPClnSubscribeCall


    ValidatorUtility.validateMask(mask, SCMPError.HV_WRONG_MASK);
    this.messageCallback = scMessageCallback;
    this.requester.getSCMPMsgSequenceNr().reset();
    // 2. initialize call & invoke
    SCServiceCallback callback = new SCServiceCallback(true);
    SCMPClnSubscribeCall subscribeCall = new SCMPClnSubscribeCall(this.requester, this.serviceName);
    subscribeCall.setMask(scSubscribeMessage.getMask());
    subscribeCall.setSessionInfo(scSubscribeMessage.getSessionInfo());
    subscribeCall.setNoDataIntervalSeconds(scSubscribeMessage.getNoDataIntervalSeconds());
    subscribeCall.setCompressed(scSubscribeMessage.isCompressed());
    subscribeCall.setRequestBody(scSubscribeMessage.getData());
    try {
      subscribeCall.invoke(callback, operationTimeoutSeconds * Constants.SEC_TO_MILLISEC_FACTOR);
    } catch (Exception e) {
      throw new SCServiceException("Subscribe failed.", e);
    }
    // 3. receiving reply and error handling
    SCMPMessage reply = callback.getMessageSync(operationTimeoutSeconds * Constants.SEC_TO_MILLISEC_FACTOR);
 
View Full Code Here


   * Description: change subscription twice, second one fails because there is no free connection<br>
   * Expectation: passes
   */
  @Test
  public void t20_ChangeTwiceFailsNoFreeConnection() throws Exception {
    SCMPClnSubscribeCall subscribeCall = new SCMPClnSubscribeCall(this.requester, TestConstants.pubServerName1);

    subscribeCall.setSessionInfo(TestConstants.publishCompressedMsgCmd);
    subscribeCall.setNoDataIntervalSeconds(10);
    subscribeCall.setMask(TestConstants.mask);
    subscribeCall.setRequestBody("100");
    TestCallback cbk = new TestCallback();
    subscribeCall.invoke(cbk, 1300);
    SCMPMessage reply = cbk.getMessageSync(1300);
    TestUtil.checkReply(reply);
    String sessionId = reply.getSessionId();

    SCMPClnChangeSubscriptionCall changeSubscriptionCall = new SCMPClnChangeSubscriptionCall(this.requester,
View Full Code Here

   * Description: subscribe - waits 2 seconds - another subscribe fails because no free server is available<br>
   * Expectation: passes
   */
  @Override
  public void t30_FailsNoFreeServer() throws Exception {
    SCMPClnSubscribeCall subscribeCall = new SCMPClnSubscribeCall(this.requester, TestConstants.pubServerName1);

    subscribeCall.setSessionInfo(TestConstants.sleepCmd);
    subscribeCall.setNoDataIntervalSeconds(10);
    subscribeCall.setMask(TestConstants.mask);
    TestCallback cbk = new TestCallback();
    TestCallback cbk1 = new TestCallback();
    subscribeCall.setRequestBody("3000");
    subscribeCall.invoke(cbk, 5000);
    subscribeCall.invoke(cbk1, 5000);
    Thread.sleep(100);
    subscribeCall = new SCMPClnSubscribeCall(this.requester, TestConstants.pubServerName1);

    subscribeCall.setNoDataIntervalSeconds(10);
    subscribeCall.setMask(TestConstants.mask);
    TestCallback cbk3 = new TestCallback();
    subscribeCall.invoke(cbk3, 2000);

    SCMPMessage reply = cbk.getMessageSync(5000);
    SCMPMessage reply1 = cbk1.getMessageSync(4000);
    SCMPMessage reply3 = cbk3.getMessageSync(4000);
    String sessionId = reply.getSessionId();
View Full Code Here

   * Description: This test fills the messageQueue with 100'000 messages<br>
   * Expectation: passes, SC should work properly with 100'000 messages
   */
  @Test
  public void t50_FillMessageQueueWith100000Messages() throws Exception {
    SCMPClnSubscribeCall subscribeCall = new SCMPClnSubscribeCall(this.requester, TestConstants.pubServerName1);

    subscribeCall.setNoDataIntervalSeconds(10);
    subscribeCall.setSessionInfo(TestConstants.publishMsgWithDelayCmd);
    subscribeCall.setMask(TestConstants.mask);
    subscribeCall.setRequestBody("100003|1");
    TestCallback cbk = new TestCallback(true);
    subscribeCall.invoke(cbk, 2000);
    SCMPMessage reply = cbk.getMessageSync(2000);
    TestUtil.checkReply(reply);
    String sessionId = reply.getSessionId();

    Thread.sleep(55000);
View Full Code Here

   * Description: subscribe, receive publication no data message, change subscription, get message and unsubscribe<br>
   * Expectation: passes
   */
  @Test
  public void t01_GetMessageAfterChange() throws Exception {
    SCMPClnSubscribeCall subscribeCall = new SCMPClnSubscribeCall(this.requester, TestConstants.pubServerName1);

    subscribeCall.setSessionInfo(TestConstants.publishMsgWithDelayCmd);
    subscribeCall.setNoDataIntervalSeconds(10);
    // mask does not match
    subscribeCall.setMask(TestConstants.mask1);
    // publish 10 messages, wait 11 second after publish each message
    subscribeCall.setRequestBody("10|11000");
    TestCallback cbk = new TestCallback(true);
    subscribeCall.invoke(cbk, 3000);
    SCMPMessage reply = cbk.getMessageSync(2000);
    TestUtil.checkReply(reply);
    String sessionId = reply.getSessionId();

    // receive publication - no data
View Full Code Here

   * Description: subscribe - receive publication call no data received<br>
   * Expectation: passes
   */
  @Test
  public void t10_ReceiveNoData() throws Exception {
    SCMPClnSubscribeCall subscribeCall = new SCMPClnSubscribeCall(this.requester, TestConstants.pubServerName1);

    subscribeCall.setNoDataIntervalSeconds(10);
    subscribeCall.setMask(TestConstants.mask);
    TestCallback cbk = new TestCallback();
    subscribeCall.invoke(cbk, 3000);
    SCMPMessage reply = cbk.getMessageSync(3000);
    TestUtil.checkReply(reply);
    String sessionId = reply.getSessionId();
    // receive publication - no data
    SCMPReceivePublicationCall receivePublicationCall = new SCMPReceivePublicationCall(this.requester,
View Full Code Here

   * Description: subscribe - receive publication call message received<br>
   * Expectation: passes
   */
  @Test
  public void t11_ReceiveMessage() throws Exception {
    SCMPClnSubscribeCall subscribeCall = new SCMPClnSubscribeCall(this.requester, TestConstants.pubServerName1);

    subscribeCall.setNoDataIntervalSeconds(10);
    subscribeCall.setSessionInfo(TestConstants.publishUncompressedMsgCmd);
    subscribeCall.setMask(TestConstants.mask);
    subscribeCall.setRequestBody("5");
    TestCallback cbk = new TestCallback();
    subscribeCall.invoke(cbk, 2000);
    SCMPMessage reply = cbk.getMessageSync(2000);
    TestUtil.checkReply(reply);
    String sessionId = reply.getSessionId();

    // receive publication - get message
View Full Code Here

   * out. It differs from direct test.<br>
   * Expectation: passes
   */
  @Test
  public void t30_FailsNoFreeServer() throws Exception {
    SCMPClnSubscribeCall subscribeCall = new SCMPClnSubscribeCall(this.requester, TestConstants.pubServerName1);

    subscribeCall.setSessionInfo(TestConstants.sleepCmd);
    subscribeCall.setNoDataIntervalSeconds(10);
    subscribeCall.setMask(TestConstants.mask);
    TestCallback cbk = new TestCallback();
    subscribeCall.setRequestBody("3000");
    subscribeCall.invoke(cbk, 6000);

    Thread.sleep(100);
    subscribeCall = new SCMPClnSubscribeCall(this.requester, TestConstants.pubServerName1);

    subscribeCall.setNoDataIntervalSeconds(10);
    subscribeCall.setMask(TestConstants.mask);
    TestCallback cbk1 = new TestCallback();
    subscribeCall.invoke(cbk1, 2000);

    SCMPMessage reply = cbk.getMessageSync(6000);
    SCMPMessage reply1 = cbk1.getMessageSync(4000);
    String sessionId = reply.getSessionId();

View Full Code Here

   * Description: subscribe - receives large message<br>
   * Expectation: passes
   */
  @Test
  public void t40_GetLargeMessage() throws Exception {
    SCMPClnSubscribeCall subscribeCall = new SCMPClnSubscribeCall(this.requester, TestConstants.pubServerName1);

    subscribeCall.setSessionInfo(TestConstants.publishLargeMsgCmd);
    subscribeCall.setNoDataIntervalSeconds(10);
    subscribeCall.setMask(TestConstants.mask);
    subscribeCall.setRequestBody("get large message");
    TestCallback cbk = new TestCallback();
    subscribeCall.invoke(cbk, 10000);
    SCMPMessage reply = cbk.getMessageSync(3000);
    TestUtil.checkReply(reply);
    String sessionId = reply.getSessionId();

    SCMPReceivePublicationCall receivePublicationCall = new SCMPReceivePublicationCall(this.requester,
View Full Code Here

   * Description: subscribe - receive publication call message received and wait to long, subscription times out<br>
   * Expectation: passes
   */
  @Test
  public void t43_SlowClient_SubscriptionTimesOut() throws Exception {
    SCMPClnSubscribeCall subscribeCall = new SCMPClnSubscribeCall(this.requester, TestConstants.pubServerName1);

    subscribeCall.setNoDataIntervalSeconds(10);
    subscribeCall.setSessionInfo(TestConstants.publishUncompressedMsgCmd);
    subscribeCall.setMask(TestConstants.mask);
    subscribeCall.setRequestBody("5");
    TestCallback cbk = new TestCallback();
    subscribeCall.invoke(cbk, 2000);
    SCMPMessage reply = cbk.getMessageSync(1000);
    TestUtil.checkReply(reply);
    String sessionId = reply.getSessionId();

    // receive publication - get message
View Full Code Here

TOP

Related Classes of org.serviceconnector.call.SCMPClnSubscribeCall

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.