UserProvider extends AuthorizableBaseProvider { @NotNull Tree createGroup(@NotNull String groupID, @Nullable String intermediateJcrPath) throws RepositoryException { return createAuthorizableNode(groupID, NT_REP_GROUP, intermediateJcrPath); } UserProvider(@NotNull Root root, @NotNull ConfigurationParameters config);   }
@Test public void testCreateGroup() throws RepositoryException { UserProvider up = createUserProvider(); Tree groupTree = up.createGroup("group1", null); assertNotNull(groupTree); assertTrue(Text.isDescendant(defaultGroupPath, groupTree.getPath())); int level = defaultConfig.getConfigValue(UserConstants.PARAM_DEFAULT_DEPTH, UserConstants.DEFAULT_DEPTH) + 1; assertEquals(defaultGroupPath, Text.getRelativeParent(groupTree.getPath(), level)); }
@Test public void testCreateGroupWithPath() throws Exception { UserProvider up = createUserProvider(4); Tree group = up.createGroup("authors", "a/b/c"); assertNotNull(group); assertTrue(Text.isDescendant(customGroupPath, group.getPath())); String groupPath = customGroupPath + "/a/b/c/authors"; assertEquals(groupPath, group.getPath()); }
@Test public void testAutoCreatedItemsUponGroupCreation() throws Exception { UserProvider up = createUserProvider(); assertAutoCreatedItems(up.createGroup("g", null), UserConstants.NT_REP_GROUP, root); }