use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class FilterTaskQueryTest method testExecuteTaskQueryListPage.
public void testExecuteTaskQueryListPage() {
TaskQuery query = taskService.createTaskQuery();
query.taskNameLike("Task%");
saveQuery(query);
List<Task> tasks = filterService.listPage(filter.getId(), 1, 2);
assertEquals(2, tasks.size());
for (Task task : tasks) {
assertEquals(testUser.getId(), task.getOwner());
}
}
use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class FormPropertyDefaultValueTest method testDefaultValue.
@Deployment
public void testDefaultValue() throws Exception {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("FormPropertyDefaultValueTest.testDefaultValue");
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
TaskFormData formData = formService.getTaskFormData(task.getId());
List<FormProperty> formProperties = formData.getFormProperties();
assertEquals(4, formProperties.size());
for (FormProperty prop : formProperties) {
if ("booleanProperty".equals(prop.getId())) {
assertEquals("true", prop.getValue());
} else if ("stringProperty".equals(prop.getId())) {
assertEquals("someString", prop.getValue());
} else if ("longProperty".equals(prop.getId())) {
assertEquals("42", prop.getValue());
} else if ("longExpressionProperty".equals(prop.getId())) {
assertEquals("23", prop.getValue());
} else {
assertTrue("Invalid form property: " + prop.getId(), false);
}
}
Map<String, String> formDataUpdate = new HashMap<String, String>();
formDataUpdate.put("longExpressionProperty", "1");
formDataUpdate.put("booleanProperty", "false");
formService.submitTaskFormData(task.getId(), formDataUpdate);
assertEquals(false, runtimeService.getVariable(processInstance.getId(), "booleanProperty"));
assertEquals("someString", runtimeService.getVariable(processInstance.getId(), "stringProperty"));
assertEquals(42L, runtimeService.getVariable(processInstance.getId(), "longProperty"));
assertEquals(1L, runtimeService.getVariable(processInstance.getId(), "longExpressionProperty"));
}
use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class FormServiceTest method testGetTaskFormKey.
@Deployment(resources = "org/camunda/bpm/engine/test/api/form/FormsProcess.bpmn20.xml")
@Test
public void testGetTaskFormKey() {
String processDefinitionId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
runtimeService.startProcessInstanceById(processDefinitionId);
Task task = taskService.createTaskQuery().singleResult();
assertNotNull(task);
String expectedFormKey = formService.getTaskFormData(task.getId()).getFormKey();
String actualFormKey = formService.getTaskFormKey(task.getProcessDefinitionId(), task.getTaskDefinitionKey());
assertEquals(expectedFormKey, actualFormKey);
}
use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class FormServiceTest method testSubmitTaskFormForStandaloneTask.
@Test
public void testSubmitTaskFormForStandaloneTask() {
// given
String id = "standaloneTask";
Task task = taskService.newTask(id);
taskService.saveTask(task);
// when
formService.submitTaskForm(task.getId(), Variables.createVariables().putValue("foo", "bar"));
if (processEngineConfiguration.getHistoryLevel().getId() >= HistoryLevel.HISTORY_LEVEL_AUDIT.getId()) {
HistoricVariableInstance variableInstance = historyService.createHistoricVariableInstanceQuery().taskIdIn(id).singleResult();
assertNotNull(variableInstance);
assertEquals("foo", variableInstance.getName());
assertEquals("bar", variableInstance.getValue());
}
taskService.deleteTask(id, true);
}
use of org.camunda.bpm.engine.task.Task 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());
}
Aggregations