use of javax.jcr.nodetype.NodeType in project jackrabbit by apache.
the class CanAddChildNodeCallWithoutNodeTypeTest method testResidualWithDefault.
/**
* Tests if <code>NodeType.canAddChildNode(String childNodeName)</code> returns
* true if <code>NodeType</code> contains a residual <code>NodeDef</code>
* with a default primary type.
*/
public void testResidualWithDefault() throws NotExecutableException, RepositoryException {
NodeDefinition nodeDef = NodeTypeUtil.locateChildNodeDef(session, true, true, true);
if (nodeDef == null) {
throw new NotExecutableException("No residual child node def " + "without a defaultPrimaryType found.");
}
NodeType nodeType = nodeDef.getDeclaringNodeType();
String undefinedName = NodeTypeUtil.getUndefinedChildNodeName(nodeType);
assertTrue("NodeType.canAddChildNode(String childNodeName) must return " + "true for a not defined childNodeName if NodeType has a residual child node " + "definition with a defaultPrimaryType", nodeType.canAddChildNode(undefinedName));
}
use of javax.jcr.nodetype.NodeType in project jackrabbit by apache.
the class CanAddChildNodeCallWithoutNodeTypeTest method testResidualWithoutDefault.
/**
* Tests if <code>NodeType.canAddChildNode(String childNodeName)</code> returns
* true if <code>NodeType</code> contains a residual <code>NodeDef</code>
* without a default primary type.
*/
public void testResidualWithoutDefault() throws NotExecutableException, RepositoryException {
NodeDefinition nodeDef = NodeTypeUtil.locateChildNodeDef(session, true, false, true);
if (nodeDef == null) {
throw new NotExecutableException("No residual child node def " + "with a defaultPrimaryType found.");
}
NodeType nodeType = nodeDef.getDeclaringNodeType();
String undefinedName = NodeTypeUtil.getUndefinedChildNodeName(nodeType);
assertFalse("NodeType.canAddChildNode(String childNodeName) must return " + "false for a not defiend childNodeName if NodeType has a " + "residual child node definition without a defaultPrimaryType", nodeType.canAddChildNode(undefinedName));
}
use of javax.jcr.nodetype.NodeType in project jackrabbit by apache.
the class CanAddChildNodeCallWithoutNodeTypeTest method testDefinedWithoutDefault.
/**
* Tests if <code>NodeType.canAddChildNode(String childNodeName)</code> returns
* true if <code>NodeType</code> contains a <code>NodeDef</code> named
* <code>childNodeName</code> without a default primary type.
*/
public void testDefinedWithoutDefault() throws NotExecutableException, RepositoryException {
NodeDefinition nodeDef = NodeTypeUtil.locateChildNodeDef(session, true, false, false);
if (nodeDef == null) {
throw new NotExecutableException("No child node def without " + "defaultPrimaryType found");
}
NodeType nodeType = nodeDef.getDeclaringNodeType();
assertFalse("NodeType.canAddChildNode(String childNodeName) must return false " + "if child node def 'childNodeName' does not define a defaultPrimaryType.", nodeType.canAddChildNode(nodeDef.getName()));
}
use of javax.jcr.nodetype.NodeType in project jackrabbit by apache.
the class CanRemoveItemTest method testRemovableProperty.
/**
* Tests that {@link NodeType#canRemoveItem(String)} and
* {@link NodeType#canRemoveProperty(String)} return true
* if the specified property is not a protected nor a mandatory
* property.
*/
public void testRemovableProperty() throws NotExecutableException, RepositoryException {
PropertyDefinition propDef = NodeTypeUtil.locatePropertyDef(session, false, false);
if (propDef == null) {
throw new NotExecutableException("No mandatory property def found.");
}
NodeType type = propDef.getDeclaringNodeType();
assertTrue("NodeType.canRemoveItem(String itemName) must return true " + "if itemName is not a protected nor a mandatory property def.", type.canRemoveItem(propDef.getName()));
assertTrue("NodeType.canRemoveProperty(String propertyName) must return true " + "if propertyName is not a protected nor a mandatory property def.", type.canRemoveProperty(propDef.getName()));
}
use of javax.jcr.nodetype.NodeType in project jackrabbit by apache.
the class CanRemoveItemTest method testRemovableChildNode.
/**
* Tests if {@link NodeType#canRemoveItem(String)} and
* {@link NodeType#canRemoveNode(String)} return true
* if the specified node is not a protected nor a mandatory
* child node.
*/
public void testRemovableChildNode() throws NotExecutableException, RepositoryException {
NodeDefinition nodeDef = NodeTypeUtil.locateChildNodeDef(session, false, false);
if (nodeDef == null) {
throw new NotExecutableException("No mandatory property def found.");
}
NodeType type = nodeDef.getDeclaringNodeType();
assertTrue("NodeType.canRemoveItem(String itemName) must return true " + "if itemName is not a protected nor a mandatory child node def.", type.canRemoveItem(nodeDef.getName()));
assertTrue("NodeType.canRemoveNode(String nodeName) must return true " + "if nodeName is not a protected nor a mandatory child node def.", type.canRemoveNode(nodeDef.getName()));
}
Aggregations