Search in sources :

Example 11 with CaseSentryPartEntity

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

the class SentryScenarioTest method testNewSentryInstance.

@Test
@ScenarioUnderTest("newSentryInstance.1")
public void testNewSentryInstance() {
    // given
    String secondStageId = rule.caseExecutionQuery().activityId("PI_Stage_2").singleResult().getId();
    // when
    // start human task
    caseService.manuallyStartCaseExecution(secondStageId);
    // then
    // a new sentry instance should be created
    CaseSentryPartEntity sentryPart = createCaseSentryPartQuery().caseExecutionId(secondStageId).singleResult();
    assertNotNull(sentryPart);
    assertFalse(sentryPart.isSatisfied());
    assertNull(sentryPart.getSourceCaseExecutionId());
    assertEquals("PI_HumanTask_1", sentryPart.getSource());
}
Also used : 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 12 with CaseSentryPartEntity

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

the class SentryScenarioTest method testTriggerStageEntryCriterion.

@Test
@ScenarioUnderTest("triggerStageEntryCriterion.1")
public void testTriggerStageEntryCriterion() {
    // given
    String secondHumanTaskId = rule.caseExecutionQuery().activityId("PI_HumanTask_2").singleResult().getId();
    String firstStageId = rule.caseExecutionQuery().activityId("PI_Stage_1").singleResult().getId();
    // when
    // complete human task
    caseService.completeCaseExecution(secondHumanTaskId);
    // then
    // "PI_Stage_1" should be completed
    CaseExecution firstStage = rule.caseExecutionQuery().activityId("PI_Stage_1").singleResult();
    assertNull(firstStage);
    // "PI_Stage_2" should be enabled
    CaseExecution secondStage = rule.caseExecutionQuery().activityId("PI_Stage_2").singleResult();
    assertNotNull(secondStage);
    assertTrue(secondStage.isEnabled());
    CaseSentryPartEntity sentryPart = createCaseSentryPartQuery().sourceCaseExecutionId(firstStageId).singleResult();
    // the associated sentry part is not satisfied
    assertFalse(sentryPart.isSatisfied());
    // the source is null (since 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)

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