use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartQueryImpl in project camunda-bpm-platform by camunda.
the class SentryScenarioTest method createCaseSentryPartQuery.
// queries /////////////////////////////////
protected CaseSentryPartQueryImpl createCaseSentryPartQuery() {
ProcessEngine processEngine = rule.getProcessEngine();
ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration();
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequiresNew();
return new CaseSentryPartQueryImpl(commandExecutor);
}
use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartQueryImpl in project camunda-bpm-platform by camunda.
the class SentryEntryCriteriaTest method testAndFork.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/sentry/SentryEntryCriteriaTest.testAndFork.cmmn" })
public void testAndFork() {
// given
createCaseInstance();
CaseExecution firstHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_1");
String firstHumanTaskId = firstHumanTask.getId();
assertTrue(firstHumanTask.isActive());
CaseExecution secondHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_2");
String secondHumanTaskId = secondHumanTask.getId();
assertTrue(secondHumanTask.isAvailable());
CaseExecution thirdHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_3");
String thirdHumanTaskId = thirdHumanTask.getId();
assertTrue(thirdHumanTask.isAvailable());
CaseSentryPartQueryImpl query = createCaseSentryPartQuery();
CmmnSentryPart part = query.singleResult();
assertFalse(part.isSatisfied());
// when
complete(firstHumanTaskId);
// then
secondHumanTask = queryCaseExecutionById(secondHumanTaskId);
assertTrue(secondHumanTask.isActive());
thirdHumanTask = queryCaseExecutionById(thirdHumanTaskId);
assertTrue(thirdHumanTask.isActive());
part = query.singleResult();
assertNotNull(part);
assertFalse(part.isSatisfied());
}
use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartQueryImpl in project camunda-bpm-platform by camunda.
the class SentryInitializationTest method testMultipleSentries.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/sentry/SentryInitializationTest.testMultipleSentries.cmmn" })
public void testMultipleSentries() {
// given
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
// when
String caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).setVariable("myVar", 0).create().getId();
// then
CaseSentryPartQueryImpl query = createCaseSentryPartQuery();
assertEquals(2, query.count());
CaseSentryPartEntity part = query.sentryId("Sentry_1").singleResult();
assertEquals(caseInstanceId, part.getCaseExecutionId());
assertEquals(caseInstanceId, part.getCaseInstanceId());
assertEquals("Sentry_1", part.getSentryId());
assertEquals(CmmnSentryDeclaration.IF_PART, part.getType());
assertNull(part.getSource());
assertNull(part.getStandardEvent());
assertFalse(part.isSatisfied());
part = query.sentryId("Sentry_2").singleResult();
assertEquals(caseInstanceId, part.getCaseExecutionId());
assertEquals(caseInstanceId, part.getCaseInstanceId());
assertEquals("Sentry_2", part.getSentryId());
assertEquals(CmmnSentryDeclaration.PLAN_ITEM_ON_PART, part.getType());
assertEquals("PI_HumanTask_1", part.getSource());
assertEquals("complete", part.getStandardEvent());
assertFalse(part.isSatisfied());
}
use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartQueryImpl in project camunda-bpm-platform by camunda.
the class SentryInitializationTest method testMultipleSentriesWithinStage.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/sentry/SentryInitializationTest.testMultipleSentriesWithinStage.cmmn" })
public void testMultipleSentriesWithinStage() {
// given
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
// when
String caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).setVariable("myVar", 0).create().getId();
// then
CaseSentryPartQueryImpl query = createCaseSentryPartQuery();
assertEquals(2, query.count());
// when
String stageId = caseService.createCaseExecutionQuery().activityId("PI_Stage_1").singleResult().getId();
// then
assertEquals(2, query.count());
CaseSentryPartEntity part = query.sentryId("Sentry_1").singleResult();
assertEquals(caseInstanceId, part.getCaseInstanceId());
assertEquals(stageId, part.getCaseExecutionId());
assertEquals("Sentry_1", part.getSentryId());
assertEquals(CmmnSentryDeclaration.IF_PART, part.getType());
assertNull(part.getSource());
assertNull(part.getStandardEvent());
assertFalse(part.isSatisfied());
part = query.sentryId("Sentry_2").singleResult();
assertEquals(caseInstanceId, part.getCaseInstanceId());
assertEquals(stageId, part.getCaseExecutionId());
assertEquals("Sentry_2", part.getSentryId());
assertEquals(CmmnSentryDeclaration.PLAN_ITEM_ON_PART, part.getType());
assertEquals("PI_HumanTask_1", part.getSource());
assertEquals("complete", part.getStandardEvent());
assertFalse(part.isSatisfied());
}
use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartQueryImpl in project camunda-bpm-platform by camunda.
the class SentryInitializationTest method testOnPartIfPartAndVariableOnPart.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/sentry/SentryInitializationTest.testOnPartIfPartAndVariableOnPart.cmmn" })
public void testOnPartIfPartAndVariableOnPart() {
// given
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
// when
String caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).create().getId();
// then
CaseSentryPartQueryImpl query = createCaseSentryPartQuery();
assertEquals(3, query.count());
CaseSentryPartEntity part = query.type(CmmnSentryDeclaration.IF_PART).singleResult();
assertEquals(caseInstanceId, part.getCaseExecutionId());
assertEquals(caseInstanceId, part.getCaseInstanceId());
assertEquals("Sentry_1", part.getSentryId());
assertEquals(CmmnSentryDeclaration.IF_PART, part.getType());
assertNull(part.getSource());
assertNull(part.getStandardEvent());
assertFalse(part.isSatisfied());
part = query.type(CmmnSentryDeclaration.PLAN_ITEM_ON_PART).singleResult();
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());
part = query.type(CmmnSentryDeclaration.VARIABLE_ON_PART).singleResult();
assertEquals(caseInstanceId, part.getCaseExecutionId());
assertEquals(caseInstanceId, part.getCaseInstanceId());
assertEquals("Sentry_1", part.getSentryId());
assertEquals(CmmnSentryDeclaration.VARIABLE_ON_PART, part.getType());
assertEquals(VariableTransition.delete.name(), part.getVariableEvent());
assertEquals("variable_1", part.getVariableName());
assertFalse(part.isSatisfied());
}
Aggregations