use of org.camunda.bpm.engine.impl.task.TaskDefinition in project camunda-bpm-platform by camunda.
the class HumanTaskPlanItemHandlerTest method testTaskDefinitionFollowUpDateExpression.
@Test
public void testTaskDefinitionFollowUpDateExpression() {
// given
String aFollowUpDate = "aFollowDate";
humanTask.setCamundaFollowUpDate(aFollowUpDate);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
TaskDefinition taskDefinition = behavior.getTaskDefinition();
Expression followUpDateExpression = taskDefinition.getFollowUpDateExpression();
assertNotNull(followUpDateExpression);
assertEquals(aFollowUpDate, followUpDateExpression.getExpressionText());
}
use of org.camunda.bpm.engine.impl.task.TaskDefinition in project camunda-bpm-platform by camunda.
the class HumanTaskPlanItemHandlerTest method testDeleteTaskListenerByDelegateExpression.
@Test
public void testDeleteTaskListenerByDelegateExpression() {
// given:
ExtensionElements extensionElements = addExtensionElements(humanTask);
CamundaTaskListener taskListener = createElement(extensionElements, null, CamundaTaskListener.class);
String delegateExpression = "${myDelegateExpression}";
String event = TaskListener.EVENTNAME_DELETE;
taskListener.setCamundaEvent(event);
taskListener.setCamundaDelegateExpression(delegateExpression);
// 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 DelegateExpressionTaskListener);
DelegateExpressionTaskListener delegateExpressionListener = (DelegateExpressionTaskListener) listener;
assertEquals(delegateExpression, delegateExpressionListener.getExpressionText());
assertTrue(delegateExpressionListener.getFieldDeclarations().isEmpty());
}
use of org.camunda.bpm.engine.impl.task.TaskDefinition in project camunda-bpm-platform by camunda.
the class CmmnElementHandlerTest method setup.
@Before
public void setup() {
modelInstance = Cmmn.createEmptyModel();
definitions = modelInstance.newInstance(Definitions.class);
definitions.setTargetNamespace("http://camunda.org/examples");
modelInstance.setDefinitions(definitions);
caseDefinition = createElement(definitions, "aCaseDefinition", Case.class);
casePlanModel = createElement(caseDefinition, "aCasePlanModel", CasePlanModel.class);
context = new CmmnHandlerContext();
CaseDefinitionEntity caseDefinition = new CaseDefinitionEntity();
caseDefinition.setTaskDefinitions(new HashMap<String, TaskDefinition>());
context.setCaseDefinition(caseDefinition);
ExpressionManager expressionManager = new ExpressionManager();
context.setExpressionManager(expressionManager);
}
use of org.camunda.bpm.engine.impl.task.TaskDefinition in project camunda-bpm-platform by camunda.
the class TaskDecoratorTest method setUp.
public void setUp() {
task = (TaskEntity) taskService.newTask();
taskService.saveTask(task);
expressionManager = processEngineConfiguration.getExpressionManager();
taskDefinition = new TaskDefinition(null);
taskDecorator = new TaskDecorator(taskDefinition, expressionManager);
}
use of org.camunda.bpm.engine.impl.task.TaskDefinition in project camunda-bpm-platform by camunda.
the class EntitySerializationTest method testTaskEntitySerialization.
public void testTaskEntitySerialization() throws Exception {
TaskEntity task = new TaskEntity();
task.setDelegationState(DelegationState.RESOLVED);
task.setExecution(new ExecutionEntity());
task.setProcessInstance(new ExecutionEntity());
task.setTaskDefinition(new TaskDefinition(null));
task.setAssignee("kermit");
task.setCreateTime(new Date());
task.setDescription("Test description");
task.setDueDate(new Date());
task.setName("myTask");
task.setEventName("end");
task.setDeleted(false);
task.setDelegationStateString(DelegationState.RESOLVED.name());
byte[] data = writeObject(task);
task = (TaskEntity) readObject(data);
assertEquals("kermit", task.getAssignee());
assertEquals("myTask", task.getName());
assertEquals("end", task.getEventName());
}
Aggregations