use of models.ChatRoom.Event in project play-cookbook by spinscale.
the class ActiveMqTest method assertThatPluginSendsMessages.
@Test
public void assertThatPluginSendsMessages() throws Exception {
assertEquals(0, ChatRoom.get().archive().size());
Event event = new Join("user");
ChatRoom.get().publish(event);
// Check chatroom
int currentEventCount = ChatRoom.get().archive().size();
assertEquals(1, currentEventCount);
// Check for messages
Message msg = receiveSubscriber.receive(2000);
Event evt = (ChatRoom.Event) ((ObjectMessage) msg).getObject();
assertEquals("join", evt.type);
}
use of models.ChatRoom.Event in project play-cookbook by spinscale.
the class ActiveMqTest method assertThatPluginReceivesMessages.
@Test
public void assertThatPluginReceivesMessages() throws Exception {
assertEquals(0, ChatRoom.get().archive().size());
// Send event via JMS
Event event = new ChatRoom.Message("alex", "cool here");
ObjectMessage objMsg = sendingSession.createObjectMessage(event);
sendingPublisher.publish(objMsg);
// short sleep to make sure the content arrives
Thread.sleep(1000);
assertEquals(1, ChatRoom.get().archive().size());
}
use of models.ChatRoom.Event in project play-cookbook by spinscale.
the class ActiveMqTest method assertThatPluginSendsMessages.
@Test
public void assertThatPluginSendsMessages() throws Exception {
assertEquals(0, ChatRoom.get().archive().size());
Event event = new Join("user");
ChatRoom.get().publish(event);
// Check chatroom
int currentEventCount = ChatRoom.get().archive().size();
assertEquals(1, currentEventCount);
// Check for messages
Message msg = receiveSubscriber.receive(2000);
Event evt = (ChatRoom.Event) ((ObjectMessage) msg).getObject();
assertEquals("join", evt.type);
}
use of models.ChatRoom.Event in project play-cookbook by spinscale.
the class ActiveMqTest method assertThatPluginReceivesMessages.
@Test
public void assertThatPluginReceivesMessages() throws Exception {
assertEquals(0, ChatRoom.get().archive().size());
// Send event via JMS
Event event = new ChatRoom.Message("alex", "cool here");
ObjectMessage objMsg = sendingSession.createObjectMessage(event);
sendingPublisher.publish(objMsg);
// short sleep to make sure the content arrives
Thread.sleep(1000);
assertEquals(1, ChatRoom.get().archive().size());
}