Package org.apache.camel

Examples of org.apache.camel.Endpoint


    public void setOutputs(List<ProcessorType> outputs) {
        this.outputs = outputs;
    }

    public void addRoutes(RouteContext routeContext, Collection<Route> routes) throws Exception {
        Endpoint from = routeContext.getEndpoint();
        final Processor processor = routeContext.createProcessor(this);
        final Resequencer resequencer = new Resequencer(from, processor, resolveExpressionList(routeContext));

        Route route = new Route<Exchange>(from, resequencer) {
            @Override
View Full Code Here


        writeSettings();

        // will start the component
        camelContext.start();

        Endpoint e1 = component.createEndpoint(getEndpointUri(settingsFile.getName(), null));
        assertThat(component.getEngines().size(), is(1));
        assertThat(component.getEngines().get(settingsFile.getName()), is(notNullValue()));
        assertThat(component.getEngines().get(settingsFile.getName()).isStarted(), is(true));
        assertThat(component.getProvisionalEngines().size(), is(0));
        assertThat(((QuickfixjEndpoint)e1).getSessionID(), is(nullValue()));
       
        Endpoint e2 = component.createEndpoint(getEndpointUri(settingsFile.getName(), sessionID));
        assertThat(component.getEngines().size(), is(1));
        assertThat(component.getEngines().get(settingsFile.getName()), is(notNullValue()));
        assertThat(component.getEngines().get(settingsFile.getName()).isStarted(), is(true));
        assertThat(component.getProvisionalEngines().size(), is(0));
        assertThat(((QuickfixjEndpoint)e2).getSessionID(), is(sessionID));
View Full Code Here

        settings.setString(sessionID, SessionFactory.SETTING_CONNECTION_TYPE, SessionFactory.INITIATOR_CONNECTION_TYPE);
        settings.setLong(sessionID, Initiator.SETTING_SOCKET_CONNECT_PORT, 1234);

        writeSettings();

        Endpoint endpoint = component.createEndpoint(getEndpointUri(settingsFile.getName(), null));
       
        final CountDownLatch latch = new CountDownLatch(1);
       
        Consumer consumer = endpoint.createConsumer(new Processor() {
            @Override
            public void process(Exchange exchange) throws Exception {
                QuickfixjEventCategory eventCategory =
                    (QuickfixjEventCategory) exchange.getIn().getHeader(QuickfixjEndpoint.EVENT_CATEGORY_KEY);
                if (eventCategory == QuickfixjEventCategory.SessionCreated) {
View Full Code Here

        settings.setLong(initiatorSessionID, Initiator.SETTING_RECONNECT_INTERVAL, 1);
        setSessionID(settings, initiatorSessionID);

        writeSettings(settings, true);
       
        Endpoint endpoint = component.createEndpoint(getEndpointUri(settingsFile.getName(), null));
       
        // Start the component and wait for the FIX sessions to be logged on

        final CountDownLatch logonLatch = new CountDownLatch(2);
        final CountDownLatch messageLatch = new CountDownLatch(2);
               
        Consumer consumer = endpoint.createConsumer(new Processor() {
            @Override
            public void process(Exchange exchange) throws Exception {
                QuickfixjEventCategory eventCategory =
                    (QuickfixjEventCategory) exchange.getIn().getHeader(QuickfixjEndpoint.EVENT_CATEGORY_KEY);
                if (eventCategory == QuickfixjEventCategory.SessionLogon) {
                    logonLatch.countDown();
                } else if (eventCategory == QuickfixjEventCategory.AppMessageReceived) {
                    messageLatch.countDown();
                }
            }
        });
        ServiceHelper.startService(consumer);

        // will start the component
        camelContext.start();

        assertTrue("Session not created", logonLatch.await(5000, TimeUnit.MILLISECONDS));
      
        Endpoint producerEndpoint = component.createEndpoint(getEndpointUri(settingsFile.getName(), acceptorSessionID));
        Producer producer = producerEndpoint.createProducer();
       
        // FIX message to send
        Email email = new Email(new EmailThreadID("ID"), new EmailType(EmailType.NEW), new Subject("Test"));
        Exchange exchange = producer.createExchange(ExchangePattern.InOnly);
        exchange.getIn().setBody(email);
View Full Code Here

        camelContext.setRegistry(registry);
       
        template = camelContext.createProducerTemplate();
        ServiceHelper.startServices(template, camelContext);

        Endpoint value = camelContext.getEndpoint(getEndpointUri());
        assertNotNull("Could not find endpoint!", value);
        assertTrue("Should be a JPA endpoint but was: " + value, value instanceof JpaEndpoint);
        endpoint = (JpaEndpoint)value;

        transactionTemplate = endpoint.createTransactionTemplate();
View Full Code Here

        }
        return null;
    }

    protected Endpoint getEndpointInjection(String uri, String name) {
        Endpoint endpoint = null;
        if (isNotNullAndNonEmpty(uri)) {
            endpoint = camelContext.getEndpoint(uri);
        } else {
            if (isNotNullAndNonEmpty(name)) {
                endpoint = (Endpoint)applicationContext.getBean(name);
View Full Code Here

*/
public class UriConfigurationTest extends TestCase {
    protected CamelContext context = new DefaultCamelContext();

    public void testFtpConfigurationAscii() throws Exception {
        Endpoint endpoint = context.getEndpoint("ftp://camel-user@localhost:123/tmp?password=secret");
        assertTrue("Endpoint not an FtpEndpoint: " + endpoint, endpoint instanceof FtpEndpoint);
        FtpEndpoint ftpEndpoint = (FtpEndpoint) endpoint;

        assertEquals("localhost", ftpEndpoint.getConfiguration().getHost());
        assertEquals(123, ftpEndpoint.getConfiguration().getPort());
View Full Code Here

        assertEquals(true, ftpEndpoint.getConfiguration().isDirectory());
        assertEquals(false, ftpEndpoint.getConfiguration().isBinary());
    }

    public void testFtpConfigurationBinary() throws Exception {
        Endpoint endpoint = context.getEndpoint("ftp://camel-user@localhost:123/tmp?password=secret&binary=true");
        assertTrue("Endpoint not an FtpEndpoint: " + endpoint, endpoint instanceof FtpEndpoint);
        FtpEndpoint ftpEndpoint = (FtpEndpoint) endpoint;

        assertEquals("localhost", ftpEndpoint.getConfiguration().getHost());
        assertEquals(123, ftpEndpoint.getConfiguration().getPort());
View Full Code Here

        assertEquals(true, ftpEndpoint.getConfiguration().isDirectory());
        assertEquals(true, ftpEndpoint.getConfiguration().isBinary());
    }

    public void testFtpConfigurationDefaultPort() throws Exception {
        Endpoint endpoint = context.getEndpoint("ftp://camel-user@localhost/tmp?password=secret");
        assertTrue("Endpoint not an FtpEndpoint: " + endpoint, endpoint instanceof FtpEndpoint);
        FtpEndpoint ftpEndpoint = (FtpEndpoint) endpoint;

        assertEquals("localhost", ftpEndpoint.getConfiguration().getHost());
        assertEquals(21, ftpEndpoint.getConfiguration().getPort());
View Full Code Here

        assertEquals(true, ftpEndpoint.getConfiguration().isDirectory());
        assertEquals(false, ftpEndpoint.getConfiguration().isBinary());
    }

    public void testSftpConfigurationDefaultPort() throws Exception {
        Endpoint endpoint = context.getEndpoint("sftp://camel-user@localhost/tmp?password=secret");
        assertTrue("Endpoint not an SftpEndpoint: " + endpoint, endpoint instanceof SftpEndpoint);
        SftpEndpoint sftpEndpoint = (SftpEndpoint) endpoint;

        assertEquals("localhost", sftpEndpoint.getConfiguration().getHost());
        assertEquals(22, sftpEndpoint.getConfiguration().getPort());
View Full Code Here

TOP

Related Classes of org.apache.camel.Endpoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.