KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > soap > SOAPFaultSubCodeTest


1 /*
2  * Copyright 2004,2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.axis2.soap;
18
19 import org.apache.axis2.soap.impl.llom.SOAPProcessingException;
20 import org.apache.axis2.soap.impl.llom.soap12.SOAP12Constants;
21
22 public class SOAPFaultSubCodeTest extends SOAPFaultSubCodeTestCase {
23
24     public SOAPFaultSubCodeTest(String JavaDoc testName) {
25         super(testName);
26     }
27
28     protected void setUp() throws Exception JavaDoc {
29         super.setUp();
30     }
31
32     //SOAP Fault SubCode(In Fault Code) Test (Programaticaly Created)
33
public void testSetValueInFaultCode() {
34         soap12FaultSubCodeInCode.setValue(soap12Factory.createSOAPFaultValue(soap12FaultSubCodeInCode));
35         assertFalse("SOAP 1.2 Subcode Test In Fault Code : - After calling setValue method, getValue method returns null", soap12FaultSubCodeInCode.getValue() == null);
36         try {
37             soap12FaultSubCodeInCode.setValue(soap12Factory.createSOAPFaultValue(soap12FaultCode));
38         } catch (SOAPProcessingException e) {
39             fail("SOAP 1.2 SOAPFaultSubCode Test In FaultCode : - FaultValue whose parent is FaultCode should not be set in to FaultSubCode, as a child");
40         }
41     }
42
43     public void testGetValueInFaultCode() {
44         assertTrue("After creating SOAP12FaultSubCode In Fault Code, it has a FaultValue", soap12FaultSubCodeInCode.getValue() == null);
45         soap12FaultSubCodeInCode.setValue(soap12Factory.createSOAPFaultValue(soap12FaultSubCodeInCode));
46         assertFalse("SOAP 1.2 SOAPFaultSubCode Test In FaultCode : - After calling setValue method, getValue method returns null", soap12FaultSubCodeInCode.getValue() == null);
47     }
48
49     public void testsetSubCodeInFaultCode() {
50         soap12FaultSubCodeInCode.setSubCode(soap12Factory.createSOAPFaultSubCode(soap12FaultSubCodeInCode));
51         assertFalse("SOAP 1.2 Subcode Test In Fault Code : - After calling setSubCode method, getSubCode method returns null", soap12FaultSubCodeInCode.getSubCode() == null);
52         try {
53             soap12FaultSubCodeInCode.setSubCode(soap12Factory.createSOAPFaultSubCode(soap12FaultCode));
54         } catch (SOAPProcessingException e) {
55             fail("SOAP 1.2 SOAPFaultSubCode Test In FaultCode : - FaultSubCode whose parent is FaultCode should not be set in to FaultSubCode, as a child");
56         }
57     }
58
59     public void testGetSubCodeInFaultCode() {
60         //soap12FaultSubCodeInCode has a SubCode because a SubCode was created in setUp method of super class
61
// assertTrue("After creating SOAP12FaultSubCode In Fault Code, it has a FaultSubCode",soap12FaultSubCodeInCode.getSubCode() == null);
62
soap12FaultSubCodeInCode.setSubCode(soap12Factory.createSOAPFaultSubCode(soap12FaultSubCodeInCode));
63         assertFalse("SOAP 1.2 SOAPFaultSubCode Test In FaultCode : - After calling setSubCode method, getSubCode method returns null", soap12FaultSubCodeInCode.getSubCode() == null);
64     }
65
66     //SOAP Fault SubCode(In Fault SubCode) Test (Programaticaly Created)
67
public void testSetValueInFaultSubCode() {
68         soap12FaultSubCodeInSubCode.setValue(soap12Factory.createSOAPFaultValue(soap12FaultSubCodeInSubCode));
69         assertFalse("SOAP 1.2 Subcode Test In Fault SubCode : - After calling setValue method, getValue method returns null", soap12FaultSubCodeInSubCode.getValue() == null);
70         try {
71             soap12FaultSubCodeInSubCode.setValue(soap12Factory.createSOAPFaultValue(soap12FaultCode));
72         } catch (SOAPProcessingException e) {
73             fail("SOAP 1.2 SOAPFaultSubCode Test In FaultCode : - FaultValue whose parent is FaultCode should not be set in to FaultSubCode, as a child");
74         }
75     }
76
77     public void testGetValueInFaultSubCode() {
78         assertTrue("After creating SOAP12FaultSubCode In Fault SubCode, it has a Fault Value", soap12FaultSubCodeInSubCode.getValue() == null);
79         soap12FaultSubCodeInSubCode.setValue(soap12Factory.createSOAPFaultValue(soap12FaultSubCodeInSubCode));
80         assertFalse("SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode : - After calling setValue method, getValue method returns null", soap12FaultSubCodeInSubCode.getValue() == null);
81     }
82
83     public void testsetSubCodeInFaultSubCode() {
84         soap12FaultSubCodeInSubCode.setSubCode(soap12Factory.createSOAPFaultSubCode(soap12FaultSubCodeInSubCode));
85         assertFalse("SOAP 1.2 Subcode Test In Fault SubCode : - After calling setSubCode method, getSubCode method returns null", soap12FaultSubCodeInSubCode.getSubCode() == null);
86         try {
87             soap12FaultSubCodeInSubCode.setSubCode(soap12Factory.createSOAPFaultSubCode(soap12FaultCode));
88         } catch (SOAPProcessingException e) {
89             fail("SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode : - FaultSubCode whose parent is FaultCode should not be set in to FaultSubCode, as a child");
90         }
91     }
92
93     public void testGetSubCodeInFaultSubCode() {
94         assertTrue("After creating SOAP12FaultSubCode In Fault SubCode, it has a FaultSubCode", soap12FaultSubCodeInSubCode.getSubCode() == null);
95         soap12FaultSubCodeInSubCode.setSubCode(soap12Factory.createSOAPFaultSubCode(soap12FaultSubCodeInSubCode));
96         assertFalse("SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode : - After calling setSubCode method, getSubCode method returns null", soap12FaultSubCodeInSubCode.getSubCode() == null);
97     }
98
99     //SOAP Fault SubCode(In Fault Code) Test (With Parser)
100
public void testGetValueInFaultCodeWithParser() {
101         assertFalse("SOAP 1.2 SOAPFaultSubCode Test In FaultCode With Parser : - getValue method returns null", soap12FaultSubCodeInFaultCodeWithParser.getValue() == null);
102         assertTrue("SOAP 1.2 SOAPFaultSubCode Test In FaultCode With Parser : - Value text mismatch", soap12FaultSubCodeInFaultCodeWithParser.getValue().getText().equals("m:MessageTimeout In First SubCode"));
103     }
104
105     public void testGetSubCodeInFaultCodeWithParser() {
106         assertFalse("SOAP 1.2 SOAPFaultSubCode Test In FaultCode With Parser : - getSubCode method returns null", soap12FaultSubCodeInFaultCodeWithParser.getSubCode() == null);
107         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));
108     }
109
110     //SOAP Fault SubCode(In Fault SubCode) Test (With Parser)
111
public void testGetValueInFaultSubCodeWithParser() {
112         assertFalse("SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode With Parser : - getValue method returns null", soap12FaultSubCodeInSubCodeWithParser.getValue() == null);
113         assertTrue("SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode With Parser : - Value text mismatch", soap12FaultSubCodeInSubCodeWithParser.getValue().getText().equals("m:MessageTimeout In Second SubCode"));
114     }
115
116     public void testGetSubCodeInFaultSubCodeWithParser() {
117         assertFalse("SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode With Parser : - getSubCode method returns null", soap12FaultSubCodeInSubCodeWithParser.getSubCode() == null);
118         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));
119     }
120 }
121
Popular Tags