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.jaxws.endpoint;
20:
21: import javax.jws.WebService;
22: import javax.xml.ws.Binding;
23: import javax.xml.ws.Endpoint;
24: import javax.xml.ws.soap.SOAPBinding;
25:
26: import junit.framework.TestCase;
27:
28: public class BasicEndpointTests extends TestCase {
29:
30: public void testCreateSimpleEndpoint() {
31: SampleEndpoint sample = new SampleEndpoint();
32:
33: Endpoint ep = Endpoint.create(sample);
34: assertTrue("The returned Endpoint instance was null",
35: ep != null);
36:
37: ep.publish("test");
38: assertTrue("The endpoint was not published successfully", ep
39: .isPublished());
40: }
41:
42: public void testCreateAndPublishEndpoint() {
43: SampleEndpoint sample = new SampleEndpoint();
44:
45: Endpoint ep = Endpoint.publish("test", sample);
46: assertTrue("The returned Endpoint instance was null",
47: ep != null);
48: assertTrue("The endpoint was not published successfully", ep
49: .isPublished());
50: }
51:
52: public void testGetBinding() throws Exception {
53: SampleEndpoint sample = new SampleEndpoint();
54:
55: Endpoint ep = Endpoint.create(sample);
56: assertTrue("The returned Endpoint instance was null",
57: ep != null);
58:
59: Binding bnd = ep.getBinding();
60: assertTrue("The returned Binding instance was null",
61: bnd != null);
62: assertTrue(
63: "The returned Binding instance was of the wrong type ("
64: + bnd.getClass().getName()
65: + "), expected SOAPBinding", SOAPBinding.class
66: .isAssignableFrom(bnd.getClass()));
67: }
68:
69: @WebService
70: class SampleEndpoint {
71:
72: public int foo(String bar) {
73: return bar.length();
74: }
75: }
76: }
|