use of org.camunda.bpm.engine.impl.batch.BatchEntity in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testDeleteAsyncWithSkipCustomListeners.
@Test
public void testDeleteAsyncWithSkipCustomListeners() {
when(runtimeServiceMock.deleteProcessInstancesAsync(anyListOf(String.class), any(ProcessInstanceQuery.class), anyString(), anyBoolean(), anyBoolean())).thenReturn(new BatchEntity());
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
messageBodyJson.put("deleteReason", TEST_DELETE_REASON);
messageBodyJson.put("processInstanceIds", Arrays.asList("processInstanceId1", "processInstanceId2"));
messageBodyJson.put("skipCustomListeners", true);
given().contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.OK.getStatusCode()).when().post(DELETE_PROCESS_INSTANCES_ASYNC_URL);
verify(runtimeServiceMock).deleteProcessInstancesAsync(anyListOf(String.class), Mockito.any(ProcessInstanceQuery.class), Mockito.eq(TEST_DELETE_REASON), Mockito.eq(true), Mockito.eq(false));
}
use of org.camunda.bpm.engine.impl.batch.BatchEntity 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);
}
use of org.camunda.bpm.engine.impl.batch.BatchEntity in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testSuspendAsyncWithHistoricProcessInstanceQuery.
@Test
public void testSuspendAsyncWithHistoricProcessInstanceQuery() {
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
List<String> ids = Arrays.asList(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID);
messageBodyJson.put("processInstanceIds", ids);
messageBodyJson.put("suspended", true);
when(mockUpdateProcessInstancesSuspensionStateBuilder.suspendAsync()).thenReturn(new BatchEntity());
given().contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.OK.getStatusCode()).when().post(PROCESS_INSTANCE_SUSPENDED_ASYNC_URL);
verify(mockUpdateSuspensionStateSelectBuilder).byProcessInstanceIds(ids);
verify(mockUpdateProcessInstancesSuspensionStateBuilder).suspendAsync();
}
use of org.camunda.bpm.engine.impl.batch.BatchEntity 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);
}
use of org.camunda.bpm.engine.impl.batch.BatchEntity in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testActivateAsyncWithProcessInstanceQuery.
@Test
public void testActivateAsyncWithProcessInstanceQuery() {
ProcessInstanceQueryDto query = new ProcessInstanceQueryDto();
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
messageBodyJson.put("processInstanceQuery", query);
messageBodyJson.put("suspended", false);
when(mockUpdateProcessInstancesSuspensionStateBuilder.activateAsync()).thenReturn(new BatchEntity());
given().contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.OK.getStatusCode()).when().post(PROCESS_INSTANCE_SUSPENDED_ASYNC_URL);
verify(mockUpdateSuspensionStateSelectBuilder).byProcessInstanceQuery(query.toQuery(processEngine));
verify(mockUpdateProcessInstancesSuspensionStateBuilder).activateAsync();
}
Aggregations