Removing unwanted repositories and tests
MODIFY
modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentRepository.java
modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentRepository.java
@@ -24,6 +24,7 @@ import org.apache.airavata.model.application.io.InputDataObjectType;
import org.apache.airavata.model.application.io.OutputDataObjectType;
import org.apache.airavata.model.commons.ErrorModel;
import org.apache.airavata.model.experiment.ExperimentModel;
+import org.apache.airavata.model.experiment.UserConfigurationDataModel;
import org.apache.airavata.model.status.*;
import org.apache.airavata.registry.core.entities.expcatalog.*;
import org.apache.airavata.registry.core.utils.DBConstants;
@@ -114,6 +115,22 @@ public class ExperimentRepository extends ExpCatAbstractRepository<ExperimentMod
return get(experimentId);
}
+ public String addUserConfigurationData(UserConfigurationDataModel userConfigurationDataModel, String experimentId) throws RegistryException {
+ ExperimentModel experimentModel = getExperiment(experimentId);
+ experimentModel.setUserConfigurationData(userConfigurationDataModel);
+ updateExperiment(experimentModel, experimentId);
+ return experimentId;
+ }
+
+ public String updateUserConfigurationData(UserConfigurationDataModel updatedUserConfigurationDataModel, String experimentId) throws RegistryException {
+ return addUserConfigurationData(updatedUserConfigurationDataModel, experimentId);
+ }
+
+ public UserConfigurationDataModel getUserConfigurationData(String experimentId) throws RegistryException {
+ ExperimentModel experimentModel = getExperiment(experimentId);
+ return experimentModel.getUserConfigurationData();
+ }
+
public String addExperimentInputs(List<InputDataObjectType> experimentInputs, String experimentId) throws RegistryException {
ExperimentModel experimentModel = getExperiment(experimentId);
List<InputDataObjectType> inputDataObjectTypeList = experimentModel.getExperimentInputs();

MODIFY
modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessRepository.java
modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessRepository.java
@@ -5,6 +5,7 @@ import org.apache.airavata.model.application.io.OutputDataObjectType;
import org.apache.airavata.model.commons.ErrorModel;
import org.apache.airavata.model.experiment.ExperimentModel;
import org.apache.airavata.model.process.ProcessModel;
+import org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel;
import org.apache.airavata.model.status.ProcessStatus;
import org.apache.airavata.registry.core.entities.expcatalog.ProcessEntity;
import org.apache.airavata.registry.core.utils.DBConstants;
@@ -108,6 +109,22 @@ public class ProcessRepository extends ExpCatAbstractRepository<ProcessModel, Pr
return processRepository.get(processId);
}
+ public String addProcessResourceSchedule(ComputationalResourceSchedulingModel computationalResourceSchedulingModel, String processId) throws RegistryException {
+ ProcessModel processModel = getProcess(processId);
+ processModel.setProcessResourceSchedule(computationalResourceSchedulingModel);
+ updateProcess(processModel, processId);
+ return processId;
+ }
+
+ public String updateProcessResourceSchedule(ComputationalResourceSchedulingModel computationalResourceSchedulingModel, String processId) throws RegistryException {
+ return addProcessResourceSchedule(computationalResourceSchedulingModel, processId);
+ }
+
+ public ComputationalResourceSchedulingModel getProcessResourceSchedule(String processId) throws RegistryException {
+ ProcessModel processModel = getProcess(processId);
+ return processModel.getProcessResourceSchedule();
+ }
+
public String addProcessInputs(List<InputDataObjectType> processInputs, String processId) throws RegistryException {
ProcessModel processModel = getProcess(processId);
List<InputDataObjectType> inputDataObjectTypeList = processModel.getProcessInputs();

DELETE
modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessResourceScheduleRepository.java
-package org.apache.airavata.registry.core.repositories.expcatalog;
-
-import org.apache.airavata.model.process.ProcessModel;
-import org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel;
-import org.apache.airavata.registry.core.entities.expcatalog.ProcessResourceScheduleEntity;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ProcessResourceScheduleRepository extends ExpCatAbstractRepository<ComputationalResourceSchedulingModel, ProcessResourceScheduleEntity, String> {
- private final static Logger logger = LoggerFactory.getLogger(ProcessResourceScheduleRepository.class);
- private ProcessRepository processRepository = new ProcessRepository();
-
- public ProcessResourceScheduleRepository() { super(ComputationalResourceSchedulingModel.class, ProcessResourceScheduleEntity.class); }
-
- public String addProcessResourceSchedule(ComputationalResourceSchedulingModel computationalResourceSchedulingModel, String processId) throws RegistryException {
- ProcessModel processModel = processRepository.getProcess(processId);
- processModel.setProcessResourceSchedule(computationalResourceSchedulingModel);
- processRepository.updateProcess(processModel, processId);
- return processId;
- }
-
- public String updateProcessResourceSchedule(ComputationalResourceSchedulingModel computationalResourceSchedulingModel, String processId) throws RegistryException {
- return addProcessResourceSchedule(computationalResourceSchedulingModel, processId);
- }
-
- public ComputationalResourceSchedulingModel getProcessResourceSchedule(String processId) throws RegistryException {
- ProcessModel processModel = processRepository.getProcess(processId);
- return processModel.getProcessResourceSchedule();
- }
-
- public boolean isProcessResourceScheduleExist(String processId) throws RegistryException {
- return isExists(processId);
- }
-
- public void removeProcessResourceSchedule(String processId) throws RegistryException {
- delete(processId);
- }
-
-}
\ No newline at end of file

DELETE
modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/UserConfigurationDataRepository.java
-package org.apache.airavata.registry.core.repositories.expcatalog;
-
-import org.apache.airavata.model.experiment.ExperimentModel;
-import org.apache.airavata.model.experiment.UserConfigurationDataModel;
-import org.apache.airavata.registry.core.entities.expcatalog.UserConfigurationDataEntity;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserConfigurationDataRepository extends ExpCatAbstractRepository<UserConfigurationDataModel, UserConfigurationDataEntity, String> {
- private final static Logger logger = LoggerFactory.getLogger(UserConfigurationDataRepository.class);
- private ExperimentRepository experimentRepository = new ExperimentRepository();
-
- public UserConfigurationDataRepository() { super(UserConfigurationDataModel.class, UserConfigurationDataEntity.class); }
-
- public String addUserConfigurationData(UserConfigurationDataModel userConfigurationDataModel, String experimentId) throws RegistryException {
- ExperimentModel experimentModel = experimentRepository.getExperiment(experimentId);
- experimentModel.setUserConfigurationData(userConfigurationDataModel);
- experimentRepository.updateExperiment(experimentModel, experimentId);
- return experimentId;
- }
-
- public String updateUserConfigurationData(UserConfigurationDataModel updatedUserConfigurationDataModel, String experimentId) throws RegistryException {
- return addUserConfigurationData(updatedUserConfigurationDataModel, experimentId);
- }
-
- public UserConfigurationDataModel getUserConfigurationData(String experimentId) throws RegistryException {
- ExperimentModel experimentModel = experimentRepository.getExperiment(experimentId);
- return experimentModel.getUserConfigurationData();
- }
-
- public boolean isUserConfigurationDataExist(String experimentId) throws RegistryException {
- return isExists(experimentId);
- }
-
- public void removeUserConfigurationData(String experimentId) throws RegistryException {
- delete(experimentId);
- }
-
-}
\ No newline at end of file

MODIFY
modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentRepositoryTest.java
modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentRepositoryTest.java
@@ -30,7 +30,6 @@ public class ExperimentRepositoryTest {
private static Initialize initialize;
GatewayRepository gatewayRepository;
ProjectRepository projectRepository;
- UserConfigurationDataRepository userConfigurationDataRepository;
ExperimentRepository experimentRepository;
private static final Logger logger = LoggerFactory.getLogger(ExperimentRepositoryTest.class);
@@ -41,7 +40,6 @@ public class ExperimentRepositoryTest {
initialize.initializeDB();
gatewayRepository = new GatewayRepository();
projectRepository = new ProjectRepository();
- userConfigurationDataRepository = new UserConfigurationDataRepository();
experimentRepository = new ExperimentRepository();
} catch (Exception e) {
logger.error(e.getMessage(), e);
@@ -88,12 +86,12 @@ public class ExperimentRepositoryTest {
UserConfigurationDataModel userConfigurationDataModel = new UserConfigurationDataModel();
userConfigurationDataModel.setAiravataAutoSchedule(true);
userConfigurationDataModel.setOverrideManualScheduledParams(false);
- assertEquals(experimentId, userConfigurationDataRepository.addUserConfigurationData(userConfigurationDataModel, experimentId));
+ assertEquals(experimentId, experimentRepository.addUserConfigurationData(userConfigurationDataModel, experimentId));
userConfigurationDataModel.setStorageId("storage2");
- userConfigurationDataRepository.updateUserConfigurationData(userConfigurationDataModel, experimentId);
+ experimentRepository.updateUserConfigurationData(userConfigurationDataModel, experimentId);
- assertEquals("storage2", userConfigurationDataRepository.getUserConfigurationData(experimentId).getStorageId());
+ assertEquals("storage2", experimentRepository.getUserConfigurationData(experimentId).getStorageId());
InputDataObjectType inputDataObjectTypeExp = new InputDataObjectType();
inputDataObjectTypeExp.setName("inputE");

MODIFY
modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessRepositoryTest.java
modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessRepositoryTest.java
@@ -33,7 +33,6 @@ public class ProcessRepositoryTest {
ProjectRepository projectRepository;
ExperimentRepository experimentRepository;
ProcessRepository processRepository;
- ProcessResourceScheduleRepository processResourceScheduleRepository;
private static final Logger logger = LoggerFactory.getLogger(ProcessRepositoryTest.class);
@Before
@@ -45,7 +44,6 @@ public class ProcessRepositoryTest {
projectRepository = new ProjectRepository();
experimentRepository = new ExperimentRepository();
processRepository = new ProcessRepository();
- processResourceScheduleRepository = new ProcessResourceScheduleRepository();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
@@ -94,11 +92,11 @@ public class ProcessRepositoryTest {
assertEquals("detail", retrievedProcessModel.getProcessDetail());
ComputationalResourceSchedulingModel computationalResourceSchedulingModel = new ComputationalResourceSchedulingModel();
- assertEquals(processId, processResourceScheduleRepository.addProcessResourceSchedule(computationalResourceSchedulingModel, processId));
+ assertEquals(processId, processRepository.addProcessResourceSchedule(computationalResourceSchedulingModel, processId));
computationalResourceSchedulingModel.setQueueName("queue");
- processResourceScheduleRepository.updateProcessResourceSchedule(computationalResourceSchedulingModel, processId);
- assertEquals("queue", processResourceScheduleRepository.getProcessResourceSchedule(processId).getQueueName());
+ processRepository.updateProcessResourceSchedule(computationalResourceSchedulingModel, processId);
+ assertEquals("queue", processRepository.getProcessResourceSchedule(processId).getQueueName());
InputDataObjectType inputDataObjectProType = new InputDataObjectType();
inputDataObjectProType.setName("inputP");

DELETE
modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessResourceScheduleRepositoryTest.java
-package org.apache.airavata.registry.core.repositories.expcatalog;
-
-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;
-
-public class ProcessResourceScheduleRepositoryTest {
-
- private static Initialize initialize;
- ProcessResourceScheduleRepository processResourceScheduleRepository;
- private static final Logger logger = LoggerFactory.getLogger(ProcessResourceScheduleRepositoryTest.class);
-
- @Before
- public void setUp() {
- try {
- initialize = new Initialize("expcatalog-derby.sql");
- initialize.initializeDB();
- processResourceScheduleRepository = new ProcessResourceScheduleRepository();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- }
- }
-
- @After
- public void tearDown() throws Exception {
- System.out.println("********** TEAR DOWN ************");
- initialize.stopDerbyServer();
- }
-
- @Test
- public void ProcessResourceScheduleRepositoryTest() throws RegistryException {
-
- }
-
-}

DELETE
modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/UserConfigurationDataRepositoryTest.java
-package org.apache.airavata.registry.core.repositories.expcatalog;
-
-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;
-
-public class UserConfigurationDataRepositoryTest {
-
- private static Initialize initialize;
- UserConfigurationDataRepository userConfigurationDataRepository;
- private static final Logger logger = LoggerFactory.getLogger(UserConfigurationDataRepositoryTest.class);
-
- @Before
- public void setUp() {
- try {
- initialize = new Initialize("expcatalog-derby.sql");
- initialize.initializeDB();
- userConfigurationDataRepository = new UserConfigurationDataRepository();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- }
- }
-
- @After
- public void tearDown() throws Exception {
- System.out.println("********** TEAR DOWN ************");
- initialize.stopDerbyServer();
- }
-
- @Test
- public void UserConfigurationDataRepositoryTest() throws RegistryException {
-
- }
-
-}

Removing unwanted repositories and tests