[ 
https://issues.apache.org/jira/browse/AIRAVATA-2728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16463068#comment-16463068
 ] 

ASF GitHub Bot commented on AIRAVATA-2728:
------------------------------------------

machristie commented on a change in pull request #191: [AIRAVATA-2728] 
Refactoring Experiment Catalog Implementation
URL: https://github.com/apache/airavata/pull/191#discussion_r185935553
 
 

 ##########
 File path: 
modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentErrorRepositoryTest.java
 ##########
 @@ -0,0 +1,113 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.registry.core.repositories.expcatalog;
+
+import org.apache.airavata.model.commons.ErrorModel;
+import org.apache.airavata.model.experiment.ExperimentModel;
+import org.apache.airavata.model.experiment.ExperimentType;
+import org.apache.airavata.model.workspace.Gateway;
+import org.apache.airavata.model.workspace.Project;
+import 
org.apache.airavata.registry.core.repositories.expcatalog.util.Initialize;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class ExperimentErrorRepositoryTest {
+
+    private static Initialize initialize;
+    GatewayRepository gatewayRepository;
+    ProjectRepository projectRepository;
+    ExperimentRepository experimentRepository;
+    ExperimentErrorRepository experimentErrorRepository;
+    private static final Logger logger = 
LoggerFactory.getLogger(ExperimentErrorRepositoryTest.class);
+
+    @Before
+    public void setUp() {
+        try {
+            initialize = new Initialize("expcatalog-derby.sql");
+            initialize.initializeDB();
+            gatewayRepository = new GatewayRepository();
+            projectRepository = new ProjectRepository();
+            experimentRepository = new ExperimentRepository();
+            experimentErrorRepository = new ExperimentErrorRepository();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        System.out.println("********** TEAR DOWN ************");
+        initialize.stopDerbyServer();
+    }
+
+    @Test
+    public void ExperimentRepositoryTest() throws RegistryException {
+        Gateway gateway = new Gateway();
+        gateway.setGatewayId("gateway");
+        gateway.setDomain("SEAGRID");
+        gateway.setEmailAddress("a...@d.com");
+        String gatewayId = gatewayRepository.addGateway(gateway);
+
+        Project project = new Project();
+        project.setName("projectName");
+        project.setOwner("user");
+        project.setGatewayId(gatewayId);
+
+        String projectId = projectRepository.addProject(project, gatewayId);
 
 Review comment:
   This should fail since the user isn't created yet. I wondered why it doesn't 
fail, and it turns out that expcatalog-derby.sql doesn't have the FK from 
Project.USER_NAME to the User table (which expcatalog-mysql.sql does have).
   
   I'm not sure what the best approach is. THere are two ways we could go:
   1. I don't think we technically need the expcatalog-derby.sql file since 
openjpa will create the schemas automatically. So we can just lean on that. 
We'll need to add the foreign keys references in the entities though (but we 
should in any case).
   2. If we do keep the expcatalog-derby.sql file then we need some way to keep 
it up to date with the entities.  But if we are just keeping it up to date with 
the entities then maybe there isn't really any point to having 
expcatalog-derby.sql.
   
   I think we should discuss this with @DImuthuUpe who has some ideas on doing 
regression testing.  In the meantime, for this particular issue, can you add 
the FOREIGN KEY to the expcatalog-derby.sql for the PROJECT table? Also, can 
you add a ManyToOne mapping from Project to User and also to Gateway?
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Refactoring Experiment Catalog Implementation
> ---------------------------------------------
>
>                 Key: AIRAVATA-2728
>                 URL: https://issues.apache.org/jira/browse/AIRAVATA-2728
>             Project: Airavata
>          Issue Type: Improvement
>          Components: Registry API
>            Reporter: Sneha Tilak
>            Assignee: Sneha Tilak
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to