Search in sources :

Example 1 with MessageDispatcher

use of akka.dispatch.MessageDispatcher in project controller by opendaylight.

the class DispatchersTest method testGetDispatcher.

@Test
public void testGetDispatcher() {
    akka.dispatch.Dispatchers mockDispatchers = mock(akka.dispatch.Dispatchers.class);
    MessageDispatcher mockDispatcher = mock(MessageDispatcher.class);
    doReturn(true).when(mockDispatchers).hasDispatcher(anyString());
    doReturn(mockDispatcher).when(mockDispatchers).lookup(anyString());
    Dispatchers dispatchers = new Dispatchers(mockDispatchers);
    assertEquals(Dispatchers.CLIENT_DISPATCHER_PATH, dispatchers.getDispatcherPath(Dispatchers.DispatcherType.Client));
    assertEquals(Dispatchers.TXN_DISPATCHER_PATH, dispatchers.getDispatcherPath(Dispatchers.DispatcherType.Transaction));
    assertEquals(Dispatchers.SHARD_DISPATCHER_PATH, dispatchers.getDispatcherPath(Dispatchers.DispatcherType.Shard));
    assertEquals(Dispatchers.NOTIFICATION_DISPATCHER_PATH, dispatchers.getDispatcherPath(Dispatchers.DispatcherType.Notification));
}
Also used : MessageDispatcher(akka.dispatch.MessageDispatcher) Dispatchers(org.opendaylight.controller.cluster.common.actor.Dispatchers) Test(org.junit.Test)

Example 2 with MessageDispatcher

use of akka.dispatch.MessageDispatcher in project controller by opendaylight.

the class DispatchersTest method testGetDefaultDispatcher.

@Test
public void testGetDefaultDispatcher() {
    akka.dispatch.Dispatchers mockDispatchers = mock(akka.dispatch.Dispatchers.class);
    MessageDispatcher mockGlobalDispatcher = mock(MessageDispatcher.class);
    doReturn(false).when(mockDispatchers).hasDispatcher(anyString());
    doReturn(mockGlobalDispatcher).when(mockDispatchers).defaultGlobalDispatcher();
    Dispatchers dispatchers = new Dispatchers(mockDispatchers);
    for (Dispatchers.DispatcherType type : Dispatchers.DispatcherType.values()) {
        assertEquals(mockGlobalDispatcher, dispatchers.getDispatcher(type));
    }
}
Also used : MessageDispatcher(akka.dispatch.MessageDispatcher) Dispatchers(org.opendaylight.controller.cluster.common.actor.Dispatchers) Test(org.junit.Test)

Aggregations

MessageDispatcher (akka.dispatch.MessageDispatcher)2 Test (org.junit.Test)2 Dispatchers (org.opendaylight.controller.cluster.common.actor.Dispatchers)2