use of javax.jcr.version.VersionManager in project jackrabbit-oak by apache.
the class VersionableTest method testReferenceableChild.
public void testReferenceableChild() throws RepositoryException {
Node node = testRootNode.addNode(nodeName1, ntUnstructured);
node.addMixin(mixVersionable);
Node child = node.addNode(nodeName2, ntUnstructured);
child.addMixin(mixReferenceable);
superuser.save();
VersionManager vMgr = superuser.getWorkspace().getVersionManager();
vMgr.checkin(node.getPath());
}
use of javax.jcr.version.VersionManager in project jackrabbit-oak by apache.
the class VersionableTest method testRecreateVersionableNodeWithAddedChild.
// Oak-1272
public void testRecreateVersionableNodeWithAddedChild() throws Exception {
Node node = testRootNode.addNode(nodeName1, ntUnstructured);
node.addMixin(mixVersionable);
superuser.save();
VersionManager vm = superuser.getWorkspace().getVersionManager();
vm.checkin(node.getPath());
// re-create node
node.remove();
node = testRootNode.addNode(nodeName1, ntUnstructured);
node.addMixin(mixVersionable);
node.addNode(nodeName2, ntUnstructured).setProperty(propertyName1, "bar");
superuser.save();
}
use of javax.jcr.version.VersionManager in project jackrabbit-oak by apache.
the class ReferencesTest method testVersionReferencesVH.
public void testVersionReferencesVH() throws RepositoryException {
Node n = testRootNode.addNode(nodeName1, testNodeType);
n.addMixin(mixVersionable);
superuser.save();
String p = n.getPath();
VersionManager vMgr = superuser.getWorkspace().getVersionManager();
VersionHistory vh = vMgr.getVersionHistory(p);
// check if versionable node has references to root version
assertEquals("Version History", vh.getIdentifier(), n.getProperty(Property.JCR_VERSION_HISTORY).getString());
checkReferences("Version History", vh.getReferences(), p + "/jcr:versionHistory");
}
use of javax.jcr.version.VersionManager in project jackrabbit-oak by apache.
the class ReferencesTest method testVersionedReferences.
// OAK-1196 - Node.getReferences() should not show references in frozen nodes
public void testVersionedReferences() throws RepositoryException {
Node ref = testRootNode.addNode(nodeName2, testNodeType);
ref.addMixin(mixReferenceable);
superuser.save();
Node n = testRootNode.addNode(nodeName1, testNodeType);
n.addMixin(mixVersionable);
n.setProperty("myref", ref);
superuser.save();
String p = n.getPath();
VersionManager vMgr = superuser.getWorkspace().getVersionManager();
Version v1 = vMgr.checkpoint(p);
Node frozen = v1.getFrozenNode();
assertEquals("ref", ref.getPath(), frozen.getProperty("myref").getNode().getPath());
checkReferences("ref in version store", ref.getReferences(), n.getPath() + "/myref");
// also test what happens if node is removed
n.remove();
ref.remove();
superuser.save();
try {
frozen.getProperty("myref").getNode();
fail("removed reference should not be accessible");
} catch (ItemNotFoundException e) {
// ok
}
}
use of javax.jcr.version.VersionManager in project jackrabbit-oak by apache.
the class ReferencesTest method testVersionReferencesV0.
public void testVersionReferencesV0() throws RepositoryException {
Node n = testRootNode.addNode(nodeName1, testNodeType);
n.addMixin(mixVersionable);
superuser.save();
String p = n.getPath();
VersionManager vMgr = superuser.getWorkspace().getVersionManager();
Version v0 = vMgr.getVersionHistory(p).getRootVersion();
// check if versionable node has references to root version
assertEquals("Root Version", v0.getIdentifier(), n.getProperty(Property.JCR_BASE_VERSION).getString());
assertEquals("Root Version", v0.getIdentifier(), n.getProperty(Property.JCR_PREDECESSORS).getValues()[0].getString());
checkReferences("Root Version", v0.getReferences(), p + "/jcr:baseVersion", p + "/jcr:predecessors");
}
Aggregations