Search in sources :

Example 11 with HBaseCommonTestingUtil

use of org.apache.hadoop.hbase.HBaseCommonTestingUtil in project hbase by apache.

the class RegionProcedureStoreTestBase method setUp.

@Before
public void setUp() throws IOException {
    htu = new HBaseCommonTestingUtil();
    Configuration conf = htu.getConfiguration();
    conf.setBoolean(MemStoreLAB.USEMSLAB_KEY, false);
    // Runs on local filesystem. Test does not need sync. Turn off checks.
    conf.setBoolean(CommonFSUtils.UNSAFE_STREAM_CAPABILITY_ENFORCE, false);
    Path testDir = htu.getDataTestDir();
    CommonFSUtils.setRootDir(htu.getConfiguration(), testDir);
    Server server = RegionProcedureStoreTestHelper.mockServer(conf);
    region = MasterRegionFactory.create(server);
    store = RegionProcedureStoreTestHelper.createStore(server, region, new LoadCounter());
}
Also used : Path(org.apache.hadoop.fs.Path) HBaseCommonTestingUtil(org.apache.hadoop.hbase.HBaseCommonTestingUtil) Configuration(org.apache.hadoop.conf.Configuration) Server(org.apache.hadoop.hbase.Server) LoadCounter(org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility.LoadCounter) Before(org.junit.Before)

Example 12 with HBaseCommonTestingUtil

use of org.apache.hadoop.hbase.HBaseCommonTestingUtil in project hbase by apache.

the class MasterRegionTestBase method setUp.

@Before
public void setUp() throws IOException {
    htu = new HBaseCommonTestingUtil();
    htu.getConfiguration().setBoolean(MemStoreLAB.USEMSLAB_KEY, false);
    // Runs on local filesystem. Test does not need sync. Turn off checks.
    htu.getConfiguration().setBoolean(CommonFSUtils.UNSAFE_STREAM_CAPABILITY_ENFORCE, false);
    createMasterRegion();
}
Also used : HBaseCommonTestingUtil(org.apache.hadoop.hbase.HBaseCommonTestingUtil) Before(org.junit.Before)

Example 13 with HBaseCommonTestingUtil

use of org.apache.hadoop.hbase.HBaseCommonTestingUtil in project hbase by apache.

the class TestRegionProcedureStoreMigration method setUp.

@Before
public void setUp() throws IOException {
    htu = new HBaseCommonTestingUtil();
    Configuration conf = htu.getConfiguration();
    conf.setBoolean(MemStoreLAB.USEMSLAB_KEY, false);
    // Runs on local filesystem. Test does not need sync. Turn off checks.
    conf.setBoolean(CommonFSUtils.UNSAFE_STREAM_CAPABILITY_ENFORCE, false);
    Path testDir = htu.getDataTestDir();
    CommonFSUtils.setRootDir(conf, testDir);
    walStore = new WALProcedureStore(conf, new LeaseRecovery() {

        @Override
        public void recoverFileLease(FileSystem fs, Path path) throws IOException {
        }
    });
    walStore.start(1);
    walStore.recoverLease();
    walStore.load(new LoadCounter());
    server = RegionProcedureStoreTestHelper.mockServer(conf);
    region = MasterRegionFactory.create(server);
}
Also used : Path(org.apache.hadoop.fs.Path) HBaseCommonTestingUtil(org.apache.hadoop.hbase.HBaseCommonTestingUtil) Configuration(org.apache.hadoop.conf.Configuration) LeaseRecovery(org.apache.hadoop.hbase.procedure2.store.LeaseRecovery) LoadCounter(org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility.LoadCounter) FileSystem(org.apache.hadoop.fs.FileSystem) WALProcedureStore(org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore) Before(org.junit.Before)

Example 14 with HBaseCommonTestingUtil

use of org.apache.hadoop.hbase.HBaseCommonTestingUtil in project hbase by apache.

the class TestProxyUserSpnegoHttpServer 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");
    wheelKeytab = new File(keytabDir, WHEEL_PRINCIPAL + ".keytab");
    unprivilegedKeytab = new File(keytabDir, UNPRIVILEGED_PRINCIPAL + ".keytab");
    privilegedKeytab = new File(keytabDir, PRIVILEGED_PRINCIPAL + ".keytab");
    privileged2Keytab = new File(keytabDir, PRIVILEGED2_PRINCIPAL + ".keytab");
    setupUser(kdc, wheelKeytab, WHEEL_PRINCIPAL);
    setupUser(kdc, unprivilegedKeytab, UNPRIVILEGED_PRINCIPAL);
    setupUser(kdc, privilegedKeytab, PRIVILEGED_PRINCIPAL);
    setupUser(kdc, privileged2Keytab, PRIVILEGED2_PRINCIPAL);
    setupUser(kdc, infoServerKeytab, serverPrincipal);
    buildSpnegoConfiguration(conf, serverPrincipal, infoServerKeytab);
    AccessControlList acl = buildAdminAcl(conf);
    server = createTestServerWithSecurityAndAcl(conf, acl);
    server.addPrivilegedServlet("echo", "/echo", EchoServlet.class);
    server.addJerseyResourcePackage(JerseyResource.class.getPackage().getName(), "/jersey/*");
    server.start();
    baseUrl = getServerURL(server);
    LOG.info("HTTP server started: " + baseUrl);
}
Also used : AccessControlList(org.apache.hadoop.security.authorize.AccessControlList) HBaseCommonTestingUtil(org.apache.hadoop.hbase.HBaseCommonTestingUtil) Configuration(org.apache.hadoop.conf.Configuration) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Example 15 with HBaseCommonTestingUtil

use of org.apache.hadoop.hbase.HBaseCommonTestingUtil in project hbase by apache.

the class TestChildProcedures 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");
    procEnv = new TestProcEnv();
    procStore = ProcedureTestingUtility.createStore(htu.getConfiguration(), logDir);
    procExecutor = new ProcedureExecutor<>(htu.getConfiguration(), procEnv, procStore);
    procExecutor.testing = new ProcedureExecutor.Testing();
    procStore.start(PROCEDURE_EXECUTOR_SLOTS);
    ProcedureTestingUtility.initAndStartWorkers(procExecutor, PROCEDURE_EXECUTOR_SLOTS, true);
}
Also used : Path(org.apache.hadoop.fs.Path) HBaseCommonTestingUtil(org.apache.hadoop.hbase.HBaseCommonTestingUtil) Before(org.junit.Before)

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