From fd0ecadbb98a426ef0107d7b8299c60be84a548f Mon Sep 17 00:00:00 2001 From: Sean Busbey Date: Thu, 8 Oct 2020 10:02:27 -0500 Subject: [PATCH] HBASE-14067 bundle ruby files for hbase shell into a jar. * removes some cruft from the hbase-shell pom that appears to be from coping the hbase-server pom long ago * puts the ruby scripts into the hbase-shell jar following the guide from jruby for packaging * removes hard coding the location of the implementation scripts from our runtime * removes hard coding the load path for the implementation from the test code (leaves hard coding the test code location) * provides a work around for a name conflict between our shell and the ruby stdlib shell. closes #2515 Signed-off-by: Michael Stack --- bin/hbase | 13 +- bin/hirb.rb | 223 +---------------- .../src/main/assembly/client-components.xml | 7 - .../src/main/assembly/components.xml | 7 - hbase-shell/pom.xml | 54 +--- hbase-shell/src/main/ruby/hbase_shell.rb | 24 ++ hbase-shell/src/main/ruby/jar-bootstrap.rb | 235 ++++++++++++++++++ .../hbase/client/AbstractTestShell.java | 38 ++- .../hadoop/hbase/client/TestAdminShell.java | 8 +- .../hadoop/hbase/client/TestAdminShell2.java | 8 +- .../hadoop/hbase/client/TestQuotasShell.java | 8 +- .../hadoop/hbase/client/TestRSGroupShell.java | 8 +- .../hbase/client/TestReplicationShell.java | 8 +- .../apache/hadoop/hbase/client/TestShell.java | 10 +- .../hbase/client/TestShellNoCluster.java | 13 +- .../hadoop/hbase/client/TestTableShell.java | 8 +- .../client/rsgroup/TestShellRSGroups.java | 8 +- .../src/test/ruby/hbase/admin2_test.rb | 2 +- hbase-shell/src/test/ruby/hbase/admin_test.rb | 2 +- .../hbase/list_regions_test_no_cluster.rb | 2 +- .../src/test/ruby/hbase/quotas_test.rb | 2 +- .../test/ruby/hbase/quotas_test_no_cluster.rb | 2 +- .../test/ruby/hbase/replication_admin_test.rb | 2 +- .../test/ruby/hbase/security_admin_test.rb | 2 +- .../ruby/hbase/test_connection_no_cluster.rb | 2 +- .../hbase/visibility_labels_admin_test.rb | 2 +- .../src/test/ruby/shell/commands_test.rb | 2 +- .../src/test/ruby/shell/converter_test.rb | 4 +- .../src/test/ruby/shell/list_locks_test.rb | 2 +- .../test/ruby/shell/list_procedures_test.rb | 2 +- .../test/ruby/shell/noninteractive_test.rb | 2 +- .../src/test/ruby/shell/rsgroup_shell_test.rb | 2 +- hbase-shell/src/test/ruby/shell/shell_test.rb | 2 +- hbase-shell/src/test/ruby/test_helper.rb | 6 +- hbase-shell/src/test/ruby/tests_runner.rb | 3 + 35 files changed, 369 insertions(+), 354 deletions(-) create mode 100644 hbase-shell/src/main/ruby/hbase_shell.rb create mode 100644 hbase-shell/src/main/ruby/jar-bootstrap.rb diff --git a/bin/hbase b/bin/hbase index dd6cfeef644..d2307c50c33 100755 --- a/bin/hbase +++ b/bin/hbase @@ -509,13 +509,22 @@ fi # figure out which class to run if [ "$COMMAND" = "shell" ] ; then #find the hbase ruby sources + # assume we are in a binary install if lib/ruby exists if [ -d "$HBASE_HOME/lib/ruby" ]; then - HBASE_OPTS="$HBASE_OPTS -Dhbase.ruby.sources=$HBASE_HOME/lib/ruby" + # We want jruby to consume these things rather than our bootstrap script; + # jruby will look for the env variable 'JRUBY_OPTS'. + JRUBY_OPTS="${JRUBY_OPTS} -X+O" + export JRUBY_OPTS + # hbase-shell.jar contains a 'jar-bootstrap.rb' + # for more info see + # https://github.com/jruby/jruby/wiki/StandaloneJarsAndClasses#standalone-executable-jar-files + CLASS="org.jruby.JarBootstrapMain" + # otherwise assume we are running in a source checkout else HBASE_OPTS="$HBASE_OPTS -Dhbase.ruby.sources=$HBASE_HOME/hbase-shell/src/main/ruby" + CLASS="org.jruby.Main -X+O ${JRUBY_OPTS} ${HBASE_HOME}/hbase-shell/src/main/ruby/jar-bootstrap.rb" fi HBASE_OPTS="$HBASE_OPTS $HBASE_SHELL_OPTS" - CLASS="org.jruby.Main -X+O ${JRUBY_OPTS} ${HBASE_HOME}/bin/hirb.rb" elif [ "$COMMAND" = "hbck" ] ; then # Look for the -j /path/to/HBCK2.jar parameter. Else pass through to hbck. case "${1}" in diff --git a/bin/hirb.rb b/bin/hirb.rb index 7b1b8f172c2..12353ca1a0e 100644 --- a/bin/hirb.rb +++ b/bin/hirb.rb @@ -1,5 +1,3 @@ -# -# # 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 @@ -15,217 +13,10 @@ # 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. -# -# File passed to org.jruby.Main by bin/hbase. Pollutes jirb with hbase imports -# and hbase commands and then loads jirb. Outputs a banner that tells user -# where to find help, shell version, and loads up a custom hirb. -# -# In noninteractive mode, runs commands from stdin until completion or an error. -# On success will exit with status 0, on any problem will exit non-zero. Callers -# should only rely on "not equal to 0", because the current error exit code of 1 -# will likely be updated to diffentiate e.g. invalid commands, incorrect args, -# permissions, etc. - -# TODO: Interrupt a table creation or a connection to a bad master. Currently -# has to time out. Below we've set down the retries for rpc and hbase but -# still can be annoying (And there seem to be times when we'll retry for -# ever regardless) -# TODO: Add support for listing and manipulating catalog tables, etc. -# TODO: Encoding; need to know how to go from ruby String to UTF-8 bytes - -# Run the java magic include and import basic HBase types that will help ease -# hbase hacking. -include Java - -# Some goodies for hirb. Should these be left up to the user's discretion? -require 'irb/completion' -require 'pathname' - -# Add the directory names in hbase.jruby.sources commandline option -# to the ruby load path so I can load up my HBase ruby modules -sources = java.lang.System.getProperty('hbase.ruby.sources') -$LOAD_PATH.unshift Pathname.new(sources) - -# -# FIXME: Switch args processing to getopt -# -# See if there are args for this shell. If any, read and then strip from ARGV -# so they don't go through to irb. Output shell 'usage' if user types '--help' -cmdline_help = <hbase-config.cmd - - - ${project.basedir}/../hbase-shell/src/main/ruby - lib/ruby - 0644 - 0755 - ${project.basedir}/../hbase-server/target/native diff --git a/hbase-assembly/src/main/assembly/components.xml b/hbase-assembly/src/main/assembly/components.xml index aaa6a831ad5..3e1394e7d5b 100644 --- a/hbase-assembly/src/main/assembly/components.xml +++ b/hbase-assembly/src/main/assembly/components.xml @@ -69,13 +69,6 @@ **/*.cmd - - - ${project.basedir}/../hbase-shell/src/main/ruby - lib/ruby - 0644 - 0755 - ${project.basedir}/../hbase-server/target/hbase-webapps diff --git a/hbase-shell/pom.xml b/hbase-shell/pom.xml index b6d2e30388a..63db97719c6 100644 --- a/hbase-shell/pom.xml +++ b/hbase-shell/pom.xml @@ -30,15 +30,9 @@ Apache HBase - Shell Shell for HBase - - - ${project.build.directory} - - hbase-webapps/** - + src/main/ruby @@ -50,38 +44,15 @@ - - - - maven-assembly-plugin - - true - - org.apache.maven.plugins maven-jar-plugin - org/apache/hadoop/hbase/mapreduce/Driver + org.jruby.JarBootstrapMain - - - org/apache/jute/** - org/apache/zookeeper/** - **/*.jsp - hbase-site.xml - hdfs-site.xml - log4j.properties - mapred-queues.xml - mapred-site.xml - @@ -89,27 +60,6 @@ org.apache.maven.plugins maven-source-plugin - - - org.codehaus.mojo - build-helper-maven-plugin - - - - jspcSource-packageInfo-source - generate-sources - - add-source - - - - ${project.build.directory}/generated-jamon - ${project.build.directory}/generated-sources/java - - - - - net.revelc.code diff --git a/hbase-shell/src/main/ruby/hbase_shell.rb b/hbase-shell/src/main/ruby/hbase_shell.rb new file mode 100644 index 00000000000..e5e85ab6820 --- /dev/null +++ b/hbase-shell/src/main/ruby/hbase_shell.rb @@ -0,0 +1,24 @@ +# 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. + +# Ruby has a stdlib named 'shell' so using "require 'shell'" does not +# work if our shell implementation is not on the local filesystem. +# this is the absolute path to our shell implementation when packaged +# in a jar. The level of indirection provided by this file lets things +# still behave the same as in earlier releases if folks unpackage the +# jar contents onto the local filesystem if they need that for some +# other reason. +require 'uri:classloader:/shell.rb' diff --git a/hbase-shell/src/main/ruby/jar-bootstrap.rb b/hbase-shell/src/main/ruby/jar-bootstrap.rb new file mode 100644 index 00000000000..de602bf551d --- /dev/null +++ b/hbase-shell/src/main/ruby/jar-bootstrap.rb @@ -0,0 +1,235 @@ +# +# +# 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. +# +# File passed to org.jruby.Main by bin/hbase. Pollutes jirb with hbase imports +# and hbase commands and then loads jirb. Outputs a banner that tells user +# where to find help, shell version, and loads up a custom hirb. +# +# In noninteractive mode, runs commands from stdin until completion or an error. +# On success will exit with status 0, on any problem will exit non-zero. Callers +# should only rely on "not equal to 0", because the current error exit code of 1 +# will likely be updated to diffentiate e.g. invalid commands, incorrect args, +# permissions, etc. + +# TODO: Interrupt a table creation or a connection to a bad master. Currently +# has to time out. Below we've set down the retries for rpc and hbase but +# still can be annoying (And there seem to be times when we'll retry for +# ever regardless) +# TODO: Add support for listing and manipulating catalog tables, etc. +# TODO: Encoding; need to know how to go from ruby String to UTF-8 bytes + +# Run the java magic include and import basic HBase types that will help ease +# hbase hacking. +include Java + +# Some goodies for hirb. Should these be left up to the user's discretion? +require 'irb/completion' +require 'pathname' + +# Add the directory names in hbase.jruby.sources commandline option +# to the ruby load path so I can load up my HBase ruby modules +# in case we are trying to get them out of source instead of jar +# packaging. +sources = java.lang.System.getProperty('hbase.ruby.sources') +unless sources.nil? + $LOAD_PATH.unshift Pathname.new(sources) +end + +# +# FIXME: Switch args processing to getopt +# +# See if there are args for this shell. If any, read and then strip from ARGV +# so they don't go through to irb. Output shell 'usage' if user types '--help' +cmdline_help = < loadPaths = new ArrayList<>(2); - loadPaths.add("src/main/ruby"); loadPaths.add("src/test/ruby"); jruby.setLoadPaths(loadPaths); jruby.put("$TEST_CLUSTER", TEST_UTIL); @@ -65,6 +71,34 @@ public abstract class AbstractTestShell { System.setProperty("jruby.native.verbose", "true"); } + /** + * @return comma separated list of ruby script names for tests + */ + protected String getIncludeList() { + return ""; + } + + /** + * @return comma separated list of ruby script names for tests to skip + */ + protected String getExcludeList() { + return ""; + } + + @Test + public void testRunShellTests() throws IOException { + final String tests = getIncludeList(); + final String excludes = getExcludeList(); + if (!tests.isEmpty()) { + System.setProperty("shell.test.include", tests); + } + if (!excludes.isEmpty()) { + System.setProperty("shell.test.exclude", excludes); + } + LOG.info("Starting ruby tests. includes: {} excludes: {}", tests, excludes); + jruby.runScriptlet(PathType.ABSOLUTE, "src/test/ruby/tests_runner.rb"); + } + @BeforeClass public static void setUpBeforeClass() throws Exception { setUpConfig(); diff --git a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestAdminShell.java b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestAdminShell.java index 1835d88dc5c..7cfd603ddb8 100644 --- a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestAdminShell.java +++ b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestAdminShell.java @@ -33,10 +33,8 @@ public class TestAdminShell extends AbstractTestShell { public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestAdminShell.class); - @Test - public void testRunShellTests() throws IOException { - System.setProperty("shell.test.include", "admin_test.rb"); - // Start all ruby tests - jruby.runScriptlet(PathType.ABSOLUTE, "src/test/ruby/tests_runner.rb"); + @Override + protected String getIncludeList() { + return "admin_test.rb"; } } diff --git a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestAdminShell2.java b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestAdminShell2.java index e2dadd05934..b94a579ea32 100644 --- a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestAdminShell2.java +++ b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestAdminShell2.java @@ -33,10 +33,8 @@ public class TestAdminShell2 extends AbstractTestShell { public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestAdminShell2.class); - @Test - public void testRunShellTests() throws IOException { - System.setProperty("shell.test.include", "admin2_test.rb"); - // Start all ruby tests - jruby.runScriptlet(PathType.ABSOLUTE, "src/test/ruby/tests_runner.rb"); + @Override + protected String getIncludeList() { + return "admin2_test.rb"; } } diff --git a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestQuotasShell.java b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestQuotasShell.java index 482bf0f46bf..f2bb06f7369 100644 --- a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestQuotasShell.java +++ b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestQuotasShell.java @@ -33,10 +33,8 @@ public class TestQuotasShell extends AbstractTestShell { public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestQuotasShell.class); - @Test - public void testRunShellTests() throws IOException { - System.setProperty("shell.test.include", "quotas_test.rb"); - // Start all ruby tests - jruby.runScriptlet(PathType.ABSOLUTE, "src/test/ruby/tests_runner.rb"); + @Override + protected String getIncludeList() { + return "quotas_test.rb"; } } diff --git a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestRSGroupShell.java b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestRSGroupShell.java index f26f9f53375..a2bc6a47c12 100644 --- a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestRSGroupShell.java +++ b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestRSGroupShell.java @@ -47,10 +47,8 @@ public class TestRSGroupShell extends AbstractTestShell { setUpJRubyRuntime(); } - @Test - public void testRunShellTests() throws IOException { - System.setProperty("shell.test.include", "rsgroup_shell_test.rb"); - // Start all ruby tests - jruby.runScriptlet(PathType.ABSOLUTE, "src/test/ruby/tests_runner.rb"); + @Override + protected String getIncludeList() { + return "rsgroup_shell_test.rb"; } } diff --git a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestReplicationShell.java b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestReplicationShell.java index ca371e145b9..146a73fa0e3 100644 --- a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestReplicationShell.java +++ b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestReplicationShell.java @@ -33,10 +33,8 @@ public class TestReplicationShell extends AbstractTestShell { public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestReplicationShell.class); - @Test - public void testRunShellTests() throws IOException { - System.setProperty("shell.test.include", "replication_admin_test.rb"); - // Start all ruby tests - jruby.runScriptlet(PathType.ABSOLUTE, "src/test/ruby/tests_runner.rb"); + @Override + protected String getIncludeList() { + return "replication_admin_test.rb"; } } diff --git a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShell.java b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShell.java index 8f3aefba180..434d8cf6709 100644 --- a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShell.java +++ b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShell.java @@ -32,11 +32,9 @@ public class TestShell extends AbstractTestShell { @ClassRule public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestShell.class); - @Test - public void testRunShellTests() throws IOException { - System.setProperty("shell.test.exclude", "replication_admin_test.rb,rsgroup_shell_test.rb," + - "admin_test.rb,table_test.rb,quotas_test.rb,admin2_test.rb"); - // Start all ruby tests - jruby.runScriptlet(PathType.ABSOLUTE, "src/test/ruby/tests_runner.rb"); + @Override + protected String getExcludeList() { + return "replication_admin_test.rb,rsgroup_shell_test.rb,admin_test.rb,table_test.rb," + + "quotas_test.rb,admin2_test.rb"; } } diff --git a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShellNoCluster.java b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShellNoCluster.java index 3172e973b76..1bea652923a 100644 --- a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShellNoCluster.java +++ b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestShellNoCluster.java @@ -30,8 +30,12 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + @Category({ ClientTests.class, MediumTests.class }) public class TestShellNoCluster extends AbstractTestShell { + private static final Logger LOG = LoggerFactory.getLogger(TestShellNoCluster.class); @ClassRule public static final HBaseClassTestRule CLASS_RULE = @@ -41,7 +45,6 @@ public class TestShellNoCluster extends AbstractTestShell { public static void setUpBeforeClass() throws Exception { // no cluster List loadPaths = new ArrayList<>(2); - loadPaths.add("src/main/ruby"); loadPaths.add("src/test/ruby"); jruby.setLoadPaths(loadPaths); jruby.put("$TEST_CLUSTER", TEST_UTIL); @@ -55,9 +58,11 @@ public class TestShellNoCluster extends AbstractTestShell { // no cluster } + // Keep the same name so we override the with-a-cluster test + @Override @Test - public void testRunNoClusterShellTests() throws IOException { - // Start ruby tests without cluster - jruby.runScriptlet(PathType.ABSOLUTE, "src/test/ruby/no_cluster_tests_runner.rb"); + public void testRunShellTests() throws IOException { + LOG.info("Start ruby tests without cluster"); + jruby.runScriptlet(PathType.CLASSPATH, "no_cluster_tests_runner.rb"); } } diff --git a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestTableShell.java b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestTableShell.java index e2fdcaa67fc..26369349e1e 100644 --- a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestTableShell.java +++ b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestTableShell.java @@ -33,10 +33,8 @@ public class TestTableShell extends AbstractTestShell { public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestTableShell.class); - @Test - public void testRunShellTests() throws IOException { - System.setProperty("shell.test.include", "table_test.rb"); - // Start all ruby tests - jruby.runScriptlet(PathType.ABSOLUTE, "src/test/ruby/tests_runner.rb"); + @Override + protected String getIncludeList() { + return "test_table.rb"; } } diff --git a/hbase-shell/src/test/rsgroup/org/apache/hadoop/hbase/client/rsgroup/TestShellRSGroups.java b/hbase-shell/src/test/rsgroup/org/apache/hadoop/hbase/client/rsgroup/TestShellRSGroups.java index 9c28cbf5b75..380ad616322 100644 --- a/hbase-shell/src/test/rsgroup/org/apache/hadoop/hbase/client/rsgroup/TestShellRSGroups.java +++ b/hbase-shell/src/test/rsgroup/org/apache/hadoop/hbase/client/rsgroup/TestShellRSGroups.java @@ -52,11 +52,9 @@ public class TestShellRSGroups { final Logger LOG = LoggerFactory.getLogger(getClass()); private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private final static ScriptingContainer jruby = new ScriptingContainer(); - private static String basePath; @BeforeClass public static void setUpBeforeClass() throws Exception { - basePath = System.getProperty("basedir"); // Start mini cluster TEST_UTIL.getConfiguration().setInt("hbase.regionserver.msginterval", 100); @@ -80,8 +78,7 @@ public class TestShellRSGroups { // Configure jruby runtime List loadPaths = new ArrayList<>(2); - loadPaths.add(basePath+"/src/main/ruby"); - loadPaths.add(basePath+"/src/test/ruby"); + loadPaths.add("src/test/ruby"); jruby.setLoadPaths(loadPaths); jruby.put("$TEST_CLUSTER", TEST_UTIL); System.setProperty("jruby.jit.logging.verbose", "true"); @@ -99,8 +96,7 @@ public class TestShellRSGroups { try { // Start only GroupShellTest System.setProperty("shell.test", "Hbase::RSGroupShellTest"); - jruby.runScriptlet(PathType.ABSOLUTE, - basePath + "/src/test/ruby/tests_runner.rb"); + jruby.runScriptlet(PathType.ABSOLUTE, "src/test/ruby/tests_runner.rb"); } finally { System.clearProperty("shell.test"); } diff --git a/hbase-shell/src/test/ruby/hbase/admin2_test.rb b/hbase-shell/src/test/ruby/hbase/admin2_test.rb index 9d3834ee667..8d368188ae1 100644 --- a/hbase-shell/src/test/ruby/hbase/admin2_test.rb +++ b/hbase-shell/src/test/ruby/hbase/admin2_test.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require 'shell' +require 'hbase_shell' require 'stringio' require 'hbase_constants' require 'hbase/hbase' diff --git a/hbase-shell/src/test/ruby/hbase/admin_test.rb b/hbase-shell/src/test/ruby/hbase/admin_test.rb index 65e3e0a6a2d..fac52ede51b 100644 --- a/hbase-shell/src/test/ruby/hbase/admin_test.rb +++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require 'shell' +require 'hbase_shell' require 'stringio' require 'hbase_constants' require 'hbase/hbase' diff --git a/hbase-shell/src/test/ruby/hbase/list_regions_test_no_cluster.rb b/hbase-shell/src/test/ruby/hbase/list_regions_test_no_cluster.rb index 6be259779d9..75a3c0ef252 100644 --- a/hbase-shell/src/test/ruby/hbase/list_regions_test_no_cluster.rb +++ b/hbase-shell/src/test/ruby/hbase/list_regions_test_no_cluster.rb @@ -15,7 +15,7 @@ # limitations under the License. # -require 'shell' +require 'hbase_shell' require 'hbase_constants' java_import 'org.apache.hadoop.hbase.HRegionLocation' diff --git a/hbase-shell/src/test/ruby/hbase/quotas_test.rb b/hbase-shell/src/test/ruby/hbase/quotas_test.rb index c4fca28bdfd..6e506c52f14 100644 --- a/hbase-shell/src/test/ruby/hbase/quotas_test.rb +++ b/hbase-shell/src/test/ruby/hbase/quotas_test.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require 'shell' +require 'hbase_shell' require 'stringio' require 'hbase_constants' require 'hbase/hbase' diff --git a/hbase-shell/src/test/ruby/hbase/quotas_test_no_cluster.rb b/hbase-shell/src/test/ruby/hbase/quotas_test_no_cluster.rb index 79f735021a8..471a81013dd 100644 --- a/hbase-shell/src/test/ruby/hbase/quotas_test_no_cluster.rb +++ b/hbase-shell/src/test/ruby/hbase/quotas_test_no_cluster.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require 'shell' +require 'hbase_shell' require 'stringio' require 'hbase_constants' require 'hbase/hbase' diff --git a/hbase-shell/src/test/ruby/hbase/replication_admin_test.rb b/hbase-shell/src/test/ruby/hbase/replication_admin_test.rb index 72fbe943040..c6ed817ad4e 100644 --- a/hbase-shell/src/test/ruby/hbase/replication_admin_test.rb +++ b/hbase-shell/src/test/ruby/hbase/replication_admin_test.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require 'shell' +require 'hbase_shell' require 'hbase_constants' require 'hbase/hbase' require 'hbase/table' diff --git a/hbase-shell/src/test/ruby/hbase/security_admin_test.rb b/hbase-shell/src/test/ruby/hbase/security_admin_test.rb index 6e9a50cafcd..8839c33dabc 100644 --- a/hbase-shell/src/test/ruby/hbase/security_admin_test.rb +++ b/hbase-shell/src/test/ruby/hbase/security_admin_test.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require 'shell' +require 'hbase_shell' require 'hbase_constants' require 'hbase/hbase' require 'hbase/table' diff --git a/hbase-shell/src/test/ruby/hbase/test_connection_no_cluster.rb b/hbase-shell/src/test/ruby/hbase/test_connection_no_cluster.rb index 361937634c3..6969a3613e4 100644 --- a/hbase-shell/src/test/ruby/hbase/test_connection_no_cluster.rb +++ b/hbase-shell/src/test/ruby/hbase/test_connection_no_cluster.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require 'shell' +require 'hbase_shell' require 'stringio' require 'hbase_constants' require 'hbase/hbase' diff --git a/hbase-shell/src/test/ruby/hbase/visibility_labels_admin_test.rb b/hbase-shell/src/test/ruby/hbase/visibility_labels_admin_test.rb index e69710d69a5..b59b9b9065f 100644 --- a/hbase-shell/src/test/ruby/hbase/visibility_labels_admin_test.rb +++ b/hbase-shell/src/test/ruby/hbase/visibility_labels_admin_test.rb @@ -17,7 +17,7 @@ # limitations under the License. # -require 'shell' +require 'hbase_shell' require 'hbase_constants' require 'hbase/hbase' require 'hbase/table' diff --git a/hbase-shell/src/test/ruby/shell/commands_test.rb b/hbase-shell/src/test/ruby/shell/commands_test.rb index 0fc3dab4110..c97931ff20f 100644 --- a/hbase-shell/src/test/ruby/shell/commands_test.rb +++ b/hbase-shell/src/test/ruby/shell/commands_test.rb @@ -19,7 +19,7 @@ require 'hbase_constants' require 'hbase/table' -require 'shell' +require 'hbase_shell' ## # Tests whether all registered commands have a help and command method diff --git a/hbase-shell/src/test/ruby/shell/converter_test.rb b/hbase-shell/src/test/ruby/shell/converter_test.rb index 51e674093f2..34999ea0071 100644 --- a/hbase-shell/src/test/ruby/shell/converter_test.rb +++ b/hbase-shell/src/test/ruby/shell/converter_test.rb @@ -15,7 +15,7 @@ # limitations under the License. require 'hbase_constants' -require 'shell' +require 'hbase_shell' module Hbase class ConverterTest < Test::Unit::TestCase @@ -153,4 +153,4 @@ module Hbase assert(!output.include?(hex_column)) end end -end \ No newline at end of file +end diff --git a/hbase-shell/src/test/ruby/shell/list_locks_test.rb b/hbase-shell/src/test/ruby/shell/list_locks_test.rb index 6d291a5000f..20a910c485d 100644 --- a/hbase-shell/src/test/ruby/shell/list_locks_test.rb +++ b/hbase-shell/src/test/ruby/shell/list_locks_test.rb @@ -18,7 +18,7 @@ # require 'hbase_constants' -require 'shell' +require 'hbase_shell' module Hbase class ListLocksTest < Test::Unit::TestCase diff --git a/hbase-shell/src/test/ruby/shell/list_procedures_test.rb b/hbase-shell/src/test/ruby/shell/list_procedures_test.rb index 2bf5824c0ee..a9a38fe9e73 100644 --- a/hbase-shell/src/test/ruby/shell/list_procedures_test.rb +++ b/hbase-shell/src/test/ruby/shell/list_procedures_test.rb @@ -18,7 +18,7 @@ # require 'hbase_constants' -require 'shell' +require 'hbase_shell' module Hbase class ListProceduresTest < Test::Unit::TestCase diff --git a/hbase-shell/src/test/ruby/shell/noninteractive_test.rb b/hbase-shell/src/test/ruby/shell/noninteractive_test.rb index 0fae4cbb79a..fa8dd333be0 100644 --- a/hbase-shell/src/test/ruby/shell/noninteractive_test.rb +++ b/hbase-shell/src/test/ruby/shell/noninteractive_test.rb @@ -15,7 +15,7 @@ # limitations under the License. # require 'hbase_constants' -require 'shell' +require 'hbase_shell' class NonInteractiveTest < Test::Unit::TestCase def setup diff --git a/hbase-shell/src/test/ruby/shell/rsgroup_shell_test.rb b/hbase-shell/src/test/ruby/shell/rsgroup_shell_test.rb index 33a6c498bec..e8ba851b20b 100644 --- a/hbase-shell/src/test/ruby/shell/rsgroup_shell_test.rb +++ b/hbase-shell/src/test/ruby/shell/rsgroup_shell_test.rb @@ -18,7 +18,7 @@ # require 'hbase_constants' -require 'shell' +require 'hbase_shell' module Hbase class RSGroupShellTest < Test::Unit::TestCase diff --git a/hbase-shell/src/test/ruby/shell/shell_test.rb b/hbase-shell/src/test/ruby/shell/shell_test.rb index 9be6bfba141..b16aef38540 100644 --- a/hbase-shell/src/test/ruby/shell/shell_test.rb +++ b/hbase-shell/src/test/ruby/shell/shell_test.rb @@ -18,7 +18,7 @@ # require 'hbase_constants' -require 'shell' +require 'hbase_shell' class ShellTest < Test::Unit::TestCase include Hbase::TestHelpers diff --git a/hbase-shell/src/test/ruby/test_helper.rb b/hbase-shell/src/test/ruby/test_helper.rb index 26b142638f0..db014f50278 100644 --- a/hbase-shell/src/test/ruby/test_helper.rb +++ b/hbase-shell/src/test/ruby/test_helper.rb @@ -39,7 +39,7 @@ module Hbase module TestHelpers require 'hbase_constants' require 'hbase/hbase' - require 'shell' + require 'hbase_shell' def setup_hbase hbase = ::Hbase::Hbase.new($TEST_CLUSTER.getConfiguration) @@ -169,7 +169,3 @@ end # Extend standard unit tests with our helpers Test::Unit::TestCase.extend(Testing::Declarative) - -# Add the $HBASE_HOME/lib/ruby directory to the ruby -# load path so I can load up my HBase ruby modules -$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "..", "main", "ruby") diff --git a/hbase-shell/src/test/ruby/tests_runner.rb b/hbase-shell/src/test/ruby/tests_runner.rb index b0a0aaf1763..147d68103f5 100644 --- a/hbase-shell/src/test/ruby/tests_runner.rb +++ b/hbase-shell/src/test/ruby/tests_runner.rb @@ -21,6 +21,8 @@ require 'rubygems' require 'rake' require 'set' +puts "Ruby description: #{RUBY_DESCRIPTION}" + unless defined?($TEST_CLUSTER) include Java @@ -68,6 +70,7 @@ files.each do |file| next end begin + puts "loading test file '#{filename}'." load(file) rescue => e puts "ERROR: #{e}"