UserValidator extends DefaultValidator implements UserConstants { @Override public Validator childNodeAdded(String name, NodeState after) throws CommitFailedException { Tree tree = checkNotNull(parentAfter.getChild(name)); validateAuthorizable(tree, UserUtil.getType(tree)); return newValidator(null, tree, provider); } UserValidator(Tree parentBefore, Tree parentAfter, UserValidatorProvider provider); @Override void propertyAdded(PropertyState after); @Override void propertyChanged(PropertyState before, PropertyState after); @Override void propertyDeleted(PropertyState before); @Override Validator childNodeAdded(String name, NodeState after); @Override Validator childNodeChanged(String name, NodeState before, NodeState after); @Override Validator childNodeDeleted(String name, NodeState before);  }
@Test(expected = CommitFailedException.class) public void createWithoutPrincipalName2() throws Exception { Tree userTree = root.getTree(userPath); userTree.removeProperty(REP_PRINCIPAL_NAME); NodeState userState = getTreeProvider().asNodeState(userTree); try { Tree tree = root.getTree(userPath).getParent(); createUserValidator(tree, tree).childNodeAdded(userTree.getName(), userState); } catch (CommitFailedException e) { assertEquals(26, e.getCode()); throw e; } }
@Test public void hiddenNodeAdded() throws CommitFailedException { UserValidatorProvider provider = createValidatorProvider(); MemoryNodeStore store = new MemoryNodeStore(); NodeState root = store.getRoot(); NodeBuilder builder = root.builder(); NodeBuilder test = builder.child("test"); NodeBuilder hidden = test.child(":hidden"); Validator validator = provider.getRootValidator( root, builder.getNodeState(), CommitInfo.EMPTY); Validator childValidator = validator.childNodeAdded( "test", test.getNodeState()); assertNotNull(childValidator); Validator hiddenValidator = childValidator.childNodeAdded( ":hidden", hidden.getNodeState()); assertNull(hiddenValidator); }