// check if repository supports versioning
if (!isSupported(Repository.OPTION_VERSIONING_SUPPORTED)) {
throw new NotExecutableException();
}
Query query = superuser.getWorkspace().getQueryManager().createQuery(statement, Query.XPATH);
// create a node that is versionable
Node versionable = testRootNode.addNode(nodeName1, testNodeType);
// or try to make it versionable if it is not
if (!versionable.isNodeType(mixVersionable)) {
if (versionable.canAddMixin(mixVersionable)) {
versionable.addMixin(mixVersionable);
} else {
fail("Node " + nodeName1 + " is not versionable and does not allow to add mix:versionable");
}
}
testRootNode.save();
versionable.checkin();
try {
query.storeAsNode(testRoot + "/" + nodeName1 + "/" + nodeName2);
fail("Query.storeAsNode() must throw VersionException, parent node is checked in.");
} catch (VersionException e) {
// expected behaviour
}
}