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 az...@apache.org on 2008/08/28 08:55:33 UTC
svn commit: r689737 - in /webservices/commons/trunk/modules/axiom: ./
modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/
modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/impl/
modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/...
Author: azeez
Date: Wed Aug 27 23:55:32 2008
New Revision: 689737
URL: http://svn.apache.org/viewvc?rev=689737&view=rev
Log:
Applying patch at https://issues.apache.org/jira/browse/WSCOMMONS-218
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
webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample1.xml
webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample2.xml
webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample3.xml
webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample4.xml
webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample5.xml
webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample6.xml
webservices/commons/trunk/modules/axiom/pom.xml
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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
@@ -1,45 +0,0 @@
-/*
- * 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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
@@ -1,73 +0,0 @@
-/*
- * 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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
@@ -1,47 +0,0 @@
-/*
- * 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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
@@ -1,51 +0,0 @@
-/*
- * 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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
@@ -1,60 +0,0 @@
-/*
- * 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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
@@ -1,79 +0,0 @@
-/*
- * 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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
@@ -1,118 +0,0 @@
-/*
- * 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
\n" +
- "Second line</text>\n" +
- " <value>2</value>\n" +
- " <compute>value>\"0\" && value<\"10\" ?\"valid\":\"error\"</compute>\n" +
- " <compute expr=\"value>"0" && value<"10" ?"valid":"error"\">valid</compute>\n" +
- " <norm attr=\" ' 
	 ' \"></norm>\n" +
- " <normNames attr=\"A 
	 B\"></normNames>\n" +
- " <normId id=\"' 
	 '\"></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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
@@ -1,126 +0,0 @@
-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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
@@ -1,57 +0,0 @@
-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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
@@ -1,65 +0,0 @@
-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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
@@ -1,126 +0,0 @@
-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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
@@ -1,55 +0,0 @@
-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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
@@ -1,44 +0,0 @@
-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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
@@ -1,54 +0,0 @@
-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());
- }
-
-}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample1.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample1.xml?rev=689737&r1=689736&r2=689737&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample1.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample1.xml Wed Aug 27 23:55:32 2008
@@ -1,22 +0,0 @@
-<!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>©</text>
- </e8>
- </e7>
- </e6>
- <![CDATA[<don't><process><this>:)]]>
-</doc><!-- Comment 3 -->
\ No newline at end of file
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample2.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample2.xml?rev=689737&r1=689736&r2=689737&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample2.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample2.xml Wed Aug 27 23:55:32 2008
@@ -1,11 +0,0 @@
-<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
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample3.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample3.xml?rev=689737&r1=689736&r2=689737&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample3.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample3.xml Wed Aug 27 23:55:32 2008
@@ -1,18 +0,0 @@
-<!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
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample4.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample4.xml?rev=689737&r1=689736&r2=689737&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample4.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample4.xml Wed Aug 27 23:55:32 2008
@@ -1,13 +0,0 @@
-<!DOCTYPE doc [
-<!ATTLIST normId id ID #IMPLIED>
-<!ATTLIST normNames attr NMTOKENS #IMPLIED>
-]>
-<doc>
- <text>First line
 Second line</text>
- <value>2</value>
- <compute><![CDATA[value>"0" && value<"10" ?"valid":"error"]]></compute>
- <compute expr='value>"0" && value<"10" ?"valid":"error"'>valid</compute>
- <norm attr=' '   
	 ' '/>
- <normNames attr=' A   
	 B '/>
- <normId id=' '   
	 ' '/>
-</doc>
\ No newline at end of file
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample5.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample5.xml?rev=689737&r1=689736&r2=689737&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample5.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample5.xml Wed Aug 27 23:55:32 2008
@@ -1,10 +0,0 @@
-<!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
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample6.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample6.xml?rev=689737&r1=689736&r2=689737&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample6.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-c14n/src/test/resources/META-INF/sample6.xml Wed Aug 27 23:55:32 2008
@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<doc>©</doc>
\ No newline at end of file
Modified: webservices/commons/trunk/modules/axiom/pom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/pom.xml?rev=689737&r1=689736&r2=689737&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/pom.xml (original)
+++ webservices/commons/trunk/modules/axiom/pom.xml Wed Aug 27 23:55:32 2008
@@ -506,7 +506,8 @@
<modules>
<module>modules/axiom-api</module>
<module>modules/axiom-impl</module>
- <module>modules/axiom-dom</module>
+ <module>modules/axiom-dom</module>
+ <module>modules/axiom-c14n</module>
<module>modules/axiom-tests</module>
</modules>
<properties>
Re: svn commit: r689737 - in /webservices/commons/trunk/modules/axiom: ./ modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/ modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/impl/ modules/axiom-c14n/src/test/java/org/apache/axiom/c14n/omwrapper/...
Posted by Brian De Pradine <PR...@uk.ibm.com>.
Hi,
Axiom is failing to build because the pom.xml is missing from the
modules/axiom-c14n directory.
Cheers
Brian DePradine
Web Services Development
IBM Hursley
External +44 (0) 1962 816319 Internal 246319
If you can't find the time to do it right the first time, where will you
find the time to do it again?
azeez@apache.org wrote on 28/08/2008 07:55:33:
> Author: azeez
> Date: Wed Aug 27 23:55:32 2008
> New Revision: 689737
>
> URL: http://svn.apache.org/viewvc?rev=689737&view=rev
> Log:
> Applying patch at https://issues.apache.org/jira/browse/WSCOMMONS-218
>
> 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
> webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample1.xml
> webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample2.xml
> webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample3.xml
> webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample4.xml
> webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample5.xml
> webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample6.xml
> webservices/commons/trunk/modules/axiom/pom.xml
>
> 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=689737&r1=689736&r2=689737&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 Wed Aug
> 27 23:55:32 2008
> @@ -1,45 +0,0 @@
> -/*
> - * 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=689737&r1=689736&r2=689737&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 Wed Aug 27
> 23:55:32 2008
> @@ -1,73 +0,0 @@
> -/*
> - * 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=689737&r1=689736&r2=689737&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 Wed Aug 27
> 23:55:32 2008
> @@ -1,47 +0,0 @@
> -/*
> - * 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=689737&r1=689736&r2=689737&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 Wed Aug 27
> 23:55:32 2008
> @@ -1,51 +0,0 @@
> -/*
> - * 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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
> @@ -1,60 +0,0 @@
> -/*
> - * 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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
> @@ -1,79 +0,0 @@
> -/*
> - * 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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
> @@ -1,118 +0,0 @@
> -/*
> - * 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
\n" +
> - "Second line</text>\n" +
> - " <value>2</value>\n" +
> - " <compute>value>\"0\" && value<\"10\"
> ?\"valid\":\"error\"</compute>\n" +
> - " <compute expr=\"value>"0" &&
> value<"10" ?"valid":"error"
> \">valid</compute>\n" +
> - " <norm attr=\" ' 
	 ' \"></norm>\n" +
> - " <normNames attr=\"A 
	 B\"></normNames>\n"
+
> - " <normId id=\"' 
	 '\"></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=689737&r1=689736&r2=689737&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
> Wed Aug 27 23:55:32 2008
> @@ -1,126 +0,0 @@
> -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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
> @@ -1,57 +0,0 @@
> -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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
> @@ -1,65 +0,0 @@
> -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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
> @@ -1,126 +0,0 @@
> -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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
> @@ -1,55 +0,0 @@
> -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=689737&r1=689736&r2=689737&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 Wed Aug 27 23:55:32 2008
> @@ -1,44 +0,0 @@
> -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=689737&r1=689736&r2=689737&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
> Wed Aug 27 23:55:32 2008
> @@ -1,54 +0,0 @@
> -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());
> - }
> -
> -}
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample1.xml
> URL: http://svn.apache.
> org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample1.xml?
> rev=689737&r1=689736&r2=689737&view=diff
>
==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample1.xml (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample1.xml Wed Aug 27 23:55:32 2008
> @@ -1,22 +0,0 @@
> -<!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>©</text>
> - </e8>
> - </e7>
> - </e6>
> - <![CDATA[<don't><process><this>:)]]>
> -</doc><!-- Comment 3 -->
> \ No newline at end of file
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample2.xml
> URL: http://svn.apache.
> org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample2.xml?
> rev=689737&r1=689736&r2=689737&view=diff
>
==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample2.xml (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample2.xml Wed Aug 27 23:55:32 2008
> @@ -1,11 +0,0 @@
> -<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
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample3.xml
> URL: http://svn.apache.
> org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample3.xml?
> rev=689737&r1=689736&r2=689737&view=diff
>
==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample3.xml (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample3.xml Wed Aug 27 23:55:32 2008
> @@ -1,18 +0,0 @@
> -<!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
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample4.xml
> URL: http://svn.apache.
> org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample4.xml?
> rev=689737&r1=689736&r2=689737&view=diff
>
==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample4.xml (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample4.xml Wed Aug 27 23:55:32 2008
> @@ -1,13 +0,0 @@
> -<!DOCTYPE doc [
> -<!ATTLIST normId id ID #IMPLIED>
> -<!ATTLIST normNames attr NMTOKENS #IMPLIED>
> -]>
> -<doc>
> - <text>First line
 Second line</text>
> - <value>2</value>
> - <compute><![CDATA[value>"0" && value<"10"
?"valid":"error"]]></compute>
> - <compute expr='value>"0" && value<"10"
> ?"valid":"error"'>valid</compute>
> - <norm attr=' '   
	 ' '/>
> - <normNames attr=' A   
	 B '/>
> - <normId id=' '   
	 ' '/>
> -</doc>
> \ No newline at end of file
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample5.xml
> URL: http://svn.apache.
> org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample5.xml?
> rev=689737&r1=689736&r2=689737&view=diff
>
==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample5.xml (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample5.xml Wed Aug 27 23:55:32 2008
> @@ -1,10 +0,0 @@
> -<!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
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample6.xml
> URL: http://svn.apache.
> org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample6.xml?
> rev=689737&r1=689736&r2=689737&view=diff
>
==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample6.xml (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-
> c14n/src/test/resources/META-INF/sample6.xml Wed Aug 27 23:55:32 2008
> @@ -1,2 +0,0 @@
> -<?xml version="1.0" encoding="ISO-8859-1"?>
> -<doc>©</doc>
> \ No newline at end of file
>
> Modified: webservices/commons/trunk/modules/axiom/pom.xml
> URL: http://svn.apache.
> org/viewvc/webservices/commons/trunk/modules/axiom/pom.xml?
> rev=689737&r1=689736&r2=689737&view=diff
>
==============================================================================
> --- webservices/commons/trunk/modules/axiom/pom.xml (original)
> +++ webservices/commons/trunk/modules/axiom/pom.xml Wed Aug 27 23:55:32
2008
> @@ -506,7 +506,8 @@
> <modules>
> <module>modules/axiom-api</module>
> <module>modules/axiom-impl</module>
> - <module>modules/axiom-dom</module>
> + <module>modules/axiom-dom</module>
> + <module>modules/axiom-c14n</module>
> <module>modules/axiom-tests</module>
> </modules>
> <properties>
>
>
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU