From 1602367641827b9c87ce52ba17acaaff7ca2f11b Mon Sep 17 00:00:00 2001 From: antelder Date: Fri, 6 Feb 2009 11:36:10 +0000 Subject: TUSCANY-2820: start adding support for the varrious property elements on the jms binding git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@741542 13f79535-47bb-0310-9956-ffa450edef68 --- .../jms/impl/JMSBindingProcessorTestCase.java | 235 +++++++++++++++++++++ 1 file changed, 235 insertions(+) (limited to 'branches/sca-java-1.x/modules/binding-jms/src/test/java') diff --git a/branches/sca-java-1.x/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java b/branches/sca-java-1.x/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java index ff41751d7d..b715d4997c 100644 --- a/branches/sca-java-1.x/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java +++ b/branches/sca-java-1.x/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java @@ -148,6 +148,132 @@ public class JMSBindingProcessorTestCase extends TestCase { + " " + ""; + private static final String DEST_PROPS = + "" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " some value text" + + " " + + " " + + " bla" + + " " + + " " + + " " + + " " + + " " + + ""; + + private static final String CF_PROPS = + "" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " some value text" + + " " + + " " + + " bla" + + " " + + " " + + " " + + " " + + " " + + ""; + + private static final String AS_PROPS = + "" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " some value text" + + " " + + " " + + " bla" + + " " + + " " + + " " + + " " + + " " + + ""; + + private static final String RESP_DEST_PROPS = + "" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " some value text" + + " " + + " " + + " bla" + + " " + + " " + + " " + + " " + + " " + + " " + + ""; + + private static final String RESP_CF_PROPS = + "" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " some value text" + + " " + + " " + + " bla" + + " " + + " " + + " " + + " " + + " " + + " " + + ""; + + private static final String RESP_AS_PROPS = + "" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " some value text" + + " " + + " " + + " bla" + + " " + + " " + + " " + + " " + + " " + + " " + + ""; + private XMLInputFactory inputFactory; private StAXArtifactProcessor staxProcessor; private Monitor monitor; @@ -267,4 +393,113 @@ public class JMSBindingProcessorTestCase extends TestCase { assertTrue( e.getClass().isAssignableFrom( JMSBindingException.class ) ); } } + + public void testDestinationProperties() throws Exception { + XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(DEST_PROPS)); + + Composite composite = (Composite)staxProcessor.read(reader); + JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0); + + assertNotNull(binding); + assertNotNull(binding.getDestinationProperties()); + assertEquals(2, binding.getDestinationProperties().size()); + BindingProperty bp = binding.getDestinationProperties().get("xxx"); + assertEquals("xxx", bp.getName()); + assertEquals("yyy", bp.getType()); + assertEquals("some value text", bp.getValue().toString().trim()); + BindingProperty bp2 = binding.getDestinationProperties().get("two"); + assertEquals("two", bp2.getName()); + assertEquals(null, bp2.getType()); + assertEquals("bla", bp2.getValue().toString().trim()); + } + public void testConnectionFactoryProperties() throws Exception { + XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(CF_PROPS)); + + Composite composite = (Composite)staxProcessor.read(reader); + JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0); + + assertNotNull(binding); + assertNotNull(binding.getConnectionFactoryProperties()); + assertEquals(2, binding.getConnectionFactoryProperties().size()); + BindingProperty bp = binding.getConnectionFactoryProperties().get("xxx"); + assertEquals("xxx", bp.getName()); + assertEquals("yyy", bp.getType()); + assertEquals("some value text", bp.getValue().toString().trim()); + BindingProperty bp2 = binding.getConnectionFactoryProperties().get("two"); + assertEquals("two", bp2.getName()); + assertEquals(null, bp2.getType()); + assertEquals("bla", bp2.getValue().toString().trim()); + } + public void testActivationSpecProperties() throws Exception { + XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(AS_PROPS)); + + Composite composite = (Composite)staxProcessor.read(reader); + JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0); + + assertNotNull(binding); + assertNotNull(binding.getActivationSpecProperties()); + assertEquals(2, binding.getActivationSpecProperties().size()); + BindingProperty bp = binding.getActivationSpecProperties().get("xxx"); + assertEquals("xxx", bp.getName()); + assertEquals("yyy", bp.getType()); + assertEquals("some value text", bp.getValue().toString().trim()); + BindingProperty bp2 = binding.getActivationSpecProperties().get("two"); + assertEquals("two", bp2.getName()); + assertEquals(null, bp2.getType()); + assertEquals("bla", bp2.getValue().toString().trim()); + } + public void testResponseDestinationProperties() throws Exception { + XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(RESP_DEST_PROPS)); + + Composite composite = (Composite)staxProcessor.read(reader); + JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0); + + assertNotNull(binding); + assertNotNull(binding.getResponseDestinationProperties()); + assertEquals(2, binding.getResponseDestinationProperties().size()); + BindingProperty bp = binding.getResponseDestinationProperties().get("xxx"); + assertEquals("xxx", bp.getName()); + assertEquals("yyy", bp.getType()); + assertEquals("some value text", bp.getValue().toString().trim()); + BindingProperty bp2 = binding.getResponseDestinationProperties().get("two"); + assertEquals("two", bp2.getName()); + assertEquals(null, bp2.getType()); + assertEquals("bla", bp2.getValue().toString().trim()); + } + public void testResponseConnectionFactoryProperties() throws Exception { + XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(RESP_CF_PROPS)); + + Composite composite = (Composite)staxProcessor.read(reader); + JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0); + + assertNotNull(binding); + assertNotNull(binding.getResponseConnectionFactoryProperties()); + assertEquals(2, binding.getResponseConnectionFactoryProperties().size()); + BindingProperty bp = binding.getResponseConnectionFactoryProperties().get("xxx"); + assertEquals("xxx", bp.getName()); + assertEquals("yyy", bp.getType()); + assertEquals("some value text", bp.getValue().toString().trim()); + BindingProperty bp2 = binding.getResponseConnectionFactoryProperties().get("two"); + assertEquals("two", bp2.getName()); + assertEquals(null, bp2.getType()); + assertEquals("bla", bp2.getValue().toString().trim()); + } + public void testResponseActivationSpecProperties() throws Exception { + XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(RESP_AS_PROPS)); + + Composite composite = (Composite)staxProcessor.read(reader); + JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0); + + assertNotNull(binding); + assertNotNull(binding.getResponseActivationSpecProperties()); + assertEquals(2, binding.getResponseActivationSpecProperties().size()); + BindingProperty bp = binding.getResponseActivationSpecProperties().get("xxx"); + assertEquals("xxx", bp.getName()); + assertEquals("yyy", bp.getType()); + assertEquals("some value text", bp.getValue().toString().trim()); + BindingProperty bp2 = binding.getResponseActivationSpecProperties().get("two"); + assertEquals("two", bp2.getName()); + assertEquals(null, bp2.getType()); + assertEquals("bla", bp2.getValue().toString().trim()); + } } -- cgit v1.2.3