Package org.jpos.iso.packager

Examples of org.jpos.iso.packager.GenericPackager


  StatefulFilter statefulFilter = new StatefulFilter();
  statefulFilter.setKey(key);
  statefulFilter.setSpace((Space) null);
  try {
      statefulFilter.filter(new CSChannel("testStatefulFilterHost", 100,
        new GenericPackager()),
        new ISOMsg("testStatefulFilterMti"), new LogEvent(
          "testStatefulFilterTag", "testString"));
      fail("Expected NullPointerException to be thrown");
  } catch (NullPointerException ex) {
      assertNull("ex.getMessage()", ex.getMessage());
View Full Code Here


        msg.set(field48);

        msg.recalcBitMap();

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

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

        // 30313030
        // 00 00 00 00 00 01 00 00
        // 30 32 30
        // 50 02 51 32
        // 5a 07 19 96 09 30 00 00 00
        // 9f 12 04 4a 50 4f 53
        System.out.println("Packed: " + ISOUtil.byte2hex(packed));

        //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", 29, field48Packed.length);
        //
        Assert.assertEquals("Pack error", "303236500251325a08999999123456789f5f2a0208409f12044a504f53", ISOUtil.byte2hex(field48Packed));
        //Assert.assertEquals("Pack error", "303235500251325a079999991234567895f2a0208409f12044a504f53", ISOUtil.byte2hex(field48Packed));

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

        msg.recalcBitMap();

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

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

        String tag1 = EMVStandardTagType.APPLICATION_PRIMARY_ACCOUNT_NUMBER_0x5A.getTagNumberHex();
        LiteralEMVTag pan = (LiteralEMVTag) tagValueSequence.getFirst(tag1);
        Assert.assertEquals("Unpack error", "999999123456789", pan.getValue());

        String tag2 = EMVStandardTagType.APPLICATION_PREFERRED_NAME_0x9F12.getTagNumberHex();
        LiteralEMVTag name = (LiteralEMVTag) tagValueSequence.getFirst(tag2);
        Assert.assertEquals("Unpack error", "JPOS", name.getValue());

        String tag3 = EMVStandardTagType.APPLICATION_LABEL_0x50.getTagNumberHex();
        LiteralEMVTag label = (LiteralEMVTag) tagValueSequence.getFirst(tag3);
        Assert.assertEquals("Unpack error", "Q2", label.getValue());

        String tag4 = EMVStandardTagType.TRANSACTION_CURRENCY_CODE_0x5F2A.getTagNumberHex();
        LiteralEMVTag currency = (LiteralEMVTag) tagValueSequence.getFirst(tag4);
        Assert.assertEquals("Unpack error", "840", currency.getValue());

        packed = packager.pack(msg);

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

        msg.set(field48);

        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", 42, field48Packed.length);

        Assert.assertEquals("Pack error", "0390012014199609300000000023003CT20165001M", new String(field48Packed));

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

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

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

        msg.set(field48);

        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", 42, field48Packed.length);

        Assert.assertEquals("Pack error", "0390012014199609300000000023003CT20165001M", new String(field48Packed));

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

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

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

        msg.set(field64);

        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[] field64Packed = new byte[packed.length - 12];
        System.arraycopy(packed, 12, field64Packed, 0, field64Packed.length);

        Assert.assertEquals("Pack error", 9, field64Packed.length);

        Assert.assertEquals("Pack error", "006R1201A", new String(field64Packed));

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

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

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

        msg.set(field63);

        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", 43, field48Packed.length);

        Assert.assertEquals("Pack error", "040M0012014199609300000000023003CT20165001M", new String(field48Packed));

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

        packed = packager.pack(msg);

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

        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
        field48Packed = new byte[packed.length - 12];
        System.arraycopy(packed, 12, field48Packed, 0, field48Packed.length);
View Full Code Here

public class HEXChannelTest {

    @Test
    public void testConstructor() throws Throwable {
        ISOPackager p = new GenericPackager();
        byte[] TPDU = new byte[3];
        HEXChannel hEXChannel = new HEXChannel("testHEXChannelHost", 100, p, TPDU);
        assertEquals("hEXChannel.getIncomingFilters().size()", 0, hEXChannel.getIncomingFilters().size());
        assertEquals("hEXChannel.getMaxPacketLength()", 100000, hEXChannel.getMaxPacketLength());
        assertSame("hEXChannel.getPackager()", p, hEXChannel.getPackager());
View Full Code Here

        }
    }

    @Test
    public void testCreateISOMsg() throws Throwable {
        ISOPackager p = new GenericPackager();
        BaseChannel pADChannel = new PADChannel(p);
        ISOMsg result = pADChannel.createMsg();
        assertEquals("result.getDirection()", 0, result.getDirection());
        assertSame("(PADChannel) pADChannel.packager", p, ((PADChannel) pADChannel).packager);
    }
View Full Code Here

        }
    }

    @Test
    public void testGetChannel() throws Throwable {
        BaseChannel aSCIIChannel = new ASCIIChannel(new GenericPackager(), new ServerSocket());
        aSCIIChannel.setName("channel.");
        BaseChannel result = (BaseChannel) BaseChannel.getChannel("channel.");
        assertSame("result", aSCIIChannel, result);
    }
View Full Code Here

TOP

Related Classes of org.jpos.iso.packager.GenericPackager

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.