use of org.infinispan.server.hotrod.test.TxResponse in project infinispan by infinispan.
the class ServerConfigurationTest method doCorrectConfigurationTest.
private void doCorrectConfigurationTest(String cacheName, ConfigurationBuilder builder) {
cacheManagers.forEach(cm -> cm.defineConfiguration(cacheName, builder.build()));
waitForClusterToForm(cacheName);
HotRodClient client = createClient(cacheName);
XidImpl xid = XidImpl.create(-1, new byte[] { 2 }, new byte[] { 3 });
try {
TxResponse response = (TxResponse) client.prepareTx(xid, false, Collections.emptyList());
assertEquals(XAResource.XA_RDONLY, response.xaCode);
response = (TxResponse) client.commitTx(xid);
assertEquals(XAException.XAER_NOTA, response.xaCode);
response = (TxResponse) client.rollbackTx(xid);
assertEquals(XAException.XAER_NOTA, response.xaCode);
assertServerTransactionTableEmpty(cacheName);
} finally {
HotRodTestingUtil.killClient(client);
}
}
use of org.infinispan.server.hotrod.test.TxResponse in project infinispan by infinispan.
the class ServerConfigurationTest method doWrongConfigurationTest.
private void doWrongConfigurationTest(String cacheName, ConfigurationBuilder builder, String errorMsg) {
cacheManagers.forEach(cm -> cm.defineConfiguration(cacheName, builder.build()));
waitForClusterToForm(cacheName);
HotRodClient client = createClient(cacheName);
XidImpl xid = XidImpl.create(-1, new byte[] { 2 }, new byte[] { 3 });
try {
TestErrorResponse response = (TestErrorResponse) client.prepareTx(xid, false, Collections.emptyList());
assertEquals(errorMsg, response.msg);
TxResponse response2 = (TxResponse) client.commitTx(xid);
assertEquals(XAException.XAER_NOTA, response2.xaCode);
response2 = (TxResponse) client.rollbackTx(xid);
assertEquals(XAException.XAER_NOTA, response2.xaCode);
assertServerTransactionTableEmpty(cacheName);
} finally {
HotRodTestingUtil.killClient(client);
}
}
Aggregations