use of org.apache.hadoop.hbase.HBaseCommonTestingUtil in project hbase by apache.
the class TestProcedureSkipPersistence method setUp.
@Before
public void setUp() throws IOException {
htu = new HBaseCommonTestingUtil();
testDir = htu.getDataTestDir();
fs = testDir.getFileSystem(htu.getConfiguration());
assertTrue(testDir.depth() > 1);
logDir = new Path(testDir, "proc-logs");
procStore = ProcedureTestingUtility.createWalStore(htu.getConfiguration(), logDir);
procExecutor = new ProcedureExecutor<>(htu.getConfiguration(), new ProcEnv(), procStore);
procStore.start(1);
ProcedureTestingUtility.initAndStartWorkers(procExecutor, 1, true);
}
use of org.apache.hadoop.hbase.HBaseCommonTestingUtil in project hbase by apache.
the class TestProcedureExecutor method setUp.
@Before
public void setUp() throws Exception {
htu = new HBaseCommonTestingUtil();
// NOTE: The executor will be created by each test
procEnv = new TestProcEnv();
procStore = new NoopProcedureStore();
procStore.start(1);
}
use of org.apache.hadoop.hbase.HBaseCommonTestingUtil in project hbase by apache.
the class TestSSLHttpServer method setup.
@BeforeClass
public static void setup() throws Exception {
HTU = new HBaseCommonTestingUtil();
serverConf = HTU.getConfiguration();
serverConf.setInt(HttpServer.HTTP_MAX_THREADS, TestHttpServer.MAX_THREADS);
keystoresDir = new File(HTU.getDataTestDir("keystore").toString());
keystoresDir.mkdirs();
sslConfDir = KeyStoreTestUtil.getClasspathDir(TestSSLHttpServer.class);
KeyStoreTestUtil.setupSSLConfig(keystoresDir.getAbsolutePath(), sslConfDir, serverConf, false);
Configuration clientConf = new Configuration(false);
clientConf.addResource(serverConf.get(SSLFactory.SSL_CLIENT_CONF_KEY));
serverConf.addResource(serverConf.get(SSLFactory.SSL_SERVER_CONF_KEY));
clientConf.set(SSLFactory.SSL_CLIENT_CONF_KEY, serverConf.get(SSLFactory.SSL_CLIENT_CONF_KEY));
clientSslFactory = new SSLFactory(SSLFactory.Mode.CLIENT, clientConf);
clientSslFactory.init();
server = new HttpServer.Builder().setName("test").addEndpoint(new URI("https://localhost")).setConf(serverConf).keyPassword(HBaseConfiguration.getPassword(serverConf, "ssl.server.keystore.keypassword", null)).keyStore(serverConf.get("ssl.server.keystore.location"), HBaseConfiguration.getPassword(serverConf, "ssl.server.keystore.password", null), clientConf.get("ssl.server.keystore.type", "jks")).trustStore(serverConf.get("ssl.server.truststore.location"), HBaseConfiguration.getPassword(serverConf, "ssl.server.truststore.password", null), serverConf.get("ssl.server.truststore.type", "jks")).build();
server.addUnprivilegedServlet("echo", "/echo", TestHttpServer.EchoServlet.class);
server.start();
baseUrl = new URL("https://" + NetUtils.getHostPortString(server.getConnectorAddress(0)));
LOG.info("HTTP server started: " + baseUrl);
}
use of org.apache.hadoop.hbase.HBaseCommonTestingUtil in project hbase by apache.
the class TestSpnegoHttpServer method setupServer.
@BeforeClass
public static void setupServer() throws Exception {
Configuration conf = new Configuration();
HBaseCommonTestingUtil htu = new HBaseCommonTestingUtil(conf);
final String serverPrincipal = "HTTP/" + KDC_SERVER_HOST;
kdc = SimpleKdcServerUtil.getRunningSimpleKdcServer(new File(htu.getDataTestDir().toString()), HBaseCommonTestingUtil::randomFreePort);
File keytabDir = new File(htu.getDataTestDir("keytabs").toString());
if (keytabDir.exists()) {
deleteRecursively(keytabDir);
}
keytabDir.mkdirs();
infoServerKeytab = new File(keytabDir, serverPrincipal.replace('/', '_') + ".keytab");
clientKeytab = new File(keytabDir, CLIENT_PRINCIPAL + ".keytab");
setupUser(kdc, clientKeytab, CLIENT_PRINCIPAL);
setupUser(kdc, infoServerKeytab, serverPrincipal);
buildSpnegoConfiguration(conf, serverPrincipal, infoServerKeytab);
server = createTestServerWithSecurity(conf);
server.addUnprivilegedServlet("echo", "/echo", EchoServlet.class);
server.addJerseyResourcePackage(JerseyResource.class.getPackage().getName(), "/jersey/*");
server.start();
baseUrl = getServerURL(server);
LOG.info("HTTP server started: " + baseUrl);
}
use of org.apache.hadoop.hbase.HBaseCommonTestingUtil in project hbase by apache.
the class TestLogLevel method setUp.
@BeforeClass
public static void setUp() throws Exception {
serverConf = new Configuration();
serverConf.setStrings(LogLevel.READONLY_LOGGERS_CONF_KEY, protectedPrefix);
HTU = new HBaseCommonTestingUtil(serverConf);
File keystoreDir = new File(HTU.getDataTestDir("keystore").toString());
keystoreDir.mkdirs();
keyTabFile = new File(HTU.getDataTestDir("keytab").toString(), "keytabfile");
keyTabFile.getParentFile().mkdirs();
clientConf = new Configuration();
setupSSL(keystoreDir);
kdc = setupMiniKdc();
// Create two principles: a client and an HTTP principal
kdc.createPrincipal(keyTabFile, clientPrincipal, HTTP_PRINCIPAL);
}
Aggregations