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;
}
}
use of javax.jcr.version.VersionManager in project jackrabbit by apache.
the class FrozenNodeTest method testFrozenNodeUUUID.
/**
* @throws RepositoryException
*/
public void testFrozenNodeUUUID() throws RepositoryException {
VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
String path = versionableNode.getPath();
Version v = versionManager.checkin(path);
Node n = v.getFrozenNode();
String puuid = n.getProperty(jcrUUID).getValue().getString();
String nuuid = n.getIdentifier();
assertEquals("jcr:uuid needs to be equal to the getIdentifier() return value.", nuuid, puuid);
}
use of javax.jcr.version.VersionManager in project jackrabbit by apache.
the class FrozenNodeTest method testFrozenChildNodeNodeType.
/**
* @throws RepositoryException
*/
public void testFrozenChildNodeNodeType() throws RepositoryException {
versionableNode.addNode("child");
versionableNode.getSession().save();
VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
String path = versionableNode.getPath();
Version v = versionManager.checkin(path);
Node n = v.getFrozenNode().getNode("child");
String puuid = n.getProperty(jcrPrimaryType).getValue().getString();
String nuuid = n.getPrimaryNodeType().getName();
assertEquals("jcr:primaryType needs to be equal to the getPrimaryNodeType() return value.", nuuid, puuid);
}
use of javax.jcr.version.VersionManager in project jackrabbit by apache.
the class FrozenNodeTest method testFrozenUUUID.
/**
* @throws RepositoryException
*/
public void testFrozenUUUID() throws RepositoryException, NotExecutableException {
// make versionable node referenceable
ensureMixinType(versionableNode, mixReferenceable);
versionableNode.getSession().save();
VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
String path = versionableNode.getPath();
Version v = versionManager.checkin(path);
Node n = v.getFrozenNode();
String fuuid = n.getProperty(jcrFrozenUuid).getValue().getString();
String ruuid = versionableNode.getIdentifier();
assertEquals("jcr:frozenUuid needs to be equal to the getIdentifier() return value.", ruuid, fuuid);
}
Aggregations