use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class DecisionDefinitionQueryTest method queryByDecisionDefinitionIds.
@Test
public void queryByDecisionDefinitionIds() {
// empty list
assertTrue(repositoryService.createDecisionDefinitionQuery().decisionDefinitionIdIn("a", "b").list().isEmpty());
// collect all ids
List<DecisionDefinition> decisionDefinitions = repositoryService.createDecisionDefinitionQuery().list();
List<String> ids = new ArrayList<String>();
for (DecisionDefinition decisionDefinition : decisionDefinitions) {
ids.add(decisionDefinition.getId());
}
decisionDefinitions = repositoryService.createDecisionDefinitionQuery().decisionDefinitionIdIn(ids.toArray(new String[ids.size()])).list();
assertEquals(ids.size(), decisionDefinitions.size());
for (DecisionDefinition decisionDefinition : decisionDefinitions) {
if (!ids.contains(decisionDefinition.getId())) {
fail("Expected to find decision definition " + decisionDefinition);
}
}
}
use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionDefinitionCmdsTenantCheckTest method updateHistoryTimeToLiveDisabledTenantCheck.
@Test
public void updateHistoryTimeToLiveDisabledTenantCheck() {
processEngineConfiguration.setTenantCheckEnabled(false);
identityService.setAuthentication("user", null, null);
repositoryService.updateDecisionDefinitionHistoryTimeToLive(decisionDefinitionId, 6);
DecisionDefinition definition = repositoryService.getDecisionDefinition(decisionDefinitionId);
assertThat(definition.getTenantId(), is(TENANT_ONE));
assertThat(definition.getHistoryTimeToLive(), is(6));
}
use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceTest method testDecisionInstancePropertiesOfDecisionLiteralExpression.
@Deployment(resources = DECISION_LITERAL_EXPRESSION_DMN)
public void testDecisionInstancePropertiesOfDecisionLiteralExpression() {
DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().singleResult();
decisionService.evaluateDecisionByKey("decision").variables(Variables.createVariables().putValue("sum", 2205)).evaluate();
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().includeInputs().includeOutputs();
assertThat(query.count(), is(1L));
HistoricDecisionInstance historicDecisionInstance = query.singleResult();
assertThat(historicDecisionInstance.getDecisionDefinitionId(), is(decisionDefinition.getId()));
assertThat(historicDecisionInstance.getDecisionDefinitionKey(), is("decision"));
assertThat(historicDecisionInstance.getDecisionDefinitionName(), is("Decision with Literal Expression"));
assertThat(historicDecisionInstance.getEvaluationTime(), is(notNullValue()));
assertThat(historicDecisionInstance.getInputs().size(), is(0));
List<HistoricDecisionOutputInstance> outputs = historicDecisionInstance.getOutputs();
assertThat(outputs.size(), is(1));
HistoricDecisionOutputInstance output = outputs.get(0);
assertThat(output.getVariableName(), is("result"));
assertThat(output.getTypeName(), is("string"));
assertThat((String) output.getValue(), is("ok"));
assertThat(output.getClauseId(), is(nullValue()));
assertThat(output.getClauseName(), is(nullValue()));
assertThat(output.getRuleId(), is(nullValue()));
assertThat(output.getRuleOrder(), is(nullValue()));
}
use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class DecisionInstanceHistoryTest method testDecisionDefinitionPassedToHistoryLevel.
@Deployment(resources = DECISION_SINGLE_OUTPUT_DMN)
public void testDecisionDefinitionPassedToHistoryLevel() {
RecordHistoryLevel historyLevel = (RecordHistoryLevel) processEngineConfiguration.getHistoryLevel();
DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey("testDecision").singleResult();
VariableMap variables = Variables.createVariables().putValue("input1", true);
decisionService.evaluateDecisionTableByKey("testDecision", variables);
List<RecordHistoryLevel.ProducedHistoryEvent> producedHistoryEvents = historyLevel.getProducedHistoryEvents();
assertEquals(1, producedHistoryEvents.size());
RecordHistoryLevel.ProducedHistoryEvent producedHistoryEvent = producedHistoryEvents.get(0);
assertEquals(HistoryEventTypes.DMN_DECISION_EVALUATE, producedHistoryEvent.eventType);
DecisionDefinition entity = (DecisionDefinition) producedHistoryEvent.entity;
assertNotNull(entity);
assertEquals(decisionDefinition.getId(), entity.getId());
}
use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class DecisionDefinitionRestServiceQueryTest method testDecisionDefinitionTenantIdList.
@Test
public void testDecisionDefinitionTenantIdList() {
List<DecisionDefinition> decisionDefinitions = Arrays.asList(MockProvider.mockDecisionDefinition().tenantId(MockProvider.EXAMPLE_TENANT_ID).build(), MockProvider.mockDecisionDefinition().id(MockProvider.ANOTHER_EXAMPLE_CASE_DEFINITION_ID).tenantId(MockProvider.ANOTHER_EXAMPLE_TENANT_ID).build());
mockedQuery = createMockDecisionDefinitionQuery(decisionDefinitions);
Response response = given().queryParam("tenantIdIn", MockProvider.EXAMPLE_TENANT_ID_LIST).then().expect().statusCode(Status.OK.getStatusCode()).when().get(DECISION_DEFINITION_QUERY_URL);
verify(mockedQuery).tenantIdIn(MockProvider.EXAMPLE_TENANT_ID, MockProvider.ANOTHER_EXAMPLE_TENANT_ID);
verify(mockedQuery).list();
String content = response.asString();
List<String> definitions = from(content).getList("");
assertThat(definitions).hasSize(2);
String returnedTenantId1 = from(content).getString("[0].tenantId");
String returnedTenantId2 = from(content).getString("[1].tenantId");
assertThat(returnedTenantId1).isEqualTo(MockProvider.EXAMPLE_TENANT_ID);
assertThat(returnedTenantId2).isEqualTo(MockProvider.ANOTHER_EXAMPLE_TENANT_ID);
}
Aggregations