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:
20: /**
21: *
22: */package org.apache.axis2.jaxws.sample;
23:
24: import javax.xml.ws.BindingProvider;
25:
26: import junit.framework.TestCase;
27: import org.apache.axis2.jaxws.sample.doclitbare.sei.BareDocLitService;
28: import org.apache.axis2.jaxws.sample.doclitbare.sei.DocLitBarePortType;
29: import org.apache.axis2.jaxws.TestLogger;
30: import org.apache.log4j.BasicConfigurator;
31:
32: public class BareTests extends TestCase {
33:
34: public void testTwoWaySync() {
35: TestLogger.logger.debug("------------------------------");
36: TestLogger.logger.debug("Test : " + getName());
37:
38: try {
39:
40: BareDocLitService service = new BareDocLitService();
41: DocLitBarePortType proxy = service.getBareDocLitPort();
42: BindingProvider p = (BindingProvider) proxy;
43: p.getRequestContext().put(
44: BindingProvider.SOAPACTION_USE_PROPERTY,
45: Boolean.TRUE);
46: p.getRequestContext().put(
47: BindingProvider.SOAPACTION_URI_PROPERTY,
48: "twoWaySimple");
49: String response = proxy.twoWaySimple(10);
50: TestLogger.logger.debug("Sync Response =" + response);
51: TestLogger.logger.debug("------------------------------");
52: } catch (Exception e) {
53: e.printStackTrace();
54: fail();
55: }
56: }
57:
58: public void testTwoWaySyncWithBodyRouting() {
59: TestLogger.logger.debug("------------------------------");
60: TestLogger.logger.debug("Test : " + getName());
61:
62: try {
63:
64: BareDocLitService service = new BareDocLitService();
65: DocLitBarePortType proxy = service.getBareDocLitPort();
66: String response = proxy.twoWaySimple(10);
67: TestLogger.logger.debug("Sync Response =" + response);
68: TestLogger.logger.debug("------------------------------");
69: } catch (Exception e) {
70: e.printStackTrace();
71: fail();
72: }
73: }
74:
75: public void testOneWayEmpty() {
76: TestLogger.logger.debug("------------------------------");
77: TestLogger.logger.debug("Test : " + getName());
78:
79: try {
80:
81: BareDocLitService service = new BareDocLitService();
82: DocLitBarePortType proxy = service.getBareDocLitPort();
83: BindingProvider p = (BindingProvider) proxy;
84:
85: p.getRequestContext().put(
86: BindingProvider.SOAPACTION_USE_PROPERTY,
87: Boolean.TRUE);
88: p.getRequestContext().put(
89: BindingProvider.SOAPACTION_URI_PROPERTY,
90: "oneWayEmpty");
91: proxy.oneWayEmpty();
92:
93: TestLogger.logger.debug("------------------------------");
94: } catch (Exception e) {
95: e.printStackTrace();
96: fail();
97: }
98: }
99: }
|