public virtual void TestProxyServer() { Configuration conf = new Configuration(); NUnit.Framework.Assert.IsFalse(ProxyServers.IsProxyServer("1.1.1.1")); conf.Set(ProxyServers.ConfHadoopProxyservers, "2.2.2.2, 3.3.3.3"); ProxyUsers.RefreshSuperUserGroupsConfiguration(conf); NUnit.Framework.Assert.IsFalse(ProxyServers.IsProxyServer("1.1.1.1")); Assert.True(ProxyServers.IsProxyServer("2.2.2.2")); Assert.True(ProxyServers.IsProxyServer("3.3.3.3")); }
/// <summary> /// Refreshes configuration using the specified Proxy user prefix for /// properties. /// </summary> /// <param name="conf">configuration</param> /// <param name="proxyUserPrefix">proxy user configuration prefix</param> public static void RefreshSuperUserGroupsConfiguration(Configuration conf, string proxyUserPrefix) { Preconditions.CheckArgument(proxyUserPrefix != null && !proxyUserPrefix.IsEmpty() , "prefix cannot be NULL or empty"); // sip is volatile. Any assignment to it as well as the object's state // will be visible to all the other threads. ImpersonationProvider ip = GetInstance(conf); ip.Init(proxyUserPrefix); sip = ip; ProxyServers.Refresh(conf); }