use of javax.jcr.version.VersionHistory in project jackrabbit-oak by apache.
the class VersionManagementTest method testRemoveVersionLabel.
/**
* @since oak
*/
@Test
public void testRemoveVersionLabel() throws Exception {
Node n = createVersionableNode(superuser.getNode(path));
allow(n.getPath(), versionPrivileges);
Node testNode = testSession.getNode(n.getPath());
Version v = testNode.checkin();
testNode.checkout();
Version v2 = testNode.checkin();
testNode.checkout();
// -> VersionHistory.addVersionLabel must be allowed
VersionHistory history = testNode.getVersionHistory();
history.addVersionLabel(v.getName(), "testLabel", false);
history.addVersionLabel(v2.getName(), "testLabel", true);
VersionManager vMgr = testSession.getWorkspace().getVersionManager();
history = vMgr.getVersionHistory(testNode.getPath());
history.removeVersionLabel("testLabel");
}
use of javax.jcr.version.VersionHistory in project jackrabbit-oak by apache.
the class ReadVersionContentTest method testGetVersionHistory.
/**
* @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);
}
use of javax.jcr.version.VersionHistory in project jackrabbit-oak by apache.
the class ReadVersionContentTest method testVersionHistoryParent.
/**
* @since oak
*/
@Test
public void testVersionHistoryParent() 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 testVh = testNode.getVersionHistory();
try {
testVh.getParent();
fail("version storage intermediate node must not be accessible");
} catch (AccessDeniedException e) {
// success
}
}
use of javax.jcr.version.VersionHistory in project jackrabbit-oak by apache.
the class ReadVersionContentTest method testAccessVersionHistoryVersionableNodeNotAccessible.
/**
* @since oak
*/
@Test
public void testAccessVersionHistoryVersionableNodeNotAccessible() throws Exception {
// revert read permission on the versionable node
modify(versionablePath, Privilege.JCR_READ, false);
// versionable node is not readable any more for test session.
assertFalse(testSession.nodeExists(versionablePath));
// access version history directly => should fail
try {
VersionHistory history = (VersionHistory) testSession.getNode(vh.getPath());
fail("Access to version history should be denied if versionable node is not accessible");
} catch (PathNotFoundException e) {
// success
}
try {
VersionHistory history = (VersionHistory) testSession.getNodeByIdentifier(vh.getIdentifier());
fail("Access to version history should be denied if versionable node is not accessible");
} catch (ItemNotFoundException e) {
// success
}
try {
VersionHistory history = (VersionHistory) testSession.getNodeByUUID(vh.getUUID());
fail("Access to version history should be denied if versionable node is not accessible");
} catch (ItemNotFoundException e) {
// success
}
}
use of javax.jcr.version.VersionHistory in project jackrabbit-oak by apache.
the class ReadVersionContentTest method testGetAllLinearVersions.
/**
* @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();
}
Aggregations