use of org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET in project narayana by jbosstm.
the class TPReturnTpurcodeService method tpservice.
public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, ConfigurationException {
log.info("testtpreturn_service_tpurcode");
X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null);
toReturn.setByteArray(new byte[] { 0 });
if (TestTPConversation.strcmp(svcinfo.getBuffer(), "24") == 0) {
return new Response(Connection.TPSUCCESS, 24, toReturn, 0);
} else {
return new Response(Connection.TPSUCCESS, 77, toReturn, 0);
}
}
use of org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET in project narayana by jbosstm.
the class TPGetRplyTPNOBLOCKService method tpservice.
public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, ConfigurationException {
String response = "test_tpgetrply_TPNOBLOCK";
log.info(response);
int sendlen = response.length() + 1;
X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null);
toReturn.setByteArray(response.getBytes());
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
log.error("Was interrupted");
}
return new Response(Connection.TPSUCCESS, 0, toReturn, 0);
}
use of org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET in project narayana by jbosstm.
the class TPCallXCommonService method tpservice.
public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, ConfigurationException {
log.info("test_tpcall_x_common_service");
boolean ok = false;
X_COMMON dptr = (X_COMMON) svcinfo.getBuffer();
if (dptr.getLong("acct_no") == 12345678 && dptr.getShort("amount") == 50) {
ok = true;
}
int len = 60;
X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null);
if (ok) {
toReturn.setByteArray("tpcall_x_common".getBytes());
} else {
toReturn.setByteArray("fail".getBytes());
}
return new Response(Connection.TPSUCCESS, 22, toReturn, 0);
}
use of org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET in project narayana by jbosstm.
the class RollbackOnlyTpcallTPETIMEService method tpservice.
public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, ConfigurationException {
log.info("RollbackOnlyTpcallTPETIMEService");
try {
int timeout = 60;
log.info("RollbackOnlyTpcallTPETIMEService, sleeping for " + timeout + " seconds");
Thread.sleep(timeout * 1000);
log.info("RollbackOnlyTpcallTPETIMEService, slept for " + timeout + " seconds");
int len = 60;
X_OCTET toReturn = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null);
toReturn.setByteArray("test_tpcall_TPETIME_service".getBytes());
return new Response(Connection.TPSUCCESS, 0, toReturn, 0);
} catch (InterruptedException e) {
return new Response(Connection.TPFAIL, 0, null, 0);
}
}
Aggregations