Search in sources :

Example 6 with RegistryOperations

use of org.apache.hadoop.registry.client.api.RegistryOperations in project hadoop by apache.

the class TestSecureRMRegistryOperations method testUserZookeeperHomePathAccess.

@Test
public void testUserZookeeperHomePathAccess() throws Throwable {
    RMRegistryOperationsService rmRegistryOperations = startRMRegistryOperations();
    final String home = rmRegistryOperations.initUserRegistry(ZOOKEEPER);
    describe(LOG, "Creating ZK client");
    RegistryOperations operations = zookeeperUGI.doAs(new PrivilegedExceptionAction<RegistryOperations>() {

        @Override
        public RegistryOperations run() throws Exception {
            RegistryOperations operations = RegistryOperationsFactory.createKerberosInstance(zkClientConf, ZOOKEEPER_CLIENT_CONTEXT);
            addToTeardown(operations);
            operations.start();
            return operations;
        }
    });
    operations.list(home);
    String path = home + "/subpath";
    operations.mknode(path, false);
    operations.delete(path, true);
}
Also used : RegistryOperations(org.apache.hadoop.registry.client.api.RegistryOperations) LoginException(javax.security.auth.login.LoginException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) ServiceStateException(org.apache.hadoop.service.ServiceStateException) PathPermissionException(org.apache.hadoop.fs.PathPermissionException) NoPathPermissionsException(org.apache.hadoop.registry.client.exceptions.NoPathPermissionsException) RMRegistryOperationsService(org.apache.hadoop.registry.server.integration.RMRegistryOperationsService) Test(org.junit.Test)

Example 7 with RegistryOperations

use of org.apache.hadoop.registry.client.api.RegistryOperations in project hadoop by apache.

the class TestSecureRMRegistryOperations method testZookeeperCanWriteUnderSystem.

/**
   * test that ZK can write as itself
   * @throws Throwable
   */
@Test
public void testZookeeperCanWriteUnderSystem() throws Throwable {
    RMRegistryOperationsService rmRegistryOperations = startRMRegistryOperations();
    RegistryOperations operations = rmRegistryOperations;
    operations.mknode(PATH_SYSTEM_SERVICES + "hdfs", false);
    ZKPathDumper pathDumper = rmRegistryOperations.dumpPath(true);
    LOG.info(pathDumper.toString());
}
Also used : ZKPathDumper(org.apache.hadoop.registry.client.impl.zk.ZKPathDumper) RegistryOperations(org.apache.hadoop.registry.client.api.RegistryOperations) RMRegistryOperationsService(org.apache.hadoop.registry.server.integration.RMRegistryOperationsService) Test(org.junit.Test)

Aggregations

RegistryOperations (org.apache.hadoop.registry.client.api.RegistryOperations)7 RMRegistryOperationsService (org.apache.hadoop.registry.server.integration.RMRegistryOperationsService)7 Test (org.junit.Test)7 ZKPathDumper (org.apache.hadoop.registry.client.impl.zk.ZKPathDumper)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 LoginException (javax.security.auth.login.LoginException)1 PathPermissionException (org.apache.hadoop.fs.PathPermissionException)1 NoPathPermissionsException (org.apache.hadoop.registry.client.exceptions.NoPathPermissionsException)1 RegistryOperationsClient (org.apache.hadoop.registry.client.impl.RegistryOperationsClient)1 ServiceStateException (org.apache.hadoop.service.ServiceStateException)1 ACL (org.apache.zookeeper.data.ACL)1