01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.axis2.jaxws.core;
20:
21: import java.util.Map;
22:
23: import junit.framework.TestCase;
24:
25: /*
26: * Testing jaxws message context's interation with axis2 message context.
27: * JAXWS delegates all property setting/getting up to axis2, but we need to
28: * be careful how we use axis2's MC. We should not have access to the options
29: * bag in the axis2 MC, for example.
30: */
31:
32: public class MessageContextTests extends TestCase {
33:
34: static final String key1 = "ONaxisMC";
35: static final String key2 = "ONaxisMCOptions";
36: static final String key3 = "ONjaxwsMC";
37:
38: /* TODO:
39: * should also test to make sure service or operation context properties
40: * on the axis2 MC are not accessible. That's probably best left for another test.
41: */
42: public void testMessageContextPropertiesAccessibility()
43: throws Exception {
44: org.apache.axis2.context.MessageContext axisMC = new org.apache.axis2.context.MessageContext();
45: MessageContext jaxwsMC = new MessageContext(axisMC);
46: axisMC.setProperty(key1, "value");
47: axisMC.getOptions().setProperty(key2, "value");
48: jaxwsMC.setProperty(key3, "value");
49:
50: assertNotNull(jaxwsMC.getProperty(key1));
51: assertNull(jaxwsMC.getProperty(key2));
52: assertNotNull(jaxwsMC.getProperty(key3));
53:
54: Map props = jaxwsMC.getProperties();
55:
56: assertNotNull(props.get(key1));
57: assertNull(props.get(key2));
58: assertNotNull(props.get(key3));
59: }
60:
61: }
|