Search in sources :

Example 1 with CaseSentryPartEntity

use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartEntity in project camunda-bpm-platform by camunda.

the class CmmnExecution method forceUpdateOnCaseSentryParts.

protected void forceUpdateOnCaseSentryParts(List<CmmnSentryPart> sentryParts) {
    // same sentry has been satisfied concurrently.
    for (CmmnSentryPart sentryPart : sentryParts) {
        if (sentryPart instanceof CaseSentryPartEntity) {
            CaseSentryPartEntity sentryPartEntity = (CaseSentryPartEntity) sentryPart;
            sentryPartEntity.forceUpdate();
        }
    }
}
Also used : CaseSentryPartEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartEntity)

Example 2 with CaseSentryPartEntity

use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartEntity in project camunda-bpm-platform by camunda.

the class CmmnExecution method forceUpdateOnSentries.

protected void forceUpdateOnSentries(List<String> sentryIds) {
    for (String sentryId : sentryIds) {
        List<? extends CmmnSentryPart> sentryParts = findSentry(sentryId);
        // same sentry has been satisfied concurrently.
        for (CmmnSentryPart sentryPart : sentryParts) {
            if (sentryPart instanceof CaseSentryPartEntity) {
                CaseSentryPartEntity sentryPartEntity = (CaseSentryPartEntity) sentryPart;
                sentryPartEntity.forceUpdate();
            }
        }
    }
}
Also used : CaseSentryPartEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartEntity)

Example 3 with CaseSentryPartEntity

use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartEntity in project camunda-bpm-platform by camunda.

the class SentryScenarioTest method testTriggerTaskEntryCriterion.

@Test
@ScenarioUnderTest("triggerTaskEntryCriterion.1")
public void testTriggerTaskEntryCriterion() {
    // given
    // enabled human task inside a stage instance
    String firstHumanTaskId = rule.caseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
    // when
    // start and complete human task
    caseService.manuallyStartCaseExecution(firstHumanTaskId);
    caseService.completeCaseExecution(firstHumanTaskId);
    // then
    // entry criterion of the second human task inside the stage instance
    // will be triggered
    CaseExecution secondHumanTask = rule.caseExecutionQuery().activityId("PI_HumanTask_2").singleResult();
    // ... and the task is enabled
    assertTrue(secondHumanTask.isEnabled());
    CaseSentryPartEntity sentryPart = createCaseSentryPartQuery().sourceCaseExecutionId(firstHumanTaskId).singleResult();
    // the associated sentry part is not satisfied
    assertFalse(sentryPart.isSatisfied());
    // the source is null (because this sentry part
    // has been migrated into 7.4)
    assertNull(sentryPart.getSource());
}
Also used : CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) CaseSentryPartEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartEntity) Test(org.junit.Test) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest)

Example 4 with CaseSentryPartEntity

use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartEntity in project camunda-bpm-platform by camunda.

the class SentryInitializationTest method testVariableOnPart.

@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/sentry/SentryInitializationTest.testVariableOnPart.cmmn" })
public void testVariableOnPart() {
    // given
    String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
    // when
    String caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).create().getId();
    // then
    List<CaseSentryPartEntity> parts = createCaseSentryPartQuery().list();
    assertEquals(1, parts.size());
    CaseSentryPartEntity part = parts.get(0);
    assertEquals(caseInstanceId, part.getCaseExecutionId());
    assertEquals(caseInstanceId, part.getCaseInstanceId());
    assertEquals("Sentry_1", part.getSentryId());
    assertEquals(CmmnSentryDeclaration.VARIABLE_ON_PART, part.getType());
    assertEquals(VariableTransition.create.name(), part.getVariableEvent());
    assertEquals("variable_1", part.getVariableName());
    assertFalse(part.isSatisfied());
}
Also used : CaseSentryPartEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartEntity) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 5 with CaseSentryPartEntity

use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartEntity in project camunda-bpm-platform by camunda.

the class SentryInitializationTest method testOnPart.

@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/sentry/SentryInitializationTest.testOnPart.cmmn" })
public void testOnPart() {
    // given
    String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
    // when
    String caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).create().getId();
    // then
    List<CaseSentryPartEntity> parts = createCaseSentryPartQuery().list();
    assertEquals(1, parts.size());
    CaseSentryPartEntity part = parts.get(0);
    assertEquals(caseInstanceId, part.getCaseExecutionId());
    assertEquals(caseInstanceId, part.getCaseInstanceId());
    assertEquals("Sentry_1", part.getSentryId());
    assertEquals(CmmnSentryDeclaration.PLAN_ITEM_ON_PART, part.getType());
    assertEquals("PI_HumanTask_1", part.getSource());
    assertEquals("complete", part.getStandardEvent());
    assertFalse(part.isSatisfied());
}
Also used : CaseSentryPartEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartEntity) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

CaseSentryPartEntity (org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartEntity)12 Deployment (org.camunda.bpm.engine.test.Deployment)6 CaseSentryPartQueryImpl (org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartQueryImpl)3 ScenarioUnderTest (org.camunda.bpm.qa.upgrade.ScenarioUnderTest)3 Test (org.junit.Test)3 CaseExecution (org.camunda.bpm.engine.runtime.CaseExecution)2