use of org.apache.camel.impl.SimpleRegistry in project camel by apache.
the class JpaWithNamedQueryAndParametersTest method setUp.
@Before
public void setUp() throws Exception {
camelContext = new DefaultCamelContext();
SimpleRegistry registry = new SimpleRegistry();
Map<String, Object> params = new HashMap<String, Object>();
params.put("custName", "Willem");
// bind the params
registry.put("params", params);
camelContext.setRegistry(registry);
template = camelContext.createProducerTemplate();
ServiceHelper.startServices(template, camelContext);
Endpoint value = camelContext.getEndpoint(getEndpointUri());
assertNotNull("Could not find endpoint!", value);
assertTrue("Should be a JPA endpoint but was: " + value, value instanceof JpaEndpoint);
endpoint = (JpaEndpoint) value;
transactionTemplate = endpoint.createTransactionTemplate();
entityManager = endpoint.createEntityManager();
}
use of org.apache.camel.impl.SimpleRegistry in project camel by apache.
the class SmppComponentTest method createEndpointWithSessionStateListener.
@Test
public void createEndpointWithSessionStateListener() throws Exception {
SimpleRegistry registry = new SimpleRegistry();
registry.put("sessionStateListener", new SessionStateListener() {
@Override
public void onStateChange(SessionState arg0, SessionState arg1, Session arg2) {
}
});
context.setRegistry(registry);
component = new SmppComponent(context);
SmppEndpoint endpoint = (SmppEndpoint) component.createEndpoint("smpp://smppclient@localhost:2775?password=password&sessionStateListener=#sessionStateListener");
assertNotNull(endpoint.getConfiguration().getSessionStateListener());
}
use of org.apache.camel.impl.SimpleRegistry in project camel by apache.
the class Sjms2EndpointConnectionSettingsTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
SimpleRegistry registry = new SimpleRegistry();
registry.put("activemq", connectionFactory);
registry.put("connresource", connectionResource);
return new DefaultCamelContext(registry);
}
use of org.apache.camel.impl.SimpleRegistry in project camel by apache.
the class RabbitMQComponentTest method testConnectionFactoryRef.
@Test
public void testConnectionFactoryRef() throws Exception {
SimpleRegistry registry = new SimpleRegistry();
ConnectionFactory connectionFactoryMock = Mockito.mock(ConnectionFactory.class);
registry.put("connectionFactoryMock", connectionFactoryMock);
CamelContext defaultContext = new DefaultCamelContext(registry);
Map<String, Object> params = new HashMap<String, Object>();
params.put("connectionFactory", "#connectionFactoryMock");
RabbitMQEndpoint endpoint = new RabbitMQComponent(defaultContext).createEndpoint("rabbitmq:localhost/exchange", "localhost/exchange", params);
assertSame(connectionFactoryMock, endpoint.getConnectionFactory());
}
use of org.apache.camel.impl.SimpleRegistry in project camel by apache.
the class SjmsBatchConsumerAsyncStartTest method createCamelContext.
// lets just test that any of the existing tests works
@Override
public CamelContext createCamelContext() throws Exception {
SimpleRegistry registry = new SimpleRegistry();
registry.put("testStrategy", new ListAggregationStrategy());
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(broker.getTcpConnectorUri());
SjmsComponent sjmsComponent = new SjmsComponent();
sjmsComponent.setConnectionFactory(connectionFactory);
SjmsBatchComponent sjmsBatchComponent = new SjmsBatchComponent();
sjmsBatchComponent.setConnectionFactory(connectionFactory);
// turn on async start listener
sjmsBatchComponent.setAsyncStartListener(true);
CamelContext context = new DefaultCamelContext(registry);
context.addComponent("sjms", sjmsComponent);
context.addComponent("sjms-batch", sjmsBatchComponent);
return context;
}
Aggregations