1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.hadoop.hbase.client;
19
20 import java.util.ArrayList;
21 import java.util.List;
22
23 import org.apache.hadoop.hbase.HBaseTestingUtility;
24 import org.apache.hadoop.hbase.HConstants;
25 import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
26 import org.apache.hadoop.hbase.security.access.SecureTestUtil;
27 import org.apache.hadoop.hbase.security.visibility.VisibilityTestUtil;
28 import org.jruby.embed.ScriptingContainer;
29 import org.junit.AfterClass;
30 import org.junit.BeforeClass;
31
32 public abstract class AbstractTestShell {
33
34 protected final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
35 protected final static ScriptingContainer jruby = new ScriptingContainer();
36
37 @BeforeClass
38 public static void setUpBeforeClass() throws Exception {
39
40 TEST_UTIL.getConfiguration().setBoolean("hbase.online.schema.update.enable", true);
41 TEST_UTIL.getConfiguration().setInt("hbase.regionserver.msginterval", 100);
42 TEST_UTIL.getConfiguration().setInt("hbase.client.pause", 250);
43 TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 6);
44 TEST_UTIL.getConfiguration().setBoolean(CoprocessorHost.ABORT_ON_ERROR_KEY, false);
45 TEST_UTIL.getConfiguration().setInt("hfile.format.version", 3);
46 TEST_UTIL.getConfiguration().setInt(HConstants.MASTER_INFO_PORT, -1);
47 TEST_UTIL.getConfiguration().setInt(HConstants.REGIONSERVER_INFO_PORT, -1);
48
49 SecureTestUtil.enableSecurity(TEST_UTIL.getConfiguration());
50 VisibilityTestUtil.enableVisiblityLabels(TEST_UTIL.getConfiguration());
51
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 System.setProperty("jruby.jit.logging.verbose", "true");
61 System.setProperty("jruby.jit.logging", "true");
62 System.setProperty("jruby.native.verbose", "true");
63 }
64
65 @AfterClass
66 public static void tearDownAfterClass() throws Exception {
67 TEST_UTIL.shutdownMiniCluster();
68 }
69 }