use of javax.jcr.version.VersionManager in project jackrabbit by apache.
the class CheckinTest method testCheckinCreatesNewVersionJcr2.
/**
* Test if VersionManager.checkin(String) adds another version to the VersionHistory
*
* @throws RepositoryException
*/
public void testCheckinCreatesNewVersionJcr2() throws RepositoryException {
VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
String path = versionableNode.getPath();
long initialNumberOfVersions = getNumberOfVersions(versionManager.getVersionHistory(path));
versionManager.checkin(path);
long numberOfVersions = getNumberOfVersions(versionManager.getVersionHistory(path));
assertTrue("Checkin must create a new Version in the VersionHistory.", numberOfVersions == initialNumberOfVersions + 1);
}
use of javax.jcr.version.VersionManager in project jackrabbit by apache.
the class CheckoutTest method setUp.
protected void setUp() throws Exception {
super.setUp();
VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
String path = versionableNode.getPath();
if (!versionManager.isCheckedOut(path)) {
fail("A versionable node must be checked-out after persistent creation.");
}
if (!versionableNode.isCheckedOut()) {
fail("A versionable node must be checked-out after persistent creation.");
}
try {
versionManager.checkin(path);
} catch (RepositoryException e) {
cleanUp();
throw e;
}
}
use of javax.jcr.version.VersionManager in project jackrabbit by apache.
the class CheckoutTest method testCheckoutTwiceDoesNotThrowJcr2.
/**
* Test if VersionManager.checkout(P) doesn't throw any exception if P
* denotes the absolute path of a versionable node that has been checked
* out before.
*/
public void testCheckoutTwiceDoesNotThrowJcr2() throws RepositoryException {
VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
String path = versionableNode.getPath();
versionManager.checkout(path);
versionManager.checkout(path);
}
use of javax.jcr.version.VersionManager in project jackrabbit by apache.
the class CopyTest method testCopy.
public void testCopy() throws RepositoryException {
Workspace wsp = superuser.getWorkspace();
VersionManager vMgr = wsp.getVersionManager();
String srcPath = versionableNode.getPath();
String dstPath = getProperty("destination");
wsp.copy(srcPath, dstPath);
// check versionable
Node v = superuser.getNode(dstPath);
assertTrue("Copied Node.isNodeType(mix:simpleVersionable) must return true.", v.isNodeType(mixSimpleVersionable));
assertFalse("Copied Node.isNodeType(mix:versionable) must return false.", v.isNodeType(mixVersionable));
// check different version history
VersionHistory vh1 = vMgr.getVersionHistory(srcPath);
VersionHistory vh2 = vMgr.getVersionHistory(dstPath);
assertFalse("Copied node needs a new version history.", vh1.isSame(vh2));
// check if 1 version
assertEquals("Copied node must have 1 version.", 1, getNumberOfVersions(vh2));
}
use of javax.jcr.version.VersionManager in project jackrabbit by apache.
the class FrozenNodeTest method setUp.
protected void setUp() throws Exception {
super.setUp();
try {
VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
String path = versionableNode.getPath();
versionManager.checkout(path);
} catch (RepositoryException e) {
cleanUp();
throw e;
}
}
Aggregations