@Test public void testCreateWithCollidingFolder() throws Exception { Tree ut = mock(Tree.class); Tree t = mock(Tree.class); when(t.getParent()).thenReturn(t); when(t.exists()).thenReturn(true); when(t.isRoot()).thenReturn(true); when(t.hasChild("uid")).thenReturn(true, false); when(t.addChild("uid")).thenReturn(ut); when(t.getChild(anyString())).thenReturn(t); when(t.getPath()).thenReturn(UserConstants.DEFAULT_USER_PATH); when(t.getProperty(JCR_PRIMARYTYPE)).thenReturn(PropertyStates.createProperty(JCR_PRIMARYTYPE, NT_REP_AUTHORIZABLE_FOLDER, Type.NAME)); Root r = when(mock(Root.class).getTree(anyString())).thenReturn(t).getMock(); when(r.getContentSession()).thenReturn(root.getContentSession()); UserProvider up = new UserProvider(r, ConfigurationParameters.EMPTY); Tree tree = up.createUser("uid", null); assertSame(ut, tree); }
@NotNull Tree createUser(@NotNull String userID, @Nullable String intermediateJcrPath) throws RepositoryException { return createAuthorizableNode(userID, NT_REP_USER, intermediateJcrPath); }
UserProvider extends AuthorizableBaseProvider { @NotNull Tree createUser(@NotNull String userID, @Nullable String intermediateJcrPath) throws RepositoryException { return createAuthorizableNode(userID, NT_REP_USER, intermediateJcrPath); } }
UserProvider extends AuthorizableBaseProvider { @NotNull Tree createUser(@NotNull String userID, @Nullable String intermediateJcrPath) throws RepositoryException { return createAuthorizableNode(userID, NT_REP_USER, intermediateJcrPath); } UserProvider(@NotNull Root root, @NotNull ConfigurationParameters config); }
UserProvider extends AuthorizableBaseProvider { @NotNull Tree createUser(@NotNull String userID, @Nullable String intermediateJcrPath) throws RepositoryException { return createAuthorizableNode(userID, NT_REP_USER, intermediateJcrPath); } UserProvider(@NotNull Root root, @NotNull ConfigurationParameters config);  }
UserProvider extends AuthorizableBaseProvider { @NotNull Tree createUser(@NotNull String userID, @Nullable String intermediateJcrPath) throws RepositoryException { return createAuthorizableNode(userID, NT_REP_USER, intermediateJcrPath); } UserProvider(@NotNull Root root, @NotNull ConfigurationParameters config);   }