1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.soap.axis.issues;
12
13 import org.mule.api.MuleException;
14 import org.mule.api.endpoint.EndpointBuilder;
15 import org.mule.api.endpoint.ImmutableEndpoint;
16 import org.mule.api.transport.Connector;
17 import org.mule.tck.DynamicPortTestCase;
18 import org.mule.transport.soap.axis.AxisConnector;
19
20 public class EndpointRetrievalMule2021TestCase extends DynamicPortTestCase
21 {
22
23 protected String getConfigResources()
24 {
25 return "endpoint-retrieval-mule-2021-test.xml";
26 }
27
28 public void testLookupEndpoint() throws MuleException
29 {
30 Object endpoint1 = muleContext.getRegistry().lookupObject("Endpoint");
31
32 assertTrue(endpoint1 instanceof EndpointBuilder);
33 assertFalse(endpoint1 instanceof ImmutableEndpoint);
34
35 EndpointBuilder endpointBuiler = muleContext.getRegistry().lookupEndpointBuilder("Endpoint");
36
37 assertNotNull(endpointBuiler);
38
39 ImmutableEndpoint endpoint2 = (ImmutableEndpoint) muleContext.getRegistry().lookupObject(
40 "axis:http://localhost:" + getPorts().get(0) + "/mule/Service?method=toString");
41
42 assertNull(endpoint2);
43 }
44
45 public void testGetOutboundEndpoint() throws MuleException
46 {
47 ImmutableEndpoint endpoint1 = muleContext.getEndpointFactory().getOutboundEndpoint(
48 "Endpoint");
49 assertEndpointOk(endpoint1);
50 ImmutableEndpoint endpoint2 = muleContext.getEndpointFactory().getOutboundEndpoint(
51 "axis:http://localhost:" + getPorts().get(0) + "/mule/Service?method=toString");
52 assertEndpointOk(endpoint2);
53 }
54
55 public void testGetInboundEndpoint() throws MuleException
56 {
57 ImmutableEndpoint endpoint1 = muleContext.getEndpointFactory().getInboundEndpoint(
58 "Endpoint");
59 assertEndpointOk(endpoint1);
60 ImmutableEndpoint endpoint2 = muleContext.getEndpointFactory().getInboundEndpoint(
61 "axis:http://localhost:" + getPorts().get(0) + "/mule/Service?method=toString");
62 assertEndpointOk(endpoint2);
63 }
64
65 public void testGetResponseEndpoint() throws MuleException
66 {
67 ImmutableEndpoint endpoint1 = muleContext.getEndpointFactory().getInboundEndpoint(
68 "Endpoint");
69 assertEndpointOk(endpoint1);
70 ImmutableEndpoint endpoint2 = muleContext.getEndpointFactory().getInboundEndpoint(
71 "axis:http://localhost:" + getPorts().get(0) + "/mule/Service?method=toString");
72 assertEndpointOk(endpoint2);
73 }
74
75 private void assertEndpointOk(ImmutableEndpoint endpoint)
76 {
77 assertNotNull("Endpoint is null", endpoint);
78 Connector connector = endpoint.getConnector();
79 assertTrue("Connector not AXIS", connector instanceof AxisConnector);
80 }
81
82 @Override
83 protected int getNumPortsToFind()
84 {
85 return 1;
86 }
87
88 }