Search in sources :

Example 26 with MigrationExecutionDtoBuilder

use of org.camunda.bpm.engine.rest.util.migration.MigrationExecutionDtoBuilder in project camunda-bpm-platform by camunda.

the class MigrationRestServiceInteractionTest method executeMigrationPlanWithProcessInstanceQuery.

@Test
public void executeMigrationPlanWithProcessInstanceQuery() {
    when(runtimeServiceMock.createProcessInstanceQuery()).thenReturn(new ProcessInstanceQueryImpl());
    ProcessInstanceQueryDto processInstanceQuery = new ProcessInstanceQueryDto();
    processInstanceQuery.setProcessDefinitionId(EXAMPLE_PROCESS_DEFINITION_ID);
    Map<String, Object> migrationExecution = new MigrationExecutionDtoBuilder().migrationPlan(EXAMPLE_PROCESS_DEFINITION_ID, ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID).instruction(EXAMPLE_ACTIVITY_ID, ANOTHER_EXAMPLE_ACTIVITY_ID).instruction(ANOTHER_EXAMPLE_ACTIVITY_ID, EXAMPLE_ACTIVITY_ID).done().processInstanceQuery(processInstanceQuery).build();
    given().contentType(POST_JSON_CONTENT_TYPE).body(migrationExecution).then().expect().statusCode(Status.NO_CONTENT.getStatusCode()).when().post(EXECUTE_MIGRATION_URL);
    verifyCreateMigrationPlanInteraction(migrationPlanBuilderMock, (Map<String, Object>) migrationExecution.get(MigrationExecutionDtoBuilder.PROP_MIGRATION_PLAN));
    verifyMigrationPlanExecutionInteraction(migrationExecution);
}
Also used : MigrationExecutionDtoBuilder(org.camunda.bpm.engine.rest.util.migration.MigrationExecutionDtoBuilder) ProcessInstanceQueryImpl(org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl) ProcessInstanceQueryDto(org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 27 with MigrationExecutionDtoBuilder

use of org.camunda.bpm.engine.rest.util.migration.MigrationExecutionDtoBuilder in project camunda-bpm-platform by camunda.

the class MigrationRestServiceInteractionTest method executeMigrationPlanAsync.

@Test
public void executeMigrationPlanAsync() {
    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).instruction(ANOTHER_EXAMPLE_ACTIVITY_ID, EXAMPLE_ACTIVITY_ID).done().processInstances(EXAMPLE_PROCESS_INSTANCE_ID, ANOTHER_EXAMPLE_PROCESS_INSTANCE_ID).build();
    given().contentType(POST_JSON_CONTENT_TYPE).body(migrationExecution).then().expect().statusCode(Status.OK.getStatusCode()).body("id", is(EXAMPLE_BATCH_ID)).body("type", is(EXAMPLE_BATCH_TYPE)).body("totalJobs", is(EXAMPLE_BATCH_TOTAL_JOBS)).body("batchJobsPerSeed", is(EXAMPLE_BATCH_JOBS_PER_SEED)).body("invocationsPerBatchJob", is(EXAMPLE_INVOCATIONS_PER_BATCH_JOB)).body("seedJobDefinitionId", is(EXAMPLE_SEED_JOB_DEFINITION_ID)).body("monitorJobDefinitionId", is(EXAMPLE_MONITOR_JOB_DEFINITION_ID)).body("batchJobDefinitionId", is(EXAMPLE_BATCH_JOB_DEFINITION_ID)).body("tenantId", is(EXAMPLE_TENANT_ID)).when().post(EXECUTE_MIGRATION_ASYNC_URL);
    verifyCreateMigrationPlanInteraction(migrationPlanBuilderMock, (Map<String, Object>) migrationExecution.get(MigrationExecutionDtoBuilder.PROP_MIGRATION_PLAN));
    verifyMigrationPlanAsyncExecutionInteraction(migrationExecution);
}
Also used : MigrationExecutionDtoBuilder(org.camunda.bpm.engine.rest.util.migration.MigrationExecutionDtoBuilder) MockProvider.createMockBatch(org.camunda.bpm.engine.rest.helper.MockProvider.createMockBatch) Batch(org.camunda.bpm.engine.batch.Batch) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 28 with MigrationExecutionDtoBuilder

use of org.camunda.bpm.engine.rest.util.migration.MigrationExecutionDtoBuilder in project camunda-bpm-platform by camunda.

the class MigrationRestServiceInteractionTest method executeMigrationPlanAsyncSkipIoMappings.

@Test
public void executeMigrationPlanAsyncSkipIoMappings() {
    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).skipIoMappings(true).build();
    given().contentType(POST_JSON_CONTENT_TYPE).body(migrationExecution).then().expect().statusCode(Status.OK.getStatusCode()).when().post(EXECUTE_MIGRATION_ASYNC_URL);
    verifyMigrationPlanAsyncExecutionInteraction(migrationExecution);
}
Also used : MigrationExecutionDtoBuilder(org.camunda.bpm.engine.rest.util.migration.MigrationExecutionDtoBuilder) MockProvider.createMockBatch(org.camunda.bpm.engine.rest.helper.MockProvider.createMockBatch) Batch(org.camunda.bpm.engine.batch.Batch) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Aggregations

MigrationExecutionDtoBuilder (org.camunda.bpm.engine.rest.util.migration.MigrationExecutionDtoBuilder)28 Test (org.junit.Test)28 Matchers.anyString (org.mockito.Matchers.anyString)28 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)16 FluentAnswer (org.camunda.bpm.engine.rest.helper.FluentAnswer)8 JoinedMigrationPlanBuilderMock (org.camunda.bpm.engine.rest.helper.MockMigrationPlanBuilder.JoinedMigrationPlanBuilderMock)8 MigrationInstructionValidationReport (org.camunda.bpm.engine.migration.MigrationInstructionValidationReport)6 MigrationPlanValidationException (org.camunda.bpm.engine.migration.MigrationPlanValidationException)6 MigrationPlanValidationReport (org.camunda.bpm.engine.migration.MigrationPlanValidationReport)6 Batch (org.camunda.bpm.engine.batch.Batch)4 MockProvider.createMockBatch (org.camunda.bpm.engine.rest.helper.MockProvider.createMockBatch)4 MigrationInstruction (org.camunda.bpm.engine.migration.MigrationInstruction)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ProcessInstanceQueryImpl (org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl)2 ProcessInstanceQueryDto (org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto)2 MigratingActivityInstanceValidationReport (org.camunda.bpm.engine.migration.MigratingActivityInstanceValidationReport)1 MigratingProcessInstanceValidationException (org.camunda.bpm.engine.migration.MigratingProcessInstanceValidationException)1 MigratingProcessInstanceValidationReport (org.camunda.bpm.engine.migration.MigratingProcessInstanceValidationReport)1 MigratingTransitionInstanceValidationReport (org.camunda.bpm.engine.migration.MigratingTransitionInstanceValidationReport)1