use of org.camunda.bpm.model.bpmn.instance.UserTask in project camunda-bpmn-model by camunda.
the class ResourceRolesTest method testGetPerformer.
@Test
public void testGetPerformer() {
UserTask userTask = modelInstance.getModelElementById("_3");
Collection<ResourceRole> resourceRoles = userTask.getResourceRoles();
assertThat(resourceRoles.size()).isEqualTo(1);
ResourceRole resourceRole = resourceRoles.iterator().next();
assertThat(resourceRole instanceof Performer).isTrue();
assertThat(resourceRole.getName()).isEqualTo("Task performer");
}
use of org.camunda.bpm.model.bpmn.instance.UserTask in project camunda-bpmn-model by camunda.
the class UserTaskImpl method registerType.
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(UserTask.class, BPMN_ELEMENT_USER_TASK).namespaceUri(BPMN20_NS).extendsType(Task.class).instanceProvider(new ModelTypeInstanceProvider<UserTask>() {
public UserTask newInstance(ModelTypeInstanceContext instanceContext) {
return new UserTaskImpl(instanceContext);
}
});
implementationAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_IMPLEMENTATION).defaultValue("##unspecified").build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
renderingCollection = sequenceBuilder.elementCollection(Rendering.class).build();
/**
* camunda extensions
*/
camundaAssigneeAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_ASSIGNEE).namespace(CAMUNDA_NS).build();
camundaCandidateGroupsAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CANDIDATE_GROUPS).namespace(CAMUNDA_NS).build();
camundaCandidateUsersAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CANDIDATE_USERS).namespace(CAMUNDA_NS).build();
camundaDueDateAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_DUE_DATE).namespace(CAMUNDA_NS).build();
camundaFollowUpDateAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_FOLLOW_UP_DATE).namespace(CAMUNDA_NS).build();
camundaFormHandlerClassAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_FORM_HANDLER_CLASS).namespace(CAMUNDA_NS).build();
camundaFormKeyAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_FORM_KEY).namespace(CAMUNDA_NS).build();
camundaPriorityAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_PRIORITY).namespace(CAMUNDA_NS).build();
typeBuilder.build();
}
use of org.camunda.bpm.model.bpmn.instance.UserTask in project camunda-bpm-platform by camunda.
the class MigrationAddSubprocessTest method testConcurrentThreeUserTaskMigration.
@Test
public void testConcurrentThreeUserTaskMigration() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(modify(ProcessModels.PARALLEL_GATEWAY_PROCESS).getBuilderForElementById("fork", ParallelGatewayBuilder.class).userTask("userTask3").endEvent().done());
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(ProcessModels.PARALLEL_GATEWAY_SUBPROCESS_PROCESS).getBuilderForElementById("fork", ParallelGatewayBuilder.class).userTask("userTask3").endEvent().done());
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("userTask1", "userTask2").mapActivities("userTask2", "userTask3").mapActivities("userTask3", "userTask1").build();
// when
testHelper.createProcessInstanceAndMigrate(migrationPlan);
// then
testHelper.assertExecutionTreeAfterMigration().hasProcessDefinitionId(targetProcessDefinition.getId()).matches(describeExecutionTree(null).scope().id(testHelper.snapshotBeforeMigration.getProcessInstanceId()).child(null).scope().child("userTask1").concurrent().noScope().up().child("userTask2").concurrent().noScope().up().child("userTask3").concurrent().noScope().done());
testHelper.assertActivityTreeAfterMigration().hasStructure(describeActivityInstanceTree(targetProcessDefinition.getId()).beginScope("subProcess").activity("userTask1", testHelper.getSingleActivityInstanceBeforeMigration("userTask3").getId()).activity("userTask2", testHelper.getSingleActivityInstanceBeforeMigration("userTask1").getId()).activity("userTask3", testHelper.getSingleActivityInstanceBeforeMigration("userTask2").getId()).done());
List<Task> migratedTasks = testHelper.snapshotAfterMigration.getTasks();
assertEquals(3, migratedTasks.size());
for (Task migratedTask : migratedTasks) {
assertEquals(targetProcessDefinition.getId(), migratedTask.getProcessDefinitionId());
}
// and it is possible to successfully complete the migrated instance
for (Task migratedTask : migratedTasks) {
rule.getTaskService().complete(migratedTask.getId());
}
testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
use of org.camunda.bpm.model.bpmn.instance.UserTask in project camunda-bpm-platform by camunda.
the class MigrationAddSubprocessTest method testAddTwoScopes.
@Test
public void testAddTwoScopes() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.DOUBLE_SUBPROCESS_PROCESS);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("userTask", "userTask").build();
// when
testHelper.createProcessInstanceAndMigrate(migrationPlan);
// then
testHelper.assertExecutionTreeAfterMigration().hasProcessDefinitionId(targetProcessDefinition.getId()).matches(describeExecutionTree(null).scope().id(testHelper.snapshotBeforeMigration.getProcessInstanceId()).child(null).scope().child("userTask").scope().done());
testHelper.assertActivityTreeAfterMigration().hasStructure(describeActivityInstanceTree(targetProcessDefinition.getId()).beginScope("outerSubProcess").beginScope("innerSubProcess").activity("userTask", testHelper.getSingleActivityInstanceBeforeMigration("userTask").getId()).done());
Task migratedTask = testHelper.snapshotAfterMigration.getTaskForKey("userTask");
Assert.assertNotNull(migratedTask);
assertEquals(targetProcessDefinition.getId(), migratedTask.getProcessDefinitionId());
// and it is possible to successfully complete the migrated instance
rule.getTaskService().complete(migratedTask.getId());
testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
use of org.camunda.bpm.model.bpmn.instance.UserTask in project camunda-bpm-platform by camunda.
the class MigrationAddSubprocessTest method testNestedScopesMigration1.
@Test
public void testNestedScopesMigration1() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.SUBPROCESS_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.DOUBLE_SUBPROCESS_PROCESS);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("userTask", "userTask").mapActivities("subProcess", "outerSubProcess").build();
// when
testHelper.createProcessInstanceAndMigrate(migrationPlan);
// then
testHelper.assertExecutionTreeAfterMigration().hasProcessDefinitionId(targetProcessDefinition.getId()).matches(describeExecutionTree(null).scope().id(testHelper.snapshotBeforeMigration.getProcessInstanceId()).child(null).scope().id(testHelper.getSingleExecutionIdForActivityBeforeMigration("subProcess")).child("userTask").scope().done());
testHelper.assertActivityTreeAfterMigration().hasStructure(describeActivityInstanceTree(targetProcessDefinition.getId()).beginScope("outerSubProcess", testHelper.getSingleActivityInstanceBeforeMigration("subProcess").getId()).beginScope("innerSubProcess").activity("userTask", testHelper.getSingleActivityInstanceBeforeMigration("userTask").getId()).done());
Task migratedTask = testHelper.snapshotAfterMigration.getTaskForKey("userTask");
Assert.assertNotNull(migratedTask);
assertEquals(targetProcessDefinition.getId(), migratedTask.getProcessDefinitionId());
// and it is possible to successfully complete the migrated instance
rule.getTaskService().complete(migratedTask.getId());
testHelper.assertProcessEnded(testHelper.snapshotBeforeMigration.getProcessInstanceId());
}
Aggregations