use of org.camunda.bpm.engine.runtime.ProcessInstance in project camunda-bpm-platform by camunda.
the class FormServiceTest method testSubmitTaskFormContainingReadonlyVariable.
@Deployment
@Test
public void testSubmitTaskFormContainingReadonlyVariable() {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId());
Task task = taskService.createTaskQuery().singleResult();
assertNotNull(task);
formService.submitTaskForm(task.getId(), new HashMap<String, Object>());
testRule.assertProcessEnded(processInstance.getId());
}
use of org.camunda.bpm.engine.runtime.ProcessInstance in project camunda-bpm-platform by camunda.
the class FormServiceTest method testSubmitStartFormWithBusinessKey.
@Deployment
@Test
public void testSubmitStartFormWithBusinessKey() {
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("duration", 45L);
properties.put("speaker", "Mike");
String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
ProcessInstance processInstance = formService.submitStartForm(procDefId, "123", properties);
assertEquals("123", processInstance.getBusinessKey());
assertEquals(processInstance.getId(), runtimeService.createProcessInstanceQuery().processInstanceBusinessKey("123").singleResult().getId());
Map<String, Object> variables = runtimeService.getVariables(processInstance.getId());
assertEquals("Mike", variables.get("SpeakerName"));
assertEquals(45L, variables.get("duration"));
}
use of org.camunda.bpm.engine.runtime.ProcessInstance in project camunda-bpm-platform by camunda.
the class FormServiceTest method testSubmitStartFormWithFormFieldMarkedAsBusinessKey.
@Deployment
@Test
public void testSubmitStartFormWithFormFieldMarkedAsBusinessKey() {
String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
ProcessInstance pi = formService.submitStartForm(procDefId, "foo", Variables.createVariables().putValue("secondParam", "bar"));
assertEquals("foo", pi.getBusinessKey());
List<VariableInstance> result = runtimeService.createVariableInstanceQuery().list();
assertEquals(1, result.size());
assertTrue(result.get(0).getName().equals("secondParam"));
}
use of org.camunda.bpm.engine.runtime.ProcessInstance in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testExtendTaskQueryByOrderByProcessVariable.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testExtendTaskQueryByOrderByProcessVariable() {
ProcessInstance instance500 = runtimeService.startProcessInstanceByKey("oneTaskProcess", Variables.createVariables().putValue("var", 500));
ProcessInstance instance1000 = runtimeService.startProcessInstanceByKey("oneTaskProcess", Variables.createVariables().putValue("var", 1000));
ProcessInstance instance250 = runtimeService.startProcessInstanceByKey("oneTaskProcess", Variables.createVariables().putValue("var", 250));
TaskQuery query = taskService.createTaskQuery().processDefinitionKey("oneTaskProcess");
saveQuery(query);
// asc
TaskQuery extendingQuery = taskService.createTaskQuery().orderByProcessVariable("var", ValueType.INTEGER).asc();
List<Task> tasks = filterService.list(filter.getId(), extendingQuery);
assertEquals(3, tasks.size());
assertEquals(instance250.getId(), tasks.get(0).getProcessInstanceId());
assertEquals(instance500.getId(), tasks.get(1).getProcessInstanceId());
assertEquals(instance1000.getId(), tasks.get(2).getProcessInstanceId());
// desc
extendingQuery = taskService.createTaskQuery().orderByProcessVariable("var", ValueType.INTEGER).desc();
tasks = filterService.list(filter.getId(), extendingQuery);
assertEquals(3, tasks.size());
assertEquals(instance1000.getId(), tasks.get(0).getProcessInstanceId());
assertEquals(instance500.getId(), tasks.get(1).getProcessInstanceId());
assertEquals(instance250.getId(), tasks.get(2).getProcessInstanceId());
runtimeService.deleteProcessInstance(instance250.getId(), null);
runtimeService.deleteProcessInstance(instance500.getId(), null);
runtimeService.deleteProcessInstance(instance1000.getId(), null);
}
use of org.camunda.bpm.engine.runtime.ProcessInstance in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testInitializeFormKeysEnabled.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/task/oneTaskWithFormKeyProcess.bpmn20.xml" })
public void testInitializeFormKeysEnabled() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess");
TaskQuery query = taskService.createTaskQuery().processInstanceId(processInstance.getId());
saveQuery(query);
Task task = (Task) filterService.list(filter.getId()).get(0);
assertEquals("exampleFormKey", task.getFormKey());
task = filterService.singleResult(filter.getId());
assertEquals("exampleFormKey", task.getFormKey());
runtimeService.deleteProcessInstance(processInstance.getId(), "test");
}
Aggregations