diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestRefreshUserMappings.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestRefreshUserMappings.java index c76033c4a5..ee20a9556a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestRefreshUserMappings.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestRefreshUserMappings.java @@ -151,9 +151,13 @@ public void testGroupMappingRefresh() throws Exception { @Test public void testRefreshSuperUserGroupsConfiguration() throws Exception { final String SUPER_USER = "super_user"; - final String [] GROUP_NAMES1 = new String [] {"gr1" , "gr2"}; - final String [] GROUP_NAMES2 = new String [] {"gr3" , "gr4"}; - + final List groupNames1 = new ArrayList<>(); + groupNames1.add("gr1"); + groupNames1.add("gr2"); + final List groupNames2 = new ArrayList<>(); + groupNames2.add("gr3"); + groupNames2.add("gr4"); + //keys in conf String userKeyGroups = DefaultImpersonationProvider.getTestProvider(). getProxySuperuserGroupConfKey(SUPER_USER); @@ -178,12 +182,12 @@ public void testRefreshSuperUserGroupsConfiguration() throws Exception { when(ugi1.getUserName()).thenReturn("userL1"); when(ugi2.getUserName()).thenReturn("userL2"); - + // set groups for users - when(ugi1.getGroupNames()).thenReturn(GROUP_NAMES1); - when(ugi2.getGroupNames()).thenReturn(GROUP_NAMES2); - - + when(ugi1.getGroups()).thenReturn(groupNames1); + when(ugi2.getGroups()).thenReturn(groupNames2); + + // check before try { ProxyUsers.authorize(ugi1, "127.0.0.1");