From b2b2912b1e0336fdeb4d10c1f7d42487e0b619ee Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Wed, 14 May 2008 15:13:32 +0000 Subject: [PATCH] Added tests for the "expect-reply" attribute on the element. --- .../jms/config/JmsGatewayParserTests.java | 28 ++++++++++++++ .../jmsGatewaysWithExpectReplyAttributes.xml | 38 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 spring-integration-adapters/src/test/java/org/springframework/integration/adapter/jms/config/jmsGatewaysWithExpectReplyAttributes.xml diff --git a/spring-integration-adapters/src/test/java/org/springframework/integration/adapter/jms/config/JmsGatewayParserTests.java b/spring-integration-adapters/src/test/java/org/springframework/integration/adapter/jms/config/JmsGatewayParserTests.java index ff7c52aee5..21565b63d9 100644 --- a/spring-integration-adapters/src/test/java/org/springframework/integration/adapter/jms/config/JmsGatewayParserTests.java +++ b/spring-integration-adapters/src/test/java/org/springframework/integration/adapter/jms/config/JmsGatewayParserTests.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertNotNull; import org.junit.Test; +import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -76,6 +77,33 @@ public class JmsGatewayParserTests { context.stop(); } + @Test + public void testGatewayWithDefaultExpectReply() { + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( + "jmsGatewaysWithExpectReplyAttributes.xml", this.getClass()); + JmsGateway gateway = (JmsGateway) context.getBean("defaultGateway"); + DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); + assertEquals(Boolean.FALSE, accessor.getPropertyValue("expectReply")); + } + + @Test + public void testGatewayExpectingReply() { + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( + "jmsGatewaysWithExpectReplyAttributes.xml", this.getClass()); + JmsGateway gateway = (JmsGateway) context.getBean("gatewayExpectingReply"); + DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); + assertEquals(Boolean.TRUE, accessor.getPropertyValue("expectReply")); + } + + @Test + public void testGatewayNotExpectingReply() { + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( + "jmsGatewaysWithExpectReplyAttributes.xml", this.getClass()); + JmsGateway gateway = (JmsGateway) context.getBean("gatewayNotExpectingReply"); + DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); + assertEquals(Boolean.FALSE, accessor.getPropertyValue("expectReply")); + } + @Test(expected=BeanDefinitionStoreException.class) public void testGatewayWithConnectionFactoryOnly() { try { diff --git a/spring-integration-adapters/src/test/java/org/springframework/integration/adapter/jms/config/jmsGatewaysWithExpectReplyAttributes.xml b/spring-integration-adapters/src/test/java/org/springframework/integration/adapter/jms/config/jmsGatewaysWithExpectReplyAttributes.xml new file mode 100644 index 0000000000..74d00db1e2 --- /dev/null +++ b/spring-integration-adapters/src/test/java/org/springframework/integration/adapter/jms/config/jmsGatewaysWithExpectReplyAttributes.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + +