Package org.serviceconnector.scmp

Examples of org.serviceconnector.scmp.SCMPPart


   * Description: Encode PRQ test<br>
   * Expectation: passes
   */
  @Test
  public void t23_EncodePRQTest() {
    IEncoderDecoder coder = coderFactory.createEncoderDecoder(new SCMPPart());

    this.headKey = SCMPHeaderKey.PRQ;
    String header = "msn=" + msgSequenceNr + "\n" + "bty=" + bodyType.getValue() + "\n" + "mty=" + msgType.getValue() + "\n";

    String expectedString = TestUtil.getSCMPString(headKey, header, body);

    SCMPMessage encodeRes = new SCMPPart();
    encodeRes.setHeader(encodeScmp);
    encodeRes.setBody(body.getBytes());

    OutputStream os = new ByteArrayOutputStream();
    try {
      coder.encode(os, encodeRes);
    } catch (Exception e) {
View Full Code Here


    SCMPMessage request = new SCMPMessage();
    request.setBody("request");
    request.setMessageType(SCMPMsgType.CLN_EXECUTE);

    SCMPPart firstPart = new SCMPPart(false);
    String bodyString = "first part request";
    firstPart.setBody(bodyString);
    SCMPCompositeReceiver largeResponse = new SCMPCompositeReceiver(request, firstPart);

    bodyLength += bodyString.length();
    body.append(bodyString);
    Assert.assertEquals(bodyLength, largeResponse.getOffset());

    for (int i = 0; i < 10; i++) {
      SCMPPart part = new SCMPPart();
      bodyString = "part nr: " + i;
      part.setBody(bodyString);
      largeResponse.add(part);
      bodyLength += bodyString.length();
      body.append(bodyString);
      Assert.assertEquals(bodyLength, largeResponse.getOffset());
    }
View Full Code Here

    SCMPMessage scmpReply = null;
    if (scmpReq.isPart()) {
      // received message part - request not complete yet
      largeRequest.incomplete();
      // set up poll response - SCMP Version request
      scmpReply = new SCMPPart(scmpReq.getSCMPVersion(), true);
      scmpReply.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSequenceNr.incrementAndGetMsgSequenceNr());
      scmpReply.setIsReply(true);
      scmpReply.setMessageType(scmpReq.getMessageType());
    } else {
      // last message of a chunk message received - request complete now
View Full Code Here

              + subscriptionId);
          // set up reply
          SCMPMessage reply = null;
          if (message.isPart()) {
            // message from queue is of type part - outgoing must be part too, no poll request
            reply = new SCMPPart(message.getSCMPVersion(), false, message.getHeader());
          } else {
            reply = new SCMPMessage(message.getSCMPVersion(), message.getHeader());
          }
          reply.setSessionId(subscriptionId);
          reply.setMessageType(reqMsg.getMessageType());
View Full Code Here

      boolean largeResponsePolling) {

    SCMPMessage req = null;
    if (largeResponsePolling == true) {
      // SCMP Version current
      req = new SCMPPart(SCMPVersion.CURRENT, true);
    } else {
      // SCMP Version current
      req = new SCMPMessage(SCMPVersion.CURRENT);
    }
    long msgSeqNr = cascClient.getMsgSequenceNr().incrementAndGetMsgSequenceNr();
View Full Code Here

    case KRQ:
      scmpMsg = new SCMPKeepAlive(receivedVersion);
      return scmpMsg;
    case PRQ:
      // no poll request
      scmpMsg = new SCMPPart(receivedVersion, false);
      scmpMsg.setIsReply(false);
      break;
    case PRS:
      // no poll response
      scmpMsg = new SCMPPart(receivedVersion, false);
      scmpMsg.setIsReply(true);
      break;
    case PAC:
      // poll request
      scmpMsg = new SCMPPart(receivedVersion, true);
      break;
    case EXC:
      scmpMsg = new SCMPMessageFault(receivedVersion);
      break;
    case UNDEF:
View Full Code Here

    if (scmpReq.isPart()) {
      // received message part - request not complete yet
      largeRequest.incomplete();
      // set up poll response - SCMP Version request
      SCMPMessage scmpReply = new SCMPPart(scmpReq.getSCMPVersion(), true);
      scmpReply.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSequenceNr.incrementAndGetMsgSequenceNr());
      scmpReply.setIsReply(true);
      scmpReply.setMessageType(scmpReq.getMessageType());
      response.setSCMP(scmpReply);
    } else {
      // last message of a chunk message received - request complete now
      largeRequest.complete();
      largeRequest.setHeader(SCMPHeaderAttributeKey.MESSAGE_SEQUENCE_NR, msgSequenceNr.incrementAndGetMsgSequenceNr());
View Full Code Here

      session.stopStreaming();
      // SCMP Version request
      reply = new SCMPMessage(message.getSCMPVersion());
    } else {
      // set up poll request - SCMP Version request
      reply = new SCMPPart(message.getSCMPVersion(), true);
    }
    return reply;
  }
View Full Code Here

      session.getHttpURLConnection().disconnect();
      session.stopStreaming();
      return reply;
    }
    // set up part request, no poll request - SCMP Version request
    reply = new SCMPPart(message.getSCMPVersion(), false);
    reply.setBody(fullBuffer, 0, readBytes);
    return reply;
  }
View Full Code Here

TOP

Related Classes of org.serviceconnector.scmp.SCMPPart

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.