public void visit(Property property) throws RepositoryException { assertTrue("Visited Property is not the same as the one returned by visit(Property).", p.isSame(property)); }
@Override public boolean isSame(Item otherItem) throws RepositoryException { return getWrappedProperty().isSame(otherItem); }
public void testNewPropertyIsSame() throws RepositoryException { Node n = testRootNode.addNode(nodeName1, testNodeType); Property p = n.setProperty(propertyName1, "anyValue"); assertTrue(p.isSame(p)); }
/** * Test if the ancestor at depth = n, where n is the depth of this * <code>Item</code>, returns this <code>Property</code> itself. * * @throws RepositoryException */ public void testGetAncestorOfItemDepth() throws RepositoryException { Property propertyAtDepth = (Property) property.getAncestor(property.getDepth()); assertTrue("The ancestor of depth = n, where n is the depth of this " + "Property must be the item itself.", property.isSame(propertyAtDepth)); }
/** * <code>Node.getProperty("./jcr:primaryType") </code> applied to any * test node must return the same Property as * {@link Node#getProperty(String) Node.getProperty("jcr:primaryType")}. * * @throws RepositoryException */ public void testGetPropertyDotSlashName() throws RepositoryException { Property pt = testRootNode.getProperty(jcrPrimaryType); String otherRelPath = DOT + "/" + jcrPrimaryType; assertTrue(pt.isSame(testRootNode.getProperty(otherRelPath))); }
public void testNewProperty() throws RepositoryException { Property p = testRootNode.setProperty(propertyName1, testValue); testRootNode.refresh(true); // p must still be accessible p.getString(); assertTrue("Refresh 'true' must not affect a new Property.", testRootNode.hasProperty(propertyName1)); Property pAgain = testRootNode.getProperty(propertyName1); assertTrue("Refresh 'true' must not affect a new Property.", p.isSame(pAgain)); }
public void testShadowingItems2() throws RepositoryException { Node n = testRootNode.addNode(nodeName1, testNodeType); Node n2 = testRootNode.addNode(nodeName2, testNodeType); Property p = n.setProperty(propertyName1, "anyValue"); testRootNode.getSession().move(n.getPath(), n2.getPath() + "/destination"); Node replaceNode = testRootNode.addNode(nodeName1, testNodeType); Property replaceProp = replaceNode.setProperty(propertyName1, "anyValue"); assertFalse(replaceNode.isSame(n)); assertFalse(replaceProp.isSame(p)); }
public void testShadowingItems() throws RepositoryException { Node n = testRootNode.addNode(nodeName1, testNodeType); Node n2 = testRootNode.addNode(nodeName2, testNodeType); Property p = n.setProperty(propertyName1, "anyValue"); testRootNode.save(); testRootNode.getSession().move(n.getPath(), n2.getPath() + "/destination"); Node replaceNode = testRootNode.addNode(nodeName1, testNodeType); Property replaceProp = replaceNode.setProperty(propertyName1, "anyValue"); assertFalse(replaceNode.isSame(n)); assertFalse(replaceProp.isSame(p)); }
public void testShadowingItems3() throws RepositoryException { Node n = testRootNode.addNode(nodeName1, testNodeType); Property p = n.setProperty(propertyName1, "anyValue"); testRootNode.save(); p.remove(); Property p2 = n.setProperty(propertyName1, "anyValue"); try { assertFalse(p2.isSame(p)); } catch (InvalidItemStateException e) { // ok as well. } }
public void testDifferentItemType() throws RepositoryException { Node n = testRootNode.addNode(nodeName1, testNodeType); Property p = n.setProperty(propertyName1, "anyValue"); assertFalse(p.isSame(n)); assertFalse(n.isSame(p)); }
public void testSameInstanceIsSame() throws RepositoryException { assertTrue(testRootNode.isSame(testRootNode)); Property p = testRootNode.getProperty(jcrPrimaryType); assertTrue(p.isSame(p)); }
public void testNewNode() throws RepositoryException { Node n = testRootNode.addNode(nodeName2); Property p = n.setProperty(propertyName1, testValue); testRootNode.refresh(true); // n must still be new and accessible String msg = "Refresh 'true' must not affect the new Node/Property."; assertTrue(msg, testRootNode.hasNode(nodeName2)); assertTrue(msg, n.isNew()); assertTrue(msg, n.hasProperty(propertyName1)); // p must still be accessible p.getString(); assertTrue(msg, p.isSame(n.getProperty(propertyName1))); }
public void testPropertyAccessibleAfterSave() throws NotExecutableException, RepositoryException { Property p; try { p = testRootNode.setProperty(propname, "anyValue"); } catch (RepositoryException e) { throw new NotExecutableException(); } // check if p is valid and can be accessed from the parent node. String name = p.getName(); assertEquals("Added property must have the original name", name, propname); assertTrue("Accessing the created property again must return the 'same' item.", p.isSame(testRootNode.getProperty(propname))); }
@Test public void testGetItem() throws Exception { Item item = superuser.getItem(n.getPath()); if (item.isNode()) { assertTrue(n.isSame(item)); } else { assertTrue(p.isSame(item)); } }
@Test public void testIsSame() throws Exception { assertFalse(n.isSame(p)); assertFalse(p.isSame(n)); }
@Test public void shouldReturnFalseFromIsSameIfTheWorkspaceNameIsDifferent() throws Exception { // Use the same id and location; use 'Toyota Prius' String priusUuid2 = prius2.getIdentifier(); String priusUuid = prius.getIdentifier(); assertThat(priusUuid, is(priusUuid2)); assertThat(prius2.isSame(prius), is(false)); // Check the properties ... javax.jcr.Property model = prius.getProperty("car:model"); javax.jcr.Property model2 = prius2.getProperty("car:model"); assertThat(model.isSame(model2), is(false)); }
@Test public void testSessionGetProperty() throws Exception { Property pp = superuser.getProperty(p.getPath()); assertTrue(p.isSame(pp)); }
public void testTreeEntries() throws RepositoryException { Item item = superuser.getItem(destinationPath + "/" + nodeName2); assertTrue("Moving a node must move all child items as well.", childNode.isSame(item)); item = superuser.getItem(destinationPath + "/" + propertyName2); assertTrue("Moving a node must move all child items as well.", childProperty.isSame(item)); item = superuser.getItem(destinationPath + "/" + nodeName2 + "/" + nodeName3); assertTrue("Moving a node must move all child items as well.", grandChildNode.isSame(item)); }
public void testTreeEntries() throws RepositoryException { Item item = superuser.getItem(destinationPath + "/" + nodeName2); assertTrue("Moving a node must move all child items as well.", childNode.isSame(item)); item = superuser.getItem(destinationPath + "/" + propertyName2); assertTrue("Moving a node must move all child items as well.", childProperty.isSame(item)); item = superuser.getItem(destinationPath + "/" + nodeName2 + "/" + nodeName3); assertTrue("Moving a node must move all child items as well.", grandChildNode.isSame(item)); }