@Test
  public void testClasspathSetupNone() throws Exception {
    System.clearProperty(HiveConf.ConfVars.HADOOPBIN.toString());
    String originalHadoopBin = new HiveConf().get(HiveConf.ConfVars.HADOOPBIN.toString());

    List<String> inputURLs = Lists.newArrayList();
    inputURLs.add("/usr/lib/hbase/lib/hbase-hadoop2-compat-0.96.1.2.0.11.0-1-hadoop2.jar");
    inputURLs.add("/usr/lib/hbase/lib/hbase-thrift-0.96.1.2.0.11.0-1-hadoop2.jar");
    inputURLs.add("/usr/lib/hadoop/hadoop-common-2.2.0.2.0.11.0-1-tests.jar");

    HiveConf hiveConf = new HiveConf();
    LocalMapreduceClasspathSetter classpathSetter =
        new LocalMapreduceClasspathSetter(
            hiveConf, TEMP_FOLDER.newFolder().getAbsolutePath(), ImmutableList.<String>of());

    for (String url : inputURLs) {
      classpathSetter.accept(url);
    }

    Assert.assertTrue(classpathSetter.getHbaseProtocolJarPaths().isEmpty());

    classpathSetter.setupClasspathScript();

    String newHadoopBin = new HiveConf().get(HiveConf.ConfVars.HADOOPBIN.toString());
    Assert.assertEquals(originalHadoopBin, newHadoopBin);
    System.clearProperty(HiveConf.ConfVars.HADOOPBIN.toString());
  }
  @Test
  public void testClasspathSetupMulti() throws Exception {
    System.clearProperty(HiveConf.ConfVars.HADOOPBIN.toString());

    List<String> inputURLs = Lists.newArrayList();
    inputURLs.add("/usr/lib/hbase/lib/hbase-protocol-0.96.1.2.0.11.0-1-hadoop2.jar");
    inputURLs.add(
        "/opt/cloudera/parcels/CDH-5.0.0-0.cdh5b2.p0.27/lib/hbase/hbase-protocol-0.95.0.jar");
    inputURLs.add(
        "/home/cloudera/.m2/repository/org/apache/hbase/hbase-protocol/0.95.1-hadoop1/"
            + "hbase-protocol-0.95.1-hadoop1.jar");
    inputURLs.add("/usr/lib/hbase/lib/hbase-hadoop2-compat-0.96.1.2.0.11.0-1-hadoop2.jar");
    inputURLs.add("/usr/lib/hbase/lib/hbase-thrift-0.96.1.2.0.11.0-1-hadoop2.jar");
    inputURLs.add("/usr/lib/hadoop/hadoop-common-2.2.0.2.0.11.0-1-tests.jar");

    List<String> auxJarsURLs = Lists.newArrayList();
    auxJarsURLs.add(
        "/hadoop/hadoop/nm-local-dir/usercache/cdap/appcache/org.ow2.asm.asm-all-4.0.jar");
    auxJarsURLs.add(
        "/hadoop/hadoop/nm-local-dir/usercache/cdap/appcache/co.cask.cdap.common-2.4.0-SNAPSHOT.jar");

    HiveConf hiveConf = new HiveConf();
    LocalMapreduceClasspathSetter classpathSetter =
        new LocalMapreduceClasspathSetter(
            hiveConf, TEMP_FOLDER.newFolder().getAbsolutePath(), auxJarsURLs);

    for (String url : inputURLs) {
      classpathSetter.accept(url);
    }

    Assert.assertEquals(
        ImmutableList.of(
            "/usr/lib/hbase/lib/hbase-protocol-0.96.1.2.0.11.0-1-hadoop2.jar",
            "/opt/cloudera/parcels/CDH-5.0.0-0.cdh5b2.p0.27/lib/hbase/"
                + "hbase-protocol-0.95.0.jar",
            "/home/cloudera/.m2/repository/org/apache/hbase/hbase-protocol/"
                + "0.95.1-hadoop1/hbase-protocol-0.95.1-hadoop1.jar"),
        ImmutableList.copyOf(classpathSetter.getHbaseProtocolJarPaths()));

    classpathSetter.setupClasspathScript();

    String newHadoopBin = new HiveConf().get(HiveConf.ConfVars.HADOOPBIN.toString());
    Assert.assertEquals(
        generatedHadoopBinMulti,
        Joiner.on('\n').join(Files.readLines(new File(newHadoopBin), Charsets.UTF_8)));
    Assert.assertTrue(new File(newHadoopBin).canExecute());
    System.clearProperty(HiveConf.ConfVars.HADOOPBIN.toString());
  }