@Test public void addObjectNew() throws Exception { store.addObject(new FedoraObject().pid("test:new-object")); Assert.assertTrue(jcr.nodeExists("/ca/88/test_new-object")); jcr.removeItem("/ca/88/test_new-object"); jcr.save(); }
/** * Test if in mode <i>cleanup</i>, a file removed from /var/dam is removed from /content/dam if * the payload points to a folder. * * @throws Exception in case of any error */ public void testCleanNotifyFile() throws Exception { String toRemove = getAsset(false).getPath(); String tiffPath = getTiff().getPath(); Session session = getAdminSession(); session.removeItem(tiffPath); session.save(); executeWorkflowProcess(tiffPath, "mode:cleanup"); assertFalse("Asset still exists", session.itemExists(toRemove)); }
@Override public int performAction(Resource res) throws RepositoryException { Node node = getNode(res); LOG.info("Deleting node at " + node.getPath() + " and saving Session"); Session sess = node.getSession(); sess.removeItem(node.getPath()); sess.save(); return -1; }
/** * Test if in mode <i>cleanup</i>, only the missing file is removed from a folder /var/dam is * removed if the payload points to a folder. * * @throws Exception in case of any error */ public void testCleanFolder() throws Exception { Node tiffFolder = getTiff().getParent(); Node gif = setUpBinary("test.xmp.gif", tiffFolder.getPath()); String toExist = createAsset(gif).getPath(); String toDelete = getAsset(false).getPath(); String tiffPath = getTiff().getPath(); Session session = getAdminSession(); session.removeItem(tiffPath); session.save(); executeWorkflowProcess(tiffPath, "mode:cleanup"); assertFalse("Binary for Asset has been removed", session.itemExists(toDelete)); assertTrue("Binary for Asset still present", session.itemExists(toExist)); }
private void removeItem(String path) { try { jcr.removeItem(path); } catch (Exception e) { } }