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 2014/07/12 02:10:26 UTC

svn commit: r1609868 [2/2] - in /webservices/axiom/trunk/modules: axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/ axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/ axiom-dom/src...

Added: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soapdom/SOAPDOMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soapdom/SOAPDOMTestSuiteBuilder.java?rev=1609868&view=auto
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soapdom/SOAPDOMTestSuiteBuilder.java (added)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soapdom/SOAPDOMTestSuiteBuilder.java Sat Jul 12 00:10:25 2014
@@ -0,0 +1,40 @@
+/*
+ * 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.soapdom;
+
+import org.apache.axiom.om.dom.DOMMetaFactory;
+import org.apache.axiom.testutils.suite.MatrixTestSuiteBuilder;
+import org.apache.axiom.ts.soap.SOAPSpec;
+
+public class SOAPDOMTestSuiteBuilder extends MatrixTestSuiteBuilder {
+    private final DOMMetaFactory metaFactory;
+
+    public SOAPDOMTestSuiteBuilder(DOMMetaFactory metaFactory) {
+        this.metaFactory = metaFactory;
+    }
+
+    protected void addTests() {
+        addTests(SOAPSpec.SOAP11);
+        addTests(SOAPSpec.SOAP12);
+    }
+    
+    private void addTests(SOAPSpec spec) {
+        addTest(new org.apache.axiom.ts.soapdom.message.TestLazySOAPFactorySelection(metaFactory, spec));
+    }
+}

Propchange: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soapdom/SOAPDOMTestSuiteBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soapdom/message/TestLazySOAPFactorySelection.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soapdom/message/TestLazySOAPFactorySelection.java?rev=1609868&view=auto
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soapdom/message/TestLazySOAPFactorySelection.java (added)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soapdom/message/TestLazySOAPFactorySelection.java Sat Jul 12 00:10:25 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.soapdom.message;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.sameInstance;
+import static org.junit.Assert.assertThat;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMXMLBuilderFactory;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPMessage;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+import org.apache.axiom.ts.soap.TestMessageSet;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class TestLazySOAPFactorySelection extends SOAPTestCase {
+    public TestLazySOAPFactorySelection(OMMetaFactory metaFactory, SOAPSpec spec) {
+        super(metaFactory, spec);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        // Create a SOAP model builder without specifying the SOAP version.
+        SOAPMessage message = OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory,
+                TestMessageSet.NO_HEADER.getMessage(spec).getInputStream(), null).getSOAPMessage();
+        
+        // At this stage, the SOAPFactory instance has not yet been determined.
+        // However, if we cast the SOAPMessage to a Document and use it to create e new Element,
+        // then that element must have the right factory.
+        Element element = ((Document)message).createElementNS("urn:test", "p:test");
+        
+        SOAPFactory soapFactoryFromNewElement = (SOAPFactory)((OMElement)element).getOMFactory();
+        assertThat(soapFactoryFromNewElement, is(sameInstance(soapFactory)));
+    }
+}

Propchange: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soapdom/message/TestLazySOAPFactorySelection.java
------------------------------------------------------------------------------
    svn:eol-style = native