[ https://issues.apache.org/jira/browse/AIRAVATA-2728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16463073#comment-16463073 ]
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_r185936226 ########## File path: modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentInputRepositoryTest.java ########## @@ -0,0 +1,116 @@ +/* + * + * 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.application.io.InputDataObjectType; +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.ArrayList; +import java.util.List; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class ExperimentInputRepositoryTest { + + private static Initialize initialize; + GatewayRepository gatewayRepository; + ProjectRepository projectRepository; + ExperimentRepository experimentRepository; + ExperimentInputRepository experimentInputRepository; + private static final Logger logger = LoggerFactory.getLogger(ExperimentInputRepositoryTest.class); + + @Before + public void setUp() { + try { + initialize = new Initialize("expcatalog-derby.sql"); + initialize.initializeDB(); + gatewayRepository = new GatewayRepository(); + projectRepository = new ProjectRepository(); + experimentRepository = new ExperimentRepository(); + experimentInputRepository = new ExperimentInputRepository(); + } catch (Exception e) { + logger.error(e.getMessage(), e); + } + } + + @After + public void tearDown() throws Exception { + System.out.println("********** TEAR DOWN ************"); + initialize.stopDerbyServer(); + } + + @Test + public void ExperimentInputRepositoryTest() 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); + + ExperimentModel experimentModel = new ExperimentModel(); + experimentModel.setProjectId(projectId); + experimentModel.setGatewayId(gatewayId); + experimentModel.setExperimentType(ExperimentType.SINGLE_APPLICATION); + experimentModel.setUserName("user"); + experimentModel.setExperimentName("name"); + + String experimentId = experimentRepository.addExperiment(experimentModel); + assertTrue(experimentId != null); + + InputDataObjectType inputDataObjectTypeExp = new InputDataObjectType(); + inputDataObjectTypeExp.setName("inputE"); Review comment: Can you test the other input fields as well? ---------------------------------------------------------------- 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)