Search in sources :

Example 31 with TaskDefinition

use of org.camunda.bpm.engine.impl.task.TaskDefinition in project camunda-bpm-platform by camunda.

the class HumanTaskPlanItemHandlerTest method testTaskDefinitionPlanItemNameExpression.

@Test
public void testTaskDefinitionPlanItemNameExpression() {
    // given
    String name = "A HumanTask";
    humanTask.setName(name);
    String planItemName = "My LocalName";
    planItem.setName(planItemName);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
    TaskDefinition taskDefinition = behavior.getTaskDefinition();
    Expression nameExpression = taskDefinition.getNameExpression();
    assertNotNull(nameExpression);
    assertEquals("My LocalName", nameExpression.getExpressionText());
}
Also used : TaskDefinition(org.camunda.bpm.engine.impl.task.TaskDefinition) Expression(org.camunda.bpm.engine.delegate.Expression) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) HumanTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.HumanTaskActivityBehavior) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Example 32 with TaskDefinition

use of org.camunda.bpm.engine.impl.task.TaskDefinition in project camunda-bpm-platform by camunda.

the class HumanTaskPlanItemHandlerTest method testTaskDefinitionDueDateExpression.

@Test
public void testTaskDefinitionDueDateExpression() {
    // given
    String aDueDate = "aDueDate";
    humanTask.setCamundaDueDate(aDueDate);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
    TaskDefinition taskDefinition = behavior.getTaskDefinition();
    Expression dueDateExpression = taskDefinition.getDueDateExpression();
    assertNotNull(dueDateExpression);
    assertEquals(aDueDate, dueDateExpression.getExpressionText());
}
Also used : TaskDefinition(org.camunda.bpm.engine.impl.task.TaskDefinition) Expression(org.camunda.bpm.engine.delegate.Expression) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) HumanTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.HumanTaskActivityBehavior) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Example 33 with TaskDefinition

use of org.camunda.bpm.engine.impl.task.TaskDefinition in project camunda-bpm-platform by camunda.

the class HumanTaskPlanItemHandlerTest method testTaskDefinitionFormKey.

@Test
public void testTaskDefinitionFormKey() {
    // given
    String aFormKey = "aFormKey";
    humanTask.setCamundaFormKey(aFormKey);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
    TaskDefinition taskDefinition = behavior.getTaskDefinition();
    Expression formKeyExpression = taskDefinition.getFormKey();
    assertNotNull(formKeyExpression);
    assertEquals(aFormKey, formKeyExpression.getExpressionText());
}
Also used : TaskDefinition(org.camunda.bpm.engine.impl.task.TaskDefinition) Expression(org.camunda.bpm.engine.delegate.Expression) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) HumanTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.HumanTaskActivityBehavior) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Example 34 with TaskDefinition

use of org.camunda.bpm.engine.impl.task.TaskDefinition in project camunda-bpm-platform by camunda.

the class HumanTaskPlanItemHandlerTest method testTaskDefinitionCandidateGroups.

@Test
public void testTaskDefinitionCandidateGroups() {
    // given
    String aCandidateGroups = "accounting,management,backoffice";
    humanTask.setCamundaCandidateGroups(aCandidateGroups);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
    TaskDefinition taskDefinition = behavior.getTaskDefinition();
    Set<Expression> candidateGroupExpressions = taskDefinition.getCandidateGroupIdExpressions();
    assertEquals(3, candidateGroupExpressions.size());
    for (Expression candidateGroupExpression : candidateGroupExpressions) {
        String candidateGroup = candidateGroupExpression.getExpressionText();
        if ("accounting".equals(candidateGroup)) {
            assertEquals("accounting", candidateGroup);
        } else if ("management".equals(candidateGroup)) {
            assertEquals("management", candidateGroup);
        } else if ("backoffice".equals(candidateGroup)) {
            assertEquals("backoffice", candidateGroup);
        } else {
            fail("Unexpected candidate group: " + candidateGroup);
        }
    }
}
Also used : TaskDefinition(org.camunda.bpm.engine.impl.task.TaskDefinition) Expression(org.camunda.bpm.engine.delegate.Expression) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) HumanTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.HumanTaskActivityBehavior) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Example 35 with TaskDefinition

use of org.camunda.bpm.engine.impl.task.TaskDefinition in project camunda-bpm-platform by camunda.

the class HumanTaskPlanItemHandlerTest method testPlanItemDescription.

@Test
public void testPlanItemDescription() {
    // given
    String description = "A description";
    humanTask.setDescription(description);
    // the planItem has an own description
    String localDescription = "My Local Description";
    planItem.setDescription(localDescription);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
    TaskDefinition taskDefinition = behavior.getTaskDefinition();
    Expression descriptionExpression = taskDefinition.getDescriptionExpression();
    assertNotNull(descriptionExpression);
    assertEquals(localDescription, descriptionExpression.getExpressionText());
}
Also used : TaskDefinition(org.camunda.bpm.engine.impl.task.TaskDefinition) Expression(org.camunda.bpm.engine.delegate.Expression) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) HumanTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.HumanTaskActivityBehavior) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Aggregations

TaskDefinition (org.camunda.bpm.engine.impl.task.TaskDefinition)39 HumanTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.HumanTaskActivityBehavior)24 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)23 Test (org.junit.Test)23 Expression (org.camunda.bpm.engine.delegate.Expression)12 TaskListener (org.camunda.bpm.engine.delegate.TaskListener)12 ClassDelegateTaskListener (org.camunda.bpm.engine.impl.task.listener.ClassDelegateTaskListener)12 DelegateExpressionTaskListener (org.camunda.bpm.engine.impl.task.listener.DelegateExpressionTaskListener)12 ExpressionTaskListener (org.camunda.bpm.engine.impl.task.listener.ExpressionTaskListener)12 ExtensionElements (org.camunda.bpm.model.cmmn.instance.ExtensionElements)12 CamundaTaskListener (org.camunda.bpm.model.cmmn.instance.camunda.CamundaTaskListener)12 ConditionExpression (org.camunda.bpm.model.cmmn.instance.ConditionExpression)11 CaseDefinitionEntity (org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)4 UserTaskActivityBehavior (org.camunda.bpm.engine.impl.bpmn.behavior.UserTaskActivityBehavior)3 TaskEntity (org.camunda.bpm.engine.impl.persistence.entity.TaskEntity)3 TaskDecorator (org.camunda.bpm.engine.impl.task.TaskDecorator)3 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)2 ExpressionManager (org.camunda.bpm.engine.impl.el.ExpressionManager)2 TaskFormHandler (org.camunda.bpm.engine.impl.form.handler.TaskFormHandler)2 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)2