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.context.ConfigurationContextFactory;
23: import org.apache.axis2.description.AxisMessage;
24: import org.apache.axis2.description.AxisOperation;
25: import org.apache.axis2.description.AxisService;
26: import org.apache.axis2.description.Parameter;
27: import org.apache.axis2.engine.AxisConfiguration;
28: import org.apache.axis2.AbstractTestCase;
29:
30: import javax.xml.namespace.QName;
31:
32: public class AxisMessageTest extends TestCase {
33:
34: public void testAxisMessage() throws Exception {
35: String filename = AbstractTestCase.basedir
36: + "/test-resources/deployment/AxisMessageTestRepo";
37: AxisConfiguration er = ConfigurationContextFactory
38: .createConfigurationContextFromFileSystem(filename,
39: filename + "/axis2.xml").getAxisConfiguration();
40:
41: assertNotNull(er);
42: AxisService service = er.getService("MessagetestService");
43: assertNotNull(service);
44: AxisOperation op = service
45: .getOperation(new QName("echoString"));
46: assertNotNull(op);
47: AxisMessage message = op.getMessage("In");
48: assertNotNull(message);
49: Parameter para = message.getParameter("messageIN");
50: assertNotNull(para);
51: assertEquals(para.getValue(), "messageIN");
52:
53: op = service.getOperation(new QName("echoStringArray"));
54: assertNotNull(op);
55: message = op.getMessage("In");
56: assertNotNull(message);
57: para = message.getParameter("messageIN");
58: assertNotNull(para);
59: assertEquals(para.getValue(), "messageIN");
60:
61: message = op.getMessage("Out");
62: assertNotNull(message);
63: para = message.getParameter("messageOut");
64: assertNotNull(para);
65: assertEquals(para.getValue(), "messageOut");
66:
67: }
68: }
|