public void addResultPart(TestResultPart testResultPart) {
Node node = getNode();
-
+
try {
-
- // error
- if (testResultPart.getExceptionMessage() != null)
- JcrUtils.discardQuietly(node.getSession());
+ // error : revert all unsaved changes on the resultNode to be sure
+ // it is in a consistant state
+ if (testResultPart.getExceptionMessage() != null)
+ JcrUtils.discardQuietly(node.getSession());
node.getSession().save();
-
+
// add the new result part, retrieving status information
Node resultPartNode = node.addNode(SlcNames.SLC_RESULT_PART,
SlcTypes.SLC_CHECK);
resultPartNode.setProperty(SLC_SUCCESS,
testResultPart.getStatus() == TestStatus.PASSED);
- // if (testResultPart.getMessage() != null)
- // resultPartNode.setProperty(SLC_MESSAGE,
- // testResultPart.getMessage());
+ if (testResultPart.getMessage() != null)
+ resultPartNode.setProperty(SLC_MESSAGE,
+ testResultPart.getMessage());
if (testResultPart.getStatus() == TestStatus.ERROR) {
resultPartNode.setProperty(SLC_ERROR_MESSAGE,
(testResultPart.getExceptionMessage() == null) ? ""
node.getSession().save();
} catch (Exception e) {
JcrUtils.discardUnderlyingSessionQuietly(node);
- throw new SlcException("Cannot get UUID from " + node, e);
+ throw new SlcException("Cannot add ResultPart to node " + node, e);
}
}