use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionDefinitionQueryTest method testQueryByLatestWithTenantId.
public void testQueryByLatestWithTenantId() {
// deploy a second version for tenant one
deploymentForTenant(TENANT_ONE, DMN);
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).latestVersion().tenantIdIn(TENANT_ONE);
assertThat(query.count(), is(1L));
DecisionDefinition decisionDefinition = query.singleResult();
assertThat(decisionDefinition.getTenantId(), is(TENANT_ONE));
assertThat(decisionDefinition.getVersion(), is(2));
query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).latestVersion().tenantIdIn(TENANT_TWO);
assertThat(query.count(), is(1L));
decisionDefinition = query.singleResult();
assertThat(decisionDefinition.getTenantId(), is(TENANT_TWO));
assertThat(decisionDefinition.getVersion(), is(1));
}
use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionDefinitionQueryTest method testQueryByLatestWithoutTenantId.
public void testQueryByLatestWithoutTenantId() {
// deploy a second version without tenant id
deployment(DMN);
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).latestVersion().withoutTenantId();
assertThat(query.count(), is(1L));
DecisionDefinition decisionDefinition = query.singleResult();
assertThat(decisionDefinition.getTenantId(), is(nullValue()));
assertThat(decisionDefinition.getVersion(), is(2));
}
use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceAuthorizationTest method prepareDecisionInstances.
protected void prepareDecisionInstances(String key, int daysInThePast, Integer historyTimeToLive, int instanceCount) {
DecisionDefinition decisionDefinition = selectDecisionDefinitionByKey(key);
disableAuthorization();
repositoryService.updateDecisionDefinitionHistoryTimeToLive(decisionDefinition.getId(), historyTimeToLive);
enableAuthorization();
Date oldCurrentTime = ClockUtil.getCurrentTime();
ClockUtil.setCurrentTime(DateUtils.addDays(oldCurrentTime, daysInThePast));
Map<String, Object> variables = Variables.createVariables().putValue("input1", null);
for (int i = 0; i < instanceCount; i++) {
disableAuthorization();
decisionService.evaluateDecisionByKey(key).variables(variables).evaluate();
enableAuthorization();
}
ClockUtil.setCurrentTime(oldCurrentTime);
}
use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class VersionTagTest method testParsingNullVersionTagDecisionDefinition.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/repository/noVersionTag.dmn" })
public void testParsingNullVersionTagDecisionDefinition() {
DecisionDefinition decision = repositoryService.createDecisionDefinitionQuery().orderByDecisionDefinitionVersion().asc().singleResult();
assertEquals(null, decision.getVersionTag());
}
use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class DecisionDefinitionQueryTest method decisionDefinitionProperties.
@Test
public void decisionDefinitionProperties() {
List<DecisionDefinition> decisionDefinitions = repositoryService.createDecisionDefinitionQuery().orderByDecisionDefinitionName().asc().orderByDecisionDefinitionVersion().asc().orderByDecisionDefinitionCategory().asc().list();
DecisionDefinition decisionDefinition = decisionDefinitions.get(0);
assertEquals("one", decisionDefinition.getKey());
assertEquals("One", decisionDefinition.getName());
assertTrue(decisionDefinition.getId().startsWith("one:1"));
assertEquals("Examples", decisionDefinition.getCategory());
assertEquals(1, decisionDefinition.getVersion());
assertEquals("org/camunda/bpm/engine/test/repository/one.dmn", decisionDefinition.getResourceName());
assertEquals(firstDeploymentId, decisionDefinition.getDeploymentId());
decisionDefinition = decisionDefinitions.get(1);
assertEquals("one", decisionDefinition.getKey());
assertEquals("One", decisionDefinition.getName());
assertTrue(decisionDefinition.getId().startsWith("one:2"));
assertEquals("Examples", decisionDefinition.getCategory());
assertEquals(2, decisionDefinition.getVersion());
assertEquals("org/camunda/bpm/engine/test/repository/one.dmn", decisionDefinition.getResourceName());
assertEquals(secondDeploymentId, decisionDefinition.getDeploymentId());
decisionDefinition = decisionDefinitions.get(2);
assertEquals("two", decisionDefinition.getKey());
assertEquals("Two", decisionDefinition.getName());
assertTrue(decisionDefinition.getId().startsWith("two:1"));
assertEquals("Examples2", decisionDefinition.getCategory());
assertEquals(1, decisionDefinition.getVersion());
assertEquals("org/camunda/bpm/engine/test/repository/two.dmn", decisionDefinition.getResourceName());
assertEquals(firstDeploymentId, decisionDefinition.getDeploymentId());
}
Aggregations