use of org.camunda.bpm.engine.history.HistoricDetail in project camunda-bpm-platform by camunda.
the class ProcessEngineRestServiceTest method createHistoricDetailMock.
private void createHistoricDetailMock() {
List<HistoricDetail> details = MockProvider.createMockHistoricDetails();
HistoricDetailQuery query = mock(HistoricDetailQuery.class);
when(mockHistoryService.createHistoricDetailQuery()).thenReturn(query);
when(query.list()).thenReturn(details);
}
use of org.camunda.bpm.engine.history.HistoricDetail in project camunda-bpm-platform by camunda.
the class HistoricDetailRestServiceQueryTest method testSerializableVariableInstanceRetrieval.
@Test
public void testSerializableVariableInstanceRetrieval() {
ObjectValue serializedValue = Variables.serializedObjectValue("a serialized value").create();
MockHistoricVariableUpdateBuilder builder = MockProvider.mockHistoricVariableUpdate().typedValue(serializedValue);
List<HistoricDetail> details = new ArrayList<HistoricDetail>();
details.add(builder.build());
mockedQuery = setUpMockedDetailsQuery(details);
given().then().expect().statusCode(Status.OK.getStatusCode()).and().body("[0].value", equalTo("a serialized value")).body("[0].variableType", equalTo(VariableTypeHelper.toExpectedValueTypeName(serializedValue.getType()))).body("[0].errorMessage", nullValue()).when().get(HISTORIC_DETAIL_RESOURCE_URL);
// should not resolve custom objects but existing API requires it
// verify(mockedQuery).disableCustomObjectDeserialization();
verify(mockedQuery, never()).disableCustomObjectDeserialization();
}
use of org.camunda.bpm.engine.history.HistoricDetail in project camunda-bpm-platform by camunda.
the class UserOperationIdTest method testWithoutAuthentication.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testWithoutAuthentication() {
// given
runtimeService.startProcessInstanceByKey(PROCESS_KEY);
String taskId = taskService.createTaskQuery().singleResult().getId();
// when
taskService.resolveTask(taskId, getVariables());
// then
List<UserOperationLogEntry> userOperationLogEntries = historyService.createUserOperationLogQuery().taskId(taskId).list();
assertEquals(0, userOperationLogEntries.size());
List<HistoricDetail> historicDetails = historyService.createHistoricDetailQuery().list();
assertTrue(historicDetails.size() > 0);
// history detail records must have null userOperationId as user operation log was not created
for (HistoricDetail historicDetail : historicDetails) {
assertNull(historicDetail.getUserOperationId());
}
}
use of org.camunda.bpm.engine.history.HistoricDetail in project camunda-bpm-platform by camunda.
the class UserOperationIdTest method verifySameOperationId.
private void verifySameOperationId(List<UserOperationLogEntry> userOperationLogEntries, List<HistoricDetail> historicDetails) {
assertTrue("Operation log entry must exist", userOperationLogEntries.size() > 0);
String operationId = userOperationLogEntries.get(0).getOperationId();
assertNotNull(operationId);
assertTrue("Some historic details are expected to be present", historicDetails.size() > 0);
for (UserOperationLogEntry userOperationLogEntry : userOperationLogEntries) {
assertEquals("OperationIds must be the same", operationId, userOperationLogEntry.getOperationId());
}
for (HistoricDetail historicDetail : historicDetails) {
assertEquals("OperationIds must be the same", operationId, historicDetail.getUserOperationId());
}
}
use of org.camunda.bpm.engine.history.HistoricDetail in project camunda-bpm-platform by camunda.
the class ProcessInstantiationAtActivitiesHistoryTest method testHistoricProcessInstanceAsyncStartEvent.
@Deployment(resources = ASYNC_PROCESS)
public void testHistoricProcessInstanceAsyncStartEvent() {
// when
ProcessInstance instance = runtimeService.createProcessInstanceByKey("exclusiveGateway").startBeforeActivity("task2").setVariable("aVar", "aValue").execute();
// then
HistoricProcessInstance historicInstance = historyService.createHistoricProcessInstanceQuery().singleResult();
assertNotNull(historicInstance);
assertEquals(instance.getId(), historicInstance.getId());
assertNotNull(historicInstance.getStartTime());
assertNull(historicInstance.getEndTime());
// should be the first activity started
assertEquals("task2", historicInstance.getStartActivityId());
// task2 wasn't entered yet
assertEquals(0, historyService.createHistoricActivityInstanceQuery().count());
// history events for variables exist already
ActivityInstance activityInstance = runtimeService.getActivityInstance(instance.getId());
HistoricVariableInstance historicVariable = historyService.createHistoricVariableInstanceQuery().variableName("aVar").singleResult();
assertNotNull(historicVariable);
assertEquals(instance.getId(), historicVariable.getProcessInstanceId());
assertEquals(activityInstance.getId(), historicVariable.getActivityInstanceId());
assertEquals("aVar", historicVariable.getName());
assertEquals("aValue", historicVariable.getValue());
HistoricDetail historicDetail = historyService.createHistoricDetailQuery().variableInstanceId(historicVariable.getId()).singleResult();
assertEquals(instance.getId(), historicDetail.getProcessInstanceId());
assertNotNull(historicDetail);
// TODO: fix if this is not ok due to CAM-3886
assertNull(historicDetail.getActivityInstanceId());
assertTrue(historicDetail instanceof HistoricVariableUpdate);
assertEquals("aVar", ((HistoricVariableUpdate) historicDetail).getVariableName());
assertEquals("aValue", ((HistoricVariableUpdate) historicDetail).getValue());
}
Aggregations