This commit is contained in:
Oleg Zhurakousky
2010-08-09 02:40:19 +00:00
parent 1a3c09c367
commit 33089397c9
2 changed files with 32 additions and 16 deletions

View File

@@ -18,10 +18,17 @@
<int:channel id="outbound-channel"/>
<int-jms:outbound-gateway request-channel="outbound-channel" request-destination="requestQueue"/>
<int-jms:outbound-gateway request-channel="outbound-channel" request-destination="requestQueueC"/>
<int-jms:inbound-gateway request-destination="requestQueue"
<int-jms:inbound-gateway request-destination="requestQueueB"
request-channel="jmsinputchannel"
exception-mapper="errorMessageMapper"/>
<int-jms:inbound-gateway request-destination="requestQueueA"
request-channel="jmsinputchannel"/>
<int-jms:inbound-gateway request-destination="requestQueueC"
request-channel="jmsinputchannel"
exception-mapper="errorMessageMapper"/>
@@ -41,16 +48,24 @@
<bean class="org.springframework.integration.jms.config.ExceptionHandlingSiConsumerTests$SampleService"/>
</int:service-activator>
<bean id="requestQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="request.queue"/>
<bean id="requestQueueA" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="request.queue.a"/>
</bean>
<bean id="replyQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="reply.queue"/>
<bean id="replyQueueA" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="reply.queue.a"/>
</bean>
<bean id="replyTopic" class="org.apache.activemq.command.ActiveMQTopic">
<constructor-arg value="reply.topic"/>
<bean id="requestQueueB" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="request.queue.b"/>
</bean>
<bean id="replyQueueB" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="reply.queue.b"/>
</bean>
<bean id="requestQueueC" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="request.queue.c"/>
</bean>
<bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">

View File

@@ -38,13 +38,13 @@ import org.springframework.jms.core.MessageCreator;
*/
public class ExceptionHandlingSiConsumerTests {
@Test @Ignore
@Test
public void nonSiProducer_siConsumer_sync_withReturn() throws Exception {
ActiveMqTestUtils.prepare();
ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext("Exception-nonSiProducer-siConsumer.xml", ExceptionHandlingSiConsumerTests.class);
JmsTemplate jmsTemplate = new JmsTemplate(applicationContext.getBean("connectionFactory", ConnectionFactory.class));
Destination request = applicationContext.getBean("requestQueue", Destination.class);
final Destination reply = applicationContext.getBean("replyQueue", Destination.class);
Destination request = applicationContext.getBean("requestQueueA", Destination.class);
final Destination reply = applicationContext.getBean("replyQueueA", Destination.class);
jmsTemplate.send(request, new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
@@ -55,16 +55,17 @@ public class ExceptionHandlingSiConsumerTests {
}
});
Message message = jmsTemplate.receive(reply);
System.out.println(message);
Assert.assertNotNull(message);
applicationContext.close();
}
@Test @Ignore
@Test
public void nonSiProducer_siConsumer_sync_withReturnNoException() throws Exception {
ActiveMqTestUtils.prepare();
ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext("Exception-nonSiProducer-siConsumer.xml", ExceptionHandlingSiConsumerTests.class);
JmsTemplate jmsTemplate = new JmsTemplate(applicationContext.getBean("connectionFactory", ConnectionFactory.class));
Destination request = applicationContext.getBean("requestQueue", Destination.class);
final Destination reply = applicationContext.getBean("replyQueue", Destination.class);
Destination request = applicationContext.getBean("requestQueueB", Destination.class);
final Destination reply = applicationContext.getBean("replyQueueB", Destination.class);
jmsTemplate.send(request, new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
@@ -79,7 +80,7 @@ public class ExceptionHandlingSiConsumerTests {
applicationContext.close();
}
@Test @Ignore
@Test
public void nonSiProducer_siConsumer_sync_withOutboundGateway() throws Exception{
ActiveMqTestUtils.prepare();
final ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext("Exception-nonSiProducer-siConsumer.xml", ExceptionHandlingSiConsumerTests.class);
@@ -88,7 +89,7 @@ public class ExceptionHandlingSiConsumerTests {
System.out.println("Reply: " + reply);
applicationContext.close();
}
//
public static class SampleService{
public String echoWithException(String value){
throw new SampleException("echoWithException");