use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class BatchRestServiceImpl method getBatches.
public List<BatchDto> getBatches(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
BatchQueryDto queryDto = new BatchQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
BatchQuery query = queryDto.toQuery(getProcessEngine());
List<Batch> matchingBatches;
if (firstResult != null || maxResults != null) {
matchingBatches = executePaginatedQuery(query, firstResult, maxResults);
} else {
matchingBatches = query.list();
}
List<BatchDto> batchResults = new ArrayList<BatchDto>();
for (Batch matchingBatch : matchingBatches) {
batchResults.add(BatchDto.fromBatch(matchingBatch));
}
return batchResults;
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class RestartProcessInstanceRestServiceTest method setUpRuntimeData.
@Before
public void setUpRuntimeData() {
runtimeServiceMock = mock(RuntimeService.class);
when(processEngine.getRuntimeService()).thenReturn(runtimeServiceMock);
historyServiceMock = mock(HistoryService.class);
when(processEngine.getHistoryService()).thenReturn(historyServiceMock);
builderMock = mock(RestartProcessInstanceBuilder.class);
when(builderMock.startAfterActivity(anyString())).thenReturn(builderMock);
when(builderMock.startBeforeActivity(anyString())).thenReturn(builderMock);
when(builderMock.startTransition(anyString())).thenReturn(builderMock);
when(builderMock.processInstanceIds(anyListOf(String.class))).thenReturn(builderMock);
when(builderMock.historicProcessInstanceQuery(any(HistoricProcessInstanceQuery.class))).thenReturn(builderMock);
when(builderMock.skipCustomListeners()).thenReturn(builderMock);
when(builderMock.skipIoMappings()).thenReturn(builderMock);
when(builderMock.initialSetOfVariables()).thenReturn(builderMock);
when(builderMock.withoutBusinessKey()).thenReturn(builderMock);
Batch batchMock = createMockBatch();
when(builderMock.executeAsync()).thenReturn(batchMock);
when(runtimeServiceMock.restartProcessInstances(anyString())).thenReturn(builderMock);
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class MigrationRestServiceInteractionTest method executeMigrationPlanAsyncSkipListeners.
@Test
public void executeMigrationPlanAsyncSkipListeners() {
Batch batchMock = createMockBatch();
when(migrationPlanExecutionBuilderMock.executeAsync()).thenReturn(batchMock);
Map<String, Object> migrationExecution = new MigrationExecutionDtoBuilder().migrationPlan(EXAMPLE_PROCESS_DEFINITION_ID, ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID).instruction(EXAMPLE_ACTIVITY_ID, ANOTHER_EXAMPLE_ACTIVITY_ID).done().processInstances(EXAMPLE_PROCESS_INSTANCE_ID).skipCustomListeners(true).build();
given().contentType(POST_JSON_CONTENT_TYPE).body(migrationExecution).then().expect().statusCode(Status.OK.getStatusCode()).when().post(EXECUTE_MIGRATION_ASYNC_URL);
verifyMigrationPlanAsyncExecutionInteraction(migrationExecution);
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class ModificationRestServiceInteractionTest method setUpRuntimeData.
@Before
public void setUpRuntimeData() {
runtimeServiceMock = mock(RuntimeService.class);
when(processEngine.getRuntimeService()).thenReturn(runtimeServiceMock);
modificationBuilderMock = mock(ModificationBuilder.class);
when(modificationBuilderMock.cancelAllForActivity(anyString())).thenReturn(modificationBuilderMock);
when(modificationBuilderMock.startAfterActivity(anyString())).thenReturn(modificationBuilderMock);
when(modificationBuilderMock.startBeforeActivity(anyString())).thenReturn(modificationBuilderMock);
when(modificationBuilderMock.startTransition(anyString())).thenReturn(modificationBuilderMock);
when(modificationBuilderMock.processInstanceIds(anyListOf(String.class))).thenReturn(modificationBuilderMock);
Batch batchMock = createMockBatch();
when(modificationBuilderMock.executeAsync()).thenReturn(batchMock);
when(runtimeServiceMock.createModification(anyString())).thenReturn(modificationBuilderMock);
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testSetRetriesByProcessAsync.
@Test
public void testSetRetriesByProcessAsync() {
List<String> ids = Arrays.asList(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID);
Batch batchEntity = MockProvider.createMockBatch();
when(mockManagementService.setJobRetriesAsync(anyListOf(String.class), any(ProcessInstanceQuery.class), anyInt())).thenReturn(batchEntity);
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
messageBodyJson.put("processInstances", ids);
messageBodyJson.put(RETRIES, 5);
Response response = given().contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.OK.getStatusCode()).when().post(SET_JOB_RETRIES_ASYNC_URL);
verifyBatchJson(response.asString());
verify(mockManagementService, times(1)).setJobRetriesAsync(eq(ids), eq((ProcessInstanceQuery) null), eq(5));
}
Aggregations