public String getPath() { try { return version.getPath(); } catch (RepositoryException e) { throw new VersionException("Error while retrieving the version path", e); } }
public String getPath() { try { return version.getPath(); } catch (RepositoryException e) { throw new VersionException("Error while retrieving the version path", e); } }
/** * Tests if <code>Version.checkin()</code> throws an {@link * javax.jcr.UnsupportedRepositoryOperationException} */ public void testCheckinJcr2() throws Exception { try { versionManager.checkin(version.getPath()); fail("Version.checkin() did not throw an UnsupportedRepositoryOperationException"); } catch (UnsupportedRepositoryOperationException success) { } }
/** * Tests if <code>Version.getVersionHistory()</code> throws an {@link * javax.jcr.UnsupportedRepositoryOperationException} */ public void testGetVersionHistoryJcr2() throws Exception { try { versionManager.getVersionHistory(version.getPath()); fail("Version.getVersionHistory() did not throw an UnsupportedRepositoryOperationException"); } catch (UnsupportedRepositoryOperationException success) { } }
/** * Tests if <code>Version.getCorrespondingNodePath(String)</code> returns * the right path */ public void testGetCorrespondingNodePath() throws Exception { assertEquals("Version.getCorrespondingNodePath(String) did not return the right path", version.getPath(), version.getCorrespondingNodePath(workspaceName)); }
/** * Tests if <code>Version.checkout()</code> throws an {@link * javax.jcr.UnsupportedRepositoryOperationException} */ public void testCheckoutJcr2() throws Exception { try { versionManager.checkout(version.getPath()); fail("Version.checkout() did not throw an UnsupportedRepositoryOperationException"); } catch (UnsupportedRepositoryOperationException success) { } }
/** * Tests if <code>Version.getBaseVersion()</code> throws an {@link * javax.jcr.UnsupportedRepositoryOperationException} */ public void testGetBaseVersionJcr2() throws Exception { try { versionManager.getBaseVersion(version.getPath()); fail("Version.getBaseVersion() did not throw an UnsupportedRepositoryOperationException"); } catch (UnsupportedRepositoryOperationException success) { } }
/** * Tests if <code>Version.isCheckedOut()</code> returns <code>true</code> */ public void testIsCheckedOutJcr2() throws Exception { assertTrue("Version.isCheckedOut() did not return true", versionManager.isCheckedOut(version.getPath())); }
/** * Tests if <code>Version.cancelMerge(Version)</code> throws an {@link * javax.jcr.UnsupportedRepositoryOperationException} */ public void testCancelMergeJcr2() throws Exception { try { versionManager.cancelMerge(version.getPath(), version2); fail("Version.cancelMerge(Version) did not throw an UnsupportedRepositoryOperationException"); } catch (UnsupportedRepositoryOperationException success) { } }
/** * Tests if <code>Version.doneMerge(Version)</code> throws an {@link * javax.jcr.UnsupportedRepositoryOperationException} */ public void testDoneMergeJcr2() throws Exception { try { versionManager.doneMerge(version.getPath(), version2); fail("Version should not be versionable: Version.doneMerge(Version) did not throw an UnsupportedRepositoryOperationException"); } catch (UnsupportedRepositoryOperationException success) { } }
/** * Tests if <code>Version.restoreByLabel(String, boolean)</code> throws an * {@link javax.jcr.UnsupportedRepositoryOperationException} */ public void testRestoreByLabelJcr2() throws Exception { try { versionManager.restoreByLabel(version.getPath(), "abc", true); fail("Version.restoreByLabel(String,boolean) did not throw an UnsupportedRepositoryOperationException"); } catch (UnsupportedRepositoryOperationException success) { } }
/** * Tests if <code>Version.restore(String, boolean)</code> and * <code>Version.restore(Version, boolean)</code> throw an * {@link UnsupportedRepositoryOperationException} and * <code>Version.restore(Version, String, boolean)</code> throws a * {@link ConstraintViolationException}. */ public void testRestoreJcr2() throws Exception { try { versionManager.restore(version.getPath(), "abc", true); fail("Version.restore(String,boolean) did not throw an UnsupportedRepositoryOperationException"); } catch (UnsupportedRepositoryOperationException success) { } }
/** * Tests if <code>Version.getPath()</code> returns the right path */ public void testGetPath() throws Exception { assertTrue("Version.getPath() does not return the right path", version.getPath().startsWith("/" + superuser.getNamespacePrefix(NS_JCR_URI) + ":system/" + superuser.getNamespacePrefix(NS_JCR_URI) + ":versionStorage/")); }
/** * Tests if <code>Version.holdsLock()</code> returns <code>false</code> */ public void testHoldsLockJcr2() throws Exception { ensureLockingSupported(); assertFalse("Version.holdsLock() did not return false", version.getSession().getWorkspace().getLockManager().holdsLock(version.getPath())); }
/** * Tests if <code>Version.isLocked()</code> returns <code>false</code> */ public void testIsLockedJcr2() throws Exception { ensureLockingSupported(); assertFalse("Version.isLocked() did not return false", version.getSession().getWorkspace().getLockManager().isLocked(version.getPath())); }
/** * Tests if <code>Version.getLock()</code> throws a {@link * javax.jcr.lock.LockException} */ public void testGetLockJcr2() throws Exception { ensureLockingSupported(); try { version.getSession().getWorkspace().getLockManager().getLock(version.getPath()); fail("Version should not be lockable: Version.getLock() did not throw a LockException"); } catch (LockException success) { } }
/** * Tests if <code>Version.unlock()</code> throws a {@link * javax.jcr.lock.LockException} */ public void testUnlockJcr2() throws Exception { ensureLockingSupported(); try { version.getSession().getWorkspace().getLockManager().unlock(version.getPath()); fail("Version should not be lockable: Version.unlock() did not throw a LockException"); } catch (LockException success) { } }
protected List<String> getVersionLabelsList(Version version) throws VersionException, RepositoryException { if (!isVersionBelongToThis(version)) { throw new VersionException("There are no version '" + version.getPath() + "' in the version history " + getPath()); } List<PropertyData> labelsList = getData().getVersionLabels(); List<String> vlabels = new ArrayList<String>(); for (PropertyData prop : labelsList) { String versionUuid = ValueDataUtil.getString(prop.getValues().get(0)); if (versionUuid.equals(((VersionImpl)version).getInternalIdentifier())) { vlabels.add(locationFactory.createJCRName(prop.getQPath().getName()).getAsString()); } } return vlabels; }
@Test public void hiddenTree() throws Exception { Node test = session.getRootNode().addNode("test", "nt:unstructured"); test.addMixin("mix:versionable"); session.save(); NodeBuilder builder = store.getRoot().builder(); builder.child("test").child(":hidden").setProperty("property", "value"); store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY); session.refresh(false); Version v1 = vMgr.checkpoint("/test"); Version v2 = vMgr.checkpoint("/test"); NodeState state = store.getRoot(); for (String name : PathUtils.elements(v2.getPath())) { state = state.getChildNode(name); } state = state.getChildNode("jcr:frozenNode"); assertTrue(state.exists()); assertFalse(state.hasChildNode(":hidden")); vMgr.restore(v1, true); state = store.getRoot().getChildNode("test"); assertTrue(state.hasChildNode(":hidden")); }