Refine search
PropertyDefinitionId(PropertyDefinition def) { declaringNodeType = def.getDeclaringNodeType().getName(); name = def.getName(); definesResidual = "*".equals(def.getName()); }
PropertyDefinitionId(PropertyDefinition def) { declaringNodeType = def.getDeclaringNodeType().getName(); name = def.getName(); definesResidual = "*".equals(def.getName()); }
PropertyDefinitionId(PropertyDefinition def) { declaringNodeType = def.getDeclaringNodeType().getName(); name = def.getName(); definesResidual = "*".equals(def.getName()); }
/** * Tests if canSetProperty(String propertyName, Value value) where value is * null returns the same as canRemoveItem */ public void testValueNull() throws NotExecutableException, RepositoryException { PropertyDefinition propDef = NodeTypeUtil.locatePropertyDef(session, NodeTypeUtil.ANY_PROPERTY_TYPE, false, false, false, false); if (propDef == null) { throw new NotExecutableException("No not protected property def found."); } NodeType nodeType = propDef.getDeclaringNodeType(); assertEquals("nodeType.canSetProperty(String propertyName, Value value) " + "where value is null must return the same result as " + "nodeType.canRemoveItem(String propertyName).", nodeType.canRemoveItem(propDef.getName()), nodeType.canSetProperty(propDef.getName(), (Value) null)); }
/** * Tests if canSetProperty(String propertyName, Value[] values) where values * is null returns the same as canRemoveItem */ public void testMultipleValuesNull() throws NotExecutableException, RepositoryException { PropertyDefinition propDef = NodeTypeUtil.locatePropertyDef(session, NodeTypeUtil.ANY_PROPERTY_TYPE, true, false, false, false); if (propDef == null) { throw new NotExecutableException("No not protected, multiple property def found"); } NodeType nodeType = propDef.getDeclaringNodeType(); assertEquals("nodeType.canSetProperty(String propertyName, Value[] values) " + "where values is null must return the same result as " + "nodeType.canRemoveItem(String propertyName)", nodeType.canRemoveItem(propDef.getName()), nodeType.canSetProperty(propDef.getName(), (Value[]) null)); }
private void setUpNodeWithUndefinedProperty(boolean multiple) throws NotExecutableException { try { // locate a property definition of type undefined PropertyDefinition propDef = NodeTypeUtil.locatePropertyDef(superuser, PropertyType.UNDEFINED, multiple, false, false, false); if (propDef == null) { throw new NotExecutableException("No testable property of type " + "UNDEFINED has been found."); } // create a node of type propDef.getDeclaringNodeType() String nodeType = propDef.getDeclaringNodeType().getName(); testNode = testRootNode.addNode(nodeName1, nodeType); testPropName = propDef.getName(); } catch (RepositoryException e) { throw new NotExecutableException("Not able to set up test items."); } }
/** * 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())); }
/** * Tests if {@link NodeType#canRemoveItem(String)} and * {@link NodeType#canRemoveProperty(String)} return false * if the specified property is a protected property. */ public void testProtectedProperty() throws NotExecutableException, RepositoryException { PropertyDefinition propDef = NodeTypeUtil.locatePropertyDef(session, true, false); if (propDef == null) { throw new NotExecutableException("No protected property def found."); } NodeType type = propDef.getDeclaringNodeType(); assertFalse("NodeType.canRemoveItem(String itemName) must return false " + "if itemName is a protected property def.", type.canRemoveItem(propDef.getName())); assertFalse("NodeType.canRemoveProperty(String propertyName) must return false " + "if propertyName is a protected property def.", type.canRemoveProperty(propDef.getName())); }
/** * Tests if {@link NodeType#canRemoveItem(String)} and * {@link NodeType#canRemoveProperty(String)} return false * if the specified property is a mandatory property. */ public void testMandatoryProperty() throws NotExecutableException, RepositoryException { PropertyDefinition propDef = NodeTypeUtil.locatePropertyDef(session, false, true); if (propDef == null) { throw new NotExecutableException("No mandatory property def found."); } NodeType type = propDef.getDeclaringNodeType(); assertFalse("NodeType.canRemoveItem(String itemName) must return false " + "if itemName is a mandatory property def.", type.canRemoveItem(propDef.getName())); assertFalse("NodeType.canRemoveProperty(String propertyName) must return false " + "if propertyName is a mandatory property def.", type.canRemoveProperty(propDef.getName())); }
NodeType type = def.getDeclaringNodeType(); boolean hasType = false; for (int j = 0; j < defs.length; j++) { if (defs[j].getName().equals(def.getName())) { hasType = true; break;
/** * Tests if NodeType.canSetProperty(String propertyName, Value value) * returns false if the property is multiple */ public void testReturnFalseBecauseIsMultiple() throws NotExecutableException, RepositoryException { PropertyDefinition propDef = NodeTypeUtil.locatePropertyDef(session, NodeTypeUtil.ANY_PROPERTY_TYPE, true, false, false, false); if (propDef == null) { throw new NotExecutableException("No multiple, not protected property def found."); } NodeType nodeType = propDef.getDeclaringNodeType(); Value value = NodeTypeUtil.getValueOfType(superuser, propDef.getRequiredType()); assertFalse("canSetProperty(String propertyName, Value value) must " + "return false if the property is multiple.", nodeType.canSetProperty(propDef.getName(), value)); }
/** * Tests if NodeType.canSetProperty(String propertyName, Value[] values) * returns false if the property is not multiple */ public void testReturnFalseBecauseIsNotMultiple() throws NotExecutableException, RepositoryException { PropertyDefinition propDef = NodeTypeUtil.locatePropertyDef(session, NodeTypeUtil.ANY_PROPERTY_TYPE, false, false, false, false); if (propDef == null) { throw new NotExecutableException("No not multiple, not protected property def found"); } NodeType nodeType = propDef.getDeclaringNodeType(); Value value = NodeTypeUtil.getValueOfType(superuser, propDef.getRequiredType()); Value values[] = new Value[] {value}; assertFalse("canSetProperty(String propertyName, Value[] values) must " + "return false if the property is not multiple", nodeType.canSetProperty(propDef.getName(), values)); }
String nodeType = propDef.getDeclaringNodeType().getName(); node = testRootNode.addNode(nodeName2, nodeType); testRootNode.getSession().save(); node.setProperty(propDef.getName(), valueNotSatisfied.getDate()); node.save(); fail("setProperty(String name, Calendar value) must throw a " + node.setProperty(propDef.getName(), valueNotSatisfied); node.save(); fail("setProperty(String name, Value value) must throw a " +
/** * Tests if NodeType.canSetProperty(String propertyName, Value value) * returns false if the property is protected. */ public void testReturnFalseBecauseIsProtected() throws NotExecutableException, RepositoryException { PropertyDefinition propDef = NodeTypeUtil.locatePropertyDef(session, NodeTypeUtil.ANY_PROPERTY_TYPE, false, true, false, false); // will never happen since at least jcr:primaryType of nt:base accomplish the request if (propDef == null) { throw new NotExecutableException("No protected property def found."); } NodeType nodeType = propDef.getDeclaringNodeType(); Value value = NodeTypeUtil.getValueOfType(superuser, propDef.getRequiredType()); assertFalse("canSetProperty(String propertyName, Value value) must " + "return false if the property is protected.", nodeType.canSetProperty(propDef.getName(), value)); }
NodeType nodeType = propDef.getDeclaringNodeType(); assertTrue("canSetProperty(String propertyName, Value value) must return " + "true if the property is of type Binary and value is a StringValue", nodeType.canSetProperty(propDef.getName(), stringValue)); nodeType.canSetProperty(propDef.getName(), binaryValue)); nodeType.canSetProperty(propDef.getName(), dateValue)); nodeType.canSetProperty(propDef.getName(), doubleValue)); nodeType.canSetProperty(propDef.getName(), longValue)); nodeType.canSetProperty(propDef.getName(), booleanValue)); nodeType.canSetProperty(propDef.getName(), nameValue)); nodeType.canSetProperty(propDef.getName(), pathValue));
/** * Tests if NodeType.canSetProperty(String propertyName, Value[] values) * returns false if the property is protected. */ public void testReturnFalseBecauseIsProtected() throws NotExecutableException, RepositoryException { PropertyDefinition propDef = NodeTypeUtil.locatePropertyDef(session, NodeTypeUtil.ANY_PROPERTY_TYPE, true, true, false, false); // will never happen since at least jcr:mixinTypes of nt:base accomplish the request if (propDef == null) { throw new NotExecutableException("No protected, multiple property def found"); } NodeType nodeType = propDef.getDeclaringNodeType(); Value value = NodeTypeUtil.getValueOfType(superuser, propDef.getRequiredType()); Value values[] = new Value[] {value, value}; assertFalse("canSetProperty(String propertyName, Value[] values) must " + "return true if the property is protected.", nodeType.canSetProperty(propDef.getName(), values)); }
/** * Tests if canSetProperty(String propertyName, Value value) returns false * if value does not satisfy the value constraints of the property def */ public void testValueConstraintNotSatisfied() throws NotExecutableException, ParseException, RepositoryException { PropertyDefinition propDef = NodeTypeUtil.locatePropertyDef(session, PropertyType.PATH, false, false, true, false); if (propDef == null) { throw new NotExecutableException("No path property def with " + "testable value constraints has been found"); } Value value = NodeTypeUtil.getValueAccordingToValueConstraints(superuser, propDef, false); if (value == null) { throw new NotExecutableException("No path property def with " + "testable value constraints has been found"); } NodeType nodeType = propDef.getDeclaringNodeType(); assertFalse("canSetProperty(String propertyName, Value value) must " + "return false if value does not match the value constraints.", nodeType.canSetProperty(propDef.getName(), value)); }
/** * Tests if canSetProperty(String propertyName, Value value) returns false * if value does not satisfy the value constraints of the property def */ public void testValueConstraintNotSatisfied() throws NotExecutableException, ParseException, RepositoryException { PropertyDefinition propDef = NodeTypeUtil.locatePropertyDef(session, PropertyType.STRING, false, false, true, false); if (propDef == null) { throw new NotExecutableException("No string property def with " + "testable value constraints has been found"); } Value value = NodeTypeUtil.getValueAccordingToValueConstraints(superuser, propDef, false); if (value == null) { throw new NotExecutableException("No string property def with " + "testable value constraints has been found"); } NodeType nodeType = propDef.getDeclaringNodeType(); assertFalse("canSetProperty(String propertyName, Value value) must " + "return false if value does not match the value constraints.", nodeType.canSetProperty(propDef.getName(), value)); }
/** * Tests if canSetProperty(String propertyName, Value value) returns false * if value does not satsfy the value constraints of the property def */ public void testValueConstraintNotSatisfied() throws NotExecutableException, ParseException, RepositoryException { PropertyDefinition propDef = NodeTypeUtil.locatePropertyDef(session, PropertyType.DOUBLE, false, false, true, false); if (propDef == null) { throw new NotExecutableException("No double property def with " + "testable value constraints has been found"); } Value value = NodeTypeUtil.getValueAccordingToValueConstraints(session, propDef, false); if (value == null) { throw new NotExecutableException("No double property def with " + "testable value constraints has been found"); } NodeType nodeType = propDef.getDeclaringNodeType(); assertFalse("canSetProperty(String propertyName, Value value) must " + "return false if value does not match the value constraints.", nodeType.canSetProperty(propDef.getName(), value)); }
/** * Tests if canSetProperty(String propertyName, Value value) returns false * if value does not satisfy the value constraints of the property def */ public void testValueConstraintNotSatisfied() throws NotExecutableException, ParseException, RepositoryException { PropertyDefinition propDef = NodeTypeUtil.locatePropertyDef(session, PropertyType.BINARY, false, false, true, false); if (propDef == null) { throw new NotExecutableException("No binary property def with " + "testable value constraints has been found"); } Value value = NodeTypeUtil.getValueAccordingToValueConstraints(session, propDef, false); if (value == null) { throw new NotExecutableException("No binary property def with " + "testable value constraints has been found"); } NodeType nodeType = propDef.getDeclaringNodeType(); assertFalse("canSetProperty(String propertyName, Value value) must " + "return false if value does not match the value constraints.", nodeType.canSetProperty(propDef.getName(), value)); }