\r
import org.apache.commons.logging.Log;\r
import org.apache.commons.logging.LogFactory;\r
-\r
import org.argeo.slc.core.process.SlcExecution;\r
import org.argeo.slc.core.test.TestRunDescriptor;\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
import org.argeo.slc.core.test.tree.TreeTestResultCollection;\r
import org.argeo.slc.dao.process.SlcExecutionDao;\r
import org.argeo.slc.dao.test.TestRunDescriptorDao;\r
\r
public void registerTestRunDescriptor(TestRunDescriptor testRunDescriptor) {\r
if (testRunDescriptor != null) {\r
- if (log.isDebugEnabled())\r
- log.debug("Updating test run descriptor with id "\r
- + testRunDescriptor.getTestRunUuid());\r
-\r
testRunDescriptorDao.saveOrUpdate(testRunDescriptor);\r
\r
// Update tree test result collection\r
// TODO: optimize\r
- SlcExecution slcExecution = slcExecutionDao\r
- .getSlcExecution(testRunDescriptor.getSlcExecutionUuid());\r
- if (slcExecution != null) {\r
- addResultToCollection(slcExecution.getUser(), testRunDescriptor\r
- .getTestResultUuid());\r
+\r
+ if (testRunDescriptor.getSlcExecutionUuid() != null) {\r
+ SlcExecution slcExecution = slcExecutionDao\r
+ .getSlcExecution(testRunDescriptor\r
+ .getSlcExecutionUuid());\r
+ if (slcExecution != null) {\r
+ String collectionId = slcExecution.getUser() != null ? slcExecution\r
+ .getUser()\r
+ : "default";\r
+ addResultToCollection(collectionId, testRunDescriptor\r
+ .getTestResultUuid());\r
+ }\r
}\r
}\r
}\r
ttrc = new TreeTestResultCollection(collectionId);\r
treeTestResultCollectionDao.create(ttrc);\r
}\r
- TreeTestResult ttr = treeTestResultDao.getTestResult(resultUuid);\r
- ttrc.getResults().add(ttr);\r
- treeTestResultCollectionDao.update(ttrc);\r
+ treeTestResultCollectionDao.addResultToCollection(ttrc, resultUuid);\r
}\r
\r
public void removeResultFromCollection(String collectionId,\r
TreeTestResultCollection ttrc = treeTestResultCollectionDao\r
.getTestResultCollection(collectionId);\r
if (ttrc != null) {\r
- TreeTestResult ttr = treeTestResultDao.getTestResult(resultUuid);\r
- if (ttrc.getResults().remove(ttr)) {\r
- treeTestResultCollectionDao.update(ttrc);\r
- }\r
+ treeTestResultCollectionDao.removeResultFromCollection(ttrc,\r
+ resultUuid);\r
}\r
}\r
\r