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.description;
20:
21: import javax.xml.namespace.QName;
22:
23: import junit.framework.TestCase;
24:
25: public class AxisServiceTest extends TestCase {
26:
27: public void testAddMessageElementQNameToOperationMappingBasic() {
28: AxisService service = new AxisService();
29:
30: AxisOperation op1 = new InOnlyAxisOperation();
31: QName opName = new QName("foo");
32:
33: // test registering the same operation multiple times
34:
35: assertEquals(null, service
36: .getOperationByMessageElementQName(opName));
37:
38: service.addMessageElementQNameToOperationMapping(opName, op1);
39:
40: assertEquals(op1, service
41: .getOperationByMessageElementQName(opName));
42:
43: service.addMessageElementQNameToOperationMapping(opName, op1);
44:
45: assertEquals(op1, service
46: .getOperationByMessageElementQName(opName));
47:
48: service.addMessageElementQNameToOperationMapping(opName, op1);
49:
50: assertEquals(op1, service
51: .getOperationByMessageElementQName(opName));
52: }
53:
54: public void testAddMessageElementQNameToOperationMappingOverloading() {
55: AxisService service = new AxisService();
56:
57: AxisOperation op1 = new InOnlyAxisOperation();
58: AxisOperation op2 = new InOnlyAxisOperation();
59: AxisOperation op3 = new InOnlyAxisOperation();
60: QName opName = new QName("foo");
61:
62: // test registering different operations under the same opName
63:
64: assertEquals(null, service
65: .getOperationByMessageElementQName(opName));
66:
67: service.addMessageElementQNameToOperationMapping(opName, op1);
68:
69: assertEquals(op1, service
70: .getOperationByMessageElementQName(opName));
71:
72: service.addMessageElementQNameToOperationMapping(opName, op2);
73:
74: assertEquals(null, service
75: .getOperationByMessageElementQName(opName));
76:
77: service.addMessageElementQNameToOperationMapping(opName, op3);
78:
79: assertEquals(null, service
80: .getOperationByMessageElementQName(opName));
81: }
82:
83: }
|