Refine search
/** * Test if restoring a node works on checked-out node. * * @throws RepositoryException */ public void testRestoreOnCheckedOutNodeJcr2_2() throws RepositoryException { try { versionManager.restore(versionableNode.getPath(), version, true); fail("VersionManager.restore(String, Version, boolean) must fail on existing nodes."); } catch (RepositoryException e) { // ok } versionManager.restore(version, true); }
@Test public void restoreVersionedNode() throws Exception{ String assetParentPath = "/bundlingtest/par"; Node asset = JcrUtils.getOrCreateByPath(assetParentPath + "/foo.png", "oak:Unstructured", "oak:Asset", s, false); Node assetParent = s.getNode(assetParentPath); assetParent.addMixin(JcrConstants.MIX_VERSIONABLE); asset.addNode("jcr:content", "oak:Unstructured"); s.save(); VersionManager vm = s.getWorkspace().getVersionManager(); Version version = vm.checkin(assetParentPath); vm.checkout(assetParentPath); asset.getNode("jcr:content").setProperty("foo1", "bar1"); s.save(); vm.restore(version, true); }
/** * Test restoring on a non-versionable node. * * @throws RepositoryException * @see Node#restore(String, boolean) */ public void testRestoreNonVersionableNodeJcr2_2() throws RepositoryException { try { versionManager.restore(nonVersionableNode.getPath(), "foo", true); fail("trying to restore on a non versionable node must throw UnsupportedRepositoryOperationException"); } catch (UnsupportedRepositoryOperationException e) { //success } }
/** * Test restoring on a non-versionable node. * * @throws RepositoryException * @see Node#restore(String, boolean) */ public void testRestoreNonVersionableNodeJcr2_2() throws RepositoryException { try { versionManager.restore(nonVersionableNode.getPath(), "foo", true); fail("trying to restore on a non versionable node must throw UnsupportedRepositoryOperationException"); } catch (UnsupportedRepositoryOperationException e) { //success } }
/** * Test if restoring a node works on checked-in node. * * @throws RepositoryException */ public void testRestoreOnCheckedInNodeJcr2_2() throws RepositoryException { versionManager.checkin(versionableNode.getPath()); try { versionManager.restore(versionableNode.getPath(), version, true); fail("VersionManager.restore(String, Version, boolean) must fail on existing nodes."); } catch (RepositoryException e) { // ok } versionManager.restore(version, true); }
/** * Test if restoring a node restores the correct property * * @throws RepositoryException */ public void testRestoreCorrectPropertyJcr2_2() throws RepositoryException { try { versionManager.restore(versionableNode.getPath(), version, true); fail("VersionManager.restore(String, Version, boolean) must fail on existing nodes."); } catch (RepositoryException e) { // ok } versionManager.restore(version, true); String value = versionableNode.getProperty(propertyName1).getString(); assertEquals("Restoring a node must set the correct property.", propertyValue1, value); }
/** * Test if restoring a node restores the correct property * * @throws RepositoryException */ public void testRestoreCorrectPropertyJcr2_3() throws RepositoryException { versionManager.restore(versionableNode.getPath(), version.getName(), true); String value = versionableNode.getProperty(propertyName1).getString(); assertEquals("Restoring a node must set the correct property.", propertyValue1, value); }
/** * Test if restoring a node with an invalid Version throws a VersionException * * @throws RepositoryException */ public void testRestoreWithInvalidVersionJcr2() throws RepositoryException { Version invalidVersion = versionManager.checkin(versionableNode2.getPath()); try { versionManager.restore(versionableNode.getPath(), invalidVersion, true); fail("Node.restore(Version, boolean): A VersionException must be thrown if the specified version does not exists in this node's version history."); } catch (VersionException e) { // success } }
/** * Test if restoring a node restores the correct property * * @throws RepositoryException */ public void testRestoreCorrectPropertyJcr2_3() throws RepositoryException { versionManager.restore(versionableNode.getPath(), version.getName(), true); String value = versionableNode.getProperty(propertyName1).getString(); assertEquals("Restoring a node must set the correct property.", propertyValue1, value); }
/** * Test if restoring a node with an invalid Version throws a VersionException * * @throws RepositoryException */ public void testRestoreWithInvalidVersionJcr2() throws RepositoryException { Version invalidVersion = versionManager.checkin(versionableNode2.getPath()); try { versionManager.restore(versionableNode.getPath(), invalidVersion, true); fail("Node.restore(Version, boolean): A VersionException must be thrown if the specified version does not exists in this node's version history."); } catch (VersionException e) { // success } }