コード例 #1
0
 public virtual void SetupRegistry()
 {
     registry   = new RMRegistryOperationsService("yarnRegistry");
     operations = registry;
     registry.Init(CreateRegistryConfiguration());
     registry.Start();
     operations.Delete("/", true);
     registry.CreateRootRegistryPaths();
     AddToTeardown(registry);
 }
コード例 #2
0
        public virtual void TestUserZookeeperHomePathAccess()
        {
            RMRegistryOperationsService rmRegistryOperations = StartRMRegistryOperations();
            string home = rmRegistryOperations.InitUserRegistry(Zookeeper);

            Describe(Log, "Creating ZK client");
            RegistryOperations operations = zookeeperUGI.DoAs(new _PrivilegedExceptionAction_232
                                                                  (this));

            operations.List(home);
            string path = home + "/subpath";

            operations.Mknode(path, false);
            operations.Delete(path, true);
        }
コード例 #3
0
 // expected
 // expected
 /// <summary>Expect a delete operation to fail</summary>
 /// <param name="operations">operations instance</param>
 /// <param name="path">path</param>
 /// <param name="recursive"/>
 /// <exception cref="System.IO.IOException">An IO failure other than those permitted</exception>
 public virtual void ExpectDeleteFailure(RegistryOperations operations, string path
                                         , bool recursive)
 {
     try
     {
         operations.Delete(path, recursive);
         NUnit.Framework.Assert.Fail("should have failed to delete the node " + path);
     }
     catch (PathPermissionException)
     {
     }
     catch (NoPathPermissionsException)
     {
     }
 }
コード例 #4
0
        public virtual int Rm(string[] args)
        {
            Option  recursive = OptionBuilder.Create("r");
            Options rmOption  = new Options();

            rmOption.AddOption(recursive);
            bool recursiveOpt        = false;
            CommandLineParser parser = new GnuParser();

            try
            {
                CommandLine    line     = parser.Parse(rmOption, args);
                IList <string> argsList = line.GetArgList();
                if (argsList.Count != 2)
                {
                    return(UsageError("RM requires exactly one path argument", RmUsage));
                }
                if (!ValidatePath(argsList[1]))
                {
                    return(-1);
                }
                try
                {
                    if (line.HasOption("r"))
                    {
                        recursiveOpt = true;
                    }
                    registry.Delete(argsList[1], recursiveOpt);
                    return(0);
                }
                catch (Exception e)
                {
                    syserr.WriteLine(AnalyzeException("rm", e, argsList));
                }
                return(-1);
            }
            catch (ParseException exp)
            {
                return(UsageError("Invalid syntax " + exp.ToString(), RmUsage));
            }
        }