Package org.jpos.iso

Examples of org.jpos.iso.ISOMsg


    @Test
    public void testFilterThrowsVetoException1() throws Throwable {
        MD5Filter mD5Filter = new MD5Filter();
        mD5Filter.setConfiguration(new SimpleConfiguration());
        ISOMsg m = new ISOMsg("testMD5FilterMti");
        m.setDirection(3);
        LogEvent evt = new LogEvent();
        try {
            mD5Filter.filter(new PostChannel("testMD5FilterHost", 100, new PostPackager()), m, evt);
            fail("Expected VetoException to be thrown");
        } catch (ISOFilter.VetoException ex) {
            assertEquals("evt.payLoad.size()", 3, evt.getPayLoad().size());
            assertEquals("ex.getMessage()", "org.jpos.iso.ISOFilter$VetoException: invalid MAC", ex.getMessage());
            assertEquals("ex.getNested().getMessage()", "invalid MAC", ex.getNested().getMessage());
            assertEquals("m.getDirection()", 3, m.getDirection());
        }
    }
View Full Code Here


        MD5Filter mD5Filter = new MD5Filter();
        mD5Filter.setConfiguration(new SimpleConfiguration());
        int[] fields = new int[1];
        fields[0] = -100;
        mD5Filter.setFields(fields);
        ISOMsg m = new ISOMsg("testMD5FilterMti");
        m.setDirection(3);
        LogEvent evt = new LogEvent("testMD5FilterTag");
        try {
            mD5Filter.filter(new ASCIIChannel(new ISOBaseValidatingPackager()), m, evt);
            fail("Expected VetoException to be thrown");
        } catch (ISOFilter.VetoException ex) {
            assertEquals("evt.payLoad.size()", 3, evt.getPayLoad().size());
            assertEquals("ex.getMessage()", "org.jpos.iso.ISOFilter$VetoException: invalid MAC", ex.getMessage());
            assertEquals("ex.getNested().getMessage()", "invalid MAC", ex.getNested().getMessage());
            assertEquals("m.getDirection()", 3, m.getDirection());
        }
    }
View Full Code Here

        MD5Filter mD5Filter = new MD5Filter();
        mD5Filter.setConfiguration(new SimpleConfiguration());
        LogEvent evt = new LogEvent("testMD5FilterTag");
        int[] fields = new int[1];
        mD5Filter.setFields(fields);
        ISOMsg m = new ISOMsg("testMD5FilterMti");
        try {
            mD5Filter.filter(new BASE24TCPChannel("testMD5FilterHost", 100, new PostPackager()), m, evt);
            fail("Expected VetoException to be thrown");
        } catch (ISOFilter.VetoException ex) {
            assertEquals("evt.payLoad.size()", 3, evt.getPayLoad().size());
            assertEquals("ex.getMessage()", "org.jpos.iso.ISOFilter$VetoException: invalid MAC", ex.getMessage());
            assertEquals("ex.getNested().getMessage()", "invalid MAC", ex.getNested().getMessage());
            assertEquals("m.getDirection()", 0, m.getDirection());
        }
    }
View Full Code Here

        MD5Filter mD5Filter = new MD5Filter();
        mD5Filter.setConfiguration(new SimpleConfiguration());
        int[] fields = new int[1];
        fields[0] = -100;
        mD5Filter.setFields(fields);
        ISOMsg m = new ISOMsg("testMD5FilterMti");
        m.setDirection(1);
        LogEvent evt = new LogEvent("testMD5FilterTag");
        try {
            mD5Filter.filter(new ASCIIChannel(new ISOBaseValidatingPackager()), m, evt);
            fail("Expected VetoException to be thrown");
        } catch (ISOFilter.VetoException ex) {
            assertEquals("evt.payLoad.size()", 3, evt.getPayLoad().size());
            assertEquals("ex.getMessage()", "org.jpos.iso.ISOFilter$VetoException: invalid MAC", ex.getMessage());
            assertEquals("ex.getNested().getMessage()", "invalid MAC", ex.getNested().getMessage());
            assertEquals("m.getDirection()", 1, m.getDirection());
        }
    }
View Full Code Here

        }
    }

    @Test
    public void testFilterThrowsVetoException5() throws Throwable {
        ISOMsg m = new ISOMsg("testMD5FilterMti");
        LogEvent evt = new LogEvent();
        try {
            new MD5Filter().filter(new PostChannel(), m, evt);
            fail("Expected VetoException to be thrown");
        } catch (ISOFilter.VetoException ex) {
            assertEquals("ex.getMessage()", "MD5Filter not configured", ex.getMessage());
            assertNull("ex.getNested()", ex.getNested());
            assertEquals("m.getDirection()", 0, m.getDirection());
        }
    }
View Full Code Here

    @Test
    public void testGetFields() throws Throwable {
        int[] fields = new int[3];
        MD5Filter mD5Filter = new MD5Filter();
        mD5Filter.setFields(fields);
        int[] result = mD5Filter.getFields(new ISOMsg("testMD5FilterMti"));
        assertSame("result", fields, result);
        assertEquals("fields[0]", 0, fields[0]);
    }
View Full Code Here

    }

    @Test
    public void testPackThrowsClassCastException() throws Throwable {
        try {
            new Base1_BITMAP126(100, "testBase1_BITMAP126Description").pack(new ISOMsg("testBase1_BITMAP126Mti"));
            fail("Expected ClassCastException to be thrown");
        } catch (ClassCastException ex) {
            assertEquals("ex.getClass()", ClassCastException.class, ex.getClass());
        }
    }
View Full Code Here

    }

    @Test
    public void testUnpackThrowsArrayIndexOutOfBoundsException() throws Throwable {
        byte[] b = new byte[0];
        ISOComponent c = new ISOMsg();
        try {
            new Base1_BITMAP126().unpack(c, b, 100);
            fail("Expected ArrayIndexOutOfBoundsException to be thrown");
        } catch (ArrayIndexOutOfBoundsException ex) {
            assertEquals("ex.getMessage()", "100", ex.getMessage());
View Full Code Here

        }
    }

    @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());
View Full Code Here

        }
    }

    @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) {
View Full Code Here

TOP

Related Classes of org.jpos.iso.ISOMsg

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.