use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceTest method testDisableDecisionInputInstanceByteValue.
@Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN })
public void testDisableDecisionInputInstanceByteValue() {
byte[] bytes = "object".getBytes();
startProcessInstanceAndEvaluateDecision(bytes);
HistoricDecisionInstance historicDecisionInstance = historyService.createHistoricDecisionInstanceQuery().includeInputs().disableBinaryFetching().singleResult();
List<HistoricDecisionInputInstance> inputs = historicDecisionInstance.getInputs();
assertThat(inputs.size(), is(1));
HistoricDecisionInputInstance input = inputs.get(0);
assertThat(input.getTypeName(), is("bytes"));
assertThat(input.getValue(), is(nullValue()));
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceTest method testCompoundDecisionOutputInstances.
@Deployment(resources = { DECISION_PROCESS, DECISION_COMPOUND_OUTPUT_DMN })
public void testCompoundDecisionOutputInstances() {
startProcessInstanceAndEvaluateDecision();
HistoricDecisionInstance historicDecisionInstance = historyService.createHistoricDecisionInstanceQuery().includeOutputs().singleResult();
List<HistoricDecisionOutputInstance> outputs = historicDecisionInstance.getOutputs();
assertThat(outputs.size(), is(2));
HistoricDecisionOutputInstance firstOutput = outputs.get(0);
assertThat(firstOutput.getClauseId(), is("out1"));
assertThat(firstOutput.getRuleId(), is("rule1"));
assertThat(firstOutput.getRuleOrder(), is(1));
assertThat(firstOutput.getVariableName(), is("result1"));
assertThat(firstOutput.getValue(), is((Object) "okay"));
HistoricDecisionOutputInstance secondOutput = outputs.get(1);
assertThat(secondOutput.getClauseId(), is("out2"));
assertThat(secondOutput.getRuleId(), is("rule1"));
assertThat(secondOutput.getRuleOrder(), is(1));
assertThat(secondOutput.getVariableName(), is("result2"));
assertThat(secondOutput.getValue(), is((Object) "not okay"));
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstance 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.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.
the class MockProvider method createMockHistoricDecisionInstance.
public static HistoricDecisionInstance createMockHistoricDecisionInstance() {
HistoricDecisionInstance mock = createMockHistoricDecisionInstanceBase();
when(mock.getInputs()).thenThrow(new ProcessEngineException("ENGINE-03060 The input instances for the historic decision instance are not fetched. You must call 'includeInputs()' on the query to enable fetching."));
when(mock.getOutputs()).thenThrow(new ProcessEngineException("ENGINE-03061 The output instances for the historic decision instance are not fetched. You must call 'includeOutputs()' on the query to enable fetching."));
return mock;
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.
the class MockProvider method createMockHistoricDecisionInstanceWithInputsAndOutputs.
public static HistoricDecisionInstance createMockHistoricDecisionInstanceWithInputsAndOutputs() {
List<HistoricDecisionInputInstance> inputs = createMockHistoricDecisionInputInstances();
List<HistoricDecisionOutputInstance> outputs = createMockHistoricDecisionOutputInstances();
HistoricDecisionInstance mock = createMockHistoricDecisionInstanceBase();
when(mock.getInputs()).thenReturn(inputs);
when(mock.getOutputs()).thenReturn(outputs);
return mock;
}
Aggregations