Search in sources :

Example 1 with IClientNotificationService

use of org.eclipse.scout.rt.shared.clientnotification.IClientNotificationService in project scout.rt by eclipse.

the class ClientNotificationClusterNotificationTest method testClientNotificationsReceived.

/**
 * Tests that the client notifications are added to the queue when received
 */
@SuppressWarnings("unchecked")
@Test
public void testClientNotificationsReceived() {
    IMessage<IClusterNotificationMessage> momMsg = mock(IMessage.class);
    ClientNotificationAddress address = ClientNotificationAddress.createAllNodesAddress();
    ClientNotificationMessage message = new ClientNotificationMessage(address, "test", true, "cid");
    ArrayList<ClientNotificationMessage> messages = new ArrayList<ClientNotificationMessage>();
    messages.add(message);
    when(momMsg.getTransferObject()).thenReturn(new ClusterNotificationMessage(new ClientNotificationClusterNotification(messages), m_testProps));
    m_svc.onMessage(momMsg);
    IClientNotificationService c = BEANS.get(IClientNotificationService.class);
    List<ClientNotificationMessage> notifications = c.getNotifications(TEST_NODE);
    assertEquals(1, notifications.size());
}
Also used : ClientNotificationClusterNotification(org.eclipse.scout.rt.server.clientnotification.ClientNotificationClusterNotification) ClientNotificationAddress(org.eclipse.scout.rt.shared.clientnotification.ClientNotificationAddress) ArrayList(java.util.ArrayList) ClusterNotificationMessage(org.eclipse.scout.rt.server.services.common.clustersync.internal.ClusterNotificationMessage) IClientNotificationService(org.eclipse.scout.rt.shared.clientnotification.IClientNotificationService) ClientNotificationMessage(org.eclipse.scout.rt.shared.clientnotification.ClientNotificationMessage) Test(org.junit.Test)

Example 2 with IClientNotificationService

use of org.eclipse.scout.rt.shared.clientnotification.IClientNotificationService in project scout.rt by eclipse.

the class AccessControlServiceTest method setup.

@Before
public void setup() {
    m_accessControlService = BeanInstanceUtil.createBean(TestAccessControlService.class);
    BeanInstanceUtil.initializeBeanInstance(m_accessControlService);
    // Register this IAccessControlService with an higher priority than AllAccessControlService registered in CustomServerTestEnvironment
    m_registerServices = TestingUtility.registerBeans(new BeanMetaData(IAccessControlService.class).withInitialInstance(m_accessControlService).withApplicationScoped(true), new BeanMetaData(MaxNotificationBlockingTimeOut.class).withInitialInstance(new TestBlockingProperty()).withApplicationScoped(true));
    // register test session
    final IClientNotificationService registry = BEANS.get(IClientNotificationService.class);
    registry.registerSession("testNode", "testSession", "testuser");
}
Also used : BeanMetaData(org.eclipse.scout.rt.platform.BeanMetaData) IClientNotificationService(org.eclipse.scout.rt.shared.clientnotification.IClientNotificationService) Before(org.junit.Before)

Aggregations

IClientNotificationService (org.eclipse.scout.rt.shared.clientnotification.IClientNotificationService)2 ArrayList (java.util.ArrayList)1 BeanMetaData (org.eclipse.scout.rt.platform.BeanMetaData)1 ClientNotificationClusterNotification (org.eclipse.scout.rt.server.clientnotification.ClientNotificationClusterNotification)1 ClusterNotificationMessage (org.eclipse.scout.rt.server.services.common.clustersync.internal.ClusterNotificationMessage)1 ClientNotificationAddress (org.eclipse.scout.rt.shared.clientnotification.ClientNotificationAddress)1 ClientNotificationMessage (org.eclipse.scout.rt.shared.clientnotification.ClientNotificationMessage)1 Before (org.junit.Before)1 Test (org.junit.Test)1