@Test public void testApplyForIncrementalBatchChangesBuild() { when(internalBuildConfig.getBuildType()).thenReturn(LocalBuildConfig.BuildType.INCREMENTAL_BATCH_CHANGES); when(internalBuildConfig.getModule()).thenReturn(module); when(buildHelper.applyBatchResourceChanges(eq(module), anyMap())).thenReturn(incrementalBuildResults); Optional<LocalBinaryConfig> result = executor.apply(internalBuildConfig, buildExecConfig); assertTrue(result.isPresent()); assertEquals(incrementalBuildResults, result.get().getIncrementalBuildResults()); verify(buildHelper, times(1)).applyBatchResourceChanges(eq(module), anyMap()); }
case INCREMENTAL_BATCH_CHANGES: result = Optional.of( new LocalBuildBinaryImpl(buildHelper.applyBatchResourceChanges( localBuildConfigInternal.getModule(), localBuildConfigInternal.getResourceChanges())));
@Test public void testIncrementalBuildResourceChangesExecution() { when(buildHelper.applyBatchResourceChanges(eq(module), any(Map.class))).thenReturn(incrementalBuildResults); // prepare the pipeline input. Input input = createBatchChangesInput(ROOT_PATH_URI, LocalBuildConfig.BuildType.INCREMENTAL_BATCH_CHANGES.name(), changes); // execute the pipeline and verify the result. pipelineInitializer.getExecutor().execute(input, pipe, (Consumer<LocalBinaryConfig>) localBinaryConfig -> { assertEquals(incrementalBuildResults, localBinaryConfig.getIncrementalBuildResults()); }, pipelineEventListener); // verify that all stages were properly invoked. verifyLocalSourceConfigWasInvoked(); verifyLocalProjectConfigWasInvoked(); verifyLocalBuildConfigExecutorWasInvoked(module, changes); verifyLocalBuildExecConfigExecutorWasInvoked(module, changes); // verify the pipeline events where properly raised. verifyPipelineEvents(); }