use of org.activiti.engine.test.Deployment in project Activiti by Activiti.
the class ErrorMapExceptionTest method testCamelDefaultMap.
@Deployment(resources = { "process/mapExceptionDefaultMap.bpmn20.xml" })
public void testCamelDefaultMap() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("activiti:mapExceptionDefaultProcess:exceptionRoute").throwException(new NullPointerException("test exception"));
}
});
FlagJavaDelegate.reset();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("mapExceptionDefaultProcess");
assertTrue(FlagJavaDelegate.isFlagSet());
}
use of org.activiti.engine.test.Deployment in project Activiti by Activiti.
the class ErrorMapExceptionTest method testCamelSingleDirectMap.
@Deployment(resources = { "process/mapExceptionSingleMap.bpmn20.xml" })
public void testCamelSingleDirectMap() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("activiti:mapExceptionProcess:exceptionRoute").throwException(new MapExceptionParent("test exception"));
}
});
FlagJavaDelegate.reset();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("mapExceptionProcess");
assertTrue(FlagJavaDelegate.isFlagSet());
}
use of org.activiti.engine.test.Deployment 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.activiti.engine.test.Deployment 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.activiti.engine.test.Deployment 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"));
}
Aggregations