use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class FormServiceTest method testTaskFormPropertyDefaultsAndFormRendering.
@Test
public void testTaskFormPropertyDefaultsAndFormRendering() {
final String deploymentId = testRule.deploy("org/camunda/bpm/engine/test/api/form/FormsProcess.bpmn20.xml", "org/camunda/bpm/engine/test/api/form/start.form", "org/camunda/bpm/engine/test/api/form/task.form").getId();
String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
StartFormData startForm = formService.getStartFormData(procDefId);
assertNotNull(startForm);
assertEquals(deploymentId, startForm.getDeploymentId());
assertEquals("org/camunda/bpm/engine/test/api/form/start.form", startForm.getFormKey());
assertEquals(new ArrayList<FormProperty>(), startForm.getFormProperties());
assertEquals(procDefId, startForm.getProcessDefinition().getId());
Object renderedStartForm = formService.getRenderedStartForm(procDefId, "juel");
assertEquals("start form content", renderedStartForm);
Map<String, String> properties = new HashMap<String, String>();
properties.put("room", "5b");
properties.put("speaker", "Mike");
String processInstanceId = formService.submitStartFormData(procDefId, properties).getId();
Map<String, Object> expectedVariables = new HashMap<String, Object>();
expectedVariables.put("room", "5b");
expectedVariables.put("speaker", "Mike");
Map<String, Object> variables = runtimeService.getVariables(processInstanceId);
assertEquals(expectedVariables, variables);
Task task = taskService.createTaskQuery().singleResult();
String taskId = task.getId();
TaskFormData taskForm = formService.getTaskFormData(taskId);
assertEquals(deploymentId, taskForm.getDeploymentId());
assertEquals("org/camunda/bpm/engine/test/api/form/task.form", taskForm.getFormKey());
assertEquals(new ArrayList<FormProperty>(), taskForm.getFormProperties());
assertEquals(taskId, taskForm.getTask().getId());
assertEquals("Mike is speaking in room 5b", formService.getRenderedTaskForm(taskId, "juel"));
properties = new HashMap<String, String>();
properties.put("room", "3f");
formService.submitTaskFormData(taskId, properties);
expectedVariables = new HashMap<String, Object>();
expectedVariables.put("room", "3f");
expectedVariables.put("speaker", "Mike");
variables = runtimeService.getVariables(processInstanceId);
assertEquals(expectedVariables, variables);
}
use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class FormServiceTest method testGetTaskFormKeyWithExpression.
@Deployment
@Test
public void testGetTaskFormKeyWithExpression() {
runtimeService.startProcessInstanceByKey("FormsProcess", CollectionUtil.singletonMap("dynamicKey", "test"));
Task task = taskService.createTaskQuery().singleResult();
assertNotNull(task);
assertEquals("test", formService.getTaskFormData(task.getId()).getFormKey());
}
use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class FormServiceTest method testSubmitTaskFormForCmmnHumanTask.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
@Test
public void testSubmitTaskFormForCmmnHumanTask() {
caseService.createCaseInstanceByKey("oneTaskCase");
Task task = taskService.createTaskQuery().singleResult();
String stringValue = "some string";
String serializedValue = "some value";
formService.submitTaskForm(task.getId(), createVariables().putValueTyped("boolean", booleanValue(null)).putValueTyped("string", stringValue(stringValue)).putValueTyped("serializedObject", serializedObjectValue(serializedValue).objectTypeName(String.class.getName()).serializationDataFormat(Variables.SerializationDataFormats.JAVA).create()).putValueTyped("object", objectValue(serializedValue).create()));
}
use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class FormServiceTest method testSubmitFormVariablesNull.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/form/FormsProcess.bpmn20.xml" })
@Test
public void testSubmitFormVariablesNull() {
String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
// assert that I can submit the start form with variables null
formService.submitStartForm(procDefId, null);
Task task = taskService.createTaskQuery().singleResult();
assertNotNull(task);
// assert that I can submit the task form with variables null
formService.submitTaskForm(task.getId(), null);
}
use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class HtmlFormEngineTest method testLegacyFormPropertySupportReadOnly.
@Deployment
public void testLegacyFormPropertySupportReadOnly() {
runtimeService.startProcessInstanceByKey("HtmlFormEngineTest.testLegacyFormPropertySupportReadOnly");
Task t = taskService.createTaskQuery().singleResult();
String renderedForm = (String) formService.getRenderedTaskForm(t.getId());
String expectedForm = IoUtil.readFileAsString("org/camunda/bpm/engine/test/api/form/HtmlFormEngineTest.testLegacyFormPropertySupportReadOnly.html");
assertHtmlEquals(expectedForm, renderedForm);
}
Aggregations