final int insCount = 4;
final String name = "defQueue";
final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(insCount);
final HazelcastInstance[] instances = factory.newInstances(config);
final TransactionContext context = instances[0].newTransactionContext();
context.beginTransaction();
try {
TransactionalQueue<String> q = context.getQueue(name);
final String response1 = q.peek(10, TimeUnit.SECONDS);
assertNull(response1);
assertTrue(q.offer("ali"));
final String response2 = q.peek();
assertEquals("ali", response2);
context.commitTransaction();
} catch (TransactionException e) {
context.rollbackTransaction();
throw e;
}
assertEquals(1, getQueue(instances, name).size());
}