コード例 #1
0
  @FixFor("MODE-826")
  @Test
  public void
      shouldAllowRegisteringNodeTypeWithPrimaryItemNameAndOnlyNonResidualChildNodeDefinition()
          throws Exception {
    ntTemplate.setName(TEST_TYPE_NAME);
    // Set the primary item name to be a name that DOES match the child node definition ...
    ntTemplate.setPrimaryItemName(TEST_CHILD_NODE_NAME);

    // Create the residual child node definition ...
    JcrNodeDefinitionTemplate childNode = new JcrNodeDefinitionTemplate(this.context);
    childNode.setDefaultPrimaryTypeName(TEST_TYPE_NAME2);
    childNode.setName(TEST_CHILD_NODE_NAME);
    ntTemplate.getNodeDefinitionTemplates().add(childNode);

    // And register it ...
    repoTypeManager.registerNodeTypes(Arrays.asList(new NodeTypeDefinition[] {ntTemplate}));
  }
コード例 #2
0
  @FixFor("MODE-826")
  @Test
  public void
      shouldAllowRegisteringNodeTypeWithPrimaryItemNameAndOnlyNonResidualPropertyNodeDefinition()
          throws Exception {
    ntTemplate.setName(TEST_TYPE_NAME);
    // Set the primary item name to be a name that DOES match the property definition ...
    ntTemplate.setPrimaryItemName(TEST_PROPERTY_NAME);

    // Create the residual property definition ...
    JcrPropertyDefinitionTemplate propertyDefn = new JcrPropertyDefinitionTemplate(this.context);
    propertyDefn.setRequiredType(PropertyType.STRING);
    propertyDefn.setName(TEST_PROPERTY_NAME);
    ntTemplate.getPropertyDefinitionTemplates().add(propertyDefn);

    // And register it ...
    repoTypeManager.registerNodeTypes(Arrays.asList(new NodeTypeDefinition[] {ntTemplate}));
  }