Author: veithen
Date: Thu Jul 10 19:20:57 2014
New Revision: 1609555

URL: http://svn.apache.org/r1609555
Log:
Added another SAAJ test.

Added:
    
webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/TestGetOwnerDocument.java
   (with props)
Modified:
    
webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuiteBuilder.java

Modified: 
webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuiteBuilder.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuiteBuilder.java?rev=1609555&r1=1609554&r2=1609555&view=diff
==============================================================================
--- 
webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuiteBuilder.java
 (original)
+++ 
webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuiteBuilder.java
 Thu Jul 10 19:20:57 2014
@@ -40,5 +40,8 @@ public class SAAJTestSuiteBuilder extend
         addTest(new TestSetParentElement(saajImplementation, 
SOAPConstants.SOAP_1_1_PROTOCOL));
         addTest(new TestSetParentElement(saajImplementation, 
SOAPConstants.SOAP_1_2_PROTOCOL));
         addTest(new TestSetParentElement(saajImplementation, 
SOAPConstants.DYNAMIC_SOAP_PROTOCOL));
+        addTest(new TestGetOwnerDocument(saajImplementation, 
SOAPConstants.SOAP_1_1_PROTOCOL));
+        addTest(new TestGetOwnerDocument(saajImplementation, 
SOAPConstants.SOAP_1_2_PROTOCOL));
+        addTest(new TestGetOwnerDocument(saajImplementation, 
SOAPConstants.DYNAMIC_SOAP_PROTOCOL));
     }
 }

Added: 
webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/TestGetOwnerDocument.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/TestGetOwnerDocument.java?rev=1609555&view=auto
==============================================================================
--- 
webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/TestGetOwnerDocument.java
 (added)
+++ 
webservices/axiom/trunk/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/TestGetOwnerDocument.java
 Thu Jul 10 19:20:57 2014
@@ -0,0 +1,55 @@
+/*
+ * 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.saaj;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.junit.Assert.assertThat;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPPart;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+/**
+ * Tests the behavior of the {@link Node#getOwnerDocument()} method when 
invoked on a {@link SOAPElement}
+ * as well as the properties of the returned document.
+ */
+public class TestGetOwnerDocument extends SAAJTestCase {
+    private final String protocol;
+    
+    public TestGetOwnerDocument(SAAJImplementation saajImplementation, String 
protocol) {
+        super(saajImplementation);
+        this.protocol = protocol;
+        addTestParameter("protocol", protocol);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        SOAPFactory factory = saajImplementation.newSOAPFactory(protocol);
+        Document doc = factory.createElement(new 
QName("test")).getOwnerDocument();
+        assertThat(doc, is(not(instanceOf(SOAPPart.class))));
+        assertThat(doc, is(not(instanceOf(javax.xml.soap.Node.class))));
+        assertThat(doc.createElementNS(null, "test"), 
is(instanceOf(SOAPElement.class)));
+    }
+}

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


Reply via email to