Search in sources :

Example 6 with ZKPathDumper

use of org.apache.hadoop.registry.client.impl.zk.ZKPathDumper in project hadoop by apache.

the class TestRegistryRMOperations method testAsyncPurgeEntry.

@Test
public void testAsyncPurgeEntry() throws Throwable {
    String path = "/users/example/hbase/hbase1/";
    ServiceRecord written = buildExampleServiceEntry(PersistencePolicies.APPLICATION_ATTEMPT);
    written.set(YarnRegistryAttributes.YARN_ID, "testAsyncPurgeEntry_attempt_001");
    operations.mknode(RegistryPathUtils.parentOf(path), true);
    operations.bind(path, written, 0);
    ZKPathDumper dump = registry.dumpPath(false);
    LOG.info("Initial state {}", dump);
    DeleteCompletionCallback deletions = new DeleteCompletionCallback();
    int opcount = purge("/", written.get(YarnRegistryAttributes.YARN_ID, ""), PersistencePolicies.CONTAINER, RegistryAdminService.PurgePolicy.PurgeAll, deletions);
    assertPathExists(path);
    dump = registry.dumpPath(false);
    assertEquals("wrong no of delete operations in " + dump, 0, deletions.getEventCount());
    assertEquals("wrong no of delete operations in " + dump, 0, opcount);
    // now app attempt
    deletions = new DeleteCompletionCallback();
    opcount = purge("/", written.get(YarnRegistryAttributes.YARN_ID, ""), PersistencePolicies.APPLICATION_ATTEMPT, RegistryAdminService.PurgePolicy.PurgeAll, deletions);
    dump = registry.dumpPath(false);
    LOG.info("Final state {}", dump);
    assertPathNotFound(path);
    assertEquals("wrong no of delete operations in " + dump, 1, deletions.getEventCount());
    assertEquals("wrong no of delete operations in " + dump, 1, opcount);
// and validate the callback event
}
Also used : ZKPathDumper(org.apache.hadoop.registry.client.impl.zk.ZKPathDumper) DeleteCompletionCallback(org.apache.hadoop.registry.server.services.DeleteCompletionCallback) RegistryTypeUtils.restEndpoint(org.apache.hadoop.registry.client.binding.RegistryTypeUtils.restEndpoint) RegistryTypeUtils.inetAddrEndpoint(org.apache.hadoop.registry.client.binding.RegistryTypeUtils.inetAddrEndpoint) ServiceRecord(org.apache.hadoop.registry.client.types.ServiceRecord) Test(org.junit.Test) AbstractRegistryTest(org.apache.hadoop.registry.AbstractRegistryTest)

Aggregations

ZKPathDumper (org.apache.hadoop.registry.client.impl.zk.ZKPathDumper)6 Test (org.junit.Test)5 AbstractRegistryTest (org.apache.hadoop.registry.AbstractRegistryTest)3 RegistryTypeUtils.inetAddrEndpoint (org.apache.hadoop.registry.client.binding.RegistryTypeUtils.inetAddrEndpoint)3 RegistryTypeUtils.restEndpoint (org.apache.hadoop.registry.client.binding.RegistryTypeUtils.restEndpoint)3 ServiceRecord (org.apache.hadoop.registry.client.types.ServiceRecord)3 RegistryOperations (org.apache.hadoop.registry.client.api.RegistryOperations)2 RMRegistryOperationsService (org.apache.hadoop.registry.server.integration.RMRegistryOperationsService)2 URI (java.net.URI)1 LoginContext (javax.security.auth.login.LoginContext)1 PathIsNotEmptyDirectoryException (org.apache.hadoop.fs.PathIsNotEmptyDirectoryException)1 CuratorEventCatcher (org.apache.hadoop.registry.client.impl.CuratorEventCatcher)1 RegistryOperationsClient (org.apache.hadoop.registry.client.impl.RegistryOperationsClient)1 CuratorService (org.apache.hadoop.registry.client.impl.zk.CuratorService)1 RegistryPathStatus (org.apache.hadoop.registry.client.types.RegistryPathStatus)1 DeleteCompletionCallback (org.apache.hadoop.registry.server.services.DeleteCompletionCallback)1 ACL (org.apache.zookeeper.data.ACL)1