org.apache.jackrabbit.oak.api.Tree.getPropertyCount()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中org.apache.jackrabbit.oak.api.Tree.getPropertyCount()方法的一些代码示例,展示了Tree.getPropertyCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.getPropertyCount()方法的具体详情如下:
包路径:org.apache.jackrabbit.oak.api.Tree
类名称:Tree
方法名:getPropertyCount

Tree.getPropertyCount介绍

[英]Determine the number of properties accessible to the current content session.
[中]确定当前内容会话可访问的属性数。

代码示例

代码示例来源:origin: apache/jackrabbit-oak

/**
 * Get the number of properties of the node
 *
 * @return number of properties of the node
 */
public long getPropertyCount() throws InvalidItemStateException {
  return getTree().getPropertyCount();
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * Get the number of properties of the node
 *
 * @return number of properties of the node
 */
public long getPropertyCount() throws InvalidItemStateException {
  return getTree().getPropertyCount();
}

代码示例来源:origin: org.apache.jackrabbit/oak-jcr

/**
 * Get the number of properties of the node
 *
 * @return number of properties of the node
 */
public long getPropertyCount() throws InvalidItemStateException {
  return getTree().getPropertyCount();
}

代码示例来源:origin: apache/jackrabbit-oak

@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());
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testGetPropertyCount() {
  Tree a = root.getTree("/a");
  assertEquals(2, a.getPropertyCount());
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void testGetPropertyCount() {
  Tree a = root.getTree("/a");
  assertEquals(2, a.getPropertyCount());
}

代码示例来源:origin: apache/jackrabbit-oak

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;
}

代码示例来源:origin: apache/jackrabbit-oak

@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());
}

代码示例来源:origin: apache/jackrabbit-oak

@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());
}

代码示例来源:origin: apache/jackrabbit-oak

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()));
    }
  }
}

代码示例来源:origin: apache/jackrabbit-oak

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()));
  }
}

代码示例来源:origin: apache/jackrabbit-oak

assertEquals("must not have any properties", 0, t.getPropertyCount());
} finally {
  s.close();

相关文章