EndzeitBegins commented on code in PR #9868:
URL: https://github.com/apache/nifi/pull/9868#discussion_r2205436915


##########
nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/test/java/org/apache/nifi/authorization/FileUserGroupProviderTest.java:
##########
@@ -196,6 +229,27 @@ public void 
testOnConfiguredWhenTenantsExistAndInitialUsersProvided() throws Exc
         assertTrue(users.contains(new 
User.Builder().identifier("user-2").identity("user-2").build()));
     }
 
+    @Test
+    public void testOnConfiguredWhenTenantsExistAndInitialGroupsProvided() 
throws Exception {
+        final String adminGroupIdentity = "admin-group";
+        final String otherGroupIdentity = "other-group";
+
+        // despite setting initial groups, they will not be loaded as the 
tenants file is non-empty
+        
when(configurationContext.getProperty(eq(FileUserGroupProvider.PROP_INITIAL_GROUP_IDENTITY_PREFIX
 + "1")))
+                .thenReturn(new StandardPropertyValue(adminGroupIdentity, 
null, ParameterLookup.EMPTY));
+        
when(configurationContext.getProperty(eq(FileUserGroupProvider.PROP_INITIAL_GROUP_IDENTITY_PREFIX
 + "2")))
+                .thenReturn(new StandardPropertyValue(otherGroupIdentity, 
null, ParameterLookup.EMPTY));
+
+        writeFile(primaryTenants, SIMPLE_TENANTS_BY_USER);
+        userGroupProvider.onConfigured(configurationContext);
+
+        final Set<User> users = userGroupProvider.getUsers();
+        assertEquals(2, users.size());

Review Comment:
   Good catch, you're absolutely right. I adjusted the test. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to