Search in sources :

Example 11 with CasePlanModel

use of org.camunda.bpm.model.cmmn.instance.CasePlanModel in project camunda-cmmn-model by camunda.

the class CreateModelTest method createCaseWithOneStageAndNestedHumanTask.

@Test
public void createCaseWithOneStageAndNestedHumanTask() {
    // create process
    Case caseInstance = createElement(definitions, "case-with-one-human-task", Case.class);
    // create case plan model
    CasePlanModel casePlanModel = createElement(caseInstance, "casePlanModel_1", CasePlanModel.class);
    // create a stage
    Stage stage = createElement(casePlanModel, "Stage_1", Stage.class);
    // create elements
    HumanTask humanTask = createElement(stage, "HumanTask_1", HumanTask.class);
    // create a plan item
    PlanItem planItem = createElement(stage, "PlanItem_1", PlanItem.class);
    // set definition to human task
    planItem.setDefinition(humanTask);
}
Also used : CasePlanModel(org.camunda.bpm.model.cmmn.instance.CasePlanModel) Stage(org.camunda.bpm.model.cmmn.instance.Stage) HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask) PlanItem(org.camunda.bpm.model.cmmn.instance.PlanItem) Case(org.camunda.bpm.model.cmmn.instance.Case) Test(org.junit.Test)

Example 12 with CasePlanModel

use of org.camunda.bpm.model.cmmn.instance.CasePlanModel in project camunda-cmmn-model by camunda.

the class GenerateIdTest method shouldGenerateIdsOnCreate.

@Test
public void shouldGenerateIdsOnCreate() {
    CmmnModelInstance modelInstance = Cmmn.createEmptyModel();
    Definitions definitions = modelInstance.newInstance(Definitions.class);
    assertThat(definitions.getId()).isNotNull();
    Case caseElement = modelInstance.newInstance(Case.class);
    assertThat(caseElement.getId()).isNotNull();
    CasePlanModel casePlanModel = modelInstance.newInstance(CasePlanModel.class);
    assertThat(casePlanModel.getId()).isNotNull();
    HumanTask humanTask = modelInstance.newInstance(HumanTask.class);
    assertThat(humanTask.getId()).isNotNull();
}
Also used : CasePlanModel(org.camunda.bpm.model.cmmn.instance.CasePlanModel) Definitions(org.camunda.bpm.model.cmmn.instance.Definitions) HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask) Case(org.camunda.bpm.model.cmmn.instance.Case) Test(org.junit.Test)

Example 13 with CasePlanModel

use of org.camunda.bpm.model.cmmn.instance.CasePlanModel in project camunda-cmmn-model by camunda.

the class Cmmn10Test method shouldGetDescription.

@Test
public void shouldGetDescription() {
    CmmnModelInstance modelInstance = getCmmnModelInstance();
    CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next();
    String description = casePlanModel.getDescription();
    assertThat(description).isEqualTo("This is a description...");
    Collection<Documentation> documentations = casePlanModel.getDocumentations();
    assertThat(documentations).isEmpty();
}
Also used : CasePlanModel(org.camunda.bpm.model.cmmn.instance.CasePlanModel) Documentation(org.camunda.bpm.model.cmmn.instance.Documentation) CmmnModelInstance(org.camunda.bpm.model.cmmn.CmmnModelInstance) Test(org.junit.Test)

Example 14 with CasePlanModel

use of org.camunda.bpm.model.cmmn.instance.CasePlanModel in project camunda-cmmn-model by camunda.

the class Cmmn10Test method shouldNotAbleToAddNewElement.

@Test
public void shouldNotAbleToAddNewElement() {
    CmmnModelInstance modelInstance = getCmmnModelInstance();
    CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next();
    HumanTask humanTask = modelInstance.newInstance(HumanTask.class);
    casePlanModel.getPlanItemDefinitions().add(humanTask);
    try {
        Cmmn.writeModelToStream(System.out, modelInstance);
        fail("cannot save cmmn 1.0 model");
    } catch (Exception e) {
    // expected exception
    }
}
Also used : CasePlanModel(org.camunda.bpm.model.cmmn.instance.CasePlanModel) HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask) CmmnModelInstance(org.camunda.bpm.model.cmmn.CmmnModelInstance) Test(org.junit.Test)

Example 15 with CasePlanModel

use of org.camunda.bpm.model.cmmn.instance.CasePlanModel in project camunda-cmmn-model by camunda.

the class Cmmn10Test method shouldGetCasePlanModelExitCriterion.

@Test
public void shouldGetCasePlanModelExitCriterion() {
    CmmnModelInstance modelInstance = getCmmnModelInstance();
    CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next();
    Collection<Sentry> exitCriterias = casePlanModel.getExitCriterias();
    assertThat(exitCriterias).hasSize(1);
    Collection<Sentry> exitCriteria = casePlanModel.getExitCriteria();
    assertThat(exitCriteria).hasSize(1);
    Collection<ExitCriterion> exitCriterions = casePlanModel.getExitCriterions();
    assertThat(exitCriterions).isEmpty();
}
Also used : CasePlanModel(org.camunda.bpm.model.cmmn.instance.CasePlanModel) Sentry(org.camunda.bpm.model.cmmn.instance.Sentry) CmmnModelInstance(org.camunda.bpm.model.cmmn.CmmnModelInstance) ExitCriterion(org.camunda.bpm.model.cmmn.instance.ExitCriterion) Test(org.junit.Test)

Aggregations

CasePlanModel (org.camunda.bpm.model.cmmn.instance.CasePlanModel)15 Test (org.junit.Test)10 Case (org.camunda.bpm.model.cmmn.instance.Case)9 CmmnModelInstance (org.camunda.bpm.model.cmmn.CmmnModelInstance)6 HumanTask (org.camunda.bpm.model.cmmn.instance.HumanTask)5 Definitions (org.camunda.bpm.model.cmmn.instance.Definitions)4 PlanItem (org.camunda.bpm.model.cmmn.instance.PlanItem)3 CaseDefinitionEntity (org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)2 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)2 Before (org.junit.Before)2 CasePlanModelHandler (org.camunda.bpm.engine.impl.cmmn.handler.CasePlanModelHandler)1 CmmnHandlerContext (org.camunda.bpm.engine.impl.cmmn.handler.CmmnHandlerContext)1 DefaultCmmnElementHandlerRegistry (org.camunda.bpm.engine.impl.cmmn.handler.DefaultCmmnElementHandlerRegistry)1 CmmnTransform (org.camunda.bpm.engine.impl.cmmn.transformer.CmmnTransform)1 CmmnTransformer (org.camunda.bpm.engine.impl.cmmn.transformer.CmmnTransformer)1 ExpressionManager (org.camunda.bpm.engine.impl.el.ExpressionManager)1 DeploymentEntity (org.camunda.bpm.engine.impl.persistence.entity.DeploymentEntity)1 TaskDefinition (org.camunda.bpm.engine.impl.task.TaskDefinition)1 PluggableProcessEngineTestCase (org.camunda.bpm.engine.impl.test.PluggableProcessEngineTestCase)1 Documentation (org.camunda.bpm.model.cmmn.instance.Documentation)1