throws NotExecutableException, RepositoryException {
Session session = testRootNode.getSession();
if (!isSupported(Repository.OPTION_LOCKING_SUPPORTED)) {
throw new NotExecutableException("Locking is not supported.");
}
// create a node that is lockable
Node node = testRootNode.addNode(nodeName1, testNodeType);
// or try to make it lockable if it is not
if (!node.isNodeType(mixLockable)) {
if (node.canAddMixin(mixLockable)) {
node.addMixin(mixLockable);
} else {
throw new NotExecutableException("Node " + nodeName1 + " is not lockable and does not " +
"allow to add mix:lockable");
}
}
testRootNode.save();
String mixinName = NodeMixinUtil.getAddableMixinName(session, node);
if (mixinName == null) {
throw new NotExecutableException("No testable mixin node type found");
}
// remove first slash of path to get rel path to root
String pathRelToRoot = node.getPath().substring(1);