ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1796439 - in /webservices/axiom/trunk: axiom-api/src/test/java/org/apache/axiom/om/ implementations/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/ implementations/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/ testing/axiom...
Date Sat, 27 May 2017 19:21:45 GMT
Author: veithen
Date: Sat May 27 19:21:45 2017
New Revision: 1796439

URL: http://svn.apache.org/viewvc?rev=1796439&view=rev
Log:
AXIOM-311: Refactor OMDocumentSerilizationTestBase.

Added:
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeUTF16.java
  (with props)
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeWithIgnoreXMLDeclaration.java
  (with props)
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeXML11.java
  (with props)
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeXMLDeclaration.java
  (with props)
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/XMLDeclarationSerializationTestCase.java
  (with props)
Removed:
    webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/om/OMDocumentSerilizationTestBase.java
    webservices/axiom/trunk/implementations/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DocumentImplSerializationTest.java
    webservices/axiom/trunk/implementations/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMDocumentImplSerializationTest.java
Modified:
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java

Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java?rev=1796439&r1=1796438&r2=1796439&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
(original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
Sat May 27 19:21:45 2017
@@ -218,6 +218,10 @@ public class OMTestSuiteBuilder extends
         addTest(new org.apache.axiom.ts.om.document.TestRemoveChildren(metaFactory, false,
true));
         addTest(new org.apache.axiom.ts.om.document.TestSerializeAndConsume(metaFactory));
         addTest(new org.apache.axiom.ts.om.document.TestSerializeAndConsumeWithIncompleteDescendant(metaFactory));
+        addTest(new org.apache.axiom.ts.om.document.TestSerializeUTF16(metaFactory));
+        addTest(new org.apache.axiom.ts.om.document.TestSerializeWithIgnoreXMLDeclaration(metaFactory));
+        addTest(new org.apache.axiom.ts.om.document.TestSerializeXML11(metaFactory));
+        addTest(new org.apache.axiom.ts.om.document.TestSerializeXMLDeclaration(metaFactory));
         addTest(new org.apache.axiom.ts.om.document.TestSetOMDocumentElementNew(metaFactory));
         addTest(new org.apache.axiom.ts.om.document.TestSetOMDocumentElementNull(metaFactory));
         addTest(new org.apache.axiom.ts.om.document.TestSetOMDocumentElementReplace(metaFactory));

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeUTF16.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeUTF16.java?rev=1796439&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeUTF16.java
(added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeUTF16.java
Sat May 27 19:21:45 2017
@@ -0,0 +1,44 @@
+/*
+ * 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.ts.om.document;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import java.io.ByteArrayOutputStream;
+
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMOutputFormat;
+
+public class TestSerializeUTF16 extends XMLDeclarationSerializationTestCase {
+    public TestSerializeUTF16(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    @Override
+    protected void runTest(OMDocument document) throws Throwable {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        OMOutputFormat format = new OMOutputFormat();
+        format.setCharSetEncoding("UTF-16");
+        document.serializeAndConsume(baos, format);
+
+        String xmlDocument = new String(baos.toByteArray(), "UTF-16");
+        assertThat(xmlDocument).startsWith("<?xml version=\"1.0\" encoding=\"UTF-16\"?>");
+    }
+}

Propchange: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeUTF16.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeWithIgnoreXMLDeclaration.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeWithIgnoreXMLDeclaration.java?rev=1796439&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeWithIgnoreXMLDeclaration.java
(added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeWithIgnoreXMLDeclaration.java
Sat May 27 19:21:45 2017
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.om.document;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import java.io.ByteArrayOutputStream;
+
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMOutputFormat;
+
+public class TestSerializeWithIgnoreXMLDeclaration extends XMLDeclarationSerializationTestCase
{
+    public TestSerializeWithIgnoreXMLDeclaration(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    @Override
+    protected void runTest(OMDocument document) throws Throwable {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        OMOutputFormat format = new OMOutputFormat();
+        format.setIgnoreXMLDeclaration(true);
+        document.serializeAndConsume(baos, format);
+
+        String xmlDocument = new String(baos.toByteArray(), "utf-8");
+
+        assertThat(xmlDocument).doesNotContain("<?xml");
+    }
+}

Propchange: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeWithIgnoreXMLDeclaration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeXML11.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeXML11.java?rev=1796439&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeXML11.java
(added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeXML11.java
Sat May 27 19:21:45 2017
@@ -0,0 +1,43 @@
+/*
+ * 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.ts.om.document;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import java.io.ByteArrayOutputStream;
+
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMMetaFactory;
+
+public class TestSerializeXML11 extends XMLDeclarationSerializationTestCase {
+    public TestSerializeXML11(OMMetaFactory metaFactory) {
+        super(metaFactory);
+        // TODO Auto-generated constructor stub
+    }
+
+    @Override
+    protected void runTest(OMDocument document) throws Throwable {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        document.setXMLVersion("1.1");
+        document.serializeAndConsume(baos);
+
+        String xmlDocument = new String(baos.toByteArray(), "utf-8");
+        assertThat(xmlDocument).startsWith("<?xml version=\"1.1\"");
+    }
+}

Propchange: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeXML11.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeXMLDeclaration.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeXMLDeclaration.java?rev=1796439&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeXMLDeclaration.java
(added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeXMLDeclaration.java
Sat May 27 19:21:45 2017
@@ -0,0 +1,42 @@
+/*
+ * 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.ts.om.document;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import java.io.ByteArrayOutputStream;
+
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMMetaFactory;
+
+public class TestSerializeXMLDeclaration extends XMLDeclarationSerializationTestCase {
+    public TestSerializeXMLDeclaration(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    @Override
+    protected void runTest(OMDocument document) throws Throwable {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        document.serializeAndConsume(baos);
+
+        String xmlDocument = new String(baos.toByteArray(), "utf-8");
+
+        assertThat(xmlDocument).startsWith("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
+    }
+}

Propchange: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestSerializeXMLDeclaration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/XMLDeclarationSerializationTestCase.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/XMLDeclarationSerializationTestCase.java?rev=1796439&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/XMLDeclarationSerializationTestCase.java
(added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/XMLDeclarationSerializationTestCase.java
Sat May 27 19:21:45 2017
@@ -0,0 +1,49 @@
+/*
+ * 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.ts.om.document;
+
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.ts.AxiomTestCase;
+
+public abstract class XMLDeclarationSerializationTestCase extends AxiomTestCase {
+    public XMLDeclarationSerializationTestCase(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    @Override
+    protected final void runTest() throws Throwable {
+        OMFactory factory = metaFactory.getOMFactory();
+
+        OMNamespace namespace = factory.createOMNamespace("http://testuri.org", "test");
+        OMElement documentElement = factory.createOMElement("DocumentElement", namespace);
+
+        OMElement child1 = factory.createOMElement("Child1", namespace);
+        child1.setText("TestText");
+        documentElement.addChild(child1);
+
+        OMDocument document = factory.createOMDocument();
+        document.addChild(documentElement);
+    }
+
+    protected abstract void runTest(OMDocument document) throws Throwable;
+}

Propchange: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/XMLDeclarationSerializationTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message