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