use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class HumanTaskPlanItemHandlerTest method testDeleteTaskListenerByClass.
@Test
public void testDeleteTaskListenerByClass() {
// given:
ExtensionElements extensionElements = addExtensionElements(humanTask);
CamundaTaskListener taskListener = createElement(extensionElements, null, CamundaTaskListener.class);
String className = "org.camunda.bpm.test.tasklistener.ABC";
String event = TaskListener.EVENTNAME_DELETE;
taskListener.setCamundaEvent(event);
taskListener.setCamundaClass(className);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
assertEquals(0, activity.getListeners().size());
HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
TaskDefinition taskDefinition = behavior.getTaskDefinition();
assertNotNull(taskDefinition);
assertEquals(1, taskDefinition.getTaskListeners().size());
List<TaskListener> createListeners = taskDefinition.getTaskListeners(event);
assertEquals(1, createListeners.size());
TaskListener listener = createListeners.get(0);
assertTrue(listener instanceof ClassDelegateTaskListener);
ClassDelegateTaskListener classDelegateListener = (ClassDelegateTaskListener) listener;
assertEquals(className, classDelegateListener.getClassName());
assertTrue(classDelegateListener.getFieldDeclarations().isEmpty());
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class HumanTaskPlanItemHandlerTest method testCreateTaskListenerByClass.
@Test
public void testCreateTaskListenerByClass() {
// given:
ExtensionElements extensionElements = addExtensionElements(humanTask);
CamundaTaskListener taskListener = createElement(extensionElements, null, CamundaTaskListener.class);
String className = "org.camunda.bpm.test.tasklistener.ABC";
String event = TaskListener.EVENTNAME_CREATE;
taskListener.setCamundaEvent(event);
taskListener.setCamundaClass(className);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
assertEquals(0, activity.getListeners().size());
HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
TaskDefinition taskDefinition = behavior.getTaskDefinition();
assertNotNull(taskDefinition);
assertEquals(1, taskDefinition.getTaskListeners().size());
List<TaskListener> createListeners = taskDefinition.getTaskListeners(event);
assertEquals(1, createListeners.size());
TaskListener listener = createListeners.get(0);
assertTrue(listener instanceof ClassDelegateTaskListener);
ClassDelegateTaskListener classDelegateListener = (ClassDelegateTaskListener) listener;
assertEquals(className, classDelegateListener.getClassName());
assertTrue(classDelegateListener.getFieldDeclarations().isEmpty());
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class HumanTaskPlanItemHandlerTest method testCompleteTaskListenerByClass.
@Test
public void testCompleteTaskListenerByClass() {
// given:
ExtensionElements extensionElements = addExtensionElements(humanTask);
CamundaTaskListener taskListener = createElement(extensionElements, null, CamundaTaskListener.class);
String className = "org.camunda.bpm.test.tasklistener.ABC";
String event = TaskListener.EVENTNAME_COMPLETE;
taskListener.setCamundaEvent(event);
taskListener.setCamundaClass(className);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
assertEquals(0, activity.getListeners().size());
HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
TaskDefinition taskDefinition = behavior.getTaskDefinition();
assertNotNull(taskDefinition);
assertEquals(1, taskDefinition.getTaskListeners().size());
List<TaskListener> createListeners = taskDefinition.getTaskListeners(event);
assertEquals(1, createListeners.size());
TaskListener listener = createListeners.get(0);
assertTrue(listener instanceof ClassDelegateTaskListener);
ClassDelegateTaskListener classDelegateListener = (ClassDelegateTaskListener) listener;
assertEquals(className, classDelegateListener.getClassName());
assertTrue(classDelegateListener.getFieldDeclarations().isEmpty());
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class HumanTaskPlanItemHandlerTest method testTaskDefinitionPeformerExpression.
@Test
public void testTaskDefinitionPeformerExpression() {
// given
CaseRole role = createElement(caseDefinition, "aRole", CaseRole.class);
role.setName("aPerformerRole");
humanTask.setPerformer(role);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
TaskDefinition taskDefinition = behavior.getTaskDefinition();
Expression assigneeExpression = taskDefinition.getAssigneeExpression();
assertNotNull(assigneeExpression);
assertEquals("aPerformerRole", assigneeExpression.getExpressionText());
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class HumanTaskPlanItemHandlerTest method testTaskDefinitionAssigneeExpression.
@Test
public void testTaskDefinitionAssigneeExpression() {
// given
String aPriority = "aPriority";
humanTask.setCamundaPriority(aPriority);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
TaskDefinition taskDefinition = behavior.getTaskDefinition();
Expression priorityExpression = taskDefinition.getPriorityExpression();
assertNotNull(priorityExpression);
assertEquals(aPriority, priorityExpression.getExpressionText());
}
Aggregations