Search in sources :

Example 41 with ISOPackager

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

the class HEXChannelTest method testConstructor3.

@Test
public void testConstructor3() throws Throwable {
    ISOPackager p = new ISOBaseValidatingPackager();
    byte[] TPDU = new byte[2];
    ServerSocket serverSocket = new ServerSocket();
    HEXChannel hEXChannel = new HEXChannel(p, TPDU, serverSocket);
    assertEquals(0, hEXChannel.getIncomingFilters().size(), "hEXChannel.getIncomingFilters().size()");
    assertEquals(100000, hEXChannel.getMaxPacketLength(), "hEXChannel.getMaxPacketLength()");
    assertSame(p, hEXChannel.getPackager(), "hEXChannel.getPackager()");
    assertEquals(0, hEXChannel.getPort(), "hEXChannel.getPort()");
    assertEquals("", hEXChannel.getName(), "hEXChannel.getName()");
    assertEquals(3, hEXChannel.getCounters().length, "hEXChannel.getCounters().length");
    assertNull(hEXChannel.getLogger(), "hEXChannel.getLogger()");
    assertNull(hEXChannel.getSocketFactory(), "hEXChannel.getSocketFactory()");
    assertSame(TPDU, hEXChannel.getHeader(), "hEXChannel.getHeader()");
    assertEquals(0, hEXChannel.getOutgoingFilters().size(), "hEXChannel.getOutgoingFilters().size()");
    assertSame(serverSocket, hEXChannel.getServerSocket(), "hEXChannel.getServerSocket()");
    assertEquals("org.jpos.iso.channel.HEXChannel", hEXChannel.getOriginalRealm(), "hEXChannel.getOriginalRealm()");
    assertNull(hEXChannel.getRealm(), "hEXChannel.getRealm()");
    assertNull(hEXChannel.getHost(), "hEXChannel.getHost()");
}
Also used : ISOPackager(org.jpos.iso.ISOPackager) ISOBaseValidatingPackager(org.jpos.iso.packager.ISOBaseValidatingPackager) ServerSocket(java.net.ServerSocket) Test(org.junit.jupiter.api.Test)

Example 42 with ISOPackager

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

the class NativePackager method pack.

@Override
public byte[] pack(ISOComponent c) throws ISOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {
        if (c instanceof ISOMsg) {
            ISOMsg m = (ISOMsg) c;
            ISOPackager p = m.getPackager();
            m.setPackager(null);
            ObjectOutputStream os = new ObjectOutputStream(baos);
            ((Externalizable) c).writeExternal(os);
            os.flush();
            m.setPackager(p);
        }
    } catch (IOException e) {
        throw new ISOException(e);
    }
    return baos.toByteArray();
}
Also used : ISOPackager(org.jpos.iso.ISOPackager) ISOException(org.jpos.iso.ISOException) ISOMsg(org.jpos.iso.ISOMsg)

Example 43 with ISOPackager

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

the class PADChannelTest method testConstructor1.

@Test
public void testConstructor1() throws Throwable {
    ISOPackager p = new ISO93BPackager();
    ServerSocket serverSocket = new ServerSocket();
    PADChannel pADChannel = new PADChannel(p, serverSocket);
    assertEquals(0, pADChannel.getIncomingFilters().size(), "pADChannel.getIncomingFilters().size()");
    assertEquals(100000, pADChannel.getMaxPacketLength(), "pADChannel.getMaxPacketLength()");
    assertSame(p, pADChannel.getPackager(), "pADChannel.getPackager()");
    assertEquals(0, pADChannel.getPort(), "pADChannel.getPort()");
    assertEquals("", pADChannel.getName(), "pADChannel.getName()");
    assertEquals(3, pADChannel.getCounters().length, "pADChannel.getCounters().length");
    assertNull(pADChannel.getLogger(), "pADChannel.getLogger()");
    assertNull(pADChannel.getSocketFactory(), "pADChannel.getSocketFactory()");
    assertNull(pADChannel.getHeader(), "pADChannel.getHeader()");
    assertEquals(0, pADChannel.getOutgoingFilters().size(), "pADChannel.getOutgoingFilters().size()");
    assertSame(serverSocket, pADChannel.getServerSocket(), "pADChannel.getServerSocket()");
    assertEquals("org.jpos.iso.channel.PADChannel", pADChannel.getOriginalRealm(), "pADChannel.getOriginalRealm()");
    assertNull(pADChannel.getRealm(), "pADChannel.getRealm()");
    assertNull(pADChannel.getHost(), "pADChannel.getHost()");
    assertNull(pADChannel.reader, "pADChannel.reader");
}
Also used : ISOPackager(org.jpos.iso.ISOPackager) ISO93BPackager(org.jpos.iso.packager.ISO93BPackager) ServerSocket(java.net.ServerSocket) Test(org.junit.jupiter.api.Test)

Example 44 with ISOPackager

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

the class PADChannelTest method testConstructor.

@Test
public void testConstructor() throws Throwable {
    ISOPackager p = new ISOBaseValidatingPackager();
    PADChannel pADChannel = new PADChannel("testPADChannelHost", 100, p);
    assertEquals(0, pADChannel.getIncomingFilters().size(), "pADChannel.getIncomingFilters().size()");
    assertEquals(100000, pADChannel.getMaxPacketLength(), "pADChannel.getMaxPacketLength()");
    assertSame(p, pADChannel.getPackager(), "pADChannel.getPackager()");
    assertEquals(100, pADChannel.getPort(), "pADChannel.getPort()");
    assertEquals("", pADChannel.getName(), "pADChannel.getName()");
    assertEquals(3, pADChannel.getCounters().length, "pADChannel.getCounters().length");
    assertNull(pADChannel.getLogger(), "pADChannel.getLogger()");
    assertNull(pADChannel.getSocketFactory(), "pADChannel.getSocketFactory()");
    assertNull(pADChannel.getHeader(), "pADChannel.getHeader()");
    assertEquals(0, pADChannel.getOutgoingFilters().size(), "pADChannel.getOutgoingFilters().size()");
    assertNull(pADChannel.getServerSocket(), "pADChannel.getServerSocket()");
    assertEquals("org.jpos.iso.channel.PADChannel", pADChannel.getOriginalRealm(), "pADChannel.getOriginalRealm()");
    assertNull(pADChannel.getRealm(), "pADChannel.getRealm()");
    assertEquals("testPADChannelHost", pADChannel.getHost(), "pADChannel.getHost()");
    assertNull(pADChannel.reader, "pADChannel.reader");
}
Also used : ISOPackager(org.jpos.iso.ISOPackager) ISOBaseValidatingPackager(org.jpos.iso.packager.ISOBaseValidatingPackager) Test(org.junit.jupiter.api.Test)

Example 45 with ISOPackager

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

the class RawChannelTest method testConstructor2.

@Test
public void testConstructor2() throws Throwable {
    byte[] header = new byte[0];
    ISOPackager p = new BASE24Packager();
    RawChannel rawChannel = new RawChannel(p, header);
    assertEquals(0, rawChannel.getIncomingFilters().size(), "rawChannel.getIncomingFilters().size()");
    assertEquals(100000, rawChannel.getMaxPacketLength(), "rawChannel.getMaxPacketLength()");
    assertSame(p, rawChannel.getPackager(), "rawChannel.getPackager()");
    assertEquals(0, rawChannel.getPort(), "rawChannel.getPort()");
    assertEquals("", rawChannel.getName(), "rawChannel.getName()");
    assertEquals(3, rawChannel.getCounters().length, "rawChannel.getCounters().length");
    assertNull(rawChannel.getLogger(), "rawChannel.getLogger()");
    assertNull(rawChannel.getSocketFactory(), "rawChannel.getSocketFactory()");
    assertSame(header, rawChannel.getHeader(), "rawChannel.getHeader()");
    assertEquals(0, rawChannel.getOutgoingFilters().size(), "rawChannel.getOutgoingFilters().size()");
    assertNull(rawChannel.getServerSocket(), "rawChannel.getServerSocket()");
    assertEquals("org.jpos.iso.channel.RawChannel", rawChannel.getOriginalRealm(), "rawChannel.getOriginalRealm()");
    assertNull(rawChannel.getRealm(), "rawChannel.getRealm()");
    assertNull(rawChannel.getHost(), "rawChannel.getHost()");
}
Also used : ISOPackager(org.jpos.iso.ISOPackager) BASE24Packager(org.jpos.iso.packager.BASE24Packager) Test(org.junit.jupiter.api.Test)

Aggregations

ISOPackager (org.jpos.iso.ISOPackager)46 Test (org.junit.jupiter.api.Test)42 ServerSocket (java.net.ServerSocket)12 ISOBaseValidatingPackager (org.jpos.iso.packager.ISOBaseValidatingPackager)5 ISO93APackager (org.jpos.iso.packager.ISO93APackager)4 ISOMsg (org.jpos.iso.ISOMsg)3 Base1Packager (org.jpos.iso.packager.Base1Packager)3 CTCSubFieldPackager (org.jpos.iso.packager.CTCSubFieldPackager)3 GenericPackager (org.jpos.iso.packager.GenericPackager)3 ISO87APackagerBBitmap (org.jpos.iso.packager.ISO87APackagerBBitmap)3 ISO87BPackager (org.jpos.iso.packager.ISO87BPackager)3 PostPackager (org.jpos.iso.packager.PostPackager)3 XMLPackager (org.jpos.iso.packager.XMLPackager)3 GenericValidatingPackager (org.jpos.iso.packager.GenericValidatingPackager)2 ISO87APackager (org.jpos.iso.packager.ISO87APackager)2 ISO93BPackager (org.jpos.iso.packager.ISO93BPackager)2 ListSelectionEvent (javax.swing.event.ListSelectionEvent)1 ListSelectionListener (javax.swing.event.ListSelectionListener)1 AbstractTableModel (javax.swing.table.AbstractTableModel)1 TableModel (javax.swing.table.TableModel)1