Author: veithen
Date: Thu Mar 31 11:34:32 2011
New Revision: 1087255

URL: http://svn.apache.org/viewvc?rev=1087255&view=rev
Log:
Refactored AttrNsTest#testAttributeNamespaces. This is a 
parse-serialize-compare style of unit test that can be handled more 
conveniently with the new test suite.

Added:
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/resources/conformance/AXIS2-192.xml
Modified:
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AbstractOMSerializationTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AttrNsTest.java

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/resources/conformance/AXIS2-192.xml
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/resources/conformance/AXIS2-192.xml?rev=1087255&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/resources/conformance/AXIS2-192.xml
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/resources/conformance/AXIS2-192.xml
 Thu Mar 31 11:34:32 2011
@@ -0,0 +1,5 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<foo xmlns:e="http://opensource.lk";>
+    <bar1 b:attr="test attr value1" 
xmlns:b="http://opensource.lk/ns1";>test1</bar1>
+    <bar2 b:attr="test attr value2" 
xmlns:b="http://opensource.lk/ns1";>test2</bar2>
+</foo>
\ No newline at end of file

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AbstractOMSerializationTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AbstractOMSerializationTest.java?rev=1087255&r1=1087254&r2=1087255&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AbstractOMSerializationTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AbstractOMSerializationTest.java
 Thu Mar 31 11:34:32 2011
@@ -65,28 +65,6 @@ public abstract class AbstractOMSerializ
         return getDiffForComparison(new FileInputStream(xmlFile));
     }
 
-    public String getSerializedOM(String xmlString) throws Exception {
-        try {
-            ByteArrayInputStream byteArrayInputStream =
-                    new ByteArrayInputStream(xmlString.getBytes());
-            StAXOMBuilder staxOMBuilder = OMXMLBuilderFactory.
-                    createStAXOMBuilder(OMAbstractFactory.getOMFactory(),
-                                        
StAXUtils.createXMLStreamReader(byteArrayInputStream));
-            OMElement rootElement = staxOMBuilder.getDocumentElement();
-
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
-            OMOutputFormat format = new OMOutputFormat();
-            format.setIgnoreXMLDeclaration(ignoreXMLDeclaration);
-
-            ((OMDocument) rootElement.getParent()).serialize(baos, format);
-
-            return new String(baos.toByteArray());
-        } catch (Exception e) {
-            throw e;
-        }
-    }
-
     public Diff getDiffForComparison(InputStream inStream) throws Exception {
         StAXOMBuilder staxOMBuilder = OMXMLBuilderFactory.
                 createStAXOMBuilder(OMAbstractFactory.getOMFactory(),

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AttrNsTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AttrNsTest.java?rev=1087255&r1=1087254&r2=1087255&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AttrNsTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AttrNsTest.java
 Thu Mar 31 11:34:32 2011
@@ -27,25 +27,6 @@ import java.io.StringReader;
 import java.util.Iterator;
 
 public class AttrNsTest extends AbstractOMSerializationTest {
-
-    private String attrNamespaceTestXML = "<?xml version='1.0' 
encoding='UTF-8'?>\n" +
-            "<foo xmlns:e=\"http://opensource.lk\";>" +
-            "    <bar1 b:attr=\"test attr value1\" 
xmlns:b=\"http://opensource.lk/ns1\";>test1</bar1>" +
-            "    <bar2 b:attr=\"test attr value2\" 
xmlns:b=\"http://opensource.lk/ns1\";>test2</bar2>" +
-            "</foo>";
-
-    public void testAttributeNamespaces() throws Exception {
-        ignoreXMLDeclaration = true;
-        ignoreDocument = true;
-
-        Document document1 = newDocument(attrNamespaceTestXML);
-        String serializedOM = getSerializedOM(attrNamespaceTestXML);
-        Document document2 = newDocument(serializedOM);
-
-        Diff diff = compareXML(document1, document2);
-        assertXMLEqual(diff, true);
-    }
-
     public void testAttributesWithProgrammaticalCreation() throws Exception {
         String expectedXML =
                 "<AttributeTester xmlns=\"\" 
xmlns:myAttr2NS=\"http://test-attributes-2.org\"; " +


Reply via email to