KickJava   Java API By Example, From Geeks To Geeks.

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


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.SOAPConstants;
20 import org.apache.axis2.soap.impl.llom.soap11.SOAP11Constants;
21 import org.apache.axis2.soap.impl.llom.soap12.SOAP12Constants;
22
23 public class SOAPEnvelopeTest extends SOAPTestCase {
24     protected SOAPEnvelope soap11Envelope;
25     protected SOAPEnvelope soap12Envelope;
26
27     public SOAPEnvelopeTest(String JavaDoc testName) {
28         super(testName);
29         soap11Envelope = soap11Factory.getDefaultEnvelope();
30         soap12Envelope = soap12Factory.getDefaultEnvelope();
31     }
32
33     //SOAP 1.1 Envelope Test (Programaticaly Created)-----------------------------------------------
34
public void testSOAP11GetHeader() {
35         SOAPHeader header = soap11Envelope.getHeader();
36         assertTrue("SOAP 1.1 Header Test : - Header local name mismatch", header.getLocalName().equals(SOAPConstants.HEADER_LOCAL_NAME));
37         assertTrue("SOAP 1.1 Header Test : - Header namespace mismatch", header.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
38     }
39
40     public void testSOAP11GetBody() {
41         SOAPBody body = soap11Envelope.getBody();
42         assertTrue("SOAP 1.1 Body Test : - Body local name mismatch", body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME));
43         assertTrue("SOAP 1.1 Body Test : - Body namespace mismatch", body.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
44     }
45
46     //SOAP 1.2 Envelope Test (Programaticaly Created)-------------------------------------------------
47
public void testSOAP12GetHeader() {
48         SOAPHeader header = soap12Envelope.getHeader();
49         assertTrue("SOAP 1.2 Header Test : - Header local name mismatch", header.getLocalName().equals(SOAPConstants.HEADER_LOCAL_NAME));
50         assertTrue("SOAP 1.2 Header Test : - Header namespace mismatch", header.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
51     }
52
53     public void testSOAP12GetBody() {
54         SOAPBody body = soap12Envelope.getBody();
55         assertTrue("SOAP 1.2 Body Test : - Body local name mismatch", body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME));
56         assertTrue("SOAP 1.2 Body Test : - Body namespace mismatch", body.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
57     }
58
59     //SOAP 1.1 Envelope Test (With Parser)-----------------------------------------------------------------
60
public void testSOAP11GetHeaderWithParser() {
61         SOAPHeader header = soap11EnvelopeWithParser.getHeader();
62         assertTrue("SOAP 1.1 Header Test : - Header local name mismatch", header.getLocalName().equals(SOAPConstants.HEADER_LOCAL_NAME));
63         assertTrue("SOAP 1.1 Header Test : - Header namespace mismatch", header.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
64     }
65
66     public void testSOAP11GetBodyWithParser() {
67         SOAPBody body = soap11EnvelopeWithParser.getBody();
68         assertTrue("SOAP 1.1 Body Test : - Body local name mismatch", body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME));
69         assertTrue("SOAP 1.1 Body Test : - Body namespace mismatch", body.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
70     }
71
72     //SOAP 1.2 Envelope Test (With Parser)--------------------------------------------------------------------
73
public void testSOAP12GetHeaderWithParser() {
74         SOAPHeader header = soap12EnvelopeWithParser.getHeader();
75         assertTrue("SOAP 1.2 Header Test : - Header local name mismatch", header.getLocalName().equals(SOAPConstants.HEADER_LOCAL_NAME));
76         assertTrue("SOAP 1.2 Header Test : - Header namespace mismatch", header.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
77     }
78
79     public void testSOAP12GetBodyWithParser() {
80         SOAPBody body = soap12EnvelopeWithParser.getBody();
81         assertTrue("SOAP 1.2 Body Test : - Body local name mismatch", body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME));
82         assertTrue("SOAP 1.2 Body Test : - Body namespace mismatch", body.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
83     }
84 }
85
Popular Tags