You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2017/12/15 16:43:04 UTC
[airavata] 04/20: Repository Test for Experiment Catalog
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch registry-refactoring
in repository https://gitbox.apache.org/repos/asf/airavata.git
commit 9edef9b8fd2d828472065856bb8e643f1904cd7d
Author: Abhiit Karanjkar <ay...@indiana.edu>
AuthorDate: Fri Sep 30 10:10:06 2016 -0400
Repository Test for Experiment Catalog
---
.../registry/core/repositories/RepositoryTest.java | 95 +++++++++++++++++++++-
1 file changed, 94 insertions(+), 1 deletion(-)
diff --git a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/RepositoryTest.java b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/RepositoryTest.java
index 53d77f1..ec1e4a0 100644
--- a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/RepositoryTest.java
+++ b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/RepositoryTest.java
@@ -56,15 +56,19 @@ public class RepositoryTest {
private NotificationRepository notificationRepository;
private UserProfileRepository userProfileRepository;
private ProjectRepository projectRepository;
+ private ExperimentRepository experimentRepository;
private String gatewayId;
private String notificationId;
private String userId;
private String projectId;
+ private String experimentId;
private final String GATEWAY_DOMAIN = "test1.com";
private final String NOTIFY_MESSAGE = "NotifyMe";
private final String USER_COMMENT = "TestComment";
private final String PROJECT_DESCRIPTION = "Test Description";
+ private final String EXPERIMENT_NAME = "sample experiment";
+ private final String EXPERIMENT_DESCRIPTION = "sample description";
@Before
public void setupRepository() {
@@ -74,11 +78,13 @@ public class RepositoryTest {
NotificationEntity.class);
userProfileRepository = new UserProfileRepository(UserProfile.class, UserProfileEntity.class);
projectRepository = new ProjectRepository(Project.class, ProjectEntity.class);
+ experimentRepository = new ExperimentRepository(ExperimentModel.class, ExperimentEntity.class);
gatewayId = "test.com" + System.currentTimeMillis();
notificationId = UUID.randomUUID().toString();
userId = "testuser" + System.currentTimeMillis();
- projectId = "project" + System.currentTimeMillis();;
+ projectId = "project" + System.currentTimeMillis();
+ experimentId = "exp" + System.currentTimeMillis();
}
@@ -288,4 +294,91 @@ public class RepositoryTest {
}
+
+ @Test
+ public void experimentRepositoryTest() {
+
+ /*
+ * Creating Gateway required for UserProfile & Project creation
+ */
+ Gateway gateway = new Gateway();
+ gateway.setGatewayApprovalStatus(GatewayApprovalStatus.ACTIVE);
+ gateway.setGatewayId(gatewayId);
+ gateway.setDomain(GATEWAY_DOMAIN);
+ gateway = gatewayRepository.create(gateway);
+ Assert.assertTrue(!gateway.getGatewayId().isEmpty());
+
+ /*
+ * UserProfile Instance creation required for Project Creation
+ */
+ UserProfile userProfile = new UserProfile();
+ userProfile.setAiravataInternalUserId(userId);
+ userProfile.setGatewayId(gateway.getGatewayId());
+ userProfile = userProfileRepository.create(userProfile);
+ Assert.assertTrue(!userProfile.getAiravataInternalUserId().isEmpty());
+
+ /*
+ * Project Instance creation
+ */
+ Project project = new Project();
+ project.setGatewayId(gatewayId);
+ project.setOwner(userId);
+ project.setProjectID(projectId);
+ project.setGatewayIdIsSet(true);
+ project = projectRepository.create(project);
+ Assert.assertTrue(!project.getProjectID().isEmpty());
+
+ /*
+ * Experiment Instance Creation
+ */
+
+ ExperimentModel experiment = new ExperimentModel();
+ experiment.setExperimentId(experimentId);
+ experiment.setExperimentName(EXPERIMENT_NAME);
+ experiment.setGatewayId(gatewayId);
+ experiment.setUserName(userId);
+ experiment.setProjectId(projectId);
+
+ /*
+ * Experiment Repository Insert Operation Test
+ */
+ experiment = experimentRepository.create(experiment);
+ Assert.assertTrue(!experiment.getExperimentId().isEmpty());
+
+
+
+
+ /*
+ * Experiment Repository Update Operation Test
+ */
+ experiment.setDescription(EXPERIMENT_DESCRIPTION);
+ experimentRepository.update(experiment);
+ experiment = experimentRepository.get(experimentId);
+ Assert.assertEquals(experiment.getDescription(), EXPERIMENT_DESCRIPTION);
+
+ /*
+ * Workspace Project Repository Select Operation Test
+ */
+ experiment = null;
+ experiment = experimentRepository.get(experimentId);
+ Assert.assertNotNull(experiment);
+
+ /*
+ * Experiment Repository Delete Operation
+ */
+
+ boolean deleteResult = experimentRepository.delete(experimentId);
+ Assert.assertTrue(deleteResult);
+
+ deleteResult = projectRepository.delete(projectId);
+ Assert.assertTrue(deleteResult);
+
+ deleteResult = userProfileRepository.delete(userId);
+ Assert.assertTrue(deleteResult);
+
+ deleteResult = gatewayRepository.delete(gatewayId);
+ Assert.assertTrue(deleteResult);
+
+
+ }
}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <co...@airavata.apache.org>.