use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class DumpModelAsXmlPlaceholdersTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = super.createCamelContext();
PropertiesComponent component = new PropertiesComponent();
component.setLocation("classpath:org/apache/camel/component/properties/cheese.properties");
context.addComponent("properties", component);
return context;
}
use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class FilerProducerDoneFileNameTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = super.createCamelContext();
PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
pc.setLocation("ref:myProp");
return context;
}
use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class SimpleWithPropertiesTest method testProperty.
/**
* A property from the property component in a expression
* is processed when the expression is evaluated with exchange
* See https://issues.apache.org/jira/browse/CAMEL-4843
* Now camel doesn't support the properties expression of {{test}}
*/
@Test
public void testProperty() throws Exception {
System.setProperty("test", "testValue");
PropertiesComponent pc = new PropertiesComponent();
CamelContext context = new DefaultCamelContext();
context.addComponent("properties", pc);
// try to setup the property
Exchange exchange = new DefaultExchange(context);
String result = SimpleBuilder.simple("${properties:test}").evaluate(exchange, String.class);
Assert.assertEquals("testValue", result);
System.clearProperty("test");
}
use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class BaseAhcTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = super.createCamelContext();
context.addComponent("properties", new PropertiesComponent("ref:prop"));
return context;
}
use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class AMQPConnectionDetails method discoverAMQP.
public static AMQPConnectionDetails discoverAMQP(CamelContext camelContext) {
try {
PropertiesComponent propertiesComponent = camelContext.getComponent("properties", PropertiesComponent.class);
String host = property(propertiesComponent, AMQP_HOST, "localhost");
int port = Integer.parseInt(property(propertiesComponent, AMQP_PORT, "5672"));
String username = property(propertiesComponent, AMQP_USERNAME, null);
String password = property(propertiesComponent, AMQP_PASSWORD, null);
return new AMQPConnectionDetails("amqp://" + host + ":" + port, username, password);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations