ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1165756 - in /webservices/commons/trunk/modules/axiom/modules: axiom-api/src/main/java/org/apache/axiom/soap/ axiom-testsuite/src/main/java/org/apache/axiom/ts/ axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/
Date Tue, 06 Sep 2011 16:32:19 GMT
Author: veithen
Date: Tue Sep  6 16:32:18 2011
New Revision: 1165756

URL: http://svn.apache.org/viewvc?rev=1165756&view=rev
Log:
Reduced the technical debt related to SOAPFactory#createSOAPEnvelope(OMNamespace), i.e. added
documentation and a test case.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPEnvelopeWithCustomPrefix.java
  (with props)
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java?rev=1165756&r1=1165755&r2=1165756&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java
Tue Sep  6 16:32:18 2011
@@ -50,6 +50,16 @@ public interface SOAPFactory extends OMF
     // TODO: when does this thing throw a SOAPProcessingException??
     SOAPEnvelope createSOAPEnvelope() throws SOAPProcessingException;
     
+    /**
+     * Create a SOAP envelope with the given namespace. This method can be used to create
a SOAP
+     * envelope with a custom namespace prefix.
+     * 
+     * @param ns
+     *            the namespace information for the SOAP envelope
+     * @return the SOAP envelope
+     */
+    // TODO: specify what happens if there is a mismatch between the provided namespace URI
and the SOAP version of the factory
+    // TODO: specify what happens if the prefix is null
     SOAPEnvelope createSOAPEnvelope(OMNamespace ns); 
 
     SOAPEnvelope createSOAPEnvelope(OMXMLParserWrapper builder);

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java?rev=1165756&r1=1165755&r2=1165756&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/SOAPTestSuiteBuilder.java
Tue Sep  6 16:32:18 2011
@@ -52,6 +52,7 @@ public class SOAPTestSuiteBuilder extend
         addTest(new org.apache.axiom.ts.soap.envelope.TestHasFault(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.envelope.TestHasFaultWithParser(metaFactory,
spec));
         addTest(new org.apache.axiom.ts.soap.factory.TestCreateSOAPEnvelope(metaFactory,
spec));
+        addTest(new org.apache.axiom.ts.soap.factory.TestCreateSOAPEnvelopeWithCustomPrefix(metaFactory,
spec));
         addTest(new org.apache.axiom.ts.soap.factory.TestGetDefaultFaultEnvelope(metaFactory,
spec));
         addTest(new org.apache.axiom.ts.soap.fault.TestGetCode(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.fault.TestGetCodeWithParser(metaFactory, spec));

Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPEnvelopeWithCustomPrefix.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPEnvelopeWithCustomPrefix.java?rev=1165756&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPEnvelopeWithCustomPrefix.java
(added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPEnvelopeWithCustomPrefix.java
Tue Sep  6 16:32:18 2011
@@ -0,0 +1,51 @@
+/*
+ * 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.soap.factory;
+
+import java.util.Iterator;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPConstants;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+/**
+ * Tests the behavior of {@link SOAPFactory#createSOAPEnvelope(OMNamespace)}.
+ */
+public class TestCreateSOAPEnvelopeWithCustomPrefix extends SOAPTestCase {
+    public TestCreateSOAPEnvelopeWithCustomPrefix(OMMetaFactory metaFactory, SOAPSpec spec)
{
+        super(metaFactory, spec);
+    }
+
+    protected void runTest() throws Throwable {
+        String prefix = "my-soap";
+        OMNamespace ns = soapFactory.createOMNamespace(spec.getEnvelopeNamespaceURI(), prefix);
+        SOAPEnvelope env = soapFactory.createSOAPEnvelope(ns);
+        assertEquals(prefix, env.getNamespace().getPrefix());
+        assertEquals(spec.getEnvelopeNamespaceURI(), env.getNamespace().getNamespaceURI());
+        assertEquals(SOAPConstants.SOAPENVELOPE_LOCAL_NAME, env.getLocalName());
+        Iterator it = env.getAllDeclaredNamespaces();
+        assertTrue(it.hasNext());
+        assertEquals(ns, it.next());
+        assertFalse(it.hasNext());
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPEnvelopeWithCustomPrefix.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message