use of org.jpos.iso.ISOPackager in project jPOS by jpos.
the class BASE24ChannelTest method testConstructor2.
@Test
public void testConstructor2() throws Throwable {
ISOPackager p = new ISOBaseValidatingPackager();
BASE24Channel bASE24Channel = new BASE24Channel("testBASE24ChannelHost", 100, p);
assertEquals(0, bASE24Channel.getIncomingFilters().size(), "bASE24Channel.getIncomingFilters().size()");
assertEquals(100000, bASE24Channel.getMaxPacketLength(), "bASE24Channel.getMaxPacketLength()");
assertSame(p, bASE24Channel.getPackager(), "bASE24Channel.getPackager()");
assertEquals(100, bASE24Channel.getPort(), "bASE24Channel.getPort()");
assertEquals("", bASE24Channel.getName(), "bASE24Channel.getName()");
assertEquals(3, bASE24Channel.getCounters().length, "bASE24Channel.getCounters().length");
assertNull(bASE24Channel.getLogger(), "bASE24Channel.getLogger()");
assertNull(bASE24Channel.getSocketFactory(), "bASE24Channel.getSocketFactory()");
assertNull(bASE24Channel.getHeader(), "bASE24Channel.getHeader()");
assertEquals(0, bASE24Channel.getOutgoingFilters().size(), "bASE24Channel.getOutgoingFilters().size()");
assertNull(bASE24Channel.getServerSocket(), "bASE24Channel.getServerSocket()");
assertEquals("org.jpos.iso.channel.BASE24Channel", bASE24Channel.getOriginalRealm(), "bASE24Channel.getOriginalRealm()");
assertNull(bASE24Channel.getRealm(), "bASE24Channel.getRealm()");
assertEquals("testBASE24ChannelHost", bASE24Channel.getHost(), "bASE24Channel.getHost()");
}
use of org.jpos.iso.ISOPackager in project jPOS by jpos.
the class CSChannelTest method testConstructor3.
@Test
public void testConstructor3() throws Throwable {
ISOPackager p = new ISO87BPackager();
CSChannel cSChannel = new CSChannel(p);
assertEquals(0, cSChannel.getIncomingFilters().size(), "cSChannel.getIncomingFilters().size()");
assertEquals(100000, cSChannel.getMaxPacketLength(), "cSChannel.getMaxPacketLength()");
assertSame(p, cSChannel.getPackager(), "cSChannel.getPackager()");
assertEquals(0, cSChannel.getPort(), "cSChannel.getPort()");
assertEquals("", cSChannel.getName(), "cSChannel.getName()");
assertEquals(3, cSChannel.getCounters().length, "cSChannel.getCounters().length");
assertNull(cSChannel.getLogger(), "cSChannel.getLogger()");
assertNull(cSChannel.getSocketFactory(), "cSChannel.getSocketFactory()");
assertNull(cSChannel.getHeader(), "cSChannel.getHeader()");
assertEquals(0, cSChannel.getOutgoingFilters().size(), "cSChannel.getOutgoingFilters().size()");
assertNull(cSChannel.getServerSocket(), "cSChannel.getServerSocket()");
assertEquals("org.jpos.iso.channel.CSChannel", cSChannel.getOriginalRealm(), "cSChannel.getOriginalRealm()");
assertNull(cSChannel.getRealm(), "cSChannel.getRealm()");
assertNull(cSChannel.getHost(), "cSChannel.getHost()");
}
use of org.jpos.iso.ISOPackager in project jPOS by jpos.
the class GZIPChannelTest method testConstructor3.
@Test
public void testConstructor3() throws Throwable {
ISOPackager p = new GenericPackager();
GZIPChannel gZIPChannel = new GZIPChannel(p);
assertEquals(0, gZIPChannel.getIncomingFilters().size(), "gZIPChannel.getIncomingFilters().size()");
assertEquals(100000, gZIPChannel.getMaxPacketLength(), "gZIPChannel.getMaxPacketLength()");
assertSame(p, gZIPChannel.getPackager(), "gZIPChannel.getPackager()");
assertEquals(0, gZIPChannel.getPort(), "gZIPChannel.getPort()");
assertEquals("", gZIPChannel.getName(), "gZIPChannel.getName()");
assertEquals(3, gZIPChannel.getCounters().length, "gZIPChannel.getCounters().length");
assertNull(gZIPChannel.getLogger(), "gZIPChannel.getLogger()");
assertNull(gZIPChannel.getSocketFactory(), "gZIPChannel.getSocketFactory()");
assertNull(gZIPChannel.getHeader(), "gZIPChannel.getHeader()");
assertEquals(0, gZIPChannel.getOutgoingFilters().size(), "gZIPChannel.getOutgoingFilters().size()");
assertNull(gZIPChannel.getServerSocket(), "gZIPChannel.getServerSocket()");
assertEquals("org.jpos.iso.channel.GZIPChannel", gZIPChannel.getOriginalRealm(), "gZIPChannel.getOriginalRealm()");
assertNull(gZIPChannel.getRealm(), "gZIPChannel.getRealm()");
assertNull(gZIPChannel.getHost(), "gZIPChannel.getHost()");
}
use of org.jpos.iso.ISOPackager in project jPOS by jpos.
the class GZIPChannelTest method testConstructor.
@Test
public void testConstructor() throws Throwable {
ISOPackager p = new CTCSubFieldPackager();
ServerSocket serverSocket = new ServerSocket();
GZIPChannel gZIPChannel = new GZIPChannel(p, serverSocket);
assertEquals(0, gZIPChannel.getIncomingFilters().size(), "gZIPChannel.getIncomingFilters().size()");
assertEquals(100000, gZIPChannel.getMaxPacketLength(), "gZIPChannel.getMaxPacketLength()");
assertSame(p, gZIPChannel.getPackager(), "gZIPChannel.getPackager()");
assertEquals(0, gZIPChannel.getPort(), "gZIPChannel.getPort()");
assertEquals("", gZIPChannel.getName(), "gZIPChannel.getName()");
assertEquals(3, gZIPChannel.getCounters().length, "gZIPChannel.getCounters().length");
assertNull(gZIPChannel.getLogger(), "gZIPChannel.getLogger()");
assertNull(gZIPChannel.getSocketFactory(), "gZIPChannel.getSocketFactory()");
assertNull(gZIPChannel.getHeader(), "gZIPChannel.getHeader()");
assertEquals(0, gZIPChannel.getOutgoingFilters().size(), "gZIPChannel.getOutgoingFilters().size()");
assertSame(serverSocket, gZIPChannel.getServerSocket(), "gZIPChannel.getServerSocket()");
assertEquals("org.jpos.iso.channel.GZIPChannel", gZIPChannel.getOriginalRealm(), "gZIPChannel.getOriginalRealm()");
assertNull(gZIPChannel.getRealm(), "gZIPChannel.getRealm()");
assertNull(gZIPChannel.getHost(), "gZIPChannel.getHost()");
}
use of org.jpos.iso.ISOPackager in project jPOS by jpos.
the class ISOMsgPanel method createISOMsgTable.
private JComponent createISOMsgTable() {
TableModel dataModel = new AbstractTableModel() {
private static final long serialVersionUID = 8917029825751856951L;
@Override
public int getColumnCount() {
return 3;
}
@Override
public int getRowCount() {
return validFields.size();
}
@Override
public String getColumnName(int columnIndex) {
switch(columnIndex) {
case 0:
return "#";
case 1:
return "Content";
case 2:
return "Description";
default:
return "";
}
}
@Override
public Object getValueAt(int row, int col) {
switch(col) {
case 0:
return validFields.elementAt(row);
case 1:
int index = (Integer) validFields.elementAt(row);
Object obj = m.getValue(index);
if (obj instanceof String) {
String s = obj.toString();
switch(index) {
case 2:
case 35:
case 45:
s = ISOUtil.protect(s);
break;
case 14:
s = "----";
}
return s;
} else if (obj instanceof byte[])
return ISOUtil.hexString((byte[]) obj);
else if (obj instanceof ISOMsg)
return "<ISOMsg>";
break;
case 2:
int i = (Integer) validFields.elementAt(row);
ISOPackager p = m.getPackager();
return p.getFieldDescription(m, i);
}
return "<???>";
}
};
JTable table = new JTable(dataModel);
table.getColumnModel().getColumn(0).setPreferredWidth(10);
table.setPreferredScrollableViewportSize(new Dimension(500, table.getRowCount() * table.getRowHeight()));
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
ListSelectionModel rowSM = table.getSelectionModel();
rowSM.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting())
return;
ListSelectionModel lsm = (ListSelectionModel) e.getSource();
if (!lsm.isSelectionEmpty()) {
int selectedRow = lsm.getMinSelectionIndex();
int index = (Integer) validFields.elementAt(selectedRow);
Object obj = m.getValue(index);
if (obj instanceof ISOMsg) {
ISOMsg sm = (ISOMsg) obj;
JFrame f = new JFrame("ISOMsg field " + index);
ISOMsgPanel p = new ISOMsgPanel(sm, false);
f.getContentPane().add(p);
f.pack();
f.show();
}
}
}
});
return new JScrollPane(table);
}
Aggregations