private Org.Apache.Hadoop.Lib.Server.Server CreateServer(Configuration conf) { return(new Org.Apache.Hadoop.Lib.Server.Server("server", TestDirHelper.GetTestDir ().GetAbsolutePath(), TestDirHelper.GetTestDir().GetAbsolutePath(), TestDirHelper .GetTestDir().GetAbsolutePath(), TestDirHelper.GetTestDir().GetAbsolutePath(), conf )); }
public virtual void IllegalState3() { Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", TestDirHelper.GetTestDir().GetAbsolutePath(), new Configuration(false )); server.SetService(null); }
public virtual void FileSystemCache() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); string services = StringUtils.Join(",", Arrays.AsList(typeof(InstrumentationService ).FullName, typeof(SchedulerService).FullName, typeof(FileSystemAccessService).FullName )); Configuration hadoopConf = new Configuration(false); hadoopConf.Set(CommonConfigurationKeysPublic.FsDefaultNameKey, TestHdfsHelper.GetHdfsConf ().Get(CommonConfigurationKeysPublic.FsDefaultNameKey)); CreateHadoopConf(hadoopConf); Configuration conf = new Configuration(false); conf.Set("server.services", services); conf.Set("server.hadoop.filesystem.cache.purge.frequency", "1"); conf.Set("server.hadoop.filesystem.cache.purge.timeout", "1"); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", dir, dir, dir, dir, conf); try { server.Init(); FileSystemAccess hadoop = server.Get <FileSystemAccess>(); FileSystem fs1 = hadoop.CreateFileSystem("u", hadoop.GetFileSystemConfiguration() ); NUnit.Framework.Assert.IsNotNull(fs1); fs1.Mkdirs(new Path("/tmp/foo1")); hadoop.ReleaseFileSystem(fs1); //still around because of caching fs1.Mkdirs(new Path("/tmp/foo2")); FileSystem fs2 = hadoop.CreateFileSystem("u", hadoop.GetFileSystemConfiguration() ); //should be same instance because of caching NUnit.Framework.Assert.AreEqual(fs1, fs2); Sharpen.Thread.Sleep(4 * 1000); //still around because of lease count is 1 (fs2 is out) fs1.Mkdirs(new Path("/tmp/foo2")); Sharpen.Thread.Sleep(4 * 1000); //still around because of lease count is 1 (fs2 is out) fs2.Mkdirs(new Path("/tmp/foo")); hadoop.ReleaseFileSystem(fs2); Sharpen.Thread.Sleep(4 * 1000); //should not be around as lease count is 0 try { fs2.Mkdirs(new Path("/tmp/foo")); NUnit.Framework.Assert.Fail(); } catch (IOException) { } catch (Exception) { NUnit.Framework.Assert.Fail(); } } finally { server.Destroy(); } }
public virtual void ServiceHadoopConfCustomDir() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); string hadoopConfDir = new FilePath(dir, "confx").GetAbsolutePath(); new FilePath(hadoopConfDir).Mkdirs(); string services = StringUtils.Join(",", Arrays.AsList(typeof(InstrumentationService ).FullName, typeof(SchedulerService).FullName, typeof(FileSystemAccessService).FullName )); Configuration conf = new Configuration(false); conf.Set("server.services", services); conf.Set("server.hadoop.config.dir", hadoopConfDir); FilePath hdfsSite = new FilePath(hadoopConfDir, "hdfs-site.xml"); OutputStream os = new FileOutputStream(hdfsSite); Configuration hadoopConf = new Configuration(false); hadoopConf.Set("foo", "BAR"); hadoopConf.WriteXml(os); os.Close(); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", dir, dir, dir, dir, conf); server.Init(); FileSystemAccessService fsAccess = (FileSystemAccessService)server.Get <FileSystemAccess >(); NUnit.Framework.Assert.AreEqual(fsAccess.serviceHadoopConf.Get("foo"), "BAR"); server.Destroy(); }
/// <summary>Fire up our own hand-rolled MiniDFSCluster.</summary> /// <remarks> /// Fire up our own hand-rolled MiniDFSCluster. We do this here instead /// of relying on TestHdfsHelper because we don't want to turn on XAttr /// support. /// </remarks> /// <exception cref="System.Exception"/> private void StartMiniDFS() { FilePath testDirRoot = TestDirHelper.GetTestDir(); if (Runtime.GetProperty("hadoop.log.dir") == null) { Runtime.SetProperty("hadoop.log.dir", new FilePath(testDirRoot, "hadoop-log").GetAbsolutePath ()); } if (Runtime.GetProperty("test.build.data") == null) { Runtime.SetProperty("test.build.data", new FilePath(testDirRoot, "hadoop-data").GetAbsolutePath ()); } Configuration conf = HadoopUsersConfTestHelper.GetBaseConf(); HadoopUsersConfTestHelper.AddUserConf(conf); conf.Set("fs.hdfs.impl.disable.cache", "true"); conf.Set("dfs.block.access.token.enable", "false"); conf.Set("dfs.permissions", "true"); conf.Set("hadoop.security.authentication", "simple"); // Explicitly turn off XAttr support conf.SetBoolean(DFSConfigKeys.DfsNamenodeXattrsEnabledKey, false); MiniDFSCluster.Builder builder = new MiniDFSCluster.Builder(conf); builder.NumDataNodes(2); miniDfs = builder.Build(); nnConf = miniDfs.GetConfiguration(0); }
/// <summary>Create an HttpFS Server to talk to the MiniDFSCluster we created.</summary> /// <exception cref="System.Exception"/> private void CreateHttpFSServer() { FilePath homeDir = TestDirHelper.GetTestDir(); NUnit.Framework.Assert.IsTrue(new FilePath(homeDir, "conf").Mkdir()); NUnit.Framework.Assert.IsTrue(new FilePath(homeDir, "log").Mkdir()); NUnit.Framework.Assert.IsTrue(new FilePath(homeDir, "temp").Mkdir()); HttpFSServerWebApp.SetHomeDirForCurrentThread(homeDir.GetAbsolutePath()); FilePath secretFile = new FilePath(new FilePath(homeDir, "conf"), "secret"); TextWriter w = new FileWriter(secretFile); w.Write("secret"); w.Close(); // HDFS configuration FilePath hadoopConfDir = new FilePath(new FilePath(homeDir, "conf"), "hadoop-conf" ); if (!hadoopConfDir.Mkdirs()) { throw new IOException(); } string fsDefaultName = nnConf.Get(CommonConfigurationKeysPublic.FsDefaultNameKey); Configuration conf = new Configuration(false); conf.Set(CommonConfigurationKeysPublic.FsDefaultNameKey, fsDefaultName); // Explicitly turn off XAttr support conf.SetBoolean(DFSConfigKeys.DfsNamenodeXattrsEnabledKey, false); FilePath hdfsSite = new FilePath(hadoopConfDir, "hdfs-site.xml"); OutputStream os = new FileOutputStream(hdfsSite); conf.WriteXml(os); os.Close(); // HTTPFS configuration conf = new Configuration(false); conf.Set("httpfs.hadoop.config.dir", hadoopConfDir.ToString()); conf.Set("httpfs.proxyuser." + HadoopUsersConfTestHelper.GetHadoopProxyUser() + ".groups" , HadoopUsersConfTestHelper.GetHadoopProxyUserGroups()); conf.Set("httpfs.proxyuser." + HadoopUsersConfTestHelper.GetHadoopProxyUser() + ".hosts" , HadoopUsersConfTestHelper.GetHadoopProxyUserHosts()); conf.Set("httpfs.authentication.signature.secret.file", secretFile.GetAbsolutePath ()); FilePath httpfsSite = new FilePath(new FilePath(homeDir, "conf"), "httpfs-site.xml" ); os = new FileOutputStream(httpfsSite); conf.WriteXml(os); os.Close(); ClassLoader cl = Sharpen.Thread.CurrentThread().GetContextClassLoader(); Uri url = cl.GetResource("webapp"); if (url == null) { throw new IOException(); } WebAppContext context = new WebAppContext(url.AbsolutePath, "/webhdfs"); Org.Mortbay.Jetty.Server server = TestJettyHelper.GetJettyServer(); server.AddHandler(context); server.Start(); }
public virtual void Sampling() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); string services = StringUtils.Join(",", Arrays.AsList(typeof(InstrumentationService ).FullName, typeof(SchedulerService).FullName)); Configuration conf = new Configuration(false); conf.Set("server.services", services); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", dir, dir, dir, dir, conf); server.Init(); Org.Apache.Hadoop.Lib.Service.Instrumentation instrumentation = server.Get <Org.Apache.Hadoop.Lib.Service.Instrumentation >(); AtomicInteger count = new AtomicInteger(); Instrumentation.Variable <long> varToSample = new _Variable_389(count); instrumentation.AddSampler("g", "s", 10, varToSample); Sleep(2000); int i = count.Get(); NUnit.Framework.Assert.IsTrue(i > 0); IDictionary <string, IDictionary <string, object> > snapshot = instrumentation.GetSnapshot (); IDictionary <string, IDictionary <string, object> > samplers = (IDictionary <string, IDictionary <string, object> >)snapshot["samplers"]; InstrumentationService.Sampler sampler = (InstrumentationService.Sampler)samplers ["g"]["s"]; NUnit.Framework.Assert.IsTrue(sampler.GetRate() > 0); server.Destroy(); }
/// <exception cref="System.Exception"/> private void CreateHadoopConf(Configuration hadoopConf) { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); FilePath hdfsSite = new FilePath(dir, "hdfs-site.xml"); OutputStream os = new FileOutputStream(hdfsSite); hadoopConf.WriteXml(os); os.Close(); }
public virtual void IllegalState4() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", dir, dir, dir, dir, new Configuration(false)); server.Init(); server.Init(); }
public virtual void ServiceNotImplementingServiceInterface() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); Configuration conf = new Configuration(false); conf.Set("server.services", typeof(TestServer.MyService4).FullName); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", dir, dir, dir, dir, conf); server.Init(); }
public virtual void InvalidSservice() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); Configuration conf = new Configuration(false); conf.Set("server.services", "foo"); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", dir, dir, dir, dir, conf); server.Init(); }
public virtual void InitNoHomeDir() { FilePath homeDir = new FilePath(TestDirHelper.GetTestDir(), "home"); Configuration conf = new Configuration(false); conf.Set("server.services", typeof(TestServer.TestService).FullName); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", homeDir.GetAbsolutePath(), conf); server.Init(); }
public virtual void SiteFileNotAFile() { string homeDir = TestDirHelper.GetTestDir().GetAbsolutePath(); FilePath siteFile = new FilePath(homeDir, "server-site.xml"); NUnit.Framework.Assert.IsTrue(siteFile.Mkdir()); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", homeDir, homeDir, homeDir, homeDir); server.Init(); }
public virtual void Server() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); Configuration httpfsConf = new Configuration(false); HttpFSServerWebApp server = new HttpFSServerWebApp(dir, dir, dir, dir, httpfsConf ); server.Init(); server.Destroy(); }
public virtual void ServiceWithNoDefaultConstructor() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); Configuration conf = new Configuration(false); conf.Set("server.services", typeof(TestServer.MyService7).FullName); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", dir, dir, dir, dir, conf); server.Init(); }
public virtual void LoadingDefaultConfig() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("testserver", dir, dir, dir, dir); server.Init(); NUnit.Framework.Assert.AreEqual(server.GetConfig().Get("testserver.a"), "default" ); }
public virtual void InvalidGroupsMapping() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); Configuration conf = new Configuration(false); conf.Set("server.services", StringUtils.Join(",", Arrays.AsList(typeof(GroupsService ).FullName))); conf.Set("server.groups.hadoop.security.group.mapping", typeof(string).FullName); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", dir, dir, dir, dir, conf); server.Init(); }
public virtual void ServiceWithMissingDependency() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); Configuration conf = new Configuration(false); string services = StringUtils.Join(",", Arrays.AsList(typeof(TestServer.MyService3 ).FullName, typeof(TestServer.MyService6).FullName)); conf.Set("server.services", services); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", dir, dir, dir, dir, conf); server.Init(); }
public virtual void ConstructorsGetters() { Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", GetAbsolutePath("/a"), GetAbsolutePath("/b"), GetAbsolutePath("/c"), GetAbsolutePath("/d"), new Configuration(false)); NUnit.Framework.Assert.AreEqual(server.GetHomeDir(), GetAbsolutePath("/a")); NUnit.Framework.Assert.AreEqual(server.GetConfigDir(), GetAbsolutePath("/b")); NUnit.Framework.Assert.AreEqual(server.GetLogDir(), GetAbsolutePath("/c")); NUnit.Framework.Assert.AreEqual(server.GetTempDir(), GetAbsolutePath("/d")); NUnit.Framework.Assert.AreEqual(server.GetName(), "server"); NUnit.Framework.Assert.AreEqual(server.GetPrefix(), "server"); NUnit.Framework.Assert.AreEqual(server.GetPrefixedName("name"), "server.name"); NUnit.Framework.Assert.IsNotNull(server.GetConfig()); server = new Org.Apache.Hadoop.Lib.Server.Server("server", GetAbsolutePath("/a"), GetAbsolutePath("/b"), GetAbsolutePath("/c"), GetAbsolutePath("/d")); NUnit.Framework.Assert.AreEqual(server.GetHomeDir(), GetAbsolutePath("/a")); NUnit.Framework.Assert.AreEqual(server.GetConfigDir(), GetAbsolutePath("/b")); NUnit.Framework.Assert.AreEqual(server.GetLogDir(), GetAbsolutePath("/c")); NUnit.Framework.Assert.AreEqual(server.GetTempDir(), GetAbsolutePath("/d")); NUnit.Framework.Assert.AreEqual(server.GetName(), "server"); NUnit.Framework.Assert.AreEqual(server.GetPrefix(), "server"); NUnit.Framework.Assert.AreEqual(server.GetPrefixedName("name"), "server.name"); NUnit.Framework.Assert.IsNull(server.GetConfig()); server = new Org.Apache.Hadoop.Lib.Server.Server("server", TestDirHelper.GetTestDir ().GetAbsolutePath(), new Configuration(false)); NUnit.Framework.Assert.AreEqual(server.GetHomeDir(), TestDirHelper.GetTestDir().GetAbsolutePath ()); NUnit.Framework.Assert.AreEqual(server.GetConfigDir(), TestDirHelper.GetTestDir() + "/conf"); NUnit.Framework.Assert.AreEqual(server.GetLogDir(), TestDirHelper.GetTestDir() + "/log"); NUnit.Framework.Assert.AreEqual(server.GetTempDir(), TestDirHelper.GetTestDir() + "/temp"); NUnit.Framework.Assert.AreEqual(server.GetName(), "server"); NUnit.Framework.Assert.AreEqual(server.GetPrefix(), "server"); NUnit.Framework.Assert.AreEqual(server.GetPrefixedName("name"), "server.name"); NUnit.Framework.Assert.IsNotNull(server.GetConfig()); server = new Org.Apache.Hadoop.Lib.Server.Server("server", TestDirHelper.GetTestDir ().GetAbsolutePath()); NUnit.Framework.Assert.AreEqual(server.GetHomeDir(), TestDirHelper.GetTestDir().GetAbsolutePath ()); NUnit.Framework.Assert.AreEqual(server.GetConfigDir(), TestDirHelper.GetTestDir() + "/conf"); NUnit.Framework.Assert.AreEqual(server.GetLogDir(), TestDirHelper.GetTestDir() + "/log"); NUnit.Framework.Assert.AreEqual(server.GetTempDir(), TestDirHelper.GetTestDir() + "/temp"); NUnit.Framework.Assert.AreEqual(server.GetName(), "server"); NUnit.Framework.Assert.AreEqual(server.GetPrefix(), "server"); NUnit.Framework.Assert.AreEqual(server.GetPrefixedName("name"), "server.name"); NUnit.Framework.Assert.IsNull(server.GetConfig()); }
public virtual void FailedInit() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); Runtime.SetProperty("TestServerWebApp2.home.dir", dir); Runtime.SetProperty("TestServerWebApp2.config.dir", dir); Runtime.SetProperty("TestServerWebApp2.log.dir", dir); Runtime.SetProperty("TestServerWebApp2.temp.dir", dir); Runtime.SetProperty("testserverwebapp2.services", "FOO"); ServerWebApp server = new _ServerWebApp_75("TestServerWebApp2"); server.ContextInitialized(null); }
public virtual void Log4jFile() { InputStream @is = Org.Apache.Hadoop.Lib.Server.Server.GetResource("default-log4j.properties" ); OutputStream os = new FileOutputStream(new FilePath(TestDirHelper.GetTestDir(), "server-log4j.properties" )); IOUtils.CopyBytes(@is, os, 1024, true); Configuration conf = new Configuration(false); Org.Apache.Hadoop.Lib.Server.Server server = CreateServer(conf); server.Init(); }
public virtual void InvalidSecurity() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); string services = StringUtils.Join(",", Arrays.AsList(typeof(InstrumentationService ).FullName, typeof(SchedulerService).FullName, typeof(FileSystemAccessService).FullName )); Configuration conf = new Configuration(false); conf.Set("server.services", services); conf.Set("server.hadoop.authentication.type", "foo"); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", dir, dir, dir, dir, conf); server.Init(); }
public virtual void Service() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); Configuration conf = new Configuration(false); conf.Set("server.services", StringUtils.Join(",", Arrays.AsList(typeof(InstrumentationService ).FullName, typeof(SchedulerService).FullName))); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", dir, dir, dir, dir, conf); server.Init(); NUnit.Framework.Assert.IsNotNull(server.Get <Org.Apache.Hadoop.Lib.Service.Scheduler >()); server.Destroy(); }
public virtual void FileSystemExecutorException() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); string services = StringUtils.Join(",", Arrays.AsList(typeof(InstrumentationService ).FullName, typeof(SchedulerService).FullName, typeof(FileSystemAccessService).FullName )); Configuration hadoopConf = new Configuration(false); hadoopConf.Set(CommonConfigurationKeysPublic.FsDefaultNameKey, TestHdfsHelper.GetHdfsConf ().Get(CommonConfigurationKeysPublic.FsDefaultNameKey)); CreateHadoopConf(hadoopConf); Configuration conf = new Configuration(false); conf.Set("server.services", services); conf.Set("server.hadoop.filesystem.cache.purge.timeout", "0"); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", dir, dir, dir, dir, conf); server.Init(); FileSystemAccess hadoop = server.Get <FileSystemAccess>(); FileSystem[] fsa = new FileSystem[1]; try { hadoop.Execute("u", hadoop.GetFileSystemConfiguration(), new _FileSystemExecutor_377 (fsa)); NUnit.Framework.Assert.Fail(); } catch (FileSystemAccessException ex) { NUnit.Framework.Assert.AreEqual(ex.GetError(), FileSystemAccessException.ERROR.H03 ); } catch (Exception) { NUnit.Framework.Assert.Fail(); } try { fsa[0].Mkdirs(new Path("/tmp/foo")); NUnit.Framework.Assert.Fail(); } catch (IOException) { } catch (Exception) { NUnit.Framework.Assert.Fail(); } server.Destroy(); }
public virtual void InitNoTempDir() { FilePath homeDir = new FilePath(TestDirHelper.GetTestDir(), "home"); NUnit.Framework.Assert.IsTrue(homeDir.Mkdir()); NUnit.Framework.Assert.IsTrue(new FilePath(homeDir, "conf").Mkdir()); NUnit.Framework.Assert.IsTrue(new FilePath(homeDir, "log").Mkdir()); Configuration conf = new Configuration(false); conf.Set("server.services", typeof(TestServer.TestService).FullName); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", homeDir.GetAbsolutePath(), conf); server.Init(); }
public virtual void LoadingSiteConfig() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); FilePath configFile = new FilePath(dir, "testserver-site.xml"); TextWriter w = new FileWriter(configFile); w.Write("<configuration><property><name>testserver.a</name><value>site</value></property></configuration>" ); w.Close(); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("testserver", dir, dir, dir, dir); server.Init(); NUnit.Framework.Assert.AreEqual(server.GetConfig().Get("testserver.a"), "site"); }
/// <exception cref="System.Exception"/> private void CreateHttpFSServer() { FilePath homeDir = TestDirHelper.GetTestDir(); NUnit.Framework.Assert.IsTrue(new FilePath(homeDir, "conf").Mkdir()); NUnit.Framework.Assert.IsTrue(new FilePath(homeDir, "log").Mkdir()); NUnit.Framework.Assert.IsTrue(new FilePath(homeDir, "temp").Mkdir()); HttpFSServerWebApp.SetHomeDirForCurrentThread(homeDir.GetAbsolutePath()); FilePath secretFile = new FilePath(new FilePath(homeDir, "conf"), "secret"); TextWriter w = new FileWriter(secretFile); w.Write("secret"); w.Close(); //HDFS configuration FilePath hadoopConfDir = new FilePath(new FilePath(homeDir, "conf"), "hadoop-conf" ); hadoopConfDir.Mkdirs(); string fsDefaultName = TestHdfsHelper.GetHdfsConf().Get(CommonConfigurationKeysPublic .FsDefaultNameKey); Configuration conf = new Configuration(false); conf.Set(CommonConfigurationKeysPublic.FsDefaultNameKey, fsDefaultName); FilePath hdfsSite = new FilePath(hadoopConfDir, "hdfs-site.xml"); OutputStream os = new FileOutputStream(hdfsSite); conf.WriteXml(os); os.Close(); conf = new Configuration(false); conf.Set("httpfs.proxyuser.client.hosts", "*"); conf.Set("httpfs.proxyuser.client.groups", "*"); conf.Set("httpfs.authentication.type", "kerberos"); conf.Set("httpfs.authentication.signature.secret.file", secretFile.GetAbsolutePath ()); FilePath httpfsSite = new FilePath(new FilePath(homeDir, "conf"), "httpfs-site.xml" ); os = new FileOutputStream(httpfsSite); conf.WriteXml(os); os.Close(); ClassLoader cl = Sharpen.Thread.CurrentThread().GetContextClassLoader(); Uri url = cl.GetResource("webapp"); WebAppContext context = new WebAppContext(url.AbsolutePath, "/webhdfs"); Org.Mortbay.Jetty.Server server = TestJettyHelper.GetJettyServer(); server.AddHandler(context); server.Start(); HttpFSServerWebApp.Get().SetAuthority(TestJettyHelper.GetAuthority()); }
public virtual void Lifecycle() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); Runtime.SetProperty("TestServerWebApp1.home.dir", dir); Runtime.SetProperty("TestServerWebApp1.config.dir", dir); Runtime.SetProperty("TestServerWebApp1.log.dir", dir); Runtime.SetProperty("TestServerWebApp1.temp.dir", dir); ServerWebApp server = new _ServerWebApp_56("TestServerWebApp1"); NUnit.Framework.Assert.AreEqual(server.GetStatus(), Server.Status.Undef); server.ContextInitialized(null); NUnit.Framework.Assert.AreEqual(server.GetStatus(), Server.Status.Normal); server.ContextDestroyed(null); NUnit.Framework.Assert.AreEqual(server.GetStatus(), Server.Status.Shutdown); }
public virtual void TestResolveAuthority() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); Runtime.SetProperty("TestServerWebApp3.home.dir", dir); Runtime.SetProperty("TestServerWebApp3.config.dir", dir); Runtime.SetProperty("TestServerWebApp3.log.dir", dir); Runtime.SetProperty("TestServerWebApp3.temp.dir", dir); Runtime.SetProperty("testserverwebapp3.http.hostname", "localhost"); Runtime.SetProperty("testserverwebapp3.http.port", "14000"); ServerWebApp server = new _ServerWebApp_91("TestServerWebApp3"); IPEndPoint address = server.ResolveAuthority(); NUnit.Framework.Assert.AreEqual("localhost", address.GetHostName()); NUnit.Framework.Assert.AreEqual(14000, address.Port); }
public virtual void KerberosInitializationFailure() { string dir = TestDirHelper.GetTestDir().GetAbsolutePath(); string services = StringUtils.Join(",", Arrays.AsList(typeof(InstrumentationService ).FullName, typeof(SchedulerService).FullName, typeof(FileSystemAccessService).FullName )); Configuration conf = new Configuration(false); conf.Set("server.services", services); conf.Set("server.hadoop.authentication.type", "kerberos"); conf.Set("server.hadoop.authentication.kerberos.keytab", "/tmp/foo"); conf.Set("server.hadoop.authentication.kerberos.principal", "foo@FOO"); Org.Apache.Hadoop.Lib.Server.Server server = new Org.Apache.Hadoop.Lib.Server.Server ("server", dir, dir, dir, dir, conf); server.Init(); }