/** * Get the number of properties of the node * * @return number of properties of the node */ public long getPropertyCount() throws InvalidItemStateException { return getTree().getPropertyCount(); }
/** * Get the number of properties of the node * * @return number of properties of the node */ public long getPropertyCount() throws InvalidItemStateException { return getTree().getPropertyCount(); }
/** * Get the number of properties of the node * * @return number of properties of the node */ public long getPropertyCount() throws InvalidItemStateException { return getTree().getPropertyCount(); }
@Test public void getPropertyCount() { Tree tree = root.getTree("/"); assertEquals(3, tree.getPropertyCount()); tree.setProperty("a", "foo"); assertEquals(3, tree.getPropertyCount()); tree.removeProperty("a"); assertEquals(2, tree.getPropertyCount()); tree.setProperty("x", "foo"); assertEquals(3, tree.getPropertyCount()); tree.setProperty("a", "foo"); assertEquals(4, tree.getPropertyCount()); }
@Test public void testGetPropertyCount() { Tree a = root.getTree("/a"); assertEquals(2, a.getPropertyCount()); }
@Test public void testGetPropertyCount() { Tree a = root.getTree("/a"); assertEquals(2, a.getPropertyCount()); }
private String chooseProperty(String parentPath) { Tree state = root1.getTree(parentPath); int k = random.nextInt((int) (state.getPropertyCount() + 1)); int c = 0; for (PropertyState entry : state.getProperties()) { if (c++ == k) { return PathUtils.concat(parentPath, entry.getName()); } } return null; }
@Test public void getProperties() { Tree tree = root.getTree("/"); Set<PropertyState> expectedProperties = Sets.newHashSet( LongPropertyState.createLongProperty("a", 1L), LongPropertyState.createLongProperty("b", 2L), LongPropertyState.createLongProperty("c", 3L)); Iterable<? extends PropertyState> properties = tree.getProperties(); for (PropertyState property : properties) { assertTrue(expectedProperties.remove(property)); } assertTrue(expectedProperties.isEmpty()); assertEquals(3, tree.getPropertyCount()); }
@Test public void testGetPropertyCount() throws Exception { setupPermission("/a", testPrincipal, false, PrivilegeConstants.REP_READ_PROPERTIES); testRoot.refresh(); Tree a = testRoot.getTree("/a"); assertEquals(0, a.getPropertyCount()); }
private static void checkEqual(Tree tree1, Tree tree2) { assertEquals(tree1.getChildrenCount(Long.MAX_VALUE), tree2.getChildrenCount(Long.MAX_VALUE)); assertEquals(tree1.getPropertyCount(), tree2.getPropertyCount()); for (PropertyState property1 : tree1.getProperties()) { assertEquals(property1, tree2.getProperty(property1.getName())); } for (Tree child1 : tree1.getChildren()) { checkEqual(child1, tree2.getChild(child1.getName())); } } }
private static void checkEqual(Tree tree1, Tree tree2) { String message = tree1.getPath() + "!=" + tree2.getPath() + " (seed " + SEED + ')'; assertEquals(message, tree1.getPath(), tree2.getPath()); assertEquals(message, tree1.getChildrenCount(Long.MAX_VALUE), tree2.getChildrenCount(Long.MAX_VALUE)); assertEquals(message, tree1.getPropertyCount(), tree2.getPropertyCount()); for (PropertyState property1 : tree1.getProperties()) { PropertyState property2 = tree2.getProperty(property1.getName()); assertEquals(message, property1, property2); } for (Tree child1 : tree1.getChildren()) { checkEqual(child1, tree2.getChild(child1.getName())); } }
assertEquals("must not have any properties", 0, t.getPropertyCount()); } finally { s.close();