Search in sources :

Example 1 with BatchEntity

use of org.camunda.bpm.engine.impl.batch.BatchEntity 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 BatchEntity

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

the class ProcessInstanceRestServiceInteractionTest method testSuspendAsyncWithMultipleGroupOperations.

@Test
public void testSuspendAsyncWithMultipleGroupOperations() {
    List<String> ids = Arrays.asList(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID);
    ProcessInstanceQueryDto query = new ProcessInstanceQueryDto();
    Map<String, Object> messageBodyJson = new HashMap<String, Object>();
    messageBodyJson.put("processInstanceIds", ids);
    messageBodyJson.put("processInstanceQuery", query);
    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).byProcessInstanceQuery(query.toQuery(processEngine));
    verify(mockUpdateProcessInstancesSuspensionStateBuilder).suspendAsync();
}
Also used : HashMap(java.util.HashMap) BatchEntity(org.camunda.bpm.engine.impl.batch.BatchEntity) ExampleVariableObject(org.camunda.bpm.engine.rest.helper.ExampleVariableObject) ProcessInstanceQueryDto(org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto) HistoricProcessInstanceQueryDto(org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto) Test(org.junit.Test)

Example 3 with BatchEntity

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

the class ProcessInstanceRestServiceInteractionTest method testActivateAsyncWithHistoricProcessInstanceQuery.

@Test
public void testActivateAsyncWithHistoricProcessInstanceQuery() {
    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", 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).byProcessInstanceIds(ids);
    verify(mockUpdateProcessInstancesSuspensionStateBuilder).activateAsync();
}
Also used : HashMap(java.util.HashMap) BatchEntity(org.camunda.bpm.engine.impl.batch.BatchEntity) ExampleVariableObject(org.camunda.bpm.engine.rest.helper.ExampleVariableObject) Test(org.junit.Test)

Example 4 with BatchEntity

use of org.camunda.bpm.engine.impl.batch.BatchEntity 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 5 with BatchEntity

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

the class ProcessInstanceRestServiceInteractionTest method testActivateAsyncWithProcessInstances.

@Test
public void testActivateAsyncWithProcessInstances() {
    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", 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).byProcessInstanceIds(ids);
    verify(mockUpdateProcessInstancesSuspensionStateBuilder).activateAsync();
}
Also used : HashMap(java.util.HashMap) BatchEntity(org.camunda.bpm.engine.impl.batch.BatchEntity) ExampleVariableObject(org.camunda.bpm.engine.rest.helper.ExampleVariableObject) Test(org.junit.Test)

Aggregations

BatchEntity (org.camunda.bpm.engine.impl.batch.BatchEntity)32 Test (org.junit.Test)18 HashMap (java.util.HashMap)11 ExampleVariableObject (org.camunda.bpm.engine.rest.helper.ExampleVariableObject)11 HistoricProcessInstanceQuery (org.camunda.bpm.engine.history.HistoricProcessInstanceQuery)10 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)10 HistoricProcessInstanceQueryDto (org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto)6 DeleteProcessInstancesDto (org.camunda.bpm.engine.rest.dto.runtime.batch.DeleteProcessInstancesDto)6 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)5 ProcessInstanceQueryDto (org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto)4 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)2 BatchConfiguration (org.camunda.bpm.engine.impl.batch.BatchConfiguration)2 BatchJobHandler (org.camunda.bpm.engine.impl.batch.BatchJobHandler)2 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)2 Date (java.util.Date)1 HistoricBatch (org.camunda.bpm.engine.batch.history.HistoricBatch)1 ModificationBatchConfiguration (org.camunda.bpm.engine.impl.ModificationBatchConfiguration)1 SetRetriesBatchConfiguration (org.camunda.bpm.engine.impl.batch.SetRetriesBatchConfiguration)1 UpdateProcessInstancesSuspendStateBatchConfiguration (org.camunda.bpm.engine.impl.batch.update.UpdateProcessInstancesSuspendStateBatchConfiguration)1 BatchManager (org.camunda.bpm.engine.impl.persistence.entity.BatchManager)1