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.deployment;
20:
21: import junit.framework.TestCase;
22: import org.apache.axis2.engine.AxisConfiguration;
23: import org.apache.axis2.context.ConfigurationContext;
24: import org.apache.axis2.context.ConfigurationContextFactory;
25: import org.apache.axis2.AbstractTestCase;
26: import org.apache.axis2.description.AxisService;
27: import org.apache.axis2.description.AxisOperation;
28:
29: import javax.xml.namespace.QName;
30: import java.util.ArrayList;
31:
32: public class OperationModuleTest extends TestCase {
33: /**
34: * Confirm that an operation module a) doesn't cause any deployment problems, and
35: * b) correctly configures the AxisOperation.
36: *
37: * @throws Exception if there is a problem
38: */
39: public void testOperationModule() throws Exception {
40: ConfigurationContext configCtx = ConfigurationContextFactory
41: .createConfigurationContextFromFileSystem(AbstractTestCase.basedir
42: + "/test-resources/deployment/AxisMessageTestRepo");
43: AxisConfiguration config = configCtx.getAxisConfiguration();
44: AxisService service = config.getService("MessagetestService");
45: assertNotNull("Couldn't find service", service);
46: AxisOperation operation = service.getOperation(new QName(
47: "echoString"));
48: assertNotNull("Couldn't find operation", operation);
49: ArrayList moduleRefs = operation.getModuleRefs();
50: assertEquals("Wrong # of modules", 1, moduleRefs.size());
51: String moduleName = (String) moduleRefs.get(0);
52: assertEquals("Wrong module name", "module1", moduleName);
53: }
54: }
|