1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.hadoop.hbase.client;
21
22 import java.io.IOException;
23 import java.util.ArrayList;
24 import java.util.List;
25
26 import org.apache.commons.logging.Log;
27 import org.apache.commons.logging.LogFactory;
28 import org.apache.hadoop.hbase.HBaseTestingUtility;
29 import org.apache.hadoop.hbase.HConstants;
30 import org.apache.hadoop.hbase.testclassification.LargeTests;
31 import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
32 import org.apache.hadoop.hbase.security.access.SecureTestUtil;
33 import org.apache.hadoop.hbase.security.visibility.VisibilityTestUtil;
34 import org.jruby.embed.PathType;
35 import org.jruby.embed.ScriptingContainer;
36 import org.junit.AfterClass;
37 import org.junit.BeforeClass;
38 import org.junit.Test;
39 import org.junit.experimental.categories.Category;
40
41 @Category(LargeTests.class)
42 public class TestShell {
43 final Log LOG = LogFactory.getLog(getClass());
44 private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
45 private final static ScriptingContainer jruby = new ScriptingContainer();
46
47 @BeforeClass
48 public static void setUpBeforeClass() throws Exception {
49
50 TEST_UTIL.getConfiguration().setBoolean("hbase.online.schema.update.enable", true);
51 TEST_UTIL.getConfiguration().setInt("hbase.regionserver.msginterval", 100);
52 TEST_UTIL.getConfiguration().setInt("hbase.client.pause", 250);
53 TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 6);
54 TEST_UTIL.getConfiguration().setBoolean(CoprocessorHost.ABORT_ON_ERROR_KEY, false);
55 TEST_UTIL.getConfiguration().setInt("hfile.format.version", 3);
56
57 SecureTestUtil.enableSecurity(TEST_UTIL.getConfiguration());
58 VisibilityTestUtil.enableVisiblityLabels(TEST_UTIL.getConfiguration());
59
60 TEST_UTIL.startMiniCluster();
61
62
63 List<String> loadPaths = new ArrayList();
64 loadPaths.add("src/main/ruby");
65 loadPaths.add("src/test/ruby");
66 jruby.getProvider().setLoadPaths(loadPaths);
67 jruby.put("$TEST_CLUSTER", TEST_UTIL);
68 }
69
70 @AfterClass
71 public static void tearDownAfterClass() throws Exception {
72 TEST_UTIL.shutdownMiniCluster();
73 }
74
75 @Test
76 public void testRunShellTests() throws IOException {
77
78 jruby.runScriptlet(PathType.ABSOLUTE, "src/test/ruby/tests_runner.rb");
79 }
80
81 }
82