Search in sources :

Example 16 with Deployment

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());
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Deployment(org.activiti.engine.test.Deployment)

Example 17 with Deployment

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());
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Deployment(org.activiti.engine.test.Deployment)

Example 18 with Deployment

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();
}
Also used : CamelContext(org.apache.camel.CamelContext) ProducerTemplate(org.apache.camel.ProducerTemplate) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Deployment(org.activiti.engine.test.Deployment)

Example 19 with Deployment

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"));
}
Also used : CamelContext(org.apache.camel.CamelContext) Exchange(org.apache.camel.Exchange) ProducerTemplate(org.apache.camel.ProducerTemplate) Deployment(org.activiti.engine.test.Deployment)

Example 20 with Deployment

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"));
}
Also used : CamelContext(org.apache.camel.CamelContext) Exchange(org.apache.camel.Exchange) ProducerTemplate(org.apache.camel.ProducerTemplate) Deployment(org.activiti.engine.test.Deployment)

Aggregations

Deployment (org.activiti.engine.test.Deployment)1020 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)709 Task (org.activiti.engine.task.Task)469 HashMap (java.util.HashMap)267 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)180 Execution (org.activiti.engine.runtime.Execution)106 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)87 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)84 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)83 Date (java.util.Date)82 Job (org.activiti.engine.runtime.Job)76 JsonNode (com.fasterxml.jackson.databind.JsonNode)66 Calendar (java.util.Calendar)54 StringEntity (org.apache.http.entity.StringEntity)50 HttpGet (org.apache.http.client.methods.HttpGet)49 ActivitiException (org.activiti.engine.ActivitiException)46 DelegateTask (org.activiti.engine.delegate.DelegateTask)40 ArrayList (java.util.ArrayList)39 HistoricActivityInstance (org.activiti.engine.history.HistoricActivityInstance)30 TaskQuery (org.activiti.engine.task.TaskQuery)29