ThinArchiveUtils { public static void validateDependencyHash(final DependencyFile f) throws HashNotMatchException { validateDependencyHash(f.getFile(), f); }  static File getStartupDependenciesFile(final File projectFolder); static DependencyFile getDependencyFile(final File projectFolder, final Dependency d); static Set<Dependency> parseStartupDependencies(final String rawJson); static Set<Dependency> parseStartupDependencies(final File f); static void writeStartupDependencies(final File f,
      final Set<Dependency> dependencies); static String convertIvyCoordinateToPath(final Dependency dep); static String replaceLocalPathsWithStoragePaths(final File projectFolder,
      String localJarSpec, final Props jobProps, final Logger log); static void validateDependencyHash(final DependencyFile f); static void validateDependencyHash(final File f, final Dependency d); static Set<Dependency> filterNullFromDeps(Set<Dependency> dependencies); static final String DEPENDENCY_STORAGE_ROOT_PATH_PROP; }
@Test public void testValidateDependencyHashValid() throws Exception { File depFile = TEMP_DIR.newFile(ThinArchiveTestUtils.getDepA().getFileName()); FileUtils.writeStringToFile(depFile, ThinArchiveTestUtils.getDepAContent()); DependencyFile f = ThinArchiveTestUtils.getDepA().makeDependencyFile(depFile); ThinArchiveUtils.validateDependencyHash(f); }
@Test(expected = HashNotMatchException.class) public void testValidateDependencyHashInvalid() throws Exception { File depFile = TEMP_DIR.newFile("dep.jar"); Dependency details = new Dependency( "dep.jar", "lib", "jar", "com.linkedin.test:blahblah:1.0.1", "73f018101ec807672cd3b06d5d7a0fc48f54428f"); DependencyFile f = details.makeDependencyFile(depFile); ThinArchiveUtils.validateDependencyHash(f); }