Search in sources :

Example 1 with HistoricDetail

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);
}
Also used : HistoricDetail(org.camunda.bpm.engine.history.HistoricDetail) HistoricDetailQuery(org.camunda.bpm.engine.history.HistoricDetailQuery)

Example 2 with HistoricDetail

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();
}
Also used : HistoricDetail(org.camunda.bpm.engine.history.HistoricDetail) ObjectValue(org.camunda.bpm.engine.variable.value.ObjectValue) ArrayList(java.util.ArrayList) MockHistoricVariableUpdateBuilder(org.camunda.bpm.engine.rest.helper.MockHistoricVariableUpdateBuilder) Test(org.junit.Test) AbstractRestServiceTest(org.camunda.bpm.engine.rest.AbstractRestServiceTest)

Example 3 with HistoricDetail

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());
    }
}
Also used : HistoricDetail(org.camunda.bpm.engine.history.HistoricDetail) UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 4 with HistoricDetail

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());
    }
}
Also used : HistoricDetail(org.camunda.bpm.engine.history.HistoricDetail) UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry)

Example 5 with HistoricDetail

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());
}
Also used : HistoricVariableUpdate(org.camunda.bpm.engine.history.HistoricVariableUpdate) HistoricDetail(org.camunda.bpm.engine.history.HistoricDetail) HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance) ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) HistoricProcessInstance(org.camunda.bpm.engine.history.HistoricProcessInstance) HistoricProcessInstance(org.camunda.bpm.engine.history.HistoricProcessInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) HistoricVariableInstance(org.camunda.bpm.engine.history.HistoricVariableInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

HistoricDetail (org.camunda.bpm.engine.history.HistoricDetail)40 Deployment (org.camunda.bpm.engine.test.Deployment)23 Test (org.junit.Test)20 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)14 HistoricVariableInstance (org.camunda.bpm.engine.history.HistoricVariableInstance)14 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)14 Task (org.camunda.bpm.engine.task.Task)13 HistoricActivityInstance (org.camunda.bpm.engine.history.HistoricActivityInstance)12 HistoricVariableUpdate (org.camunda.bpm.engine.history.HistoricVariableUpdate)10 HashMap (java.util.HashMap)7 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)7 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)6 ArrayList (java.util.ArrayList)3 HistoricCaseInstance (org.camunda.bpm.engine.history.HistoricCaseInstance)3 HistoricDetailVariableInstanceUpdateEntity (org.camunda.bpm.engine.impl.persistence.entity.HistoricDetailVariableInstanceUpdateEntity)3 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 HistoricDetailQuery (org.camunda.bpm.engine.history.HistoricDetailQuery)2 HistoricFormProperty (org.camunda.bpm.engine.history.HistoricFormProperty)2 HistoricVariableInstanceQuery (org.camunda.bpm.engine.history.HistoricVariableInstanceQuery)2