Search in sources :

Example 21 with VersionHistory

use of javax.jcr.version.VersionHistory in project jackrabbit-oak by apache.

the class ReadVersionContentTest method testVersionHistoryGetUUID.

/**
     * @since oak
     */
@Test
public void testVersionHistoryGetUUID() throws Exception {
    VersionHistory testVh = testSession.getNode(versionablePath).getVersionHistory();
    testVh.getUUID();
}
Also used : VersionHistory(javax.jcr.version.VersionHistory) Test(org.junit.Test)

Example 22 with VersionHistory

use of javax.jcr.version.VersionHistory in project jackrabbit-oak by apache.

the class ReadVersionContentTest method testVersionHistoryGetVersionableUUID.

/**
     * @since oak
     */
@Test
public void testVersionHistoryGetVersionableUUID() throws Exception {
    VersionHistory testVh = testSession.getNode(versionablePath).getVersionHistory();
    testVh.getVersionableUUID();
}
Also used : VersionHistory(javax.jcr.version.VersionHistory) Test(org.junit.Test)

Example 23 with VersionHistory

use of javax.jcr.version.VersionHistory in project jackrabbit-oak by apache.

the class ReadVersionContentTest method testAccessVersionHistoryVersionableNodeRemoved.

/**
     * @since oak
     */
@Test
public void testAccessVersionHistoryVersionableNodeRemoved() throws Exception {
    superuser.getNode(versionablePath).remove();
    superuser.save();
    testSession.refresh(false);
    assertTrue(testSession.nodeExists(path));
    assertFalse(testSession.nodeExists(versionablePath));
    // accessing the version history directly should still succeed as
    // read permission is still granted on the tree defined by the parent.
    VersionHistory history = (VersionHistory) testSession.getNode(vh.getPath());
    history = (VersionHistory) testSession.getNodeByIdentifier(vh.getIdentifier());
    history = (VersionHistory) testSession.getNodeByUUID(vh.getUUID());
    // revoking read permission on the parent node -> version history
    // must no longer be accessible
    modify(path, Privilege.JCR_READ, false);
    assertFalse(testSession.nodeExists(vh.getPath()));
}
Also used : VersionHistory(javax.jcr.version.VersionHistory) Test(org.junit.Test)

Example 24 with VersionHistory

use of javax.jcr.version.VersionHistory in project jackrabbit-oak by apache.

the class ReadVersionContentTest method testVersionHistoryGetVersionableIdentifier.

/**
     * @since oak
     */
@Test
public void testVersionHistoryGetVersionableIdentifier() throws Exception {
    VersionHistory testVh = testSession.getNode(versionablePath).getVersionHistory();
    testVh.getVersionableIdentifier();
}
Also used : VersionHistory(javax.jcr.version.VersionHistory) Test(org.junit.Test)

Example 25 with VersionHistory

use of javax.jcr.version.VersionHistory in project jackrabbit-oak by apache.

the class VersionHistoryTest method testGetNodeByUUID.

@SuppressWarnings("deprecation")
public void testGetNodeByUUID() throws RepositoryException {
    Node n = testRootNode.addNode(nodeName1, testNodeType);
    n.addMixin(mixVersionable);
    superuser.save();
    VersionManager vMgr = superuser.getWorkspace().getVersionManager();
    String uuid = vMgr.getVersionHistory(n.getPath()).getUUID();
    assertTrue("Session.getNodeByUUID() did not return VersionHistory object for a nt:versionHistory node.", superuser.getNodeByUUID(uuid) instanceof VersionHistory);
}
Also used : Node(javax.jcr.Node) VersionManager(javax.jcr.version.VersionManager) VersionHistory(javax.jcr.version.VersionHistory)

Aggregations

VersionHistory (javax.jcr.version.VersionHistory)73 Node (javax.jcr.Node)45 Version (javax.jcr.version.Version)29 Test (org.junit.Test)25 RepositoryException (javax.jcr.RepositoryException)17 VersionManager (javax.jcr.version.VersionManager)17 Session (javax.jcr.Session)12 VersionIterator (javax.jcr.version.VersionIterator)12 Property (javax.jcr.Property)7 DavException (org.apache.jackrabbit.webdav.DavException)7 DavResourceLocator (org.apache.jackrabbit.webdav.DavResourceLocator)7 JcrDavException (org.apache.jackrabbit.webdav.jcr.JcrDavException)7 ArrayList (java.util.ArrayList)6 DavResource (org.apache.jackrabbit.webdav.DavResource)6 ItemNotFoundException (javax.jcr.ItemNotFoundException)5 VersionHistoryResource (org.apache.jackrabbit.webdav.version.VersionHistoryResource)4 Workspace (javax.jcr.Workspace)3 VersionException (javax.jcr.version.VersionException)3 JackrabbitSession (org.apache.jackrabbit.api.JackrabbitSession)3 PathNotFoundException (javax.jcr.PathNotFoundException)2