Ejemplo n.º 1
0
        public virtual void TestZookeeperCanWriteUnderSystem()
        {
            RMRegistryOperationsService rmRegistryOperations = StartRMRegistryOperations();
            RegistryOperations          operations           = rmRegistryOperations;

            operations.Mknode(PathSystemServices + "hdfs", false);
            ZKPathDumper pathDumper = rmRegistryOperations.DumpPath(true);

            Log.Info(pathDumper.ToString());
        }
Ejemplo n.º 2
0
        public virtual void TestDigestAccess()
        {
            RMRegistryOperationsService registryAdmin = StartRMRegistryOperations();
            string id   = "username";
            string pass = "******";

            registryAdmin.AddWriteAccessor(id, pass);
            IList <ACL> clientAcls = registryAdmin.GetClientAcls();

            Log.Info("Client ACLS=\n{}", RegistrySecurity.AclsToString(clientAcls));
            string @base = "/digested";

            registryAdmin.Mknode(@base, false);
            IList <ACL> baseACLs = registryAdmin.ZkGetACLS(@base);
            string      aclset   = RegistrySecurity.AclsToString(baseACLs);

            Log.Info("Base ACLs=\n{}", aclset);
            ACL found = null;

            foreach (ACL acl in baseACLs)
            {
                if (ZookeeperConfigOptions.SchemeDigest.Equals(acl.GetId().GetScheme()))
                {
                    found = acl;
                    break;
                }
            }
            NUnit.Framework.Assert.IsNotNull("Did not find digest entry in ACLs " + aclset, found
                                             );
            zkClientConf.Set(KeyRegistryUserAccounts, "sasl:[email protected], sasl:other"
                             );
            RegistryOperations operations = RegistryOperationsFactory.CreateAuthenticatedInstance
                                                (zkClientConf, id, pass);

            AddToTeardown(operations);
            operations.Start();
            RegistryOperationsClient operationsClient = (RegistryOperationsClient)operations;
            IList <ACL> digestClientACLs = operationsClient.GetClientAcls();

            Log.Info("digest client ACLs=\n{}", RegistrySecurity.AclsToString(digestClientACLs
                                                                              ));
            operations.Stat(@base);
            operations.Mknode(@base + "/subdir", false);
            ZKPathDumper pathDumper = registryAdmin.DumpPath(true);

            Log.Info(pathDumper.ToString());
        }