Search in sources :

Example 71 with ISOMsg

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

the class GenericValidatingPackagerTest method testValidateThrowsNullPointerException4.

@Test
public void testValidateThrowsNullPointerException4() throws Throwable {
    GenericValidatingPackager genericValidatingPackager = new GenericValidatingPackager();
    ISOFieldValidator[] fvlds = new ISOFieldValidator[0];
    genericValidatingPackager.setFieldValidator(fvlds);
    ISOBaseValidator[] msgVlds = new ISOBaseValidator[2];
    msgVlds[1] = new MSGTEST02();
    genericValidatingPackager.setMsgValidator(msgVlds);
    try {
        genericValidatingPackager.validate(new ISOMsg());
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) ISOBaseValidator(org.jpos.iso.ISOBaseValidator) ISOFieldValidator(org.jpos.iso.ISOFieldValidator) MSGTEST02(org.jpos.iso.validator.MSGTEST02) Test(org.junit.Test)

Example 72 with ISOMsg

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

the class GenericValidatingPackagerTest method testValidateThrowsISOException.

@Test
public void testValidateThrowsISOException() throws Throwable {
    GenericValidatingPackager genericValidatingPackager = new GenericValidatingPackager();
    ISOFieldValidator[] fvlds = new ISOFieldValidator[1];
    fvlds[0] = new IVA_ALPHANUMNOBLANK("testGenericValidatingPackagerDescription");
    genericValidatingPackager.setFieldValidator(fvlds);
    ISOBaseValidator[] msgVlds = new ISOBaseValidator[3];
    msgVlds[0] = new TEST0100();
    genericValidatingPackager.setMsgValidator(msgVlds);
    try {
        genericValidatingPackager.validate(new ISOMsg());
        fail("Expected ISOException to be thrown");
    } catch (ISOException ex) {
        assertEquals("ex.getMessage()", "MTI not available", ex.getMessage());
        assertNull("ex.getNested()", ex.getNested());
    }
}
Also used : IVA_ALPHANUMNOBLANK(org.jpos.iso.IVA_ALPHANUMNOBLANK) ISOException(org.jpos.iso.ISOException) ISOMsg(org.jpos.iso.ISOMsg) ISOBaseValidator(org.jpos.iso.ISOBaseValidator) TEST0100(org.jpos.iso.validator.TEST0100) ISOFieldValidator(org.jpos.iso.ISOFieldValidator) Test(org.junit.Test)

Example 73 with ISOMsg

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

the class GenericValidatingPackagerTest method testValidate6.

@Test
public void testValidate6() throws Throwable {
    ISOBaseValidator mSGTEST = new MSGTEST(false);
    GenericValidatingPackager genericValidatingPackager = new GenericValidatingPackager();
    ISOBaseValidator mSGTEST2 = new MSGTEST(false);
    ISOBaseValidator[] msgVlds = new ISOBaseValidator[3];
    msgVlds[0] = mSGTEST2;
    msgVlds[1] = mSGTEST;
    msgVlds[2] = mSGTEST2;
    genericValidatingPackager.setMsgValidator(msgVlds);
    ISOFieldValidator[] fvlds = new ISOFieldValidator[1];
    fvlds[0] = new IVA_ALPHANUM("testGenericValidatingPackagerDescription");
    genericValidatingPackager.setFieldValidator(fvlds);
    ISOVMsg result = (ISOVMsg) genericValidatingPackager.validate(new ISOMsg(100));
    assertNotNull("result", result);
}
Also used : MSGTEST(org.jpos.iso.validator.MSGTEST) ISOMsg(org.jpos.iso.ISOMsg) IVA_ALPHANUM(org.jpos.iso.IVA_ALPHANUM) ISOBaseValidator(org.jpos.iso.ISOBaseValidator) ISOVMsg(org.jpos.iso.ISOVMsg) ISOFieldValidator(org.jpos.iso.ISOFieldValidator) Test(org.junit.Test)

Example 74 with ISOMsg

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

the class GenericValidatingPackagerTest method testValidate1.

@Test
public void testValidate1() throws Throwable {
    GenericValidatingPackager genericValidatingPackager = new GenericValidatingPackager();
    ISOFieldValidator[] fvlds = new ISOFieldValidator[2];
    fvlds[0] = new ISOFieldValidator();
    fvlds[1] = new IVA_ALPHANUMNOZERO_NOBLANK();
    genericValidatingPackager.setFieldValidator(fvlds);
    ISOBaseValidator[] msgVlds = new ISOBaseValidator[2];
    msgVlds[0] = new MSGTEST();
    msgVlds[1] = new ISOBaseValidator();
    genericValidatingPackager.setMsgValidator(msgVlds);
    ISOMsg m = new ISOMsg("testGenericValidatingPackagerMti");
    m.setMTI("testGenericValidatingPackagerMti");
    ISOVMsg result = (ISOVMsg) genericValidatingPackager.validate(m);
    assertNotNull("result", result);
}
Also used : MSGTEST(org.jpos.iso.validator.MSGTEST) ISOMsg(org.jpos.iso.ISOMsg) ISOBaseValidator(org.jpos.iso.ISOBaseValidator) ISOVMsg(org.jpos.iso.ISOVMsg) ISOFieldValidator(org.jpos.iso.ISOFieldValidator) IVA_ALPHANUMNOZERO_NOBLANK(org.jpos.iso.IVA_ALPHANUMNOZERO_NOBLANK) Test(org.junit.Test)

Example 75 with ISOMsg

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

the class ISOBaseValidatingPackagerTest method testValidateThrowsNullPointerException2.

@Test
public void testValidateThrowsNullPointerException2() throws Throwable {
    ISOBaseValidatingPackager iSOBaseValidatingPackager = new ISOBaseValidatingPackager();
    ISOBaseValidator[] msgVlds = new ISOBaseValidator[3];
    msgVlds[0] = new TEST0100();
    msgVlds[1] = new MSGTEST();
    msgVlds[2] = new MSGTEST02();
    ISOValidator[] fvlds = new ISOValidator[0];
    iSOBaseValidatingPackager.setFieldValidator(fvlds);
    iSOBaseValidatingPackager.setMsgValidator(msgVlds);
    ISOMsg m = new ISOMsg();
    m.setMTI("testISOBaseValidatingPackagerMti");
    m.setRetransmissionMTI();
    try {
        iSOBaseValidatingPackager.validate(m);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : MSGTEST(org.jpos.iso.validator.MSGTEST) ISOMsg(org.jpos.iso.ISOMsg) ISOValidator(org.jpos.iso.ISOValidator) ISOBaseValidator(org.jpos.iso.ISOBaseValidator) TEST0100(org.jpos.iso.validator.TEST0100) MSGTEST02(org.jpos.iso.validator.MSGTEST02) Test(org.junit.Test)

Aggregations

ISOMsg (org.jpos.iso.ISOMsg)223 Test (org.junit.Test)191 LogEvent (org.jpos.util.LogEvent)41 ISOBaseValidator (org.jpos.iso.ISOBaseValidator)30 ISOException (org.jpos.iso.ISOException)29 ISOComponent (org.jpos.iso.ISOComponent)25 ISOVMsg (org.jpos.iso.ISOVMsg)22 ISOFieldValidator (org.jpos.iso.ISOFieldValidator)21 Context (org.jpos.transaction.Context)20 ISOValidator (org.jpos.iso.ISOValidator)18 Result (org.jpos.rc.Result)17 SimpleConfiguration (org.jpos.core.SimpleConfiguration)15 ISOFieldPackager (org.jpos.iso.ISOFieldPackager)12 TEST0100 (org.jpos.iso.validator.TEST0100)12 FileInputStream (java.io.FileInputStream)9 Vector (java.util.Vector)9 PostChannel (org.jpos.iso.channel.PostChannel)9 MSGTEST (org.jpos.iso.validator.MSGTEST)9 MSGTEST02 (org.jpos.iso.validator.MSGTEST02)9 ISOFilter (org.jpos.iso.ISOFilter)8