@Test public void testApplyForModuleFullBuild() { when(internalBuildConfig.getBuildType()).thenReturn(LocalBuildConfig.BuildType.FULL_BUILD); when(internalBuildConfig.getModule()).thenReturn(module); when(buildHelper.build(module)).thenReturn(buildResult); Optional<LocalBinaryConfig> result = executor.apply(internalBuildConfig, buildExecConfig); assertTrue(result.isPresent()); assertEquals(builder, result.get().getBuilder()); assertEquals(buildResults, result.get().getBuildResults()); verify(buildHelper, times(1)).build(module); }
@Override public Optional<LocalBinaryConfig> apply(LocalBuildConfigInternal localBuildConfigInternal, LocalBuildExecConfig localBuildExecConfig) { Optional<LocalBinaryConfig> result = Optional.empty(); BuildHelper.BuildResult buildResult; switch (localBuildConfigInternal.getBuildType()) { case FULL_BUILD: buildResult = buildHelper.build(localBuildConfigInternal.getModule()); result = Optional.of(new LocalBuildBinaryImpl(buildResult.getBuilder(), buildResult.getBuildResults())); break; case INCREMENTAL_ADD_RESOURCE: result = Optional.of(new LocalBuildBinaryImpl( buildHelper.addPackageResource(localBuildConfigInternal.getResource()))); break; case INCREMENTAL_UPDATE_RESOURCE: result = Optional.of(new LocalBuildBinaryImpl( buildHelper.updatePackageResource(localBuildConfigInternal.getResource()))); break; case INCREMENTAL_DELETE_RESOURCE: result = Optional.of(new LocalBuildBinaryImpl( buildHelper.deletePackageResource(localBuildConfigInternal.getResource()))); break; case INCREMENTAL_BATCH_CHANGES: result = Optional.of( new LocalBuildBinaryImpl(buildHelper.applyBatchResourceChanges( localBuildConfigInternal.getModule(), localBuildConfigInternal.getResourceChanges()))); break; case FULL_BUILD_AND_DEPLOY: result = Optional.of( new LocalBuildBinaryImpl( buildHelper.buildAndDeploy(localBuildConfigInternal.getModule(), localBuildConfigInternal.isSuppressHandlers(), toDeploymentMode(localBuildConfigInternal.getDeploymentType())))); break; } return result; }
LocalBuildExecConfigExecutor implements BiFunctionConfigExecutor<LocalBuildConfigInternal, LocalBuildExecConfig, LocalBinaryConfig> { @Override public Optional<LocalBinaryConfig> apply(LocalBuildConfigInternal localBuildConfigInternal, LocalBuildExecConfig localBuildExecConfig) { Optional<LocalBinaryConfig> result = Optional.empty(); BuildHelper.BuildResult buildResult; switch (localBuildConfigInternal.getBuildType()) { case FULL_BUILD: buildResult = buildHelper.build(localBuildConfigInternal.getModule()); result = Optional.of(new LocalBuildBinaryImpl(buildResult.getBuilder(), buildResult.getBuildResults())); break; case INCREMENTAL_ADD_RESOURCE: result = Optional.of(new LocalBuildBinaryImpl( buildHelper.addPackageResource(localBuildConfigInternal.getResource()))); break; case INCREMENTAL_UPDATE_RESOURCE: result = Optional.of(new LocalBuildBinaryImpl( buildHelper.updatePackageResource(localBuildConfigInternal.getResource()))); break; case INCREMENTAL_DELETE_RESOURCE: result = Optional.of(new LocalBuildBinaryImpl( buildHelper.deletePackageResource(localBuildConfigInternal.getResource()))); break; case INCREMENTAL_BATCH_CHANGES: result = Optional.of( new LocalBuildBinaryImpl(buildHelper.applyBatchResourceChanges( localBuildConfigInternal.getModule(), localBuildConfigInternal.getResourceChanges()))); break; case FULL_BUILD_AND_DEPLOY: result = Optional.of( new LocalBuildBinaryImpl( buildHelper.buildAndDeploy(localBuildConfigInternal.getModule(), localBuildConfigInternal.isSuppressHandlers(), toDeploymentMode(localBuildConfigInternal.getDeploymentType())))); break; } return result; } }
LocalBuildExecConfigExecutor implements BiFunctionConfigExecutor<LocalBuildConfigInternal, LocalBuildExecConfig, LocalBinaryConfig> { @Override public Optional<LocalBinaryConfig> apply(LocalBuildConfigInternal localBuildConfigInternal, LocalBuildExecConfig localBuildExecConfig) { Optional<LocalBinaryConfig> result = Optional.empty(); BuildHelper.BuildResult buildResult; switch (localBuildConfigInternal.getBuildType()) { case FULL_BUILD: buildResult = buildHelper.build(localBuildConfigInternal.getModule()); result = Optional.of(new LocalBuildBinaryImpl(buildResult.getBuilder(), buildResult.getBuildResults())); break; case INCREMENTAL_ADD_RESOURCE: result = Optional.of(new LocalBuildBinaryImpl( buildHelper.addPackageResource(localBuildConfigInternal.getResource()))); break; case INCREMENTAL_UPDATE_RESOURCE: result = Optional.of(new LocalBuildBinaryImpl( buildHelper.updatePackageResource(localBuildConfigInternal.getResource()))); break; case INCREMENTAL_DELETE_RESOURCE: result = Optional.of(new LocalBuildBinaryImpl( buildHelper.deletePackageResource(localBuildConfigInternal.getResource()))); break; case INCREMENTAL_BATCH_CHANGES: result = Optional.of( new LocalBuildBinaryImpl(buildHelper.applyBatchResourceChanges( localBuildConfigInternal.getModule(), localBuildConfigInternal.getResourceChanges()))); break; case FULL_BUILD_AND_DEPLOY: result = Optional.of( new LocalBuildBinaryImpl( buildHelper.buildAndDeploy(localBuildConfigInternal.getModule(), localBuildConfigInternal.isSuppressHandlers(), toDeploymentMode(localBuildConfigInternal.getDeploymentType())))); break; } return result; } LocalBuildExecConfigExecutor(); @Inject  LocalBuildExecConfigExecutor(BuildHelper buildHelper); }
LocalBuildExecConfigExecutor implements BiFunctionConfigExecutor<LocalBuildConfigInternal, LocalBuildExecConfig, LocalBinaryConfig> { @Override public Optional<LocalBinaryConfig> apply(LocalBuildConfigInternal localBuildConfigInternal, LocalBuildExecConfig localBuildExecConfig) { Optional<LocalBinaryConfig> result = Optional.empty(); BuildHelper.BuildResult buildResult; switch (localBuildConfigInternal.getBuildType()) { case FULL_BUILD: buildResult = buildHelper.build(localBuildConfigInternal.getModule()); result = Optional.of(new LocalBuildBinaryImpl(buildResult.getBuilder(), buildResult.getBuildResults())); break; case INCREMENTAL_ADD_RESOURCE: result = Optional.of(new LocalBuildBinaryImpl( buildHelper.addPackageResource(localBuildConfigInternal.getResource()))); break; case INCREMENTAL_UPDATE_RESOURCE: result = Optional.of(new LocalBuildBinaryImpl( buildHelper.updatePackageResource(localBuildConfigInternal.getResource()))); break; case INCREMENTAL_DELETE_RESOURCE: result = Optional.of(new LocalBuildBinaryImpl( buildHelper.deletePackageResource(localBuildConfigInternal.getResource()))); break; case INCREMENTAL_BATCH_CHANGES: result = Optional.of( new LocalBuildBinaryImpl(buildHelper.applyBatchResourceChanges( localBuildConfigInternal.getModule(), localBuildConfigInternal.getResourceChanges()))); break; case FULL_BUILD_AND_DEPLOY: result = Optional.of( new LocalBuildBinaryImpl( buildHelper.buildAndDeploy(localBuildConfigInternal.getModule(), localBuildConfigInternal.isSuppressHandlers(), toDeploymentMode(localBuildConfigInternal.getDeploymentType())))); break; } return result; } LocalBuildExecConfigExecutor(); @Inject  LocalBuildExecConfigExecutor(BuildHelper buildHelper); @Override Optional<LocalBinaryConfig> apply(LocalBuildConfigInternal localBuildConfigInternal, LocalBuildExecConfig localBuildExecConfig); @Override Class<? extends Config> executeFor(); @Override String outputId(); }
LocalBuildExecConfigExecutor implements BiFunctionConfigExecutor<LocalBuildConfigInternal, LocalBuildExecConfig, LocalBinaryConfig> { @Override public Optional<LocalBinaryConfig> apply(LocalBuildConfigInternal localBuildConfigInternal, LocalBuildExecConfig localBuildExecConfig) { Optional<LocalBinaryConfig> result = Optional.empty(); BuildHelper.BuildResult buildResult; switch (localBuildConfigInternal.getBuildType()) { case FULL_BUILD: buildResult = buildHelper.build(localBuildConfigInternal.getModule()); result = Optional.of(new LocalBuildBinaryImpl(buildResult.getBuilder(), buildResult.getBuildResults())); break; case INCREMENTAL_ADD_RESOURCE: result = Optional.of(new LocalBuildBinaryImpl( buildHelper.addPackageResource(localBuildConfigInternal.getResource()))); break; case INCREMENTAL_UPDATE_RESOURCE: result = Optional.of(new LocalBuildBinaryImpl( buildHelper.updatePackageResource(localBuildConfigInternal.getResource()))); break; case INCREMENTAL_DELETE_RESOURCE: result = Optional.of(new LocalBuildBinaryImpl( buildHelper.deletePackageResource(localBuildConfigInternal.getResource()))); break; case INCREMENTAL_BATCH_CHANGES: result = Optional.of( new LocalBuildBinaryImpl(buildHelper.applyBatchResourceChanges( localBuildConfigInternal.getModule(), localBuildConfigInternal.getResourceChanges()))); break; case FULL_BUILD_AND_DEPLOY: result = Optional.of( new LocalBuildBinaryImpl( buildHelper.buildAndDeploy(localBuildConfigInternal.getModule(), localBuildConfigInternal.isSuppressHandlers(), toDeploymentMode(localBuildConfigInternal.getDeploymentType())))); break; } return result; } LocalBuildExecConfigExecutor(); @Inject  LocalBuildExecConfigExecutor(BuildHelper buildHelper); @Override Optional<LocalBinaryConfig> apply(LocalBuildConfigInternal localBuildConfigInternal, LocalBuildExecConfig localBuildExecConfig); @Override Class<? extends Config> executeFor(); @Override String outputId();  }