Search in sources :

Example 1 with TransactionCompletedEvent

use of org.infinispan.notifications.cachelistener.event.TransactionCompletedEvent in project infinispan by infinispan.

the class CacheNotifierImplTest method testNotifyTransactionCompleted.

public void testNotifyTransactionCompleted() {
    GlobalTransaction tx = mock(GlobalTransaction.class);
    n.notifyTransactionCompleted(tx, true, ctx);
    n.notifyTransactionCompleted(tx, false, ctx);
    assertEquals(2, cl.getInvocationCount());
    assertEquals(mockCache, cl.getEvents().get(0).getCache());
    assertEquals(Event.Type.TRANSACTION_COMPLETED, cl.getEvents().get(0).getType());
    assertTrue(((TransactionCompletedEvent) cl.getEvents().get(0)).isTransactionSuccessful());
    assertEquals(((TransactionCompletedEvent) cl.getEvents().get(0)).getGlobalTransaction(), tx);
    assertEquals(mockCache, cl.getEvents().get(1).getCache());
    assertEquals(Event.Type.TRANSACTION_COMPLETED, cl.getEvents().get(1).getType());
    assertTrue(!((TransactionCompletedEvent) cl.getEvents().get(1)).isTransactionSuccessful());
    assertEquals(((TransactionCompletedEvent) cl.getEvents().get(1)).getGlobalTransaction(), tx);
}
Also used : GlobalTransaction(org.infinispan.transaction.xa.GlobalTransaction) TransactionCompletedEvent(org.infinispan.notifications.cachelistener.event.TransactionCompletedEvent)

Aggregations

TransactionCompletedEvent (org.infinispan.notifications.cachelistener.event.TransactionCompletedEvent)1 GlobalTransaction (org.infinispan.transaction.xa.GlobalTransaction)1