Search in sources :

Example 6 with LogEvent

use of org.jpos.util.LogEvent in project jPOS by jpos.

the class BaseChannelTest method testApplyIncomingFilters1.

@Test
public void testApplyIncomingFilters1() throws Throwable {
    BaseChannel gZIPChannel = new GZIPChannel("testBaseChannelHost", 100, new ISOBaseValidatingPackager());
    LogEvent evt = new LogEvent();
    byte[] header = new byte[0];
    byte[] image = new byte[2];
    ISOMsg result = gZIPChannel.applyIncomingFilters(m, header, image, evt);
    assertSame("result", m, result);
}
Also used : LogEvent(org.jpos.util.LogEvent) ISOBaseValidatingPackager(org.jpos.iso.packager.ISOBaseValidatingPackager) GZIPChannel(org.jpos.iso.channel.GZIPChannel) Test(org.junit.Test)

Example 7 with LogEvent

use of org.jpos.util.LogEvent in project jPOS by jpos.

the class BaseChannelTest method testApplyIncomingFiltersThrowsVetoException.

@Test
public void testApplyIncomingFiltersThrowsVetoException() throws Throwable {
    BaseChannel x25Channel = new X25Channel();
    x25Channel.addFilter(new MD5Filter());
    try {
        x25Channel.applyIncomingFilters(new ISOMsg(), new LogEvent(new CTCSubFieldPackager(), "testBaseChannelTag"));
        fail("Expected VetoException to be thrown");
    } catch (ISOFilter.VetoException ex) {
        assertEquals("ex.getMessage()", "MD5Filter not configured", ex.getMessage());
        assertNull("ex.nested", ex.nested);
    }
}
Also used : LogEvent(org.jpos.util.LogEvent) X25Channel(org.jpos.iso.channel.X25Channel) CTCSubFieldPackager(org.jpos.iso.packager.CTCSubFieldPackager) MD5Filter(org.jpos.iso.filter.MD5Filter) Test(org.junit.Test)

Example 8 with LogEvent

use of org.jpos.util.LogEvent in project jPOS by jpos.

the class BaseChannelTest method testApplyIncomingFilters.

@Test
public void testApplyIncomingFilters() throws Throwable {
    byte[] image = "testString".getBytes();
    final BaseChannel cSChannel = new CSChannel();
    cSChannel.addIncomingFilter(filter);
    final LogEvent evt = new LogEvent();
    byte[] header = new byte[2];
    when(filter.filter(cSChannel, m, evt)).thenReturn(m);
    ISOMsg result = cSChannel.applyIncomingFilters(m, header, image, evt);
    assertSame("result", m, result);
}
Also used : LogEvent(org.jpos.util.LogEvent) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.Test)

Example 9 with LogEvent

use of org.jpos.util.LogEvent in project jPOS by jpos.

the class BaseChannelTest method testApplyIncomingFilters2.

@Test
public void testApplyIncomingFilters2() throws Throwable {
    BaseChannel x25Channel = new X25Channel(null, new ServerSocket());
    byte[] header = new byte[1];
    byte[] image = new byte[1];
    ISOMsg result = x25Channel.applyIncomingFilters(null, header, image, new LogEvent("testBaseChannelTag"));
    assertNull("result", result);
}
Also used : LogEvent(org.jpos.util.LogEvent) X25Channel(org.jpos.iso.channel.X25Channel) Test(org.junit.Test)

Example 10 with LogEvent

use of org.jpos.util.LogEvent in project jPOS by jpos.

the class BaseChannelTest method testApplyOutgoingFilters.

@Test
public void testApplyOutgoingFilters() throws Throwable {
    BaseChannel x25Channel = new X25Channel();
    LogEvent evt = new LogEvent(new CTCSubFieldPackager(), "testBaseChannelTag");
    ISOMsg result = x25Channel.applyOutgoingFilters(m, evt);
    assertSame("result", m, result);
}
Also used : LogEvent(org.jpos.util.LogEvent) X25Channel(org.jpos.iso.channel.X25Channel) CTCSubFieldPackager(org.jpos.iso.packager.CTCSubFieldPackager) Test(org.junit.Test)

Aggregations

LogEvent (org.jpos.util.LogEvent)189 Test (org.junit.Test)78 ConfigurationException (org.jpos.core.ConfigurationException)51 ISOMsg (org.jpos.iso.ISOMsg)41 SimpleMsg (org.jpos.util.SimpleMsg)40 NotFoundException (org.jpos.util.NameRegistrar.NotFoundException)38 ArrayList (java.util.ArrayList)24 IOException (java.io.IOException)18 SimpleConfiguration (org.jpos.core.SimpleConfiguration)14 CSChannel (org.jpos.iso.channel.CSChannel)12 Loggeable (org.jpos.util.Loggeable)11 Map (java.util.Map)9 ISOChannel (org.jpos.iso.ISOChannel)9 PostChannel (org.jpos.iso.channel.PostChannel)9 CTCSubFieldPackager (org.jpos.iso.packager.CTCSubFieldPackager)9 ISOFilter (org.jpos.iso.ISOFilter)8 BASE24TCPChannel (org.jpos.iso.channel.BASE24TCPChannel)8 PADChannel (org.jpos.iso.channel.PADChannel)8 ISOBaseValidatingPackager (org.jpos.iso.packager.ISOBaseValidatingPackager)8 EOFException (java.io.EOFException)7