Examples of IEncoderDecoder


Examples of org.serviceconnector.net.IEncoderDecoder

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

    byte[] buffer = requestString.getBytes();
    InputStream is = new ByteArrayInputStream(buffer);
    IEncoderDecoder coder = coderFactory.createEncoderDecoder(new SCMPPart(SCMPVersion.CURRENT));

    SCMPMessage message = null;
    try {
      message = (SCMPMessage) coder.decode(is);
    } catch (Exception e) {
      Assert.fail("Should not throw exception");
    }
    if (message.isFault() == false) {
      Assert.fail("scmp should be of type fault");
View Full Code Here

Examples of org.serviceconnector.net.IEncoderDecoder

    String requestString = "garbe /s=69& SCMP/1.0\n" + "bty=" + bodyType.getValue() + "\n" + "msn=" + msgSequenceNr + "\n"
        + "mty=" + msgType.getValue() + "\n" + body;

    byte[] buffer = requestString.getBytes();
    InputStream is = new ByteArrayInputStream(buffer);
    IEncoderDecoder coder = coderFactory.createEncoderDecoder(new SCMPPart(SCMPVersion.CURRENT));

    try {
      coder.decode(is);
      Assert.fail("Should throw exception");
    } catch (Exception e) {
      Assert.assertEquals("wrong protocol in message not possible to decode", e.getMessage());
    }
  }
View Full Code Here

Examples of org.serviceconnector.net.IEncoderDecoder

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

    byte[] buffer = requestString.getBytes();
    InputStream is = new ByteArrayInputStream(buffer);
    IEncoderDecoder coder = coderFactory.createEncoderDecoder(new SCMPPart(SCMPVersion.CURRENT));

    SCMPMessage message = null;
    try {
      message = (SCMPMessage) coder.decode(is);
    } catch (Exception e) {
      Assert.fail("Should not throw exception");
    }
    verifySCMP(message);
    if (message.isPart() == false) {
View Full Code Here

Examples of org.serviceconnector.net.IEncoderDecoder

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

    byte[] buffer = requestString.getBytes();
    InputStream is = new ByteArrayInputStream(buffer);
    IEncoderDecoder coder = coderFactory.createEncoderDecoder(new SCMPPart(SCMPVersion.CURRENT));

    SCMPMessage message = null;
    try {
      message = (SCMPMessage) coder.decode(is);
    } catch (Exception e) {
      Assert.fail("Should not throw exception");
    }
    verifySCMP(message);
    if (message.isPart() == false) {
View Full Code Here

Examples of org.serviceconnector.net.IEncoderDecoder

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

    byte[] buffer = requestString.getBytes();
    InputStream is = new ByteArrayInputStream(buffer);
    IEncoderDecoder coder = coderFactory.createEncoderDecoder(new SCMPPart(SCMPVersion.CURRENT));

    SCMPMessage message = null;
    try {
      message = (SCMPMessage) coder.decode(is);
    } catch (Exception e) {
      Assert.fail("Should not throw exception");
    }
    verifySCMP(message);

    bodyType = SCMPBodyType.TEXT;
    header = "bty=" + bodyType.getValue() + "\n" + "msn=" + msgSequenceNr + "\n" + "mty=" + msgType.getValue() + "\n";

    requestString = TestUtil.getSCMPString(headKey, header, body);

    buffer = requestString.getBytes();
    is = new ByteArrayInputStream(buffer);
    coder = coderFactory.createEncoderDecoder(new SCMPPart(SCMPVersion.CURRENT));

    message = null;
    try {
      message = (SCMPMessage) coder.decode(is);
    } catch (Exception e) {
      Assert.fail("Should not throw exception");
    }
    verifySCMPStringBody(message);
  }
View Full Code Here

Examples of org.serviceconnector.net.IEncoderDecoder

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

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

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

    OutputStream os = new ByteArrayOutputStream();
    try {
      coder.encode(os, encodeScmp);
    } catch (Exception e) {
      Assert.fail("Should not throw exception");
    }
    Assert.assertEquals(expectedString, os.toString());
  }
View Full Code Here

Examples of org.serviceconnector.net.IEncoderDecoder

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

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

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

    SCMPMessage encodeRes = new SCMPMessage(SCMPVersion.CURRENT);
    encodeRes.setIsReply(true);
    encodeRes.setHeader(encodeScmp);
    encodeRes.setBody(body.getBytes());

    OutputStream os = new ByteArrayOutputStream();
    try {
      coder.encode(os, encodeRes);
    } catch (Exception e) {
      Assert.fail("Should not throw exception");
    }
    Assert.assertEquals(expectedString, os.toString());
  }
View Full Code Here

Examples of org.serviceconnector.net.IEncoderDecoder

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

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

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

    SCMPMessage encodeExc = new SCMPMessageFault(SCMPVersion.CURRENT);
    encodeExc.setHeader(encodeScmp);
    encodeExc.setBody(body.getBytes());

    OutputStream os = new ByteArrayOutputStream();
    try {
      coder.encode(os, encodeExc);
    } catch (Exception e) {
      Assert.fail("Should not throw exception");
    }
    Assert.assertEquals(expectedString, os.toString());
  }
View Full Code Here

Examples of org.serviceconnector.net.IEncoderDecoder

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

    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(SCMPVersion.CURRENT);
    encodeRes.setHeader(encodeScmp);
    encodeRes.setBody(body.getBytes());

    OutputStream os = new ByteArrayOutputStream();
    try {
      coder.encode(os, encodeRes);
    } catch (Exception e) {
      Assert.fail("Should not throw exception");
    }
    Assert.assertEquals(expectedString, os.toString());
  }
View Full Code Here

Examples of org.serviceconnector.net.IEncoderDecoder

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

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

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

    SCMPMessage encodeRes = new SCMPPart(SCMPVersion.CURRENT);
    encodeRes.setIsReply(true);
    encodeRes.setHeader(encodeScmp);
    encodeRes.setBody(body.getBytes());

    OutputStream os = new ByteArrayOutputStream();
    try {
      coder.encode(os, encodeRes);
    } catch (Exception e) {
      Assert.fail("Should not throw exception");
    }
    Assert.assertEquals(expectedString, os.toString());
  }
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.