Search in sources :

Example 6 with X25Channel

use of org.jpos.iso.channel.X25Channel 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(m, result, "result");
}
Also used : LogEvent(org.jpos.util.LogEvent) X25Channel(org.jpos.iso.channel.X25Channel) CTCSubFieldPackager(org.jpos.iso.packager.CTCSubFieldPackager) Test(org.junit.jupiter.api.Test)

Example 7 with X25Channel

use of org.jpos.iso.channel.X25Channel in project jPOS by jpos.

the class BaseChannelTest method testResetCounters.

@Test
public void testResetCounters() throws Throwable {
    BaseChannel x25Channel = new X25Channel(new GenericValidatingPackager());
    x25Channel.resetCounters();
    assertEquals(3, ((X25Channel) x25Channel).cnt.length, "(X25Channel) x25Channel.cnt.length");
}
Also used : GenericValidatingPackager(org.jpos.iso.packager.GenericValidatingPackager) X25Channel(org.jpos.iso.channel.X25Channel) Test(org.junit.jupiter.api.Test)

Example 8 with X25Channel

use of org.jpos.iso.channel.X25Channel in project jPOS by jpos.

the class BaseChannelTest method testSendKeepAliveThrowsNullPointerException.

@Test
public void testSendKeepAliveThrowsNullPointerException() throws Throwable {
    try {
        new X25Channel("testBaseChannelHost", 100, new XMLPackager()).sendKeepAlive();
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        if (isJavaVersionAtMost(JAVA_14)) {
            assertNull(ex.getMessage(), "ex.getMessage()");
        } else {
            assertEquals("Cannot invoke \"java.io.DataOutputStream.flush()\" because \"this.serverOut\" is null", ex.getMessage(), "ex.getMessage()");
        }
    }
}
Also used : XMLPackager(org.jpos.iso.packager.XMLPackager) X25Channel(org.jpos.iso.channel.X25Channel) Test(org.junit.jupiter.api.Test)

Example 9 with X25Channel

use of org.jpos.iso.channel.X25Channel 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.jupiter.api.Test)

Example 10 with X25Channel

use of org.jpos.iso.channel.X25Channel in project jPOS by jpos.

the class BaseChannelTest method testSetConfigurationThrowsNullPointerException.

@Test
public void testSetConfigurationThrowsNullPointerException() throws Throwable {
    BaseChannel x25Channel = new X25Channel();
    Configuration cfg = new SimpleConfiguration((Properties) null);
    try {
        x25Channel.setConfiguration(cfg);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        if (isJavaVersionAtMost(JAVA_14)) {
            assertNull(ex.getMessage(), "ex.getMessage()");
        } else {
            assertEquals("Cannot invoke \"java.util.Properties.get(Object)\" because \"this.props\" is null", ex.getMessage(), "ex.getMessage()");
        }
        assertEquals(100000, x25Channel.getMaxPacketLength(), "(X25Channel) x25Channel.getMaxPacketLength()");
        assertEquals(0, x25Channel.getPort(), "(X25Channel) x25Channel.getPort()");
        assertEquals(0, x25Channel.getTimeout(), "(X25Channel) x25Channel.getTimeout()");
        assertNull(x25Channel.getHost(), "(X25Channel) x25Channel.getHost()");
        assertNull(x25Channel.getSocket(), "(X25Channel) x25Channel.getSocket()");
        assertFalse(((X25Channel) x25Channel).overrideHeader, "(X25Channel) x25Channel.overrideHeader");
    }
}
Also used : Configuration(org.jpos.core.Configuration) SimpleConfiguration(org.jpos.core.SimpleConfiguration) X25Channel(org.jpos.iso.channel.X25Channel) SimpleConfiguration(org.jpos.core.SimpleConfiguration) Test(org.junit.jupiter.api.Test)

Aggregations

X25Channel (org.jpos.iso.channel.X25Channel)13 Test (org.junit.jupiter.api.Test)13 LogEvent (org.jpos.util.LogEvent)4 MD5Filter (org.jpos.iso.filter.MD5Filter)3 StatefulFilter (org.jpos.iso.filter.StatefulFilter)3 CTCSubFieldPackager (org.jpos.iso.packager.CTCSubFieldPackager)3 ArrayList (java.util.ArrayList)1 Configuration (org.jpos.core.Configuration)1 SimpleConfiguration (org.jpos.core.SimpleConfiguration)1 GenericValidatingPackager (org.jpos.iso.packager.GenericValidatingPackager)1 XMLPackager (org.jpos.iso.packager.XMLPackager)1