X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.server%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fservices%2Ftest%2Fimpl%2FTestManagerServiceImpl.java;fp=org.argeo.slc.server%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fservices%2Ftest%2Fimpl%2FTestManagerServiceImpl.java;h=0000000000000000000000000000000000000000;hb=cdb5a9f10678f41914d6eeebd6620c0a84dbd208;hp=b9a3a7045b6a14e0dad8c8950b141443d365876a;hpb=7a8f034133c1112e187e2a2bfd2c56a8d2452345;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.server/src/main/java/org/argeo/slc/services/test/impl/TestManagerServiceImpl.java b/org.argeo.slc.server/src/main/java/org/argeo/slc/services/test/impl/TestManagerServiceImpl.java deleted file mode 100644 index b9a3a7045..000000000 --- a/org.argeo.slc.server/src/main/java/org/argeo/slc/services/test/impl/TestManagerServiceImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.argeo.slc.services.test.impl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.core.process.SlcExecution; -import org.argeo.slc.core.test.TestRunDescriptor; -import org.argeo.slc.core.test.tree.TreeTestResultCollection; -import org.argeo.slc.dao.process.SlcExecutionDao; -import org.argeo.slc.dao.test.TestRunDescriptorDao; -import org.argeo.slc.dao.test.tree.TreeTestResultCollectionDao; -import org.argeo.slc.dao.test.tree.TreeTestResultDao; -import org.argeo.slc.services.test.TestManagerService; - -public class TestManagerServiceImpl implements TestManagerService { - private Log log = LogFactory.getLog(getClass()); - - private final TreeTestResultDao treeTestResultDao; - private final TestRunDescriptorDao testRunDescriptorDao; - private final SlcExecutionDao slcExecutionDao; - private final TreeTestResultCollectionDao treeTestResultCollectionDao; - - public TestManagerServiceImpl(TreeTestResultDao treeTestResultDao, - TestRunDescriptorDao testRunDescriptorDao, - SlcExecutionDao slcExecutionDao, - TreeTestResultCollectionDao treeTestResultCollectionDao) { - this.treeTestResultDao = treeTestResultDao; - this.testRunDescriptorDao = testRunDescriptorDao; - this.slcExecutionDao = slcExecutionDao; - this.treeTestResultCollectionDao = treeTestResultCollectionDao; - } - - public void registerTestRunDescriptor(TestRunDescriptor testRunDescriptor) { - if (testRunDescriptor != null) { - testRunDescriptorDao.saveOrUpdate(testRunDescriptor); - - // Update tree test result collection - // TODO: optimize - - if (testRunDescriptor.getSlcExecutionUuid() != null) { - SlcExecution slcExecution = slcExecutionDao - .getSlcExecution(testRunDescriptor - .getSlcExecutionUuid()); - if (slcExecution != null) { - String collectionId = slcExecution.getUser() != null ? slcExecution - .getUser() - : "default"; - addResultToCollection(collectionId, testRunDescriptor - .getTestResultUuid()); - } - } - } - } - - public void addResultToCollection(String collectionId, String resultUuid) { - TreeTestResultCollection ttrc = treeTestResultCollectionDao - .getTestResultCollection(collectionId); - if (ttrc == null) { - ttrc = new TreeTestResultCollection(collectionId); - treeTestResultCollectionDao.create(ttrc); - } - treeTestResultCollectionDao.addResultToCollection(ttrc, resultUuid); - } - - public void removeResultFromCollection(String collectionId, - String resultUuid) { - TreeTestResultCollection ttrc = treeTestResultCollectionDao - .getTestResultCollection(collectionId); - if (ttrc != null) { - treeTestResultCollectionDao.removeResultFromCollection(ttrc, - resultUuid); - } - } - -}