SENTRY-972: Include sentry-tests-hive hadoop test script in maven project (Colm O hEigeartaigh via Lenni Kuff)

Change-Id: I8f7e7c99be0acc9c136fe0a4263b6224df163a12
diff --git a/sentry-tests/sentry-tests-hive/pom.xml b/sentry-tests/sentry-tests-hive/pom.xml
index b70fe60..bea4a73 100644
--- a/sentry-tests/sentry-tests-hive/pom.xml
+++ b/sentry-tests/sentry-tests-hive/pom.xml
@@ -327,45 +327,6 @@
      <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-antrun-plugin</artifactId>
-        <configuration>
-          <exportAntProperties>true</exportAntProperties>
-          <skipTests>true</skipTests>
-        </configuration>
-        <executions>
-          <execution>
-            <id>link-hadoop</id>
-            <phase>generate-sources</phase>
-            <goals>
-              <goal>run</goal>
-            </goals>
-            <configuration>
-              <target>
-                <echo file="target/hadoop-setup.sh">
-                  set -e
-                  set -x
-                  /bin/pwd
-                  BASE_DIR=./target
-                  TEST_UTIL_DIR=./testutil
-                  setup_hadoop() {
-                    set -e
-                    set -x
-                    /bin/pwd
-                    cp -f $TEST_UTIL_DIR/* $BASE_DIR/.
-                    chmod 777 $BASE_DIR/hadoop
-                  }
-                  setup_hadoop
-                </echo>
-                <exec executable="bash" dir="${basedir}" failonerror="true">
-                  <arg line="target/hadoop-setup.sh"/>
-                </exec>
-              </target>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
           <environmentVariables>
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/hiveserver/HiveServerFactory.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/hiveserver/HiveServerFactory.java
index 895452c..e7e497d 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/hiveserver/HiveServerFactory.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/hiveserver/HiveServerFactory.java
@@ -22,6 +22,7 @@
 import java.io.OutputStream;
 import java.net.ServerSocket;
 import java.net.URL;
+import java.nio.file.FileSystems;
 import java.util.Map;
 
 import org.apache.hadoop.fs.FileSystem;
@@ -151,8 +152,15 @@
       properties.put(SUPPORT_CONCURRENCY, "false");
     }
     if(!properties.containsKey(HADOOPBIN)) {
-      properties.put(HADOOPBIN, "./target/hadoop");
+      properties.put(HADOOPBIN, "./target/test-classes/hadoop");
     }
+
+    // Modify the test resource to have executable permission
+    java.nio.file.Path hadoopPath = FileSystems.getDefault().getPath("target/test-classes", "hadoop");
+    if (hadoopPath != null) {
+      hadoopPath.toFile().setExecutable(true);
+    }
+
     properties.put(METASTORE_RAW_STORE_IMPL,
         "org.apache.sentry.binding.metastore.AuthorizingObjectStore");
     if (!properties.containsKey(METASTORE_URI)) {
diff --git a/sentry-tests/sentry-tests-hive/testutil/hadoop b/sentry-tests/sentry-tests-hive/src/test/resources/hadoop
similarity index 100%
rename from sentry-tests/sentry-tests-hive/testutil/hadoop
rename to sentry-tests/sentry-tests-hive/src/test/resources/hadoop