@Test void testResolveComparisonConfigurationSameBranchAndBuildWithoutAlias() { ComparisonConfiguration config = getComparisonConfiguration(BRANCH_NAME_1, BRANCH_NAME_2, BUILD_NAME_2, COMPARISON_NAME); ComparisonConfiguration result = comparisonExecutor.resolveComparisonConfiguration( config, BUILD_NAME_1); assertEquals(BRANCH_NAME_1, result.getBaseBranchName()); assertEquals(BRANCH_NAME_2, result.getComparisonBranchName()); assertEquals(BUILD_NAME_2, result.getComparisonBuildName()); }
ComparisonConfiguration resolveComparisonConfiguration( ComparisonConfiguration comparisonConfiguration, String baseBuildName) { String lastSuccessFulAlias = configurationRepository.getConfiguration().getAliasForLastSuccessfulBuild(); String mostRecentAlias = configurationRepository.getConfiguration().getAliasForMostRecentBuild(); String baseBranchName = this.aliasResolver.resolveBranchAlias(comparisonConfiguration.getBaseBranchName()); String comparisonBranchName = this.aliasResolver.resolveBranchAlias(comparisonConfiguration.getComparisonBranchName()); boolean isBuildsFromSameBranch = baseBranchName.equals(comparisonBranchName); boolean isComparisonToLastSuccessBuild = comparisonConfiguration.getComparisonBuildName().equals(lastSuccessFulAlias); boolean isComparisonToMostRecentBuild = comparisonConfiguration.getComparisonBuildName().equals(mostRecentAlias); boolean isComparisonToBuildAlias = isComparisonToLastSuccessBuild ||isComparisonToMostRecentBuild; BuildIdentifier comparisonBuildIdentifier; if (isBuildsFromSameBranch && isComparisonToBuildAlias) { comparisonBuildIdentifier = getPreviousBuildIdentifier( comparisonConfiguration, baseBuildName, isComparisonToLastSuccessBuild); } else { comparisonBuildIdentifier = this.aliasResolver.resolveBranchAndBuildAliases( comparisonConfiguration.getComparisonBranchName(), comparisonConfiguration.getComparisonBuildName()); } if (comparisonBuildIdentifier == null || baseBuildName.equals(comparisonBuildIdentifier.getBuildName())) { return null; } return getResolvedComparisonConfiguration(comparisonConfiguration, comparisonBuildIdentifier); }
ComparisonExecutor { ComparisonConfiguration resolveComparisonConfiguration( ComparisonConfiguration comparisonConfiguration, String baseBuildName) { String lastSuccessFulAlias = configurationRepository.getConfiguration().getAliasForLastSuccessfulBuild(); String mostRecentAlias = configurationRepository.getConfiguration().getAliasForMostRecentBuild(); String baseBranchName = this.aliasResolver.resolveBranchAlias(comparisonConfiguration.getBaseBranchName()); String comparisonBranchName = this.aliasResolver.resolveBranchAlias(comparisonConfiguration.getComparisonBranchName()); boolean isBuildsFromSameBranch = baseBranchName.equals(comparisonBranchName); boolean isComparisonToLastSuccessBuild = comparisonConfiguration.getComparisonBuildName().equals(lastSuccessFulAlias); boolean isComparisonToMostRecentBuild = comparisonConfiguration.getComparisonBuildName().equals(mostRecentAlias); boolean isComparisonToBuildAlias = isComparisonToLastSuccessBuild ||isComparisonToMostRecentBuild; BuildIdentifier comparisonBuildIdentifier; if (isBuildsFromSameBranch && isComparisonToBuildAlias) { comparisonBuildIdentifier = getPreviousBuildIdentifier( comparisonConfiguration, baseBuildName, isComparisonToLastSuccessBuild); } else { comparisonBuildIdentifier = this.aliasResolver.resolveBranchAndBuildAliases( comparisonConfiguration.getComparisonBranchName(), comparisonConfiguration.getComparisonBuildName()); } if (comparisonBuildIdentifier == null || baseBuildName.equals(comparisonBuildIdentifier.getBuildName())) { return null; } return getResolvedComparisonConfiguration(comparisonConfiguration, comparisonBuildIdentifier); } }
ComparisonExecutor { ComparisonConfiguration resolveComparisonConfiguration( ComparisonConfiguration comparisonConfiguration, String baseBuildName) { String lastSuccessFulAlias = configurationRepository.getConfiguration().getAliasForLastSuccessfulBuild(); String mostRecentAlias = configurationRepository.getConfiguration().getAliasForMostRecentBuild(); String baseBranchName = this.aliasResolver.resolveBranchAlias(comparisonConfiguration.getBaseBranchName()); String comparisonBranchName = this.aliasResolver.resolveBranchAlias(comparisonConfiguration.getComparisonBranchName()); boolean isBuildsFromSameBranch = baseBranchName.equals(comparisonBranchName); boolean isComparisonToLastSuccessBuild = comparisonConfiguration.getComparisonBuildName().equals(lastSuccessFulAlias); boolean isComparisonToMostRecentBuild = comparisonConfiguration.getComparisonBuildName().equals(mostRecentAlias); boolean isComparisonToBuildAlias = isComparisonToLastSuccessBuild ||isComparisonToMostRecentBuild; BuildIdentifier comparisonBuildIdentifier; if (isBuildsFromSameBranch && isComparisonToBuildAlias) { comparisonBuildIdentifier = getPreviousBuildIdentifier( comparisonConfiguration, baseBuildName, isComparisonToLastSuccessBuild); } else { comparisonBuildIdentifier = this.aliasResolver.resolveBranchAndBuildAliases( comparisonConfiguration.getComparisonBranchName(), comparisonConfiguration.getComparisonBuildName()); } if (comparisonBuildIdentifier == null || baseBuildName.equals(comparisonBuildIdentifier.getBuildName())) { return null; } return getResolvedComparisonConfiguration(comparisonConfiguration, comparisonBuildIdentifier); } ComparisonExecutor(AliasResolver aliasResolver);   ComparisonExecutor(ThreadPoolExecutor executorService, AliasResolver aliasResolver); }
ComparisonExecutor { ComparisonConfiguration resolveComparisonConfiguration( ComparisonConfiguration comparisonConfiguration, String baseBuildName) { String lastSuccessFulAlias = configurationRepository.getConfiguration().getAliasForLastSuccessfulBuild(); String mostRecentAlias = configurationRepository.getConfiguration().getAliasForMostRecentBuild(); String baseBranchName = this.aliasResolver.resolveBranchAlias(comparisonConfiguration.getBaseBranchName()); String comparisonBranchName = this.aliasResolver.resolveBranchAlias(comparisonConfiguration.getComparisonBranchName()); boolean isBuildsFromSameBranch = baseBranchName.equals(comparisonBranchName); boolean isComparisonToLastSuccessBuild = comparisonConfiguration.getComparisonBuildName().equals(lastSuccessFulAlias); boolean isComparisonToMostRecentBuild = comparisonConfiguration.getComparisonBuildName().equals(mostRecentAlias); boolean isComparisonToBuildAlias = isComparisonToLastSuccessBuild ||isComparisonToMostRecentBuild; BuildIdentifier comparisonBuildIdentifier; if (isBuildsFromSameBranch && isComparisonToBuildAlias) { comparisonBuildIdentifier = getPreviousBuildIdentifier( comparisonConfiguration, baseBuildName, isComparisonToLastSuccessBuild); } else { comparisonBuildIdentifier = this.aliasResolver.resolveBranchAndBuildAliases( comparisonConfiguration.getComparisonBranchName(), comparisonConfiguration.getComparisonBuildName()); } if (comparisonBuildIdentifier == null || baseBuildName.equals(comparisonBuildIdentifier.getBuildName())) { return null; } return getResolvedComparisonConfiguration(comparisonConfiguration, comparisonBuildIdentifier); } ComparisonExecutor(AliasResolver aliasResolver);   ComparisonExecutor(ThreadPoolExecutor executorService, AliasResolver aliasResolver); void scheduleAllConfiguredComparisonsForOneBuild(String baseBranchName, String baseBuildName); Future<BuildDiffInfo> scheduleComparison(String baseBranchName, String baseBuildName,
													String comparisonBranchName, String comparisonBuildName, String comparisonName); void executeAfterAllPendingComparisonsDone(Runnable task); boolean areAllComparisonCalculationsFinished(); }
ComparisonExecutor { ComparisonConfiguration resolveComparisonConfiguration( ComparisonConfiguration comparisonConfiguration, String baseBuildName) { String lastSuccessFulAlias = configurationRepository.getConfiguration().getAliasForLastSuccessfulBuild(); String mostRecentAlias = configurationRepository.getConfiguration().getAliasForMostRecentBuild(); String baseBranchName = this.aliasResolver.resolveBranchAlias(comparisonConfiguration.getBaseBranchName()); String comparisonBranchName = this.aliasResolver.resolveBranchAlias(comparisonConfiguration.getComparisonBranchName()); boolean isBuildsFromSameBranch = baseBranchName.equals(comparisonBranchName); boolean isComparisonToLastSuccessBuild = comparisonConfiguration.getComparisonBuildName().equals(lastSuccessFulAlias); boolean isComparisonToMostRecentBuild = comparisonConfiguration.getComparisonBuildName().equals(mostRecentAlias); boolean isComparisonToBuildAlias = isComparisonToLastSuccessBuild ||isComparisonToMostRecentBuild; BuildIdentifier comparisonBuildIdentifier; if (isBuildsFromSameBranch && isComparisonToBuildAlias) { comparisonBuildIdentifier = getPreviousBuildIdentifier( comparisonConfiguration, baseBuildName, isComparisonToLastSuccessBuild); } else { comparisonBuildIdentifier = this.aliasResolver.resolveBranchAndBuildAliases( comparisonConfiguration.getComparisonBranchName(), comparisonConfiguration.getComparisonBuildName()); } if (comparisonBuildIdentifier == null || baseBuildName.equals(comparisonBuildIdentifier.getBuildName())) { return null; } return getResolvedComparisonConfiguration(comparisonConfiguration, comparisonBuildIdentifier); } ComparisonExecutor(AliasResolver aliasResolver);   ComparisonExecutor(ThreadPoolExecutor executorService, AliasResolver aliasResolver); void scheduleAllConfiguredComparisonsForOneBuild(String baseBranchName, String baseBuildName); Future<BuildDiffInfo> scheduleComparison(String baseBranchName, String baseBuildName,
													String comparisonBranchName, String comparisonBuildName, String comparisonName); void executeAfterAllPendingComparisonsDone(Runnable task); boolean areAllComparisonCalculationsFinished();  }