Search in sources :

Example 1 with CmmnModelInstance

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

the class Cmmn10Test method shouldGetCaseRoles.

@Test
public void shouldGetCaseRoles() {
    CmmnModelInstance modelInstance = getCmmnModelInstance();
    Case _case = modelInstance.getModelElementsByType(Case.class).iterator().next();
    Collection<CaseRole> roles = _case.getCaseRoles();
    assertThat(roles).hasSize(2);
    CaseRoles caseRole = _case.getRoles();
    assertThat(caseRole).isNull();
}
Also used : CaseRoles(org.camunda.bpm.model.cmmn.instance.CaseRoles) CaseRole(org.camunda.bpm.model.cmmn.instance.CaseRole) CmmnModelInstance(org.camunda.bpm.model.cmmn.CmmnModelInstance) Case(org.camunda.bpm.model.cmmn.instance.Case) Test(org.junit.Test)

Example 2 with CmmnModelInstance

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

the class Cmmn10Test method shouldNotAbleToAddCmmn10Element.

@Test
public void shouldNotAbleToAddCmmn10Element() {
    CmmnModelInstance modelInstance = Cmmn.readModelFromStream(Cmmn10Test.class.getResourceAsStream("Cmmn11Test.cmmn"));
    CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next();
    Event event = modelInstance.newInstance(Event.class);
    casePlanModel.getPlanItemDefinitions().add(event);
    try {
        Cmmn.writeModelToStream(System.out, modelInstance);
        fail("cannot save cmmn 1.1 model");
    } catch (Exception e) {
    // expected exception
    }
}
Also used : CasePlanModel(org.camunda.bpm.model.cmmn.instance.CasePlanModel) TimerEvent(org.camunda.bpm.model.cmmn.instance.TimerEvent) Event(org.camunda.bpm.model.cmmn.instance.Event) UserEvent(org.camunda.bpm.model.cmmn.instance.UserEvent) CmmnModelInstance(org.camunda.bpm.model.cmmn.CmmnModelInstance) Test(org.junit.Test)

Example 3 with CmmnModelInstance

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

the class Cmmn10Test method shouldGetTaskInputsOutputs.

@Test
public void shouldGetTaskInputsOutputs() {
    CmmnModelInstance modelInstance = getCmmnModelInstance();
    HumanTask humanTask = modelInstance.getModelElementsByType(HumanTask.class).iterator().next();
    Collection<InputsCaseParameter> inputs = humanTask.getInputs();
    assertThat(inputs).hasSize(1);
    Collection<InputCaseParameter> inputParameters = humanTask.getInputParameters();
    assertThat(inputParameters).isEmpty();
    Collection<OutputsCaseParameter> outputs = humanTask.getOutputs();
    assertThat(outputs).hasSize(1);
    Collection<OutputCaseParameter> outputParameters = humanTask.getOutputParameters();
    assertThat(outputParameters).isEmpty();
}
Also used : InputCaseParameter(org.camunda.bpm.model.cmmn.instance.InputCaseParameter) OutputsCaseParameter(org.camunda.bpm.model.cmmn.instance.OutputsCaseParameter) HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask) OutputCaseParameter(org.camunda.bpm.model.cmmn.instance.OutputCaseParameter) CmmnModelInstance(org.camunda.bpm.model.cmmn.CmmnModelInstance) InputsCaseParameter(org.camunda.bpm.model.cmmn.instance.InputsCaseParameter) Test(org.junit.Test)

Example 4 with CmmnModelInstance

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

the class Cmmn10Test method shouldGetMultipleIfPartConditions.

@Test
public void shouldGetMultipleIfPartConditions() {
    CmmnModelInstance modelInstance = getCmmnModelInstance();
    Sentry sentry = modelInstance.getModelElementsByType(Sentry.class).iterator().next();
    IfPart ifPart = sentry.getIfPart();
    assertThat(ifPart).isNotNull();
    Collection<ConditionExpression> conditions = ifPart.getConditions();
    assertThat(conditions).hasSize(2);
    ConditionExpression condition = ifPart.getCondition();
    assertThat(condition).isNotNull();
}
Also used : IfPart(org.camunda.bpm.model.cmmn.instance.IfPart) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) Sentry(org.camunda.bpm.model.cmmn.instance.Sentry) CmmnModelInstance(org.camunda.bpm.model.cmmn.CmmnModelInstance) Test(org.junit.Test)

Example 5 with CmmnModelInstance

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

the class Cmmn10Test method shouldGetEvents.

@Test
public void shouldGetEvents() {
    CmmnModelInstance modelInstance = getCmmnModelInstance();
    Event event = modelInstance.getModelElementsByType(Event.class).iterator().next();
    assertThat(event).isNotNull();
    UserEvent userEvent = modelInstance.getModelElementsByType(UserEvent.class).iterator().next();
    assertThat(userEvent).isNotNull();
    TimerEvent timerEvent = modelInstance.getModelElementsByType(TimerEvent.class).iterator().next();
    assertThat(timerEvent).isNotNull();
}
Also used : TimerEvent(org.camunda.bpm.model.cmmn.instance.TimerEvent) Event(org.camunda.bpm.model.cmmn.instance.Event) UserEvent(org.camunda.bpm.model.cmmn.instance.UserEvent) TimerEvent(org.camunda.bpm.model.cmmn.instance.TimerEvent) CmmnModelInstance(org.camunda.bpm.model.cmmn.CmmnModelInstance) UserEvent(org.camunda.bpm.model.cmmn.instance.UserEvent) Test(org.junit.Test)

Aggregations

CmmnModelInstance (org.camunda.bpm.model.cmmn.CmmnModelInstance)22 Test (org.junit.Test)14 CasePlanModel (org.camunda.bpm.model.cmmn.instance.CasePlanModel)6 Case (org.camunda.bpm.model.cmmn.instance.Case)4 Sentry (org.camunda.bpm.model.cmmn.instance.Sentry)4 HumanTask (org.camunda.bpm.model.cmmn.instance.HumanTask)3 PlanItem (org.camunda.bpm.model.cmmn.instance.PlanItem)3 CaseDefinitionEntity (org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)2 PluggableProcessEngineTestCase (org.camunda.bpm.engine.impl.test.PluggableProcessEngineTestCase)2 ConditionExpression (org.camunda.bpm.model.cmmn.instance.ConditionExpression)2 Event (org.camunda.bpm.model.cmmn.instance.Event)2 ExitCriterion (org.camunda.bpm.model.cmmn.instance.ExitCriterion)2 TimerEvent (org.camunda.bpm.model.cmmn.instance.TimerEvent)2 UserEvent (org.camunda.bpm.model.cmmn.instance.UserEvent)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 HashSet (java.util.HashSet)1 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)1 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)1 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)1 ResourceEntity (org.camunda.bpm.engine.impl.persistence.entity.ResourceEntity)1