Author: lresende
Date: Fri Jan 16 17:35:01 2009
New Revision: 735200

URL: http://svn.apache.org/viewvc?rev=735200&view=rev
Log:
TUSCANY-2663 - UPdating test scenarios to split valid extended element from 
invalid scenario where require attribute has empty value

Modified:
    
tuscany/branches/sca-java-1.x/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.java

Modified: 
tuscany/branches/sca-java-1.x/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.java?rev=735200&r1=735199&r2=735200&view=diff
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.java
 (original)
+++ 
tuscany/branches/sca-java-1.x/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.java
 Fri Jan 16 17:35:01 2009
@@ -55,12 +55,24 @@
         "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"; 
xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\"; targetNamespace=\"http://temp\"; 
name=\"aaaa\" autowire=\"false\">" +
          "<component name=\"unknownImpl\">" +
            "<implementation.unknown class=\"raymond\" />" +
-             "<service name= \"service\" requires=\"\">" +
-               "<binding.ws unknownAttribute=\"unknown\" />" +
-             "</service>" +
+           "<service name=\"service\">" +
+             "<binding.ws />" +
+           "</service>" +
          "</component>" +
         "</composite>";
 
+    private static final String XML_UNKNOWN_IMPL_WITH_INVALID_ATTRIBUTE =
+        "<?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://temp\"; 
name=\"aaaa\" autowire=\"false\">" +
+         "<component name=\"unknownImpl\">" +
+           "<implementation.unknown class=\"raymond\" />" +
+           "<service name=\"service\" requires=\"\">" +
+             "<binding.ws />" +
+           "</service>" +
+         "</component>" +
+        "</composite>";
+    
+    
     private XMLInputFactory inputFactory;
     private ExtensibleStAXArtifactProcessor staxProcessor;
 
@@ -89,15 +101,14 @@
         staxProcessor.write(composite, bos);
 
         // used for debug comparison
-        System.out.println(XML_RECURSIVE_EXTENDED_ELEMENT);
-        System.out.println(bos.toString());
+        // System.out.println(XML_RECURSIVE_EXTENDED_ELEMENT);
+        // System.out.println(bos.toString());
 
         assertEquals(XML_RECURSIVE_EXTENDED_ELEMENT, bos.toString());
         bos.close();
     }
 
-    // @Test
-    @Ignore()
+    @Test
     public void testReadWriteUnknwonImpl() throws Exception {
         XMLStreamReader reader = inputFactory.createXMLStreamReader(new 
StringReader(XML_UNKNOWN_IMPL));
         Composite composite = (Composite)staxProcessor.read(reader);
@@ -115,4 +126,22 @@
         bos.close();
     }
 
-}
+    // @Test
+    @Ignore()
+    public void testReadWriteInvalidAttribute() throws Exception {
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(new 
StringReader(XML_UNKNOWN_IMPL_WITH_INVALID_ATTRIBUTE));
+        Composite composite = (Composite)staxProcessor.read(reader);
+        assertNotNull(composite);
+        reader.close();
+
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        staxProcessor.write(composite, bos);
+
+        // used for debug comparison
+        // System.out.println(XML_UNKNOWN_IMPL);
+        // System.out.println(bos.toString());
+
+        assertEquals(XML_UNKNOWN_IMPL, bos.toString());
+        bos.close();
+    }
+}
\ No newline at end of file


Reply via email to