Search in sources :

Example 46 with Task

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);
}
Also used : Task(org.camunda.bpm.engine.task.Task) FormProperty(org.camunda.bpm.engine.form.FormProperty) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) StartFormData(org.camunda.bpm.engine.form.StartFormData) TaskFormData(org.camunda.bpm.engine.form.TaskFormData) Test(org.junit.Test)

Example 47 with Task

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());
}
Also used : Task(org.camunda.bpm.engine.task.Task) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 48 with Task

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()));
}
Also used : Task(org.camunda.bpm.engine.task.Task) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 49 with Task

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);
}
Also used : Task(org.camunda.bpm.engine.task.Task) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 50 with Task

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);
}
Also used : Task(org.camunda.bpm.engine.task.Task) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

Task (org.camunda.bpm.engine.task.Task)1654 Deployment (org.camunda.bpm.engine.test.Deployment)788 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)660 Test (org.junit.Test)648 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)230 ScenarioUnderTest (org.camunda.bpm.qa.upgrade.ScenarioUnderTest)190 HashMap (java.util.HashMap)140 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)139 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)108 Execution (org.camunda.bpm.engine.runtime.Execution)99 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)98 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)87 Job (org.camunda.bpm.engine.runtime.Job)71 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)67 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)52 DescribesScenario (org.camunda.bpm.qa.upgrade.DescribesScenario)46 ScenarioSetup (org.camunda.bpm.qa.upgrade.ScenarioSetup)46 Times (org.camunda.bpm.qa.upgrade.Times)46 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)45 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)45