You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2016/02/21 12:34:57 UTC

svn commit: r1731522 - in /webservices/axiom/trunk/testing/axiom-testsuite: ./ src/main/java/org/apache/axiom/ts/om/ src/main/java/org/apache/axiom/ts/om/comment/ src/main/java/org/apache/axiom/ts/om/doctype/ src/main/java/org/apache/axiom/ts/om/entref...

Author: veithen
Date: Sun Feb 21 11:34:56 2016
New Revision: 1731522

URL: http://svn.apache.org/viewvc?rev=1731522&view=rev
Log:
Increase test coverage.

Added:
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/comment/
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/comment/TestSerialize.java   (with props)
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/doctype/
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/doctype/TestSerialize.java   (with props)
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/entref/
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/entref/TestSerialize.java   (with props)
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/pi/TestSerialize.java   (with props)
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestSerialize.java   (with props)
Modified:
    webservices/axiom/trunk/testing/axiom-testsuite/pom.xml
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java

Modified: webservices/axiom/trunk/testing/axiom-testsuite/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/pom.xml?rev=1731522&r1=1731521&r2=1731522&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/pom.xml (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/pom.xml Sun Feb 21 11:34:56 2016
@@ -94,6 +94,10 @@
             <artifactId>jaxp-testsuite</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

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=1731522&r1=1731521&r2=1731522&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 Sun Feb 21 11:34:56 2016
@@ -140,6 +140,7 @@ public class OMTestSuiteBuilder extends
         addTest(new org.apache.axiom.ts.om.builder.TestRegisterCustomBuilderForPayloadJAXBWithXOP(metaFactory));
         addTest(new org.apache.axiom.ts.om.builder.TestRootPartStreaming(metaFactory));
         addTest(new org.apache.axiom.ts.om.builder.TestStandaloneConfiguration(metaFactory));
+        addTest(new org.apache.axiom.ts.om.comment.TestSerialize(metaFactory));
         for (XMLSample file : getInstances(XMLSample.class)) {
             for (OMContainerExtractor ce : getInstances(OMContainerExtractor.class)) {
                 for (BuilderFactory bf : getInstances(BuilderFactory.class)) {
@@ -162,6 +163,7 @@ public class OMTestSuiteBuilder extends
             addTest(new org.apache.axiom.ts.om.container.TestGetDescendants(metaFactory, cf, true));
             addTest(new org.apache.axiom.ts.om.container.TestGetDescendants(metaFactory, cf, false));
         }
+        addTest(new org.apache.axiom.ts.om.doctype.TestSerialize(metaFactory));
         addTest(new org.apache.axiom.ts.om.document.TestAddChildIncomplete(metaFactory));
         addTest(new org.apache.axiom.ts.om.document.TestAddChildWithExistingDocumentElement(metaFactory));
         addTest(new org.apache.axiom.ts.om.document.TestBuild(metaFactory));
@@ -435,6 +437,7 @@ public class OMTestSuiteBuilder extends
         addTest(new org.apache.axiom.ts.om.element.sr.TestGetNamespaceContext(metaFactory, true));
         addTest(new org.apache.axiom.ts.om.element.sr.TestGetNamespaceContext(metaFactory, false));
         addTest(new org.apache.axiom.ts.om.element.sr.TestNextTag(metaFactory));
+        addTest(new org.apache.axiom.ts.om.entref.TestSerialize(metaFactory));
         addTest(new org.apache.axiom.ts.om.factory.TestCreateOMAttributeGeneratedPrefix(metaFactory));
         addTest(new org.apache.axiom.ts.om.factory.TestCreateOMAttributeInterfaces(metaFactory));
         addTest(new org.apache.axiom.ts.om.factory.TestCreateOMAttributeNullPrefixNoNamespace(metaFactory));
@@ -610,6 +613,7 @@ public class OMTestSuiteBuilder extends
             addTest(new org.apache.axiom.ts.om.sourcedelement.sr.TestCloseWithoutCaching(metaFactory, events));
         }
         addTest(new org.apache.axiom.ts.om.pi.TestDigest(metaFactory));
+        addTest(new org.apache.axiom.ts.om.pi.TestSerialize(metaFactory));
         addTest(new org.apache.axiom.ts.om.text.TestBase64StreamingWithGetSAXSource(metaFactory));
         addTest(new org.apache.axiom.ts.om.text.TestBase64StreamingWithSerialize(metaFactory));
         addTest(new org.apache.axiom.ts.om.text.TestCloneBinary(metaFactory, false));
@@ -618,6 +622,7 @@ public class OMTestSuiteBuilder extends
         addTest(new org.apache.axiom.ts.om.text.TestGetNamespace(metaFactory));
         addTest(new org.apache.axiom.ts.om.text.TestGetNamespaceNoNamespace(metaFactory));
         addTest(new org.apache.axiom.ts.om.text.TestGetTextCharactersFromDataHandler(metaFactory));
+        addTest(new org.apache.axiom.ts.om.text.TestSerialize(metaFactory));
         addTest(new org.apache.axiom.ts.om.xop.TestSerialize(metaFactory, false));
         addTest(new org.apache.axiom.ts.om.xop.TestSerialize(metaFactory, true));
         addTest(new org.apache.axiom.ts.om.xop.TestSetOptimize(metaFactory, false));

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/comment/TestSerialize.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/comment/TestSerialize.java?rev=1731522&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/comment/TestSerialize.java (added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/comment/TestSerialize.java Sun Feb 21 11:34:56 2016
@@ -0,0 +1,46 @@
+/*
+ * 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.comment;
+
+import static org.mockito.Mockito.atMost;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.om.OMComment;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.ts.AxiomTestCase;
+
+public class TestSerialize extends AxiomTestCase {
+    public TestSerialize(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        OMComment comment = metaFactory.getOMFactory().createOMComment(null, "test");
+        XMLStreamWriter writer = mock(XMLStreamWriter.class);
+        comment.serialize(writer);
+        verify(writer).writeComment(comment.getValue());
+        verify(writer, atMost(1)).flush();
+        verifyNoMoreInteractions(writer);
+    }
+}

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

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/doctype/TestSerialize.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/doctype/TestSerialize.java?rev=1731522&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/doctype/TestSerialize.java (added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/doctype/TestSerialize.java Sun Feb 21 11:34:56 2016
@@ -0,0 +1,46 @@
+/*
+ * 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.doctype;
+
+import static org.mockito.Mockito.atMost;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.om.OMDocType;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.ts.AxiomTestCase;
+
+public class TestSerialize extends AxiomTestCase {
+    public TestSerialize(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        OMDocType doctype = metaFactory.getOMFactory().createOMDocType(null, "root", null, "my.dtd", null);
+        XMLStreamWriter writer = mock(XMLStreamWriter.class);
+        doctype.serialize(writer);
+        verify(writer).writeDTD("<!DOCTYPE root SYSTEM \"my.dtd\">");
+        verify(writer, atMost(1)).flush();
+        verifyNoMoreInteractions(writer);
+    }
+}

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

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/entref/TestSerialize.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/entref/TestSerialize.java?rev=1731522&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/entref/TestSerialize.java (added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/entref/TestSerialize.java Sun Feb 21 11:34:56 2016
@@ -0,0 +1,46 @@
+/*
+ * 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.entref;
+
+import static org.mockito.Mockito.atMost;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.om.OMEntityReference;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.ts.AxiomTestCase;
+
+public class TestSerialize extends AxiomTestCase {
+    public TestSerialize(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        OMEntityReference entref = metaFactory.getOMFactory().createOMEntityReference(null, "testref");
+        XMLStreamWriter writer = mock(XMLStreamWriter.class);
+        entref.serialize(writer);
+        verify(writer).writeEntityRef(entref.getName());
+        verify(writer, atMost(1)).flush();
+        verifyNoMoreInteractions(writer);
+    }
+}

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

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/pi/TestSerialize.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/pi/TestSerialize.java?rev=1731522&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/pi/TestSerialize.java (added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/pi/TestSerialize.java Sun Feb 21 11:34:56 2016
@@ -0,0 +1,46 @@
+/*
+ * 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.pi;
+
+import static org.mockito.Mockito.atMost;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMProcessingInstruction;
+import org.apache.axiom.ts.AxiomTestCase;
+
+public class TestSerialize extends AxiomTestCase {
+    public TestSerialize(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        OMProcessingInstruction pi = metaFactory.getOMFactory().createOMProcessingInstruction(null, "target", "data");
+        XMLStreamWriter writer = mock(XMLStreamWriter.class);
+        pi.serialize(writer);
+        verify(writer).writeProcessingInstruction(pi.getTarget() + " ", pi.getValue());
+        verify(writer, atMost(1)).flush();
+        verifyNoMoreInteractions(writer);
+    }
+}

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

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestSerialize.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestSerialize.java?rev=1731522&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestSerialize.java (added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestSerialize.java Sun Feb 21 11:34:56 2016
@@ -0,0 +1,46 @@
+/*
+ * 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.text;
+
+import static org.mockito.Mockito.atMost;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.ts.AxiomTestCase;
+
+public class TestSerialize extends AxiomTestCase {
+    public TestSerialize(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        OMText text = metaFactory.getOMFactory().createOMText("test");
+        XMLStreamWriter writer = mock(XMLStreamWriter.class);
+        text.serialize(writer);
+        verify(writer).writeCharacters(text.getText());
+        verify(writer, atMost(1)).flush();
+        verifyNoMoreInteractions(writer);
+    }
+}

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