java/kudu-client/src/test/java/org/apache/kudu/client/TestUtils.java
private static String findBinDir() {
    // First check the system property, which is our standard override.
    String binDirProp = System.getProperty(BIN_DIR_PROP);
    if (binDirProp != null) {
      LOG.info("Using binary directory specified by property: {}", binDirProp);
      return binDirProp;
    }

    // Next, attempt to traverse from the location of the class file.
    URL codeSrcUrl = BaseKuduTest.class.getProtectionDomain().getCodeSource().getLocation();
    File srcDir = findParentGitDir(new File(urlToPath(codeSrcUrl)));
    if (srcDir != null) {
      return new File(srcDir, "build/latest/bin").getAbsolutePath();
    }

    // Note: It has been discussed in the past whether to also search from the current working
    // directory to find the source directory. At this time we have elected *not* to support this,
    // instead relying on setting -DbinDir for cases where the test libs may be in the Maven repo.
    // See the following code reviews for the discussion: https://gerrit.cloudera.org/5328 and
    // https://gerrit.cloudera.org/4630
    // Note: Builds using Gradle do not have this issue.

    LOG.warn("Unable to find bin dir! codeSrcUrl={}", codeSrcUrl);
    return null;
  }
/**
   * Find the binary directory within the build tree.
   */
Find the binary directory within the build tree.
Find the binary directory within the build tree .
private static String findBinDir() {
    String binDirProp = System.getProperty(BIN_DIR_PROP);
    if (binDirProp != null) {
      LOG.info("Using binary directory specified by property: {}", binDirProp);
      return binDirProp;
    }
    URL codeSrcUrl = BaseKuduTest.class.getProtectionDomain().getCodeSource().getLocation();
    File srcDir = findParentGitDir(new File(urlToPath(codeSrcUrl)));
    if (srcDir != null) {
      return new File(srcDir, "build/latest/bin").getAbsolutePath();
    }
    LOG.warn("Unable to find bin dir! codeSrcUrl={}", codeSrcUrl);
    return null;
  }
private static String findBinDir ( ) { String binDirProp = System . getProperty ( BIN_DIR_PROP ) ; if ( binDirProp != null ) { LOG . info ( "Using binary directory specified by property: {}" , binDirProp ) ; return binDirProp ; } URL codeSrcUrl = BaseKuduTest . class . getProtectionDomain ( ) . getCodeSource ( ) . getLocation ( ) ; File srcDir = findParentGitDir ( new File ( urlToPath ( codeSrcUrl ) ) ) ; if ( srcDir != null ) { return new File ( srcDir , "build/latest/bin" ) . getAbsolutePath ( ) ; } LOG . warn ( "Unable to find bin dir! codeSrcUrl={}" , codeSrcUrl ) ; return null ; }
Find the binary directory within the build tree.
Find the binary directory within the build tree .
// First check the system property, which is our standard override. // Next, attempt to traverse from the location of the class file. // Note: It has been discussed in the past whether to also search from the current working // directory to find the source directory. At this time we have elected *not* to support this, // instead relying on setting -DbinDir for cases where the test libs may be in the Maven repo. // See the following code reviews for the discussion: https://gerrit.cloudera.org/5328 and // https://gerrit.cloudera.org/4630 // Note: Builds using Gradle do not have this issue.