public void call() throws RepositoryException { n.remove(); testRootNode.getSession().save(); } }, Event.NODE_REMOVED);
@Override protected void afterSuite() throws Exception { Session session = loginWriter(); session.getNode(testRoot.getPath()).remove(); testRoot.getSession().logout(); session.save(); session.logout(); } }
protected void tearDown() throws Exception { try { Node folder = testRootNode.getNode("bigcoll"); folder.remove(); folder.getSession().save(); } catch (RepositoryException ex) { // nothing to do } super.tearDown(); }
/** * Test reordering same-name-siblings using move */ public void testReorderSameNameSiblingsUsingMove() throws RepositoryException { Session session = testRootNode.getSession(); for (NodeIterator it = testRootNode.getNodes(); it.hasNext();) { it.nextNode().remove(); session.save(); } Node node1 = testRootNode.addNode(nodeName1); Node node2 = testRootNode.addNode(nodeName1); String path = node1.getPath(); // re-order the nodes using move session.move(path, path); assertEquals(path + "[2]", node1.getPath()); assertEquals(path, node2.getPath()); }
public void testRemoveLockedChild() throws RepositoryException { Session otherSession = getHelper().getReadWriteSession(); try { Node child = (Node) otherSession.getItem(childNode.getPath()); child.remove(); otherSession.save(); fail("A node below a deeply locked node cannot be removed by another Session."); } catch (LockException e) { // success } finally { otherSession.logout(); } } }
protected void tearDown() throws Exception { int count = 0; for (NodeIterator it = testRootNode.getNodes(); it.hasNext();) { it.nextNode().remove(); count++; if (count % 10000 == 0) { testRootNode.getSession().save(); } } testRootNode.getSession().save(); super.tearDown(); }
@Test public void testGetJcrItemWithPropertyNotExisting() throws Exception { // GIVEN String nodeName = "nodeName"; Node testNode = session.getRootNode().addNode(nodeName); String propertyName = "propertyName"; String propertyValue = "propertyValue"; Property testProperty = testNode.setProperty(propertyName, propertyValue); testNode.remove(); // WHEN DummyJcrAdapter adapter = new DummyJcrAdapter(testProperty); // THEN assertNull(adapter.getJcrItem()); }
protected final void deleteOrMarkDeletedIfLiveExists(final Node toDelete) throws RepositoryException { if (liveExists(toDelete.getSession(), toDelete.getPath())) { markDeleted(toDelete); } else { toDelete.remove(); } }
@Test public void testAclDefinedButEmpty() throws RepositoryException, TaskExecutionException { // GIVEN GrantReadPermissionToRolesTask task = new GrantReadPermissionToRolesTask("name", "description"); aclUserrolesNode.getNode("0").remove(); userRoleSession.save(); // WHEN task.execute(installContext); // THEN checkACL("/superuser", 8l, "0"); }
private void removeResource(final Resource resource) { if (resource != null) { final Node node = resource.adaptTo(Node.class); if (node != null) { try { log.trace("Removing AEM Fiddle compiled scripts at: {}", node.getPath()); node.remove(); node.getSession().save(); } catch (RepositoryException e) { log.error("Could not remove compiled AEM Fiddle scripts: {}", e); } } } }
public void removeNode(String key) throws RepositoryException { Node parent = getParent(key); Node n = parent.getNode(key); n.remove(); treeManager.join(this, parent, n); if (autoSave) { parent.getSession().save(); } }
private void doTestMoveWithGetPath(boolean index) throws RepositoryException { Session session = testRootNode.getSession(); for (NodeIterator it = testRootNode.getNodes(); it.hasNext();) { it.nextNode().remove(); session.save(); } String testPath = testRootNode.getPath(); Node a = testRootNode.addNode("a"); Node b = a.addNode("b"); session.save(); session.move(testPath + "/a/b", testPath + "/a"); if (index) { b.getPath(); } session.move(testPath + "/a", testPath + "/a"); assertEquals(testPath + "/a[2]", a.getPath()); assertEquals(testPath + "/a", b.getPath()); }
public void call() throws RepositoryException { n.remove(); testRootNode.getSession().save(); } }, Event.NODE_REMOVED);
@FixFor( "MODE-1685" ) @Test public void shouldNotEnforceReferentialIntegrityOfWeakReferenceWhenRemovingNodes() throws Exception { JcrValueFactory valueFactory = session.getValueFactory(); Node targetNode = session.getRootNode().addNode("target"); targetNode.addMixin(JcrMixLexicon.REFERENCEABLE.toString()); Node parentNode = session.getRootNode().addNode("parent"); Node childNode = parentNode.addNode("child"); childNode.setProperty("ref1", valueFactory.createValue(targetNode, true)); session.save(); // Delete the target - there should be no strong references, but the weak is okay and won't prevent removal ... targetNode.remove(); session.save(); }
public void testRemoveDestParent() throws RepositoryException { String srcPath = moveNode.getPath(); testRootNode.getSession().move(srcPath, destinationPath); destParentNode.remove(); assertFalse(destParentNode.isNew()); assertFalse(destParentNode.isModified()); assertFalse(moveNode.isModified()); assertTrue(srcParentNode.isModified()); assertFalse(testRootNode.getSession().itemExists(srcPath)); }