use of org.jpos.transaction.Context in project jPOS by jpos.
the class QueryHostTest method testNoDestination.
@Test
public void testNoDestination() throws Exception {
Context ctx = new Context();
cfg.put("continuations", "no");
queryHost.setConfiguration(cfg);
ctx.put(ContextConstants.REQUEST.toString(), createDummyRequest());
int action = queryHost.prepare(1L, ctx);
assertTrue(action == FAIL);
assertNull(ctx.get(ContextConstants.RESPONSE.toString()));
assertTrue("has Failures", ctx.getResult().hasFailures());
assertTrue(ctx.getResult().failure().getIrc() == CMF.MISCONFIGURED_ENDPOINT);
}
use of org.jpos.transaction.Context in project jPOS by jpos.
the class QueryHostTest method testNoRequest.
@Test
public void testNoRequest() throws Exception {
Context ctx = new Context();
cfg.put("continuations", "no");
queryHost.setConfiguration(cfg);
ctx.put(ContextConstants.DESTINATION.toString(), "TEST");
int action = queryHost.prepare(1L, ctx);
assertTrue(action == FAIL);
assertNull(ctx.get(ContextConstants.RESPONSE.toString()));
assertTrue("has Failures", ctx.getResult().hasFailures());
assertTrue(ctx.getResult().failure().getIrc() == CMF.INVALID_REQUEST);
}
use of org.jpos.transaction.Context in project jPOS by jpos.
the class SelectDestinationTest method testNetwork6.
@Test
public void testNetwork6() {
cfg.put("ignore-luhn", "true");
p.setConfiguration(cfg);
Context ctx = new Context();
ctx.put(ContextConstants.REQUEST.toString(), createISOMsg("6111111111111111"));
int action = p.prepare(1L, ctx);
assertEquals("Action should be PREPARED|NO_JOIN|READONLY", PREPARED | NO_JOIN | READONLY, action);
Result rc = ctx.getResult();
assertFalse("No failures", rc.hasFailures());
assertEquals("Invalid Destination", "N6", ctx.getString(DESTINATION.toString()));
}
use of org.jpos.transaction.Context in project jPOS by jpos.
the class SelectDestinationTest method testNetwork_V.
@Test
public void testNetwork_V() {
cfg.put("ignore-luhn", "false");
p.setConfiguration(cfg);
Context ctx = new Context();
ctx.put(ContextConstants.REQUEST.toString(), createISOMsg("4111111111111111"));
int action = p.prepare(1L, ctx);
assertEquals("Action should be PREPARED|NO_JOIN|READONLY", PREPARED | NO_JOIN | READONLY, action);
Result rc = ctx.getResult();
assertFalse("No failures", rc.hasFailures());
assertEquals("Invalid Destination", "V", ctx.getString(DESTINATION.toString()));
}
use of org.jpos.transaction.Context in project jPOS by jpos.
the class SelectDestinationTest method testNetwork7.
@Test
public void testNetwork7() {
cfg.put("ignore-luhn", "true");
p.setConfiguration(cfg);
Context ctx = new Context();
ctx.put(ContextConstants.REQUEST.toString(), createISOMsg("7111111111111111"));
int action = p.prepare(1L, ctx);
assertEquals("Action should be PREPARED|NO_JOIN|READONLY", PREPARED | NO_JOIN | READONLY, action);
Result rc = ctx.getResult();
assertFalse("No failures", rc.hasFailures());
assertEquals("Invalid Destination", "N7", ctx.getString(DESTINATION.toString()));
}
Aggregations