use of org.springframework.jms.listener.adapter.MessageListenerAdapter in project spring-framework by spring-projects.
the class JmsListenerEndpointTests method setupMessageContainerUnsupportedContainer.
@Test
public void setupMessageContainerUnsupportedContainer() {
MessageListenerContainer container = mock(MessageListenerContainer.class);
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
endpoint.setMessageListener(new MessageListenerAdapter());
thrown.expect(IllegalArgumentException.class);
endpoint.setupListenerContainer(container);
}
use of org.springframework.jms.listener.adapter.MessageListenerAdapter in project spring-framework by spring-projects.
the class JmsListenerEndpointTests method setupJcaMessageContainerFullConfig.
@Test
public void setupJcaMessageContainerFullConfig() {
JmsMessageEndpointManager container = new JmsMessageEndpointManager();
MessageListener messageListener = new MessageListenerAdapter();
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
endpoint.setDestination("myQueue");
endpoint.setSelector("foo = 'bar'");
endpoint.setSubscription("mySubscription");
endpoint.setConcurrency("10");
endpoint.setMessageListener(messageListener);
endpoint.setupListenerContainer(container);
JmsActivationSpecConfig config = container.getActivationSpecConfig();
assertEquals("myQueue", config.getDestinationName());
assertEquals("foo = 'bar'", config.getMessageSelector());
assertEquals("mySubscription", config.getSubscriptionName());
assertEquals(10, config.getMaxConcurrency());
assertEquals(messageListener, container.getMessageListener());
}
use of org.springframework.jms.listener.adapter.MessageListenerAdapter in project spring-framework by spring-projects.
the class JmsListenerContainerFactoryTests method createJcaContainerFullConfig.
@Test
public void createJcaContainerFullConfig() {
DefaultJcaListenerContainerFactory factory = new DefaultJcaListenerContainerFactory();
setDefaultJcaConfig(factory);
factory.setConcurrency("10");
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
MessageListener messageListener = new MessageListenerAdapter();
endpoint.setMessageListener(messageListener);
endpoint.setDestination("myQueue");
JmsMessageEndpointManager container = factory.createListenerContainer(endpoint);
assertDefaultJcaConfig(container);
assertEquals(10, container.getActivationSpecConfig().getMaxConcurrency());
assertEquals(messageListener, container.getMessageListener());
assertEquals("myQueue", container.getActivationSpecConfig().getDestinationName());
}
use of org.springframework.jms.listener.adapter.MessageListenerAdapter in project spring-framework by spring-projects.
the class JmsListenerContainerFactoryTests method backOffOverridesRecoveryInterval.
@Test
public void backOffOverridesRecoveryInterval() {
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
BackOff backOff = new FixedBackOff();
factory.setBackOff(backOff);
factory.setRecoveryInterval(2000L);
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
MessageListener messageListener = new MessageListenerAdapter();
endpoint.setMessageListener(messageListener);
endpoint.setDestination("myQueue");
DefaultMessageListenerContainer container = factory.createListenerContainer(endpoint);
assertSame(backOff, new DirectFieldAccessor(container).getPropertyValue("backOff"));
}
use of org.springframework.jms.listener.adapter.MessageListenerAdapter in project spring-framework by spring-projects.
the class JmsListenerContainerFactoryTests method createSimpleContainer.
@Test
public void createSimpleContainer() {
SimpleJmsListenerContainerFactory factory = new SimpleJmsListenerContainerFactory();
setDefaultJmsConfig(factory);
SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
MessageListener messageListener = new MessageListenerAdapter();
endpoint.setMessageListener(messageListener);
endpoint.setDestination("myQueue");
SimpleMessageListenerContainer container = factory.createListenerContainer(endpoint);
assertDefaultJmsConfig(container);
assertEquals(messageListener, container.getMessageListener());
assertEquals("myQueue", container.getDestinationName());
}
Aggregations