Search in sources :

Example 1 with ISOVMsg

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

the class BSHFilterTest method testFilter1.

@Test
public void testFilter1() throws Throwable {
    BSHFilter bSHFilter = new BSHFilter();
    Configuration cfg = new SimpleConfiguration();
    bSHFilter.setConfiguration(cfg);
    ISOChannel channel = new CSChannel();
    LogEvent evt = new LogEvent();
    ISOVMsg result = (ISOVMsg) bSHFilter.filter(channel, m, evt);
    assertSame("result", m, result);
    assertSame("bSHFilter.cfg", cfg, bSHFilter.cfg);
}
Also used : SimpleConfiguration(org.jpos.core.SimpleConfiguration) Configuration(org.jpos.core.Configuration) LogEvent(org.jpos.util.LogEvent) SimpleConfiguration(org.jpos.core.SimpleConfiguration) ISOVMsg(org.jpos.iso.ISOVMsg) ISOChannel(org.jpos.iso.ISOChannel) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.Test)

Example 2 with ISOVMsg

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

the class MSGTEST021Test method testValidate2.

@Test
public void testValidate2() throws Throwable {
    ISOMsg m = new ISOVMsg(new ISOMsg("testMSGTEST02Mti"), new ISOVError("testMSGTEST02Description"));
    m.set(1, "testMSGTEST02Value");
    ISOMsg result = (ISOMsg) new MSGTEST02().validate(m);
    assertSame("result", m, result);
}
Also used : ISOVError(org.jpos.iso.ISOVError) ISOMsg(org.jpos.iso.ISOMsg) ISOVMsg(org.jpos.iso.ISOVMsg) Test(org.junit.Test)

Example 3 with ISOVMsg

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

the class MSGTEST021Test method testValidate1.

@Test
public void testValidate1() throws Throwable {
    MSGTEST02 mSGTEST02 = new MSGTEST02();
    ISOVMsg m = mock(ISOVMsg.class);
    given(m.getComposite()).willReturn(m);
    given(m.hasFields(new int[] { 0, 1 })).willReturn(false);
    given(m.addISOVError(isA(ISOVError.class))).willReturn(true);
    given(m.getString(0)).willReturn("");
    ISOVMsg result = (ISOVMsg) mSGTEST02.validate(m);
    assertSame("result", m, result);
}
Also used : ISOVError(org.jpos.iso.ISOVError) ISOVMsg(org.jpos.iso.ISOVMsg) Test(org.junit.Test)

Example 4 with ISOVMsg

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

the class MSGTEST021Test method testValidateThrowsISOVException1.

@Test
public void testValidateThrowsISOVException1() throws Throwable {
    ISOComponent m = new ISOVMsg(new ISOMsg("testMSGTEST02Mti"));
    try {
        new MSGTEST02(true).validate(m);
        fail("Expected ISOVException to be thrown");
    } catch (ISOVException ex) {
        assertEquals("ex.getMessage()", "Error on msg. ", ex.getMessage());
        assertFalse("ex.treated", ex.treated);
        assertSame("ex.errComponent", m, ex.errComponent);
        assertNull("ex.getNested()", ex.getNested());
    }
}
Also used : ISOComponent(org.jpos.iso.ISOComponent) ISOMsg(org.jpos.iso.ISOMsg) ISOVMsg(org.jpos.iso.ISOVMsg) Test(org.junit.Test)

Example 5 with ISOVMsg

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

the class MSGTEST021Test method testValidateThrowsNullPointerException.

@Test
public void testValidateThrowsNullPointerException() throws Throwable {
    ISOMsg Source = new ISOMsg("testMSGTEST02Mti");
    Source.setMTI("testMSGTEST02Mti");
    Source.setRetransmissionMTI();
    ISOComponent m = new ISOVMsg(Source);
    try {
        new MSGTEST02().validate(m);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISOComponent(org.jpos.iso.ISOComponent) ISOMsg(org.jpos.iso.ISOMsg) ISOVMsg(org.jpos.iso.ISOVMsg) Test(org.junit.Test)

Aggregations

ISOVMsg (org.jpos.iso.ISOVMsg)25 Test (org.junit.Test)25 ISOMsg (org.jpos.iso.ISOMsg)22 ISOVError (org.jpos.iso.ISOVError)9 ISOBaseValidator (org.jpos.iso.ISOBaseValidator)8 ISOComponent (org.jpos.iso.ISOComponent)8 ISOFieldValidator (org.jpos.iso.ISOFieldValidator)7 Vector (java.util.Vector)5 ISOValidator (org.jpos.iso.ISOValidator)4 MSGTEST (org.jpos.iso.validator.MSGTEST)4 MSGTEST02 (org.jpos.iso.validator.MSGTEST02)4 IVA_ALPHANUM (org.jpos.iso.IVA_ALPHANUM)3 Configuration (org.jpos.core.Configuration)1 SimpleConfiguration (org.jpos.core.SimpleConfiguration)1 ISOChannel (org.jpos.iso.ISOChannel)1 IVA_ALPHANUMNOBLANK (org.jpos.iso.IVA_ALPHANUMNOBLANK)1 IVA_ALPHANUMNOZERO_NOBLANK (org.jpos.iso.IVA_ALPHANUMNOZERO_NOBLANK)1 CSChannel (org.jpos.iso.channel.CSChannel)1 TEST0100 (org.jpos.iso.validator.TEST0100)1 LogEvent (org.jpos.util.LogEvent)1