1   /*** 
2    * 
3    * Copyright 2004 Protique Ltd
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License"); 
6    * you may not use this file except in compliance with the License. 
7    * You may obtain a copy of the License at 
8    * 
9    * http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, 
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
14   * See the License for the specific language governing permissions and 
15   * limitations under the License. 
16   * 
17   **/
18  package org.codehaus.activesoap.soap;
19  
20  import org.codehaus.activesoap.TestSupport;
21  
22  /***
23   * A test suite using the
24   * <a href="http://w3.org/TR/2003/REC-soap12-testcollection-20030624/">SOAP 1.2 conformance tests</a>
25   *
26   * @version $Revision: 1.11 $
27   */
28  public class Soap12ConformanceTest extends TestSupport {
29  
30      /***
31       * Should we test the SOAP encoding rules?
32       */
33      // TODO
34      protected boolean testSoapEncoding = false;
35  
36      // TODO allow header output to be flushed on faults
37      private boolean testFlushHeadersOnFault = false;
38  
39      // TODO handle DocTypes in XML gracefully
40      private boolean testDocTypeXml = false;
41  
42      // TODO handle test case when StAX can parse the test cases with standalone=true in pragma
43      private boolean staxRIBugFixed = false;
44  
45      // TODO test RPC handling
46      private boolean testRPC = false;
47  
48      public void testT1() throws Exception {
49          assertResponse("T1_fromA.xml", "T1_fromC.xml");
50      }
51  
52      public void testT2() throws Exception {
53          assertResponse("T2_fromA.xml", "T2_fromC.xml");
54      }
55  
56      public void testT3() throws Exception {
57          assertResponse("T3_fromA.xml", "T3_fromC.xml");
58      }
59  
60      public void testT4() throws Exception {
61          assertResponse("T4_fromA.xml", "T4_fromC.xml");
62      }
63  
64      public void testT5() throws Exception {
65          assertResponse("T5_fromA.xml", "T5_fromC.xml");
66      }
67  
68      public void testT6() throws Exception {
69          assertResponse("T6_fromA.xml", "T6_fromB.xml", "T6_fromC.xml");
70      }
71  
72      public void testT7() throws Exception {
73          assertResponse("T7_fromA.xml", "T7_fromB.xml", "T7_fromC.xml");
74      }
75  
76      public void testT8() throws Exception {
77          assertResponse("T8_fromA.xml", "T8_fromB.xml", "T8_fromC.xml");
78      }
79  
80      public void testT9() throws Exception {
81          assertResponse("T9_fromA.xml", "T9_fromB.xml", "T9_fromC.xml");
82      }
83  
84      public void testT10() throws Exception {
85          assertResponse("T10_fromA.xml", "T10_fromC.xml");
86      }
87  
88      public void testT11() throws Exception {
89          assertResponse("T11_fromA.xml", "T11_fromC.xml");
90      }
91  
92      public void testT12() throws Exception {
93          assertResponse("T12_fromA.xml", "T12_fromC.xml");
94      }
95  
96      public void testT13() throws Exception {
97          assertResponse("T13_fromA.xml", "T13_fromC.xml");
98      }
99  
100     public void testT14() throws Exception {
101         assertResponse("T14_fromA.xml", "T14_fromC.xml");
102     }
103 
104     // TODO
105     // I assume a mistake in the test spec - this test
106     //  should go through the intermediary, so have introduced
107     // the fromB message
108     public void TODO_testT15() throws Exception {
109         assertResponse("T15_fromA.xml", "T15_fromC.xml");
110     }
111 
112     public void testT16() throws Exception {
113         assertResponse("T16_fromA.xml", "T16_fromB.xml", "T16_fromC.xml");
114     }
115 
116     public void testT17() throws Exception {
117         assertResponse("T17_fromA.xml", "T17_fromB.xml");
118     }
119 
120     public void testT18() throws Exception {
121         assertResponse("T18_fromA.xml", "T18_fromB.xml", "T18_fromC.xml");
122     }
123 
124     public void testT19() throws Exception {
125         assertResponse("T19_fromA.xml", "T19_fromC.xml");
126     }
127 
128     public void testT21() throws Exception {
129         assertResponse("T21_fromA.xml", "T21_fromB.xml", null);
130     }
131 
132     public void testT22() throws Exception {
133         assertResponse("T22_fromA.xml", "T22_fromC.xml");
134     }
135 
136     public void testT23() throws Exception {
137         if (testFlushHeadersOnFault) {
138             assertResponse("T23_fromA.xml", "T23_fromC.xml");
139         }
140     }
141 
142     public void testT24() throws Exception {
143         assertResponse("T24_fromA.xml", "T24_fromC.xml");
144     }
145 
146     public void testT25() throws Exception {
147         if (testDocTypeXml) {
148             assertResponse("T25_fromA.xml", "T25_fromC.xml");
149         }
150     }
151 
152     public void testT26() throws Exception {
153         assertResponse("T26_fromA.xml", "T26_fromC.xml");
154     }
155 
156     public void testT27() throws Exception {
157         if (testSoapEncoding) {
158             assertResponse("T27_fromA.xml", "T27_fromC.xml");
159         }
160     }
161 
162     public void testT28() throws Exception {
163         if (testSoapEncoding) {
164             assertResponse("T28_fromA.xml", "T28_fromC.xml");
165         }
166     }
167 
168     public void testT29() throws Exception {
169         assertResponse("T29_fromA.xml", "T29_fromC.xml");
170     }
171 
172     // TODO : upgrade SOAP protocol required
173     public void TODO_testT30() throws Exception {
174         assertResponse("T30_fromA.xml", "T30_fromC.xml");
175     }
176 
177     // TODO : returnVoid handler
178     public void TODO_testT31() throws Exception {
179         assertResponse("T31_fromA.xml", "T31_fromC.xml");
180     }
181 
182     // TODO : requiredHeader handler
183     public void TODO_testT32() throws Exception {
184         assertResponse("T32_fromA.xml", "T32_fromC.xml");
185     }
186 
187     public void testT33() throws Exception {
188         assertResponse("T33_fromA.xml", "T33_fromC.xml");
189     }
190 
191     public void testT34() throws Exception {
192         assertResponse("T34_fromA.xml", "T34_fromC.xml");
193     }
194 
195     public void testT35() throws Exception {
196         assertResponse("T35_fromA.xml", "T35_fromC.xml");
197     }
198 
199     public void testT36() throws Exception {
200         assertResponse("T36_fromA.xml", "T36_fromC.xml");
201     }
202 
203     public void testT37() throws Exception {
204         assertResponse("T37_fromA.xml", "T37_fromC.xml");
205     }
206 
207     public void testT38() throws Exception {
208         assertResponse("T38_fromA.xml", "T38_fromC.xml");
209         assertResponse("T38_fromA2.xml", "T38_fromC2.xml");
210     }
211 
212     public void testT39() throws Exception {
213         assertResponse("T39_fromA.xml", "T39_fromC.xml");
214     }
215 
216     public void testT40() throws Exception {
217         assertResponse("T40_fromA.xml", "T40_fromC.xml");
218     }
219 
220     public void testT41_61() throws Exception {
221         if (testSoapEncoding) {
222             for (int i = 41; i <= 61; i++) {
223                 System.out.println("Testing: T" + i);
224                 assertResponse("T" + i + "_fromA.xml", "T" + i + "_fromC.xml");
225             }
226         }
227     }
228 
229     // TODO : concatAndForwardEchoOk handler
230     public void TODO_testT62() throws Exception {
231         assertResponse("T62_fromA.xml", "T62_fromC.xml");
232     }
233 
234     // TODO : validateCountryCode handler
235     public void TODO_testT63() throws Exception {
236         assertResponse("T63_fromA.xml", "T63_fromC.xml");
237     }
238 
239     public void testT64() throws Exception {
240         if (testDocTypeXml) {
241             assertResponse("T64_fromA.xml", "T64_fromC.xml");
242         }
243     }
244 
245     public void testT65() throws Exception {
246         if (testDocTypeXml) {
247             assertResponse("T65_fromA.xml", "T65_fromC.xml");
248         }
249     }
250 
251     public void testT66() throws Exception {
252         if (staxRIBugFixed) {
253             assertResponse("T66_fromA.xml", "T66_fromC.xml");
254         }
255     }
256 
257     public void testT67() throws Exception {
258         if (staxRIBugFixed) {
259             assertResponse("T67_fromA.xml", "T67_fromC.xml");
260         }
261     }
262 
263     public void testT68() throws Exception {
264         assertResponse("T68_fromA.xml", "T68_fromC.xml");
265     }
266 
267     public void testT69() throws Exception {
268         if (testFlushHeadersOnFault) {
269             assertResponse("T69_fromA.xml", "T69_fromC.xml");
270         }
271     }
272 
273     // TODO : handle element after Body
274     public void TODO_testT70() throws Exception {
275         assertResponse("T70_fromA.xml", "T70_fromC.xml");
276     }
277 
278     public void testT71() throws Exception {
279         assertResponse("T71_fromA.xml", "T71_fromC.xml");
280     }
281 
282     public void testT72() throws Exception {
283         assertResponse("T72_fromA.xml", "T72_fromC.xml");
284     }
285 
286     public void testT73() throws Exception {
287         if (testRPC) {
288             assertResponse("T73_fromA.xml", "T73_fromC.xml");
289         }
290     }
291 
292     public void testT74() throws Exception {
293         assertResponse("T74_fromA.xml", "T74_fromC.xml");
294     }
295 
296     // TODO : echoResolvedRef handler
297     public void TODO_testT75() throws Exception {
298         assertResponse("T75_fromA.xml", "T75_fromC.xml");
299     }
300 
301     public void testT76_77() throws Exception {
302         if (testRPC) {
303             assertResponse("T76_fromA.xml", "T76_fromC.xml");
304             assertResponse("T76_fromA2.xml", "T76_fromC2.xml");
305             assertResponse("T77_fromA.xml", "T77_fromC.xml");
306             assertResponse("T77_fromA2.xml", "T77_fromC2.xml");
307             assertResponse("T77_fromA3.xml", "T77_fromC3.xml");
308         }
309     }
310 
311     public void testT78() throws Exception {
312         assertResponse("T78_fromA.xml", "T78_fromC.xml");
313     }
314 
315     public void testT79() throws Exception {
316         assertResponse("T79_fromA.xml", "T79_fromB.xml", "T79_fromC.xml");
317     }
318 
319     public void testT80() throws Exception {
320         assertResponse("T80_fromA.xml", "T80_fromC.xml");
321     }
322 
323     protected void setUp() throws Exception {
324         super.setUp();
325         service.getHandlerRegistry().addHandler(EchoOKHandler.echoOk, new EchoOKHandler());
326         service.getRoles().add("http://example.org/ts-tests/C");
327     }
328 }