summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.3.3/modules/assembly-xml/src/test
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-11-04 22:56:14 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-11-04 22:56:14 +0000
commit8c5612a58086ee0eaa45c166fc8c2c9a09ecff1b (patch)
tree7852d1cdd22afbb350135fee4b9a6058f15403e1 /branches/sca-java-1.3.3/modules/assembly-xml/src/test
parentff27c26bfd80c0ab7457b96b4ee20bd3f5e2d14f (diff)
TUSCANY-2663 unknown element processing didn't write out all the information it read in
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@711457 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.3.3/modules/assembly-xml/src/test')
-rw-r--r--branches/sca-java-1.3.3/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/AnyElementReadWriteTestCase.java19
-rw-r--r--branches/sca-java-1.3.3/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAttributeTestCase.java19
-rw-r--r--branches/sca-java-1.3.3/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/UnknownElement.composite42
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>