Exemplo n.º 1
0
        public virtual void TestRefreshSuperUserGroupsWithFileSystemBasedConfigurationProvider
            ()
        {
            configuration.Set(YarnConfiguration.RmConfigurationProviderClass, "org.apache.hadoop.yarn.FileSystemBasedConfigurationProvider"
                              );
            //upload default configurations
            UploadDefaultConfiguration();
            try
            {
                rm = new MockRM(configuration);
                rm.Init(configuration);
                rm.Start();
            }
            catch (Exception)
            {
                NUnit.Framework.Assert.Fail("Should not get any exceptions");
            }
            Configuration coreConf = new Configuration(false);

            coreConf.Set("hadoop.proxyuser.test.groups", "test_groups");
            coreConf.Set("hadoop.proxyuser.test.hosts", "test_hosts");
            UploadConfiguration(coreConf, "core-site.xml");
            rm.adminService.RefreshSuperUserGroupsConfiguration(RefreshSuperUserGroupsConfigurationRequest
                                                                .NewInstance());
            NUnit.Framework.Assert.IsTrue(ProxyUsers.GetDefaultImpersonationProvider().GetProxyGroups
                                              ()["hadoop.proxyuser.test.groups"].Count == 1);
            NUnit.Framework.Assert.IsTrue(ProxyUsers.GetDefaultImpersonationProvider().GetProxyGroups
                                              ()["hadoop.proxyuser.test.groups"].Contains("test_groups"));
            NUnit.Framework.Assert.IsTrue(ProxyUsers.GetDefaultImpersonationProvider().GetProxyHosts
                                              ()["hadoop.proxyuser.test.hosts"].Count == 1);
            NUnit.Framework.Assert.IsTrue(ProxyUsers.GetDefaultImpersonationProvider().GetProxyHosts
                                              ()["hadoop.proxyuser.test.hosts"].Contains("test_hosts"));
            Configuration yarnConf = new Configuration(false);

            yarnConf.Set("yarn.resourcemanager.proxyuser.test.groups", "test_groups_1");
            yarnConf.Set("yarn.resourcemanager.proxyuser.test.hosts", "test_hosts_1");
            UploadConfiguration(yarnConf, "yarn-site.xml");
            // RM specific configs will overwrite the common ones
            rm.adminService.RefreshSuperUserGroupsConfiguration(RefreshSuperUserGroupsConfigurationRequest
                                                                .NewInstance());
            NUnit.Framework.Assert.IsTrue(ProxyUsers.GetDefaultImpersonationProvider().GetProxyGroups
                                              ()["hadoop.proxyuser.test.groups"].Count == 1);
            NUnit.Framework.Assert.IsTrue(ProxyUsers.GetDefaultImpersonationProvider().GetProxyGroups
                                              ()["hadoop.proxyuser.test.groups"].Contains("test_groups_1"));
            NUnit.Framework.Assert.IsTrue(ProxyUsers.GetDefaultImpersonationProvider().GetProxyHosts
                                              ()["hadoop.proxyuser.test.hosts"].Count == 1);
            NUnit.Framework.Assert.IsTrue(ProxyUsers.GetDefaultImpersonationProvider().GetProxyHosts
                                              ()["hadoop.proxyuser.test.hosts"].Contains("test_hosts_1"));
        }
Exemplo n.º 2
0
 public virtual void TestRefreshSuperUserGroupsWithLocalConfigurationProvider()
 {
     rm = new MockRM(configuration);
     rm.Init(configuration);
     rm.Start();
     try
     {
         rm.adminService.RefreshSuperUserGroupsConfiguration(RefreshSuperUserGroupsConfigurationRequest
                                                             .NewInstance());
     }
     catch (Exception)
     {
         NUnit.Framework.Assert.Fail("Using localConfigurationProvider. Should not get any exception."
                                     );
     }
 }
Exemplo n.º 3
0
 /// <exception cref="Org.Apache.Hadoop.HA.ServiceFailedException"/>
 private void RefreshAll()
 {
     try
     {
         RefreshQueues(RefreshQueuesRequest.NewInstance());
         RefreshNodes(RefreshNodesRequest.NewInstance());
         RefreshSuperUserGroupsConfiguration(RefreshSuperUserGroupsConfigurationRequest.NewInstance
                                                 ());
         RefreshUserToGroupsMappings(RefreshUserToGroupsMappingsRequest.NewInstance());
         if (GetConfig().GetBoolean(CommonConfigurationKeysPublic.HadoopSecurityAuthorization
                                    , false))
         {
             RefreshServiceAcls(RefreshServiceAclsRequest.NewInstance());
         }
     }
     catch (Exception ex)
     {
         throw new ServiceFailedException(ex.Message);
     }
 }