ArchiveUnthinner { public Map<String, ValidationReport> validateThinProject(final Project project, final File projectFolder, final File startupDependenciesFile, final Props additionalValidatorProps) { if (!isEnabled) { throw new ProjectManagerException("Thin archive support is not yet enabled on this cluster."); } Set<Dependency> dependencies = getDependenciesFromSpec(startupDependenciesFile); String validationKey = this.validatorUtils.getCacheKey(project, projectFolder, additionalValidatorProps); Map<Dependency, FileValidationStatus> depsToValidationStatus = getValidationStatuses(dependencies, validationKey); Set<Dependency> removedCachedDeps = filterValidationStatus(depsToValidationStatus, FileValidationStatus.REMOVED); Set<Dependency> validCachedDeps = filterValidationStatus(depsToValidationStatus, FileValidationStatus.VALID); Set<Dependency> newDeps = filterValidationStatus(depsToValidationStatus, FileValidationStatus.NEW); final Set<DependencyFile> downloadedDeps = downloadDependencyFiles(projectFolder, newDeps); Map<String, ValidationReport> reports = this.validatorUtils.validateProject(project, projectFolder, additionalValidatorProps); if (reports.values().stream().anyMatch(r -> r.getStatus() == ValidationStatus.ERROR)) { return reports; } Map<String, DependencyFile> pathToDownloadedDeps = getPathToDepFileMap(downloadedDeps); Set<DependencyFile> removedDownloadedDeps = getDepsFromReports(reports, pathToDownloadedDeps, ValidationReport::getRemovedFiles); Set<DependencyFile> modifiedDownloadedDeps = getDepsFromReports(reports, pathToDownloadedDeps, ValidationReport::getModifiedFiles); Set<DependencyFile> untouchedDownloadedDeps = Sets.difference(downloadedDeps, Sets.union(removedDownloadedDeps, modifiedDownloadedDeps)); updateValidationStatuses(untouchedDownloadedDeps, removedDownloadedDeps, validationKey); ValidationReport cacheReport = new ValidationReport(); cacheReport.addWarningMsgs(getWarningsFromRemovedDeps(removedCachedDeps)); if (untouchedDownloadedDeps.size() < downloadedDeps.size() || removedCachedDeps.size() > 0) { cacheReport.addModifiedFile(startupDependenciesFile); Set<Dependency> finalDeps = filterNullFromDeps(Sets.union(validCachedDeps, untouchedDownloadedDeps)); rewriteStartupDependencies(startupDependenciesFile, finalDeps); } untouchedDownloadedDeps.forEach(d -> d.getFile().delete()); reports.put(CACHED_VALIDATOR_REPORT_NAME, cacheReport); return reports; } @Inject  ArchiveUnthinner(final ValidatorUtils validatorUtils, final JdbcDependencyManager jdbcDependencyManager,
      final DependencyTransferManager dependencyTransferManager); Map<String, ValidationReport> validateThinProject(final Project project,
      final File projectFolder, final File startupDependenciesFile, final Props additionalValidatorProps); static final String CACHED_VALIDATOR_REPORT_NAME; }
@Test(expected = ProjectManagerException.class) public void testDisabled() { DependencyTransferManager disabledTransferManager = mock(DependencyTransferManager.class); doReturn(false).when(disabledTransferManager).isEnabled(); ArchiveUnthinner disabledUnthinner = new ArchiveUnthinner(this.validatorUtils, this.jdbcDependencyManager, disabledTransferManager); disabledUnthinner.validateThinProject(this.project, this.projectFolder, startupDependenciesFile, null); }