Exemple #1
0
        public void TestGetterSetter()
        {
            Mock <IHadoopConfigurationProxy> hadoopConfProxy = new Mock <IHadoopConfigurationProxy>();

            hadoopConfProxy.Setup(m => m.Get(It.IsAny <string>(), It.IsAny <string>())).Returns("valueofproperty");

            hadoopConfProxy.Setup(m => m.Set(It.IsAny <string>(), It.IsAny <string>()))
            .Callback <string, string>(ValueSetter);

            var hadoopConf = new HadoopConfiguration(hadoopConfProxy.Object);

            var returnValue = hadoopConf.Get("somename", "somedefaultvalue");

            Assert.AreEqual("valueofproperty", returnValue);

            hadoopConf.Set("propertyname", "propertyvalue");

            Assert.AreEqual("propertyname", name);
            Assert.AreEqual("propertyvalue", value);
        }
Exemple #2
0
        private static bool CreateConfigurationDirectory()
        {
            string hadoopHome = Environment.GetEnvironmentVariable("HADOOP_HOME");

            HadoopConfiguration config;

            if (IsSecured)
            {
                config = new HadoopConfiguration(ActiveNameNode, IsSecured, credentials);
                credentials.DomainName = config.GetDomainName(credentials.ActiveDirectoryIp, credentials.Username, credentials.Password);
            }
            else
            {
                config = new HadoopConfiguration(ActiveNameNode);
            }
            if (!config.IsConfigurationExist())
            {
                return(config.GenerateConfigFiles(true));
            }
            else
            {
                return(true);
            }
        }