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
47
48 TEST_UTIL.getConfiguration().setInt(HConstants.MASTER_INFO_PORT, -1);
49 TEST_UTIL.getConfiguration().setInt(HConstants.REGIONSERVER_INFO_PORT, 0);
50 TEST_UTIL.getConfiguration().setBoolean(HConstants.REGIONSERVER_INFO_PORT_AUTO, true);
51
52 SecureTestUtil.enableSecurity(TEST_UTIL.getConfiguration());
53 VisibilityTestUtil.enableVisiblityLabels(TEST_UTIL.getConfiguration());
54
55 TEST_UTIL.startMiniCluster();
56
57
58 List<String> loadPaths = new ArrayList();
59 loadPaths.add("src/main/ruby");
60 loadPaths.add("src/test/ruby");
61 jruby.getProvider().setLoadPaths(loadPaths);
62 jruby.put("$TEST_CLUSTER", TEST_UTIL);
63 System.setProperty("jruby.jit.logging.verbose", "true");
64 System.setProperty("jruby.jit.logging", "true");
65 System.setProperty("jruby.native.verbose", "true");
66 }
67
68 @AfterClass
69 public static void tearDownAfterClass() throws Exception {
70 TEST_UTIL.shutdownMiniCluster();
71 }
72 }