use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.
the class MockProvider method createMockHistoricDecisionInstanceWithOutputs.
public static HistoricDecisionInstance createMockHistoricDecisionInstanceWithOutputs() {
List<HistoricDecisionOutputInstance> outputs = createMockHistoricDecisionOutputInstances();
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()).thenReturn(outputs);
return mock;
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceSerializationTest method testListJsonProperty.
@Deployment(resources = { "org/camunda/spin/plugin/DecisionSingleOutput.dmn11.xml" })
public void testListJsonProperty() {
JsonListSerializable<String> list = new JsonListSerializable<String>();
list.addElement("foo");
ObjectValue objectValue = Variables.objectValue(list).serializationDataFormat(DataFormats.JSON_DATAFORMAT_NAME).create();
VariableMap variables = Variables.createVariables().putValueTyped("input1", objectValue);
decisionService.evaluateDecisionTableByKey("testDecision", variables);
HistoricDecisionInstance testDecision = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey("testDecision").includeInputs().includeOutputs().singleResult();
assertNotNull(testDecision);
List<HistoricDecisionInputInstance> inputs = testDecision.getInputs();
assertEquals(1, inputs.size());
HistoricDecisionInputInstance inputInstance = inputs.get(0);
assertEquals(list.getListProperty(), inputInstance.getValue());
List<HistoricDecisionOutputInstance> outputs = testDecision.getOutputs();
assertEquals(1, outputs.size());
HistoricDecisionOutputInstance outputInstance = outputs.get(0);
assertEquals(list.getListProperty(), outputInstance.getValue());
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.
the class DeleteHistoricDecisionInstanceByInstanceIdCmd method execute.
@Override
public Object execute(CommandContext commandContext) {
ensureNotNull("historicDecisionInstanceId", historicDecisionInstanceId);
HistoricDecisionInstance historicDecisionInstance = commandContext.getHistoricDecisionInstanceManager().findHistoricDecisionInstance(historicDecisionInstanceId);
ensureNotNull("No historic decision instance found with id: " + historicDecisionInstanceId, "historicDecisionInstance", historicDecisionInstance);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkDeleteHistoricDecisionInstance(historicDecisionInstance);
}
commandContext.getHistoricDecisionInstanceManager().deleteHistoricDecisionInstanceByIds(Arrays.asList(historicDecisionInstanceId));
return null;
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.
the class TenantIdProviderTest method setsTenantIdForHistoricDecisionInstance.
@Test
public void setsTenantIdForHistoricDecisionInstance() {
String tenantId = TENANT_ID;
StaticTenantIdTestProvider tenantIdProvider = new StaticTenantIdTestProvider(tenantId);
TestTenantIdProvider.delegate = tenantIdProvider;
testRule.deploy(DMN_FILE);
// if a decision definition is evaluated
engineRule.getDecisionService().evaluateDecisionTableByKey(DECISION_DEFINITION_KEY).variables(createVariables()).evaluate();
// then the tenant id provider can set the tenant id to a value
HistoricDecisionInstance historicDecisionInstance = engineRule.getHistoryService().createHistoricDecisionInstanceQuery().singleResult();
assertThat(historicDecisionInstance.getTenantId(), is(tenantId));
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.
the class TenantIdProviderTest method setsTenantIdForHistoricDecisionInstance_BusinessRuleTask.
@Test
public void setsTenantIdForHistoricDecisionInstance_BusinessRuleTask() {
String tenantId = TENANT_ID;
SetValueOnHistoricDecisionInstanceTenantIdProvider tenantIdProvider = new SetValueOnHistoricDecisionInstanceTenantIdProvider(tenantId);
TestTenantIdProvider.delegate = tenantIdProvider;
BpmnModelInstance process = Bpmn.createExecutableProcess(PROCESS_DEFINITION_KEY).startEvent().businessRuleTask().camundaDecisionRef(DECISION_DEFINITION_KEY).camundaAsyncAfter().endEvent().done();
testRule.deploy(process, DMN_FILE);
// if a process instance is started
engineRule.getRuntimeService().createProcessInstanceByKey(PROCESS_DEFINITION_KEY).setVariables(createVariables()).execute();
// then the tenant id provider can set the tenant id to a value
HistoricDecisionInstance historicDecisionInstance = engineRule.getHistoryService().createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).singleResult();
assertThat(historicDecisionInstance.getTenantId(), is(tenantId));
}
Aggregations