You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ch...@apache.org on 2006/02/01 11:36:10 UTC
svn commit: r374036 [12/15] - in /webservices/commons/trunk/axiom:
src/org/apache/ws/ src/org/apache/ws/commons/
src/org/apache/ws/commons/attachments/
src/org/apache/ws/commons/attachments/utils/ src/org/apache/ws/commons/om/
src/org/apache/ws/commons...
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultCodeTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultCodeTest.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultCodeTest.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultCodeTest.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap;
+
+
+public class SOAPFaultCodeTest extends SOAPFaultCodeTestCase {
+
+ public SOAPFaultCodeTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ //SOAP 1.1 Fault Code Test (Programaticaly Created)
+ public void testSOAP11SetValue() {
+ soap11FaultCode.setValue(
+ soap11Factory.createSOAPFaultValue(soap11FaultCode));
+ assertFalse(
+ "SOAP 1.1 Fault Code Test :- After calling setValue method, getValue method returns null",
+ soap11FaultCode.getValue() == null);
+ try {
+ soap11FaultCode.setValue(
+ soap12Factory.createSOAPFaultValue(soap12FaultCode));
+ fail("SOAP12FaultValue should not be inserted to SOAP11FaultCode");
+ } catch (SOAPProcessingException e) {
+ assertTrue(true);
+ }
+
+ }
+
+ public void testSOAP11GetValue() {
+ assertTrue(
+ "SOAP 1.1 Fault Code Test :- After creating soapfaultcode, it has a value",
+ soap11FaultCode.getValue() == null);
+ soap11FaultCode.setValue(
+ soap11Factory.createSOAPFaultValue(soap11FaultCode));
+ assertFalse(
+ "SOAP 1.1 Fault Code Test :- After calling setValue method, getValue method returns null",
+ soap11FaultCode.getValue() == null);
+ }
+
+ //SOAP 1.2 Fault Code Test (Programaticaly Created)
+ public void testSOAP12SetValue() {
+ soap12FaultCode.setValue(
+ soap12Factory.createSOAPFaultValue(soap12FaultCode));
+ assertFalse(
+ "SOAP 1.2 Fault Code Test :- After calling setValue method, getValue method returns null",
+ soap12FaultCode.getValue() == null);
+ try {
+ soap12FaultCode.setValue(
+ soap11Factory.createSOAPFaultValue(soap11FaultCode));
+ fail("SOAP11FaultValue should not be inserted to SOAP12FaultCode");
+ } catch (SOAPProcessingException e) {
+ assertTrue(true);
+ }
+
+ try {
+ soap12FaultCode.setValue(
+ soap12Factory.createSOAPFaultValue(
+ soap12Factory.createSOAPFaultSubCode(
+ soap12FaultCode)));
+ } catch (Exception e) {
+ fail(
+ "SOAP 1.2 Fault Code Test :- When calling setValue method, parent of value element mismatch");
+ }
+ }
+
+ public void testSOAP12GetValue() {
+ assertTrue(
+ "SOAP 1.2 Fault Code Test :- After creating soapfaultcode, it has a value",
+ soap12FaultCode.getValue() == null);
+ soap12FaultCode.setValue(
+ soap12Factory.createSOAPFaultValue(soap12FaultCode));
+ assertFalse(
+ "SOAP 1.2 Fault Code Test :- After calling setValue method, getValue method returns null",
+ soap12FaultCode.getValue() == null);
+ }
+
+ public void testSOAP12SetSubCode() {
+ soap12FaultCode.setSubCode(
+ soap12Factory.createSOAPFaultSubCode(soap12FaultCode));
+ assertFalse(
+ "SOAP 1.2 Fault Code Test :- After calling setSubCode method, getSubCode method returns null",
+ soap12FaultCode.getSubCode() == null);
+ try {
+ soap12FaultCode.setSubCode(
+ soap11Factory.createSOAPFaultSubCode(soap11FaultCode));
+ fail(
+ "SOAP11FaultSubCode should not be inserted to SOAP12FaultCode");
+ } catch (SOAPProcessingException e) {
+ assertTrue(true);
+ }
+
+ try {
+ soap12FaultCode.setSubCode(
+ soap12Factory.createSOAPFaultSubCode(
+ soap12Factory.createSOAPFaultSubCode(
+ soap12FaultCode)));
+ } catch (Exception e) {
+ fail(
+ "SOAP 1.2 Fault Code Test :- When calling setSubCode method, parent of subcode element mismatch");
+ }
+ }
+
+ public void testSOAP12GetSubCode() {
+ assertTrue(
+ "SOAP 1.2 Fault Code Test :- After creating soapfaultcode, it has a subcode",
+ soap12FaultCode.getSubCode() == null);
+ soap12FaultCode.setSubCode(
+ soap12Factory.createSOAPFaultSubCode(soap12FaultCode));
+ assertFalse(
+ "SOAP 1.2 Fault Code Test :- After calling setSubCode method, getSubCode method returns null",
+ soap12FaultCode.getSubCode() == null);
+ }
+
+ //SOAP 1.1 Fault Code Test (With Parser)
+ public void testSOAP11GetValueWithParser() {
+ assertFalse(
+ "SOAP 1.1 Fault Code Test with parser : - getValue method returns null",
+ soap11FaultCodeWithParser.getValue() == null);
+ assertTrue(
+ "SOAP 1.1 Fault Code Test with parser : - Value local name mismatch",
+ soap11FaultCodeWithParser.getValue().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));
+ }
+
+ //SOAP 1.2 Fault Code Test (With Parser)
+ public void testSOAP12GetValueWithParser() {
+ assertFalse(
+ "SOAP 1.2 Fault Code Test with parser : - getValue method returns null",
+ soap12FaultCodeWithParser.getValue() == null);
+ assertTrue(
+ "SOAP 1.2 Fault Code Test with parser : - Value local name mismatch",
+ soap12FaultCodeWithParser.getValue().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));
+ }
+
+ public void testSOAP12GetSubCodeWithParser() {
+ assertFalse(
+ "SOAP 1.2 Fault Code Test with parser :- getSubCode method returns null",
+ soap12FaultCodeWithParser.getSubCode() == null);
+ assertTrue(
+ "SOAP 1.2 Fault Code Test with parser : - subcode local name mismatch",
+ soap12FaultCodeWithParser.getSubCode().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME));
+ }
+}
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultCodeTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultCodeTestCase.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultCodeTestCase.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultCodeTestCase.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap;
+
+public class SOAPFaultCodeTestCase extends SOAPFaultTestCase {
+
+ protected SOAPFaultCode soap11FaultCode;
+ protected SOAPFaultCode soap12FaultCode;
+
+ protected SOAPFaultCode soap11FaultCodeWithParser;
+ protected SOAPFaultCode soap12FaultCodeWithParser;
+
+ public SOAPFaultCodeTestCase(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ soap11FaultCode = soap11Factory.createSOAPFaultCode(soap11Fault);
+ soap12FaultCode = soap12Factory.createSOAPFaultCode(soap12Fault);
+
+ soap11FaultCodeWithParser = soap11FaultWithParser.getCode();
+ soap12FaultCodeWithParser = soap12FaultWithParser.getCode();
+ }
+
+}
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultDetailTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultDetailTest.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultDetailTest.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultDetailTest.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,223 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMNamespace;
+import org.apache.ws.commons.om.OMText;
+
+import java.util.Iterator;
+
+public class SOAPFaultDetailTest extends SOAPFaultTestCase {
+ protected SOAPFaultDetail soap11FaultDetail;
+ protected SOAPFaultDetail soap12FaultDetail;
+ protected SOAPFaultDetail soap11FaultDetailWithParser;
+ protected SOAPFaultDetail soap12FaultDetailWithParser;
+ protected OMNamespace omNamespace;
+
+ public SOAPFaultDetailTest(String testName) {
+ super(testName);
+ omNamespace =
+ omFactory.createOMNamespace("http://www.test.org", "test");
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ soap11FaultDetail = soap11Factory.createSOAPFaultDetail(soap11Fault);
+ soap12FaultDetail = soap12Factory.createSOAPFaultDetail(soap12Fault);
+ soap11FaultDetailWithParser = soap11FaultWithParser.getDetail();
+ soap12FaultDetailWithParser = soap12FaultWithParser.getDetail();
+ }
+
+ //SOAP 1.1 Fault Detail Test (Programaticaly Created)
+ public void testSOAP11AddDetailEntry() {
+ soap11FaultDetail.addDetailEntry(
+ omFactory.createOMElement("DetailEntry1", omNamespace));
+ soap11FaultDetail.addDetailEntry(
+ omFactory.createOMElement("DetailEntry2", omNamespace));
+ Iterator iterator = soap11FaultDetail.getAllDetailEntries();
+ OMElement detailEntry1 = (OMElement) iterator.next();
+ assertFalse(
+ "SOAP 1.1 Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns empty iterator",
+ detailEntry1 == null);
+ assertTrue(
+ "SOAP 1.1 Fault Detail Test : - detailEntry1 local name mismatch",
+ detailEntry1.getLocalName().equals("DetailEntry1"));
+ assertTrue(
+ "SOAP 1.1 Fault Detail Test : - detailEntry1 namespace uri mismatch",
+ detailEntry1.getNamespace().getName().equals(
+ "http://www.test.org"));
+ OMElement detailEntry2 = (OMElement) iterator.next();
+ assertFalse(
+ "SOAP 1.1 Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns an iterator with only one object",
+ detailEntry2 == null);
+ assertTrue(
+ "SOAP 1.1 Fault Detail Test : - detailEntry2 local name mismatch",
+ detailEntry2.getLocalName().equals("DetailEntry2"));
+ assertTrue(
+ "SOAP 1.1 Fault Detail Test : - detailEntry2 namespace uri mismatch",
+ detailEntry2.getNamespace().getName().equals(
+ "http://www.test.org"));
+ assertTrue(
+ "SOAP 1.1 Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns an iterator with three objects",
+ iterator.next() == null);
+ }
+
+ public void testSOAP11GetAllDetailEntries() {
+ Iterator iterator = soap11FaultDetail.getAllDetailEntries();
+ assertTrue(
+ "SOAP 1.1 Fault Detail Test : - After creating SOAP11FaultDetail element, it has DetailEntries",
+ iterator.next() == null);
+ soap11FaultDetail.addDetailEntry(
+ omFactory.createOMElement("DetailEntry", omNamespace));
+ iterator = soap11FaultDetail.getAllDetailEntries();
+ OMElement detailEntry = (OMElement) iterator.next();
+ assertFalse(
+ "SOAP 1.1 Fault Detail Test : - After calling addDetailEntry method, getAllDetailEntries method returns empty iterator",
+ detailEntry == null);
+ assertTrue(
+ "SOAP 1.1 Fault Detail Test : - detailEntry local name mismatch",
+ detailEntry.getLocalName().equals("DetailEntry"));
+ assertTrue(
+ "SOAP 1.1 Fault Detail Test : - detailEntry namespace uri mismatch",
+ detailEntry.getNamespace().getName().equals(
+ "http://www.test.org"));
+ assertTrue(
+ "SOAP 1.1 Fault Detail Test : - After calling addDetailEntry method once, getAllDetailEntries method returns an iterator with two objects",
+ iterator.next() == null);
+ }
+
+ //SOAP 1.2 Fault Detail Test (Programaticaly Created)
+ public void testSOAP12AddDetailEntry() {
+ soap12FaultDetail.addDetailEntry(
+ omFactory.createOMElement("DetailEntry1", omNamespace));
+ soap12FaultDetail.addDetailEntry(
+ omFactory.createOMElement("DetailEntry2", omNamespace));
+ Iterator iterator = soap12FaultDetail.getAllDetailEntries();
+ OMElement detailEntry1 = (OMElement) iterator.next();
+ assertFalse(
+ "SOAP 1.2 Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns empty iterator",
+ detailEntry1 == null);
+ assertTrue(
+ "SOAP 1.2 Fault Detail Test : - detailEntry1 local name mismatch",
+ detailEntry1.getLocalName().equals("DetailEntry1"));
+ assertTrue(
+ "SOAP 1.2 Fault Detail Test : - detailEntry1 namespace uri mismatch",
+ detailEntry1.getNamespace().getName().equals(
+ "http://www.test.org"));
+ OMElement detailEntry2 = (OMElement) iterator.next();
+ assertFalse(
+ "SOAP 1.2 Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns an iterator with only one object",
+ detailEntry2 == null);
+ assertTrue(
+ "SOAP 1.2 Fault Detail Test : - detailEntry2 local name mismatch",
+ detailEntry2.getLocalName().equals("DetailEntry2"));
+ assertTrue(
+ "SOAP 1.2 Fault Detail Test : - detailEntry2 namespace uri mismatch",
+ detailEntry2.getNamespace().getName().equals(
+ "http://www.test.org"));
+ assertTrue(
+ "SOAP 1.2 Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns an iterator with three objects",
+ iterator.next() == null);
+ }
+
+ public void testSOAP12GetAllDetailEntries() {
+ Iterator iterator = soap12FaultDetail.getAllDetailEntries();
+ assertTrue(
+ "SOAP 1.2 Fault Detail Test : - After creating SOAP11FaultDetail element, it has DetailEntries",
+ iterator.next() == null);
+ soap12FaultDetail.addDetailEntry(
+ omFactory.createOMElement("DetailEntry", omNamespace));
+ iterator = soap12FaultDetail.getAllDetailEntries();
+ OMElement detailEntry = (OMElement) iterator.next();
+ assertFalse(
+ "SOAP 1.2 Fault Detail Test : - After calling addDetailEntry method, getAllDetailEntries method returns empty iterator",
+ detailEntry == null);
+ assertTrue(
+ "SOAP 1.2 Fault Detail Test : - detailEntry local name mismatch",
+ detailEntry.getLocalName().equals("DetailEntry"));
+ assertTrue(
+ "SOAP 1.2 Fault Detail Test : - detailEntry namespace uri mismatch",
+ detailEntry.getNamespace().getName().equals(
+ "http://www.test.org"));
+ assertTrue(
+ "SOAP 1.2 Fault Detail Test : - After calling addDetailEntry method once, getAllDetailEntries method returns an iterator with two objects",
+ iterator.next() == null);
+ }
+
+ //SOAP 1.1 Fault Detail Test (With Parser)
+ public void testSOAP11GetAllDetailEntriesWithParser() {
+ Iterator iterator = soap11FaultDetailWithParser.getAllDetailEntries();
+ OMText textEntry = (OMText) iterator.next();
+ assertFalse(
+ "SOAP 1.1 Fault Detail Test With Parser : - getAllDetailEntries method returns empty iterator",
+ textEntry == null);
+ assertTrue(
+ "SOAP 1.1 Fault Detail Test With Parser : - text value mismatch",
+ textEntry.getText().trim().equals("Details of error"));
+ OMElement detailEntry1 = (OMElement) iterator.next();
+ assertFalse(
+ "SOAP 1.1 Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator without detail entries",
+ detailEntry1 == null);
+ assertTrue(
+ "SOAP 1.1 Fault Detail Test With Parser : - detailEntry1 localname mismatch",
+ detailEntry1.getLocalName().equals("MaxTime"));
+ iterator.next();
+ OMElement detailEntry2 = (OMElement) iterator.next();
+ assertFalse(
+ "SOAP 1.1 Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator with only one detail entries",
+ detailEntry2 == null);
+ assertTrue(
+ "SOAP 1.1 Fault Detail Test With Parser : - detailEntry2 localname mismatch",
+ detailEntry2.getLocalName().equals("AveTime"));
+ iterator.next();
+ assertTrue(
+ "SOAP 1.1 Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator with more than two detail entries",
+ iterator.next() == null);
+ }
+
+ //SOAP 1.2 Fault Detail Test (With Parser)
+ public void testSOAP12GetAllDetailEntriesWithParser() {
+ Iterator iterator = soap12FaultDetailWithParser.getAllDetailEntries();
+ OMText textEntry = (OMText) iterator.next();
+ assertFalse(
+ "SOAP 1.2 Fault Detail Test With Parser : - getAllDetailEntries method returns empty iterator",
+ textEntry == null);
+ assertTrue(
+ "SOAP 1.2 Fault Detail Test With Parser : - text value mismatch",
+ textEntry.getText().trim().equals("Details of error"));
+ OMElement detailEntry1 = (OMElement) iterator.next();
+ assertFalse(
+ "SOAP 1.2 Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator without detail entries",
+ detailEntry1 == null);
+ assertTrue(
+ "SOAP 1.2 Fault Detail Test With Parser : - detailEntry1 localname mismatch",
+ detailEntry1.getLocalName().equals("MaxTime"));
+ iterator.next();
+ OMElement detailEntry2 = (OMElement) iterator.next();
+ assertFalse(
+ "SOAP 1.2 Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator with only one detail entries",
+ detailEntry2 == null);
+ assertTrue(
+ "SOAP 1.2 Fault Detail Test With Parser : - detailEntry2 localname mismatch",
+ detailEntry2.getLocalName().equals("AveTime"));
+ iterator.next();
+ assertTrue(
+ "SOAP 1.2 Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator with more than two detail entries",
+ iterator.next() == null);
+ }
+}
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultNodeTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultNodeTest.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultNodeTest.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultNodeTest.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap;
+
+public class SOAPFaultNodeTest extends SOAPFaultTestCase {
+ protected SOAPFaultNode soap11FaultNode;
+ protected SOAPFaultNode soap12FaultNode;
+ protected SOAPFaultNode soap12FaultNodeWithParser;
+
+ public SOAPFaultNodeTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ soap11FaultNode = soap11Factory.createSOAPFaultNode(soap11Fault);
+ soap12FaultNode = soap12Factory.createSOAPFaultNode(soap12Fault);
+ soap12FaultNodeWithParser = soap12FaultWithParser.getNode();
+ }
+
+ //SOAP 1.1 Fault Node Test (Programaticaly Created)
+ public void testSOAP11SetNodeValue() {
+ soap11FaultNode.setNodeValue("This is only a test");
+ assertTrue(
+ "SOAP 1.1 Fault Node Test : - After calling setNodeValue method, getNodeValue method returns incorrect value",
+ soap11FaultNode.getNodeValue().equals("This is only a test"));
+ }
+
+ public void testSOAP11GetNodeValue() {
+ assertTrue(
+ "SOAP 1.1 Fault Node Test : - After creating SOAPFaultNode, it has a value",
+ soap11FaultNode.getNodeValue().equals(""));
+ soap11FaultNode.setNodeValue("This is only a test");
+ assertTrue(
+ "SOAP 1.1 Fault Node Test : - After calling setNodeValue method, getNodeValue method returns incorrect value",
+ soap11FaultNode.getNodeValue().equals("This is only a test"));
+ }
+
+ //SOAP 1.2 Fault Node Test (Programaticaly Created)
+ public void testSOAP12SetNodeValue() {
+ soap12FaultNode.setNodeValue("This is only a test");
+ assertTrue(
+ "SOAP 1.2 Fault Node Test : - After calling setNodeValue method, getNodeValue method returns incorrect value",
+ soap12FaultNode.getNodeValue().equals("This is only a test"));
+ }
+
+ public void testSOAP12GetNodeValue() {
+ assertTrue(
+ "SOAP 1.2 Fault Node Test : - After creating SOAPFaultNode, it has a value",
+ soap12FaultNode.getNodeValue().equals(""));
+ soap12FaultNode.setNodeValue("This is only a test");
+ assertTrue(
+ "SOAP 1.2 Fault Node Test : - After calling setNodeValue method, getNodeValue method returns incorrect value",
+ soap12FaultNode.getNodeValue().equals("This is only a test"));
+ }
+
+ //SOAP 1.2 Fault Node Test (With Parser)
+ public void testSOAP12GetNodeValueWithParser() {
+ assertTrue(
+ "SOAP 1.2 Fault Node Test With Parser : - getNodeValue method returns incorrect value",
+ soap12FaultNodeWithParser.getNodeValue().trim().equals(
+ "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"));
+ }
+}
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultReasonTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultReasonTest.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultReasonTest.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultReasonTest.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap;
+
+public class SOAPFaultReasonTest extends SOAPFaultReasonTestCase {
+
+ public SOAPFaultReasonTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ //SOAP 1.1 Fault Reason Test (Programaticaly Created)
+ public void testSOAP11SetSOAPText() {
+ soap11FaultReason.setSOAPText(
+ soap11Factory.createSOAPFaultText(soap11FaultReason));
+ assertFalse(
+ "SOAP 1.1 FaultReason Test : - After calling setSOAPText, getSOAPText returns null",
+ soap11FaultReason.getSOAPText() == null);
+ try {
+ soap11FaultReason.setSOAPText(
+ soap12Factory.createSOAPFaultText(soap12FaultReason));
+ fail("SOAP12FaultText should not be added to SOAP11FaultReason");
+
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testSOAP11GetSOAPText() {
+ assertTrue(
+ "SOAP 1.1 FaultReason Test : - After creating SOAP11FaultReason, it has a SOAPFaultText",
+ soap11FaultReason.getSOAPText() == null);
+ soap11FaultReason.setSOAPText(
+ soap11Factory.createSOAPFaultText(soap11FaultReason));
+ assertFalse(
+ "SOAP 1.1 FaultReason Test : - After calling setSOAPText, getSOAPText returns null",
+ soap11FaultReason.getSOAPText() == null);
+ }
+
+ //SOAP 1.2 Fault Reason Test (Programaticaly Created)
+ public void testSOAP12SetSOAPText() {
+ soap12FaultReason.setSOAPText(
+ soap12Factory.createSOAPFaultText(soap12FaultReason));
+ assertFalse(
+ "SOAP 1.2 FaultReason Test : - After calling setSOAPText, getSOAPText returns null",
+ soap12FaultReason.getSOAPText() == null);
+ try {
+ soap12FaultReason.setSOAPText(
+ soap11Factory.createSOAPFaultText(soap11FaultReason));
+ fail("SOAP11FaultText should not be added to SOAP12FaultReason");
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testSOAP12GetSOAPText() {
+ assertTrue(
+ "SOAP 1.2 FaultReason Test : - After creating SOAP12FaultReason, it has a SOAPFaultText",
+ soap12FaultReason.getSOAPText() == null);
+ soap12FaultReason.setSOAPText(
+ soap12Factory.createSOAPFaultText(soap12FaultReason));
+ assertFalse(
+ "SOAP 1.2 FaultReason Test : - After calling setSOAPText, getSOAPText returns null",
+ soap12FaultReason.getSOAPText() == null);
+ }
+
+ //SOAP 1.1 Fault Reason Test (With Parser)
+ public void testSOAP11GetSOAPTextWithParser() {
+ assertFalse(
+ "SOAP 1.1 FaultReason Test With Parser : - getSOAPText method returns null",
+ soap11FaultReasonWithParser.getSOAPText() == null);
+ }
+
+ //SOAP 1.2 Fault Reason Test (With Parser)
+ public void testSOAP12GetSOAPTextWithParser() {
+ assertFalse(
+ "SOAP 1.2 FaultReason Test With Parser : - getSOAPText method returns null",
+ soap12FaultReasonWithParser.getSOAPText() == null);
+ }
+}
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultReasonTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultReasonTestCase.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultReasonTestCase.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultReasonTestCase.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap;
+
+public class SOAPFaultReasonTestCase extends SOAPFaultTestCase {
+
+ protected SOAPFaultReason soap11FaultReason;
+ protected SOAPFaultReason soap12FaultReason;
+ protected SOAPFaultReason soap11FaultReasonWithParser;
+ protected SOAPFaultReason soap12FaultReasonWithParser;
+
+ public SOAPFaultReasonTestCase(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ soap11FaultReason = soap11Factory.createSOAPFaultReason(soap11Fault);
+ soap12FaultReason = soap12Factory.createSOAPFaultReason(soap12Fault);
+ soap11FaultReasonWithParser = soap11FaultWithParser.getReason();
+ soap12FaultReasonWithParser = soap12FaultWithParser.getReason();
+ }
+
+}
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultRoleTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultRoleTest.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultRoleTest.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultRoleTest.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap;
+
+public class SOAPFaultRoleTest extends SOAPFaultTestCase {
+
+ protected SOAPFaultRole soap11FaultRole;
+ protected SOAPFaultRole soap12FaultRole;
+ protected SOAPFaultRole soap11FaultRoleWithParser;
+ protected SOAPFaultRole soap12FaultRoleWithParser;
+
+ public SOAPFaultRoleTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ soap11FaultRole = soap11Factory.createSOAPFaultRole(soap11Fault);
+ soap12FaultRole = soap12Factory.createSOAPFaultRole(soap12Fault);
+ soap11FaultRoleWithParser = soap11FaultWithParser.getRole();
+ soap12FaultRoleWithParser = soap12FaultWithParser.getRole();
+ }
+
+ //SOAP 1.1 Fault Role Test (Programaticaly Created)
+ public void testSOAP11SetRoleValue() {
+ soap11FaultRole.setRoleValue("This is only a test");
+ assertTrue(
+ "SOAP 1.1 Fault Role Test : - After calling setRoleValue method, getRoleValue method returns incorrect value",
+ soap11FaultRole.getRoleValue().trim().equals("This is only a test"));
+ }
+
+ public void testSOAP11GetRoleValue() {
+ assertTrue(
+ "SOAP 1.1 Fault Role Test : - After creating SOAPFaultRole, it has a value",
+ soap11FaultRole.getRoleValue().equals(""));
+ soap11FaultRole.setRoleValue("This is only a test");
+ assertTrue(
+ "SOAP 1.1 Fault Role Test : - After calling setRoleValue method, getRoleValue method returns incorrect value",
+ soap11FaultRole.getRoleValue().trim().equals("This is only a test"));
+ }
+
+ //SOAP 1.2 Fault Role Test (Programaticaly Created)
+ public void testSOAP12SetRoleValue() {
+ soap12FaultRole.setRoleValue("This is only a test");
+ assertTrue(
+ "SOAP 1.2 Fault Role Test : - After calling setRoleValue method, getRoleValue method returns incorrect value",
+ soap12FaultRole.getRoleValue().trim().equals("This is only a test"));
+ }
+
+ public void testSOAP12GetRoleValue() {
+ assertTrue(
+ "SOAP 1.2 Fault Role Test : - After creating SOAPFaultRole, it has a value",
+ soap12FaultRole.getRoleValue().trim().equals(""));
+ soap12FaultRole.setRoleValue("This is only a test");
+ assertTrue(
+ "SOAP 1.2 Fault Role Test : - After calling setRoleValue method, getRoleValue method returns incorrect value",
+ soap12FaultRole.getRoleValue().trim().equals("This is only a test"));
+ }
+
+ //SOAP 1.1 Fault Role Test (With Parser)
+ public void testSOAP11GetRoleValueWithParser() {
+ assertTrue(
+ "SOAP 1.1 Fault Role Test With Parser : - getRoleValue method returns incorrect value",
+ soap11FaultRoleWithParser.getRoleValue().trim().equals(
+ "http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver"));
+ }
+
+ //SOAP 1.2 Fault Role Test (With Parser)
+ public void testSOAP12GetRoleValueWithParser() {
+ assertTrue(
+ "SOAP 1.2 Fault Role Test With Parser : - getRoleValue method returns incorrect value",
+ soap12FaultRoleWithParser.getRoleValue().trim().equals(
+ "ultimateReceiver"));
+ }
+}
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultSubCodeTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultSubCodeTest.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultSubCodeTest.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultSubCodeTest.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,180 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap;
+
+
+public class SOAPFaultSubCodeTest extends SOAPFaultSubCodeTestCase {
+
+ public SOAPFaultSubCodeTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ //SOAP Fault SubCode(In Fault Code) Test (Programaticaly Created)
+ public void testSetValueInFaultCode() {
+ soap12FaultSubCodeInCode.setValue(
+ soap12Factory.createSOAPFaultValue(soap12FaultSubCodeInCode));
+ assertFalse(
+ "SOAP 1.2 Subcode Test In Fault Code : - After calling setValue method, getValue method returns null",
+ soap12FaultSubCodeInCode.getValue() == null);
+ try {
+ soap12FaultSubCodeInCode.setValue(
+ soap12Factory.createSOAPFaultValue(soap12FaultCode));
+ } catch (SOAPProcessingException e) {
+ fail(
+ "SOAP 1.2 SOAPFaultSubCode Test In FaultCode : - FaultValue whose parent is FaultCode should not be set in to FaultSubCode, as a child");
+ }
+ }
+
+ public void testGetValueInFaultCode() {
+ assertTrue(
+ "After creating SOAP12FaultSubCode In Fault Code, it has a FaultValue",
+ soap12FaultSubCodeInCode.getValue() == null);
+ soap12FaultSubCodeInCode.setValue(
+ soap12Factory.createSOAPFaultValue(soap12FaultSubCodeInCode));
+ assertFalse(
+ "SOAP 1.2 SOAPFaultSubCode Test In FaultCode : - After calling setValue method, getValue method returns null",
+ soap12FaultSubCodeInCode.getValue() == null);
+ }
+
+ public void testsetSubCodeInFaultCode() {
+ soap12FaultSubCodeInCode.setSubCode(
+ soap12Factory.createSOAPFaultSubCode(soap12FaultSubCodeInCode));
+ assertFalse(
+ "SOAP 1.2 Subcode Test In Fault Code : - After calling setSubCode method, getSubCode method returns null",
+ soap12FaultSubCodeInCode.getSubCode() == null);
+ try {
+ soap12FaultSubCodeInCode.setSubCode(
+ soap12Factory.createSOAPFaultSubCode(soap12FaultCode));
+ } catch (SOAPProcessingException e) {
+ fail(
+ "SOAP 1.2 SOAPFaultSubCode Test In FaultCode : - FaultSubCode whose parent is FaultCode should not be set in to FaultSubCode, as a child");
+ }
+ }
+
+ public void testGetSubCodeInFaultCode() {
+ //soap12FaultSubCodeInCode has a SubCode because a SubCode was created in setUp method of super class
+// assertTrue("After creating SOAP12FaultSubCode In Fault Code, it has a FaultSubCode",soap12FaultSubCodeInCode.getSubCode() == null);
+ soap12FaultSubCodeInCode.setSubCode(
+ soap12Factory.createSOAPFaultSubCode(soap12FaultSubCodeInCode));
+ assertFalse(
+ "SOAP 1.2 SOAPFaultSubCode Test In FaultCode : - After calling setSubCode method, getSubCode method returns null",
+ soap12FaultSubCodeInCode.getSubCode() == null);
+ }
+
+ //SOAP Fault SubCode(In Fault SubCode) Test (Programaticaly Created)
+ public void testSetValueInFaultSubCode() {
+ soap12FaultSubCodeInSubCode.setValue(
+ soap12Factory.createSOAPFaultValue(soap12FaultSubCodeInSubCode));
+ assertFalse(
+ "SOAP 1.2 Subcode Test In Fault SubCode : - After calling setValue method, getValue method returns null",
+ soap12FaultSubCodeInSubCode.getValue() == null);
+ try {
+ soap12FaultSubCodeInSubCode.setValue(
+ soap12Factory.createSOAPFaultValue(soap12FaultCode));
+ } catch (SOAPProcessingException e) {
+ fail(
+ "SOAP 1.2 SOAPFaultSubCode Test In FaultCode : - FaultValue whose parent is FaultCode should not be set in to FaultSubCode, as a child");
+ }
+ }
+
+ public void testGetValueInFaultSubCode() {
+ assertTrue(
+ "After creating SOAP12FaultSubCode In Fault SubCode, it has a Fault Value",
+ soap12FaultSubCodeInSubCode.getValue() == null);
+ soap12FaultSubCodeInSubCode.setValue(
+ soap12Factory.createSOAPFaultValue(soap12FaultSubCodeInSubCode));
+ assertFalse(
+ "SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode : - After calling setValue method, getValue method returns null",
+ soap12FaultSubCodeInSubCode.getValue() == null);
+ }
+
+ public void testsetSubCodeInFaultSubCode() {
+ soap12FaultSubCodeInSubCode.setSubCode(
+ soap12Factory.createSOAPFaultSubCode(
+ soap12FaultSubCodeInSubCode));
+ assertFalse(
+ "SOAP 1.2 Subcode Test In Fault SubCode : - After calling setSubCode method, getSubCode method returns null",
+ soap12FaultSubCodeInSubCode.getSubCode() == null);
+ try {
+ soap12FaultSubCodeInSubCode.setSubCode(
+ soap12Factory.createSOAPFaultSubCode(soap12FaultCode));
+ } catch (SOAPProcessingException e) {
+ fail(
+ "SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode : - FaultSubCode whose parent is FaultCode should not be set in to FaultSubCode, as a child");
+ }
+ }
+
+ public void testGetSubCodeInFaultSubCode() {
+ assertTrue(
+ "After creating SOAP12FaultSubCode In Fault SubCode, it has a FaultSubCode",
+ soap12FaultSubCodeInSubCode.getSubCode() == null);
+ soap12FaultSubCodeInSubCode.setSubCode(
+ soap12Factory.createSOAPFaultSubCode(
+ soap12FaultSubCodeInSubCode));
+ assertFalse(
+ "SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode : - After calling setSubCode method, getSubCode method returns null",
+ soap12FaultSubCodeInSubCode.getSubCode() == null);
+ }
+
+ //SOAP Fault SubCode(In Fault Code) Test (With Parser)
+ public void testGetValueInFaultCodeWithParser() {
+ assertFalse(
+ "SOAP 1.2 SOAPFaultSubCode Test In FaultCode With Parser : - getValue method returns null",
+ soap12FaultSubCodeInFaultCodeWithParser.getValue() == null);
+ assertTrue(
+ "SOAP 1.2 SOAPFaultSubCode Test In FaultCode With Parser : - Value text mismatch",
+ soap12FaultSubCodeInFaultCodeWithParser.getValue().getText()
+ .equals("m:MessageTimeout In First Subcode"));
+ }
+
+ public void testGetSubCodeInFaultCodeWithParser() {
+ assertFalse(
+ "SOAP 1.2 SOAPFaultSubCode Test In FaultCode With Parser : - getSubCode method returns null",
+ soap12FaultSubCodeInFaultCodeWithParser.getSubCode() == null);
+ assertTrue(
+ "SOAP 1.2 SOAPFaultSubCode Test In FaultCode With Parser : - SubCode local name mismatch",
+ soap12FaultSubCodeInFaultCodeWithParser.getSubCode()
+ .getLocalName()
+ .equals(SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME));
+ }
+
+ //SOAP Fault SubCode(In Fault SubCode) Test (With Parser)
+ public void testGetValueInFaultSubCodeWithParser() {
+ assertFalse(
+ "SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode With Parser : - getValue method returns null",
+ soap12FaultSubCodeInSubCodeWithParser.getValue() == null);
+ assertTrue(
+ "SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode With Parser : - Value text mismatch",
+ soap12FaultSubCodeInSubCodeWithParser.getValue().getText()
+ .equals("m:MessageTimeout In Second Subcode"));
+ }
+
+ public void testGetSubCodeInFaultSubCodeWithParser() {
+ assertFalse(
+ "SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode With Parser : - getSubCode method returns null",
+ soap12FaultSubCodeInSubCodeWithParser.getSubCode() == null);
+ assertTrue(
+ "SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode With Parser : - SubCode local name mismatch",
+ soap12FaultSubCodeInSubCodeWithParser.getSubCode()
+ .getLocalName()
+ .equals(SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME));
+ }
+}
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultSubCodeTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultSubCodeTestCase.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultSubCodeTestCase.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultSubCodeTestCase.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap;
+
+public class SOAPFaultSubCodeTestCase extends SOAPFaultCodeTestCase {
+ protected SOAPFaultValue soap11FaultValue;
+ protected SOAPFaultValue soap12FaultValueInFaultCode;
+ protected SOAPFaultSubCode soap12FaultSubCodeInCode;
+
+ protected SOAPFaultValue soap12FaultValueInFaultSubCode;
+ protected SOAPFaultSubCode soap12FaultSubCodeInSubCode;
+
+ protected SOAPFaultValue soap11FaultValueWithParser;
+ protected SOAPFaultValue soap12FaultValueInFaultCodeWithParser;
+ protected SOAPFaultSubCode soap12FaultSubCodeInFaultCodeWithParser;
+
+ protected SOAPFaultValue soap12FaultValueInFaultSubCodeWithParser;
+ protected SOAPFaultSubCode soap12FaultSubCodeInSubCodeWithParser;
+
+ public SOAPFaultSubCodeTestCase(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ soap11FaultValue = soap11Factory.createSOAPFaultValue(soap11FaultCode);
+
+ soap12FaultValueInFaultCode =
+ soap12Factory.createSOAPFaultValue(soap12FaultCode);
+ soap12FaultSubCodeInCode =
+ soap12Factory.createSOAPFaultSubCode(soap12FaultCode);
+
+
+ soap12FaultSubCodeInSubCode =
+ soap12Factory.createSOAPFaultSubCode(soap12FaultSubCodeInCode);
+
+ soap11FaultValueWithParser = soap11FaultCodeWithParser.getValue();
+ soap12FaultValueInFaultCodeWithParser =
+ soap12FaultCodeWithParser.getValue();
+ soap12FaultSubCodeInFaultCodeWithParser =
+ soap12FaultCodeWithParser.getSubCode();
+
+ soap12FaultValueInFaultSubCodeWithParser =
+ soap12FaultSubCodeInFaultCodeWithParser.getValue();
+ soap12FaultSubCodeInSubCodeWithParser =
+ soap12FaultSubCodeInFaultCodeWithParser.getSubCode();
+ }
+}
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultTest.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultTest.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultTest.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,416 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMAbstractFactory;
+
+public class SOAPFaultTest extends SOAPFaultTestCase {
+
+ public SOAPFaultTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ //SOAP 1.1 Fault Test (Programaticaly created)-----------------------------------------------------------------------------------
+ public void testSOAP11SetCode() {
+ soap11Fault.setCode(soap11Factory.createSOAPFaultCode(soap11Fault));
+ assertNotNull(
+ "SOAP 1.1 Fault Test:- After calling setCode method, Fault has no code",
+ soap11Fault.getCode());
+ try {
+ soap11Fault.setCode(soap12Factory.createSOAPFaultCode(soap12Fault));
+ fail("SOAP12FaultCode should not not be set in to a SOAP11Fault");
+ } catch (Exception e) {
+ }
+ }
+
+ public void testSOAP11GetCode() {
+ assertTrue(
+ "SOAP 1.1 Fault Test:- After creating a SOAP11Fault, it has a code",
+ soap11Fault.getCode() == null);
+ soap11Fault.setCode(soap11Factory.createSOAPFaultCode(soap11Fault));
+ assertFalse(
+ "SOAP 1.1 Fault Test:- After calling setCode method, Fault has no code",
+ soap11Fault.getCode() == null);
+ }
+
+ public void testSOAP11SetReason() {
+ soap11Fault.setReason(soap11Factory.createSOAPFaultReason(soap11Fault));
+ assertFalse(
+ "SOAP 1.1 Fault Test:- After calling setReason method, Fault has no reason",
+ soap11Fault.getReason() == null);
+ try {
+ soap11Fault.setReason(
+ soap12Factory.createSOAPFaultReason(soap12Fault));
+ fail("SOAP12FaultReason should not be set in to a SOAP11Fault");
+
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testSOAP11GetReason() {
+ assertTrue(
+ "SOAP 1.1 Fault Test:- After creating a SOAP11Fault, it has a reason",
+ soap11Fault.getReason() == null);
+ soap11Fault.setReason(soap11Factory.createSOAPFaultReason(soap11Fault));
+ assertFalse(
+ "SOAP 1.1 Fault Test:- After calling setReason method, Fault has no reason",
+ soap11Fault.getReason() == null);
+ }
+
+ public void testSOAP11SetNode() {
+ soap11Fault.setNode(soap11Factory.createSOAPFaultNode(soap11Fault));
+ assertFalse(
+ "SOAP 1.1 Fault Test:- After calling setNode method, Fault has no node",
+ soap11Fault.getNode() == null);
+ try {
+ soap11Fault.setNode(soap12Factory.createSOAPFaultNode(soap12Fault));
+ fail("SOAP12FaultNode should not be set in to a SOAP11Fault");
+
+ } catch (Exception e) {
+ assertTrue(true);
+
+ }
+ }
+
+ public void testSOAP11GetNode() {
+ assertTrue(
+ "SOAP 1.1 Fault Test:- After creating a SOAP11Fault, it has a node",
+ soap11Fault.getNode() == null);
+ soap11Fault.setNode(soap11Factory.createSOAPFaultNode(soap11Fault));
+ assertFalse(
+ "SOAP 1.1 Fault Test:- After calling setNode method, Fault has no node",
+ soap11Fault.getNode() == null);
+ }
+
+ public void testSOAP11SetRole() {
+ soap11Fault.setRole(soap11Factory.createSOAPFaultRole(soap11Fault));
+ assertFalse(
+ "SOAP 1.1 Fault Test:- After calling setRole method, Fault has no role",
+ soap11Fault.getRole() == null);
+ try {
+ soap11Fault.setRole(soap12Factory.createSOAPFaultRole(soap12Fault));
+ fail("SOAP12FaultRole should not be set in to a SOAP11Fault");
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testSOAP11GetRole() {
+ assertTrue(
+ "SOAP 1.1 Fault Test:- After creating a SOAP11Fault, it has a role",
+ soap11Fault.getRole() == null);
+ soap11Fault.setRole(soap11Factory.createSOAPFaultRole(soap11Fault));
+ assertFalse(
+ "SOAP 1.1 Fault Test:- After calling setRole method, Fault has no role",
+ soap11Fault.getRole() == null);
+ }
+
+ public void testSOAP11SetDetail() {
+ soap11Fault.setDetail(soap11Factory.createSOAPFaultDetail(soap11Fault));
+ assertFalse(
+ "SOAP 1.1 Fault Test:- After calling setDetail method, Fault has no detail",
+ soap11Fault.getDetail() == null);
+ try {
+ soap11Fault.setDetail(
+ soap12Factory.createSOAPFaultDetail(soap12Fault));
+ fail("SOAP12FaultDetail should not be set in to a SOAP11Fault");
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testSOAP11GetDetail() {
+ assertTrue(
+ "SOAP 1.1 Fault Test:- After creating a SOAP11Fault, it has a detail",
+ soap11Fault.getDetail() == null);
+ soap11Fault.setDetail(soap11Factory.createSOAPFaultDetail(soap11Fault));
+ assertFalse(
+ "SOAP 1.1 Fault Test:- After calling setDetail method, Fault has no detail",
+ soap11Fault.getDetail() == null);
+ }
+
+ //SOAP 1.2 Fault Test ((Programaticaly created)--------------------------------------------------------------------------------
+ public void testSOAP12SetCode() {
+ soap12Fault.setCode(soap12Factory.createSOAPFaultCode(soap12Fault));
+ assertFalse(
+ "SOAP 1.2 Fault Test:- After calling setCode method, Fault has no code",
+ soap12Fault.getCode() == null);
+ assertTrue("SOAP 1.2 Fault Test:- Code local name mismatch",
+ soap12Fault.getCode().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME));
+ try {
+ soap12Fault.setCode(soap11Factory.createSOAPFaultCode(soap11Fault));
+ fail("SOAP11FaultCode should not be set in to a SOAP12Fault");
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testSOAP12GetCode() {
+ assertTrue(
+ "SOAP 1.2 Fault Test:- After creating a SOAP12Fault, it has a code",
+ soap12Fault.getCode() == null);
+ soap12Fault.setCode(soap12Factory.createSOAPFaultCode(soap12Fault));
+ assertFalse(
+ "SOAP 1.2 Fault Test:- After calling setCode method, Fault has no code",
+ soap12Fault.getCode() == null);
+ assertTrue("SOAP 1.2 Fault Test:- Fault code local name mismatch",
+ soap12Fault.getCode().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME));
+ }
+
+ public void testSOAP12SetReason() {
+ soap12Fault.setReason(soap12Factory.createSOAPFaultReason(soap12Fault));
+ assertFalse(
+ "SOAP 1.2 Fault Test:- After calling setReason method, Fault has no reason",
+ soap12Fault.getReason() == null);
+ assertTrue("SOAP 1.2 Fault Test:- Fault reason local name mismatch",
+ soap12Fault.getReason().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME));
+ try {
+ soap12Fault.setReason(
+ soap11Factory.createSOAPFaultReason(soap11Fault));
+ fail("SOAP11FaultReason should not be set in to a SOAP12Fault");
+
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testSOAP12GetReason() {
+ assertTrue(
+ "SOAP 1.2 Fault Test:- After creating a SOAP12Fault, it has a reason",
+ soap12Fault.getReason() == null);
+ soap12Fault.setReason(soap12Factory.createSOAPFaultReason(soap12Fault));
+ assertFalse(
+ "SOAP 1.2 Fault Test:- After calling setReason method, Fault has no reason",
+ soap12Fault.getReason() == null);
+ assertTrue("SOAP 1.2 Fault Test:- Fault reason local name mismatch",
+ soap12Fault.getReason().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME));
+ }
+
+ public void testSOAP12SetNode() {
+ soap12Fault.setNode(soap12Factory.createSOAPFaultNode(soap12Fault));
+ assertFalse(
+ "SOAP 1.2 Fault Test:- After calling setNode method, Fault has no node",
+ soap12Fault.getNode() == null);
+ assertTrue("SOAP 1.2 Fault Test:- Fault node local name mismatch",
+ soap12Fault.getNode().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME));
+ try {
+ soap12Fault.setNode(soap11Factory.createSOAPFaultNode(soap11Fault));
+ fail("SOAP11FaultNode should nott be set in to a SOAP12Fault");
+
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testSOAP12GetNode() {
+ assertTrue(
+ "SOAP 1.2 Fault Test:- After creating a SOAP12Fault, it has a node",
+ soap12Fault.getNode() == null);
+ soap12Fault.setNode(soap12Factory.createSOAPFaultNode(soap12Fault));
+ assertFalse(
+ "SOAP 1.2 Fault Test:- After calling setNode method, Fault has no node",
+ soap12Fault.getNode() == null);
+ assertTrue("SOAP 1.2 Fault Test:- Fault node local name mismatch",
+ soap12Fault.getNode().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME));
+ }
+
+ public void testSOAP12SetRole() {
+ soap12Fault.setRole(soap12Factory.createSOAPFaultRole(soap12Fault));
+ assertFalse(
+ "SOAP 1.2 :- After calling setRole method, Fault has no role",
+ soap12Fault.getRole() == null);
+ assertTrue("SOAP 1.2 Fault Test:- Fault role local name mismatch",
+ soap12Fault.getRole().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME));
+ try {
+ soap12Fault.setRole(soap11Factory.createSOAPFaultRole(soap11Fault));
+ fail("SOAP11FaultRole should not be set in to a SOAP12Fault");
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testSOAP12GetRole() {
+ assertTrue(
+ "SOAP 1.2 Fault Test:- After creating a SOAP11Fault, it has a role",
+ soap12Fault.getRole() == null);
+ soap12Fault.setRole(soap12Factory.createSOAPFaultRole(soap12Fault));
+ assertFalse(
+ "SOAP 1.2 Fault Test:- After calling setRole method, Fault has no role",
+ soap12Fault.getRole() == null);
+ assertTrue("SOAP 1.2 Fault Test:- Fault role local name mismatch",
+ soap12Fault.getRole().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME));
+ }
+
+ public void testSOAP12SetDetail() {
+ soap12Fault.setDetail(soap12Factory.createSOAPFaultDetail(soap12Fault));
+ assertFalse(
+ "SOAP 1.2 Fault Test:- After calling setDetaile method, Fault has no detail",
+ soap12Fault.getDetail() == null);
+ assertTrue("SOAP 1.2 Fault Test:- Fault detail local name mismatch",
+ soap12Fault.getDetail().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));
+ try {
+ soap12Fault.setDetail(
+ soap11Factory.createSOAPFaultDetail(soap11Fault));
+ fail("SOAP11FaultDetail should not be set in to a SOAP12Fault");
+
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testSOAP12GetDetail() {
+ assertTrue(
+ "SOAP 1.2 Fault Test:- After creating a SOAP12Fault, it has a detail",
+ soap12Fault.getDetail() == null);
+ soap12Fault.setDetail(soap12Factory.createSOAPFaultDetail(soap12Fault));
+ assertFalse(
+ "SOAP 1.2 Fault Test:- After calling setDetail method, Fault has no detail",
+ soap12Fault.getDetail() == null);
+ assertTrue("SOAP 1.2 Fault Test:- Fault detail local name mismatch",
+ soap12Fault.getDetail().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));
+ }
+
+ //SOAP 1.1 Fault Test (With parser)
+ public void testSOAP11GetCodeWithParser() {
+ assertFalse(
+ "SOAP 1.1 Fault Test with parser: - getCode method returns null",
+ soap11FaultWithParser.getCode() == null);
+ }
+
+ public void testSOAP11GetRoleWithParser() {
+ assertFalse(
+ "SOAP 1.1 Fault Test with parser: - getRole method returns null",
+ soap11FaultWithParser.getRole() == null);
+ }
+
+ public void testSOAP11GetDetailWithParser() {
+ assertFalse(
+ "SOAP 1.1 Fault Test with parser: - getDetail method returns null",
+ soap11FaultWithParser.getDetail() == null);
+ }
+
+ //SOAP 1.2 Fault Test (With parser)
+ public void testSOAP12GetCodeWithParser() {
+ assertFalse(
+ "SOAP 1.2 Fault Test with parser: - getCode method returns null",
+ soap12FaultWithParser.getCode() == null);
+ assertTrue(
+ "SOAP 1.2 Fault Test with parser: - Fault code local name mismatch",
+ soap12FaultWithParser.getCode().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME));
+ }
+
+ public void testSOAP12GetReasonWithParser() {
+ assertFalse(
+ "SOAP 1.2 Fault Test with parser: - getReason method returns null",
+ soap12FaultWithParser.getReason() == null);
+ assertTrue(
+ "SOAP 1.2 Fault Test with parser: - Fault reason local name mismatch",
+ soap12FaultWithParser.getReason().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME));
+ }
+
+ public void testSOAP12GetNodeWithParser() {
+ assertFalse(
+ "SOAP 1.2 Fault Test with parser: - getNode method returns null",
+ soap12FaultWithParser.getNode() == null);
+ assertTrue(
+ "SOAP 1.2 Fault Test with parser: - Fault node local name mismatch",
+ soap12FaultWithParser.getNode().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME));
+ }
+
+ public void testSOAP12GetRoleWithParser() {
+ assertFalse(
+ "SOAP 1.2 Fault Test with parser: - getRole method returns null",
+ soap12FaultWithParser.getRole() == null);
+ assertTrue(
+ "SOAP 1.2 Fault Test with parser: - Fault role local name mismatch",
+ soap12FaultWithParser.getRole().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME));
+ }
+
+ public void testSOAP12GetDetailWithParser() {
+ assertFalse(
+ "SOAP 1.2 Fault Test with parser: - getDetail method returns null",
+ soap12FaultWithParser.getDetail() == null);
+ assertTrue(
+ "SOAP 1.2 Fault Test with parser: - Fault detail local name mismatch",
+ soap12FaultWithParser.getDetail().getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));
+ }
+
+ public void testMoreChildrenAddition() {
+ try {
+ SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();
+ SOAPEnvelope envelope = soapFactory.getDefaultFaultEnvelope();
+
+ assertNotNull("Default FaultEnvelope must have a SOAPFault in it",
+ envelope.getBody().getFault());
+ assertNotNull(
+ "Default FaultEnvelope must have a SOAPFaultCode in it",
+ envelope.getBody().getFault().getCode());
+ assertNotNull(
+ "Default FaultEnvelope must have a SOAPFaultCodeValue in it",
+ envelope.getBody().getFault().getCode().getValue());
+ assertNotNull(
+ "Default FaultEnvelope must have a SOAPFaultReason in it",
+ envelope.getBody().getFault().getReason());
+ assertNotNull(
+ "Default FaultEnvelope must have a SOAPFaultText in it",
+ envelope.getBody().getFault().getReason().getSOAPText());
+
+ SOAPEnvelope soapEnvelope = soapFactory.getDefaultFaultEnvelope();
+ String errorCodeString = "Some Error occurred !!";
+ soapEnvelope.getBody().getFault().getCode().getValue().setText(
+ errorCodeString);
+
+ SOAPFaultCode code = soapEnvelope.getBody().getFault().getCode();
+ envelope.getBody().getFault().setCode(code);
+
+ assertTrue("Parent Value of Code has not been set to new fault",
+ code.getParent() == envelope.getBody().getFault());
+ assertTrue("Parent Value of Code is still pointing to old fault",
+ code.getParent() != soapEnvelope.getBody().getFault());
+ assertNull("Old fault must not have a fault code",
+ soapEnvelope.getBody().getFault().getCode());
+ assertEquals("The SOAP Code value must be " + errorCodeString,
+ errorCodeString,
+ envelope.getBody().getFault().getCode().getValue().getText());
+
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+
+
+ }
+}
\ No newline at end of file
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultTestCase.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultTestCase.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultTestCase.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMAbstractFactory;
+
+public class SOAPFaultTestCase extends SOAPBodyTestCase {
+ protected SOAPFault soap11Fault;
+ protected SOAPFault soap12Fault;
+ protected SOAPFault soap11FaultWithParser;
+ protected SOAPFault soap12FaultWithParser;
+
+ public SOAPFaultTestCase(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ soap11Fault =
+ OMAbstractFactory.getSOAP11Factory().createSOAPFault(
+ soap11Body);
+ soap12Fault =
+ OMAbstractFactory.getSOAP12Factory().createSOAPFault(
+ soap12Body);
+ soap11FaultWithParser = soap11BodyWithParser.getFault();
+ soap12FaultWithParser = soap12BodyWithParser.getFault();
+ }
+}
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultTextTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultTextTest.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultTextTest.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultTextTest.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap;
+
+import org.apache.ws.commons.om.OMAttribute;
+
+public class SOAPFaultTextTest extends SOAPFaultReasonTestCase {
+ protected SOAPFaultText soap11FaultText;
+ protected SOAPFaultText soap12FaultText;
+ protected SOAPFaultText soap11FaultTextWithParser;
+ protected SOAPFaultText soap12FaultTextWithParser;
+
+ public SOAPFaultTextTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ soap11FaultText = soap11Factory.createSOAPFaultText(soap11FaultReason);
+ soap12FaultText = soap12Factory.createSOAPFaultText(soap12FaultReason);
+ soap11FaultTextWithParser = soap11FaultReasonWithParser.getSOAPText();
+ soap12FaultTextWithParser = soap12FaultReasonWithParser.getSOAPText();
+ }
+
+ //SOAP 1.1 Fault Text Test (Programaticaly Created)
+ public void testSOAP11SetLang() {
+ soap11FaultText.setLang("en");
+ assertTrue(
+ "SOAP 1.1 Fault Text Test : - After calling setLang method, Lang attribute value mismatch",
+ soap11FaultText.getLang().equals("en"));
+ OMAttribute langAttribute = (OMAttribute) soap11FaultText.getAllAttributes()
+ .next();
+ assertTrue(
+ "SOAP 1.1 Fault Text Test : - After calling setLang method, Lang attribute local name mismaatch",
+ langAttribute.getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME));
+ assertTrue(
+ "SOAP 1.1 Fault Text Test : - After calling setLang method, Lang attribute namespace prefix mismatch",
+ langAttribute.getNamespace().getPrefix().equals(
+ SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX));
+ assertTrue(
+ "SOAP 1.1 Fault Text Test : - After calling setLang method, Lang attribute namespace uri mismatch",
+ langAttribute.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI));
+ }
+
+ public void testSOAP11GetLang() {
+
+
+ assertNull(
+ "SOAP 1.1 Fault Text Test : - After creating SOAPFaultText, it has a Lnag attribute",
+ soap11FaultText.getLang());
+
+ soap11FaultText.setLang("en");
+ assertTrue(
+ "SOAP 1.1 Fault Text Test : - After calling setLang method, Lang attribute value mismatch",
+ soap11FaultText.getLang().equals("en"));
+ }
+
+ public void testSOAP11SetText() {
+ soap11FaultText.setText("This is only a test");
+ assertTrue(
+ "SOAP 1.1 Fault Text Test : - After calling setText method, getText method return incorrect string",
+ soap11FaultText.getText().equals("This is only a test"));
+ }
+
+ public void testSOAP11GetText() {
+ assertTrue(
+ "SOAP 1.1 Fault Text Test : - After creating SOAPFaultText, it has a text",
+ soap11FaultText.getText().equals(""));
+ soap11FaultText.setText("This is only a test");
+ assertTrue(
+ "SOAP 1.1 Fault Text Test : - After calling setText method, getText method return incorrect string",
+ soap11FaultText.getText().equals("This is only a test"));
+ }
+
+ //SOAP 1.2 Fault Text Test (Programaticaly Created)
+ public void testSOAP12SetLang() {
+ soap12FaultText.setLang("en");
+ assertTrue(
+ "SOAP 1.2 Fault Text Test : - After calling setLang method, Lang attribute value mismatch",
+ soap12FaultText.getLang().equals("en"));
+ OMAttribute langAttribute = (OMAttribute) soap12FaultText.getAllAttributes()
+ .next();
+ assertTrue(
+ "SOAP 1.2 Fault Text Test : - After calling setLang method, Lang attribute local name mismaatch",
+ langAttribute.getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME));
+ assertTrue(
+ "SOAP 1.2 Fault Text Test : - After calling setLang method, Lang attribute namespace prefix mismatch",
+ langAttribute.getNamespace().getPrefix().equals(
+ SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX));
+ assertTrue(
+ "SOAP 1.2 Fault Text Test : - After calling setLang method, Lang attribute namespace uri mismatch",
+ langAttribute.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI));
+ }
+
+ public void testSOAP12GetLang() {
+
+ assertNull(
+ "SOAP 1.2 Fault Text Test : - After creating SOAPFaultText, it has a Lnag attribute",
+ soap12FaultText.getLang());
+
+ soap12FaultText.setLang("en");
+ assertTrue(
+ "SOAP 1.2 Fault Text Test : - After calling setLang method, Lang attribute value mismatch",
+ soap12FaultText.getLang().equals("en"));
+ }
+
+ public void testSOAP12SetText() {
+ soap12FaultText.setText("This is only a test");
+ assertTrue(
+ "SOAP 1.2 Fault Text Test : - After calling setText method, getText method return incorrect string",
+ soap12FaultText.getText().equals("This is only a test"));
+ }
+
+ public void testSOAP12GetText() {
+ assertTrue(
+ "SOAP 1.2 Fault Text Test : - After creating SOAPFaultText, it has a text",
+ soap12FaultText.getText().equals(""));
+ soap12FaultText.setText("This is only a test");
+ assertTrue(
+ "SOAP 1.2 Fault Text Test : - After calling setText method, getText method return incorrect string",
+ soap12FaultText.getText().equals("This is only a test"));
+ }
+
+ //SOAP 1.1 Fault Text Test (With Parser)
+ public void testSOAP11GetTextWithParser() {
+ assertTrue(
+ "SOAP 1.1 Fault Text Test With Parser : - getText method returns incorrect string",
+ soap11FaultTextWithParser.getText().trim().equals("Sender Timeout"));
+ }
+
+ //SOAP 1.2 Fault Text Test (With Parser)
+ public void testSOAP12GetLangWithParser() {
+ assertTrue(
+ "SOAP 1.2 Fault Text Test With Parser : - getLang method returns incorrect string",
+ soap12FaultTextWithParser.getLang().equals("en"));
+ OMAttribute langAttribute = (OMAttribute) soap12FaultTextWithParser.getAllAttributes()
+ .next();
+ assertTrue(
+ "SOAP 1.2 Fault Text Test With Parser : - Lang attribute local name mismaatch",
+ langAttribute.getLocalName().equals(
+ SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME));
+ assertTrue(
+ "SOAP 1.2 Fault Text Test With Parser : - Lang attribute namespace prefix mismatch",
+ langAttribute.getNamespace().getPrefix().equals(
+ SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX));
+ assertTrue(
+ "SOAP 1.2 Fault Text Test With Parser : - Lang attribute namespace uri mismatch",
+ langAttribute.getNamespace().getName().equals(
+ SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI));
+ }
+
+ public void testSOAP12GetTextWithParser() {
+
+ assertTrue(
+ "SOAP 1.2 Fault Text Test With Parser : - getText method returns incorrect string",
+ soap12FaultTextWithParser.getText().equals("Sender Timeout"));
+
+ }
+}
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultValueTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultValueTest.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultValueTest.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/soap/SOAPFaultValueTest.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap;
+
+public class SOAPFaultValueTest extends SOAPFaultSubCodeTestCase {
+
+ public SOAPFaultValueTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ soap12FaultValueInFaultSubCode =
+ soap12Factory.createSOAPFaultValue(soap12FaultSubCodeInCode);
+ }
+
+ //SOAP 1.1 Fault Value Test (Programaticaly Created)
+ public void testSOAP11setText() {
+ soap11FaultValue.setText("This is only Test");
+ assertTrue("SOAP 1.1 Fault Value Test : - value text mismatch",
+ soap11FaultValue.getText().equals("This is only Test"));
+ }
+
+ public void testSOAP11GetText() {
+ assertTrue(
+ "SOAP 1.1 Fault Value Test : - After creating Fault Value, it has a text",
+ soap11FaultValue.getText().equals(""));
+ soap11FaultValue.setText("This is only Test");
+ assertFalse(
+ "SOAP 1.1 Fault Value Test : - After calling setText method, getText method returns null",
+ soap11FaultValue.getText().equals(""));
+ assertTrue("SOAP 1.1 Fault Value Test : - value text mismatch",
+ soap11FaultValue.getText().equals("This is only Test"));
+ }
+
+ //SOAP 1.2 Fault Value(In Fault Code) Test (Programaticaly Created)
+ public void testSOAP12setTextInFaultCode() {
+ soap12FaultValueInFaultCode.setText("This is only Test");
+ assertTrue(
+ "SOAP 1.2 Fault Value Test in Fault Code : - value text mismatch",
+ soap12FaultValueInFaultCode.getText().equals(
+ "This is only Test"));
+ }
+
+ public void testSOAP12GetTextInFaultCode() {
+ assertTrue(
+ "SOAP 1.2 Fault Value Test in Fault Code : - After creating Fault Value, it has a text",
+ soap12FaultValueInFaultCode.getText().equals(""));
+ soap12FaultValueInFaultCode.setText("This is only Test");
+ assertFalse(
+ "SOAP 1.2 Fault Value Test in Fault Code : - After calling setText method, getText method returns null",
+ soap12FaultValueInFaultCode.getText().equals(""));
+ assertTrue(
+ "SOAP 1.2 Fault Value Test in Fault Code : - value text mismatch",
+ soap12FaultValueInFaultCode.getText().equals(
+ "This is only Test"));
+ }
+
+ //SOAP 1.2 Fault Value(In Fault SubCode) Test (Programaticaly Created)
+ public void testSOAP12setTextInFaultSubCode() {
+ soap12FaultValueInFaultSubCode.setText("This is only Test");
+ assertTrue(
+ "SOAP 1.2 Fault Value Test in Fault SubCode : - value text mismatch",
+ soap12FaultValueInFaultSubCode.getText().equals(
+ "This is only Test"));
+ }
+
+ public void testSOAP12GetTextInFaultSubCode() {
+ assertTrue(
+ "SOAP 1.2 Fault Value Test in Fault SubCode : - After creating Fault Value, it has a text",
+ soap12FaultValueInFaultSubCode.getText().equals(""));
+ soap12FaultValueInFaultSubCode.setText("This is only Test");
+ assertFalse(
+ "SOAP 1.2 Fault Value Test in Fault SubCode : - After calling setText method, getText method returns null",
+ soap12FaultValueInFaultSubCode.getText().equals(""));
+ assertTrue(
+ "SOAP 1.2 Fault Value Test in Fault SubCode : - value text mismatch",
+ soap12FaultValueInFaultSubCode.getText().equals(
+ "This is only Test"));
+ }
+
+ //SOAP 1.1 Fault Value Test (With Parser)
+ public void testSOAP11GetTextWithParser() {
+ assertTrue(
+ "SOAP 1.1 Fault Value Test with parser : - value text mismatch",
+ soap11FaultValueWithParser.getText().trim().equals("env:Sender"));
+ }
+
+ //SOAP 1.2 Fault Value(In Fault Code) Test (With Parser)
+ public void testSOAP12setTextWithParserInFaultCode() {
+ assertTrue(
+ "SOAP 1.2 Fault Value Test with parser in Fault Code : - value text mismatch",
+ soap12FaultValueInFaultCodeWithParser.getText().equals(
+ "env:Sender"));
+ }
+
+ //SOAP 1.2 Fault Value(In Fault SubCode) Test (With Parser)
+ public void testSOAP12setTextWithParserInFaultSubCode() {
+ assertTrue(
+ "SOAP 1.2 Fault Value Test with parser in Fault SubCode : - value text mismatch",
+ soap12FaultValueInFaultSubCodeWithParser.getText().equals(
+ "m:MessageTimeout In First Subcode"));
+ }
+}