1 package org
.argeo
.slc
.services
.test
.impl
;
3 import org
.apache
.commons
.logging
.Log
;
4 import org
.apache
.commons
.logging
.LogFactory
;
5 import org
.argeo
.slc
.core
.process
.SlcExecution
;
6 import org
.argeo
.slc
.core
.test
.TestRunDescriptor
;
7 import org
.argeo
.slc
.core
.test
.tree
.TreeTestResultCollection
;
8 import org
.argeo
.slc
.dao
.process
.SlcExecutionDao
;
9 import org
.argeo
.slc
.dao
.test
.TestRunDescriptorDao
;
10 import org
.argeo
.slc
.dao
.test
.tree
.TreeTestResultCollectionDao
;
11 import org
.argeo
.slc
.dao
.test
.tree
.TreeTestResultDao
;
12 import org
.argeo
.slc
.services
.test
.TestManagerService
;
14 public class TestManagerServiceImpl
implements TestManagerService
{
15 private Log log
= LogFactory
.getLog(getClass());
17 private final TreeTestResultDao treeTestResultDao
;
18 private final TestRunDescriptorDao testRunDescriptorDao
;
19 private final SlcExecutionDao slcExecutionDao
;
20 private final TreeTestResultCollectionDao treeTestResultCollectionDao
;
22 public TestManagerServiceImpl(TreeTestResultDao treeTestResultDao
,
23 TestRunDescriptorDao testRunDescriptorDao
,
24 SlcExecutionDao slcExecutionDao
,
25 TreeTestResultCollectionDao treeTestResultCollectionDao
) {
26 this.treeTestResultDao
= treeTestResultDao
;
27 this.testRunDescriptorDao
= testRunDescriptorDao
;
28 this.slcExecutionDao
= slcExecutionDao
;
29 this.treeTestResultCollectionDao
= treeTestResultCollectionDao
;
32 public void registerTestRunDescriptor(TestRunDescriptor testRunDescriptor
) {
33 if (testRunDescriptor
!= null) {
34 testRunDescriptorDao
.saveOrUpdate(testRunDescriptor
);
36 // Update tree test result collection
39 if (testRunDescriptor
.getSlcExecutionUuid() != null) {
40 SlcExecution slcExecution
= slcExecutionDao
41 .getSlcExecution(testRunDescriptor
42 .getSlcExecutionUuid());
43 if (slcExecution
!= null) {
44 String collectionId
= slcExecution
.getUser() != null ? slcExecution
47 addResultToCollection(collectionId
, testRunDescriptor
48 .getTestResultUuid());
54 public void addResultToCollection(String collectionId
, String resultUuid
) {
55 TreeTestResultCollection ttrc
= treeTestResultCollectionDao
56 .getTestResultCollection(collectionId
);
58 ttrc
= new TreeTestResultCollection(collectionId
);
59 treeTestResultCollectionDao
.create(ttrc
);
61 treeTestResultCollectionDao
.addResultToCollection(ttrc
, resultUuid
);
64 public void removeResultFromCollection(String collectionId
,
66 TreeTestResultCollection ttrc
= treeTestResultCollectionDao
67 .getTestResultCollection(collectionId
);
69 treeTestResultCollectionDao
.removeResultFromCollection(ttrc
,