use of org.apache.camel.component.seda.SedaEndpoint in project camel by apache.
the class SpringEndpointPropertyTest method testEndpointProperty.
public void testEndpointProperty() throws Exception {
getMockEndpoint("mock:result").expectedMessageCount(2);
template.sendBody("ref:foo", "Hello World");
template.sendBody("ref:bar", "Bye World");
assertMockEndpointsSatisfied();
SedaEndpoint foo = applicationContext.getBean("foo", SedaEndpoint.class);
assertNotNull(foo);
assertEquals(100, foo.getSize());
assertEquals(5000, foo.getPollTimeout());
assertEquals(true, foo.isBlockWhenFull());
assertEquals("seda://foo?blockWhenFull=true&pollTimeout=5000&size=100", foo.getEndpointUri());
SedaEndpoint bar = applicationContext.getBean("bar", SedaEndpoint.class);
assertNotNull(bar);
assertEquals(200, bar.getSize());
assertEquals("seda://bar?size=200", bar.getEndpointUri());
}
use of org.apache.camel.component.seda.SedaEndpoint in project camel by apache.
the class DummyRestConsumerFactory method createConsumer.
@Override
public Consumer createConsumer(CamelContext camelContext, Processor processor, String verb, String basePath, String uriTemplate, String consumes, String produces, RestConfiguration configuration, Map<String, Object> parameters) throws Exception {
// just use a seda endpoint for testing purpose
String id;
if (uriTemplate != null) {
id = ActiveMQUuidGenerator.generateSanitizedId(basePath + uriTemplate);
} else {
id = ActiveMQUuidGenerator.generateSanitizedId(basePath);
}
// remove leading dash as we add that ourselves
if (id.startsWith("-")) {
id = id.substring(1);
}
SedaEndpoint seda = camelContext.getEndpoint("seda:" + verb + "-" + id, SedaEndpoint.class);
return seda.createConsumer(processor);
}
use of org.apache.camel.component.seda.SedaEndpoint in project camel by apache.
the class DummyRestConsumerFactory method createConsumer.
@Override
public Consumer createConsumer(CamelContext camelContext, Processor processor, String verb, String basePath, String uriTemplate, String consumes, String produces, RestConfiguration configuration, Map<String, Object> parameters) throws Exception {
// just use a seda endpoint for testing purpose
String id;
if (uriTemplate != null) {
id = ActiveMQUuidGenerator.generateSanitizedId(basePath + uriTemplate);
} else {
id = ActiveMQUuidGenerator.generateSanitizedId(basePath);
}
// remove leading dash as we add that ourselves
if (id.startsWith("-")) {
id = id.substring(1);
}
SedaEndpoint seda = camelContext.getEndpoint("seda:" + verb + "-" + id, SedaEndpoint.class);
return seda.createConsumer(processor);
}
use of org.apache.camel.component.seda.SedaEndpoint in project camel by apache.
the class DummyRestConsumerFactory method createApiConsumer.
@Override
public Consumer createApiConsumer(CamelContext camelContext, Processor processor, String contextPath, RestConfiguration configuration, Map<String, Object> parameters) throws Exception {
// just use a seda endpoint for testing purpose
String id = ActiveMQUuidGenerator.generateSanitizedId(contextPath);
// remove leading dash as we add that ourselves
if (id.startsWith("-")) {
id = id.substring(1);
}
SedaEndpoint seda = camelContext.getEndpoint("seda:api:" + "-" + id, SedaEndpoint.class);
return seda.createConsumer(processor);
}
use of org.apache.camel.component.seda.SedaEndpoint in project camel by apache.
the class DummyRestConsumerFactory method createConsumer.
@Override
public Consumer createConsumer(CamelContext camelContext, Processor processor, String verb, String basePath, String uriTemplate, String consumes, String produces, RestConfiguration configuration, Map<String, Object> parameters) throws Exception {
// just use a seda endpoint for testing purpose
String id;
if (uriTemplate != null) {
id = ActiveMQUuidGenerator.generateSanitizedId(basePath + uriTemplate);
} else {
id = ActiveMQUuidGenerator.generateSanitizedId(basePath);
}
// remove leading dash as we add that ourselves
if (id.startsWith("-")) {
id = id.substring(1);
}
if (configuration.getConsumerProperties() != null) {
String ref = (String) configuration.getConsumerProperties().get("dummy");
if (ref != null) {
dummy = CamelContextHelper.mandatoryLookup(camelContext, ref.substring(1));
}
}
SedaEndpoint seda = camelContext.getEndpoint("seda:" + verb + "-" + id, SedaEndpoint.class);
return seda.createConsumer(processor);
}
Aggregations