use of org.camunda.bpm.engine.history.HistoricProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testSuspendHistoricProcessInstanceQuery.
@Test
public void testSuspendHistoricProcessInstanceQuery() {
HistoricProcessInstanceQueryDto query = new HistoricProcessInstanceQueryDto();
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
messageBodyJson.put("historicProcessInstanceQuery", query);
messageBodyJson.put("suspended", true);
given().contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.NO_CONTENT.getStatusCode()).when().put(PROCESS_INSTANCE_SUSPENDED_URL);
verify(mockUpdateSuspensionStateSelectBuilder).byHistoricProcessInstanceQuery(any(HistoricProcessInstanceQuery.class));
verify(mockUpdateProcessInstancesSuspensionStateBuilder).suspend();
}
use of org.camunda.bpm.engine.history.HistoricProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testDeleteAsyncHistoricQueryBasedWithQueryAndProcessInstanceIds.
@Test
public void testDeleteAsyncHistoricQueryBasedWithQueryAndProcessInstanceIds() {
when(runtimeServiceMock.deleteProcessInstancesAsync(anyListOf(String.class), any(ProcessInstanceQuery.class), anyString(), anyBoolean(), anyBoolean())).thenReturn(new BatchEntity());
HistoricProcessInstanceQuery mockedHistoricProcessInstanceQuery = mock(HistoricProcessInstanceQueryImpl.class);
when(historyServiceMock.createHistoricProcessInstanceQuery()).thenReturn(mockedHistoricProcessInstanceQuery);
List<HistoricProcessInstance> historicProcessInstances = MockProvider.createMockRunningHistoricProcessInstances();
when(mockedHistoricProcessInstanceQuery.list()).thenReturn(historicProcessInstances);
DeleteProcessInstancesDto body = new DeleteProcessInstancesDto();
body.setHistoricProcessInstanceQuery(new HistoricProcessInstanceQueryDto());
body.setProcessInstanceIds(Arrays.asList(MockProvider.ANOTHER_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, MockProvider.ANOTHER_EXAMPLE_PROCESS_INSTANCE_ID), null, null, false, false);
}
use of org.camunda.bpm.engine.history.HistoricProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testActivateHistoricProcessInstanceQuery.
@Test
public void testActivateHistoricProcessInstanceQuery() {
HistoricProcessInstanceDto query = new HistoricProcessInstanceDto();
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
messageBodyJson.put("historicProcessInstanceQuery", query);
messageBodyJson.put("suspended", false);
given().contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.NO_CONTENT.getStatusCode()).when().put(PROCESS_INSTANCE_SUSPENDED_URL);
verify(mockUpdateSuspensionStateSelectBuilder).byHistoricProcessInstanceQuery(any(HistoricProcessInstanceQuery.class));
verify(mockUpdateProcessInstancesSuspensionStateBuilder).activate();
}
use of org.camunda.bpm.engine.history.HistoricProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testSetRetriesByProcessAsyncHistoricQueryBasedWithQueryAndProcessInstanceIds.
@Test
public void testSetRetriesByProcessAsyncHistoricQueryBasedWithQueryAndProcessInstanceIds() {
Batch batchEntity = MockProvider.createMockBatch();
when(mockManagementService.setJobRetriesAsync(anyListOf(String.class), eq((ProcessInstanceQuery) null), anyInt())).thenReturn(batchEntity);
HistoricProcessInstanceQuery mockedHistoricProcessInstanceQuery = mock(HistoricProcessInstanceQuery.class);
when(historyServiceMock.createHistoricProcessInstanceQuery()).thenReturn(mockedHistoricProcessInstanceQuery);
List<HistoricProcessInstance> historicProcessInstances = MockProvider.createMockRunningHistoricProcessInstances();
when(mockedHistoricProcessInstanceQuery.list()).thenReturn(historicProcessInstances);
SetJobRetriesByProcessDto body = new SetJobRetriesByProcessDto();
body.setRetries(MockProvider.EXAMPLE_JOB_RETRIES);
body.setProcessInstances(Arrays.asList(MockProvider.ANOTHER_EXAMPLE_PROCESS_INSTANCE_ID));
body.setHistoricProcessInstanceQuery(new HistoricProcessInstanceQueryDto());
given().contentType(ContentType.JSON).body(body).then().expect().statusCode(Status.OK.getStatusCode()).when().post(SET_JOB_RETRIES_ASYNC_HIST_QUERY_URL);
verify(mockManagementService, times(1)).setJobRetriesAsync(eq(Arrays.asList(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID, MockProvider.ANOTHER_EXAMPLE_PROCESS_INSTANCE_ID)), eq((ProcessInstanceQuery) null), eq(MockProvider.EXAMPLE_JOB_RETRIES));
}
use of org.camunda.bpm.engine.history.HistoricProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testSetRetriesByProcessAsyncHistoricQueryBasedWithNegativeRetries.
@Test
public void testSetRetriesByProcessAsyncHistoricQueryBasedWithNegativeRetries() {
doThrow(new BadUserRequestException("retries are negative")).when(mockManagementService).setJobRetriesAsync(anyListOf(String.class), eq((ProcessInstanceQuery) null), eq(MockProvider.EXAMPLE_NEGATIVE_JOB_RETRIES));
HistoricProcessInstanceQuery mockedHistoricProcessInstanceQuery = mock(HistoricProcessInstanceQuery.class);
when(historyServiceMock.createHistoricProcessInstanceQuery()).thenReturn(mockedHistoricProcessInstanceQuery);
List<HistoricProcessInstance> historicProcessInstances = MockProvider.createMockRunningHistoricProcessInstances();
when(mockedHistoricProcessInstanceQuery.list()).thenReturn(historicProcessInstances);
SetJobRetriesByProcessDto body = new SetJobRetriesByProcessDto();
body.setRetries(MockProvider.EXAMPLE_NEGATIVE_JOB_RETRIES);
body.setHistoricProcessInstanceQuery(new HistoricProcessInstanceQueryDto());
given().contentType(ContentType.JSON).body(body).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).when().post(SET_JOB_RETRIES_ASYNC_HIST_QUERY_URL);
}
Aggregations