From 614a2e5ec9d9f1ddebf2e100d3ec82032d72af02 Mon Sep 17 00:00:00 2001 From: beckerdo Date: Thu, 19 Feb 2009 16:02:03 +0000 Subject: TUSCANY-2849 Unable to define operation-level intents on binding.jms git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@745909 13f79535-47bb-0310-9956-ffa450edef68 --- .../jms/impl/JMSBindingProcessorTestCase.java | 37 ++++++++++++++++++++ .../jms/impl/JMSBindingProcessorWriteTestCase.java | 39 ++++++++++++---------- 2 files changed, 58 insertions(+), 18 deletions(-) (limited to 'branches/sca-java-1.x/modules/binding-jms/src/test') 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 29ab264c7c..eabe4f7590 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 @@ -19,8 +19,10 @@ package org.apache.tuscany.sca.binding.jms.impl; +import java.io.InputStream; import java.io.StringReader; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; @@ -30,6 +32,8 @@ import javax.xml.stream.XMLStreamReader; import junit.framework.TestCase; import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.ConfiguredOperation; +import org.apache.tuscany.sca.assembly.OperationsConfigurator; import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint; import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; @@ -333,6 +337,21 @@ public class JMSBindingProcessorTestCase extends TestCase { + " " + ""; + public static final String CONFIGURED_OPERATIONS = + "" + + "" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + ""; + private XMLInputFactory inputFactory; private StAXArtifactProcessor staxProcessor; private Monitor monitor; @@ -350,6 +369,7 @@ public class JMSBindingProcessorTestCase extends TestCase { } StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints); staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor); + } /** @@ -655,4 +675,21 @@ public class JMSBindingProcessorTestCase extends TestCase { } } + /** + * Tests the APIs: + * public Set getOperationNames(); + * Provides no optional properties or sub elements + * @throws Exception + */ + public void testConfiguredOperations1() throws Exception { + XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(CONFIGURED_OPERATIONS)); + + Composite composite = (Composite)staxProcessor.read(reader); + JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0); + assertNotNull(binding); + + OperationsConfigurator opConfig = ((OperationsConfigurator)binding); + assertEquals(opConfig.getConfiguredOperations().get(0).getRequiredIntents().size(), 2); + } + } 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 b7d3088c42..d40d69d4c6 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 @@ -54,24 +54,6 @@ import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl; */ public class JMSBindingProcessorWriteTestCase extends TestCase { -// public static final String COMPOSITE = -// public static final String HEADERS1 = -// public static final String PROPERTIES1 = -// public static final String OP_PROPERTIES1 = -// public static final String OP_NAMES_NO_PROPERTIES1 = -// public static final String SELECTOR = -// public static final String COMPOSITE_INVALID_URI = -// // Invalid: contains both a response attribute and a response element. -// public static final String COMPOSITE_INVALID_RESPONSE_ATTR_ELEMENT = -// public static final String DEST_PROPS = -// public static final String CF_PROPS = -// public static final String AS_PROPS = -// public static final String RESP_DEST_PROPS = -// public static final String RESP_CF_PROPS = -// public static final String RESP_AS_PROPS = -// public static final String OP_PROPS_PROPS = -// public static final String RES_ADPT_PROPS = - private XMLInputFactory inputFactory; private XMLOutputFactory outputFactory; private StAXArtifactProcessor staxProcessor; @@ -358,4 +340,25 @@ public class JMSBindingProcessorWriteTestCase extends TestCase { // Compare initial binding to written binding. assertEquals(binding, binding2); } + + public void testConfiguredOperations() throws Exception { + XMLStreamReader reader = + inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.CONFIGURED_OPERATIONS)); + Composite composite = (Composite)staxProcessor.read(reader); + JMSBinding binding = (JMSBinding)composite.getComponents().get(0).getServices().get(0).getBindings().get(0); + assertNotNull(binding); + + // Write out JMSBinding model to stream. + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos)); + + // Read written JMSBinding to a different JMSBinding model. + XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString())); + Composite composite2 = (Composite)staxProcessor.read(reader2); + JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0); + assertNotNull(binding2); + + // Compare initial binding to written binding. + assertEquals(binding, binding2); + } } -- cgit v1.2.3