Search in sources :

Example 1 with BookmarkChangedClientNotification

use of org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkChangedClientNotification in project scout.rt by eclipse.

the class ClusterSynchronizationServiceTest method testTransactionalWithCoalesce.

@Test
public void testTransactionalWithCoalesce() throws Exception {
    ArgumentCaptor<ClusterNotificationMessage> msgCaptor = ArgumentCaptor.forClass(ClusterNotificationMessage.class);
    doNothing().when(m_nullMomImplementorSpy).publish(eq(IClusterMomDestinations.CLUSTER_NOTIFICATION_TOPIC), msgCaptor.capture(), any(PublishInput.class));
    m_svc.publishTransactional(new BookmarkChangedClientNotification());
    m_svc.publishTransactional(new BookmarkChangedClientNotification());
    m_svc.publishTransactional(new InvalidateCacheNotification("TEST", new AllCacheEntryFilter<>()));
    ITransaction.CURRENT.get().commitPhase1();
    ITransaction.CURRENT.get().commitPhase2();
    // verify
    verify(m_nullMomImplementorSpy, times(2)).publish(eq(IClusterMomDestinations.CLUSTER_NOTIFICATION_TOPIC), any(IClusterNotificationMessage.class), any(PublishInput.class));
    assertEquals(2, m_svc.getStatusInfo().getSentMessageCount());
    List<ClusterNotificationMessage> messages = msgCaptor.getAllValues();
    assertEquals(BookmarkChangedClientNotification.class, messages.get(0).getNotification().getClass());
    assertEquals(InvalidateCacheNotification.class, messages.get(1).getNotification().getClass());
}
Also used : BookmarkChangedClientNotification(org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkChangedClientNotification) AllCacheEntryFilter(org.eclipse.scout.rt.shared.cache.AllCacheEntryFilter) PublishInput(org.eclipse.scout.rt.mom.api.PublishInput) ClusterNotificationMessage(org.eclipse.scout.rt.server.services.common.clustersync.internal.ClusterNotificationMessage) InvalidateCacheNotification(org.eclipse.scout.rt.shared.cache.InvalidateCacheNotification) Test(org.junit.Test)

Aggregations

PublishInput (org.eclipse.scout.rt.mom.api.PublishInput)1 ClusterNotificationMessage (org.eclipse.scout.rt.server.services.common.clustersync.internal.ClusterNotificationMessage)1 AllCacheEntryFilter (org.eclipse.scout.rt.shared.cache.AllCacheEntryFilter)1 InvalidateCacheNotification (org.eclipse.scout.rt.shared.cache.InvalidateCacheNotification)1 BookmarkChangedClientNotification (org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkChangedClientNotification)1 Test (org.junit.Test)1