use of javax.jcr.version.VersionManager in project jackrabbit-oak by apache.
the class VersionableTest method testRecreateVersionableNodeWithRemovedProperty.
// Oak-1272
public void testRecreateVersionableNodeWithRemovedProperty() throws Exception {
Node node = testRootNode.addNode(nodeName1, ntUnstructured);
node.addMixin(mixVersionable);
node.setProperty(propertyName1, "foo");
superuser.save();
VersionManager vm = superuser.getWorkspace().getVersionManager();
vm.checkin(node.getPath());
// re-create node
node.remove();
node = testRootNode.addNode(nodeName1, ntUnstructured);
node.addMixin(mixVersionable);
superuser.save();
}
use of javax.jcr.version.VersionManager in project jackrabbit-oak by apache.
the class VersionableTest method testSuccessorsPredecessorsMergedOnRemove.
// OAK-5193
public void testSuccessorsPredecessorsMergedOnRemove() throws Exception {
Node node = testRootNode.addNode(nodeName1, ntUnstructured);
node.addMixin(mixVersionable);
superuser.save();
VersionManager vm = superuser.getWorkspace().getVersionManager();
VersionHistory history = vm.getVersionHistory(node.getPath());
// 1.0
vm.checkpoint(node.getPath());
Version v11 = vm.checkpoint(node.getPath());
// 1.2
vm.checkpoint(node.getPath());
// 1.3
vm.checkpoint(node.getPath());
vm.restore(v11, true);
// 1.1
vm.checkpoint(node.getPath());
// 1.1.0
vm.checkpoint(node.getPath());
assertSuccessors(history, of("1.1.0", "1.2"), "1.1");
// 1.1.1
vm.checkpoint(node.getPath());
history.removeVersion("1.2");
assertSuccessors(history, of("1.1.0", "1.3"), "1.1");
}
use of javax.jcr.version.VersionManager in project jackrabbit-oak by apache.
the class VersionableTest method testRecreateVersionableNodeWithChangedProperty.
// Oak-1272
public void testRecreateVersionableNodeWithChangedProperty() throws Exception {
Node node = testRootNode.addNode(nodeName1, ntUnstructured);
node.addMixin(mixVersionable);
node.setProperty(propertyName1, "foo");
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.setProperty(propertyName1, "bar");
superuser.save();
}
use of javax.jcr.version.VersionManager in project jackrabbit-oak by apache.
the class VersionableTest method testRemoveAndCreateSameVersionableChildNode.
// OAK-1272
public void testRemoveAndCreateSameVersionableChildNode() throws Exception {
// create parent
Node parentNode = testRootNode.addNode("parent");
parentNode.setPrimaryType(ntUnstructured);
parentNode.setProperty("name", "sample");
// create a versionable child
Node createdNode = parentNode.addNode("versionablechild", "nt:unstructured");
createdNode.addMixin(mixVersionable);
superuser.save();
VersionManager vm = superuser.getWorkspace().getVersionManager();
vm.checkin(testRootNode.getPath() + "/parent/versionablechild");
// delete and create exact same node
Node parent = testRootNode.getNode("parent");
// remove children
NodeIterator nodes = parent.getNodes();
while (nodes.hasNext()) {
Node childNode = nodes.nextNode();
childNode.remove();
}
// create again versionable child node
Node recreatedNode = parent.addNode("versionablechild", ntUnstructured);
recreatedNode.addMixin(mixVersionable);
superuser.save();
}
use of javax.jcr.version.VersionManager in project jackrabbit-oak by apache.
the class VersionableTest method testGetTypeOfPredecessors.
public void testGetTypeOfPredecessors() throws RepositoryException {
Node node = testRootNode.addNode(nodeName1, testNodeType);
node.addMixin(mixVersionable);
superuser.save();
VersionManager vMgr = superuser.getWorkspace().getVersionManager();
vMgr.checkin(node.getPath());
assertEquals(PropertyType.nameFromValue(PropertyType.REFERENCE), PropertyType.nameFromValue(node.getProperty(jcrPredecessors).getType()));
}
Aggregations