Search in sources :

Example 51 with SimpleRegistry

use of org.apache.camel.impl.SimpleRegistry in project camel by apache.

the class ManagedFromRestGetEmbeddedRouteTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("dummy-test", new DummyRestConsumerFactory());
    return new DefaultCamelContext(registry);
}
Also used : SimpleRegistry(org.apache.camel.impl.SimpleRegistry) DummyRestConsumerFactory(org.apache.camel.component.rest.DummyRestConsumerFactory) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext)

Example 52 with SimpleRegistry

use of org.apache.camel.impl.SimpleRegistry in project camel by apache.

the class ManagedFromRestPlaceholderTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("dummy-test", new DummyRestConsumerFactory());
    CamelContext answer = new DefaultCamelContext(registry);
    PropertiesComponent pc = new PropertiesComponent();
    pc.setLocation("classpath:org/apache/camel/management/rest.properties");
    answer.addComponent("properties", pc);
    return answer;
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) SimpleRegistry(org.apache.camel.impl.SimpleRegistry) DummyRestConsumerFactory(org.apache.camel.component.rest.DummyRestConsumerFactory) PropertiesComponent(org.apache.camel.component.properties.PropertiesComponent) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext)

Example 53 with SimpleRegistry

use of org.apache.camel.impl.SimpleRegistry in project camel by apache.

the class LogProcessorWithProvidedLoggerTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("mylogger1", LoggerFactory.getLogger("org.apache.camel.customlogger"));
    CamelContext context = new DefaultCamelContext(registry);
    return context;
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) SimpleRegistry(org.apache.camel.impl.SimpleRegistry) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext)

Example 54 with SimpleRegistry

use of org.apache.camel.impl.SimpleRegistry in project camel by apache.

the class CxfEndpointTest method testCxfEndpointConfigurer.

@Test
public void testCxfEndpointConfigurer() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    CxfEndpointConfigurer configurer = EasyMock.createMock(CxfEndpointConfigurer.class);
    Processor processor = EasyMock.createMock(Processor.class);
    registry.put("myConfigurer", configurer);
    CamelContext camelContext = new DefaultCamelContext(registry);
    CxfComponent cxfComponent = new CxfComponent(camelContext);
    CxfEndpoint endpoint = (CxfEndpoint) cxfComponent.createEndpoint(routerEndpointURI + "&cxfEndpointConfigurer=#myConfigurer");
    configurer.configure(EasyMock.isA(AbstractWSDLBasedEndpointFactory.class));
    EasyMock.expectLastCall();
    configurer.configureServer(EasyMock.isA(Server.class));
    EasyMock.expectLastCall();
    EasyMock.replay(configurer);
    endpoint.createConsumer(processor);
    EasyMock.verify(configurer);
    EasyMock.reset(configurer);
    configurer.configure(EasyMock.isA(AbstractWSDLBasedEndpointFactory.class));
    EasyMock.expectLastCall();
    configurer.configureClient(EasyMock.isA(Client.class));
    EasyMock.expectLastCall();
    EasyMock.replay(configurer);
    Producer producer = endpoint.createProducer();
    producer.start();
    EasyMock.verify(configurer);
}
Also used : CamelContext(org.apache.camel.CamelContext) SpringCamelContext(org.apache.camel.spring.SpringCamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) AbstractWSDLBasedEndpointFactory(org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory) Processor(org.apache.camel.Processor) Server(org.apache.cxf.endpoint.Server) Producer(org.apache.camel.Producer) SimpleRegistry(org.apache.camel.impl.SimpleRegistry) Client(org.apache.cxf.endpoint.Client) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Example 55 with SimpleRegistry

use of org.apache.camel.impl.SimpleRegistry in project camel by apache.

the class CamelSimpleExpressionPerfTestRunner method main.

public static void main(String[] args) throws Exception {
    long bodyOnly = executePerformanceTest(new SimpleRegistry(), "${body}");
    long bodyProperty = executePerformanceTest(new SimpleRegistry(), "${body[p]}");
    long bodyPropertyWithCache = executePerformanceTest(new SimpleRegistry(), "${body[p]}");
    System.out.printf("${body}: %dms%n", bodyOnly);
    System.out.printf("${body[p]} : %dms%n", bodyProperty);
    System.out.printf("${body[p]} with cache : %dms%n", bodyPropertyWithCache);
}
Also used : SimpleRegistry(org.apache.camel.impl.SimpleRegistry)

Aggregations

SimpleRegistry (org.apache.camel.impl.SimpleRegistry)60 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)57 CamelContext (org.apache.camel.CamelContext)35 Test (org.junit.Test)25 RouteBuilder (org.apache.camel.builder.RouteBuilder)14 Before (org.junit.Before)8 FailedToCreateRouteException (org.apache.camel.FailedToCreateRouteException)5 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)4 Component (org.apache.camel.Component)4 Exchange (org.apache.camel.Exchange)4 DummyRestConsumerFactory (org.apache.camel.component.rest.DummyRestConsumerFactory)4 HashMap (java.util.HashMap)3 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)3 SjmsComponent (org.apache.camel.component.sjms.SjmsComponent)3 Config (com.hazelcast.config.Config)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)2 Properties (java.util.Properties)2 ConnectionFactory (javax.jms.ConnectionFactory)2 FileComponent (org.apache.camel.component.file.FileComponent)2 HystrixConfigurationDefinition (org.apache.camel.model.HystrixConfigurationDefinition)2