use of org.camunda.bpm.model.bpmn.instance.UserTask in project camunda-bpmn-model by camunda.
the class ResourceRolesTest method testGetPotentialOwner.
@Test
public void testGetPotentialOwner() {
UserTask userTask = modelInstance.getModelElementById("_9");
Collection<ResourceRole> resourceRoles = userTask.getResourceRoles();
assertThat(resourceRoles.size()).isEqualTo(1);
ResourceRole resourceRole = resourceRoles.iterator().next();
assertThat(resourceRole instanceof PotentialOwner).isTrue();
assertThat(resourceRole.getName()).isEqualTo("Task potential owner");
}
use of org.camunda.bpm.model.bpmn.instance.UserTask in project camunda-bpmn-model by camunda.
the class ResourceRolesTest method testGetHumanPerformer.
@Test
public void testGetHumanPerformer() {
UserTask userTask = modelInstance.getModelElementById("_7");
Collection<ResourceRole> resourceRoles = userTask.getResourceRoles();
assertThat(resourceRoles.size()).isEqualTo(1);
ResourceRole resourceRole = resourceRoles.iterator().next();
assertThat(resourceRole instanceof HumanPerformer).isTrue();
assertThat(resourceRole.getName()).isEqualTo("Task human performer");
}
use of org.camunda.bpm.model.bpmn.instance.UserTask in project camunda-bpmn-model by camunda.
the class GenerateIdTest method shouldNotGenerateIdsOnRead.
@Test
public void shouldNotGenerateIdsOnRead() {
BpmnModelInstance modelInstance = Bpmn.readModelFromStream(GenerateIdTest.class.getResourceAsStream("GenerateIdTest.bpmn"));
Definitions definitions = modelInstance.getDefinitions();
assertThat(definitions.getId()).isNull();
Process process = modelInstance.getModelElementsByType(Process.class).iterator().next();
assertThat(process.getId()).isNull();
StartEvent startEvent = modelInstance.getModelElementsByType(StartEvent.class).iterator().next();
assertThat(startEvent.getId()).isNull();
UserTask userTask = modelInstance.getModelElementsByType(UserTask.class).iterator().next();
assertThat(userTask.getId()).isNull();
}
use of org.camunda.bpm.model.bpmn.instance.UserTask in project camunda-bpm-platform by camunda.
the class MigrationUserTaskTest method addTaskListener.
protected static void addTaskListener(BpmnModelInstance targetModel, String activityId, String event, String className) {
CamundaTaskListener taskListener = targetModel.newInstance(CamundaTaskListener.class);
taskListener.setCamundaClass(className);
taskListener.setCamundaEvent(event);
UserTask task = targetModel.getModelElementById(activityId);
task.builder().addExtensionElement(taskListener);
}
use of org.camunda.bpm.model.bpmn.instance.UserTask in project camunda-bpm-platform by camunda.
the class MigrationUserTaskTest method testAccessModelInTaskListenerAfterMigration.
@Test
public void testAccessModelInTaskListenerAfterMigration() {
BpmnModelInstance targetModel = modify(ProcessModels.ONE_TASK_PROCESS).changeElementId("userTask", "newUserTask");
addTaskListener(targetModel, "newUserTask", TaskListener.EVENTNAME_ASSIGNMENT, AccessModelInstanceTaskListener.class.getName());
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(targetModel);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("userTask", "newUserTask").build();
ProcessInstance processInstance = rule.getRuntimeService().startProcessInstanceById(sourceProcessDefinition.getId());
testHelper.migrateProcessInstance(migrationPlan, processInstance);
// when
Task task = rule.getTaskService().createTaskQuery().singleResult();
rule.getTaskService().setAssignee(task.getId(), "foo");
// then the task listener was able to access the bpmn model instance and set a variable
String variableValue = (String) rule.getRuntimeService().getVariable(processInstance.getId(), AccessModelInstanceTaskListener.VARIABLE_NAME);
Assert.assertEquals("newUserTask", variableValue);
}
Aggregations