Author: veithen
Date: Tue Jan 18 23:33:35 2011
New Revision: 1060621

URL: http://svn.apache.org/viewvc?rev=1060621&view=rev
Log:
Added a test case for SOAPFactory#createSOAPEnvelope() and improved the Javadoc 
of that method.

Added:
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPEnvelope.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=1060621&r1=1060620&r2=1060621&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 Jan 18 23:33:35 2011
@@ -39,7 +39,15 @@ public interface SOAPFactory extends OMF
 
     SOAPMessage createSOAPMessage(SOAPEnvelope envelope, OMXMLParserWrapper 
parserWrapper);
 
-    /** @return Returns SOAPEnvelope. */
+    /**
+     * Create a SOAP envelope. The returned element will have the namespace 
URI specified by the
+     * SOAP version that this factory represents. It will have the prefix 
given by
+     * {@link SOAPConstants#SOAP_DEFAULT_NAMESPACE_PREFIX}. It will also have 
a corresponding
+     * namespace declaration.
+     * 
+     * @return the SOAP envelope
+     */
+    // TODO: when does this thing throw a SOAPProcessingException??
     SOAPEnvelope createSOAPEnvelope() throws SOAPProcessingException;
     
     SOAPEnvelope createSOAPEnvelope(OMNamespace ns); 

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=1060621&r1=1060620&r2=1060621&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 Jan 18 23:33:35 2011
@@ -43,6 +43,7 @@ public class SOAPTestSuiteBuilder extend
         addTest(new 
org.apache.axiom.ts.soap.envelope.TestGetHeader(metaFactory, spec));
         addTest(new 
org.apache.axiom.ts.soap.envelope.TestGetHeaderWithParser(metaFactory, spec));
         addTest(new 
org.apache.axiom.ts.soap.envelope.TestGetSOAPBodyFirstElementLocalNameAndNS(metaFactory,
 spec));
+        addTest(new 
org.apache.axiom.ts.soap.factory.TestCreateSOAPEnvelope(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/TestCreateSOAPEnvelope.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPEnvelope.java?rev=1060621&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPEnvelope.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPEnvelope.java
 Tue Jan 18 23:33:35 2011
@@ -0,0 +1,47 @@
+/*
+ * 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.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+public class TestCreateSOAPEnvelope extends SOAPTestCase {
+    public TestCreateSOAPEnvelope(OMMetaFactory metaFactory, SOAPSpec spec) {
+        super(metaFactory, spec);
+    }
+
+    protected void runTest() throws Throwable {
+        SOAPEnvelope env = soapFactory.createSOAPEnvelope();
+        assertEquals(SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX, 
env.getNamespace().getPrefix());
+        assertEquals(spec.getEnvelopeNamespaceURI(), 
env.getNamespace().getNamespaceURI());
+        assertEquals(SOAPConstants.SOAPENVELOPE_LOCAL_NAME, 
env.getLocalName());
+        Iterator it = env.getAllDeclaredNamespaces();
+        assertTrue(it.hasNext());
+        OMNamespace ns = (OMNamespace)it.next();
+        assertEquals(SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX, 
ns.getPrefix());
+        assertEquals(spec.getEnvelopeNamespaceURI(), ns.getNamespaceURI());
+        assertFalse(it.hasNext());
+    }
+}

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


Reply via email to