@Test
 public void testTransactionalOfferAndPollWithTimeout() throws InterruptedException {
   final String item = "offered";
   final String name = randomString();
   final TransactionContext context = client.newTransactionContext();
   context.beginTransaction();
   TransactionalQueue<String> txnQueue = context.getQueue(name);
   assertTrue(txnQueue.offer(item));
   assertEquals(1, txnQueue.size());
   assertEquals(item, txnQueue.poll(5, TimeUnit.SECONDS));
   context.commitTransaction();
 }
  @Test
  public void testTransactionalOfferPoll() {
    final String item = "offered";
    final String queueName = randomString();
    final IQueue queue = client.getQueue(queueName);

    final TransactionContext context = client.newTransactionContext();
    context.beginTransaction();
    TransactionalQueue txnQueue = context.getQueue(queueName);
    txnQueue.offer(item);
    assertEquals(item, txnQueue.poll());
    context.commitTransaction();
  }
  @Test
  public void testTransactionalOfferRoleBack() {
    final String name = randomString();
    final IQueue queue = client.getQueue(name);

    final TransactionContext context = client.newTransactionContext();
    context.beginTransaction();
    TransactionalQueue<String> qTxn = context.getQueue(name);
    qTxn.offer("ITEM");
    context.rollbackTransaction();

    assertEquals(0, queue.size());
  }
  @Test
  public void testTransactionalQueueSize() {
    final String item = "offered";
    final String name = randomString();
    final IQueue queue = client.getQueue(name);

    queue.offer(item);

    final TransactionContext context = client.newTransactionContext();
    context.beginTransaction();
    TransactionalQueue<String> txnQueue = context.getQueue(name);

    txnQueue.offer(item);
    assertEquals(2, txnQueue.size());

    context.rollbackTransaction();
  }