Examples of IEncoderDecoder


Examples of org.serviceconnector.net.IEncoderDecoder

   * Description: Encode body types test<br>
   * Expectation: passes
   */
  @Test
  public void t13_EncodeBodyTypesTest() {
    IEncoderDecoder coder = coderFactory.createEncoderDecoder(encodeScmp);

    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());

    coder = coderFactory.createEncoderDecoder(encodeScmp);
    bodyType = SCMPBodyType.TEXT;
    encodeScmp.setHeader(SCMPHeaderAttributeKey.BODY_TYPE, bodyType.getValue());

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

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

    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
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.