Search in sources :

Example 46 with PropertiesComponent

use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.

the class BlueprintPropertiesLocationElementOptionalTest method testPropertiesLocationElement.

@Test
public void testPropertiesLocationElement() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedHeaderReceived("property-1", "property-value-1");
    mock.expectedHeaderReceived("property-2", "property-value-2");
    mock.expectedHeaderReceived("cm", "cm-value");
    PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
    assertNotNull("Properties component not defined", pc);
    List<PropertiesLocation> locations = pc.getLocations();
    assertNotNull(locations);
    assertEquals("Properties locations", 3, locations.size());
    template.sendBody("direct:start", null);
    mock.assertIsSatisfied();
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) PropertiesLocation(org.apache.camel.component.properties.PropertiesLocation) PropertiesComponent(org.apache.camel.component.properties.PropertiesComponent) Test(org.junit.Test)

Example 47 with PropertiesComponent

use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.

the class BlueprintPropertiesLocationElementTest method testPropertiesLocationElement.

@Test
public void testPropertiesLocationElement() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedHeaderReceived("property-1", "property-value-1");
    mock.expectedHeaderReceived("property-2", "property-value-2");
    mock.expectedHeaderReceived("cm", "cm-value");
    PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
    assertNotNull("Properties component not defined", pc);
    List<PropertiesLocation> locations = pc.getLocations();
    assertNotNull(locations);
    assertEquals("Properties locations", 3, locations.size());
    template.sendBody("direct:start", null);
    mock.assertIsSatisfied();
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) PropertiesLocation(org.apache.camel.component.properties.PropertiesLocation) PropertiesComponent(org.apache.camel.component.properties.PropertiesComponent) Test(org.junit.Test)

Example 48 with PropertiesComponent

use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.

the class ReportIncidentRoutesTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext camel = super.createCamelContext();
    camel.addComponent("properties", new PropertiesComponent("classpath:incident.properties,file:target/custom.properties"));
    return camel;
}
Also used : CamelContext(org.apache.camel.CamelContext) PropertiesComponent(org.apache.camel.component.properties.PropertiesComponent)

Example 49 with PropertiesComponent

use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.

the class BaseUndertowTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();
    context.addComponent("properties", new PropertiesComponent("ref:prop"));
    return context;
}
Also used : CamelContext(org.apache.camel.CamelContext) PropertiesComponent(org.apache.camel.component.properties.PropertiesComponent)

Example 50 with PropertiesComponent

use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.

the class Application method properties.

@Produces
@ApplicationScoped
@Named("properties")
// "properties" component bean that Camel uses to lookup properties
PropertiesComponent properties(PropertiesParser parser) {
    PropertiesComponent component = new PropertiesComponent();
    // Use DeltaSpike as configuration source for Camel CDI
    component.setPropertiesParser(parser);
    return component;
}
Also used : PropertiesComponent(org.apache.camel.component.properties.PropertiesComponent) Named(javax.inject.Named) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Aggregations

PropertiesComponent (org.apache.camel.component.properties.PropertiesComponent)83 CamelContext (org.apache.camel.CamelContext)35 Properties (java.util.Properties)17 ApplicationScoped (javax.enterprise.context.ApplicationScoped)12 Produces (javax.enterprise.inject.Produces)12 Named (javax.inject.Named)12 RouteBuilder (org.apache.camel.builder.RouteBuilder)11 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)8 PropertiesLocation (org.apache.camel.component.properties.PropertiesLocation)7 SpringCamelContext (org.apache.camel.spring.SpringCamelContext)6 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)5 Test (org.junit.Test)5 HashMap (java.util.HashMap)3 Component (org.apache.camel.Component)3 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)3 Method (java.lang.reflect.Method)2 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 Map (java.util.Map)2 Exchange (org.apache.camel.Exchange)2