use of org.activiti.engine.test.Deployment in project Activiti by Activiti.
the class BusinessProcessBeanTest method testResolveTaskBean.
@Test
@Deployment(resources = "org/activiti/cdi/test/api/BusinessProcessBeanTest.test.bpmn20.xml")
public void testResolveTaskBean() {
BusinessProcess businessProcess = getBeanInstance(BusinessProcess.class);
assertNull(getBeanInstance(Task.class));
assertNull(getBeanInstance("taskId"));
businessProcess.startProcessByKey("businessProcessBeanTest");
String taskId = taskService.createTaskQuery().singleResult().getId();
businessProcess.startTask(taskId);
// assert that now we can resolve the Task-bean
assertEquals(taskId, getBeanInstance(Task.class).getId());
assertEquals(taskId, getBeanInstance("taskId"));
taskService.complete(taskService.createTaskQuery().singleResult().getId());
}
use of org.activiti.engine.test.Deployment in project Activiti by Activiti.
the class BusinessProcessBeanTest method testProcessWithoutWaitState.
@Test
@Deployment
public void testProcessWithoutWaitState() {
BusinessProcess businessProcess = getBeanInstance(BusinessProcess.class);
// start the process
businessProcess.startProcessByKey("businessProcessBeanTest").getId();
// assert that the process is ended:
assertNull(processEngine.getRuntimeService().createProcessInstanceQuery().singleResult());
}
use of org.activiti.engine.test.Deployment in project Activiti by Activiti.
the class InitiatorCamelCallTest method testInitiatorCamelCall.
@Deployment
public void testInitiatorCamelCall() throws Exception {
CamelContext ctx = applicationContext.getBean(CamelContext.class);
ProducerTemplate tpl = ctx.createProducerTemplate();
String body = "body text";
Exchange exchange = ctx.getEndpoint("direct:startWithInitiatorHeader").createExchange();
exchange.getIn().setBody(body);
tpl.send("direct:startWithInitiatorHeader", exchange);
String instanceId = (String) exchange.getProperty("PROCESS_ID_PROPERTY");
String initiator = (String) runtimeService.getVariable(instanceId, "initiator");
assertEquals("kermit", initiator);
Object camelInitiatorHeader = runtimeService.getVariable(instanceId, "CamelProcessInitiatorHeader");
assertNull(camelInitiatorHeader);
}
use of org.activiti.engine.test.Deployment in project Activiti by Activiti.
the class MultiInstanceTest method testRunProcess.
@Deployment(resources = { "process/multiinstanceReceive.bpmn20.xml" })
public void testRunProcess() throws Exception {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("miProcessExample");
List<Job> jobList = managementService.createJobQuery().list();
assertEquals(5, jobList.size());
assertEquals(5, runtimeService.createExecutionQuery().processInstanceId(processInstance.getId()).activityId("serviceTask1").count());
waitForJobExecutorToProcessAllJobs(3000, 500);
int counter = 0;
long processInstanceCount = 1;
while (processInstanceCount == 1 && counter < 20) {
Thread.sleep(500);
processInstanceCount = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).count();
counter++;
}
assertEquals(0, runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).count());
}
use of org.activiti.engine.test.Deployment in project Activiti by Activiti.
the class CamelExceptionTest method testHappyPathAsynchronous.
// check happy path in asynchronous camel call
@Deployment(resources = { "org/activiti/camel/exception/bpmnExceptionInRouteAsynchronous.bpmn20.xml" })
public void testHappyPathAsynchronous() {
// Signal ThrowBpmnExceptionBean to throw no exception
ThrowBpmnExceptionBean.setExceptionType(ThrowBpmnExceptionBean.ExceptionType.NO_EXCEPTION);
runtimeService.startProcessInstanceByKey("exceptionInRouteSynchron");
Job job = managementService.createJobQuery().singleResult();
managementService.executeJob(job.getId());
assertFalse(JobTestHelper.areJobsAvailable(managementService));
assertFalse(ExceptionServiceMock.isCalled());
assertTrue(NoExceptionServiceMock.isCalled());
}
Aggregations