Search in sources :

Example 1 with DeleteProcessInstancesDto

use of org.camunda.bpm.engine.rest.dto.runtime.batch.DeleteProcessInstancesDto in project camunda-bpm-platform by camunda.

the class ProcessInstanceRestServiceInteractionTest method testDeleteAsyncHistoricQueryBasedWithSkipSubprocesses.

@Test
public void testDeleteAsyncHistoricQueryBasedWithSkipSubprocesses() {
    when(runtimeServiceMock.deleteProcessInstancesAsync(anyListOf(String.class), any(ProcessInstanceQuery.class), anyString(), anyBoolean(), anyBoolean())).thenReturn(new BatchEntity());
    DeleteProcessInstancesDto body = new DeleteProcessInstancesDto();
    body.setSkipSubprocesses(true);
    given().contentType(ContentType.JSON).body(body).then().expect().statusCode(Status.OK.getStatusCode()).when().post(DELETE_PROCESS_INSTANCES_ASYNC_HIST_QUERY_URL);
    verify(runtimeServiceMock, times(1)).deleteProcessInstancesAsync(new ArrayList<String>(), null, null, false, true);
}
Also used : HistoricProcessInstanceQuery(org.camunda.bpm.engine.history.HistoricProcessInstanceQuery) ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) BatchEntity(org.camunda.bpm.engine.impl.batch.BatchEntity) DeleteProcessInstancesDto(org.camunda.bpm.engine.rest.dto.runtime.batch.DeleteProcessInstancesDto) Test(org.junit.Test)

Example 2 with DeleteProcessInstancesDto

use of org.camunda.bpm.engine.rest.dto.runtime.batch.DeleteProcessInstancesDto in project camunda-bpm-platform by camunda.

the class ProcessInstanceRestServiceInteractionTest method testDeleteAsyncHistoricQueryBasedWithoutQueryAndWithoutProcessInstanceIds.

@Test
public void testDeleteAsyncHistoricQueryBasedWithoutQueryAndWithoutProcessInstanceIds() {
    doThrow(new BadUserRequestException("processInstanceIds is empty")).when(runtimeServiceMock).deleteProcessInstancesAsync(anyListOf(String.class), eq((ProcessInstanceQuery) null), anyString(), anyBoolean(), anyBoolean());
    given().contentType(ContentType.JSON).body(new DeleteProcessInstancesDto()).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).when().post(DELETE_PROCESS_INSTANCES_ASYNC_HIST_QUERY_URL);
    verify(runtimeServiceMock, times(1)).deleteProcessInstancesAsync(new ArrayList<String>(), null, null, false, false);
}
Also used : HistoricProcessInstanceQuery(org.camunda.bpm.engine.history.HistoricProcessInstanceQuery) ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) BadUserRequestException(org.camunda.bpm.engine.BadUserRequestException) DeleteProcessInstancesDto(org.camunda.bpm.engine.rest.dto.runtime.batch.DeleteProcessInstancesDto) Test(org.junit.Test)

Example 3 with DeleteProcessInstancesDto

use of org.camunda.bpm.engine.rest.dto.runtime.batch.DeleteProcessInstancesDto in project camunda-bpm-platform by camunda.

the class ProcessInstanceRestServiceInteractionTest method testDeleteAsyncHistoricQueryBasedWithDeleteReason.

@Test
public void testDeleteAsyncHistoricQueryBasedWithDeleteReason() {
    when(runtimeServiceMock.deleteProcessInstancesAsync(anyListOf(String.class), any(ProcessInstanceQuery.class), anyString(), anyBoolean(), anyBoolean())).thenReturn(new BatchEntity());
    DeleteProcessInstancesDto body = new DeleteProcessInstancesDto();
    body.setDeleteReason(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_DELETE_REASON);
    given().contentType(ContentType.JSON).body(body).then().expect().statusCode(Status.OK.getStatusCode()).when().post(DELETE_PROCESS_INSTANCES_ASYNC_HIST_QUERY_URL);
    verify(runtimeServiceMock, times(1)).deleteProcessInstancesAsync(new ArrayList<String>(), null, MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_DELETE_REASON, false, false);
}
Also used : HistoricProcessInstanceQuery(org.camunda.bpm.engine.history.HistoricProcessInstanceQuery) ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) BatchEntity(org.camunda.bpm.engine.impl.batch.BatchEntity) DeleteProcessInstancesDto(org.camunda.bpm.engine.rest.dto.runtime.batch.DeleteProcessInstancesDto) Test(org.junit.Test)

Example 4 with DeleteProcessInstancesDto

use of org.camunda.bpm.engine.rest.dto.runtime.batch.DeleteProcessInstancesDto in project camunda-bpm-platform by camunda.

the class ProcessInstanceRestServiceInteractionTest method testDeleteAsyncHistoricQueryBasedWithSkipCustomListenerTrue.

@Test
public void testDeleteAsyncHistoricQueryBasedWithSkipCustomListenerTrue() {
    when(runtimeServiceMock.deleteProcessInstancesAsync(anyListOf(String.class), any(ProcessInstanceQuery.class), anyString(), anyBoolean(), anyBoolean())).thenReturn(new BatchEntity());
    DeleteProcessInstancesDto body = new DeleteProcessInstancesDto();
    body.setSkipCustomListeners(true);
    given().contentType(ContentType.JSON).body(body).then().expect().statusCode(Status.OK.getStatusCode()).when().post(DELETE_PROCESS_INSTANCES_ASYNC_HIST_QUERY_URL);
    verify(runtimeServiceMock, times(1)).deleteProcessInstancesAsync(new ArrayList<String>(), null, null, true, false);
}
Also used : HistoricProcessInstanceQuery(org.camunda.bpm.engine.history.HistoricProcessInstanceQuery) ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) BatchEntity(org.camunda.bpm.engine.impl.batch.BatchEntity) DeleteProcessInstancesDto(org.camunda.bpm.engine.rest.dto.runtime.batch.DeleteProcessInstancesDto) Test(org.junit.Test)

Example 5 with DeleteProcessInstancesDto

use of org.camunda.bpm.engine.rest.dto.runtime.batch.DeleteProcessInstancesDto in project camunda-bpm-platform by camunda.

the class ProcessInstanceRestServiceInteractionTest method testDeleteAsyncHistoricQueryBasedWithProcessInstanceIds.

@Test
public void testDeleteAsyncHistoricQueryBasedWithProcessInstanceIds() {
    when(runtimeServiceMock.deleteProcessInstancesAsync(anyListOf(String.class), any(ProcessInstanceQuery.class), anyString(), anyBoolean(), anyBoolean())).thenReturn(new BatchEntity());
    DeleteProcessInstancesDto body = new DeleteProcessInstancesDto();
    body.setProcessInstanceIds(Arrays.asList(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID));
    given().contentType(ContentType.JSON).body(body).then().expect().statusCode(Status.OK.getStatusCode()).when().post(DELETE_PROCESS_INSTANCES_ASYNC_HIST_QUERY_URL);
    verify(runtimeServiceMock, times(1)).deleteProcessInstancesAsync(Arrays.asList(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID), null, null, false, false);
}
Also used : HistoricProcessInstanceQuery(org.camunda.bpm.engine.history.HistoricProcessInstanceQuery) ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) BatchEntity(org.camunda.bpm.engine.impl.batch.BatchEntity) DeleteProcessInstancesDto(org.camunda.bpm.engine.rest.dto.runtime.batch.DeleteProcessInstancesDto) Test(org.junit.Test)

Aggregations

HistoricProcessInstanceQuery (org.camunda.bpm.engine.history.HistoricProcessInstanceQuery)7 DeleteProcessInstancesDto (org.camunda.bpm.engine.rest.dto.runtime.batch.DeleteProcessInstancesDto)7 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)7 Test (org.junit.Test)7 BatchEntity (org.camunda.bpm.engine.impl.batch.BatchEntity)6 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)2 HistoricProcessInstanceQueryDto (org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto)2 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)1