ChangeCollectorProvider extends ValidatorProvider { protected int getMaxItems() { return this.maxItems; }   static final String TYPE; static final String COMMIT_CONTEXT_OBSERVATION_CHANGESET; }
@Test public void testPathNotOverflown() throws Exception { Root root = session.getLatestRoot(); Tree rootTree = root.getTree("/test"); Set<String> expectedParentPaths = Sets.newHashSet(); expectedParentPaths.add("/test"); Set<String> expectedParentNodeNames = Sets.newHashSet(); expectedParentNodeNames.add("test"); Set<String> expectedParentNodeTypes = Sets.newHashSet(); expectedParentNodeTypes.add("test:parentType"); for (int i = 0; i < collectorProvider.getMaxItems() - 1; i++) { Tree aChild = rootTree.addChild("manychildren" + i); aChild.setProperty("aProperty", "foo"); aChild.setProperty(JcrConstants.JCR_PRIMARYTYPE, "aChildPrimaryType" + i, Type.NAME); expectedParentPaths.add("/test/manychildren" + i); expectedParentNodeNames.add("manychildren" + i); expectedParentNodeTypes.add("aChildPrimaryType" + i); } root.commit(); ChangeSet changeSet = getSingleChangeSet(); assertMatches("parentPaths", changeSet.getParentPaths(), expectedParentPaths.toArray(new String[0])); assertMatches("parentNodeNames", changeSet.getParentNodeNames(), expectedParentNodeNames.toArray(new String[0])); assertMatches("parentNodeTypes", changeSet.getParentNodeTypes(), expectedParentNodeTypes.toArray(new String[0])); assertMatches("allNodeTypes", changeSet.getAllNodeTypes(), expectedParentNodeTypes.toArray(new String[0])); assertMatches("propertyNames", changeSet.getPropertyNames(), JcrConstants.JCR_PRIMARYTYPE, "aProperty"); }
@Test public void testPropertyNotOverflown() throws Exception { Root root = session.getLatestRoot(); Tree rootTree = root.getTree("/test"); Tree child1 = rootTree.getChild("child1"); Set<String> expectedPropertyNames = Sets.newHashSet(); for (int i = 0; i < collectorProvider.getMaxItems(); i++) { child1.setProperty("aProperty" + i, "foo"); expectedPropertyNames.add("aProperty" + i); } root.commit(); ChangeSet changeSet = getSingleChangeSet(); assertMatches("parentPaths", changeSet.getParentPaths(), "/test/child1"); assertMatches("parentNodeNames", changeSet.getParentNodeNames(), "child1"); assertMatches("parentNodeTypes", changeSet.getParentNodeTypes(), "test:childType"); assertMatches("allNodeTypes", changeSet.getAllNodeTypes(), "test:parentType", "test:childType"); assertMatches("propertyNames", changeSet.getPropertyNames(), expectedPropertyNames.toArray(new String[0])); }