Exemple #1
0
        public virtual void TestTempDirSupport()
        {
            YarnConfiguration conf = new YarnConfiguration();

            zookeeper = new MicroZookeeperService("t1");
            zookeeper.Init(conf);
            zookeeper.Start();
            zookeeper.Stop();
        }
Exemple #2
0
 /// <summary>Start the secure ZK instance using the test method name as the path.</summary>
 /// <remarks>
 /// Start the secure ZK instance using the test method name as the path.
 /// As the entry is saved to the
 /// <see cref="secureZK"/>
 /// field, it
 /// is automatically stopped after the test case.
 /// </remarks>
 /// <exception cref="System.Exception">on any failure</exception>
 protected internal virtual void StartSecureZK()
 {
     lock (this)
     {
         NUnit.Framework.Assert.IsNull("Zookeeper is already running", secureZK);
         zookeeperLogin = Login(zkServerPrincipal, ZookeeperServerContext, keytab_zk);
         secureZK       = CreateSecureZKInstance("test-" + methodName.GetMethodName());
         secureZK.Start();
     }
 }
Exemple #3
0
 /// <summary>Stop the secure ZK and log out the ZK account</summary>
 public virtual void StopSecureZK()
 {
     lock (this)
     {
         ServiceOperations.Stop(secureZK);
         secureZK = null;
         Logout(zookeeperLogin);
         zookeeperLogin = null;
     }
 }
        public static void CreateZKServer()
        {
            FilePath zkDir = new FilePath("target/zookeeper");

            FileUtils.DeleteDirectory(zkDir);
            NUnit.Framework.Assert.IsTrue(zkDir.Mkdirs());
            zookeeper = new MicroZookeeperService("InMemoryZKService");
            YarnConfiguration conf = new YarnConfiguration();

            conf.Set(MicroZookeeperServiceKeys.KeyZkserviceDir, zkDir.GetAbsolutePath());
            zookeeper.Init(conf);
            zookeeper.Start();
            AddToTeardown(zookeeper);
        }
Exemple #5
0
        /// <summary>Create a secure instance</summary>
        /// <param name="name">instance name</param>
        /// <returns>the instance</returns>
        /// <exception cref="System.Exception"/>
        protected internal static MicroZookeeperService CreateSecureZKInstance(string name
                                                                               )
        {
            string        context = ZookeeperServerContext;
            Configuration conf    = new Configuration();
            FilePath      testdir = new FilePath(Runtime.GetProperty("test.dir", "target"));
            FilePath      workDir = new FilePath(testdir, name);

            if (!workDir.Mkdirs())
            {
                NUnit.Framework.Assert.IsTrue(workDir.IsDirectory());
            }
            Runtime.SetProperty(ZookeeperConfigOptions.PropZkServerMaintainConnectionDespiteSaslFailure
                                , "false");
            RegistrySecurity.ValidateContext(context);
            conf.Set(MicroZookeeperServiceKeys.KeyRegistryZkserviceJaasContext, context);
            MicroZookeeperService secureZK = new MicroZookeeperService(name);

            secureZK.Init(conf);
            Log.Info(secureZK.GetDiagnostics());
            return(secureZK);
        }