KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > engine > MessageContextTest


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.engine;
18
19 import org.apache.axis2.AbstractTestCase;
20 import org.apache.axis2.context.ConfigurationContext;
21 import org.apache.axis2.context.MessageContext;
22 import org.apache.axis2.description.ServiceDescription;
23 import org.apache.axis2.om.OMAbstractFactory;
24 import org.apache.axis2.soap.SOAPFactory;
25 import org.apache.axis2.soap.impl.llom.SOAPProcessingException;
26
27 public class MessageContextTest extends AbstractTestCase {
28     public MessageContextTest(String JavaDoc testName) {
29         super(testName);
30     }
31
32     public void testMesssageContext() throws AxisFault, SOAPProcessingException {
33         AxisConfiguration er = new AxisConfigurationImpl();
34         ServiceDescription servicesDesc = new ServiceDescription();
35         er.addService(servicesDesc);
36
37         ConfigurationContext engineContext = new ConfigurationContext(er);
38
39         MessageContext msgctx = new MessageContext(engineContext);
40
41         SOAPFactory omFac = OMAbstractFactory.getSOAP11Factory();
42
43         msgctx.setEnvelope(omFac.getDefaultEnvelope());
44         assertNotNull(msgctx.getEnvelope());
45
46         msgctx.setFaultTo(null);
47         assertNull(msgctx.getFaultTo());
48
49         msgctx.setFrom(null);
50         assertNull(msgctx.getFrom());
51
52         msgctx.setRelatesTo(null);
53         assertNull(msgctx.getRelatesTo());
54
55         msgctx.setReplyTo(null);
56         assertNull(msgctx.getReplyTo());
57
58         msgctx.setMessageID(null);
59         assertNull(msgctx.getMessageID());
60     }
61 }
62
Popular Tags