Search in sources :

Example 6 with ISOMsg

use of org.jpos.iso.ISOMsg in project jPOS by jpos.

the class VISA1PackagerTest method testHandleSpecialField351.

@SuppressWarnings("unchecked")
@Test
public void testHandleSpecialField351() throws Throwable {
    int[] sequence = new int[0];
    VISA1Packager vISA1Packager = new VISA1Packager(sequence, 100, "testVISA1PackagerBadResultCode", "testVISA1PackagerOkPattern");
    Vector v = new Vector(100, 1000);
    int result = vISA1Packager.handleSpecialField35(new ISOMsg(100), v);
    assertEquals("result", 0, result);
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) Vector(java.util.Vector) Test(org.junit.Test)

Example 7 with ISOMsg

use of org.jpos.iso.ISOMsg in project jPOS by jpos.

the class VISA1PackagerTest method testCreateISOMsg.

@Test
public void testCreateISOMsg() throws Throwable {
    int[] sequence = new int[0];
    ISOMsg result = new VISA1Packager(sequence, 100, "testVISA1PackagerBadResultCode", "testVISA1PackagerOkPattern").createISOMsg();
    assertEquals("result.getDirection()", 0, result.getDirection());
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) Test(org.junit.Test)

Example 8 with ISOMsg

use of org.jpos.iso.ISOMsg in project jPOS by jpos.

the class VISA1PackagerTest method testUnpack.

@Test
public void testUnpack() throws Throwable {
    int[] sequence = new int[2];
    ISOComponent m = new ISOMsg(100);
    VISA1Packager vISA1Packager = new VISA1Packager(sequence, 100, "testVISA1PackagerBadResultCode", "");
    byte[] b = new byte[1];
    int result = vISA1Packager.unpack(m, b);
    assertEquals("(ISOMsg) m.getMaxField()", 100, m.getMaxField());
    assertEquals("result", 1, result);
    assertSame("vISA1Packager.filter", vISA1Packager, vISA1Packager.filter);
}
Also used : ISOComponent(org.jpos.iso.ISOComponent) ISOMsg(org.jpos.iso.ISOMsg) Test(org.junit.Test)

Example 9 with ISOMsg

use of org.jpos.iso.ISOMsg in project jPOS by jpos.

the class XMLPackagerTest method testUnpackLargeXmlBytes.

@Test
public void testUnpackLargeXmlBytes() throws IOException, ISOException {
    String veryLongXml = "<large-xml><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element><element><nested-element>Some very very long text</nested-element></element></large-xml>";
    String input = "<isomsg>  <!-- org.jpos.iso.packager.XMLPackager -->" + "<field id=\"0\" value=\"0800\"/>" + "<field id=\"1\"><![CDATA[" + veryLongXml + "]]></field>" + "</isomsg>";
    isoMsg.setHeader("header".getBytes());
    ISOMsg result = xMLPackager.createISOMsg();
    int consumedBytes = xMLPackager.unpack(result, input.getBytes());
    assertThat(result.getString(1), is(veryLongXml));
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) String(java.lang.String) Test(org.junit.Test)

Example 10 with ISOMsg

use of org.jpos.iso.ISOMsg in project jPOS by jpos.

the class XMLPackagerTest method testGetFieldDescription.

@Test
public void testGetFieldDescription() throws Throwable {
    ISOComponent m = new ISOMsg(100);
    String result = xMLPackager.getFieldDescription(m, 100);
    assertEquals("result", "<notavailable/>", result);
}
Also used : ISOComponent(org.jpos.iso.ISOComponent) ISOMsg(org.jpos.iso.ISOMsg) String(java.lang.String) Test(org.junit.Test)

Aggregations

ISOMsg (org.jpos.iso.ISOMsg)223 Test (org.junit.Test)191 LogEvent (org.jpos.util.LogEvent)41 ISOBaseValidator (org.jpos.iso.ISOBaseValidator)30 ISOException (org.jpos.iso.ISOException)29 ISOComponent (org.jpos.iso.ISOComponent)25 ISOVMsg (org.jpos.iso.ISOVMsg)22 ISOFieldValidator (org.jpos.iso.ISOFieldValidator)21 Context (org.jpos.transaction.Context)20 ISOValidator (org.jpos.iso.ISOValidator)18 Result (org.jpos.rc.Result)17 SimpleConfiguration (org.jpos.core.SimpleConfiguration)15 ISOFieldPackager (org.jpos.iso.ISOFieldPackager)12 TEST0100 (org.jpos.iso.validator.TEST0100)12 FileInputStream (java.io.FileInputStream)9 Vector (java.util.Vector)9 PostChannel (org.jpos.iso.channel.PostChannel)9 MSGTEST (org.jpos.iso.validator.MSGTEST)9 MSGTEST02 (org.jpos.iso.validator.MSGTEST02)9 ISOFilter (org.jpos.iso.ISOFilter)8