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 2011/07/10 13:01:38 UTC
svn commit: r1144820 - 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/header/
Author: veithen
Date: Sun Jul 10 11:01:38 2011
New Revision: 1144820
URL: http://svn.apache.org/viewvc?rev=1144820&view=rev
Log:
Clarify the behavior of SOAPHeader#addHeaderBlock if no namespace is given.
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockWithoutNamespace1.java (with props)
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockWithoutNamespace2.java (with props)
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeader.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/SOAPHeader.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeader.java?rev=1144820&r1=1144819&r2=1144820&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeader.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeader.java Sun Jul 10 11:01:38 2011
@@ -33,13 +33,15 @@ public interface SOAPHeader extends OMEl
* to this {@link SOAPHeader} object.
*
* @param localName
+ * the local name of the header block
* @param ns
+ * the namespace of the header block; must not be <code>null</code> and must specify
+ * a non empty namespace URI
* @return the new {@link SOAPHeaderBlock} object that was inserted into this {@link SOAPHeader}
* object
* @throws OMException
- * if a SOAP error occurs
+ * if an error occurs, e.g. if no namespace was specified
*/
- // TODO: specify that the element to be added must have a namespace
SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException;
/**
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=1144820&r1=1144819&r2=1144820&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 Sun Jul 10 11:01:38 2011
@@ -71,6 +71,8 @@ public class SOAPTestSuiteBuilder extend
addTest(new org.apache.axiom.ts.soap.faultdetail.TestWSCommons202(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.faulttext.TestSetLang(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.header.TestAddHeaderBlock(metaFactory, spec));
+ addTest(new org.apache.axiom.ts.soap.header.TestAddHeaderBlockWithoutNamespace1(metaFactory, spec));
+ addTest(new org.apache.axiom.ts.soap.header.TestAddHeaderBlockWithoutNamespace2(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.header.TestExamineAllHeaderBlocks(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.header.TestExamineHeaderBlocks(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.header.TestExtractAllHeaderBlocks(metaFactory, spec));
Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockWithoutNamespace1.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockWithoutNamespace1.java?rev=1144820&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockWithoutNamespace1.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockWithoutNamespace1.java Sun Jul 10 11:01:38 2011
@@ -0,0 +1,48 @@
+/*
+ * 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.header;
+
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+/**
+ * Tests the behavior of {@link SOAPHeader#addHeaderBlock(String, OMNamespace)} when passing a
+ * <code>null</code> value for the {@link OMNamespace} parameter.
+ */
+public class TestAddHeaderBlockWithoutNamespace1 extends SOAPTestCase {
+ public TestAddHeaderBlockWithoutNamespace1(OMMetaFactory metaFactory, SOAPSpec spec) {
+ super(metaFactory, spec);
+ }
+
+ protected void runTest() throws Throwable {
+ SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
+ SOAPHeader header = soapFactory.createSOAPHeader(envelope);
+ try {
+ header.addHeaderBlock("test", null);
+ fail("Expected OMException");
+ } catch (OMException ex) {
+ // Expected
+ }
+ }
+}
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockWithoutNamespace1.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockWithoutNamespace2.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockWithoutNamespace2.java?rev=1144820&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockWithoutNamespace2.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockWithoutNamespace2.java Sun Jul 10 11:01:38 2011
@@ -0,0 +1,49 @@
+/*
+ * 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.header;
+
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+/**
+ * Tests the behavior of {@link SOAPHeader#addHeaderBlock(String, OMNamespace)} when passing an
+ * {@link OMNamespace} object with an empty namespace URI.
+ */
+public class TestAddHeaderBlockWithoutNamespace2 extends SOAPTestCase {
+ public TestAddHeaderBlockWithoutNamespace2(OMMetaFactory metaFactory, SOAPSpec spec) {
+ super(metaFactory, spec);
+ }
+
+ protected void runTest() throws Throwable {
+ SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
+ SOAPHeader header = soapFactory.createSOAPHeader(envelope);
+ OMNamespace ns = soapFactory.createOMNamespace("", "");
+ try {
+ header.addHeaderBlock("test", ns);
+ fail("Expected OMException");
+ } catch (OMException ex) {
+ // Expected
+ }
+ }
+}
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockWithoutNamespace2.java
------------------------------------------------------------------------------
svn:eol-style = native