public RegistryCli(TextWriter sysout, TextWriter syserr) { Configuration conf = new Configuration(); base.SetConf(conf); registry = RegistryOperationsFactory.CreateInstance(conf); registry.Start(); this.sysout = sysout; this.syserr = syserr; }
public virtual void TestAnonNoWriteAccessOffRoot() { RMRegistryOperationsService rmRegistryOperations = StartRMRegistryOperations(); Describe(Log, "testAnonNoWriteAccessOffRoot"); RegistryOperations operations = RegistryOperationsFactory.CreateAnonymousInstance (zkClientConf); AddToTeardown(operations); operations.Start(); NUnit.Framework.Assert.IsFalse("mknode(/)", operations.Mknode("/", false)); ExpectMkNodeFailure(operations, "/sub"); ExpectDeleteFailure(operations, PathSystemServices, true); }
public virtual void TestAnonNoWriteAccess() { RMRegistryOperationsService rmRegistryOperations = StartRMRegistryOperations(); Describe(Log, "testAnonNoWriteAccess"); RegistryOperations operations = RegistryOperationsFactory.CreateAnonymousInstance (zkClientConf); AddToTeardown(operations); operations.Start(); string servicePath = PathSystemServices + "hdfs"; ExpectMkNodeFailure(operations, servicePath); }
public virtual void TestAnonReadAccess() { RMRegistryOperationsService rmRegistryOperations = StartRMRegistryOperations(); Describe(Log, "testAnonReadAccess"); RegistryOperations operations = RegistryOperationsFactory.CreateAnonymousInstance (zkClientConf); AddToTeardown(operations); operations.Start(); NUnit.Framework.Assert.IsFalse("RegistrySecurity.isClientSASLEnabled()==true", RegistrySecurity .IsClientSASLEnabled()); operations.List(PathSystemServices); }
public virtual void TestAlicePathRestrictedAnonAccess() { 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); }
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()); }