Search in sources :

Example 96 with LogEvent

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

the class BaseSMAdapter method verifyIBMPINOffset.

@Override
public boolean verifyIBMPINOffset(EncryptedPIN pinUnderKd1, SecureDESKey kd1, SecureDESKey pvk, String offset, String decTab, String pinValData, int minPinLen) throws SMException {
    SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "account number", pinUnderKd1.getAccountNumber()), new SimpleMsg("parameter", "PIN under Data Key 1", pinUnderKd1), new SimpleMsg("parameter", "Data Key 1", kd1), new SimpleMsg("parameter", "PVK", pvk), new SimpleMsg("parameter", "Pin block format", pinUnderKd1.getPINBlockFormat()), new SimpleMsg("parameter", "decimalisation table", decTab), new SimpleMsg("parameter", "PIN validation data", pinValData), new SimpleMsg("parameter", "minimum PIN length", minPinLen), new SimpleMsg("parameter", "offset", offset) };
    LogEvent evt = new LogEvent(this, "s-m-operation");
    evt.addMessage(new SimpleMsg("command", "Verify PIN offset", cmdParameters));
    try {
        boolean r = verifyIBMPINOffsetImpl(pinUnderKd1, kd1, pvk, offset, decTab, pinValData, minPinLen);
        evt.addMessage(new SimpleMsg("result", "Verification status", r ? "valid" : "invalid"));
        return r;
    } catch (Exception e) {
        evt.addMessage(e);
        throw e instanceof SMException ? (SMException) e : new SMException(e);
    } finally {
        Logger.log(evt);
    }
}
Also used : LogEvent(org.jpos.util.LogEvent) SimpleMsg(org.jpos.util.SimpleMsg) ConfigurationException(org.jpos.core.ConfigurationException) NotFoundException(org.jpos.util.NameRegistrar.NotFoundException)

Example 97 with LogEvent

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

the class TransactionManagerTest method testPrepare5.

@Test
public void testPrepare5() throws Throwable {
    int result = transactionManager.prepare(1, 100L, new File("testTransactionManagerParam1"), new ArrayList(), new ArrayList(1000).iterator(), true, new LogEvent("testTransactionManagerTag"), null);
    assertEquals("result", TransactionConstants.ABORTED, result);
}
Also used : LogEvent(org.jpos.util.LogEvent) ArrayList(java.util.ArrayList) File(java.io.File) CheckPoint(org.jpos.transaction.participant.CheckPoint) Test(org.junit.Test)

Example 98 with LogEvent

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

the class TransactionManagerTest method testAbort6.

@Test
public void testAbort6() throws Throwable {
    LogEvent evt = new LogEvent();
    transactionManager.abort(1, 100L, new NotActiveException(), members, true, evt, null);
    assertEquals("(ArrayList) members.size()", 0, members.size());
}
Also used : LogEvent(org.jpos.util.LogEvent) NotActiveException(java.io.NotActiveException) Test(org.junit.Test)

Example 99 with LogEvent

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

the class TransactionManagerTest method testPrepareThrowsNullPointerException3.

@Test
public void testPrepareThrowsNullPointerException3() throws Throwable {
    List<TransactionParticipant> members = new ArrayList();
    List<TransactionParticipant> arrayList = new ArrayList();
    arrayList.add(new Forward());
    LogEvent evt = new LogEvent();
    try {
        transactionManager.prepare(1, 100L, Boolean.FALSE, members, arrayList.iterator(), false, evt, null);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertEquals("evt.payLoad.size()", 1, evt.getPayLoad().size());
        assertEquals("evt.payLoad.get(0)", "        prepare: org.jpos.transaction.participant.Forward ABORTED", evt.getPayLoad().get(0));
        assertNull("ex.getMessage()", ex.getMessage());
        assertNull("transactionManager.psp", transactionManager.psp);
        assertNull("transactionManager.groups", transactionManager.groups);
        assertEquals("(ArrayList) members.size()", 0, members.size());
    }
}
Also used : BSHTransactionParticipant(org.jpos.transaction.participant.BSHTransactionParticipant) LogEvent(org.jpos.util.LogEvent) ArrayList(java.util.ArrayList) Forward(org.jpos.transaction.participant.Forward) Test(org.junit.Test)

Example 100 with LogEvent

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

the class TransactionManagerTest method testAbort3.

@Test
public void testAbort3() throws Throwable {
    LogEvent evt = new LogEvent("testTransactionManagerTag", Integer.valueOf(2));
    transactionManager.abort(1, 100L, Boolean.TRUE, members, members.add(new Forward()), evt, null);
    assertEquals("evt.payLoad.size()", 2, evt.getPayLoad().size());
    assertEquals("evt.payLoad.get(1)", "          abort: org.jpos.transaction.participant.Forward", evt.getPayLoad().get(1));
}
Also used : LogEvent(org.jpos.util.LogEvent) Forward(org.jpos.transaction.participant.Forward) Test(org.junit.Test)

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