You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ga...@apache.org on 2009/01/06 21:59:57 UTC

svn commit: r732117 - in /webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test: java/org/apache/axiom/c14n/ java/org/apache/axiom/c14n/impl/ java/org/apache/axiom/c14n/omwrapper/ resources/ resources/META-INF/

Author: gawor
Date: Tue Jan  6 12:59:56 2009
New Revision: 732117

URL: http://svn.apache.org/viewvc?rev=732117&view=rev
Log:
restore c14n tests - tests files were empty

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample1.xml   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample2.xml   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample3.xml   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample4.xml   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample5.xml   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample6.xml   (with props)
Removed:
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/AllC14NTests.java
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/DataParser.java
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/ImplTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/WrapperTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/impl/AbstractCanonicalizerTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/impl/Canonicalizer20010315OmitCommentTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/impl/Canonicalizer20010315WithCommentTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/AttrImplTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/CommentImplTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/DocumentImplTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/ElementImplTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/NamedNodeMapImplTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/NodeListImplTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/TextImplTest.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/AllC14NTests.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/AllC14NTests.java?rev=732117&r1=732116&r2=732117&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/AllC14NTests.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/AllC14NTests.java Tue Jan  6 12:59:56 2009
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+package org.apache.axiom.c14n;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * @author Saliya Ekanayake (esaliya@gmail.com)
+ */
+public class AllC14NTests extends TestCase {
+    public AllC14NTests(String name){
+        super(name);
+    }
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite("All org.apache.axiom.c14n JUnit Tests");
+        suite.addTest(ImplTest.suite());
+        suite.addTest(WrapperTest.suite());
+        return suite;
+    }
+
+    public static void main(String[] args) {
+        TestRunner.run(suite()); 
+    }
+}

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/DataParser.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/DataParser.java?rev=732117&r1=732116&r2=732117&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/DataParser.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/DataParser.java Tue Jan  6 12:59:56 2009
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+package org.apache.axiom.c14n;
+
+import org.apache.axiom.c14n.omwrapper.factory.WrapperFactory;
+import org.apache.axiom.c14n.omwrapper.interfaces.Document;
+import org.apache.axiom.c14n.omwrapper.interfaces.Element;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMElement;
+
+import java.net.URL;
+import java.io.RandomAccessFile;
+import java.io.InputStream;
+import java.io.ByteArrayInputStream;
+
+/**
+ * @author Saliya Ekanayake (esaliya@gmail.com)
+ */
+public class DataParser {
+    private String fileName = null;
+    private StAXOMBuilder builder = null;
+    private byte [] bytes;
+
+    public WrapperFactory fac = null;
+    public Document doc = null;
+    public Element docEle = null;
+    public OMDocument omDoc = null;
+    public OMElement omDocEle = null;
+
+    public DataParser(String fileName) {
+        this.fileName = fileName;
+    }
+
+    public void init() throws Exception {
+        builder = new StAXOMBuilder(this.getClass().getResourceAsStream(fileName));
+        fac = new WrapperFactory();
+        omDoc = builder.getDocument();
+        omDocEle = omDoc.getOMDocumentElement();
+        doc = (Document) fac.getNode(omDoc);
+        docEle = doc.getDocumentElement();
+    }
+
+    public void initWithNewFile(String fileName) throws Exception{
+        this.fileName = fileName;
+        init();
+    }
+
+    public byte[] getBytes() throws Exception{
+        URL uri = getClass().getResource(fileName);
+        RandomAccessFile raf = new RandomAccessFile(uri.getFile(),"r");
+        byte[] bytes = new byte[(int)raf.length()];
+        raf.readFully(bytes);
+        return bytes;
+    }
+}

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/ImplTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/ImplTest.java?rev=732117&r1=732116&r2=732117&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/ImplTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/ImplTest.java Tue Jan  6 12:59:56 2009
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+package org.apache.axiom.c14n;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+import org.apache.axiom.c14n.impl.Canonicalizer20010315OmitCommentTest;
+import org.apache.axiom.c14n.impl.Canonicalizer20010315WithCommentTest;
+
+/**
+ * @author Saliya Ekanayake (esaliya@gmail.com)
+ */
+public class ImplTest extends TestCase {
+    public ImplTest(String name){
+        super(name);
+    }
+
+    public static Test suite(){
+        TestSuite suite = new TestSuite("All org.apache.axiom.c14n.impl JUnit Tests");
+        suite.addTest(Canonicalizer20010315OmitCommentTest.suite());
+        suite.addTest(Canonicalizer20010315WithCommentTest.suite());
+        return suite;
+    }
+
+    public static void main(String[] args) {
+        TestRunner.run(suite());
+    }
+}

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/WrapperTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/WrapperTest.java?rev=732117&r1=732116&r2=732117&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/WrapperTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/WrapperTest.java Tue Jan  6 12:59:56 2009
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+package org.apache.axiom.c14n;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+import org.apache.axiom.c14n.omwrapper.*;
+
+/**
+ * @author Saliya Ekanayake (esaliya@gmail.com)
+ */
+public class WrapperTest extends TestCase {
+    public WrapperTest(String name){
+        super(name);
+    }
+
+    public static Test suite() {
+        TestSuite suite =  new TestSuite("All org.apache.axiom.c14n.omwrapper JUnit Tests");
+        suite.addTest(AttrImplTest.suite());
+        suite.addTest(CommentImplTest.suite());
+        suite.addTest(DocumentImplTest.suite());
+        suite.addTest(ElementImplTest.suite());
+        suite.addTest(NamedNodeMapImplTest.suite());
+        suite.addTest(NodeListImplTest.suite());
+        suite.addTest(TextImplTest.suite());
+        return suite;
+    }
+
+    public static void main(String[] args) {
+        TestRunner.run(suite());
+    }
+}

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/impl/AbstractCanonicalizerTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/impl/AbstractCanonicalizerTest.java?rev=732117&r1=732116&r2=732117&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/impl/AbstractCanonicalizerTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/impl/AbstractCanonicalizerTest.java Tue Jan  6 12:59:56 2009
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+package org.apache.axiom.c14n.impl;
+
+import junit.framework.TestCase;
+import org.apache.axiom.c14n.DataParser;
+import org.apache.axiom.c14n.Canonicalizer;
+import org.apache.axiom.c14n.exceptions.AlgorithmAlreadyRegisteredException;
+
+/**
+ * @author Saliya Ekanayake (esaliya@gmail.com)
+ */
+public class AbstractCanonicalizerTest extends TestCase {
+    protected DataParser dp = null;
+    protected Canonicalizer c14n = null;
+
+    public AbstractCanonicalizerTest(){}
+
+    public AbstractCanonicalizerTest(String name){
+        super(name);
+    }
+
+       static {
+        Canonicalizer.init();
+        try {
+            Canonicalizer.register("http://www.w3.org/TR/2001/REC-xml-c14n-20010315",
+                    "org.apache.axiom.c14n.impl.Canonicalizer20010315OmitComments");
+
+            Canonicalizer.register("http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments",
+                    "org.apache.axiom.c14n.impl.Canonicalizer20010315WithComments");
+
+
+            Canonicalizer.register("http://www.w3.org/2001/10/xml-exc-c14n#",
+                    "org.apache.axiom.c14n.impl.Canonicalizer20010315ExclOmitComments");
+
+            Canonicalizer.register("http://www.w3.org/2001/10/xml-exc-c14n#WithComments",
+                    "org.apache.axiom.c14n.impl.Canonicalizer20010315ExclWithComments");
+
+        } catch (AlgorithmAlreadyRegisteredException e) {
+            fail(e.getMessage());
+        }
+    }
+}

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/impl/Canonicalizer20010315OmitCommentTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/impl/Canonicalizer20010315OmitCommentTest.java?rev=732117&r1=732116&r2=732117&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/impl/Canonicalizer20010315OmitCommentTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/impl/Canonicalizer20010315OmitCommentTest.java Tue Jan  6 12:59:56 2009
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+
+package org.apache.axiom.c14n.impl;
+
+import org.apache.axiom.c14n.DataParser;
+import org.apache.axiom.c14n.Canonicalizer;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * @author Saliya Ekanayake (esaliya@gmail.com)
+ */
+public class Canonicalizer20010315OmitCommentTest
+        extends AbstractCanonicalizerTest {
+
+    public Canonicalizer20010315OmitCommentTest(String name) {
+        super(name);
+    }
+
+    public static Test suite() {
+        return new TestSuite(Canonicalizer20010315OmitCommentTest.class);
+    }
+
+    public static void main(String[] args) {
+        TestRunner.run(suite());
+    }
+
+    private byte[] bytes = null;
+
+    private String sample5Result = "<doc attrExtEnt=\"entExt\">\n" +
+            "   Hello, world!\n" +
+            "</doc>";
+
+    private String sample6Result = "<doc>©</doc>";
+
+    public void setUp() throws Exception {
+        // parse data of sample5.xml
+        dp = new DataParser("/sample5.xml");
+        // get canonicalizer which omits comments
+        c14n = Canonicalizer.getInstance(
+                "http://www.w3.org/TR/2001/REC-xml-c14n-20010315");
+    }
+
+    public void testSample5() throws Exception {
+        // get the canonicalized byte[]
+        bytes = c14n.canonicalize(dp.getBytes());
+        // check against sample2Result
+        assertEquals(sample5Result, new String(bytes));
+    }
+
+     public void testSample6() throws Exception {
+         // parse data of sample6.xml
+        dp.initWithNewFile("/sample6.xml");
+        // get the canonicalized byte[]
+        bytes = c14n.canonicalize(dp.getBytes());
+        // check against sample6Result
+        assertEquals(sample6Result, new String(bytes));
+    }
+
+
+}

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/impl/Canonicalizer20010315WithCommentTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/impl/Canonicalizer20010315WithCommentTest.java?rev=732117&r1=732116&r2=732117&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/impl/Canonicalizer20010315WithCommentTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/impl/Canonicalizer20010315WithCommentTest.java Tue Jan  6 12:59:56 2009
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+
+package org.apache.axiom.c14n.impl;
+
+import org.apache.axiom.c14n.DataParser;
+import org.apache.axiom.c14n.Canonicalizer;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * @author Saliya Ekanayake (esaliya@gmail.com)
+ */
+public class Canonicalizer20010315WithCommentTest
+        extends AbstractCanonicalizerTest {
+
+    public Canonicalizer20010315WithCommentTest(String name){
+        super(name);
+    }
+
+    public static Test suite(){
+        return new TestSuite(Canonicalizer20010315WithCommentTest.class);
+    }
+
+    public static void main(String[] args) {
+        TestRunner.run(suite());
+    }
+
+    private byte[] bytes = null;
+
+    private String sample2Result = "<doc>\n" +
+            "   <clean>   </clean>\n" +
+            "   <dirty>   A   B   </dirty>\n" +
+            "   <mixed>\n" +
+            "      A\n" +
+            "      <clean>   </clean>\n" +
+            "      B\n" +
+            "      <dirty>   A   B   </dirty>\n" +
+            "      C\n" +
+            "   </mixed>\n" +
+            "</doc>";
+
+    private String sample3Result = "<doc>\n" +
+            "   <e1></e1>\n" +
+            "   <e2></e2>\n" +
+            "   <e3 id=\"elem3\" name=\"elem3\"></e3>\n" +
+            "   <e4 id=\"elem4\" name=\"elem4\"></e4>\n" +
+            "   <e5 xmlns=\"http://example.org\" xmlns:a=\"http://www.w3.org\" xmlns:b=\"http://www.ietf.org\" attr=\"I'm\" attr2=\"all\" b:attr=\"sorted\" a:attr=\"out\"></e5>\n" +
+            "   <e6 xmlns:a=\"http://www.w3.org\">\n" +
+            "      <e7 xmlns=\"http://www.ietf.org\">\n" +
+            "         <e8 xmlns=\"\">\n" +
+            "            <e9 xmlns:a=\"http://www.ietf.org\" attr=\"default\"></e9>\n" +
+            "         </e8>\n" +
+            "      </e7>\n" +
+            "   </e6>\n" +
+            "</doc>";
+
+    private String sample4Result = "<doc>\n" +
+            "   <text>First line&#xD;\n" +
+            "Second line</text>\n" +
+            "   <value>2</value>\n" +
+            "   <compute>value&gt;\"0\" &amp;&amp; value&lt;\"10\" ?\"valid\":\"error\"</compute>\n" +
+            "   <compute expr=\"value>&quot;0&quot; &amp;&amp; value&lt;&quot;10&quot; ?&quot;valid&quot;:&quot;error&quot;\">valid</compute>\n" +
+            "   <norm attr=\" '    &#xD;&#xA;&#x9;   ' \"></norm>\n" +
+            "   <normNames attr=\"A &#xD;&#xA;&#x9; B\"></normNames>\n" +
+            "   <normId id=\"' &#xD;&#xA;&#x9; '\"></normId>\n" +
+            "</doc>";
+
+    public void setUp() throws Exception {
+        // parse data of sample2.xml
+        dp = new DataParser("/sample2.xml");
+        // get canonicalizer with comment
+        c14n = Canonicalizer.getInstance(
+                "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments");
+    }
+
+    public void testSample2() throws Exception{
+        // get the canonicalized byte[]
+        bytes = c14n.canonicalize(dp.getBytes());
+        // check against sample2Result
+        assertEquals(sample2Result, new String(bytes));
+    }
+
+    public void testSample3() throws Exception{
+        // parse data of sample3.xml
+        dp.initWithNewFile("/sample3.xml");
+        // get the canonicalized byte[]
+        bytes = c14n.canonicalize(dp.getBytes());
+        // check against sample3Result
+        assertEquals(sample3Result, new String(bytes));
+    }
+
+    public void testSample4() throws Exception {
+        // parse data of sample3.xml
+        dp.initWithNewFile("/sample4.xml");
+        // get the canonicalized byte[]
+        bytes = c14n.canonicalize(dp.getBytes());
+        // check against sample3Result
+        assertEquals(sample4Result, new String(bytes));
+    }
+}

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/AttrImplTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/AttrImplTest.java?rev=732117&r1=732116&r2=732117&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/AttrImplTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/AttrImplTest.java Tue Jan  6 12:59:56 2009
@@ -0,0 +1,126 @@
+package org.apache.axiom.c14n.omwrapper;
+
+import org.apache.axiom.c14n.omwrapper.factory.WrapperFactory;
+import org.apache.axiom.c14n.omwrapper.interfaces.Document;
+import org.apache.axiom.c14n.omwrapper.interfaces.Element;
+import org.apache.axiom.c14n.omwrapper.interfaces.NamedNodeMap;
+import org.apache.axiom.c14n.omwrapper.interfaces.Attr;
+import org.apache.axiom.c14n.DataParser;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMElement;
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author Saliya Ekanayake (esaliya@gmail.com)
+ */
+public class AttrImplTest extends TestCase {
+    private DataParser dp;
+    private NamedNodeMap nnm;
+    private Attr attr;
+
+    public AttrImplTest(String name){
+        super(name);
+    }
+
+    public static Test suite() {
+        return new TestSuite(AttrImplTest.class);
+    }
+
+    public static void main(String[] args) {
+        TestRunner.run(suite());
+    }
+
+    public void setUp() throws Exception{
+        dp = new DataParser("/sample1.xml");
+        dp.init();
+        // get e5
+        OMElement e5 = dp.omDocEle.getFirstChildWithName(new QName("http://example.org","e5"));
+        // get the wrapped element of e5
+        Element e = (Element)dp.fac.getNode(e5);
+        nnm = e.getAttributes();
+
+    }
+
+    public void testAttrProperties(){
+        // e5 has 7 attributes
+        assertEquals(7, nnm.getLength());
+        //attr is a:attr="out"
+        attr = (Attr)nnm.item(0);
+        assertEquals("attr", attr.getLocalName());
+        assertEquals("a:attr", attr.getName());
+        assertEquals("a:attr", attr.getNodeName());
+        assertEquals("a", attr.getPrefix());
+        assertEquals("http://www.w3.org", attr.getNamespaceURI());
+
+        // attr is attr2="all"
+        attr = (Attr)nnm.item(2);
+        assertEquals("attr2", attr.getLocalName());
+        assertEquals("attr2", attr.getName());
+        assertEquals("attr2", attr.getNodeName());
+        assertNull("prefix of attr2=\"all\" is null", attr.getPrefix());
+        assertNull("Namespace URI of attr2=\"all\" is null", attr.getNamespaceURI());
+        assertEquals("all", attr.getValue());
+        assertEquals("all", attr.getNodeValue());
+
+        // attr is xmlns:a="http://www.w3.org"
+        attr = (Attr)nnm.item(4);
+        assertEquals("a", attr.getLocalName());
+        assertEquals("xmlns:a", attr.getName());
+        assertEquals("xmlns:a", attr.getNodeName());
+        assertEquals("xmlns", attr.getPrefix());
+        // the namespace URI of xmlns is "http://www.w3.org/2000/xmlns/"
+        assertEquals("http://www.w3.org/2000/xmlns/", attr.getNamespaceURI());
+        assertEquals("http://www.w3.org", attr.getValue());
+        assertEquals("http://www.w3.org", attr.getNodeValue());
+
+        // attr is xmlns="http://example.org"
+        attr = (Attr)nnm.item(6);
+        assertEquals("xmlns", attr.getLocalName());
+        assertEquals("xmlns", attr.getName());
+        assertEquals("xmlns", attr.getNodeName());
+        assertNull("prefix of xmlns=\"http://example.org\" is null", attr.getPrefix());
+        // the namespace URI of xmlns is "http://www.w3.org/2000/xmlns/"
+        assertEquals("http://www.w3.org/2000/xmlns/", attr.getNamespaceURI());
+        assertEquals("http://example.org", attr.getValue());
+        assertEquals("http://example.org", attr.getNodeValue());
+    }
+
+    public void testOwnerElement() {
+        // get e5
+        OMElement e5 = dp.omDocEle.getFirstChildWithName(new QName("http://example.org","e5"));
+        // get the wrapped element of e5
+        Element e = (Element)dp.fac.getNode(e5);
+        // attr is a:attr="out"
+        attr = (Attr)e.getAttributes().item(0);
+        // the getOwnerElement() should provide a reference to the same object pointed by reference e
+        assertEquals(e, attr.getOwnerElement());
+    }
+
+    public void testGetNextSibling() {
+        // attr is a:attr="out"
+        attr = (Attr)nnm.item(0);
+        assertNull("getNextSibling() should return null", attr.getNextSibling());
+    }
+
+    public void testGetPreviousSibling(){
+        // attr is a:attr="out"
+        attr = (Attr)nnm.item(0);
+        assertNull("getPreviousSibling() should return null", attr.getPreviousSibling());
+    }
+
+    public void testGetParentNode(){
+        // attr is a:attr="out"
+        attr = (Attr)nnm.item(0);
+        assertNull("getParentNode() should return null", attr.getParentNode());
+
+    }
+
+
+
+}

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/CommentImplTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/CommentImplTest.java?rev=732117&r1=732116&r2=732117&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/CommentImplTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/CommentImplTest.java Tue Jan  6 12:59:56 2009
@@ -0,0 +1,57 @@
+package org.apache.axiom.c14n.omwrapper;
+
+import org.apache.axiom.c14n.omwrapper.interfaces.Comment;
+import org.apache.axiom.c14n.omwrapper.interfaces.Node;
+import org.apache.axiom.c14n.DataParser;
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * @author Saliya Ekanayake (esaliya@gmail.com)
+ */
+public class CommentImplTest extends TestCase {
+    private DataParser dp = null;
+    private Comment comment = null;
+
+    public CommentImplTest(String name){
+        super(name);
+    }
+
+    public static Test suite() {
+        return new TestSuite(CommentImplTest.class);
+    }
+
+    public static void main(String[] args) {
+        TestRunner.run(suite());
+    }
+
+    public void setUp() throws Exception{
+        dp = new DataParser("/sample1.xml");
+        dp.init();
+        // <!-- Comment 2 -->
+        comment = (Comment)dp.doc.getFirstChild().getNextSibling();
+    }
+
+    public void testGetData() {
+        assertEquals(" Comment 2 ", comment.getData());
+    }
+
+    public void testGetParent(){
+        assertEquals(Node.DOCUMENT_NODE, comment.getParentNode().getNodeType());
+    }
+
+    public void testGetNextSibling(){
+        // this comment is inside the document so we don't want the next newline character
+        // to get as a node
+        assertEquals(Node.ELEMENT_NODE, comment.getNextSibling().getNodeType());
+    }
+
+    public void testGetPreviousSibling(){
+        // this comment is inside the document so we don't want the previous newline character
+        // to get as a node
+        assertEquals(Node.DOCUMENT_TYPE_NODE, comment.getPreviousSibling().getNodeType());
+    }
+
+}

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/DocumentImplTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/DocumentImplTest.java?rev=732117&r1=732116&r2=732117&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/DocumentImplTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/DocumentImplTest.java Tue Jan  6 12:59:56 2009
@@ -0,0 +1,65 @@
+package org.apache.axiom.c14n.omwrapper;
+
+import org.apache.axiom.c14n.omwrapper.interfaces.NodeList;
+import org.apache.axiom.c14n.omwrapper.interfaces.Node;
+import org.apache.axiom.c14n.DataParser;
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * @author Saliya Ekanayake (esaliya@gmail.com)
+ */
+public class DocumentImplTest extends TestCase {
+    private DataParser dp = null;
+
+    public DocumentImplTest(String name){
+        super(name);
+    }
+
+    public static Test suite() {
+        return new TestSuite(DocumentImplTest.class);
+    }
+
+    public static void main(String[] args) {
+        TestRunner.run(suite());
+    }
+
+    public void setUp() throws Exception{
+        dp = new DataParser("/sample1.xml");
+        dp.init();
+    }
+
+    public void testGetChildNode() {
+        // this nl should not contain any text node
+        NodeList nl = dp.doc.getChildNodes();
+        for (int i = 0; i < nl.getLength(); i++) {
+            assertFalse("node type can't be Text", (Node.TEXT_NODE == nl.item(i).getNodeType()));
+        }
+    }
+
+    public void testGetNextSibling() {
+        assertNull("getNextSibling() should return null", dp.doc.getNextSibling());
+    }
+
+    public void testGetPreviousSibling() {
+        assertNull("getPreviousSibling() should return null", dp.doc.getPreviousSibling());
+    }
+
+    public void testGetParentNode() {
+        assertNull("getParentNode() should return null", dp.doc.getParentNode());
+    }
+
+    public void testGetFirstChild(){
+        assertFalse("document should not return Text nodes",
+                (Node.TEXT_NODE == dp.doc.getFirstChild().getNodeType()));
+
+        assertEquals(Node.DOCUMENT_TYPE_NODE, dp.doc.getFirstChild().getNodeType());
+    }
+
+    public void testGetDocumentElement() {
+        assertEquals(Node.ELEMENT_NODE, dp.doc.getDocumentElement().getNodeType());
+        assertEquals("doc", dp.doc.getDocumentElement().getNodeName());
+    }
+}

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/ElementImplTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/ElementImplTest.java?rev=732117&r1=732116&r2=732117&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/ElementImplTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/ElementImplTest.java Tue Jan  6 12:59:56 2009
@@ -0,0 +1,126 @@
+package org.apache.axiom.c14n.omwrapper;
+
+import org.apache.axiom.c14n.omwrapper.interfaces.Element;
+import org.apache.axiom.c14n.omwrapper.interfaces.Node;
+import org.apache.axiom.c14n.DataParser;
+import org.apache.axiom.om.OMElement;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * @author Saliya Ekanayake (esaliya@gmail.com)
+ */
+public class ElementImplTest extends TestCase {
+    private DataParser dp = null;
+
+    public ElementImplTest(String name){
+        super(name);
+    }
+
+    public static Test suite() {
+        return new TestSuite(ElementImplTest.class);
+    }
+
+    public static void main(String[] args) {
+        TestRunner.run(suite());
+    }
+
+    public void setUp() throws Exception{
+        dp = new DataParser("/sample1.xml");
+        dp.init();
+    }
+
+    public void testHasAttributes() {
+        // first child of docEle is of Text type. So we get the next sibling of that,i.e. e1
+        Element e = (Element) dp.docEle.getFirstChild().getNextSibling();
+        // e1 has one attribute which is in fact a namespace declaration
+        assertEquals(true, e.hasAttributes());
+        // get e2
+        e = (Element) e.getNextSibling().getNextSibling();
+        // e2 has the default namespace declaration
+        assertEquals(true, e.hasAttributes());
+        // get e2child
+        e = (Element) e.getFirstChild();
+        // e2child gets the default namespace from parent, but it's not an attribute of it
+        assertEquals(false, e.hasAttributes());
+    }
+
+    public void testGetNamespaceURI() {
+        // <e2   xmlns="http://www.blankns.com" ><e2child>I've no attributes</e2child></e2>
+        OMElement e2 = dp.omDocEle.getFirstChildWithName(new QName("http://www.blankns.com", "e2"));
+        // get the wrapped element
+        Element e = (Element) dp.fac.getNode(e2);
+        assertEquals("http://www.blankns.com", e.getNamespaceURI());
+        // <e2child>I've no attributes</e2child>
+        e = (Element) e.getFirstChild();
+        // e2child inherits the default namespace of e2
+        assertEquals("http://www.blankns.com", e.getNamespaceURI());
+
+        // <e3   name =    "elem3" id="elem3"/>
+        OMElement e3 = dp.omDocEle.getFirstChildWithName(new QName("e3"));
+        // get the wrapped element
+        e = (Element) dp.fac.getNode(e3);
+        assertNull("Namespace URI of e3 is null", e.getNamespaceURI());
+    }
+
+    public void testGetPrefix() {
+        // <e2   xmlns="http://www.blankns.com" ><e2child>I've no attributes</e2child></e2>
+        OMElement e2 = dp.omDocEle.getFirstChildWithName(new QName("http://www.blankns.com", "e2"));
+        // get the wrapped element
+        Element e = (Element) dp.fac.getNode(e2);
+        assertNull("prefix of e2 is null", e.getPrefix());
+        // <a:e1 xmlns:a="http://www.nonamespace.com"  />
+        e = (Element) e.getPreviousSibling().getPreviousSibling();
+        assertEquals("a", e.getPrefix());
+    }
+
+    public void testGetNodeName() {
+        // <a:e1 xmlns:a="http://www.nonamespace.com"  />
+        OMElement e1 = dp.omDocEle.getFirstElement();
+        // get the wrapped element
+        Element e = (Element) dp.fac.getNode(e1);
+        assertEquals("a:e1", e.getNodeName());
+        // <e2   xmlns="http://www.blankns.com" ><e2child>I've no attributes</e2child></e2>
+        e = (Element) e.getNextSibling().getNextSibling();
+        assertEquals("e2", e.getNodeName());
+    }
+
+    public void testGetFirstChild() {
+        Element e = (Element) dp.fac.getNode(dp.omDocEle);
+        // first child of root element represents the newline character so it's a text node
+        assertEquals(Node.TEXT_NODE, e.getFirstChild().getNodeType());
+    }
+
+
+    // there is a difference when it comes to CDATA. Axiom treats it as OMText. Eg.,
+    // <e1/>
+    // <![CDATA[<don't><process><this>:)]]>
+    // <e2/>
+    // getNextSibling() of e1 would return "\n<don't><process><this>:)\n"
+    // in DOM it would be just "\n". Taking the next sibling of that would be
+    // <don't><process><this>:) and taking the next sibling of that would be "\n"
+    // so Axiom put all these three into one OMText node. This wasn't a issue yet :)
+    // but thought to mention it for clarity.
+    public void testGetNextSibling() {
+        Element e = (Element) dp.fac.getNode(dp.omDocEle);
+        // first child of root element represents the newline character so it's a text node
+        // the getNextSibling() of that should return element e1
+        assertEquals(Node.ELEMENT_NODE, (e = (Element)e.getFirstChild().getNextSibling()).getNodeType());
+        assertEquals("a:e1", e.getNodeName());
+    }
+
+    public void testGetPreviousSibling() {
+        // <a:e1 xmlns:a="http://www.nonamespace.com"  />
+        Element e = (Element) dp.fac.getNode(dp.omDocEle.getFirstElement());
+        // this n is a text node representing the newline character
+        Node n = e.getPreviousSibling();
+        assertEquals(Node.TEXT_NODE, n.getNodeType());
+    }
+
+
+}

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/NamedNodeMapImplTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/NamedNodeMapImplTest.java?rev=732117&r1=732116&r2=732117&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/NamedNodeMapImplTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/NamedNodeMapImplTest.java Tue Jan  6 12:59:56 2009
@@ -0,0 +1,55 @@
+package org.apache.axiom.c14n.omwrapper;
+
+import org.apache.axiom.c14n.omwrapper.interfaces.NamedNodeMap;
+import org.apache.axiom.c14n.omwrapper.interfaces.Element;
+import org.apache.axiom.c14n.DataParser;
+import org.apache.axiom.om.OMElement;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * @author Saliya Ekanayake (esaliya@gmail.com)
+ */
+public class NamedNodeMapImplTest extends TestCase {
+    private DataParser dp = null;
+    private NamedNodeMap nnm = null;
+
+    public NamedNodeMapImplTest(String name){
+        super(name);
+    }
+
+    public static Test suite() {
+        return new TestSuite(NamedNodeMapImplTest.class);
+    }
+
+    public static void main(String[] args) {
+        TestRunner.run(suite());
+    }
+
+    public void setUp() throws Exception {
+        dp = new DataParser("/sample1.xml");
+        dp.init();
+        // get e5
+        OMElement e5 = dp.omDocEle.getFirstChildWithName(new QName("http://example.org", "e5"));
+        // get the wrapped element of e5
+        Element e = (Element) dp.fac.getNode(e5);
+        nnm = e.getAttributes();
+    }
+
+    public void testGetLength(){
+        assertEquals(7, nnm.getLength());
+    }
+
+    public void testItem(){
+        assertNotNull("valid index should not return null", nnm.item(nnm.getLength() - 1));
+        assertNull("invalid index should return null", nnm.item(-2));
+        assertNull("invalid index should return null", nnm.item(nnm.getLength()));
+    }
+
+
+}

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/NodeListImplTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/NodeListImplTest.java?rev=732117&r1=732116&r2=732117&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/NodeListImplTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/NodeListImplTest.java Tue Jan  6 12:59:56 2009
@@ -0,0 +1,44 @@
+package org.apache.axiom.c14n.omwrapper;
+
+import org.apache.axiom.c14n.omwrapper.interfaces.NodeList;
+import org.apache.axiom.c14n.DataParser;
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * @author Saliya Ekanayake (esaliya@gmail.com)
+ */
+public class NodeListImplTest extends TestCase {
+    private DataParser dp = null;
+    private NodeList nl = null;
+
+    public NodeListImplTest(String name){
+        super(name);
+    }
+
+    public static Test suite() {
+        return new TestSuite(NodeListImplTest.class);
+    }
+
+    public static void main(String[] args) {
+        TestRunner.run(suite());
+    }
+
+    public void setUp() throws Exception{
+        dp = new DataParser("/sample1.xml");
+        dp.init();
+        nl = dp.docEle.getChildNodes();
+    }
+
+    public void testGetLength() {
+        assertEquals(15, nl.getLength());
+    }
+
+    public void testItem(){
+        assertNotNull("valid index should not return null", nl.item(nl.getLength() - 1));
+        assertNull("invalid index should return null", nl.item(-2));
+        assertNull("invalid index should return null", nl.item(nl.getLength()));
+    }
+}

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/TextImplTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/TextImplTest.java?rev=732117&r1=732116&r2=732117&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/TextImplTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/TextImplTest.java Tue Jan  6 12:59:56 2009
@@ -0,0 +1,54 @@
+package org.apache.axiom.c14n.omwrapper;
+
+import org.apache.axiom.c14n.omwrapper.interfaces.NodeList;
+import org.apache.axiom.c14n.omwrapper.interfaces.Node;
+import org.apache.axiom.c14n.DataParser;
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * @author Saliya Ekanayake (esaliya@gmail.com)
+ */
+public class TextImplTest extends TestCase {
+    private DataParser dp = null;
+    private Node n = null;
+
+    public TextImplTest(String name){
+        super(name);
+    }
+
+    public static Test suite() {
+        return new TestSuite(TextImplTest.class);
+    }
+
+    public static void main(String[] args) {
+        TestRunner.run(suite());
+    }
+
+    public void setUp() throws Exception{
+        dp = new DataParser("/sample1.xml");
+        dp.init();
+        NodeList nl = dp.docEle.getChildNodes();
+        n = null;
+        for (int i = 0; i < nl.getLength(); i++) {
+            n = nl.item(i);
+            if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals("e6")){
+                break;
+            }
+        }
+    }
+
+    public void testGetNodeType(){
+        // here n is e6
+        assertEquals(Node.TEXT_NODE, n.getNextSibling().getNodeType());
+    }
+
+    // see issue mentioned with the testGetNextSibling() method in ElementImplTest
+    public void testGetNodeValue() {
+        // here n is e6
+        assertEquals("\n    <don't><process><this>:)\n", n.getNextSibling().getNodeValue());
+    }
+
+}

Added: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample1.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample1.xml?rev=732117&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample1.xml (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample1.xml Tue Jan  6 12:59:56 2009
@@ -0,0 +1,22 @@
+<!DOCTYPE doc [<!ATTLIST e9 attr CDATA "default">]>
+<!-- Comment 2 -->
+<doc      >
+    <a:e1 xmlns:a="http://www.nonamespace.com"  />
+    <e2   xmlns="http://www.blankns.com" ><e2child>I've no attributes</e2child></e2>
+    <e3   name =    "elem3" id="elem3"/>
+    <e4 name="elem4" id="elem4"></e4>
+    <!-- Comment before e5 and after e4 -->
+    <e5 a:attr="out" b:attr="sorted" attr2="all" attr="I'm"
+        xmlns:b="http://www.ietf.org"
+        xmlns:a="http://www.w3.org"
+        xmlns="http://example.org"/>
+    <e6 xmlns="" xmlns:a="http://www.w3.org">
+        <e7 xmlns="http://www.ietf.org">
+            <e8 xmlns="" xmlns:a="http://www.w3.org">
+                <e9 xmlns="" xmlns:a="http://www.ietf.org"/>
+                <text>&#169;</text>
+            </e8>
+        </e7>
+    </e6>
+    <![CDATA[<don't><process><this>:)]]>
+</doc><!-- Comment 3 -->
\ No newline at end of file

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample1.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample2.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample2.xml?rev=732117&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample2.xml (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample2.xml Tue Jan  6 12:59:56 2009
@@ -0,0 +1,11 @@
+<doc>
+   <clean>   </clean>
+   <dirty>   A   B   </dirty>
+   <mixed>
+      A
+      <clean>   </clean>
+      B
+      <dirty>   A   B   </dirty>
+      C
+   </mixed>
+</doc>
\ No newline at end of file

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample2.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample3.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample3.xml?rev=732117&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample3.xml (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample3.xml Tue Jan  6 12:59:56 2009
@@ -0,0 +1,18 @@
+<!DOCTYPE doc [<!ATTLIST e9 attr CDATA "default">]>
+<doc>
+   <e1   />
+   <e2   ></e2>
+   <e3   name = "elem3"   id="elem3"   />
+   <e4   name="elem4"   id="elem4"   ></e4>
+   <e5 a:attr="out" b:attr="sorted" attr2="all" attr="I'm"
+      xmlns:b="http://www.ietf.org"
+      xmlns:a="http://www.w3.org"
+      xmlns="http://example.org"/>
+   <e6 xmlns="" xmlns:a="http://www.w3.org">
+      <e7 xmlns="http://www.ietf.org">
+         <e8 xmlns="" xmlns:a="http://www.w3.org">
+            <e9 xmlns="" xmlns:a="http://www.ietf.org"/>
+         </e8>
+      </e7>
+   </e6>
+</doc>
\ No newline at end of file

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample3.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample4.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample4.xml?rev=732117&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample4.xml (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample4.xml Tue Jan  6 12:59:56 2009
@@ -0,0 +1,13 @@
+<!DOCTYPE doc [
+<!ATTLIST normId id ID #IMPLIED>
+<!ATTLIST normNames attr NMTOKENS #IMPLIED>
+]>
+<doc>
+   <text>First line&#x0d;&#10;Second line</text>
+   <value>&#x32;</value>
+   <compute><![CDATA[value>"0" && value<"10" ?"valid":"error"]]></compute>
+   <compute expr='value>"0" &amp;&amp; value&lt;"10" ?"valid":"error"'>valid</compute>
+   <norm attr=' &apos;   &#x20;&#13;&#xa;&#9;   &apos; '/>
+   <normNames attr='   A   &#x20;&#13;&#xa;&#9;   B   '/>
+   <normId id=' &apos;   &#x20;&#13;&#xa;&#9;   &apos; '/>
+</doc>
\ No newline at end of file

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample4.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample5.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample5.xml?rev=732117&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample5.xml (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample5.xml Tue Jan  6 12:59:56 2009
@@ -0,0 +1,10 @@
+<!DOCTYPE doc [
+<!ATTLIST doc attrExtEnt ENTITY #IMPLIED>
+<!ENTITY ent1 "Hello">
+<!ENTITY ent2 "world">
+]>
+<doc attrExtEnt="entExt">
+   &ent1;, &ent2;!
+</doc>
+
+<!-- comment goes here -->
\ No newline at end of file

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample5.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample6.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample6.xml?rev=732117&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample6.xml (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample6.xml Tue Jan  6 12:59:56 2009
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<doc>&#169;</doc>

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/sample6.xml
------------------------------------------------------------------------------
    svn:eol-style = native