public void test_tpcall_x_octet_commit_tx_rollback_only() throws Exception {
log.debug("JABTestCase::test_tpcall_x_octet_commit_tx_rollback_only");
runServer.tpadvertisetpcallXOctet();
JABSessionAttributes jabSessionAttributes = new JABSessionAttributes();
JABSession jabSession = new JABSession(jabSessionAttributes);
JABTransaction transaction = new JABTransaction(jabSession, 5000);
JABServiceInvoker jabService = new JABServiceInvoker(
RunServer.getServiceNametpcallXOctet(), jabSession, "X_OCTET",
null);
transaction.rollback_only();
jabService.getRequest().setByteArray("X_OCTET",
"test_tpcall_x_octet".getBytes());
jabService.call(transaction);
try {
transaction.commit();
fail("committing a tx marked rollback only succeeded");
} catch (JABException e) {
// the exception is expected, but:
// exception should be CORBA::CORBA::TRANSACTION_ROLLEDBACK but
// JBossTM
// returns CORBA::OBJECT_NOT_EXIST instead in which case we would
// use presumed abort");
}
byte[] expected = new byte[60];
System.arraycopy("tpcall_x_octet".getBytes(), 0, expected, 0, 14);
byte[] received = jabService.getResponse().getByteArray("X_OCTET");
assertTrue(Arrays.equals(expected, received));
jabSession.closeSession();
}