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 2012/02/28 14:07:46 UTC
svn commit: r1294630 - in /webservices/commons/trunk/modules/axiom/modules:
axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/
axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/
axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/ axiom-...
Author: veithen
Date: Tue Feb 28 13:07:45 2012
New Revision: 1294630
URL: http://svn.apache.org/viewvc?rev=1294630&view=rev
Log:
There is no reason why detach should not be allowed on a SOAPEnvelope.
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestDetach.java (with props)
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPMessageImpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java?rev=1294630&r1=1294629&r2=1294630&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java Tue Feb 28 13:07:45 2012
@@ -204,15 +204,6 @@ public class SOAPEnvelopeImpl extends SO
return null;
}
- /**
- * Method detach
- *
- * @throws OMException
- */
- public OMNode detach() throws OMException {
- throw new OMException("Root Element can not be detached");
- }
-
protected void checkParent(OMElement parent) throws SOAPProcessingException {
// here do nothing as SOAPEnvelope doesn't have a parent !!!
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java?rev=1294630&r1=1294629&r2=1294630&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java Tue Feb 28 13:07:45 2012
@@ -184,21 +184,6 @@ public class SOAPEnvelopeImpl extends SO
return null;
}
- /**
- * Method detach
- *
- * @throws OMException
- */
- public OMNode detach() throws OMException {
-// throw new OMException("Root Element can not be detached");
- // I'm confused why this threw an exception as above. One should be able to create
- // a SOAP envelope and be able to detach from the its parent document.
- // The example is if I want to send a SOAPEnvelope inside another SOAP message, then this will
- // not allow to do that.
- // Must be an idea of a DOM guy ;)
- return this;
- }
-
protected void checkParent(OMElement parent) throws SOAPProcessingException {
// here do nothing as SOAPEnvelope doesn't have a parent !!!
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPMessageImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPMessageImpl.java?rev=1294630&r1=1294629&r2=1294630&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPMessageImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPMessageImpl.java Tue Feb 28 13:07:45 2012
@@ -20,7 +20,6 @@
package org.apache.axiom.soap.impl.llom;
import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.impl.OMNodeEx;
import org.apache.axiom.om.impl.llom.OMDocumentImpl;
@@ -61,11 +60,6 @@ public class SOAPMessageImpl extends OMD
"This is not allowed. Use set SOAPEnvelope instead");
}
- public void setFirstChild(OMNode firstChild) {
- throw new UnsupportedOperationException(
- "This is not allowed. Use set SOAPEnvelope instead");
- }
-
protected void internalSerialize(XMLStreamWriter writer, boolean cache,
boolean includeXMLDeclaration) throws XMLStreamException {
((OMNodeEx)getOMDocumentElement()).internalSerialize(writer, cache);
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java?rev=1294630&r1=1294629&r2=1294630&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java Tue Feb 28 13:07:45 2012
@@ -40,6 +40,7 @@ public class SOAPTestSuiteBuilder extend
addTest(new org.apache.axiom.ts.soap.body.TestHasFaultWithParser(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.envelope.TestAddHeaderToIncompleteEnvelope(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.envelope.TestBodyHeaderOrder(metaFactory, spec));
+ addTest(new org.apache.axiom.ts.soap.envelope.TestDetach(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.envelope.TestDiscardHeader(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.envelope.TestGetBody(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.envelope.TestGetBodyOnEmptyEnvelope(metaFactory, spec));
Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestDetach.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestDetach.java?rev=1294630&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestDetach.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestDetach.java Tue Feb 28 13:07:45 2012
@@ -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.envelope;
+
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+/**
+ * Tests {@link OMNode#detach()} when used on a {@link SOAPEnvelope}. Older Axiom versions threw an
+ * exception in that case. This is not correct because obviously one may want to detach a SOAP
+ * envelope from its containing document.
+ */
+public class TestDetach extends SOAPTestCase {
+ public TestDetach(OMMetaFactory metaFactory, SOAPSpec spec) {
+ super(metaFactory, spec);
+ }
+
+ protected void runTest() throws Throwable {
+ SOAPEnvelope envelope = getTestMessage(MESSAGE);
+ OMDocument document = (OMDocument)envelope.getParent();
+ envelope.detach();
+ assertNull(envelope.getParent());
+ assertNull(envelope.getPreviousOMSibling());
+ assertNull(envelope.getNextOMSibling());
+ assertNull(document.getOMDocumentElement());
+ }
+}
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestDetach.java
------------------------------------------------------------------------------
svn:eol-style = native