Search in sources :

Example 1 with RMRegistryOperationsService

use of org.apache.hadoop.registry.server.integration.RMRegistryOperationsService in project hadoop by apache.

the class AbstractRegistryTest method setupRegistry.

@Before
public void setupRegistry() throws IOException {
    registry = new RMRegistryOperationsService("yarnRegistry");
    operations = registry;
    registry.init(createRegistryConfiguration());
    registry.start();
    operations.delete("/", true);
    registry.createRootRegistryPaths();
    addToTeardown(registry);
}
Also used : RMRegistryOperationsService(org.apache.hadoop.registry.server.integration.RMRegistryOperationsService) Before(org.junit.Before)

Example 2 with RMRegistryOperationsService

use of org.apache.hadoop.registry.server.integration.RMRegistryOperationsService in project hadoop by apache.

the class TestSecureRMRegistryOperations method startRMRegistryOperations.

/**
   * Create the RM registry operations as the current user
   * @return the service
   * @throws LoginException
   * @throws FileNotFoundException
   */
public RMRegistryOperationsService startRMRegistryOperations() throws LoginException, IOException, InterruptedException {
    // kerberos
    secureConf.set(KEY_REGISTRY_CLIENT_AUTH, REGISTRY_CLIENT_AUTH_KERBEROS);
    secureConf.set(KEY_REGISTRY_CLIENT_JAAS_CONTEXT, ZOOKEEPER_CLIENT_CONTEXT);
    RMRegistryOperationsService registryOperations = zookeeperUGI.doAs(new PrivilegedExceptionAction<RMRegistryOperationsService>() {

        @Override
        public RMRegistryOperationsService run() throws Exception {
            RMRegistryOperationsService operations = new RMRegistryOperationsService("rmregistry", secureZK);
            addToTeardown(operations);
            operations.init(secureConf);
            LOG.info(operations.bindingDiagnosticDetails());
            operations.start();
            return operations;
        }
    });
    return registryOperations;
}
Also used : 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)

Example 3 with RMRegistryOperationsService

use of org.apache.hadoop.registry.server.integration.RMRegistryOperationsService in project hadoop by apache.

the class TestSecureRMRegistryOperations method testAlicePathRestrictedAnonAccess.

@Test
public void testAlicePathRestrictedAnonAccess() throws Throwable {
    RMRegistryOperationsService rmRegistryOperations = startRMRegistryOperations();
    String aliceHome = rmRegistryOperations.initUserRegistry(ALICE);
    describe(LOG, "Creating anonymous accessor");
    RegistryOperations anonOperations = RegistryOperationsFactory.createAnonymousInstance(zkClientConf);
    addToTeardown(anonOperations);
    anonOperations.start();
    anonOperations.list(aliceHome);
    expectMkNodeFailure(anonOperations, aliceHome + "/anon");
    expectDeleteFailure(anonOperations, aliceHome, true);
}
Also used : RegistryOperations(org.apache.hadoop.registry.client.api.RegistryOperations) RMRegistryOperationsService(org.apache.hadoop.registry.server.integration.RMRegistryOperationsService) Test(org.junit.Test)

Example 4 with RMRegistryOperationsService

use of org.apache.hadoop.registry.server.integration.RMRegistryOperationsService in project hadoop by apache.

the class TestSecureRMRegistryOperations method testAnonNoWriteAccess.

@Test
public void testAnonNoWriteAccess() throws Throwable {
    RMRegistryOperationsService rmRegistryOperations = startRMRegistryOperations();
    describe(LOG, "testAnonNoWriteAccess");
    RegistryOperations operations = RegistryOperationsFactory.createAnonymousInstance(zkClientConf);
    addToTeardown(operations);
    operations.start();
    String servicePath = PATH_SYSTEM_SERVICES + "hdfs";
    expectMkNodeFailure(operations, servicePath);
}
Also used : RegistryOperations(org.apache.hadoop.registry.client.api.RegistryOperations) RMRegistryOperationsService(org.apache.hadoop.registry.server.integration.RMRegistryOperationsService) Test(org.junit.Test)

Example 5 with RMRegistryOperationsService

use of org.apache.hadoop.registry.server.integration.RMRegistryOperationsService in project jstorm by alibaba.

the class JstormMaster method setupInitialRegistryPaths.

/**
 * TODO: purge this once RM is doing the work
 *
 * @throws IOException
 */
protected void setupInitialRegistryPaths() throws IOException {
    if (registryOperations instanceof RMRegistryOperationsService) {
        RMRegistryOperationsService rmRegOperations = (RMRegistryOperationsService) registryOperations;
        rmRegOperations.initUserRegistryAsync(jstormMasterContext.service_user_name);
    }
}
Also used : RMRegistryOperationsService(org.apache.hadoop.registry.server.integration.RMRegistryOperationsService)

Aggregations

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