Search in sources :

Example 1 with HistoricDetailQuery

use of org.camunda.bpm.engine.history.HistoricDetailQuery in project camunda-bpm-platform by camunda.

the class ProcessEngineRestServiceTest method testHistoryServiceEngineAccess_HistoricDetailBinaryFile.

@Ignore
@Test
public void testHistoryServiceEngineAccess_HistoricDetailBinaryFile() {
    HistoricDetailQuery query = mock(HistoricDetailQuery.class);
    HistoricVariableUpdate instance = mock(HistoricVariableUpdate.class);
    String filename = "test.txt";
    byte[] byteContent = "test".getBytes();
    String encoding = "UTF-8";
    FileValue variableValue = Variables.fileValue(filename).file(byteContent).mimeType(ContentType.TEXT.toString()).encoding(encoding).create();
    when(instance.getTypedValue()).thenReturn(variableValue);
    when(query.singleResult()).thenReturn(instance);
    when(mockHistoryService.createHistoricDetailQuery()).thenReturn(query);
    given().pathParam("name", EXAMPLE_ENGINE_NAME).then().expect().statusCode(Status.OK.getStatusCode()).body(is(equalTo(new String(byteContent)))).and().header("Content-Disposition", "attachment; filename=" + filename).contentType(CoreMatchers.<String>either(equalTo(ContentType.TEXT.toString() + ";charset=UTF-8")).or(equalTo(ContentType.TEXT.toString() + " ;charset=UTF-8"))).when().get(HISTORY_BINARY_DETAIL_URL);
    verify(mockHistoryService).createHistoricDetailQuery();
    verifyZeroInteractions(processEngine);
}
Also used : HistoricVariableUpdate(org.camunda.bpm.engine.history.HistoricVariableUpdate) FileValue(org.camunda.bpm.engine.variable.value.FileValue) HistoricDetailQuery(org.camunda.bpm.engine.history.HistoricDetailQuery) Matchers.anyString(org.mockito.Matchers.anyString) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with HistoricDetailQuery

use of org.camunda.bpm.engine.history.HistoricDetailQuery 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 3 with HistoricDetailQuery

use of org.camunda.bpm.engine.history.HistoricDetailQuery in project camunda-bpm-platform by camunda.

the class HistoricDetailRestServiceImpl method getHistoricDetailsCount.

@Override
public CountResultDto getHistoricDetailsCount(UriInfo uriInfo) {
    HistoricDetailQueryDto queryDto = new HistoricDetailQueryDto(objectMapper, uriInfo.getQueryParameters());
    HistoricDetailQuery query = queryDto.toQuery(processEngine);
    long count = query.count();
    CountResultDto result = new CountResultDto();
    result.setCount(count);
    return result;
}
Also used : HistoricDetailQueryDto(org.camunda.bpm.engine.rest.dto.history.HistoricDetailQueryDto) CountResultDto(org.camunda.bpm.engine.rest.dto.CountResultDto) HistoricDetailQuery(org.camunda.bpm.engine.history.HistoricDetailQuery)

Example 4 with HistoricDetailQuery

use of org.camunda.bpm.engine.history.HistoricDetailQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyHistoricDetailVariableUpdateQueryTest method testQueryWithoutTenantId.

public void testQueryWithoutTenantId() {
    HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableUpdates();
    assertThat(query.count(), is(4L));
}
Also used : HistoricDetailQuery(org.camunda.bpm.engine.history.HistoricDetailQuery)

Example 5 with HistoricDetailQuery

use of org.camunda.bpm.engine.history.HistoricDetailQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyHistoricDetailVariableUpdateQueryTest method testQueryAuthenticatedTenant.

public void testQueryAuthenticatedTenant() {
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    HistoricDetailQuery query = historyService.createHistoricDetailQuery();
    assertThat(query.count(), is(2L));
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(2L));
    assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
    assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count(), is(2L));
}
Also used : HistoricDetailQuery(org.camunda.bpm.engine.history.HistoricDetailQuery)

Aggregations

HistoricDetailQuery (org.camunda.bpm.engine.history.HistoricDetailQuery)49 Test (org.junit.Test)7 Deployment (org.camunda.bpm.engine.test.Deployment)5 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2 HistoricDetail (org.camunda.bpm.engine.history.HistoricDetail)2 HistoricDetailQueryDto (org.camunda.bpm.engine.rest.dto.history.HistoricDetailQueryDto)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)1 HistoricVariableInstance (org.camunda.bpm.engine.history.HistoricVariableInstance)1 HistoricVariableUpdate (org.camunda.bpm.engine.history.HistoricVariableUpdate)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 HistoricDetailDto (org.camunda.bpm.engine.rest.dto.history.HistoricDetailDto)1 Task (org.camunda.bpm.engine.task.Task)1 FileValue (org.camunda.bpm.engine.variable.value.FileValue)1 Ignore (org.junit.Ignore)1 Matchers.anyString (org.mockito.Matchers.anyString)1