@Test public void testAddJarDirectory() throws IOException { DistCache.addJarDirToDistributedCache(testConf, testFolder.getRoot().getCanonicalPath()); String[] splitJarPaths = StringUtils.split(testConf.get("tmpjars"), ","); Set<String> addedJarPaths = new HashSet<String>(); for (String path: splitJarPaths) { addedJarPaths.add(path); } assertEquals("Incorrect number of jar paths added.", testFilePaths.length, addedJarPaths.size()); for (int i = 0; i < testFileQualifiedPaths.length; i++) { assertTrue("Expected jar path missing from jar paths added to tmpjars: " + testFileQualifiedPaths[i], addedJarPaths.contains(testFileQualifiedPaths[i])); } }
public static void addJarDirToDistributedCache(Configuration conf, File jarDirectory) throws IOException { if (!jarDirectory.exists() || !jarDirectory.isDirectory()) { throw new IOException("Jar directory: " + jarDirectory.getCanonicalPath() + " does not " + "exist or is not a directory."); } for (File file : jarDirectory.listFiles()) { if (!file.isDirectory() && file.getName().endsWith(".jar")) { addJarToDistributedCache(conf, file); } } }
DistCache { public static void addJarDirToDistributedCache(Configuration conf, File jarDirectory) throws IOException { if (!jarDirectory.exists() || !jarDirectory.isDirectory()) { throw new IOException("Jar directory: " + jarDirectory.getCanonicalPath() + " does not " + "exist or is not a directory."); } for (File file : jarDirectory.listFiles()) { if (!file.isDirectory() && file.getName().endsWith(".jar")) { addJarToDistributedCache(conf, file); } } } }
DistCache { public static void addJarDirToDistributedCache(Configuration conf, File jarDirectory) throws IOException { if (!jarDirectory.exists() || !jarDirectory.isDirectory()) { throw new IOException("Jar directory: " + jarDirectory.getCanonicalPath() + " does not " + "exist or is not a directory."); } for (File file : jarDirectory.listFiles()) { if (!file.isDirectory() && file.getName().endsWith(".jar")) { addJarToDistributedCache(conf, file); } } }  }
DistCache { public static void addJarDirToDistributedCache(Configuration conf, File jarDirectory) throws IOException { if (!jarDirectory.exists() || !jarDirectory.isDirectory()) { throw new IOException("Jar directory: " + jarDirectory.getCanonicalPath() + " does not " + "exist or is not a directory."); } for (File file : jarDirectory.listFiles()) { if (!file.isDirectory() && file.getName().endsWith(".jar")) { addJarToDistributedCache(conf, file); } } }  static void write(Configuration conf, Path path, Object value); static Object read(Configuration conf, Path path); static void addJarToDistributedCache(Configuration conf, File jarFile); static void addJarToDistributedCache(Configuration conf, String jarFile); static String findContainingJar(Class jarClass); static void addJarDirToDistributedCache(Configuration conf, File jarDirectory); static void addJarDirToDistributedCache(Configuration conf, String jarDirectory); }
DistCache { public static void addJarDirToDistributedCache(Configuration conf, File jarDirectory) throws IOException { if (!jarDirectory.exists() || !jarDirectory.isDirectory()) { throw new IOException("Jar directory: " + jarDirectory.getCanonicalPath() + " does not " + "exist or is not a directory."); } for (File file : jarDirectory.listFiles()) { if (!file.isDirectory() && file.getName().endsWith(".jar")) { addJarToDistributedCache(conf, file); } } }  static void write(Configuration conf, Path path, Object value); static Object read(Configuration conf, Path path); static void addJarToDistributedCache(Configuration conf, File jarFile); static void addJarToDistributedCache(Configuration conf, String jarFile); static String findContainingJar(Class jarClass); static void addJarDirToDistributedCache(Configuration conf, File jarDirectory); static void addJarDirToDistributedCache(Configuration conf, String jarDirectory);  }