diff options
Diffstat (limited to '')
3 files changed, 76 insertions, 4 deletions
diff --git a/branches/sca-java-1.3.3/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/AnyElementReadWriteTestCase.java b/branches/sca-java-1.3.3/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/AnyElementReadWriteTestCase.java index ee953d7071..774fc45703 100644 --- a/branches/sca-java-1.3.3/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/AnyElementReadWriteTestCase.java +++ b/branches/sca-java-1.3.3/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/AnyElementReadWriteTestCase.java @@ -34,6 +34,7 @@ import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtens import org.apache.tuscany.sca.contribution.processor.ValidatingXMLInputFactory; import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.junit.Ignore; import org.junit.Test; public class AnyElementReadWriteTestCase extends TestCase { @@ -58,6 +59,7 @@ public class AnyElementReadWriteTestCase extends TestCase { public void tearDown() throws Exception { } + /* @Test public void testReadWriteComposite() throws Exception { InputStream is = getClass().getResourceAsStream("Calculator.composite"); @@ -73,5 +75,22 @@ public class AnyElementReadWriteTestCase extends TestCase { is.close(); } + */ + + @Test + public void testReadWriteUnknownElementComposite() throws Exception { + InputStream is = getClass().getResourceAsStream("UnknownElement.composite"); + XMLStreamReader reader = inputFactory.createXMLStreamReader(is); + Composite composite = (Composite) staxProcessor.read(reader); + assertNotNull(composite); + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + staxProcessor.write(composite, bos); + System.out.println(bos.toString()); + //assertEquals(XML, bos.toString()); + bos.close(); + + is.close(); + } } diff --git a/branches/sca-java-1.3.3/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAttributeTestCase.java b/branches/sca-java-1.3.3/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAttributeTestCase.java index c510feafc6..387405fd8d 100644 --- a/branches/sca-java-1.3.3/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAttributeTestCase.java +++ b/branches/sca-java-1.3.3/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAttributeTestCase.java @@ -49,21 +49,32 @@ public class ReadWriteAttributeTestCase extends TestCase { private static final QName ATTRIBUTE = new QName("http://test", "customAttribute"); + // implementation.java for CalculatorServiceComponent appears in a strange place as the + // java implementation extension is not loaded and hence they are loaded as any elements private static final String XML = "<?xml version='1.0' encoding='UTF-8'?>"+ "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://calc\" name=\"Calculator\">"+ "<service name=\"CalculatorService\" promote=\"CalculatorServiceComponent\">"+ "<interface.java interface=\"calculator.CalculatorService\" />"+ "</service>"+ "<component name=\"CalculatorServiceComponent\" customAttribute=\"customValue\">"+ + "<implementation.java class=\"calculator.CalculatorServiceImpl\" />"+ "<reference name=\"addService\" target=\"AddServiceComponent\" />"+ "<reference name=\"subtractService\" target=\"SubtractServiceComponent\" />"+ "<reference name=\"multiplyService\" target=\"MultiplyServiceComponent\" />"+ "<reference name=\"divideService\" target=\"DivideServiceComponent\" />"+ "</component>"+ - "<component name=\"AddServiceComponent\" />"+ - "<component name=\"SubtractServiceComponent\" />"+ - "<component name=\"MultiplyServiceComponent\" />"+ - "<component name=\"DivideServiceComponent\" />"+ + "<component name=\"AddServiceComponent\">"+ + "<implementation.java class=\"calculator.AddServiceImpl\" />"+ + "</component>"+ + "<component name=\"SubtractServiceComponent\">"+ + "<implementation.java class=\"calculator.SubtractServiceImpl\" />"+ + "</component>"+ + "<component name=\"MultiplyServiceComponent\">"+ + "<implementation.java class=\"calculator.MultiplyServiceImpl\" />"+ + "</component>"+ + "<component name=\"DivideServiceComponent\">"+ + "<implementation.java class=\"calculator.DivideServiceImpl\" />"+ + "</component>"+ "</composite>"; @Override diff --git a/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/UnknownElement.composite b/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/UnknownElement.composite new file mode 100644 index 0000000000..f8c0c5ea36 --- /dev/null +++ b/branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/UnknownElement.composite @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:ns1="http://temp" xmlns:ns1_1="adfsaf" name="composite1" targetNamespace="http://temp"> + <unknown>Test unknown</unknown> + <component name="data7"> + <implementation.java class="temp.EchoImpl"/> + <unknownImpl abc="cde"/> + <service> + <interface.wsdl interface="http://echo.webservice#wsdl.interface(Echo)"/> + </service> + </component> +</composite> + +And I got this: +<?xml version="1.0" encoding="UTF-8"?> +<composite targetNamespace="http://temp" name="composite1" + xmlns="http://www.osoa.org/xmlns/sca/1.0"> + <component name="data7"> + <implementation.java class="temp.EchoImpl"></implementation.java> + <service> + <interface.wsdl interface="http://echo.webservice#wsdl.interface(Echo)"></interface.wsdl> + </service> + </component> + <component name="empty"></component> +</composite> |