/** * Tests if <code>VersionHistory.getName()</code> returns the right name */ public void testGetName() throws Exception { assertEquals("VersionHistory.getName() does not return the right name", version.getParent().getName(), vHistory.getName()); }
/** * Tests if <code>Version.getParent()</code> returns the right parent Node */ public void testGetParent() throws Exception { assertTrue("Version.getParent() does not return a parent-node of type nt:versionHistory", version.getParent().isNodeType(ntVersionHistory)); }
/** * Tests if <code>VersionHistory.isSame()</code> returns the right * <code>boolean</code> value */ public void testIsSame() throws Exception { assertTrue("VersionHistory.isSame(Item) did not return true", vHistory.isSame(version.getParent())); }
/** * Checks if the given version belongs to this history * * @param version the version * @throws javax.jcr.version.VersionException if the specified version is * not part of this version history * @throws javax.jcr.RepositoryException if a repository error occurs */ private void checkOwnVersion(Version version) throws VersionException, RepositoryException { if (!version.getParent().isSame(this)) { throw new VersionException("Specified version not contained in this history."); } }
/** * Checks if the given version belongs to this history * * @param version the version * @throws javax.jcr.version.VersionException if the specified version is * not part of this version history * @throws javax.jcr.RepositoryException if a repository error occurs */ private void checkOwnVersion(Version version) throws VersionException, RepositoryException { if (!version.getParent().isSame(this)) { throw new VersionException("Specified version not contained in this history."); } }
/** * Returns the version labels that point to the given version * * @param version the version for which the labels should be retrieved * @return the set of version labels for that version; never null * @throws RepositoryException if an error occurs accessing the repository */ private Set<String> versionLabelsFor( Version version ) throws RepositoryException { if (!version.getParent().equals(this)) { throw new VersionException(JcrI18n.invalidVersion.text(version.getPath(), getPath())); } String versionId = version.getIdentifier(); PropertyIterator iter = versionLabels().getProperties(); if (iter.getSize() == 0) return Collections.emptySet(); Set<String> labels = new HashSet<String>(); while (iter.hasNext()) { javax.jcr.Property prop = iter.nextProperty(); if (versionId.equals(prop.getString())) { labels.add(prop.getName()); } } return labels; }
/** * Returns the version labels that point to the given version * * @param version the version for which the labels should be retrieved * @return the set of version labels for that version; never null * @throws RepositoryException if an error occurs accessing the repository */ private Set<String> versionLabelsFor( Version version ) throws RepositoryException { if (!version.getParent().equals(this)) { throw new VersionException(JcrI18n.invalidVersion.text(version.getPath(), getPath())); } String versionId = version.getIdentifier(); PropertyIterator iter = versionLabels().getProperties(); if (iter.getSize() == 0) return Collections.emptySet(); Set<String> labels = new HashSet<String>(); while (iter.hasNext()) { javax.jcr.Property prop = iter.nextProperty(); if (versionId.equals(prop.getString())) { labels.add(prop.getName()); } } return labels; }
VersionHistory grandParent = mock( VersionHistory.class ); when( rootNode.getParent() ).thenReturn( parent ); when( parent.getParent() ).thenReturn( grandParent );
RepositoryException { assert versionToBeRemoved.getParent().equals(this);
VersionHistory history = (VersionHistory) version.getParent(); final String versionableId = history.getVersionableIdentifier(); if (history.getRootVersion().isSame(version)) {
VersionHistory history = (VersionHistory) version.getParent(); final String versionableId = history.getVersionableIdentifier(); if (history.getRootVersion().isSame(version)) {
RepositoryException { assert versionToBeRemoved.getParent().equals(this);
VersionHistory history = (VersionHistory) version.getParent(); final String versionableId = history.getVersionableIdentifier(); if (history.getRootVersion().isSame(version)) {