sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lsk...@apache.org
Subject [2/2] incubator-sentry git commit: SENTRY-972: Include sentry-tests-hive hadoop test script in maven project (Colm O hEigeartaigh via Lenni Kuff)
Date Wed, 09 Dec 2015 08:37:01 GMT
SENTRY-972: Include sentry-tests-hive hadoop test script in maven project (Colm O hEigeartaigh
via Lenni Kuff)

Change-Id: I8f7e7c99be0acc9c136fe0a4263b6224df163a12


Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/7d6390e2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/7d6390e2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/7d6390e2

Branch: refs/heads/master
Commit: 7d6390e2cb833b4d3496971ee879cf008aae3fd1
Parents: 0e2e678
Author: Lenni Kuff <lskuff@cloudera.com>
Authored: Wed Dec 9 00:35:13 2015 -0800
Committer: Lenni Kuff <lskuff@cloudera.com>
Committed: Wed Dec 9 00:36:22 2015 -0800

----------------------------------------------------------------------
 sentry-tests/sentry-tests-hive/pom.xml          |  39 -------
 .../e2e/hive/hiveserver/HiveServerFactory.java  |  10 +-
 .../sentry-tests-hive/src/test/resources/hadoop | 107 +++++++++++++++++++
 sentry-tests/sentry-tests-hive/testutil/hadoop  | 107 -------------------
 4 files changed, 116 insertions(+), 147 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/7d6390e2/sentry-tests/sentry-tests-hive/pom.xml
----------------------------------------------------------------------
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 @@ limitations under the License.
      <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>

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/7d6390e2/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/hiveserver/HiveServerFactory.java
----------------------------------------------------------------------
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.IOException;
 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 @@ public class HiveServerFactory {
       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)) {

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/7d6390e2/sentry-tests/sentry-tests-hive/src/test/resources/hadoop
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/resources/hadoop b/sentry-tests/sentry-tests-hive/src/test/resources/hadoop
new file mode 100755
index 0000000..914d3db
--- /dev/null
+++ b/sentry-tests/sentry-tests-hive/src/test/resources/hadoop
@@ -0,0 +1,107 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This script runs the hadoop core commands. 
+
+bin=`which $0`
+bin=`dirname ${bin}`
+bin=`cd "$bin"; pwd`
+ 
+JAVA=$JAVA_HOME/bin/java
+JAVA_HEAP_MAX=-Xmx1000m
+
+# check envvars which might override default args
+if [ "$HADOOP_HEAPSIZE" != "" ]; then
+  JAVA_HEAP_MAX="-Xmx""$HADOOP_HEAPSIZE""m"
+fi
+
+if [ "$SENTRY_HADOOP_TEST_CLASSPATH" != "" ]; then
+  CLASSPATH=${CLASSPATH}:${SENTRY_HADOOP_TEST_CLASSPATH}
+  echo "Got Sentry classpath ${SENTRY_HADOOP_TEST_CLASSPATH}"
+else    
+  echo "Error: SENTRY_HADOOP_TEST_CLASSPATH not defined."
+  exit 1  
+fi
+DEFAULT_LIBEXEC_DIR="$bin"/../libexec
+HADOOP_LIBEXEC_DIR=${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}
+
+function print_usage(){
+  echo "Usage: hadoop [--config confdir] COMMAND"
+  echo "       where COMMAND is one of:"
+  echo "  fs                   run a generic filesystem user client"
+  echo "  version              print the version"
+  echo "  jar <jar>            run a jar file"
+  echo ""
+  echo "Most commands print help when invoked w/o parameters."
+}
+
+if [ $# = 0 ]; then
+  print_usage
+  exit
+fi
+
+COMMAND=$1
+case $COMMAND in
+  # usage flags
+  --help|-help|-h)
+    print_usage
+    exit
+    ;;
+
+
+  classpath)
+    echo $CLASSPATH
+    exit
+    ;;
+
+  #core commands  
+  *)
+    # the core commands
+    if [ "$COMMAND" = "fs" ] ; then
+      CLASS=org.apache.hadoop.fs.FsShell
+    elif [ "$COMMAND" = "version" ] ; then
+      CLASS=org.apache.hadoop.util.VersionInfo
+    elif [ "$COMMAND" = "jar" ] ; then
+      CLASS=org.apache.hadoop.util.RunJar
+    elif [ "$COMMAND" = "checknative" ] ; then
+      CLASS=org.apache.hadoop.util.NativeLibraryChecker
+    elif [ "$COMMAND" = "distcp" ] ; then
+      CLASS=org.apache.hadoop.tools.DistCp
+      CLASSPATH=${CLASSPATH}:${TOOL_PATH}
+    elif [ "$COMMAND" = "archive" ] ; then
+      CLASS=org.apache.hadoop.tools.HadoopArchives
+      CLASSPATH=${CLASSPATH}:${TOOL_PATH}
+    elif [[ "$COMMAND" = -*  ]] ; then
+        # class and package names cannot begin with a -
+        echo "Error: No command named \`$COMMAND' was found. Perhaps you meant \`hadoop ${COMMAND#-}'"
+        exit 1
+    else
+      CLASS=$COMMAND
+    fi
+    shift
+    
+    # Always respect HADOOP_OPTS and HADOOP_CLIENT_OPTS
+    HADOOP_OPTS="$HADOOP_OPTS $HADOOP_CLIENT_OPTS"
+
+    #make sure security appender is turned off
+    HADOOP_OPTS="$HADOOP_OPTS -Dhadoop.security.logger=${HADOOP_SECURITY_LOGGER:-INFO,NullAppender}"
+
+    export CLASSPATH=$CLASSPATH
+    exec "$JAVA" $JAVA_HEAP_MAX $HADOOP_OPTS $CLASS "$@"
+    ;;
+
+esac

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/7d6390e2/sentry-tests/sentry-tests-hive/testutil/hadoop
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/testutil/hadoop b/sentry-tests/sentry-tests-hive/testutil/hadoop
deleted file mode 100755
index 914d3db..0000000
--- a/sentry-tests/sentry-tests-hive/testutil/hadoop
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This script runs the hadoop core commands. 
-
-bin=`which $0`
-bin=`dirname ${bin}`
-bin=`cd "$bin"; pwd`
- 
-JAVA=$JAVA_HOME/bin/java
-JAVA_HEAP_MAX=-Xmx1000m
-
-# check envvars which might override default args
-if [ "$HADOOP_HEAPSIZE" != "" ]; then
-  JAVA_HEAP_MAX="-Xmx""$HADOOP_HEAPSIZE""m"
-fi
-
-if [ "$SENTRY_HADOOP_TEST_CLASSPATH" != "" ]; then
-  CLASSPATH=${CLASSPATH}:${SENTRY_HADOOP_TEST_CLASSPATH}
-  echo "Got Sentry classpath ${SENTRY_HADOOP_TEST_CLASSPATH}"
-else    
-  echo "Error: SENTRY_HADOOP_TEST_CLASSPATH not defined."
-  exit 1  
-fi
-DEFAULT_LIBEXEC_DIR="$bin"/../libexec
-HADOOP_LIBEXEC_DIR=${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}
-
-function print_usage(){
-  echo "Usage: hadoop [--config confdir] COMMAND"
-  echo "       where COMMAND is one of:"
-  echo "  fs                   run a generic filesystem user client"
-  echo "  version              print the version"
-  echo "  jar <jar>            run a jar file"
-  echo ""
-  echo "Most commands print help when invoked w/o parameters."
-}
-
-if [ $# = 0 ]; then
-  print_usage
-  exit
-fi
-
-COMMAND=$1
-case $COMMAND in
-  # usage flags
-  --help|-help|-h)
-    print_usage
-    exit
-    ;;
-
-
-  classpath)
-    echo $CLASSPATH
-    exit
-    ;;
-
-  #core commands  
-  *)
-    # the core commands
-    if [ "$COMMAND" = "fs" ] ; then
-      CLASS=org.apache.hadoop.fs.FsShell
-    elif [ "$COMMAND" = "version" ] ; then
-      CLASS=org.apache.hadoop.util.VersionInfo
-    elif [ "$COMMAND" = "jar" ] ; then
-      CLASS=org.apache.hadoop.util.RunJar
-    elif [ "$COMMAND" = "checknative" ] ; then
-      CLASS=org.apache.hadoop.util.NativeLibraryChecker
-    elif [ "$COMMAND" = "distcp" ] ; then
-      CLASS=org.apache.hadoop.tools.DistCp
-      CLASSPATH=${CLASSPATH}:${TOOL_PATH}
-    elif [ "$COMMAND" = "archive" ] ; then
-      CLASS=org.apache.hadoop.tools.HadoopArchives
-      CLASSPATH=${CLASSPATH}:${TOOL_PATH}
-    elif [[ "$COMMAND" = -*  ]] ; then
-        # class and package names cannot begin with a -
-        echo "Error: No command named \`$COMMAND' was found. Perhaps you meant \`hadoop ${COMMAND#-}'"
-        exit 1
-    else
-      CLASS=$COMMAND
-    fi
-    shift
-    
-    # Always respect HADOOP_OPTS and HADOOP_CLIENT_OPTS
-    HADOOP_OPTS="$HADOOP_OPTS $HADOOP_CLIENT_OPTS"
-
-    #make sure security appender is turned off
-    HADOOP_OPTS="$HADOOP_OPTS -Dhadoop.security.logger=${HADOOP_SECURITY_LOGGER:-INFO,NullAppender}"
-
-    export CLASSPATH=$CLASSPATH
-    exec "$JAVA" $JAVA_HEAP_MAX $HADOOP_OPTS $CLASS "$@"
-    ;;
-
-esac


Mime
View raw message