Search in sources :

Example 46 with LogEvent

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

the class TransactionManagerTest method testAbortThrowsNullPointerException.

@Test
public void testAbortThrowsNullPointerException() throws Throwable {
    LogEvent evt = new LogEvent("testTransactionManagerTag");
    try {
        transactionManager.abort(1, 100L, new NotActiveException("testTransactionManagerParam1"), members, members.add(null), evt, null);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
        assertEquals("(ArrayList) members.size()", 1, members.size());
    }
}
Also used : LogEvent(org.jpos.util.LogEvent) NotActiveException(java.io.NotActiveException) Test(org.junit.Test)

Example 47 with LogEvent

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

the class BSHTransactionParticipantTest method testExecuteMethodThrowsEvalError.

@Test
public void testExecuteMethodThrowsEvalError() throws Throwable {
    BSHTransactionParticipant bSHGroupSelector = new BSHGroupSelector();
    try {
        bSHGroupSelector.executeMethod(new BSHMethod("testBSHTransactionParticipantBshData", false), 100L, new CharConversionException(), new LogEvent(), "sh.evalOnly");
        fail("Expected EvalError to be thrown");
    } catch (EvalError ex) {
        assertEquals("ex.getMessage()", "Class or variable not found: sh.evalOnly", ex.getMessage());
        assertEquals("ex.getMessage()", "Class or variable not found: sh.evalOnly", ex.getMessage());
    }
}
Also used : LogEvent(org.jpos.util.LogEvent) EvalError(bsh.EvalError) CharConversionException(java.io.CharConversionException) Test(org.junit.Test)

Example 48 with LogEvent

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

the class BSHTransactionParticipantTest method testExecuteMethodThrowsFileNotFoundException.

@Test
public void testExecuteMethodThrowsFileNotFoundException() throws Throwable {
    BSHTransactionParticipant source = new BSHTransactionParticipant();
    try {
        source.executeMethod(new BSHMethod("testBSHTransactionParticipantBshData", true), 100L, new CharConversionException(), new LogEvent(source, "testBSHTransactionParticipantTag"), "testBSHTransactionParticipantResultName");
        fail("Expected FileNotFoundException to be thrown");
    } catch (FileNotFoundException ex) {
        assertEquals("ex.getClass()", FileNotFoundException.class, ex.getClass());
    }
}
Also used : LogEvent(org.jpos.util.LogEvent) FileNotFoundException(java.io.FileNotFoundException) CharConversionException(java.io.CharConversionException) Test(org.junit.Test)

Example 49 with LogEvent

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

the class BSHTransactionParticipantTest method testExecuteMethodThrowsNullPointerException.

@Test
public void testExecuteMethodThrowsNullPointerException() throws Throwable {
    BSHTransactionParticipant bSHTransactionParticipant = new BSHTransactionParticipant();
    try {
        bSHTransactionParticipant.executeMethod(null, 100L, new StringBuffer(), new LogEvent("testBSHTransactionParticipantTag", Integer.valueOf(0)), "testBSHTransactionParticipantResultName");
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : LogEvent(org.jpos.util.LogEvent) Test(org.junit.Test)

Example 50 with LogEvent

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

the class DUKPTTest method test_DUKPT.

private void test_DUKPT(String keyName, KeySerialNumber ksn, byte[] pinUnderDukpt, String pan, boolean tdes) throws Exception {
    LogEvent evt = log.createInfo("test_DUKPT " + ksn);
    evt.addMessage(ksn);
    EncryptedPIN pin = new EncryptedPIN(pinUnderDukpt, SMAdapter.FORMAT01, pan);
    SecureDESKey bdk = (SecureDESKey) ks.getKey(keyName);
    evt.addMessage(pin);
    evt.addMessage(ksn);
    evt.addMessage(bdk);
    EncryptedPIN pinUnderLMK = sm.importPIN(pin, ksn, bdk, tdes);
    evt.addMessage(pinUnderLMK);
    evt.addMessage("<decrypted-pin>" + sm.decryptPIN(pinUnderLMK) + "</decrypted-pin>");
    Logger.log(evt);
}
Also used : LogEvent(org.jpos.util.LogEvent) SecureDESKey(org.jpos.security.SecureDESKey) EncryptedPIN(org.jpos.security.EncryptedPIN)

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