/** * @inheritDoc */ public VersionHistory getVersionHistory() throws UnsupportedRepositoryOperationException, RepositoryException { VersionHistory hist = node.getVersionHistory(); return factory.getVersionHistoryDecorator(session, hist); }
/** * Test if Node.checkin() adds another version to the VersionHistory * * @throws RepositoryException */ @SuppressWarnings("deprecation") public void testCheckinCreatesNewVersion() throws RepositoryException { long initialNumberOfVersions = getNumberOfVersions(versionableNode.getVersionHistory()); versionableNode.checkin(); long numberOfVersions = getNumberOfVersions(versionableNode.getVersionHistory()); assertTrue("Checkin must create a new Version in the VersionHistory.", numberOfVersions == initialNumberOfVersions + 1); }
/** * Test if Node.checkin() adds another version to the VersionHistory * * @throws RepositoryException */ @SuppressWarnings("deprecation") public void testCheckinCreatesNewVersion() throws RepositoryException { long initialNumberOfVersions = getNumberOfVersions(versionableNode.getVersionHistory()); versionableNode.checkin(); long numberOfVersions = getNumberOfVersions(versionableNode.getVersionHistory()); assertTrue("Checkin must create a new Version in the VersionHistory.", numberOfVersions == initialNumberOfVersions + 1); }
/** {@inheritDoc} */ public RemoteVersionHistory getVersionHistory() throws RepositoryException, RemoteException { try { return getFactory().getRemoteVersionHistory(node.getVersionHistory()); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
/** * Tests if <code>Version.getUUID()</code> returns the right UUID */ public void testGetUUID() throws Exception { List<Value> successorValues = Arrays.asList(versionableNode.getVersionHistory().getRootVersion().getProperty(jcrSuccessors).getValues()); assertTrue("Version.getUUID() did not return the right UUID", successorValues.contains(superuser.getValueFactory().createValue(version))); }
public void testGetVersionHistoryFromNode() throws Exception { Node n = testRootNode.addNode(nodeName1, testNodeType); n.addMixin(JcrConstants.MIX_VERSIONABLE); superuser.save(); VersionHistory vh = n.getVersionHistory(); assertNotNull(vh); }
/** * Test that the initial base version after creation of a versionable node * points to the root version. * * @throws javax.jcr.RepositoryException */ public void testInitialBaseVersionPointsToRootVersion() throws RepositoryException { Version rV = versionableNode.getVersionHistory().getRootVersion(); Version bV = versionableNode.getBaseVersion(); assertTrue("After creation of a versionable node the node's baseVersion must point to the rootVersion in the version history.", rV.isSame(bV)); }
@SuppressWarnings( "deprecation" ) protected VersionHistory versionHistory( Node node ) throws RepositoryException { if (useDeprecatedApi()) return node.getVersionHistory(); return session.getWorkspace().getVersionManager().getVersionHistory(node.getPath()); }
public Object doInJcr( final Session session ) throws RepositoryException { Item item = session.getItem( absPath ); Assert.isTrue( item.isNode() ); Node node = ( (Node) item ); return node.getVersionHistory().getPath(); } } );
public void testRemoveAddMixVersionable1() throws Exception { Node node = testRootNode.addNode(nodeName1); node.addMixin(mixReferenceable); node.addMixin(mixVersionable); superuser.save(); String vhId = node.getVersionHistory().getUUID(); node.removeMixin(mixVersionable); node.addMixin(mixVersionable); superuser.save(); assertEquals(vhId, node.getVersionHistory().getUUID()); } }
/** * @since oak */ @Test public void testGetVersionHistory() throws Exception { // accessing the version history must be allowed if the versionable node // is readable to the editing test session. Node testNode = testSession.getNode(versionablePath); VersionHistory vh = testNode.getVersionHistory(); VersionHistory vh2 = testSession.getWorkspace().getVersionManager().getVersionHistory(versionablePath); }
/** * @since oak */ @Test public void testVersionHistoryGetIdentifier() throws Exception { VersionHistory testVh = testSession.getNode(versionablePath).getVersionHistory(); testVh.getIdentifier(); }
/** * @since oak */ @Test public void testVersionHistoryGetVersionableIdentifier() throws Exception { VersionHistory testVh = testSession.getNode(versionablePath).getVersionHistory(); testVh.getVersionableIdentifier(); }
/** * @since oak */ @Test public void testVersionHistoryGetVersionableUUID() throws Exception { VersionHistory testVh = testSession.getNode(versionablePath).getVersionHistory(); testVh.getVersionableUUID(); }
/** * @since oak */ @Test public void testGetAllVersions() throws Exception { // accessing the version history must be allowed if the versionable node // is readable to the editing test session. Node testNode = testSession.getNode(versionablePath); VersionHistory vh = testNode.getVersionHistory(); VersionIterator versionIterator = vh.getAllVersions(); }
/** * @since oak */ @Test public void testGetAllLinearVersions() throws Exception { // accessing the version history must be allowed if the versionable node // is readable to the editing test session. Node testNode = testSession.getNode(versionablePath); VersionHistory vh = testNode.getVersionHistory(); VersionIterator versionIterator = vh.getAllLinearVersions(); }
/** * @since oak */ @Test public void testVersionablePath() throws Exception { Node n = createVersionableNode(superuser.getNode(path)); VersionHistory vh = n.getVersionHistory(); Property versionablePath = vh.getProperty(superuser.getWorkspace().getName()); assertEquals(n.getPath(), versionablePath.getString()); }
public NodeIterator execute() throws Exception { Node n = getNode(); Version v = getRandomVersion(true); if (v != null) { log.info(n.getPath() + ":" + v.getName()); n.getVersionHistory().removeVersion(v.getName()); } return wrapWithIterator(n); } }
/** * Returns the versionable node. */ public NodeIterator execute() throws Exception { Node n = getNode(); String name = n.getBaseVersion().getName(); String label = getRandomText(3); log.info(n.getPath() + ":" + name + " -> " + label); n.getVersionHistory().addVersionLabel(name, label, true); return wrapWithIterator(n); } }
public Object doInJcr( final Session session ) throws RepositoryException { Node fileNode = (Node) session.getItem( absPath ); VersionHistory versionHistory = fileNode.getVersionHistory(); VersionIterator versionIterator = versionHistory.getAllVersions(); int versionCount = 0; while ( versionIterator.hasNext() ) { versionIterator.nextVersion(); versionCount++; } return versionCount; } } );