use of org.activiti.engine.test.Deployment in project Activiti by Activiti.
the class HistoryServiceTest method testHistoricProcessInstanceQueryByDeploymentId.
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml", "org/activiti/engine/test/api/runtime/oneTaskProcess2.bpmn20.xml" })
public void testHistoricProcessInstanceQueryByDeploymentId() {
org.activiti.engine.repository.Deployment deployment = repositoryService.createDeploymentQuery().singleResult();
HashSet<String> processInstanceIds = new HashSet<String>();
for (int i = 0; i < 4; i++) {
processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess", i + "").getId());
}
processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess2", "1").getId());
HistoricProcessInstanceQuery processInstanceQuery = historyService.createHistoricProcessInstanceQuery().deploymentId(deployment.getId());
assertEquals(5, processInstanceQuery.count());
assertEquals(deployment.getId(), processInstanceQuery.list().get(0).getDeploymentId());
List<HistoricProcessInstance> processInstances = processInstanceQuery.list();
assertNotNull(processInstances);
assertEquals(5, processInstances.size());
processInstanceQuery = historyService.createHistoricProcessInstanceQuery().deploymentId("invalid");
assertEquals(0, processInstanceQuery.count());
}
use of org.activiti.engine.test.Deployment in project Activiti by Activiti.
the class HistoryServiceTest method testHistoricProcessInstanceQueryOrderBy.
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testHistoricProcessInstanceQueryOrderBy() {
// With a clean ProcessEngine, no instances should be available
assertTrue(historyService.createHistoricProcessInstanceQuery().count() == 0);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
List<Task> tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list();
assertEquals(1, tasks.size());
taskService.complete(tasks.get(0).getId());
historyService.createHistoricTaskInstanceQuery().orderByDeleteReason().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByExecutionId().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByHistoricActivityInstanceId().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByHistoricTaskInstanceStartTime().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByHistoricTaskInstanceDuration().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByHistoricTaskInstanceEndTime().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByProcessDefinitionId().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByProcessInstanceId().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByTaskAssignee().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByTaskDefinitionKey().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByTaskDescription().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByTaskId().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByTaskName().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByTaskOwner().asc().list();
historyService.createHistoricTaskInstanceQuery().orderByTaskPriority().asc().list();
}
use of org.activiti.engine.test.Deployment in project Activiti by Activiti.
the class HistoryServiceTest method testHistoricTaskInstanceOrQueryByDeploymentId.
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml", "org/activiti/engine/test/api/runtime/oneTaskProcess2.bpmn20.xml" })
public void testHistoricTaskInstanceOrQueryByDeploymentId() {
org.activiti.engine.repository.Deployment deployment = repositoryService.createDeploymentQuery().singleResult();
HashSet<String> processInstanceIds = new HashSet<String>();
for (int i = 0; i < 4; i++) {
processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess", i + "").getId());
}
processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess2", "1").getId());
HistoricTaskInstanceQuery taskInstanceQuery = historyService.createHistoricTaskInstanceQuery().or().deploymentId(deployment.getId()).endOr();
assertEquals(5, taskInstanceQuery.count());
List<HistoricTaskInstance> taskInstances = taskInstanceQuery.list();
assertNotNull(taskInstances);
assertEquals(5, taskInstances.size());
taskInstanceQuery = historyService.createHistoricTaskInstanceQuery().or().deploymentId("invalid").endOr();
assertEquals(0, taskInstanceQuery.count());
taskInstanceQuery = historyService.createHistoricTaskInstanceQuery().or().taskDefinitionKey("theTask").deploymentId("invalid").endOr();
assertEquals(5, taskInstanceQuery.count());
taskInstanceQuery = historyService.createHistoricTaskInstanceQuery().taskDefinitionKey("theTask").or().deploymentId("invalid").endOr();
assertEquals(0, taskInstanceQuery.count());
taskInstanceQuery = historyService.createHistoricTaskInstanceQuery().or().taskDefinitionKey("theTask").deploymentId("invalid").endOr().or().processDefinitionKey("oneTaskProcess").processDefinitionId("invalid").endOr();
assertEquals(4, taskInstanceQuery.count());
taskInstanceQuery = historyService.createHistoricTaskInstanceQuery().or().taskDefinitionKey("theTask").deploymentId("invalid").endOr().or().processDefinitionKey("oneTaskProcess2").processDefinitionId("invalid").endOr();
assertEquals(1, taskInstanceQuery.count());
taskInstanceQuery = historyService.createHistoricTaskInstanceQuery().or().taskDefinitionKey("theTask").deploymentId("invalid").endOr().or().processDefinitionKey("oneTaskProcess").processDefinitionId("invalid").endOr().processInstanceBusinessKey("1");
assertEquals(1, taskInstanceQuery.count());
taskInstanceQuery = historyService.createHistoricTaskInstanceQuery().or().taskDefinitionKey("theTask").deploymentId("invalid").endOr().or().processDefinitionKey("oneTaskProcess2").processDefinitionId("invalid").endOr().processInstanceBusinessKey("1");
assertEquals(1, taskInstanceQuery.count());
taskInstanceQuery = historyService.createHistoricTaskInstanceQuery().or().taskDefinitionKey("theTask").deploymentId("invalid").endOr().or().processDefinitionKey("oneTaskProcess2").processDefinitionId("invalid").endOr().processInstanceBusinessKey("2");
assertEquals(0, taskInstanceQuery.count());
}
use of org.activiti.engine.test.Deployment in project Activiti by Activiti.
the class HistoryServiceTest method testHistoricVariableInstancesOnParallelExecution.
@Deployment(resources = { "org/activiti/engine/test/api/runtime/concurrentExecution.bpmn20.xml" })
public void testHistoricVariableInstancesOnParallelExecution() {
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("rootValue", "test");
ProcessInstance pi = runtimeService.startProcessInstanceByKey("concurrent", vars);
List<Task> tasks = taskService.createTaskQuery().processInstanceId(pi.getId()).list();
for (Task task : tasks) {
Map<String, Object> variables = new HashMap<String, Object>();
// set token local variable
log.debug("setting variables on task {}, execution {}", task.getId(), task.getExecutionId());
runtimeService.setVariableLocal(task.getExecutionId(), "parallelValue1", task.getName());
runtimeService.setVariableLocal(task.getExecutionId(), "parallelValue2", "test");
taskService.complete(task.getId(), variables);
}
taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId());
assertEquals(1, historyService.createHistoricProcessInstanceQuery().variableValueEquals("rootValue", "test").count());
assertEquals(1, historyService.createHistoricProcessInstanceQuery().variableValueEquals("parallelValue1", "Receive Payment").count());
assertEquals(1, historyService.createHistoricProcessInstanceQuery().variableValueEquals("parallelValue1", "Ship Order").count());
assertEquals(1, historyService.createHistoricProcessInstanceQuery().variableValueEquals("parallelValue2", "test").count());
}
use of org.activiti.engine.test.Deployment in project Activiti by Activiti.
the class LaneExtensionTest method testLaneExtensionElement.
@Test
@Deployment
public void testLaneExtensionElement() {
ProcessDefinition processDefinition = activitiRule.getRepositoryService().createProcessDefinitionQuery().processDefinitionKey("swimlane-extension").singleResult();
BpmnModel bpmnModel = activitiRule.getRepositoryService().getBpmnModel(processDefinition.getId());
byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel);
System.out.println(new String(xml));
Process bpmnProcess = bpmnModel.getMainProcess();
for (Lane l : bpmnProcess.getLanes()) {
Map<String, List<ExtensionElement>> extensions = l.getExtensionElements();
Assert.assertTrue(extensions.size() > 0);
}
}
Aggregations