use of org.apache.camel.CamelContext in project Activiti by Activiti.
the class SimpleProcessTest method testRunProcessByKey.
@Deployment(resources = { "process/example.bpmn20.xml" })
public void testRunProcessByKey() throws Exception {
CamelContext ctx = applicationContext.getBean(CamelContext.class);
ProducerTemplate tpl = ctx.createProducerTemplate();
MockEndpoint me = (MockEndpoint) ctx.getEndpoint("mock:service1");
me.expectedBodiesReceived("ala");
tpl.sendBodyAndProperty("direct:start", Collections.singletonMap("var1", "ala"), ActivitiProducer.PROCESS_KEY_PROPERTY, "key1");
String instanceId = runtimeService.createProcessInstanceQuery().processInstanceBusinessKey("key1").singleResult().getProcessInstanceId();
tpl.sendBodyAndProperty("direct:receive", null, ActivitiProducer.PROCESS_KEY_PROPERTY, "key1");
assertProcessEnded(instanceId);
me.assertIsSatisfied();
}
use of org.apache.camel.CamelContext in project Activiti by Activiti.
the class SimpleProcessTest method testRunProcess.
@Deployment(resources = { "process/example.bpmn20.xml" })
public void testRunProcess() throws Exception {
CamelContext ctx = applicationContext.getBean(CamelContext.class);
ProducerTemplate tpl = ctx.createProducerTemplate();
service1.expectedBodiesReceived("ala");
Exchange exchange = ctx.getEndpoint("direct:start").createExchange();
exchange.getIn().setBody(Collections.singletonMap("var1", "ala"));
tpl.send("direct:start", exchange);
String instanceId = (String) exchange.getProperty("PROCESS_ID_PROPERTY");
tpl.sendBodyAndProperty("direct:receive", null, ActivitiProducer.PROCESS_ID_PROPERTY, instanceId);
assertProcessEnded(instanceId);
service1.assertIsSatisfied();
Map<?, ?> m = service2.getExchanges().get(0).getIn().getBody(Map.class);
assertEquals("ala", m.get("var1"));
assertEquals("var2", m.get("var2"));
}
use of org.apache.camel.CamelContext in project Activiti by Activiti.
the class SimpleSpringProcessTest method testRunProcess.
@Deployment(resources = { "process/example.bpmn20.xml" })
public void testRunProcess() throws Exception {
CamelContext ctx = applicationContext.getBean(CamelContext.class);
ProducerTemplate tpl = ctx.createProducerTemplate();
service1.expectedBodiesReceived("ala");
Exchange exchange = ctx.getEndpoint("direct:start").createExchange();
exchange.getIn().setBody(Collections.singletonMap("var1", "ala"));
tpl.send("direct:start", exchange);
String instanceId = (String) exchange.getProperty("PROCESS_ID_PROPERTY");
tpl.sendBodyAndProperty("direct:receive", null, ActivitiProducer.PROCESS_ID_PROPERTY, instanceId);
assertProcessEnded(instanceId);
service1.assertIsSatisfied();
Map<?, ?> m = service2.getExchanges().get(0).getIn().getBody(Map.class);
assertEquals("ala", m.get("var1"));
assertEquals("var2", m.get("var2"));
}
use of org.apache.camel.CamelContext in project nhin-d by DirectProject.
the class MessageIdCorrelationExpression_evaluateTest method testEvaluate_emptyDetails_assertNullId.
@Test
public void testEvaluate_emptyDetails_assertNullId() {
MessageIdCorrelationExpression exp = new MessageIdCorrelationExpression();
Tx tx = new Tx(TxMessageType.IMF, new HashMap<String, TxDetail>());
CamelContext context = mock(CamelContext.class);
Exchange exchange = new DefaultExchange(context);
exchange.getIn().setBody(tx);
assertNull(exp.evaluate(exchange, String.class));
}
use of org.apache.camel.CamelContext in project nhin-d by DirectProject.
the class MessageIdCorrelationExpression_evaluateTest method testEvaluate_IMFMessage_noMsgId_assertNullId.
@Test
public void testEvaluate_IMFMessage_noMsgId_assertNullId() {
MessageIdCorrelationExpression exp = new MessageIdCorrelationExpression();
Map<String, TxDetail> details = new HashMap<String, TxDetail>();
details.put(TxDetailType.FROM.getType(), new TxDetail(TxDetailType.FROM, "me@test.com"));
Tx tx = new Tx(TxMessageType.IMF, details);
CamelContext context = mock(CamelContext.class);
Exchange exchange = new DefaultExchange(context);
exchange.getIn().setBody(tx);
assertNull(exp.evaluate(exchange, String.class));
}
Aggregations