message: Modifying tests

diff:
@@ -22,18 +22,16 @@ package org.apache.airavata.registry.core.repositories;
import org.apache.airavata.model.user.UserProfile;
import org.apache.airavata.model.workspace.Gateway;
-import org.apache.airavata.model.workspace.GatewayApprovalStatus;
import org.apache.airavata.model.workspace.Notification;
import org.apache.airavata.model.workspace.Project;
-import org.apache.airavata.registry.core.entities.workspacecatalog.GatewayEntity;
-import org.apache.airavata.registry.core.entities.workspacecatalog.NotificationEntity;
-import org.apache.airavata.registry.core.entities.workspacecatalog.ProjectEntity;
+import org.apache.airavata.registry.core.entities.expcatalog.GatewayEntity;
+import org.apache.airavata.registry.core.entities.expcatalog.NotificationEntity;
+import org.apache.airavata.registry.core.entities.expcatalog.ProjectEntity;
import org.apache.airavata.registry.core.entities.workspacecatalog.UserProfileEntity;
-import org.apache.airavata.registry.core.repositories.workspacecatalog.GatewayRepository;
-import org.apache.airavata.registry.core.repositories.workspacecatalog.NotificationRepository;
-import org.apache.airavata.registry.core.repositories.workspacecatalog.ProjectRepository;
+import org.apache.airavata.registry.core.repositories.expcatalog.GatewayRepository;
+import org.apache.airavata.registry.core.repositories.expcatalog.NotificationRepository;
+import org.apache.airavata.registry.core.repositories.expcatalog.ProjectRepository;
import org.apache.airavata.registry.core.repositories.workspacecatalog.UserProfileRepository;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
@@ -62,7 +60,7 @@ public class WorkspaceRepositoryTest {
@Before
public void setupRepository() {
- gatewayRepository = new GatewayRepository(Gateway.class, GatewayEntity.class);
+ /*gatewayRepository = new GatewayRepository(Gateway.class, GatewayEntity.class);
notificationRepository = new NotificationRepository(Notification.class,
NotificationEntity.class);
userProfileRepository = new UserProfileRepository(UserProfile.class, UserProfileEntity.class);
@@ -71,7 +69,7 @@ public class WorkspaceRepositoryTest {
gatewayId = "test.com" + System.currentTimeMillis();
notificationId = UUID.randomUUID().toString();
userId = "testuser" + System.currentTimeMillis();
- projectId = "project" + System.currentTimeMillis();
+ projectId = "project" + System.currentTimeMillis();*/
}

diff:
-/*
- *
- * 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;
-
-import org.apache.airavata.model.experiment.ExperimentModel;
-import org.apache.airavata.model.user.UserProfile;
-import org.apache.airavata.model.workspace.Gateway;
-import org.apache.airavata.model.workspace.Project;
-import org.apache.airavata.registry.core.entities.expcatalog.ExperimentEntity;
-import org.apache.airavata.registry.core.entities.expcatalog.GatewayEntity;
-import org.apache.airavata.registry.core.entities.expcatalog.ProjectEntity;
-import org.apache.airavata.registry.core.entities.workspacecatalog.UserProfileEntity;
-import org.apache.airavata.registry.core.repositories.expcatalog.ExperimentRepository;
-import org.apache.airavata.registry.core.repositories.expcatalog.GatewayRepository;
-import org.apache.airavata.registry.core.repositories.expcatalog.ProjectRepository;
-import org.apache.airavata.registry.core.repositories.workspacecatalog.UserProfileRepository;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ExperimentRepositoryTest {
- private final static Logger logger = LoggerFactory.getLogger(ExperimentRepositoryTest.class);
-
- private GatewayRepository gatewayRepository;
- private UserProfileRepository userProfileRepository;
- private ProjectRepository projectRepository;
- private ExperimentRepository experimentRepository;
- private String gatewayId;
- private String userId;
- private String projectId;
- private String experimentId;
-
- private final String GATEWAY_DOMAIN = "test1.com";
- private final String EXPERIMENT_NAME = "sample experiment";
- private final String EXPERIMENT_DESCRIPTION = "sample description";
-
-
- @Before
- public void setupRepository() {
-
- gatewayRepository = new GatewayRepository(Gateway.class, GatewayEntity.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();
- userId = "testuser" + System.currentTimeMillis();
- projectId = "project" + System.currentTimeMillis();
- experimentId = "exp" + System.currentTimeMillis();
- }
-
- @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 = 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

original_message: Modifying tests


message: Making changes to repository classes

change_type: ADD

diff:
+/**
+ *
+ * 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.entities.expcatalog;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+/**
+ * The class for the experiment_summary view.
+ */
+@Entity
+@Table(name = "EXPERIMENT_SUMMARY")
+public class ExperimentSummaryEntity implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @Column(name = "EXPERIMENT_ID")
+ private String experimentId;
+
+ @Column(name = "PROJECT_ID")
+ private String projectId;
+
+ @Column(name = "GATEWAY_ID")
+ private String gatewayId;
+
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+
+ @Column(name = "USER_NAME")
+ private String userName;
+
+ @Column(name = "EXPERIMENT_NAME")
+ private String name;
+
+ @Column(name = "DESCRIPTION")
+ private String description;
+
+ @Column(name = "EXECUTION_ID")
+ private String executionId;
+
+ @Column(name = "STATE")
+ private String state;
+
+ @Column(name = "RESOURCE_HOST_ID")
+ private String resourceHostId;
+
+ @Column(name = "TIME_OF_STATE_CHANGE")
+ private Timestamp statusUpdateTime;
+
+ public ExperimentSummaryEntity() {
+ }
+
+ public String getExperimentId() {
+ return experimentId;
+ }
+
+ public void setExperimentId(String experimentId) {
+ this.experimentId = experimentId;
+ }
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getExecutionId() {
+ return executionId;
+ }
+
+ public void setExecutionId(String executionId) {
+ this.executionId = executionId;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public String getResourceHostId() {
+ return resourceHostId;
+ }
+
+ public void setResourceHostId(String resourceHostId) {
+ this.resourceHostId = resourceHostId;
+ }
+
+ public Timestamp getStatusUpdateTime() {
+ return statusUpdateTime;
+ }
+
+ public void setStatusUpdateTime(Timestamp statusUpdateTime) {
+ this.statusUpdateTime = statusUpdateTime;
+ }
+}

change_type: MODIFY

diff:
@@ -29,19 +29,19 @@ public class JobStatusPK implements Serializable {
//default serial version id, required for serializable classes.
private static final long serialVersionUID = 1L;
- private String stateId;
+ private String statusId;
private String jobId;
private String taskId;
public JobStatusPK() {
}
- public String getStateId() {
- return stateId;
+ public String getStatusId() {
+ return statusId;
}
- public void setStateId(String stateId) {
- this.stateId = stateId;
+ public void setStatusId(String statusId) {
+ this.statusId = statusId;
}
public String getJobId() {
@@ -69,7 +69,7 @@ public class JobStatusPK implements Serializable {
}
JobStatusPK castOther = (JobStatusPK) other;
return
- this.stateId.equals(castOther.stateId)
+ this.statusId.equals(castOther.statusId)
&& this.jobId.equals(castOther.jobId)
&& this.taskId.equals(castOther.taskId);
}
@@ -77,7 +77,7 @@ public class JobStatusPK implements Serializable {
public int hashCode() {
final int prime = 31;
int hash = 17;
- hash = hash * prime + this.stateId.hashCode();
+ hash = hash * prime + this.statusId.hashCode();
hash = hash * prime + this.jobId.hashCode();
hash = hash * prime + this.taskId.hashCode();

diff:
@@ -511,7 +511,7 @@ public class ExperimentRepository extends ExpCatAbstractRepository<ExperimentMod
}*/
public List<ExperimentModel> getExperimentList(String fieldName, Object value) throws RegistryException {
- return getExperimentList(fieldName, value, -1, -1, null, null);
+ return getExperimentList(fieldName, value, -1, 0, null, null);
}
public List<ExperimentModel> getExperimentList(String fieldName, Object value, int limit, int offset,
@@ -522,21 +522,21 @@ public class ExperimentRepository extends ExpCatAbstractRepository<ExperimentMod
logger.debug("Search criteria is Username");
Map<String, Object> queryParameters = new HashMap<>();
queryParameters.put(DBConstants.Experiment.USER_NAME, value);
- experimentModelList = select(QueryConstants.GET_EXPERIMENTS_FOR_USER, -1, 0, queryParameters);
+ experimentModelList = select(QueryConstants.GET_EXPERIMENTS_FOR_USER, limit, offset, queryParameters);
}
else if (fieldName.equals(DBConstants.Experiment.PROJECT_ID)) {
logger.debug("Search criteria is ProjectId");
Map<String, Object> queryParameters = new HashMap<>();
queryParameters.put(DBConstants.Experiment.PROJECT_ID, value);
- experimentModelList = select(QueryConstants.GET_EXPERIMENTS_FOR_PROJECT_ID, -1, 0, queryParameters);
+ experimentModelList = select(QueryConstants.GET_EXPERIMENTS_FOR_PROJECT_ID, limit, offset, queryParameters);
}
else if (fieldName.equals(DBConstants.Experiment.PROJECT_ID)) {
logger.debug("Search criteria is GatewayId");
Map<String, Object> queryParameters = new HashMap<>();
queryParameters.put(DBConstants.Experiment.GATEWAY_ID, value);
- experimentModelList = select(QueryConstants.GET_EXPERIMENTS_FOR_GATEWAY_ID, -1, 0, queryParameters);
+ experimentModelList = select(QueryConstants.GET_EXPERIMENTS_FOR_GATEWAY_ID, limit, offset, queryParameters);
}
else {

diff:
package org.apache.airavata.registry.core.repositories.expcatalog;
-public class ExperimentSummaryRepository {
+import org.apache.airavata.model.experiment.ExperimentStatistics;
+import org.apache.airavata.model.experiment.ExperimentSummaryModel;
+import org.apache.airavata.model.status.ExperimentState;
+import org.apache.airavata.registry.core.entities.expcatalog.ExperimentSummaryEntity;
+import org.apache.airavata.registry.core.utils.DBConstants;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.apache.airavata.registry.cpi.ResultOrderType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Timestamp;
+import java.util.List;
+import java.util.Map;
+
+public class ExperimentSummaryRepository extends ExpCatAbstractRepository<ExperimentSummaryModel, ExperimentSummaryEntity, String> {
+ private final static Logger logger = LoggerFactory.getLogger(ExperimentRepository.class);
+
+ public ExperimentSummaryRepository() { super(ExperimentSummaryModel.class, ExperimentSummaryEntity.class); }
+
+ public List<ExperimentSummaryModel> searchExperiments(Map<String, String> filters, int limit,
+ int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
+ return searchAllAccessibleExperiments(null, filters, limit, offset, orderByIdentifier, resultOrderType);
+ }
+
+ public List<ExperimentSummaryModel> searchAllAccessibleExperiments(List<String> accessibleExperimentIds, Map<String, String> filters, int limit,
+ int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
+ String query = "SELECT DISTINCT ES FROM " + ExperimentSummaryEntity.class.getSimpleName() + " ES ";
+
+ if (!filters.isEmpty() && filters != null) {
+
+ for (String field : filters.keySet()) {
+
+ query += " WHERE ";
+
+ if (field.equals(DBConstants.Experiment.USER_NAME)) {
+ logger.debug("Filter Experiments by User");
+ query += "ES.userName LIKE :" + filters.get(field) + " AND ";
+ }
+
+ else if (field.equals(DBConstants.Experiment.GATEWAY_ID)) {
+ logger.debug("Filter Experiments by Gateway ID");
+ query += "ES.gatewayId LIKE :" + filters.get(field) + " AND ";
+ }
+
+ else if (field.equals(DBConstants.Experiment.PROJECT_ID)) {
+ logger.debug("Filter Experiments by Project ID");
+ query += "ES.projectId LIKE :" + filters.get(field) + " AND ";
+ }
+
+ else if (field.equals(DBConstants.Experiment.EXPERIMENT_NAME)) {
+ logger.debug("Filter Experiments by Name");
+ query += "ES.name LIKE :" + filters.get(field) + " AND ";
+ }
+
+ else if (field.equals(DBConstants.Experiment.DESCRIPTION)) {
+ logger.debug("Filter Experiments by Description");
+ query += "ES.description LIKE :" + filters.get(field) + " AND ";
+ }
+
+ else if (field.equals(DBConstants.Experiment.EXECUTION_ID)) {
+ logger.debug("Filter Experiments by Execution ID");
+ query += "ES.executionId LIKE :" + filters.get(field) + " AND ";
+ }
+
+ }
+
+ }
+
+ if (filters.get(DBConstants.ExperimentStatus.STATE) != null) {
+ logger.debug("Filter Experiments by State");
+ String state = ExperimentState.valueOf(filters.get(DBConstants.ExperimentStatus.STATE)).toString();
+ query += "ES.state LIKE :" + state + " AND ";
+ }
+
+ if (filters.get(DBConstants.ExperimentSummary.FROM_DATE) != null
+ && filters.get(DBConstants.ExperimentSummary.TO_DATE) != null) {
+
+ Timestamp fromDate = new Timestamp(Long.parseLong(filters.get(DBConstants.ExperimentSummary.FROM_DATE)));
+ Timestamp toDate = new Timestamp(Long.parseLong(filters.get(DBConstants.ExperimentSummary.TO_DATE)));
+
+ if (toDate.after(fromDate)) {
+ logger.debug("Filter Experiments by Date");
+ query += "ES.creationTime BETWEEN :" + fromDate + " AND :" + toDate + " AND ";
+ }
+
+ }
+
+ if (!accessibleExperimentIds.isEmpty() && accessibleExperimentIds != null) {
+ logger.debug("Filter Projects by Accessible Experiment IDs");
+ query += " ES.experimentId IN :" + accessibleExperimentIds;
+ }
+
+ else {
+ logger.debug("Removing the last operator from the query");
+ query = query.substring(0, query.length() - 5);
+ }
+
+ List<ExperimentSummaryModel> experimentSummaryModelList = select(query, offset);
+ return experimentSummaryModelList;
+ }
+
+ public ExperimentStatistics getExperimentStatistics(Map<String,String> filters) throws RegistryException {
+
+ try {
+
+ ExperimentStatistics experimentStatistics = new ExperimentStatistics();
+ String gatewayId = filters.get(DBConstants.Experiment.GATEWAY_ID);
+ String userName = filters.get(DBConstants.Experiment.USER_NAME);
+ String applicationName = filters.get(DBConstants.Experiment.EXECUTION_ID);
+ String resourceHostName = filters.get(DBConstants.Experiment.RESOURCE_HOST_ID);
+ Timestamp fromDate = new Timestamp(Long.parseLong(filters.get(DBConstants.ExperimentSummary.FROM_DATE)));
+ Timestamp toDate = new Timestamp(Long.parseLong(filters.get(DBConstants.ExperimentSummary.TO_DATE)));
+
+ List<ExperimentSummaryModel> allExperiments = getExperimentStatisticsForState(null, gatewayId,
+ fromDate, toDate, userName, applicationName, resourceHostName);
+ experimentStatistics.setAllExperimentCount(allExperiments.size());
+ experimentStatistics.setAllExperiments(allExperiments);
+
+ List<ExperimentSummaryModel> createdExperiments = getExperimentStatisticsForState(ExperimentState.CREATED, gatewayId,
+ fromDate, toDate, userName, applicationName, resourceHostName);
+ createdExperiments.addAll(getExperimentStatisticsForState(ExperimentState.VALIDATED, gatewayId,
+ fromDate, toDate, userName, applicationName, resourceHostName));
+ experimentStatistics.setCreatedExperimentCount(createdExperiments.size());
+ experimentStatistics.setCreatedExperiments(createdExperiments);
+
+ List<ExperimentSummaryModel> runningExperiments = getExperimentStatisticsForState(ExperimentState.EXECUTING, gatewayId,
+ fromDate, toDate, userName, applicationName, resourceHostName);
+ runningExperiments.addAll(getExperimentStatisticsForState(ExperimentState.SCHEDULED, gatewayId,
+ fromDate, toDate, userName, applicationName, resourceHostName));
+ runningExperiments.addAll(getExperimentStatisticsForState(ExperimentState.LAUNCHED, gatewayId,
+ fromDate, toDate, userName, applicationName, resourceHostName));
+ experimentStatistics.setRunningExperimentCount(runningExperiments.size());
+ experimentStatistics.setRunningExperiments(runningExperiments);
+
+ List<ExperimentSummaryModel> completedExperiments = getExperimentStatisticsForState(ExperimentState.COMPLETED, gatewayId,
+ fromDate, toDate, userName, applicationName, resourceHostName);
+ experimentStatistics.setCompletedExperimentCount(completedExperiments.size());
+ experimentStatistics.setCompletedExperiments(completedExperiments);
+
+ List<ExperimentSummaryModel> failedExperiments = getExperimentStatisticsForState(ExperimentState.FAILED, gatewayId,
+ fromDate, toDate, userName, applicationName, resourceHostName);
+ experimentStatistics.setFailedExperimentCount(failedExperiments.size());
+ experimentStatistics.setFailedExperiments(failedExperiments);
+
+ List<ExperimentSummaryModel> cancelledExperiments = getExperimentStatisticsForState(ExperimentState.CANCELED, gatewayId,
+ fromDate, toDate, userName, applicationName, resourceHostName);
+ cancelledExperiments.addAll(getExperimentStatisticsForState(ExperimentState.CANCELING, gatewayId,
+ fromDate, toDate, userName, applicationName, resourceHostName));
+ experimentStatistics.setCancelledExperimentCount(cancelledExperiments.size());
+ experimentStatistics.setCancelledExperiments(cancelledExperiments);
+
+ return experimentStatistics;
+ }
+
+ catch (RegistryException e) {
+ logger.error("Error while retrieving experiment statistics from registry", e);
+ throw new RegistryException(e);
+ }
+
+ }
+
+ protected List<ExperimentSummaryModel> getExperimentStatisticsForState(ExperimentState experimentState, String gatewayId, Timestamp fromDate, Timestamp toDate,
+ String userName, String applicationName, String resourceHostName) throws RegistryException {
+
+ String query = "SELECT DISTINCT ES FROM " + ExperimentSummaryEntity.class.getSimpleName() + " ES WHERE ";
+
+ if (experimentState != null) {
+ query += "ES.state LIKE :" + experimentState.toString() + " AND ";
+ }
+
+ query += "ES.creationTime BETWEEN :" + fromDate + " AND :" + toDate + " AND " +
+ "ES.gatewayId LIKE :" + gatewayId + " ";
+
+ if (userName != null) {
+ query += "AND ES.userName LIKE :" + userName + " ";
+ }
+
+ if (applicationName != null) {
+ query += "AND ES.executionId LIKE :" + applicationName + " ";
+ }
+
+ if (resourceHostName != null) {
+ query += "AND ES.resourceHostId LIKE :" + resourceHostName + " ";
+ }
+
+ query += "ORDER BY ES.creationTime DESC";
+ List<ExperimentSummaryModel> experimentSummaryModelList = select(query, 0);
+ return experimentSummaryModelList;
+ }
+
}

diff:
@@ -93,6 +93,11 @@ public class ProjectRepository extends ExpCatAbstractRepository<Project, Project
}
+ else {
+ logger.error("Unsupported field name for Project module.");
+ throw new IllegalArgumentException("Unsupported field name for Project module.");
+ }
+
return null;
}
@@ -110,52 +115,61 @@ public class ProjectRepository extends ExpCatAbstractRepository<Project, Project
return projectIds;
}
- public List<Project> searchProjects(Map<String, String> filters) throws RegistryException {
- return searchProjects(filters, -1, -1, null, null);
+ public List<Project> searchProjects(Map<String, String> filters, int limit,
+ int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
+ return searchAllAccessibleProjects(null, filters, limit, offset, orderByIdentifier, resultOrderType);
}
- public List<Project> searchProjects(Map<String, String> filters, int limit,
+ public List<Project> searchAllAccessibleProjects(List<String> accessibleProjectIds, Map<String, String> filters, int limit,
int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- Map<String, Object> queryParameters = new HashMap<>();
+ String query = "SELECT DISTINCT P FROM " + ProjectEntity.class.getSimpleName() + " P ";
+
+ if (!filters.isEmpty() && filters != null) {
+
for (String field : filters.keySet()) {
+ query += " WHERE ";
+
if (field.equals(DBConstants.Project.GATEWAY_ID)) {
logger.debug("Filter Projects by Gateway ID");
- queryParameters.put(DBConstants.Project.GATEWAY_ID, filters.get(field));
- }
-
- else if (field.equals(DBConstants.Project.PROJECT_NAME)) {
- logger.debug("Filter Projects by Project Name");
- queryParameters.put(DBConstants.Project.PROJECT_NAME, filters.get(field));
+ query += "P.gatewayId LIKE :" + filters.get(field) + " AND ";
}
else if (field.equals(DBConstants.Project.OWNER)) {
logger.debug("Filter Projects by Owner");
- queryParameters.put(DBConstants.Project.OWNER, filters.get(field));
+ query += "P.owner LIKE :" + filters.get(field) + " AND ";
+ }
+
+ else if (field.equals(DBConstants.Project.PROJECT_NAME)) {
+ logger.debug("Filter Projects by Project Name");
+ query += "P.name LIKE :" + filters.get(field) + " AND ";
}
else if (field.equals(DBConstants.Project.DESCRIPTION)) {
logger.debug("Filter Projects by Description");
- queryParameters.put(DBConstants.Project.DESCRIPTION, filters.get(field));
+ query += "P.description LIKE :" + filters.get(field) + " AND ";
}
+
+ else {
+ logger.error("Unsupported field name for Project module.");
+ throw new IllegalArgumentException("Unsupported field name for Project module.");
}
- List<Project> projectList = select(QueryConstants.SEARCH_FOR_PROJECTS, -1, 0, queryParameters);
- return projectList;
}
- public List<Project> searchAllAccessibleProjects(List<String> accessibleProjectIds, Map<String, String> filters, int limit,
- int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- List<Project> projectList = new ArrayList<>();
- for (Project project : searchProjects(filters, limit, offset, orderByIdentifier, resultOrderType)) {
+ }
- if (accessibleProjectIds.contains(project.getProjectID())) {
- logger.debug("Project is accessible");
- projectList.add(project);
+ if (!accessibleProjectIds.isEmpty() && accessibleProjectIds != null) {
+ logger.debug("Filter Projects by Accessible Project IDs");
+ query += " P.projectId IN :" + accessibleProjectIds;
}
+ else {
+ logger.debug("Removing the last operator from the query");
+ query = query.substring(0, query.length() - 5);
}
+ List<Project> projectList = select(query, offset);
return projectList;
}

diff:
@@ -91,13 +91,24 @@ public class DBConstants {
public static final String OWNER = "owner";
public static final String PROJECT_NAME = "name";
public static final String DESCRIPTION = "description";
- public static final String ACCESSIBLE_PROJECT_IDS = "accessibleProjectIds";
}
public static class Experiment {
public static final String USER_NAME = "userName";
public static final String PROJECT_ID = "projectId";
public static final String GATEWAY_ID = "gatewayId";
+ public static final String EXPERIMENT_ID = "experimentId";
+ public static final String EXPERIMENT_NAME = "experimentName";
+ public static final String DESCRIPTION = "description";
+ public static final String EXECUTION_ID = "executionId";
+ public static final String CREATION_TIME = "creationTime";
+ public static final String RESOURCE_HOST_ID = "resourceHostId";
+ }
+
+ public final class ExperimentStatus {
+ public static final String EXPERIMENT_ID = "experimentId";
+ public static final String STATE = "state";
+ public static final String REASON = "reason";
}
public static class Process {
@@ -113,6 +124,11 @@ public class DBConstants {
public static final String TASK_ID = "taskId";
}
+ public static class ExperimentSummary {
+ public static final String FROM_DATE = "fromDate";
+ public static final String TO_DATE = "toDate";
+ }
+
public static class UserComputeResourcePreference {
public static final String USER_ID = "userId";
public static final String GATEWAY_ID = "gatewayId";

diff:
@@ -111,11 +111,6 @@ public interface QueryConstants {
"WHERE N.gatewayId LIKE :" + DBConstants.Notification.GATEWAY_ID;
String GET_ALL_PROJECTS = "SELECT P FROM " + ProjectEntity.class.getSimpleName() + " P";
- String SEARCH_FOR_PROJECTS = "SELECT DISTINCT P FROM " + ProjectEntity.class.getSimpleName() + " P " +
- "WHERE P.gatewayId LIKE :" + DBConstants.Project.GATEWAY_ID + " AND " +
- "P.owner LIKE :" + DBConstants.Project.OWNER + " AND " +
- "P.name LIKE :" + DBConstants.Project.PROJECT_NAME + " AND " +
- "P.description LIKE :" + DBConstants.Project.DESCRIPTION;
String GET_EXPERIMENTS_FOR_USER = "SELECT E FROM " + ExperimentEntity.class.getSimpleName() + " E " +
"WHERE E.userName LIKE :" + DBConstants.Experiment.USER_NAME;

license: Apache License 2.0

repo: apache/airavata

original_message: Making changes to repository classes


message: Initial commit for tests

diff:
+package org.apache.airavata.registry.core.repositories.expcatalog;
+
+import org.apache.airavata.registry.core.repositories.expcatalog.util.Initialize;
+import org.apache.airavata.registry.core.utils.DBConstants;
+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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+
+public class ExperimentRepositoryTest {
+
+ private static Initialize initialize;
+ JobRepository jobRepository;
+ ProcessRepository processRepository;
+ ProcessResourceScheduleRepository processResourceScheduleRepository;
+ QueueStatusRepository queueStatusRepository;
+ TaskRepository taskRepository;
+ UserConfigurationDataRepository userConfigurationDataRepository;
+ ExperimentRepository experimentRepository;
+ private static final Logger logger = LoggerFactory.getLogger(ExperimentRepositoryTest.class);
+
+ @Before
+ public void setUp() {
+ try {
+ initialize = new Initialize("expcatalog-derby.sql");
+ initialize.initializeDB();
+ jobRepository = new JobRepository();
+ processRepository = new ProcessRepository();
+ processResourceScheduleRepository = new ProcessResourceScheduleRepository();
+ queueStatusRepository = new QueueStatusRepository();
+ taskRepository = new TaskRepository();
+ userConfigurationDataRepository = new UserConfigurationDataRepository();
+ experimentRepository = new ExperimentRepository();
+ } 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 {
+
+ }
+
+}

diff:
+package org.apache.airavata.registry.core.repositories.expcatalog;
+
+import org.apache.airavata.registry.core.repositories.expcatalog.util.Initialize;
+import org.apache.airavata.registry.core.utils.DBConstants;
+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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+
+public class ExperimentSummaryRepositoryTest {
+
+ private static Initialize initialize;
+ ExperimentSummaryRepository experimentSummaryRepository;
+ private static final Logger logger = LoggerFactory.getLogger(ExperimentSummaryRepositoryTest.class);
+
+ @Before
+ public void setUp() {
+ try {
+ initialize = new Initialize("expcatalog-derby.sql");
+ initialize.initializeDB();
+ experimentSummaryRepository = new ExperimentSummaryRepository();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ System.out.println("********** TEAR DOWN ************");
+ initialize.stopDerbyServer();
+ }
+
+ @Test
+ public void ExperimentSummaryRepositoryTest() throws RegistryException {
+
+ }
+
+}

diff:
+package org.apache.airavata.registry.core.repositories.expcatalog;
+
+import org.apache.airavata.registry.core.repositories.expcatalog.util.Initialize;
+import org.apache.airavata.registry.core.utils.DBConstants;
+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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+
+public class GatewayRepositoryTest {
+
+ private static Initialize initialize;
+ GatewayRepository gatewayRepository;
+ private static final Logger logger = LoggerFactory.getLogger(GatewayRepositoryTest.class);
+
+ @Before
+ public void setUp() {
+ try {
+ initialize = new Initialize("expcatalog-derby.sql");
+ initialize.initializeDB();
+ gatewayRepository = new GatewayRepository();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ System.out.println("********** TEAR DOWN ************");
+ initialize.stopDerbyServer();
+ }
+
+ @Test
+ public void GatewayRepositoryTest() throws RegistryException {
+
+ }
+
+}

diff:
+package org.apache.airavata.registry.core.repositories.expcatalog;
+
+import org.apache.airavata.registry.core.repositories.expcatalog.util.Initialize;
+import org.apache.airavata.registry.core.utils.DBConstants;
+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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+
+public class NotificationRepositoryTest {
+
+ private static Initialize initialize;
+ NotificationRepository notificationRepository;
+ private static final Logger logger = LoggerFactory.getLogger(NotificationRepositoryTest.class);
+
+ @Before
+ public void setUp() {
+ try {
+ initialize = new Initialize("expcatalog-derby.sql");
+ initialize.initializeDB();
+ notificationRepository = new NotificationRepository();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ System.out.println("********** TEAR DOWN ************");
+ initialize.stopDerbyServer();
+ }
+
+ @Test
+ public void NotificationRepositoryTest() throws RegistryException {
+
+ }
+
+}

diff:
+package org.apache.airavata.registry.core.repositories.expcatalog;
+
+import org.apache.airavata.registry.core.repositories.expcatalog.util.Initialize;
+import org.apache.airavata.registry.core.utils.DBConstants;
+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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+
+public class ProjectRepositoryTest {
+
+ private static Initialize initialize;
+ ProjectRepository projectRepository;
+ private static final Logger logger = LoggerFactory.getLogger(ProjectRepositoryTest.class);
+
+ @Before
+ public void setUp() {
+ try {
+ initialize = new Initialize("expcatalog-derby.sql");
+ initialize.initializeDB();
+ projectRepository = new ProjectRepository();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ System.out.println("********** TEAR DOWN ************");
+ initialize.stopDerbyServer();
+ }
+
+ @Test
+ public void ProjectRepositoryTest() throws RegistryException {
+
+ }
+
+}

original_message: Initial commit for tests


message: Making changes to Gateway and Notification tests

diff:
@@ -122,14 +122,12 @@ public class ProjectRepository extends ExpCatAbstractRepository<Project, Project
public List<Project> searchAllAccessibleProjects(List<String> accessibleProjectIds, Map<String, String> filters, int limit,
int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- String query = "SELECT DISTINCT P FROM " + ProjectEntity.class.getSimpleName() + " P ";
+ String query = "SELECT DISTINCT P FROM " + ProjectEntity.class.getSimpleName() + " P WHERE ";
if (!filters.isEmpty() && filters != null) {
for (String field : filters.keySet()) {
- query += " WHERE ";
-
if (field.equals(DBConstants.Project.GATEWAY_ID)) {
logger.debug("Filter Projects by Gateway ID");
query += "P.gatewayId LIKE :" + filters.get(field) + " AND ";
@@ -159,9 +157,13 @@ public class ProjectRepository extends ExpCatAbstractRepository<Project, Project
}
- if (!accessibleProjectIds.isEmpty() && accessibleProjectIds != null) {
+ if (accessibleProjectIds != null && !accessibleProjectIds.isEmpty()) {
logger.debug("Filter Projects by Accessible Project IDs");
- query += " P.projectId IN :" + accessibleProjectIds;
+ query += "P.projectId IN (";
+ for(String projectId : accessibleProjectIds) {
+ query += (":" + projectId + ",");
+ }
+ query = query.substring(0, query.length() - 1) + ")";
}
else {

diff:
package org.apache.airavata.registry.core.repositories.expcatalog;
+import org.apache.airavata.model.workspace.Gateway;
import org.apache.airavata.registry.core.repositories.expcatalog.util.Initialize;
-import org.apache.airavata.registry.core.utils.DBConstants;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.registry.cpi.RegistryException;
import org.junit.After;
import org.junit.Before;
@@ -16,6 +17,7 @@ import static org.junit.Assert.assertFalse;
public class GatewayRepositoryTest {
private static Initialize initialize;
+ private String testGatewayId = "testGateway";
GatewayRepository gatewayRepository;
private static final Logger logger = LoggerFactory.getLogger(GatewayRepositoryTest.class);
@@ -37,8 +39,25 @@ public class GatewayRepositoryTest {
}
@Test
- public void GatewayRepositoryTest() throws RegistryException {
+ public void GatewayRepositoryTest() throws ApplicationSettingsException, RegistryException {
+ Gateway gateway = new Gateway();
+ gateway.setGatewayId(testGatewayId);
+ gateway.setDomain("SEAGRID");
+ gateway.setEmailAddress("abc@d.com");
+ String gatewayId = gatewayRepository.addGateway(gateway);
+ assertEquals(testGatewayId, gatewayId);
+
+ gateway.setGatewayAdminFirstName("ABC");
+ gatewayRepository.updateGateway(testGatewayId, gateway);
+
+ Gateway retrievedGateway = gatewayRepository.getGateway(gatewayId);
+ assertEquals(gateway.getGatewayAdminFirstName(), retrievedGateway.getGatewayAdminFirstName());
+
+ assertTrue(gatewayRepository.getAllGateways().size() == 1);
+
+ gatewayRepository.removeGateway(gatewayId);
+ assertFalse(gatewayRepository.isGatewayExist(gatewayId));
}
}

diff:
package org.apache.airavata.registry.core.repositories.expcatalog;
+import org.apache.airavata.model.workspace.Notification;
+import org.apache.airavata.model.workspace.NotificationPriority;
import org.apache.airavata.registry.core.repositories.expcatalog.util.Initialize;
-import org.apache.airavata.registry.core.utils.DBConstants;
import org.apache.airavata.registry.cpi.RegistryException;
import org.junit.After;
import org.junit.Before;
@@ -11,11 +12,11 @@ import org.slf4j.LoggerFactory;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
public class NotificationRepositoryTest {
private static Initialize initialize;
+ private String testGateway = "testGateway";
NotificationRepository notificationRepository;
private static final Logger logger = LoggerFactory.getLogger(NotificationRepositoryTest.class);
@@ -38,7 +39,24 @@ public class NotificationRepositoryTest {
@Test
public void NotificationRepositoryTest() throws RegistryException {
+ Notification notification = new Notification();
+ notification.setNotificationId("notificationId");
+ notification.setGatewayId(testGateway);
+ notification.setTitle("notificationTitle");
+ notification.setNotificationMessage("notificationMessage");
+ String notificationId = notificationRepository.createNotification(notification);
+ assertEquals(notification.getNotificationId(), notificationId);
+
+ notification.setPriority(NotificationPriority.NORMAL);
+ notificationRepository.updateNotification(notification);
+
+ Notification retrievedNotification = notificationRepository.getNotification(notificationId);
+ assertEquals(NotificationPriority.NORMAL, retrievedNotification.getPriority());
+
+ assertTrue(notificationRepository.getAllGatewayNotifications(testGateway).size() == 1);
+
+ notificationRepository.deleteNotification(notificationId);
}
}


message: Adding tests for Project

diff:
@@ -45,13 +45,20 @@ public class ProjectRepository extends ExpCatAbstractRepository<Project, Project
}
protected ProjectEntity saveProject(Project project, String gatewayId) throws RegistryException {
- String projectID = getProjectId(project.getName());
+ if (project.getProjectID() == null) {
+ logger.debug("Setting the Project's ProjectId");
+ project.setProjectID(getProjectId(project.getName()));
+ }
+
Mapper mapper = ObjectMapperSingleton.getInstance();
ProjectEntity projectEntity = mapper.map(project, ProjectEntity.class);
- projectEntity.setProjectID(projectID);
- projectEntity.setGatewayId(gatewayId);
- if (!isProjectExist(projectID)) {
+ if (project.getGatewayId() == null) {
+ logger.debug("Setting the Project's GatewayId");
+ projectEntity.setGatewayId(project.getGatewayId());
+ }
+
+ if (!isProjectExist(projectEntity.getProjectID())) {
logger.debug("Checking if the Project already exists");
projectEntity.setCreationTime(new Timestamp((System.currentTimeMillis())));
}
@@ -64,7 +71,7 @@ public class ProjectRepository extends ExpCatAbstractRepository<Project, Project
}
public void updateProject(Project project, String projectId) throws RegistryException {
- saveProjectData(project, null);
+ saveProjectData(project, projectId);
}
private String getProjectId(String projectName){
@@ -122,30 +129,35 @@ public class ProjectRepository extends ExpCatAbstractRepository<Project, Project
public List<Project> searchAllAccessibleProjects(List<String> accessibleProjectIds, Map<String, String> filters, int limit,
int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- String query = "SELECT DISTINCT P FROM " + ProjectEntity.class.getSimpleName() + " P WHERE ";
+ String query = "SELECT P FROM " + ProjectEntity.class.getSimpleName() + " P WHERE ";
+ Map<String, Object> queryParameters = new HashMap<>();
- if (!filters.isEmpty() && filters != null) {
+ if (filters != null && !filters.isEmpty()) {
for (String field : filters.keySet()) {
if (field.equals(DBConstants.Project.GATEWAY_ID)) {
logger.debug("Filter Projects by Gateway ID");
- query += "P.gatewayId LIKE :" + filters.get(field) + " AND ";
+ queryParameters.put(DBConstants.Project.GATEWAY_ID, filters.get(field));
+ query += "P.gatewayId LIKE :" + DBConstants.Project.GATEWAY_ID + " AND ";
}
else if (field.equals(DBConstants.Project.OWNER)) {
logger.debug("Filter Projects by Owner");
- query += "P.owner LIKE :" + filters.get(field) + " AND ";
+ queryParameters.put(DBConstants.Project.OWNER, filters.get(field));
+ query += "P.owner LIKE :" + DBConstants.Project.OWNER + " AND ";
}
else if (field.equals(DBConstants.Project.PROJECT_NAME)) {
logger.debug("Filter Projects by Project Name");
- query += "P.name LIKE :" + filters.get(field) + " AND ";
+ queryParameters.put(DBConstants.Project.PROJECT_NAME, filters.get(field));
+ query += "P.name LIKE :" + DBConstants.Project.PROJECT_NAME + " AND ";
}
else if (field.equals(DBConstants.Project.DESCRIPTION)) {
logger.debug("Filter Projects by Description");
- query += "P.description LIKE :" + filters.get(field) + " AND ";
+ queryParameters.put(DBConstants.Project.DESCRIPTION, filters.get(field));
+ query += "P.description LIKE :" + DBConstants.Project.DESCRIPTION + " AND ";
}
else {
@@ -159,11 +171,8 @@ public class ProjectRepository extends ExpCatAbstractRepository<Project, Project
if (accessibleProjectIds != null && !accessibleProjectIds.isEmpty()) {
logger.debug("Filter Projects by Accessible Project IDs");
- query += "P.projectId IN (";
- for(String projectId : accessibleProjectIds) {
- query += (":" + projectId + ",");
- }
- query = query.substring(0, query.length() - 1) + ")";
+ queryParameters.put(DBConstants.Project.ACCESSIBLE_PROJECT_IDS, accessibleProjectIds);
+ query += "P.projectID IN :" + DBConstants.Project.ACCESSIBLE_PROJECT_IDS;
}
else {
@@ -171,7 +180,7 @@ public class ProjectRepository extends ExpCatAbstractRepository<Project, Project
query = query.substring(0, query.length() - 5);
}
- List<Project> projectList = select(query, offset);
+ List<Project> projectList = select(query, limit, offset, queryParameters);
return projectList;
}

diff:
@@ -96,6 +96,7 @@ public class DBConstants {
public static final String OWNER = "owner";
public static final String PROJECT_NAME = "name";
public static final String DESCRIPTION = "description";
+ public static final String ACCESSIBLE_PROJECT_IDS = "accessibleProjectIds";
}
public static class Experiment {

diff:
package org.apache.airavata.registry.core.repositories.expcatalog;
+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.core.utils.DBConstants;
import org.apache.airavata.registry.cpi.RegistryException;
@@ -9,6 +11,11 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
@@ -16,6 +23,8 @@ import static org.junit.Assert.assertFalse;
public class ProjectRepositoryTest {
private static Initialize initialize;
+ private String testGateway = "testGateway";
+ GatewayRepository gatewayRepository;
ProjectRepository projectRepository;
private static final Logger logger = LoggerFactory.getLogger(ProjectRepositoryTest.class);
@@ -24,6 +33,7 @@ public class ProjectRepositoryTest {
try {
initialize = new Initialize("expcatalog-derby.sql");
initialize.initializeDB();
+ gatewayRepository = new GatewayRepository();
projectRepository = new ProjectRepository();
} catch (Exception e) {
logger.error(e.getMessage(), e);
@@ -38,7 +48,42 @@ public class ProjectRepositoryTest {
@Test
public void ProjectRepositoryTest() throws RegistryException {
+ Gateway gateway = new Gateway();
+ gateway.setGatewayId(testGateway);
+ gateway.setDomain("SEAGRID");
+ gateway.setEmailAddress("abc@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);
+ assertTrue(projectId != null);
+
+ project.setDescription("projectDescription");
+ projectRepository.updateProject(project, null);
+
+ Project retrievedProject = projectRepository.getProject(projectId);
+ assertEquals(gatewayId, retrievedProject.getGatewayId());
+
+ assertTrue(projectRepository.getProjectIDs(DBConstants.Project.OWNER, "user").contains(projectId));
+
+ List<String> accessibleProjectIds = new ArrayList<>();
+ accessibleProjectIds.add(projectId);
+
+ Map<String, String> filters = new HashMap<>();
+ filters.put(DBConstants.Project.GATEWAY_ID, retrievedProject.getGatewayId());
+ filters.put(DBConstants.Project.OWNER, retrievedProject.getOwner());
+ filters.put(DBConstants.Project.PROJECT_NAME, retrievedProject.getName());
+ filters.put(DBConstants.Project.DESCRIPTION, retrievedProject.getDescription());
+
+ assertTrue(projectRepository.searchAllAccessibleProjects(accessibleProjectIds, filters,
+ -1, 0, null, null).size() == 1);
+ projectRepository.removeProject(projectId);
+ assertFalse(projectRepository.isProjectExist(projectId));
}
}

original_message: Adding tests for Project


message: Deleting gateway and project entities in tests

diff:
@@ -153,6 +153,9 @@ public class ExperimentRepositoryTest {
experimentRepository.removeExperiment(experimentId);
assertFalse(experimentRepository.isExperimentExist(experimentId));
+
+ gatewayRepository.removeGateway(gatewayId);
+ projectRepository.removeProject(projectId);
}
}

diff:
@@ -130,6 +130,8 @@ public class JobRepositoryTest {
jobRepository.removeJob(cis);
assertFalse(jobRepository.isJobExist(cis));
+ gatewayRepository.removeGateway(gatewayId);
+ projectRepository.removeProject(projectId);
}
}

diff:
@@ -159,6 +159,9 @@ public class ProcessRepositoryTest {
experimentRepository.removeExperiment(experimentId);
processRepository.removeProcess(processId);
assertFalse(processRepository.isProcessExist(processId));
+
+ gatewayRepository.removeGateway(gatewayId);
+ projectRepository.removeProject(projectId);
}
}

diff:
@@ -84,6 +84,8 @@ public class ProjectRepositoryTest {
projectRepository.removeProject(projectId);
assertFalse(projectRepository.isProjectExist(projectId));
+
+ gatewayRepository.removeGateway(gatewayId);
}
}

diff:
@@ -125,6 +125,8 @@ public class TaskRepositoryTest {
taskRepository.removeTask(taskId);
assertFalse(taskRepository.isTaskExist(taskId));
+ gatewayRepository.removeGateway(gatewayId);
+ projectRepository.removeProject(projectId);
}
}


message: Removing unwanted repositories and tests

diff:
@@ -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();

diff:
@@ -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();

change_type: DELETE

diff:
-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

diff:
-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

diff:
@@ -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");

diff:
@@ -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");

diff:
-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 {
-
- }
-
-}

diff:
-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 {
-
- }
-
-}


message:
Adding test for
ExperimentSummaryRepository

diff:
package org.apache.airavata.registry.core.repositories.expcatalog;
+import org.apache.airavata.model.experiment.ExperimentModel;
+import org.apache.airavata.model.experiment.ExperimentSummaryModel;
+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.core.utils.DBConstants;
import org.apache.airavata.registry.cpi.RegistryException;
@@ -9,6 +14,11 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
@@ -16,6 +26,9 @@ import static org.junit.Assert.assertFalse;
public class ExperimentSummaryRepositoryTest {
private static Initialize initialize;
+ GatewayRepository gatewayRepository;
+ ProjectRepository projectRepository;
+ ExperimentRepository experimentRepository;
ExperimentSummaryRepository experimentSummaryRepository;
private static final Logger logger = LoggerFactory.getLogger(ExperimentSummaryRepositoryTest.class);
@@ -24,6 +37,9 @@ public class ExperimentSummaryRepositoryTest {
try {
initialize = new Initialize("expcatalog-derby.sql");
initialize.initializeDB();
+ gatewayRepository = new GatewayRepository();
+ projectRepository = new ProjectRepository();
+ experimentRepository = new ExperimentRepository();
experimentSummaryRepository = new ExperimentSummaryRepository();
} catch (Exception e) {
logger.error(e.getMessage(), e);
@@ -38,7 +54,70 @@ public class ExperimentSummaryRepositoryTest {
@Test
public void ExperimentSummaryRepositoryTest() throws RegistryException {
+ Gateway gateway = new Gateway();
+ gateway.setGatewayId("gateway");
+ gateway.setDomain("SEAGRID");
+ gateway.setEmailAddress("abc@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 experimentModelOne = new ExperimentModel();
+ experimentModelOne.setProjectId(projectId);
+ experimentModelOne.setGatewayId(gatewayId);
+ experimentModelOne.setExperimentType(ExperimentType.SINGLE_APPLICATION);
+ experimentModelOne.setUserName("userOne");
+ experimentModelOne.setExperimentName("nameOne");
+ experimentModelOne.setDescription("descriptionOne");
+ experimentModelOne.setExecutionId("executionIdOne");
+
+ ExperimentModel experimentModelTwo = new ExperimentModel();
+ experimentModelTwo.setProjectId(projectId);
+ experimentModelTwo.setGatewayId(gatewayId);
+ experimentModelTwo.setExperimentType(ExperimentType.WORKFLOW);
+ experimentModelTwo.setUserName("userTwo");
+ experimentModelTwo.setExperimentName("nameTwo");
+ experimentModelTwo.setDescription("descriptionTwo");
+ experimentModelTwo.setExecutionId("executionIdTwo");
+
+ String experimentIdOne = experimentRepository.addExperiment(experimentModelOne);
+ assertTrue(experimentIdOne != null);
+
+ String expertimentIdTwo = experimentRepository.addExperiment(experimentModelTwo);
+ assertTrue(expertimentIdTwo != null);
+
+ Map<String, String> filters = new HashMap<>();
+ filters.put(DBConstants.Experiment.GATEWAY_ID, gatewayId);
+ filters.put(DBConstants.Experiment.PROJECT_ID, projectId);
+
+ List<ExperimentSummaryModel> experimentSummaryModelList = experimentSummaryRepository.
+ searchExperiments(filters, -1, 0, null, null);
+ assertTrue(experimentSummaryModelList.size() == 2);
+
+ filters.put(DBConstants.Experiment.EXECUTION_ID, "executionIdTwo");
+
+ experimentSummaryModelList = experimentSummaryRepository.
+ searchExperiments(filters, -1, 0, null, null);
+ assertTrue(experimentSummaryModelList.size() == 1);
+ assertEquals(expertimentIdTwo, experimentSummaryModelList.get(0).getExperimentId());
+
+ List<String> accessibleExperimentIds = new ArrayList<>();
+ accessibleExperimentIds.add(experimentIdOne);
+ filters.put(DBConstants.Experiment.EXECUTION_ID, "executionIdOne");
+
+ experimentSummaryModelList = experimentSummaryRepository.
+ searchAllAccessibleExperiments(accessibleExperimentIds, filters, -1, 0, null, null);
+ assertTrue(experimentSummaryModelList.size() == 1);
+ assertEquals(experimentIdOne, experimentSummaryModelList.get(0).getExperimentId());
+
+ //TODO: Use fromDate and toDate filters
+ //TODO: Write test for the getExperimentStatistics() method
}
}


message: Removing outdated entity class

diff:
-/*
- *
- * 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.entities.expcatalog;
-
-import javax.persistence.*;
-import java.io.Serializable;
-
-*/
-/**
- * The persistent class for the compute_resource_schedule database table.
- *//*
-
-@Entity
-@Table(name = "COMPUTE_RESOURCE_SCHEDULE")
-public class ComputeResourceScheduleEntity implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @Id
- @Column(name = "EXPERIMENT_ID")
- private String experimentId;
-
- @Column(name = "RESOURCE_HOST_ID")
- private String resourceHostId;
-
- @Column(name = "CPU_COUNT")
- private int totalCPUCount;
-
- @Column(name = "NODE_COUNT")
- private int nodeCount;
-
- @Column(name = "NUMBER_OF_THREADS")
- private int numberOfThreads;
-
- @Column(name = "QUEUE_NAME")
- private String queueName;
-
- @Column(name = "WALL_TIME_LIMIT")
- private int wallTimeLimit;
-
- @Column(name = "TOTAL_PHYSICAL_MEMORY")
- private int totalPhysicalMemory;
-
- @Column(name = "CHESSIS_NUMBER")
- private String chessisNumber;
-
- @Column(name = "STATIC_WORKING_DIRECTORY")
- private String staticWorkingDir;
-
- @Column(name = "OVERRIDE_LOGIN_USERNAME")
- private String overrideLoginUserName;
-
- @Column(name = "OVERRIDE_SCRATCH_LOCATION")
- private String overrideScratchLocation;
-
- @Column(name = "OVERRIDE_ALLOCATION_PROJECT_NUMBER")
- private String overrideAllocationProjectNumber;
-
- @OneToOne(targetEntity = UserConfigurationDataEntity.class, cascade = CascadeType.ALL)
- @PrimaryKeyJoinColumn(name = "EXPERIMENT_ID", referencedColumnName = "EXPERIMENT_ID")
- private UserConfigurationDataEntity userConfiguration;
-
- public ComputeResourceScheduleEntity() {
- }
-
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- public String getResourceHostId() {
- return resourceHostId;
- }
-
- public void setResourceHostId(String resourceHostId) {
- this.resourceHostId = resourceHostId;
- }
-
- public int getTotalCPUCount() {
- return totalCPUCount;
- }
-
- public void setTotalCPUCount(int totalCPUCount) {
- this.totalCPUCount = totalCPUCount;
- }
-
- public int getNodeCount() {
- return nodeCount;
- }
-
- public void setNodeCount(int nodeCount) {
- this.nodeCount = nodeCount;
- }
-
- public int getNumberOfThreads() {
- return numberOfThreads;
- }
-
- public void setNumberOfThreads(int numberOfThreads) {
- this.numberOfThreads = numberOfThreads;
- }
-
- public String getQueueName() {
- return queueName;
- }
-
- public void setQueueName(String queueName) {
- this.queueName = queueName;
- }
-
- public int getWallTimeLimit() {
- return wallTimeLimit;
- }
-
- public void setWallTimeLimit(int wallTimeLimit) {
- this.wallTimeLimit = wallTimeLimit;
- }
-
- public int getTotalPhysicalMemory() {
- return totalPhysicalMemory;
- }
-
- public void setTotalPhysicalMemory(int totalPhysicalMemory) {
- this.totalPhysicalMemory = totalPhysicalMemory;
- }
-
- public String getChessisNumber() {
- return chessisNumber;
- }
-
- public void setChessisNumber(String chessisNumber) {
- this.chessisNumber = chessisNumber;
- }
-
- public String getStaticWorkingDir() {
- return staticWorkingDir;
- }
-
- public void setStaticWorkingDir(String staticWorkingDir) {
- this.staticWorkingDir = staticWorkingDir;
- }
-
- public String getOverrideLoginUserName() {
- return overrideLoginUserName;
- }
-
- public void setOverrideLoginUserName(String overrideLoginUserName) {
- this.overrideLoginUserName = overrideLoginUserName;
- }
-
- public String getOverrideScratchLocation() {
- return overrideScratchLocation;
- }
-
- public void setOverrideScratchLocation(String overrideScratchLocation) {
- this.overrideScratchLocation = overrideScratchLocation;
- }
-
- public String getOverrideAllocationProjectNumber() {
- return overrideAllocationProjectNumber;
- }
-
- public void setOverrideAllocationProjectNumber(String overrideAllocationProjectNumber) {
- this.overrideAllocationProjectNumber = overrideAllocationProjectNumber;
- }
-
- public UserConfigurationDataEntity getUserConfiguration() {
- return userConfiguration;
- }
-
- public void setUserConfiguration(UserConfigurationDataEntity userConfiguration) {
- this.userConfiguration = userConfiguration;
- }
-}*/

original_message: Removing outdated entity class


message: Updating entities according to expcatalog-mysql.sql

diff:
@@ -64,15 +64,10 @@ public class ExperimentEntity implements Serializable {
@Column(name = "GATEWAY_EXECUTION_ID")
public String gatewayExecutionId;
- @Column(name = "GATEWAY_INSTANCE_ID")
- public String gatewayInstanceId;
-
@Column(name = "ENABLE_EMAIL_NOTIFICATION")
public boolean enableEmailNotification;
@Lob
- @ElementCollection(fetch = FetchType.EAGER)
- @CollectionTable(name="EXPCAT_EXPERIMENT_EMAIL", joinColumns = @JoinColumn(name="EXPERIMENT_ID"))
@Column(name = "EMAIL_ADDRESSES")
public List<String> emailAddresses;
@@ -183,14 +178,6 @@ public class ExperimentEntity implements Serializable {
this.gatewayExecutionId = gatewayExecutionId;
}
- public String getGatewayInstanceId() {
- return gatewayInstanceId;
- }
-
- public void setGatewayInstanceId(String gatewayInstanceId) {
- this.gatewayInstanceId = gatewayInstanceId;
- }
-
public boolean isEnableEmailNotification() {
return enableEmailNotification;
}

diff:
@@ -57,8 +57,6 @@ public class ExperimentErrorEntity implements Serializable {
private boolean transientOrPersistent;
@Lob
- @ElementCollection
- @CollectionTable(name="EXPERIMENT_ERROR_ROOT_CAUSE_ERROR_ID", joinColumns = @JoinColumn(name="ERROR_ID"))
@Column(name = "ROOT_CAUSE_ERROR_ID_LIST")
private List<String> rootCauseErrorIdList;

diff:
@@ -44,7 +44,7 @@ public class ExperimentInputEntity implements Serializable {
@Column(name = "INPUT_VALUE")
private String value;
- @Column(name = "INPUT_TYPE")
+ @Column(name = "DATA_TYPE")
private String type;
@Column(name = "APPLICATION_ARGUMENT")
@@ -62,10 +62,10 @@ public class ExperimentInputEntity implements Serializable {
@Column(name = "INPUT_ORDER")
private int inputOrder;
- @Column(name = "REQUIRED")
+ @Column(name = "IS_REQUIRED")
private boolean isRequired;
- @Column(name = "REQUIRED_TO_ADDED_TO_COMMANDLINE")
+ @Column(name = "REQUIRED_TO_ADDED_TO_CMD")
private boolean requiredToAddedToCommandLine;
@Column(name = "DATA_STAGED")

diff:
@@ -44,16 +44,16 @@ public class ExperimentOutputEntity implements Serializable {
@Column(name = "OUTPUT_VALUE")
private String value;
- @Column(name = "OUTPUT_TYPE")
+ @Column(name = "DATA_TYPE")
private String type;
@Column(name = "APPLICATION_ARGUMENT")
private String applicationArgument;
- @Column(name = "REQUIRED")
+ @Column(name = "IS_REQUIRED")
private boolean isRequired;
- @Column(name = "REQUIRED_TO_ADDED_TO_COMMANDLINE")
+ @Column(name = "REQUIRED_TO_ADDED_TO_CMD")
private boolean requiredToAddedToCommandLine;
@Column(name = "DATA_MOVEMENT")

diff:
@@ -59,7 +59,7 @@ public class GatewayEntity implements Serializable {
@Column(name = "GATEWAY_PUBLIC_ABSTRACT")
private String gatewayPublicAbstract;
- @Column(name = "REVIEW_PROPOSAL_DESCRIPTION")
+ @Column(name = "GATEWAY_REVIEW_PROPOSAL_DESCRIPTION")
private String reviewProposalDescription;
@Column(name = "GATEWAY_ADMIN_FIRST_NAME")

diff:
@@ -60,11 +60,11 @@ public class JobEntity implements Serializable {
private String workingDir;
@Lob
- @Column(name = "STDOUT")
+ @Column(name = "STD_OUT")
private String stdOut;
@Lob
- @Column(name = "STDERR")
+ @Column(name = "STD_ERR")
private String stdErr;
@Column(name = "EXIT_CODE")

diff:
@@ -67,12 +67,13 @@ public class ProcessEntity implements Serializable {
@Column(name = "GATEWAY_EXECUTION_ID")
private String gatewayExecutionId;
+ @Column(name = "GATEWAY_INSTANCE_ID")
+ private String gatewayInstanceId;
+
@Column(name = "ENABLE_EMAIL_NOTIFICATION")
private boolean enableEmailNotification;
@Lob
- @ElementCollection
- @CollectionTable(name="PROCESS_EMAIL", joinColumns = @JoinColumn(name="PROCESS_ID"))
@Column(name = "EMAIL_ADDRESSES")
private List<String> emailAddresses;
@@ -205,6 +206,14 @@ public class ProcessEntity implements Serializable {
this.gatewayExecutionId = gatewayExecutionId;
}
+ public String getGatewayInstanceId() {
+ return gatewayInstanceId;
+ }
+
+ public void setGatewayInstanceId(String gatewayInstanceId) {
+ this.gatewayInstanceId = gatewayInstanceId;
+ }
+
public boolean isEnableEmailNotification() {
return enableEmailNotification;
}

diff:
@@ -57,8 +57,6 @@ public class ProcessErrorEntity implements Serializable {
private boolean transientOrPersistent;
@Lob
- @ElementCollection
- @CollectionTable(name="EXPCAT_EXPERIMENT_ERROR_ROOT_CAUSE_ERROR_ID", joinColumns = @JoinColumn(name="ERROR_ID"))
@Column(name = "ROOT_CAUSE_ERROR_ID_LIST")
private List<String> rootCauseErrorIdList;

diff:
@@ -44,7 +44,7 @@ public class ProcessInputEntity implements Serializable {
@Column(name = "INPUT_VALUE")
private String value;
- @Column(name = "INPUT_TYPE")
+ @Column(name = "DATA_TYPE")
private String type;
@Column(name = "APPLICATION_ARGUMENT")

diff:
@@ -44,7 +44,7 @@ public class ProcessOutputEntity implements Serializable {
@Column(name = "OUTPUT_VALUE")
private String value;
- @Column(name = "OUTPUT_TYPE")
+ @Column(name = "DATA_TYPE")
private String type;
@Column(name = "APPLICATION_ARGUMENT")

diff:
@@ -56,9 +56,6 @@ public class ProcessResourceScheduleEntity implements Serializable {
@Column(name = "TOTAL_PHYSICAL_MEMORY")
private int totalPhysicalMemory;
- @Column(name = "STATIC_WORKING_DIRECTORY")
- private String staticWorkingDir;
-
@OneToOne(targetEntity = ProcessEntity.class, cascade = CascadeType.ALL)
@PrimaryKeyJoinColumn(name = "PROCESS_ID", referencedColumnName = "PROCESS_ID")
private ProcessEntity process;
@@ -130,14 +127,6 @@ public class ProcessResourceScheduleEntity implements Serializable {
this.totalPhysicalMemory = totalPhysicalMemory;
}
- public String getStaticWorkingDir() {
- return staticWorkingDir;
- }
-
- public void setStaticWorkingDir(String staticWorkingDir) {
- this.staticWorkingDir = staticWorkingDir;
- }
-
public ProcessEntity getProcess() {
return process;
}

diff:
@@ -53,8 +53,8 @@ public class TaskEntity implements Serializable {
@Column(name = "TASK_DETAIL")
private String taskDetail;
- @Column(name = "SUB_TASK_MODEL")
- private ByteBuffer subTaskModel;
+ @Column(name = "TASK_INTERNAL_STORE")
+ private ByteBuffer taskInternalStore;
@OneToMany(targetEntity = TaskStatusEntity.class, cascade = CascadeType.ALL,
mappedBy = "task", fetch = FetchType.EAGER)
@@ -123,12 +123,12 @@ public class TaskEntity implements Serializable {
this.taskDetail = taskDetail;
}
- public ByteBuffer getSubTaskModel() {
- return subTaskModel;
+ public ByteBuffer getTaskInternalStore() {
+ return taskInternalStore;
}
- public void setSubTaskModel(ByteBuffer subTaskModel) {
- this.subTaskModel = subTaskModel;
+ public void setTaskInternalStore(ByteBuffer taskInternalStore) {
+ this.taskInternalStore = taskInternalStore;
}
public List<TaskStatusEntity> getTaskStatuses() {

diff:
@@ -57,8 +57,7 @@ public class TaskErrorEntity implements Serializable {
private boolean transientOrPersistent;
@Lob
- @ElementCollection
- @CollectionTable(name="EXPCAT_EXPERIMENT_ERROR_ROOT_CAUSE_ERROR_ID", joinColumns = @JoinColumn(name="ERROR_ID"))
+ @Column(name = "ROOT_CAUSE_ERROR_ID_LIST")
private List<String> rootCauseErrorIdList;
@ManyToOne(targetEntity = TaskEntity.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY)