Package org.jpos.tlv

Examples of org.jpos.tlv.GenericTagSequence


    @Test
    public void testPacking() throws ISOException, FileNotFoundException {

        ISOMsg msg = new ISOMsg("0100");

        GenericTagSequence tagValueSequence = new GenericTagSequence();

        tagValueSequence.add(new LiteralTagValue("0012", "19960930000000"));
        tagValueSequence.add(new LiteralTagValue("0165", "M"));
        tagValueSequence.add(new LiteralTagValue("0023", "CT2"));

        ISOMsg field48 = new ISOMsg(48);

        tagValueSequence.writeTo(field48);

        msg.set(field48);

        msg.recalcBitMap();
View Full Code Here


    @Test
    public void testPackingWithISOField() throws ISOException, FileNotFoundException {

        ISOMsg msg = new ISOMsg("0100");

        GenericTagSequence tagValueSequence = new GenericTagSequence();


        ISOMsg field48 = new ISOMsg(48);
        field48.set("12", "19960930000000");
        field48.set("0165", "M");
        field48.set("23", "CT2");

        tagValueSequence.writeTo(field48);

        msg.set(field48);

        msg.recalcBitMap();
View Full Code Here

    @Test
    public void testPacking2() throws ISOException, FileNotFoundException {

        ISOMsg msg = new ISOMsg("0100");

        GenericTagSequence tagValueSequence = new GenericTagSequence();

        tagValueSequence.add(new LiteralTagValue("12", "A"));

        ISOMsg field64 = new ISOMsg(64);

        field64.set(new ISOField(0, "R"));

        tagValueSequence.writeTo(field64);

        msg.set(field64);

        msg.recalcBitMap();
View Full Code Here

    @Test
    public void testPackingWithPrefixes() throws ISOException, FileNotFoundException {

        ISOMsg msg = new ISOMsg("0100");

        GenericTagSequence tagValueSequence = new GenericTagSequence();

        tagValueSequence.add(new LiteralTagValue("0012", "19960930000000"));
        tagValueSequence.add(new LiteralTagValue("0165", "M"));
        tagValueSequence.add(new LiteralTagValue("0023", "CT2"));

        ISOMsg field63 = new ISOMsg(63);
        field63.set(new ISOField(0, "M"));
        tagValueSequence.writeTo(field63);

        msg.set(field63);

        msg.recalcBitMap();
View Full Code Here

    @Test
    public void testPackingSpanningMultipleFields() throws ISOException, FileNotFoundException {

        ISOMsg msg = new ISOMsg("0100");

        GenericTagSequence tagValueSequence = new GenericTagSequence();

        tagValueSequence.add(new LiteralTagValue("0012", "19960930000000"));
        tagValueSequence.add(new LiteralTagValue("0165", "M"));
        tagValueSequence.add(new LiteralTagValue("0023", "CT2"));
        tagValueSequence.add(new LiteralTagValue("0170", "1-800-555-1212"));

        ISOMsg field48 = new ISOMsg(48);
        tagValueSequence.writeTo(field48);
        ISOMsgRef isoMsgRef = new ISOMsgRef(field48);
        msg.set(isoMsgRef.reference(48));

        msg.set(isoMsgRef.reference(62));

        msg.recalcBitMap();

        GenericPackager packager = new GenericPackager(new FileInputStream("build/resources/test/org/jpos/tlv/tagged-sequence-packager.xml"));
        msg.setPackager(packager);

        byte[] packed = packager.pack(msg);

        //skip 4 byte MTI and 8 byte Primary BitMap
        byte[] field48Packed = new byte[packed.length - 12];
        System.arraycopy(packed, 12, field48Packed, 0, field48Packed.length);

        Assert.assertEquals("Pack error", 66, field48Packed.length);

        Assert.assertEquals("Pack error", "0390012014199609300000000023003CT20165001M02101700141-800-555-1212", new String(field48Packed));

        msg = new ISOMsg();
        packager.unpack(msg, packed);

        tagValueSequence = new GenericTagSequence();
        tagValueSequence.readFrom((ISOMsg) msg.getComponent(48));
        tagValueSequence.readFrom((ISOMsg) msg.getComponent(62));

        Assert.assertEquals("Unpack error", 4, tagValueSequence.getAll().size());

        msg.recalcBitMap();
        packed = packager.pack(msg);

        //skip 4 byte MTI and 8 byte Primary BitMap
View Full Code Here

TOP

Related Classes of org.jpos.tlv.GenericTagSequence

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.