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/04/04 22:56:33 UTC
svn commit: r1088789 - 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/ axiom-tests...
Author: veithen
Date: Mon Apr 4 20:56:33 2011
New Revision: 1088789
URL: http://svn.apache.org/viewvc?rev=1088789&view=rev
Log:
Added a unit test for SOAPFault#setException and fixed an issue in the DOOM implementation.
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetException.java (with props)
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultImpl.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-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java?rev=1088789&r1=1088788&r2=1088789&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java Mon Apr 4 20:56:33 2011
@@ -24,6 +24,7 @@ import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMException;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.impl.dom.ElementImpl;
+import org.apache.axiom.om.impl.dom.ParentNode;
import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
import org.apache.axiom.om.impl.util.OMSerializerUtil;
import org.apache.axiom.soap.SOAPBody;
@@ -129,12 +130,12 @@ public abstract class SOAPFaultImpl exte
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
sw.flush();
- getDetail();
- if (getDetail() == null) {
- setDetail(getNewSOAPFaultDetail(this));
-
+ SOAPFaultDetail detail = getDetail();
+ if (detail == null) {
+ detail = getNewSOAPFaultDetail(this);
+ setDetail(detail);
}
- OMElement faultDetailEnty = new ElementImpl(this,
+ OMElement faultDetailEnty = new ElementImpl((ParentNode)detail,
SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY,
null, this.factory);
faultDetailEnty.setText(sw.getBuffer().toString());
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultImpl.java?rev=1088789&r1=1088788&r2=1088789&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultImpl.java Mon Apr 4 20:56:33 2011
@@ -132,7 +132,7 @@ public abstract class SOAPFaultImpl exte
e.printStackTrace(new PrintWriter(sw));
sw.flush();
SOAPFaultDetail detail = getDetail();
- if (getDetail() == null) {
+ if (detail == null) {
detail = getNewSOAPFaultDetail(this);
setDetail(detail);
}
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=1088789&r1=1088788&r2=1088789&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 Mon Apr 4 20:56:33 2011
@@ -61,6 +61,7 @@ public class SOAPTestSuiteBuilder extend
addTest(new org.apache.axiom.ts.soap.fault.TestGetRoleWithParser(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.fault.TestSetCode(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.fault.TestSetDetail(metaFactory, spec));
+ addTest(new org.apache.axiom.ts.soap.fault.TestSetException(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.fault.TestSetReason(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.fault.TestSetRole(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.faultdetail.TestAddDetailEntry(metaFactory, spec));
Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetException.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetException.java?rev=1088789&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetException.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetException.java Mon Apr 4 20:56:33 2011
@@ -0,0 +1,53 @@
+/*
+ * 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.fault;
+
+import java.util.Iterator;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPConstants;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+public class TestSetException extends SOAPTestCase {
+ public TestSetException(OMMetaFactory metaFactory, SOAPSpec spec) {
+ super(metaFactory, spec);
+ }
+
+ protected void runTest() throws Throwable {
+ SOAPFault fault = soapFactory.createSOAPFault();
+ Exception exception = new Exception("Test exception message");
+ fault.setException(exception);
+ SOAPFaultDetail detail = fault.getDetail();
+ assertNotNull(detail);
+ Iterator it = detail.getAllDetailEntries();
+ assertTrue(it.hasNext());
+ OMElement entry = (OMElement)it.next();
+ assertNotNull(entry);
+ assertEquals(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY, entry.getLocalName());
+ assertNull(entry.getNamespace());
+ String text = entry.getText();
+ assertTrue(text.startsWith(Exception.class.getName() + ": Test exception message"));
+ assertTrue(text.contains("at " + TestSetException.class.getName()));
+ assertFalse(it.hasNext());
+ }
+}
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetException.java
------------------------------------------------------------------------------
svn:eol-style = native