Search in sources :

Example 6 with HBaseCommonTestingUtil

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);
}
Also used : Path(org.apache.hadoop.fs.Path) HBaseCommonTestingUtil(org.apache.hadoop.hbase.HBaseCommonTestingUtil) Before(org.junit.Before)

Example 7 with HBaseCommonTestingUtil

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);
}
Also used : HBaseCommonTestingUtil(org.apache.hadoop.hbase.HBaseCommonTestingUtil) NoopProcedureStore(org.apache.hadoop.hbase.procedure2.store.NoopProcedureStore) Before(org.junit.Before)

Example 8 with HBaseCommonTestingUtil

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);
}
Also used : HBaseCommonTestingUtil(org.apache.hadoop.hbase.HBaseCommonTestingUtil) SSLFactory(org.apache.hadoop.security.ssl.SSLFactory) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) Configuration(org.apache.hadoop.conf.Configuration) File(java.io.File) URI(java.net.URI) URL(java.net.URL) BeforeClass(org.junit.BeforeClass)

Example 9 with HBaseCommonTestingUtil

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);
}
Also used : HBaseCommonTestingUtil(org.apache.hadoop.hbase.HBaseCommonTestingUtil) Configuration(org.apache.hadoop.conf.Configuration) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Example 10 with HBaseCommonTestingUtil

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);
}
Also used : HBaseCommonTestingUtil(org.apache.hadoop.hbase.HBaseCommonTestingUtil) Configuration(org.apache.hadoop.conf.Configuration) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Aggregations

HBaseCommonTestingUtil (org.apache.hadoop.hbase.HBaseCommonTestingUtil)26 Before (org.junit.Before)20 Path (org.apache.hadoop.fs.Path)15 Configuration (org.apache.hadoop.conf.Configuration)7 BeforeClass (org.junit.BeforeClass)6 File (java.io.File)4 LoadCounter (org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility.LoadCounter)4 NoopProcedureStore (org.apache.hadoop.hbase.procedure2.store.NoopProcedureStore)3 URI (java.net.URI)1 URL (java.net.URL)1 Duration (java.time.Duration)1 Arrays (java.util.Arrays)1 Collections.singletonList (java.util.Collections.singletonList)1 ExecutorService (java.util.concurrent.ExecutorService)1 Executors (java.util.concurrent.Executors)1 ThreadFactory (java.util.concurrent.ThreadFactory)1 TimeUnit (java.util.concurrent.TimeUnit)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 Supplier (java.util.function.Supplier)1 FileSystem (org.apache.hadoop.fs.FileSystem)1