Search in sources :

Example 21 with PropertiesComponent

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

the class InterceptFromPropertyPlaceholderTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();
    PropertiesComponent pc = new PropertiesComponent();
    pc.setLocation("classpath:org/apache/camel/processor/intercept/myproperties.properties");
    context.addComponent("properties", pc);
    return context;
}
Also used : CamelContext(org.apache.camel.CamelContext) PropertiesComponent(org.apache.camel.component.properties.PropertiesComponent)

Example 22 with PropertiesComponent

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

the class AbstractJsseParametersTest method createPropertiesPlaceholderAwareContext.

protected CamelContext createPropertiesPlaceholderAwareContext(Properties supplementalProperties) throws IOException {
    Properties properties = new Properties(supplementalProperties);
    properties.load(AbstractJsseParametersTest.class.getResourceAsStream("test.properties"));
    if (supplementalProperties != null) {
        Properties mergedProps = new Properties();
        Set<String> keys = new HashSet<String>();
        keys.addAll(properties.stringPropertyNames());
        keys.addAll(supplementalProperties.stringPropertyNames());
        for (String key : keys) {
            mergedProps.setProperty(key, properties.getProperty(key));
        }
        properties = mergedProps;
    }
    properties.store(new FileOutputStream("target/jsse-test.properties"), "Generated by " + AbstractJsseParametersTest.class.getName());
    PropertiesComponent pc = new PropertiesComponent();
    pc.setLocation("file:./target/jsse-test.properties");
    CamelContext context = new DefaultCamelContext();
    context.addComponent("properties", pc);
    return context;
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) FileOutputStream(java.io.FileOutputStream) Properties(java.util.Properties) PropertiesComponent(org.apache.camel.component.properties.PropertiesComponent) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) HashSet(java.util.HashSet)

Example 23 with PropertiesComponent

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

the class AbstractInfluxDbTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    applicationContext = new AnnotationConfigApplicationContext(MockedInfluxDbConfiguration.class);
    CamelContext ctx = new SpringCamelContext(applicationContext);
    PropertiesComponent pc = new PropertiesComponent("classpath:influxdb.test.properties");
    ctx.addComponent("properties", pc);
    return ctx;
}
Also used : CamelContext(org.apache.camel.CamelContext) SpringCamelContext(org.apache.camel.spring.SpringCamelContext) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) SpringCamelContext(org.apache.camel.spring.SpringCamelContext) PropertiesComponent(org.apache.camel.component.properties.PropertiesComponent)

Example 24 with PropertiesComponent

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

the class JasyptPropertiesTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();
    // START SNIPPET: e1
    // create the jasypt properties parser
    JasyptPropertiesParser jasypt = new JasyptPropertiesParser();
    // and set the master password
    jasypt.setPassword("secret");
    // create the properties component
    PropertiesComponent pc = new PropertiesComponent();
    pc.setLocation("classpath:org/apache/camel/component/jasypt/myproperties.properties");
    // and use the jasypt properties parser so we can decrypt values
    pc.setPropertiesParser(jasypt);
    // add properties component to camel context
    context.addComponent("properties", pc);
    return context;
}
Also used : CamelContext(org.apache.camel.CamelContext) PropertiesComponent(org.apache.camel.component.properties.PropertiesComponent)

Example 25 with PropertiesComponent

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

the class BaseEmbeddedKafkaTest method createCamelContext.

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

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