1
2
3
4
5
6
7
8
9
10 package org.mule.transport.email.config;
11
12 import org.mule.api.MuleException;
13 import org.mule.api.endpoint.ImmutableEndpoint;
14 import org.mule.tck.FunctionalTestCase;
15
16 public abstract class AbstractEmailNamespaceHandlerTestCase extends FunctionalTestCase
17 {
18 protected void testInboundEndpoint(String name, String protocolName) throws MuleException
19 {
20 ImmutableEndpoint endpoint =
21 muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(name);
22 testEndpoint(endpoint, protocolName);
23 }
24
25 protected void testOutboundEndpoint(String name, String protocolName) throws MuleException
26 {
27 ImmutableEndpoint endpoint =
28 muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(name);
29 testEndpoint(endpoint, protocolName);
30 }
31
32 private void testEndpoint(ImmutableEndpoint endpoint, String protocolName)
33 {
34 assertNotNull(endpoint);
35 String address = endpoint.getEndpointURI().getAddress();
36 assertNotNull(address);
37 assertEquals("bob@localhost:123", address);
38 String password = endpoint.getEndpointURI().getPassword();
39 assertNotNull(password);
40 assertEquals("secret", password);
41 String protocol = endpoint.getProtocol();
42 assertNotNull(protocol);
43 assertEquals(protocolName, protocol);
44 }
45 }