// do a 'rollback'
s.refresh(false);
Node root = s.getRootNode();
Node testRootNode;
RetentionManager rm;
try {
rm = s.getRetentionManager();
} catch (UnsupportedRepositoryOperationException ex) {
rm = null;
}
if (root.hasNode(testPath)) {
// clean test root
testRootNode = root.getNode(testPath);
for (NodeIterator children = testRootNode.getNodes(); children.hasNext();) {
Node child = children.nextNode();
// Remove retention policy if needed
if (rm != null) {
RetentionPolicy pol = rm.getRetentionPolicy(child.getPath());
if (pol != null) {
rm.removeRetentionPolicy(child.getPath());
s.save();
}
}
NodeDefinition nodeDef = child.getDefinition();