use of com.yahoo.messagebus.jdisc.test.MessageQueue in project vespa by vespa-engine.
the class SharedDestinationSessionTestCase method requireThatMessageHandlerCanBeAccessed.
@Test
public void requireThatMessageHandlerCanBeAccessed() {
SharedDestinationSession session = newDestinationSession();
assertNull(session.getMessageHandler());
MessageQueue handler = new MessageQueue();
session.setMessageHandler(handler);
assertSame(handler, session.getMessageHandler());
}
use of com.yahoo.messagebus.jdisc.test.MessageQueue in project vespa by vespa-engine.
the class SharedDestinationSessionTestCase method requireThatMessageHandlerIsCalled.
@Test
public void requireThatMessageHandlerIsCalled() throws InterruptedException {
SharedDestinationSession session = newDestinationSession();
MessageQueue queue = new MessageQueue();
session.setMessageHandler(queue);
session.handleMessage(new SimpleMessage("foo"));
assertNotNull(queue.awaitMessage(60, TimeUnit.SECONDS));
session.release();
}
use of com.yahoo.messagebus.jdisc.test.MessageQueue in project vespa by vespa-engine.
the class SharedDestinationSessionTestCase method requireThatMessageHandlerCanOnlyBeSetOnce.
@Test
public void requireThatMessageHandlerCanOnlyBeSetOnce() {
SharedDestinationSession session = newDestinationSession();
session.setMessageHandler(new MessageQueue());
try {
session.setMessageHandler(new MessageQueue());
fail();
} catch (IllegalStateException e) {
assertEquals("Message handler already registered.", e.getMessage());
}
session.release();
}
Aggregations