diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-26 11:09:50 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-26 11:09:50 +0000 |
commit | b81731425e5fa400987e740d82e74534bcdf47a8 (patch) | |
tree | 48685d18d6ee46df861201ce78dc17940f9fff5a /branches/sca-java-1.x/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorWriteTestCase.java | |
parent | 339ba844b9a14e0e428d3ebad1dcb943c70bf58e (diff) |
TUSCANY-3120 - improve write processing so that it writes out what has been entered and ignores defaults where possible.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@788655 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorWriteTestCase.java')
-rw-r--r-- | branches/sca-java-1.x/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorWriteTestCase.java | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/branches/sca-java-1.x/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorWriteTestCase.java b/branches/sca-java-1.x/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorWriteTestCase.java index d9427407e5..5b18f30cbc 100644 --- a/branches/sca-java-1.x/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorWriteTestCase.java +++ b/branches/sca-java-1.x/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorWriteTestCase.java @@ -58,6 +58,26 @@ public class JMSBindingProcessorWriteTestCase extends TestCase { private XMLOutputFactory outputFactory; private StAXArtifactProcessor<Object> staxProcessor; private Monitor monitor; + + public static final String DEFAULT = + "<?xml version=\"1.0\" encoding=\"ASCII\"?>" + + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">" + + " <component name=\"HelloWorldComponent\">" + + " <service name=\"HelloWorldService\">" + + " <binding.jms>" + + " <destination name=\"AAA\">" + + " <property name=\"AAAProp\" type=\"string\"/>" + + " </destination>" + + " <connectionFactory name=\"ABC\"/>" + + " <response/>" + + " <headers/>" + + " <resourceAdapter name=\"GHI\"/>" + + " <operationProperties name=\"JKL\">" + + " </operationProperties>" + + " </binding.jms>" + + " </service>" + + " </component>" + + "</composite>"; @Override protected void setUp() throws Exception { @@ -381,5 +401,35 @@ public class JMSBindingProcessorWriteTestCase extends TestCase { // Compare initial binding to written binding. assertEquals(binding, binding2); - } + } + + // TUSCANY-3120 + // Checking we don't write out values unless the use has specified them on input + public void testDefault() throws Exception { + XMLStreamReader reader = + inputFactory.createXMLStreamReader(new StringReader(DEFAULT)); + Composite composite = (Composite)staxProcessor.read(reader); + JMSBinding binding = (JMSBinding)composite.getComponents().get(0).getServices().get(0).getBindings().get(0); + assertNotNull(binding); + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos)); + + System.out.println(bos.toString()); + assertEquals(bos.toString(), + "<?xml version=\'1.0\' encoding=\'UTF-8\'?>" + + "<composite targetNamespace=\"http://binding-jms\" name=\"binding-jms\" xmlns=\"http://www.osoa.org/xmlns/sca/1.0\">" + + "<component name=\"HelloWorldComponent\">" + + "<service name=\"HelloWorldService\">" + + "<binding.jms><operationProperties name=\"JKL\" /> " + + "<destination name=\"AAA\">" + + "<property name=\"AAAProp\" type=\"string\"></property>" + + "</destination> " + + "<connectionFactory name=\"ABC\" /> "+ + "<resourceAdapter name=\"GHI\" /> " + + "</binding.jms>" + + "</service>" + + "</component>" + + "</composite>"); + } } |