Search in sources :

Example 1 with MessageListener

use of org.springframework.data.redis.connection.MessageListener in project camel by apache.

the class RedisConsumerTest method consumerReceivesMessages.

@Test
public void consumerReceivesMessages() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMinimumMessageCount(2);
    ArgumentCaptor<MessageListener> messageListenerCaptor = ArgumentCaptor.forClass(MessageListener.class);
    verify(listenerContainer).addMessageListener(messageListenerCaptor.capture(), any(Collection.class));
    MessageListener messageListener = messageListenerCaptor.getValue();
    messageListener.onMessage(new DefaultMessage(null, null), null);
    messageListener.onMessage(new DefaultMessage(null, null), null);
    mock.assertIsSatisfied();
}
Also used : DefaultMessage(org.springframework.data.redis.connection.DefaultMessage) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) MessageListener(org.springframework.data.redis.connection.MessageListener) Collection(java.util.Collection) Test(org.junit.Test)

Aggregations

Collection (java.util.Collection)1 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)1 Test (org.junit.Test)1 DefaultMessage (org.springframework.data.redis.connection.DefaultMessage)1 MessageListener (org.springframework.data.redis.connection.MessageListener)1