airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata] branch group-based-auth updated: AIRAVATA-2819 Fix tests affected by implicit CREATED status
Date Mon, 11 Jun 2018 13:58:37 GMT
This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch group-based-auth
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/group-based-auth by this push:
     new 3f4b69f  AIRAVATA-2819 Fix tests affected by implicit CREATED status
3f4b69f is described below

commit 3f4b69ff2f39be4783600a146a02b101d19b2d81
Author: Marcus Christie <machristie@apache.org>
AuthorDate: Mon Jun 11 09:57:15 2018 -0400

    AIRAVATA-2819 Fix tests affected by implicit CREATED status
---
 .../core/repositories/expcatalog/ExperimentStatusRepository.java    | 2 ++
 .../repositories/expcatalog/ExperimentStatusRepositoryTest.java     | 6 ++++--
 .../repositories/expcatalog/ExperimentSummaryRepositoryTest.java    | 6 +++++-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentStatusRepository.java
b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentStatusRepository.java
index a09a024..0babd10 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentStatusRepository.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentStatusRepository.java
@@ -20,6 +20,7 @@
 */
 package org.apache.airavata.registry.core.repositories.expcatalog;
 
+import org.apache.airavata.common.utils.AiravataUtils;
 import org.apache.airavata.model.experiment.ExperimentModel;
 import org.apache.airavata.model.status.ExperimentState;
 import org.apache.airavata.model.status.ExperimentStatus;
@@ -59,6 +60,7 @@ public class ExperimentStatusRepository extends ExpCatAbstractRepository<Experim
             logger.debug("Setting the ExperimentStatus's StatusId");
             experimentStatus.setStatusId(ExpCatalogUtils.getID("EXPERIMENT_STATE"));
         }
+        experimentStatus.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
 
         return saveExperimentStatus(experimentStatus, experimentId);
     }
diff --git a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentStatusRepositoryTest.java
b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentStatusRepositoryTest.java
index 4cfbec2..c6f4de8 100644
--- a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentStatusRepositoryTest.java
+++ b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentStatusRepositoryTest.java
@@ -90,11 +90,13 @@ public class ExperimentStatusRepositoryTest {
 
         String experimentId = experimentRepository.addExperiment(experimentModel);
         assertTrue(experimentId != null);
+        // addExperiment adds the CREATED experiment status
+        assertEquals(1, experimentRepository.getExperiment(experimentId).getExperimentStatus().size());
 
-        ExperimentStatus experimentStatus = new ExperimentStatus(ExperimentState.CREATED);
+        ExperimentStatus experimentStatus = new ExperimentStatus(ExperimentState.VALIDATED);
         String experimentStatusId = experimentStatusRepository.addExperimentStatus(experimentStatus,
experimentId);
         assertTrue(experimentStatusId != null);
-        assertTrue(experimentRepository.getExperiment(experimentId).getExperimentStatus().size()
== 1);
+        assertEquals(2, experimentRepository.getExperiment(experimentId).getExperimentStatus().size());
 
         experimentStatus.setState(ExperimentState.EXECUTING);
         experimentStatusRepository.updateExperimentStatus(experimentStatus, experimentId);
diff --git a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentSummaryRepositoryTest.java
b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentSummaryRepositoryTest.java
index 2641452..84e79d7 100644
--- a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentSummaryRepositoryTest.java
+++ b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentSummaryRepositoryTest.java
@@ -109,9 +109,13 @@ public class ExperimentSummaryRepositoryTest {
 
         String experimentIdOne = experimentRepository.addExperiment(experimentModelOne);
         assertTrue(experimentIdOne != null);
+        // Reload experiment to get its status' identifier
+        experimentModelOne = experimentRepository.getExperiment(experimentIdOne);
 
         String expertimentIdTwo = experimentRepository.addExperiment(experimentModelTwo);
         assertTrue(expertimentIdTwo != null);
+        // Reload experiment to get its status' identifier
+        experimentModelTwo = experimentRepository.getExperiment(expertimentIdTwo);
 
         Timestamp timeOne = Timestamp.valueOf("2010-01-01 09:00:00");
         experimentModelOne.setCreationTime(timeOne.getTime());
@@ -127,7 +131,7 @@ public class ExperimentSummaryRepositoryTest {
 
         List<ExperimentSummaryModel> experimentSummaryModelList = experimentSummaryRepository.
                 searchExperiments(filters, -1, 0, null, null);
-        assertTrue(experimentSummaryModelList.size() == 2);
+        assertEquals(2, experimentSummaryModelList.size());
 
         filters.put(DBConstants.Experiment.EXECUTION_ID, "executionIdTwo");
 

-- 
To stop receiving notification emails like this one, please contact
machristie@apache.org.

Mime
View raw message