You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2017/12/15 16:43:07 UTC
[airavata] 07/20: Replica catalog Entities, repositories and Junit
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch registry-refactoring
in repository https://gitbox.apache.org/repos/asf/airavata.git
commit c825fb0700f73af061903795f1ed1b4e313b80a1
Author: Abhiit Karanjkar <ay...@indiana.edu>
AuthorDate: Fri Oct 21 10:22:43 2016 -0400
Replica catalog Entities, repositories and Junit
---
.../entities/replicacatalog/DataProductEntity.java | 148 +++++++++++++++++++++
.../replicacatalog/DataProductMetadataEntity.java | 68 ++++++++++
.../DataProductMetadataEntityPK.java | 53 ++++++++
.../replicacatalog/DataReplicaLocationEntity.java | 136 +++++++++++++++++++
.../replicacatalog/DataReplicaMetadataEntity.java | 68 ++++++++++
.../DataReplicaMetadataEntityPK.java | 53 ++++++++
.../replicacatalog/DataProductRepository.java | 14 ++
.../DataReplicaLocationRepository.java | 14 ++
.../src/main/resources/META-INF/persistence.xml | 82 +++++++++++-
.../repositories/ReplicaCatalogRepositoryTest.java | 130 ++++++++++++++++++
10 files changed, 761 insertions(+), 5 deletions(-)
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataProductEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataProductEntity.java
new file mode 100644
index 0000000..94defce
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataProductEntity.java
@@ -0,0 +1,148 @@
+package org.apache.airavata.registry.core.entities.replicacatalog;
+
+import javax.persistence.*;
+import java.sql.Timestamp;
+
+/**
+ * Created by abhij on 10/13/2016.
+ */
+@Entity
+@Table(name = "data_product", schema = "airavata_catalog", catalog = "")
+public class DataProductEntity {
+ private String productUri;
+ private String gatewayId;
+ private String productName;
+ private String productDescription;
+ private String ownerName;
+ private String parentProductUri;
+ private Integer productSize;
+ private Timestamp creationTime;
+ private Timestamp lastModifiedTime;
+
+ @Id
+ @Column(name = "PRODUCT_URI")
+ public String getProductUri() {
+ return productUri;
+ }
+
+ public void setProductUri(String productUri) {
+ this.productUri = productUri;
+ }
+
+ @Basic
+ @Column(name = "GATEWAY_ID")
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ @Basic
+ @Column(name = "PRODUCT_NAME")
+ public String getProductName() {
+ return productName;
+ }
+
+ public void setProductName(String productName) {
+ this.productName = productName;
+ }
+
+ @Basic
+ @Column(name = "PRODUCT_DESCRIPTION")
+ public String getProductDescription() {
+ return productDescription;
+ }
+
+ public void setProductDescription(String productDescription) {
+ this.productDescription = productDescription;
+ }
+
+ @Basic
+ @Column(name = "OWNER_NAME")
+ public String getOwnerName() {
+ return ownerName;
+ }
+
+ public void setOwnerName(String ownerName) {
+ this.ownerName = ownerName;
+ }
+
+ @Basic
+ @Column(name = "PARENT_PRODUCT_URI")
+ public String getParentProductUri() {
+ return parentProductUri;
+ }
+
+ public void setParentProductUri(String parentProductUri) {
+ this.parentProductUri = parentProductUri;
+ }
+
+ @Basic
+ @Column(name = "PRODUCT_SIZE")
+ public Integer getProductSize() {
+ return productSize;
+ }
+
+ public void setProductSize(Integer productSize) {
+ this.productSize = productSize;
+ }
+
+ @Basic
+ @Column(name = "CREATION_TIME")
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ @Basic
+ @Column(name = "LAST_MODIFIED_TIME")
+ public Timestamp getLastModifiedTime() {
+ return lastModifiedTime;
+ }
+
+ public void setLastModifiedTime(Timestamp lastModifiedTime) {
+ this.lastModifiedTime = lastModifiedTime;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ DataProductEntity that = (DataProductEntity) o;
+
+ if (productUri != null ? !productUri.equals(that.productUri) : that.productUri != null) return false;
+ if (gatewayId != null ? !gatewayId.equals(that.gatewayId) : that.gatewayId != null) return false;
+ if (productName != null ? !productName.equals(that.productName) : that.productName != null) return false;
+ if (productDescription != null ? !productDescription.equals(that.productDescription) : that.productDescription != null)
+ return false;
+ if (ownerName != null ? !ownerName.equals(that.ownerName) : that.ownerName != null) return false;
+ if (parentProductUri != null ? !parentProductUri.equals(that.parentProductUri) : that.parentProductUri != null)
+ return false;
+ if (productSize != null ? !productSize.equals(that.productSize) : that.productSize != null) return false;
+ if (creationTime != null ? !creationTime.equals(that.creationTime) : that.creationTime != null) return false;
+ if (lastModifiedTime != null ? !lastModifiedTime.equals(that.lastModifiedTime) : that.lastModifiedTime != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = productUri != null ? productUri.hashCode() : 0;
+ result = 31 * result + (gatewayId != null ? gatewayId.hashCode() : 0);
+ result = 31 * result + (productName != null ? productName.hashCode() : 0);
+ result = 31 * result + (productDescription != null ? productDescription.hashCode() : 0);
+ result = 31 * result + (ownerName != null ? ownerName.hashCode() : 0);
+ result = 31 * result + (parentProductUri != null ? parentProductUri.hashCode() : 0);
+ result = 31 * result + (productSize != null ? productSize.hashCode() : 0);
+ result = 31 * result + (creationTime != null ? creationTime.hashCode() : 0);
+ result = 31 * result + (lastModifiedTime != null ? lastModifiedTime.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataProductMetadataEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataProductMetadataEntity.java
new file mode 100644
index 0000000..80a2d04
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataProductMetadataEntity.java
@@ -0,0 +1,68 @@
+package org.apache.airavata.registry.core.entities.replicacatalog;
+
+import javax.persistence.*;
+
+/**
+ * Created by abhij on 10/13/2016.
+ */
+@Entity
+@Table(name = "data_product_metadata", schema = "airavata_catalog", catalog = "")
+@IdClass(DataProductMetadataEntityPK.class)
+public class DataProductMetadataEntity {
+ private String productUri;
+ private String metadataKey;
+ private String metadataValue;
+
+ @Id
+ @Column(name = "PRODUCT_URI")
+ public String getProductUri() {
+ return productUri;
+ }
+
+ public void setProductUri(String productUri) {
+ this.productUri = productUri;
+ }
+
+ @Id
+ @Column(name = "METADATA_KEY")
+ public String getMetadataKey() {
+ return metadataKey;
+ }
+
+ public void setMetadataKey(String metadataKey) {
+ this.metadataKey = metadataKey;
+ }
+
+ @Basic
+ @Column(name = "METADATA_VALUE")
+ public String getMetadataValue() {
+ return metadataValue;
+ }
+
+ public void setMetadataValue(String metadataValue) {
+ this.metadataValue = metadataValue;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ DataProductMetadataEntity that = (DataProductMetadataEntity) o;
+
+ if (productUri != null ? !productUri.equals(that.productUri) : that.productUri != null) return false;
+ if (metadataKey != null ? !metadataKey.equals(that.metadataKey) : that.metadataKey != null) return false;
+ if (metadataValue != null ? !metadataValue.equals(that.metadataValue) : that.metadataValue != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = productUri != null ? productUri.hashCode() : 0;
+ result = 31 * result + (metadataKey != null ? metadataKey.hashCode() : 0);
+ result = 31 * result + (metadataValue != null ? metadataValue.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataProductMetadataEntityPK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataProductMetadataEntityPK.java
new file mode 100644
index 0000000..16a80d2
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataProductMetadataEntityPK.java
@@ -0,0 +1,53 @@
+package org.apache.airavata.registry.core.entities.replicacatalog;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+/**
+ * Created by abhij on 10/13/2016.
+ */
+public class DataProductMetadataEntityPK implements Serializable {
+ private String productUri;
+ private String metadataKey;
+
+ @Column(name = "PRODUCT_URI")
+ @Id
+ public String getProductUri() {
+ return productUri;
+ }
+
+ public void setProductUri(String productUri) {
+ this.productUri = productUri;
+ }
+
+ @Column(name = "METADATA_KEY")
+ @Id
+ public String getMetadataKey() {
+ return metadataKey;
+ }
+
+ public void setMetadataKey(String metadataKey) {
+ this.metadataKey = metadataKey;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ DataProductMetadataEntityPK that = (DataProductMetadataEntityPK) o;
+
+ if (productUri != null ? !productUri.equals(that.productUri) : that.productUri != null) return false;
+ if (metadataKey != null ? !metadataKey.equals(that.metadataKey) : that.metadataKey != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = productUri != null ? productUri.hashCode() : 0;
+ result = 31 * result + (metadataKey != null ? metadataKey.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataReplicaLocationEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataReplicaLocationEntity.java
new file mode 100644
index 0000000..64f647c
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataReplicaLocationEntity.java
@@ -0,0 +1,136 @@
+package org.apache.airavata.registry.core.entities.replicacatalog;
+
+import javax.persistence.*;
+import java.sql.Timestamp;
+
+/**
+ * Created by abhij on 10/13/2016.
+ */
+@Entity
+@Table(name = "data_replica_location", schema = "airavata_catalog", catalog = "")
+public class DataReplicaLocationEntity {
+ private String replicaId;
+ private String replicaName;
+ private String replicaDescription;
+ private String storageResourceId;
+ private String filePath;
+ private Timestamp creationTime;
+ private Timestamp lastModifiedTime;
+ private Timestamp validUntilTime;
+
+ @Id
+ @Column(name = "REPLICA_ID")
+ public String getReplicaId() {
+ return replicaId;
+ }
+
+ public void setReplicaId(String replicaId) {
+ this.replicaId = replicaId;
+ }
+
+ @Basic
+ @Column(name = "REPLICA_NAME")
+ public String getReplicaName() {
+ return replicaName;
+ }
+
+ public void setReplicaName(String replicaName) {
+ this.replicaName = replicaName;
+ }
+
+ @Basic
+ @Column(name = "REPLICA_DESCRIPTION")
+ public String getReplicaDescription() {
+ return replicaDescription;
+ }
+
+ public void setReplicaDescription(String replicaDescription) {
+ this.replicaDescription = replicaDescription;
+ }
+
+ @Basic
+ @Column(name = "STORAGE_RESOURCE_ID")
+ public String getStorageResourceId() {
+ return storageResourceId;
+ }
+
+ public void setStorageResourceId(String storageResourceId) {
+ this.storageResourceId = storageResourceId;
+ }
+
+ @Basic
+ @Column(name = "FILE_PATH")
+ public String getFilePath() {
+ return filePath;
+ }
+
+ public void setFilePath(String filePath) {
+ this.filePath = filePath;
+ }
+
+ @Basic
+ @Column(name = "CREATION_TIME")
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ @Basic
+ @Column(name = "LAST_MODIFIED_TIME")
+ public Timestamp getLastModifiedTime() {
+ return lastModifiedTime;
+ }
+
+ public void setLastModifiedTime(Timestamp lastModifiedTime) {
+ this.lastModifiedTime = lastModifiedTime;
+ }
+
+ @Basic
+ @Column(name = "VALID_UNTIL_TIME")
+ public Timestamp getValidUntilTime() {
+ return validUntilTime;
+ }
+
+ public void setValidUntilTime(Timestamp validUntilTime) {
+ this.validUntilTime = validUntilTime;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ DataReplicaLocationEntity that = (DataReplicaLocationEntity) o;
+
+ if (replicaId != null ? !replicaId.equals(that.replicaId) : that.replicaId != null) return false;
+ if (replicaName != null ? !replicaName.equals(that.replicaName) : that.replicaName != null) return false;
+ if (replicaDescription != null ? !replicaDescription.equals(that.replicaDescription) : that.replicaDescription != null)
+ return false;
+ if (storageResourceId != null ? !storageResourceId.equals(that.storageResourceId) : that.storageResourceId != null)
+ return false;
+ if (filePath != null ? !filePath.equals(that.filePath) : that.filePath != null) return false;
+ if (creationTime != null ? !creationTime.equals(that.creationTime) : that.creationTime != null) return false;
+ if (lastModifiedTime != null ? !lastModifiedTime.equals(that.lastModifiedTime) : that.lastModifiedTime != null)
+ return false;
+ if (validUntilTime != null ? !validUntilTime.equals(that.validUntilTime) : that.validUntilTime != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = replicaId != null ? replicaId.hashCode() : 0;
+ result = 31 * result + (replicaName != null ? replicaName.hashCode() : 0);
+ result = 31 * result + (replicaDescription != null ? replicaDescription.hashCode() : 0);
+ result = 31 * result + (storageResourceId != null ? storageResourceId.hashCode() : 0);
+ result = 31 * result + (filePath != null ? filePath.hashCode() : 0);
+ result = 31 * result + (creationTime != null ? creationTime.hashCode() : 0);
+ result = 31 * result + (lastModifiedTime != null ? lastModifiedTime.hashCode() : 0);
+ result = 31 * result + (validUntilTime != null ? validUntilTime.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataReplicaMetadataEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataReplicaMetadataEntity.java
new file mode 100644
index 0000000..7d3a0bf
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataReplicaMetadataEntity.java
@@ -0,0 +1,68 @@
+package org.apache.airavata.registry.core.entities.replicacatalog;
+
+import javax.persistence.*;
+
+/**
+ * Created by abhij on 10/13/2016.
+ */
+@Entity
+@Table(name = "data_replica_metadata", schema = "airavata_catalog", catalog = "")
+@IdClass(DataReplicaMetadataEntityPK.class)
+public class DataReplicaMetadataEntity {
+ private String replicaId;
+ private String metadataKey;
+ private String metadataValue;
+
+ @Id
+ @Column(name = "REPLICA_ID")
+ public String getReplicaId() {
+ return replicaId;
+ }
+
+ public void setReplicaId(String replicaId) {
+ this.replicaId = replicaId;
+ }
+
+ @Id
+ @Column(name = "METADATA_KEY")
+ public String getMetadataKey() {
+ return metadataKey;
+ }
+
+ public void setMetadataKey(String metadataKey) {
+ this.metadataKey = metadataKey;
+ }
+
+ @Basic
+ @Column(name = "METADATA_VALUE")
+ public String getMetadataValue() {
+ return metadataValue;
+ }
+
+ public void setMetadataValue(String metadataValue) {
+ this.metadataValue = metadataValue;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ DataReplicaMetadataEntity that = (DataReplicaMetadataEntity) o;
+
+ if (replicaId != null ? !replicaId.equals(that.replicaId) : that.replicaId != null) return false;
+ if (metadataKey != null ? !metadataKey.equals(that.metadataKey) : that.metadataKey != null) return false;
+ if (metadataValue != null ? !metadataValue.equals(that.metadataValue) : that.metadataValue != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = replicaId != null ? replicaId.hashCode() : 0;
+ result = 31 * result + (metadataKey != null ? metadataKey.hashCode() : 0);
+ result = 31 * result + (metadataValue != null ? metadataValue.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataReplicaMetadataEntityPK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataReplicaMetadataEntityPK.java
new file mode 100644
index 0000000..4625091
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/replicacatalog/DataReplicaMetadataEntityPK.java
@@ -0,0 +1,53 @@
+package org.apache.airavata.registry.core.entities.replicacatalog;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+/**
+ * Created by abhij on 10/13/2016.
+ */
+public class DataReplicaMetadataEntityPK implements Serializable {
+ private String replicaId;
+ private String metadataKey;
+
+ @Column(name = "REPLICA_ID")
+ @Id
+ public String getReplicaId() {
+ return replicaId;
+ }
+
+ public void setReplicaId(String replicaId) {
+ this.replicaId = replicaId;
+ }
+
+ @Column(name = "METADATA_KEY")
+ @Id
+ public String getMetadataKey() {
+ return metadataKey;
+ }
+
+ public void setMetadataKey(String metadataKey) {
+ this.metadataKey = metadataKey;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ DataReplicaMetadataEntityPK that = (DataReplicaMetadataEntityPK) o;
+
+ if (replicaId != null ? !replicaId.equals(that.replicaId) : that.replicaId != null) return false;
+ if (metadataKey != null ? !metadataKey.equals(that.metadataKey) : that.metadataKey != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = replicaId != null ? replicaId.hashCode() : 0;
+ result = 31 * result + (metadataKey != null ? metadataKey.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/replicacatalog/DataProductRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/replicacatalog/DataProductRepository.java
new file mode 100644
index 0000000..e3f88ec
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/replicacatalog/DataProductRepository.java
@@ -0,0 +1,14 @@
+package org.apache.airavata.registry.core.repositories.replicacatalog;
+
+import org.apache.airavata.model.data.replica.DataProductModel;
+import org.apache.airavata.registry.core.entities.replicacatalog.DataProductEntity;
+import org.apache.airavata.registry.core.repositories.AbstractRepository;
+
+/**
+ * Created by abhij on 10/13/2016.
+ */
+public class DataProductRepository extends AbstractRepository<DataProductModel, DataProductEntity, String> {
+ public DataProductRepository(Class<DataProductModel> thriftGenericClass, Class<DataProductEntity> dbEntityGenericClass) {
+ super(thriftGenericClass, dbEntityGenericClass);
+ }
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/replicacatalog/DataReplicaLocationRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/replicacatalog/DataReplicaLocationRepository.java
new file mode 100644
index 0000000..6a106fd
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/replicacatalog/DataReplicaLocationRepository.java
@@ -0,0 +1,14 @@
+package org.apache.airavata.registry.core.repositories.replicacatalog;
+
+import org.apache.airavata.model.data.replica.DataReplicaLocationModel;
+import org.apache.airavata.registry.core.entities.replicacatalog.DataReplicaLocationEntity;
+import org.apache.airavata.registry.core.repositories.AbstractRepository;
+
+/**
+ * Created by abhij on 10/13/2016.
+ */
+public class DataReplicaLocationRepository extends AbstractRepository<DataReplicaLocationModel, DataReplicaLocationEntity, String> {
+ public DataReplicaLocationRepository(Class<DataReplicaLocationModel> thriftGenericClass, Class<DataReplicaLocationEntity> dbEntityGenericClass) {
+ super(thriftGenericClass, dbEntityGenericClass);
+ }
+}
diff --git a/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml b/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml
index ddc99ef..eca158d 100644
--- a/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml
+++ b/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml
@@ -54,13 +54,85 @@
<class>org.apache.airavata.registry.core.entities.workflowcatalog.WorkflowInputEntity</class>
<class>org.apache.airavata.registry.core.entities.workflowcatalog.WorkflowOutputEntity</class>
<class>org.apache.airavata.registry.core.entities.workflowcatalog.WorkflowStatusEntity</class>
-
-
-
-
-
+ <class>org.apache.airavata.registry.core.entities.replicacatalog.DataProductEntity</class>
+ <class>org.apache.airavata.registry.core.entities.replicacatalog.DataProductMetadataEntity</class>
+ <class>org.apache.airavata.registry.core.entities.replicacatalog.DataReplicaLocationEntity</class>
+ <class>org.apache.airavata.registry.core.entities.replicacatalog.DataReplicaMetadataEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.GridftpDataMovementEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.ResourceJobManagerEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.ComputeResourceEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.ApplicationModuleEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.ApplicationDeploymentEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.ApplicationInterfaceEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.GatewayProfileEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.StorageResourceEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.ScpDataMovementEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.SshJobSubmissionEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.GlobusSubmissionEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.GsisshSubmissionEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.GridftpEndpointEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.ComputeResourcePreferenceEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.JobSubmissionInterfaceEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.DataMovementInterfaceEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.StorageInterfaceEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.LocalSubmissionEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.GlobusGkEndpointEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.UnicoreDatamovementEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.UnicoreSubmissionEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.GsisshPostjobcommandEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.GsisshPrejobcommandEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.GsisshExportEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.HostIpaddressEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.HostAliasEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.LibraryApendPathEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.LibraryPrependPathEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.AppEnvironmentEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.PrejobCommandEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.PostjobCommandEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.AppModuleMappingEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.ApplicationInputEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.ApplicationOutputEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.BatchQueueEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.ComputeResourceFileSystemEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.JobManagerCommandEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.ParallelismCommandEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.LocalDataMovementEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.DataStoragePreferenceEntity</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.GlobusGkEndpointPK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.GsisshPostjobcommandPK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.GsisshPrejobcommandPK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.GsisshExportPK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.HostIpaddressPK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.HostAliasPK</class>
+ <class>org.apache.airavata.registry.core.entities.workflowcatalog.WorkflowInputPK</class>
+ <class>org.apache.airavata.registry.core.entities.workflowcatalog.WorkflowOutputPK</class>
+ <class>org.apache.airavata.registry.core.entities.workflowcatalog.WorkflowStatusPK</class>
+ <class>org.apache.airavata.registry.core.entities.workflowcatalog.EdgePK</class>
+ <class>org.apache.airavata.registry.core.entities.workflowcatalog.PortPK</class>
+ <class>org.apache.airavata.registry.core.entities.workflowcatalog.NodePK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.GridftpEndpointPK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.PrejobCommandPK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.PostjobCommandPK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.AppModuleMappingPK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.ApplicationInputPK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.ApplicationOutputPK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.ComputeResourcePreferencePK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.BatchQueuePK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.ComputeResourceFileSystemPK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.JobSubmissionInterfacePK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.DataMovementInterfacePK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.StorageInterfacePK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.JobManagerCommandPK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.ParallelismCommandPK</class>
+ <class>org.apache.airavata.registry.core.entities.appcatalog.DataStoragePreferencePK</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
+ <properties>
+ <property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:3306/airavata_catalog"/>
+ <property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver"/>
+ <property name="openjpa.ConnectionUserName"/>
+ <property name="openjpa.ConnectionPassword"/>
+ </properties>
</persistence-unit>
</persistence>
diff --git a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/ReplicaCatalogRepositoryTest.java b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/ReplicaCatalogRepositoryTest.java
new file mode 100644
index 0000000..8fa515b
--- /dev/null
+++ b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/ReplicaCatalogRepositoryTest.java
@@ -0,0 +1,130 @@
+package org.apache.airavata.registry.core.repositories;
+
+import org.apache.airavata.model.WorkflowModel;
+import org.apache.airavata.model.data.replica.DataProductModel;
+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.GatewayApprovalStatus;
+import org.apache.airavata.model.workspace.Notification;
+import org.apache.airavata.model.workspace.Project;
+import org.apache.airavata.registry.core.entities.expcatalog.ExperimentEntity;
+import org.apache.airavata.registry.core.entities.replicacatalog.DataProductEntity;
+import org.apache.airavata.registry.core.entities.workflowcatalog.WorkflowEntity;
+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.workspacecatalog.UserProfileEntity;
+import org.apache.airavata.registry.core.repositories.expcatalog.ExperimentRepository;
+import org.apache.airavata.registry.core.repositories.replicacatalog.DataProductRepository;
+import org.apache.airavata.registry.core.repositories.workflowcatalog.WorkflowRepository;
+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.workspacecatalog.UserProfileRepository;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.UUID;
+
+/**
+ * Created by abhij on 10/14/2016.
+ */
+public class ReplicaCatalogRepositoryTest {
+
+ private GatewayRepository gatewayRepository;
+ private UserProfileRepository userProfileRepository;
+ private String gatewayId;
+ private String userId;
+ private String dataProductUri;
+
+ private final String NOTIFY_MESSAGE = "NotifyMe";
+ private final String USER_COMMENT = "TestComment";
+ private final String GATEWAY_DOMAIN = "test1.com";
+ private final String DATA_PRODUCT_DESCRIPTION = "testDesc";
+
+
+ @Before
+ public void setupRepository() {
+
+ gatewayRepository = new GatewayRepository(Gateway.class, GatewayEntity.class);
+ userProfileRepository = new UserProfileRepository(UserProfile.class, UserProfileEntity.class);
+
+
+ gatewayId = "test.com" + System.currentTimeMillis();
+ userId = "testuser" + System.currentTimeMillis();
+ dataProductUri = "uri" + System.currentTimeMillis();
+
+ }
+ @Test
+ public void dataProductRepositoryTest() {
+
+ DataProductRepository dataProductRepository = new DataProductRepository(DataProductModel.class, DataProductEntity.class);
+
+ /*
+ * 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());
+
+ /*
+ * DataProduct Instance creation
+ */
+ DataProductModel dataProduct = new DataProductModel();
+ dataProduct.setProductUri(dataProductUri);
+ dataProduct.setGatewayId(gatewayId);
+ dataProduct.setOwnerName(gatewayId);
+ dataProduct.setProductName("Product1234");
+
+
+ /*
+ * Data Product Repository Insert Operation Test
+ */
+ dataProduct = dataProductRepository.create(dataProduct);
+ Assert.assertTrue(!dataProduct.getProductUri().isEmpty());
+
+
+
+ /*
+ * DataProduct Repository Update Operation Test
+ */
+ dataProduct.setProductDescription(DATA_PRODUCT_DESCRIPTION);
+ dataProductRepository.update(dataProduct);
+ dataProduct = dataProductRepository.get(dataProduct.getProductUri());
+ Assert.assertEquals(dataProduct.getProductDescription(), DATA_PRODUCT_DESCRIPTION);
+
+ /*
+ * Data Product Repository Select Operation Test
+ */
+ dataProduct = null;
+ dataProduct = dataProductRepository.get(dataProductUri);
+ Assert.assertNotNull(dataProduct);
+
+ /*
+ * Workspace Project Repository Delete Operation
+ */
+ boolean deleteResult = dataProductRepository.delete(dataProductUri);
+ Assert.assertTrue(deleteResult);
+
+ deleteResult = userProfileRepository.delete(userId);
+ Assert.assertTrue(deleteResult);
+
+ deleteResult = gatewayRepository.delete(gatewayId);
+ Assert.assertTrue(deleteResult);
+
+ }
+}
--
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <co...@airavata.apache.org>.