Search in sources :

Example 46 with Endpoint

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());
}
Also used : Endpoint(org.apache.camel.Endpoint) Test(org.junit.Test)

Example 47 with Endpoint

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());
}
Also used : Endpoint(org.apache.camel.Endpoint) Test(org.junit.Test)

Example 48 with Endpoint

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());
}
Also used : Endpoint(org.apache.camel.Endpoint) Test(org.junit.Test)

Example 49 with Endpoint

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);
    }
}
Also used : Endpoint(org.apache.camel.Endpoint) MockEndpoint(org.apache.camel.component.mock.MockEndpoint)

Example 50 with 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());
}
Also used : Endpoint(org.apache.camel.Endpoint) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Aggregations

Endpoint (org.apache.camel.Endpoint)615 Test (org.junit.Test)238 Exchange (org.apache.camel.Exchange)209 Producer (org.apache.camel.Producer)139 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)94 CamelContext (org.apache.camel.CamelContext)50 Processor (org.apache.camel.Processor)46 Message (org.apache.camel.Message)44 HashMap (java.util.HashMap)32 Map (java.util.Map)31 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)30 RouteBuilder (org.apache.camel.builder.RouteBuilder)28 Consumer (org.apache.camel.Consumer)27 File (java.io.File)26 ProducerTemplate (org.apache.camel.ProducerTemplate)23 Route (org.apache.camel.Route)21 EventDrivenConsumerRoute (org.apache.camel.impl.EventDrivenConsumerRoute)18 CountDownLatch (java.util.concurrent.CountDownLatch)16 DefaultExchange (org.apache.camel.impl.DefaultExchange)16 ArrayList (java.util.ArrayList)15