예제 #1
0
  /**
   * Get the {@link NodeDefinition} for the root node.
   *
   * @return the definition; never null
   * @throws RepositoryException
   * @throws NoSuchNodeTypeException
   */
  JcrNodeDefinition getRootNodeDefinition() throws NoSuchNodeTypeException, RepositoryException {
    NodeTypes nodeTypes = nodeTypes();
    for (NodeDefinition definition :
        nodeTypes.getNodeType(ModeShapeLexicon.ROOT).getChildNodeDefinitions()) {
      if (definition.getName().equals(JcrNodeType.RESIDUAL_ITEM_NAME))
        return (JcrNodeDefinition) definition;
    }

    assert false; // should not get here
    return null;
  }
예제 #2
0
 @Test
 public void shouldReadNodeTypeDefinitionsFromSystemCatalog() {
   NodeTypes nodeTypes = repository.nodeTypeManager().getNodeTypes();
   Set<Name> builtInNodeTypes = new HashSet<Name>(nodeTypes.getAllNodeTypeNames());
   for (NodeTypeDefinition type : system.readAllNodeTypes()) {
     Name name = name(type.getName());
     JcrNodeType actual = nodeTypes.getNodeType(name);
     assertThat(
         "Did not find actual node type for name \"" + type.getName() + "\"",
         actual,
         is(notNullValue()));
     assertThat(builtInNodeTypes.remove(name), is(true));
   }
   assertThat(builtInNodeTypes.isEmpty(), is(true));
 }