use of org.apache.camel.Endpoint in project camel by apache.
the class UriConfigurationTest method testGroupChatConfiguration.
@Test
public void testGroupChatConfiguration() throws Exception {
Endpoint endpoint = context.getEndpoint("xmpp://camel-user@im.google.com:123?room=cheese&password=secret&nickname=incognito");
assertTrue("Endpoint not an XmppEndpoint: " + endpoint, endpoint instanceof XmppEndpoint);
XmppEndpoint xmppEndpoint = (XmppEndpoint) endpoint;
assertEquals("im.google.com", xmppEndpoint.getHost());
assertEquals(123, xmppEndpoint.getPort());
assertEquals("camel-user", xmppEndpoint.getUser());
assertEquals("cheese", xmppEndpoint.getRoom());
assertEquals("secret", xmppEndpoint.getPassword());
assertEquals("incognito", xmppEndpoint.getNickname());
}
use of org.apache.camel.Endpoint in project camel by apache.
the class UriConfigurationTest method testPrivateChatConfiguration.
@Test
public void testPrivateChatConfiguration() throws Exception {
Endpoint endpoint = context.getEndpoint("xmpp://camel-user@localhost:123/test-user@localhost?password=secret&serviceName=someCoolChat");
assertTrue("Endpoint not an XmppEndpoint: " + endpoint, endpoint instanceof XmppEndpoint);
XmppEndpoint xmppEndpoint = (XmppEndpoint) endpoint;
assertEquals("localhost", xmppEndpoint.getHost());
assertEquals(123, xmppEndpoint.getPort());
assertEquals("camel-user", xmppEndpoint.getUser());
assertEquals("test-user@localhost", xmppEndpoint.getParticipant());
assertEquals("secret", xmppEndpoint.getPassword());
assertEquals("someCoolChat", xmppEndpoint.getServiceName());
}
use of org.apache.camel.Endpoint in project camel by apache.
the class UriConfigurationTest method testDefaultResource.
// Changes in default resource name may break
// clients program assuming the default "Camel" resource name
// so it is better to avoid changing it.
@Test
public void testDefaultResource() throws Exception {
Endpoint endpoint = context.getEndpoint("xmpp://camel-user@im.google.com?password=secret");
assertTrue("Endpoint not an XmppEndpoint: " + endpoint, endpoint instanceof XmppEndpoint);
XmppEndpoint xmppEndpoint = (XmppEndpoint) endpoint;
assertEquals("Camel", xmppEndpoint.getResource());
}
use of org.apache.camel.Endpoint in project camel by apache.
the class CamelCdiTest method assertHasEndpoints.
public static void assertHasEndpoints(CamelContext context, String... uris) {
Map<String, Endpoint> endpointMap = context.getEndpointMap();
for (String uri : uris) {
Endpoint endpoint = endpointMap.get(uri);
assertNotNull("CamelContext " + context + " does not have an Endpoint with URI " + uri + " but has " + endpointMap.keySet(), endpoint);
}
}
use of org.apache.camel.Endpoint in project camel by apache.
the class RemoveEndpointsTest method testRemoveAllEndpoints.
@Test
public void testRemoveAllEndpoints() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:jms-queue");
mock.expectedMessageCount(1);
assertEquals(7, context.getEndpoints().size());
template.sendBody("direct:foo", "Hello World");
assertMockEndpointsSatisfied();
Collection<Endpoint> list = context.removeEndpoints("*");
// all have been removed
assertEquals(7, list.size());
assertEquals(0, context.getEndpoints().size());
}
Aggregations