use of org.jpos.transaction.Context in project jPOS by jpos.
the class Trace method commit.
public void commit(long id, Serializable o) {
Context ctx = (Context) o;
ctx.checkPoint("commit:" + trace);
}
use of org.jpos.transaction.Context in project jPOS by jpos.
the class Trace method prepareForAbort.
public int prepareForAbort(long id, Serializable o) {
Context ctx = (Context) o;
ctx.checkPoint("prepareForAbort:" + trace);
return PREPARED | READONLY;
}
use of org.jpos.transaction.Context in project jPOS by jpos.
the class JESpaceTestCase method testPersistentContext.
public void testPersistentContext() throws Exception {
Context ctx = new Context();
ctx.put("P", "ABC", true);
ISOMsg m = new ISOMsg("0800");
m.set(11, "000001");
ctx.put("ISOMSG", m, true);
sp.out("CTX", ctx);
assertNotNull("entry should not be null", sp.in("CTX"));
}
use of org.jpos.transaction.Context in project jPOS by jpos.
the class CheckFieldsTest method testMidAndTidWithSpaces.
@Test
public void testMidAndTidWithSpaces() {
Context ctx = new Context();
ISOMsg m = new ISOMsg();
m.set(41, "0001 ");
m.set(42, "0000000001 ");
ctx.put(ContextConstants.REQUEST.toString(), m);
cfg.put("mandatory", "MID, TID");
int action = cf.prepare(1L, ctx);
assertEquals(PREPARED | NO_JOIN | READONLY, action);
Result rc = ctx.getResult();
assertFalse(rc.hasFailures());
}
use of org.jpos.transaction.Context in project jPOS by jpos.
the class CheckFieldsTest method testValidTimestamps.
@Test
public void testValidTimestamps() {
Date now = new Date();
Context ctx = new Context();
ISOMsg m = new ISOMsg();
m.set(7, ISODate.getDateTime(now));
m.set(12, ISODate.getDateTime(now));
ctx.put(ContextConstants.REQUEST.toString(), m);
cfg.put("mandatory", "7 12");
int action = cf.prepare(1L, ctx);
assertEquals(PREPARED | NO_JOIN | READONLY, action);
Result rc = ctx.getResult();
assertFalse(rc.hasInfo());
assertFalse(rc.hasWarnings());
assertFalse(rc.hasFailures());
}
Aggregations