Search in sources :

Example 11 with HistoricProcessInstanceQueryImpl

use of org.camunda.bpm.engine.impl.HistoricProcessInstanceQueryImpl in project camunda-bpm-platform by camunda.

the class RestartProcessInstanceRestServiceTest method testRestartProcessInstanceWithoutProcessInstanceIdsAsync.

@Test
public void testRestartProcessInstanceWithoutProcessInstanceIdsAsync() {
    when(historyServiceMock.createHistoricProcessInstanceQuery()).thenReturn(new HistoricProcessInstanceQueryImpl());
    Map<String, Object> json = new HashMap<String, Object>();
    List<Map<String, Object>> instructions = new ArrayList<Map<String, Object>>();
    HistoricProcessInstanceQueryDto query = new HistoricProcessInstanceQueryDto();
    query.setFinished(true);
    json.put("historicProcessInstanceQuery", query);
    instructions.add(ModificationInstructionBuilder.startBefore().activityId("activityId").getJson());
    json.put("instructions", instructions);
    given().pathParam("id", MockProvider.EXAMPLE_PROCESS_DEFINITION_ID).contentType(ContentType.JSON).body(json).then().expect().statusCode(Status.OK.getStatusCode()).when().post(RESTART_PROCESS_INSTANCE_ASYNC_URL);
    verify(builderMock).startBeforeActivity("activityId");
    verify(builderMock).historicProcessInstanceQuery(query.toQuery(processEngine));
    verify(builderMock).executeAsync();
    verifyNoMoreInteractions(builderMock);
}
Also used : HistoricProcessInstanceQueryDto(org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Matchers.anyString(org.mockito.Matchers.anyString) HashMap(java.util.HashMap) Map(java.util.Map) HistoricProcessInstanceQueryImpl(org.camunda.bpm.engine.impl.HistoricProcessInstanceQueryImpl) Test(org.junit.Test)

Aggregations

HistoricProcessInstanceQueryImpl (org.camunda.bpm.engine.impl.HistoricProcessInstanceQueryImpl)11 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)6 HistoricProcessInstanceQueryDto (org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto)6 Test (org.junit.Test)6 Matchers.anyString (org.mockito.Matchers.anyString)6 HashSet (java.util.HashSet)4 Map (java.util.Map)4 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)2 HistoricProcessInstanceQuery (org.camunda.bpm.engine.history.HistoricProcessInstanceQuery)2 ProcessInstanceQueryImpl (org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl)2 List (java.util.List)1 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)1 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)1