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.dispatchers;
20:
21: import junit.framework.TestCase;
22: import org.apache.axis2.AxisFault;
23: import org.apache.axis2.addressing.EndpointReference;
24: import org.apache.axis2.context.ConfigurationContext;
25: import org.apache.axis2.context.ConfigurationContextFactory;
26: import org.apache.axis2.context.MessageContext;
27: import org.apache.axis2.description.AxisOperation;
28: import org.apache.axis2.description.AxisService;
29: import org.apache.axis2.description.InOnlyAxisOperation;
30: import org.apache.axis2.engine.AxisConfiguration;
31:
32: import javax.xml.namespace.QName;
33:
34: public class RequestURIBasedOperationDispatcherTest extends TestCase {
35:
36: public void testFindService() throws AxisFault {
37: MessageContext messageContext;
38: AxisService as1 = new AxisService("Service1");
39:
40: AxisOperation operation1 = new InOnlyAxisOperation(new QName(
41: "operation1"));
42: AxisOperation operation2 = new InOnlyAxisOperation(new QName(
43: "operation2"));
44: as1.addOperation(operation1);
45: as1.addOperation(operation2);
46:
47: ConfigurationContext cc = ConfigurationContextFactory
48: .createEmptyConfigurationContext();
49: AxisConfiguration ac = cc.getAxisConfiguration();
50: ac.addService(as1);
51: messageContext = cc.createMessageContext();
52:
53: messageContext
54: .setTo(new EndpointReference(
55: "http://127.0.0.1:8080/axis2/services/Service1/operation2"));
56: messageContext.setAxisService(as1);
57:
58: RequestURIBasedOperationDispatcher ruisd = new RequestURIBasedOperationDispatcher();
59: ruisd.invoke(messageContext);
60:
61: assertEquals(operation2, messageContext.getAxisOperation());
62: }
63:
64: }
|