use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class BeanInjectTest method configuration.
@Produces
@ApplicationScoped
@Named("properties")
private static PropertiesComponent configuration() {
Properties properties = new Properties();
properties.put("property", "value");
PropertiesComponent component = new PropertiesComponent();
component.setInitialProperties(properties);
return component;
}
use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class PropertyEndpointTest method configuration.
@Produces
@ApplicationScoped
@Named("properties")
private static PropertiesComponent configuration() {
Properties properties = new Properties();
properties.put("from", "inbound");
properties.put("to", "mock:outbound");
PropertiesComponent component = new PropertiesComponent();
component.setInitialProperties(properties);
return component;
}
use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class XPathFunctionsTest method createRouteBuilder.
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
// START SNIPPET: ex
// setup properties component
PropertiesComponent properties = new PropertiesComponent();
properties.setLocation("classpath:org/apache/camel/builder/xml/myprop.properties");
context.addComponent("properties", properties);
// myprop.properties contains the following properties
// foo=Camel
// bar=Kong
from("direct:in").choice().when().xpath("$type = function:properties('foo')").to("mock:camel").when().xpath("//name = function:simple('Donkey ${properties:bar}')").to("mock:donkey").otherwise().to("mock:other").end();
// END SNIPPET: ex
}
};
}
use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class TransactedPropertyPlaceholderIssueTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = super.createCamelContext();
PropertiesComponent pc = new PropertiesComponent();
pc.setLocation("classpath:org/apache/camel/component/properties/myproperties.properties");
context.addComponent("properties", pc);
return context;
}
use of org.apache.camel.component.properties.PropertiesComponent in project camel by apache.
the class RouteAutoStartupTest method testRouteNotAutoStartedUsingProperties.
public void testRouteNotAutoStartedUsingProperties() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
PropertiesComponent properties = new PropertiesComponent();
properties.setLocation("classpath:org/apache/camel/processor/routeAutoStartupTest.properties");
context.addComponent("properties", properties);
from("direct:start").id("route1").autoStartup("{{noAutoStartupProp}}").to("mock:result");
}
});
context.start();
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(0);
try {
template.sendBody("direct:start", "Hello World");
fail("route shouldn't be started yet");
} catch (Exception e) {
// expected
}
assertMockEndpointsSatisfied();
// reset mock, start route and resend message
mock.reset();
mock.expectedMessageCount(1);
context.startRoute("route1");
template.sendBody("direct:start", "Hello World");
assertMockEndpointsSatisfied();
}
Aggregations