aboutsummaryrefslogtreecommitdiffstats
path: root/mso-catalog-db
diff options
context:
space:
mode:
Diffstat (limited to 'mso-catalog-db')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AuthenticationType.java25
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java278
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java261
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java208
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServerType.java25
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java71
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepository.java10
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java14
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java10
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/BaseTest.java15
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CloudIdentityTest.java103
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CloudifyManagerTest.java47
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepositoryTest.java21
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java37
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java21
-rw-r--r--mso-catalog-db/src/test/resources/data.sql7
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql51
17 files changed, 1183 insertions, 21 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AuthenticationType.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AuthenticationType.java
new file mode 100644
index 0000000000..b1cb07447d
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AuthenticationType.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.beans;
+
+public enum AuthenticationType {
+ USERNAME_PASSWORD, RACKSPACE_APIKEY;
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java
new file mode 100644
index 0000000000..e6d02c6836
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java
@@ -0,0 +1,278 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.beans;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.Id;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+/**
+ * EntityBean class for a CloudIdentity. This bean represents a cloud identity
+ * service instance (i.e. a DCP node) in the NVP/AIC cloud. It will be loaded via
+ * CloudConfig object, of which it is a component.
+ *
+ */
+@Entity
+@Table(name = "identity_services")
+public class CloudIdentity {
+
+ @JsonProperty
+ @BusinessKey
+ @Id
+ @Column(name = "ID")
+ private String id;
+
+ @JsonProperty("identity_url")
+ @BusinessKey
+ @Column(name = "IDENTITY_URL")
+ private String identityUrl;
+
+ @JsonProperty("mso_id")
+ @BusinessKey
+ @Column(name = "MSO_ID")
+ private String msoId;
+
+ @JsonProperty("mso_pass")
+ @BusinessKey
+ @Column(name = "MSO_PASS")
+ private String msoPass;
+
+ @JsonProperty("admin_tenant")
+ @BusinessKey
+ @Column(name = "ADMIN_TENANT")
+ private String adminTenant;
+
+ @JsonProperty("member_role")
+ @BusinessKey
+ @Column(name = "MEMBER_ROLE")
+ private String memberRole;
+
+ @JsonProperty("tenant_metadata")
+ @BusinessKey
+ @Column(name = "TENANT_METADATA")
+ private Boolean tenantMetadata;
+
+ @JsonProperty("identity_server_type")
+ @BusinessKey
+ @Enumerated(EnumType.STRING)
+ @Column(name = "IDENTITY_SERVER_TYPE")
+ private ServerType identityServerType;
+
+ @JsonProperty("identity_authentication_type")
+ @BusinessKey
+ @Enumerated(EnumType.STRING)
+ @Column(name = "IDENTITY_AUTHENTICATION_TYPE")
+ private AuthenticationType identityAuthenticationType;
+
+ @JsonProperty("last_updated_by")
+ @BusinessKey
+ @Column(name = "LAST_UPDATED_BY")
+ private String lastUpdatedBy ;
+
+ @JsonProperty("creation_timestamp")
+ @BusinessKey
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ @JsonProperty("update_timestamp")
+ @BusinessKey
+ @Column(name = "UPDATE_TIMESTAMP")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date updated;
+
+ public CloudIdentity() {}
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ this.updated = new Date();
+ }
+
+ public String getId () {
+ return id;
+ }
+
+ public void setId (String id) {
+ this.id = id;
+ }
+
+ public String getIdentityUrl() {
+ return this.identityUrl;
+ }
+ public void setIdentityUrl(String url) {
+ this.identityUrl = url;
+ }
+
+ public String getMsoId () {
+ return msoId;
+ }
+
+ public void setMsoId (String id) {
+ this.msoId = id;
+ }
+
+ public String getMsoPass () {
+ return msoPass;
+ }
+
+ public void setMsoPass (String pwd) {
+ this.msoPass = pwd;
+ }
+
+ public String getAdminTenant () {
+ return adminTenant;
+ }
+
+ public String getLastUpdatedBy() {
+ return lastUpdatedBy;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public Date getUpdated() {
+ return updated;
+ }
+
+ public void setLastUpdatedBy(String lastUpdatedBy) {
+ this.lastUpdatedBy = lastUpdatedBy;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public void setUpdated(Date updated) {
+ this.updated = updated;
+ }
+
+ public void setAdminTenant (String tenant) {
+ this.adminTenant = tenant;
+ }
+
+ public String getMemberRole () {
+ return memberRole;
+ }
+
+ public void setMemberRole (String role) {
+ this.memberRole = role;
+ }
+
+ public Boolean getTenantMetadata() {
+ return tenantMetadata;
+ }
+
+ public void setTenantMetadata (Boolean meta) {
+ this.tenantMetadata = meta;
+ }
+
+ public ServerType getIdentityServerType() {
+ return this.identityServerType;
+ }
+ public void setIdentityServerType(ServerType ist) {
+ this.identityServerType = ist;
+ }
+ public String getIdentityServerTypeAsString() {
+ return this.identityServerType.toString();
+ }
+ /**
+ * @return the identityAuthenticationType
+ */
+ public AuthenticationType getIdentityAuthenticationType() {
+ return identityAuthenticationType;
+ }
+
+ /**
+ * @param identityAuthenticationType the identityAuthenticationType to set
+ */
+ public void setIdentityAuthenticationType(AuthenticationType identityAuthenticationType) {
+ this.identityAuthenticationType = identityAuthenticationType;
+ }
+
+ @Override
+ public CloudIdentity clone() {
+ CloudIdentity cloudIdentityCopy = new CloudIdentity();
+
+ cloudIdentityCopy.id = this.id;
+ cloudIdentityCopy.identityUrl = this.identityUrl;
+ cloudIdentityCopy.msoId = this.msoId;
+ cloudIdentityCopy.msoPass = this.msoPass;
+ cloudIdentityCopy.adminTenant = this.adminTenant;
+ cloudIdentityCopy.memberRole = this.memberRole;
+ cloudIdentityCopy.tenantMetadata = this.tenantMetadata;
+ cloudIdentityCopy.identityServerType = this.identityServerType;
+ cloudIdentityCopy.identityAuthenticationType = this.identityAuthenticationType;
+
+ return cloudIdentityCopy;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", getId())
+ .append("identityUrl", getIdentityUrl()).append("msoId", getMsoId())
+ .append("adminTenant", getAdminTenant()).append("memberRole", getMemberRole())
+ .append("tenantMetadata", getTenantMetadata()).append("identityServerType", getIdentityServerType())
+ .append("identityAuthenticationType", getIdentityAuthenticationType()).toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (other == null) {
+ return false;
+ }
+ if (!getClass().equals(other.getClass())) {
+ return false;
+ }
+ CloudIdentity castOther = (CloudIdentity) other;
+ return new EqualsBuilder().append(getId(), castOther.getId())
+ .append(getIdentityUrl(), castOther.getIdentityUrl()).append(getMsoId(), castOther.getMsoId())
+ .append(getMsoPass(), castOther.getMsoPass()).append(getAdminTenant(), castOther.getAdminTenant())
+ .append(getMemberRole(), castOther.getMemberRole())
+ .append(getTenantMetadata(), castOther.getTenantMetadata())
+ .append(getIdentityServerType(), castOther.getIdentityServerType())
+ .append(getIdentityAuthenticationType(), castOther.getIdentityAuthenticationType()).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder(1, 31).append(getId()).append(getIdentityUrl()).append(getMsoId())
+ .append(getMsoPass()).append(getAdminTenant()).append(getMemberRole()).append(getTenantMetadata())
+ .append(getIdentityServerType()).append(getIdentityAuthenticationType()).toHashCode();
+ }
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java
new file mode 100644
index 0000000000..53c97fbce6
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java
@@ -0,0 +1,261 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.beans;
+
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+/**
+ * EntityBean class for a CloudSite. This bean represents a cloud location
+ * (i.e. and LCP node) in the NVP/AIC cloud. It will be loaded via CloudConfig
+ * object, of which it is a component
+ *
+ */
+@Entity
+@Table(name = "cloud_sites")
+public class CloudSite {
+
+ @JsonProperty
+ @BusinessKey
+ @Id
+ @Column(name = "ID")
+ private String id;
+
+ @JsonProperty("region_id")
+ @BusinessKey
+ @Column(name = "REGION_ID")
+ private String regionId;
+
+ @JsonProperty("aic_version")
+ @BusinessKey
+ @Column(name = "CLOUD_VERSION")
+ private String cloudVersion;
+
+ @JsonProperty("clli")
+ @BusinessKey
+ @Column(name = "CLLI")
+ private String clli;
+
+ @JsonProperty("platform")
+ @BusinessKey
+ @Column(name = "PLATFORM")
+ private String platform;
+
+ @JsonProperty("orchestrator")
+ @BusinessKey
+ @Column(name = "ORCHESTRATOR")
+ private String orchestrator;
+
+ @JsonProperty("cloudify_id")
+ @BusinessKey
+ @Column(name = "CLOUDIFY_ID")
+ private String cloudifyId;
+
+ // Derived property (set by CloudConfig loader based on identityServiceId)
+ @BusinessKey
+ @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @JoinColumn(name = "IDENTITY_SERVICE_ID")
+ private CloudIdentity identityService;
+
+ @BusinessKey
+ @JsonProperty("identity_service_id")
+ transient private String identityServiceId;
+
+ @JsonProperty("last_updated_by")
+ @BusinessKey
+ @Column(name = "LAST_UPDATED_BY")
+ private String lastUpdatedBy ;
+
+ @JsonProperty("creation_timestamp")
+ @BusinessKey
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ @JsonProperty("update_timestamp")
+ @BusinessKey
+ @Column(name = "UPDATE_TIMESTAMP")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date updated;
+
+ public CloudSite() {
+
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ this.updated = new Date();
+ }
+
+ public CloudSite(CloudSite site) {
+ this.cloudVersion = site.getCloudVersion();
+ this.clli = site.getClli();
+ this.id = site.getId();
+ this.identityService = site.getIdentityService();
+ this.orchestrator = site.getOrchestrator();
+ this.platform = site.getPlatform();
+ this.regionId = site.getRegionId();
+ this.identityServiceId = site.getIdentityServiceId();
+ }
+ public String getId() {
+ return this.id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getRegionId() {
+ return regionId;
+ }
+
+ public void setRegionId(String regionId) {
+ this.regionId = regionId;
+ }
+
+ public String getIdentityServiceId() {
+ return identityServiceId == null ? (identityService== null? null:identityService.getId()):identityServiceId;
+ }
+
+ public String getCloudVersion() {
+ return cloudVersion;
+ }
+
+ public void setCloudVersion(String cloudVersion) {
+ this.cloudVersion = cloudVersion;
+ }
+
+ public String getClli() {
+ return clli;
+ }
+
+ public void setClli(String clli) {
+ this.clli = clli;
+ }
+
+ public String getCloudifyId() {
+ return cloudifyId;
+ }
+
+ public void setCloudifyId(String cloudifyId) {
+ this.cloudifyId = cloudifyId;
+ }
+
+ public String getLastUpdatedBy() {
+ return lastUpdatedBy;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public Date getUpdated() {
+ return updated;
+ }
+
+ public void setLastUpdatedBy(String lastUpdatedBy) {
+ this.lastUpdatedBy = lastUpdatedBy;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public void setUpdated(Date updated) {
+ this.updated = updated;
+ }
+
+ public String getPlatform() {
+ return platform;
+ }
+
+ public void setPlatform(String platform) {
+ this.platform = platform;
+ }
+
+ public String getOrchestrator() {
+ return orchestrator;
+ }
+
+ public void setOrchestrator(String orchestrator) {
+ this.orchestrator = orchestrator;
+ }
+
+ public CloudIdentity getIdentityService () {
+ return identityService;
+ }
+
+ public void setIdentityService (CloudIdentity identity) {
+ this.identityService = identity;
+ }
+ @Deprecated
+ public void setIdentityServiceId(String identityServiceId) {
+ this.identityServiceId = identityServiceId;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("regionId", getRegionId())
+ .append("identityServiceId", getIdentityServiceId()).append("cloudVersion", getCloudVersion())
+ .append("clli", getClli()).append("cloudifyId", getCloudifyId()).append("platform", getPlatform())
+ .append("orchestrator", getOrchestrator()).toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (other == null) {
+ return false;
+ }
+ if (!getClass().equals(other.getClass())) {
+ return false;
+ }
+ CloudSite castOther = (CloudSite) other;
+ return new EqualsBuilder().append(getRegionId(), castOther.getRegionId())
+ .append(getIdentityServiceId(), castOther.getIdentityServiceId())
+ .append(getCloudVersion(), castOther.getCloudVersion()).append(getClli(), castOther.getClli()).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder(1, 31).append(getRegionId()).append(getIdentityServiceId()).append(getCloudVersion())
+ .append(getClli()).toHashCode();
+ }
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java
new file mode 100644
index 0000000000..eb9078fd57
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java
@@ -0,0 +1,208 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.beans;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.openpojo.business.annotation.BusinessKey;
+import org.onap.so.logger.MsoLogger;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+/**
+ * EntityBean class for a Cloudify Manager. This bean represents a Cloudify
+ * node through which TOSCA-based VNFs may be deployed. Each CloudSite in the
+ * CloudConfig may have a Cloudify Manager for deployments using TOSCA blueprints.
+ * Cloudify Managers may support multiple Cloud Sites, but each site will have
+ * at most one Cloudify Manager.
+ *
+ * This does not replace the ability to use the CloudSite directly via Openstack.
+ *
+ * @author JC1348
+ */
+@Entity
+@Table(name = "cloudify_managers")
+public class CloudifyManager {
+
+ @JsonProperty
+ @BusinessKey
+ @Id
+ @Column(name = "ID")
+ private String id;
+
+ @BusinessKey
+ @JsonProperty ("cloudify_url")
+ @Column(name = "CLOUDIFY_URL")
+ private String cloudifyUrl;
+
+ @BusinessKey
+ @JsonProperty("username")
+ @Column(name = "USERNAME")
+ private String username;
+
+ @BusinessKey
+ @JsonProperty("password")
+ @Column(name = "PASSWORD")
+ private String password;
+
+ @BusinessKey
+ @JsonProperty("version")
+ @Column(name = "VERSION")
+ private String version;
+
+ @JsonProperty("last_updated_by")
+ @BusinessKey
+ @Column(name = "LAST_UPDATED_BY")
+ private String lastUpdatedBy ;
+
+ @JsonProperty("creation_timestamp")
+ @BusinessKey
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ @JsonProperty("update_timestamp")
+ @BusinessKey
+ @Column(name = "UPDATE_TIMESTAMP")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date updated;
+
+ public CloudifyManager() {}
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ this.updated = new Date();
+ }
+
+ public String getId() {
+ return id;
+ }
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getCloudifyUrl() {
+ return cloudifyUrl;
+ }
+
+ public void setCloudifyUrl(String cloudifyUrl) {
+ this.cloudifyUrl = cloudifyUrl;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getLastUpdatedBy() {
+ return lastUpdatedBy;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public Date getUpdated() {
+ return updated;
+ }
+
+ public void setLastUpdatedBy(String lastUpdatedBy) {
+ this.lastUpdatedBy = lastUpdatedBy;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public void setUpdated(Date updated) {
+ this.updated = updated;
+ }
+
+ @Override
+ public CloudifyManager clone() {
+ CloudifyManager cloudifyManagerCopy = new CloudifyManager();
+ cloudifyManagerCopy.id = this.id;
+ cloudifyManagerCopy.cloudifyUrl = this.cloudifyUrl;
+ cloudifyManagerCopy.username = this.username;
+ cloudifyManagerCopy.password = this.password;
+ cloudifyManagerCopy.version = this.version;
+ return cloudifyManagerCopy;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", getId())
+ .append("cloudifyUrl", getCloudifyUrl()).append("username", getUsername())
+ .append("password", getPassword()).append("version", getVersion()).toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (other == null) {
+ return false;
+ }
+ if (!getClass().equals(other.getClass())) {
+ return false;
+ }
+ CloudifyManager castOther = (CloudifyManager) other;
+ return new EqualsBuilder().append(getId(), castOther.getId())
+ .append(getCloudifyUrl(), castOther.getCloudifyUrl()).append(getUsername(), castOther.getUsername())
+ .append(getPassword(), castOther.getPassword()).append(getVersion(), castOther.getVersion()).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder(1, 31).append(getId()).append(getCloudifyUrl()).append(getUsername())
+ .append(getPassword()).append(getVersion()).toHashCode();
+ }
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServerType.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServerType.java
new file mode 100644
index 0000000000..d8d386db8c
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServerType.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.beans;
+
+public enum ServerType {
+ KEYSTONE, ORM;
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index edfaba0fb2..0caafc794b 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -32,18 +32,17 @@ import org.onap.so.db.catalog.beans.ResourceType;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudifyManager;
import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.onap.so.logging.jaxrs.filter.jersey.SpringClientFilter;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpRequest;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
-import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestFactory;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
-import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
@@ -100,8 +99,14 @@ public class CatalogDbClient {
private Client<ServiceRecipe> serviceRecipeClient;
+ private Client<CloudSite> cloudSiteClient;
+
+ private Client<CloudIdentity> cloudIdentityClient;
+
+ private Client<CloudifyManager> cloudifyManagerClient;
+
@Value("${mso.catalog.db.spring.endpoint}")
- protected String endpoint;
+ private String endpoint;
@Value("${mso.db.auth}")
private String msoAdaptersAuth;
@@ -116,21 +121,14 @@ public class CatalogDbClient {
public CatalogDbClient() {
ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory());
- ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(new RestTemplateConfigurer() {
-
- public void configure(RestTemplate restTemplate) {
- restTemplate.getInterceptors().add((new SpringClientFilter()));
-
- restTemplate.getInterceptors().add(new ClientHttpRequestInterceptor() {
-
- public ClientHttpResponse intercept(HttpRequest request, byte[] body,
- ClientHttpRequestExecution execution) throws IOException {
-
- request.getHeaders().add("Authorization", msoAdaptersAuth);
- return execution.execute(request, body);
- }
- });
- }
+ ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> {
+ restTemplate.getInterceptors().add((new SpringClientFilter()));
+
+ restTemplate.getInterceptors().add((request, body, execution) -> {
+
+ request.getHeaders().add("Authorization", msoAdaptersAuth);
+ return execution.execute(request, body);
+ });
}).build().buildClientFactory();
serviceClient = clientFactory.create(Service.class);
orchestrationClient = clientFactory.create(OrchestrationFlow.class);
@@ -146,6 +144,9 @@ public class CatalogDbClient {
instanceGroupClient = clientFactory.create(InstanceGroup.class);
networkCollectionResourceCustomizationClient = clientFactory.create(NetworkCollectionResourceCustomization.class);
collectionNetworkResourceCustomizationClient = clientFactory.create(CollectionNetworkResourceCustomization.class);
+ cloudSiteClient = clientFactory.create(CloudSite.class);
+ cloudIdentityClient = clientFactory.create(CloudIdentity.class);
+ cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
}
@@ -303,6 +304,24 @@ public class CatalogDbClient {
return collectionNetworkResourceCustomizationClient.get(uri);
}
+ public CloudifyManager getCloudifyManager(String id) {
+ return this.getSingleCloudifyManager(UriBuilder.fromUri(endpoint+"/cloudifyManager/"+id).build());
+ }
+
+ public CloudSite getCloudSite(String id){
+ return this.getSinglCloudSite(UriBuilder.fromUri(endpoint+"/cloudSite/"+id).build());
+ }
+
+ public CloudIdentity getCloudIdentity(String id){
+ return this.getSingleCloudIdentity(UriBuilder.fromUri(endpoint+"/cloudIdentity/"+id).build());
+ }
+
+ public CloudSite getCloudSiteByClliAndAicVersion (String clli, String aicVersion){
+ return this.getSinglCloudSite(UriBuilder.fromUri(endpoint+"/cloud_sites/search/findByClliAndCloudVersion")
+ .queryParam("CLLI",clli).queryParam("AIC_VERSION",aicVersion)
+ .build());
+ }
+
private InstanceGroup getSingleInstanceGroup(URI uri) {
return instanceGroupClient.get(uri);
}
@@ -327,6 +346,18 @@ public class CatalogDbClient {
return serviceRecipeClient.get(uri);
}
+ protected CloudSite getSinglCloudSite(URI uri) {
+ return cloudSiteClient.get(uri);
+ }
+
+ protected CloudIdentity getSingleCloudIdentity(URI uri) {
+ return cloudIdentityClient.get(uri);
+ }
+
+ protected CloudifyManager getSingleCloudifyManager(URI uri) {
+ return cloudifyManagerClient.get(uri);
+ }
+
public Service getServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) {
return this.getSingleService(
UriBuilder.fromUri(findByModelVersionAndModelInvariantUUIDURI)
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepository.java
new file mode 100644
index 0000000000..c1714821ee
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepository.java
@@ -0,0 +1,10 @@
+package org.onap.so.db.catalog.data.repository;
+
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+@RepositoryRestResource(collectionResourceRel = "cloudIdentity", path = "cloudIdentity")
+public interface CloudIdentityRepository extends JpaRepository<CloudIdentity, String> {
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java
new file mode 100644
index 0000000000..78f117b3ae
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java
@@ -0,0 +1,14 @@
+package org.onap.so.db.catalog.data.repository;
+
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+import javax.transaction.Transactional;
+
+@RepositoryRestResource(collectionResourceRel = "cloudSite", path = "cloudSite")
+@Transactional
+public interface CloudSiteRepository extends JpaRepository<CloudSite, String> {
+
+ CloudSite findByClliAndCloudVersion(String clli, String aicVersion);
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java
new file mode 100644
index 0000000000..dfa677b402
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java
@@ -0,0 +1,10 @@
+package org.onap.so.db.catalog.data.repository;
+
+import org.onap.so.db.catalog.beans.CloudifyManager;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+@RepositoryRestResource(collectionResourceRel = "cloudifyManager", path = "cloudifyManager")
+public interface CloudifyManagerRepository extends JpaRepository<CloudifyManager, String> {
+
+}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/BaseTest.java b/mso-catalog-db/src/test/java/org/onap/so/BaseTest.java
new file mode 100644
index 0000000000..6e6db11c45
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/BaseTest.java
@@ -0,0 +1,15 @@
+package org.onap.so;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class BaseTest {
+ @Test
+ public void testNothing(){}
+}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CloudIdentityTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CloudIdentityTest.java
new file mode 100644
index 0000000000..f8f3435fe1
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CloudIdentityTest.java
@@ -0,0 +1,103 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.beans;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.security.GeneralSecurityException;
+
+import org.junit.Test;
+import org.onap.so.db.catalog.beans.AuthenticationType;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.ServerType;
+import org.onap.so.utils.CryptoUtils;
+
+public class CloudIdentityTest {
+
+ private CloudIdentity cloudIdentity = new CloudIdentity();
+ private static final String ID = "testId";
+ private static final String IDENTITY_URL = "testIdentityUrl";
+ private static final String MSO_ID = "testMsoId";
+ private static final String MSO_PASS = "testMsoPassword";
+ private static final String ADMIN_TENANT = "testAdminTenant";
+ private static final String MEMBER_ROLE = "testMemberRole";
+ private static final Boolean TENANT_METADATA = true;
+
+ @Test
+ public final void testCloudIdentity () {
+ CloudIdentity id = new CloudIdentity ();
+ id.setAdminTenant ("AdminTenant");
+ id.setId ("id");
+// id.setKeystoneUrl ("keystone");
+ id.setIdentityUrl ("keystone");
+ id.setMemberRole ("member");
+ id.setMsoId ("msoId");
+ id.setMsoPass (CryptoUtils.encryptCloudConfigPassword("password"));
+ id.setTenantMetadata (true);
+ id.setIdentityServerType(null);
+ id.setIdentityAuthenticationType(null);
+
+
+ assertTrue (id.getAdminTenant ().equals ("AdminTenant"));
+ assertTrue (id.getId ().equals ("id"));
+// assertTrue (id.getKeystoneUrl ().equals ("keystone"));
+ assertTrue (id.getMemberRole ().equals ("member"));
+ assertTrue (id.getMsoId ().equals ("msoId"));
+ assertTrue (CryptoUtils.decryptCloudConfigPassword(id.getMsoPass()).equals ("password"));
+ assertTrue (id.getTenantMetadata ());
+// assertTrue (id.toString ().contains ("keystone"));
+ assertTrue(id.toString().contains("null"));
+ }
+
+ @Test
+ public final void testEncryption () throws GeneralSecurityException {
+ String encrypted = CryptoUtils.encryptCloudConfigPassword("password");
+ assertTrue (encrypted != null);
+ assertTrue (!encrypted.equals ("password"));
+ }
+
+ @Test
+ public void cloneTest() {
+ cloudIdentity = setupCloudIdentity(cloudIdentity, ID, IDENTITY_URL, MSO_ID, MSO_PASS, ADMIN_TENANT,
+ MEMBER_ROLE, TENANT_METADATA, ServerType.ORM, AuthenticationType.USERNAME_PASSWORD);
+ CloudIdentity cloudIdentity2 = cloudIdentity.clone();
+
+ assertEquals(cloudIdentity.getClass(), cloudIdentity2.getClass());
+ }
+
+ private CloudIdentity setupCloudIdentity(CloudIdentity obj, String id, String identityUrl,
+ String msoId, String msoPass, String adminTenant, String memberRole, Boolean tenantMetadata,
+ ServerType identityServerType, AuthenticationType identityAuthenticationType) {
+ obj.setId(id);
+ obj.setIdentityUrl(identityUrl);
+ obj.setMsoId(msoId);
+ obj.setMsoPass(msoPass);
+ obj.setAdminTenant(adminTenant);
+ obj.setMemberRole(memberRole);
+ obj.setTenantMetadata(tenantMetadata);
+ obj.setIdentityServerType(identityServerType);
+ obj.setIdentityAuthenticationType(identityAuthenticationType);
+
+ return obj;
+ }
+}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CloudifyManagerTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CloudifyManagerTest.java
new file mode 100644
index 0000000000..2405a413cf
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CloudifyManagerTest.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.beans;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+import org.onap.so.db.catalog.beans.CloudifyManager;
+
+public class CloudifyManagerTest {
+
+ private CloudifyManager cloudifyManager = new CloudifyManager();
+ private static final String ID = "testId";
+ private static final String CLOUDIFY_URL = "testCloudifyUrl";
+ private static final String USERNAME = "testUsername";
+ private static final String PASSWORD = "testPassword";
+ private static final String VERSION = "testVersion";
+
+ @Test
+ public void cloneTest() {
+ cloudifyManager.setId(ID);
+ cloudifyManager.setCloudifyUrl(CLOUDIFY_URL);
+ cloudifyManager.setUsername(USERNAME);
+ cloudifyManager.setPassword(PASSWORD);
+ cloudifyManager.setVersion(VERSION);
+
+ CloudifyManager clone = cloudifyManager.clone();
+ assertEquals(cloudifyManager, clone);
+ }
+}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepositoryTest.java
new file mode 100644
index 0000000000..8fb65c2080
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudIdentityRepositoryTest.java
@@ -0,0 +1,21 @@
+package org.onap.so.db.catalog.data.repository;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.BaseTest;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class CloudIdentityRepositoryTest extends BaseTest {
+
+ @Autowired
+ private CloudIdentityRepository cloudIdentityRepository;
+
+ @Test
+ public void findOneTest() throws Exception {
+ CloudIdentity cloudIdentity = cloudIdentityRepository.findOne("mtn13");
+ Assert.assertNotNull(cloudIdentity);
+ Assert.assertEquals("mtn13",cloudIdentity.getId());
+ }
+
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java
new file mode 100644
index 0000000000..5a0770ead6
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java
@@ -0,0 +1,37 @@
+package org.onap.so.db.catalog.data.repository;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.BaseTest;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+
+public class CloudSiteRepositoryTest extends BaseTest {
+
+ @Autowired
+ private CloudSiteRepository cloudSiteRepository;
+
+ @Test
+ public void findByClliAndAicVersionTest() throws Exception {
+ CloudSite cloudSite = cloudSiteRepository.findByClliAndCloudVersion("MDT13","2.5");
+ Assert.assertNotNull(cloudSite);
+ Assert.assertEquals("mtn13",cloudSite.getId());
+ }
+
+ @Test
+ public void findOneTest() throws Exception {
+ CloudSite cloudSite = cloudSiteRepository.findOne("mtn13");
+ Assert.assertNotNull(cloudSite);
+ Assert.assertEquals("mtn13",cloudSite.getId());
+ }
+
+ @Test
+ public void findAllTest() throws Exception {
+ List<CloudSite> cloudSiteList = cloudSiteRepository.findAll();
+ Assert.assertFalse(CollectionUtils.isEmpty(cloudSiteList));
+ }
+
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java
new file mode 100644
index 0000000000..21f95a7727
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java
@@ -0,0 +1,21 @@
+package org.onap.so.db.catalog.data.repository;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.BaseTest;
+import org.onap.so.db.catalog.beans.CloudifyManager;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class CloudifyManagerRepositoryTest extends BaseTest {
+
+ @Autowired
+ private CloudifyManagerRepository cloudifyManagerRepository;
+
+ @Test
+ public void findOneTest() throws Exception {
+ CloudifyManager cloudifyManager = cloudifyManagerRepository.findOne("mtn13");
+ Assert.assertNotNull(cloudifyManager);
+ Assert.assertEquals("mtn13", cloudifyManager.getId());
+ }
+
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql
index 604f493cf0..e16ca0fe8f 100644
--- a/mso-catalog-db/src/test/resources/data.sql
+++ b/mso-catalog-db/src/test/resources/data.sql
@@ -641,3 +641,10 @@ VALUES
('CUSTOM', 'PENDING_CREATE', 'CUSTOM', 'CONTINUE'),
('CUSTOM', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE'),
('CUSTOM', 'PRECREATED', 'CUSTOM', 'CONTINUE');
+
+
+INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', NULL, 'MSO_USER', '2018-07-17 14:05:08', '2018-07-17 14:05:08');
+
+INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('MTN13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', 'admin', 'admin', 1, 'KEYSTONE', 'USERNAME_PASSWORD', 'MSO_USER', '2018-07-17 14:02:33', '2018-07-17 14:02:33');
+
+INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'mtn13', 'MTN13', '2.5', 'MDT13', 'mtn13', NULL, 'orchestrator', 'MSO_USER', '2018-07-17 14:06:28', '2018-07-17 14:06:28'); \ No newline at end of file
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index b4b9c0d28b..8ff04ea038 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -823,4 +823,53 @@ create table if not exists model (
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `vnf_recipe`
-CHANGE COLUMN `VNF_TYPE` `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL ; \ No newline at end of file
+CHANGE COLUMN `VNF_TYPE` `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL ;
+
+CREATE TABLE IF NOT EXISTS `identity_services` (
+ `ID` varchar(50) NOT NULL,
+ `IDENTITY_URL` varchar(200) DEFAULT NULL,
+ `MSO_ID` varchar(255) DEFAULT NULL,
+ `MSO_PASS` varchar(255) DEFAULT NULL,
+ `ADMIN_TENANT` varchar(50) DEFAULT NULL,
+ `MEMBER_ROLE` varchar(50) DEFAULT NULL,
+ `TENANT_METADATA` tinyint(1) DEFAULT 0,
+ `IDENTITY_SERVER_TYPE` varchar(50) DEFAULT NULL,
+ `IDENTITY_AUTHENTICATION_TYPE` varchar(50) DEFAULT NULL,
+ `LAST_UPDATED_BY` varchar(120) DEFAULT NULL,
+ `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(),
+ `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(),
+ PRIMARY KEY (`ID`)
+) ;
+
+
+CREATE TABLE IF NOT EXISTS `cloudify_managers` (
+ `ID` varchar(50) NOT NULL,
+ `CLOUDIFY_URL` varchar(200) DEFAULT NULL,
+ `USERNAME` varchar(255) DEFAULT NULL,
+ `PASSWORD` varchar(255) DEFAULT NULL,
+ `VERSION` varchar(20) DEFAULT NULL,
+ `LAST_UPDATED_BY` varchar(120) DEFAULT NULL,
+ `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(),
+ `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(),
+ PRIMARY KEY (`ID`)
+) ;
+
+
+
+
+CREATE TABLE IF NOT EXISTS `cloud_sites` (
+ `ID` varchar(50) NOT NULL,
+ `REGION_ID` varchar(11) DEFAULT NULL,
+ `IDENTITY_SERVICE_ID` varchar(50) DEFAULT NULL,
+ `CLOUD_VERSION` varchar(20) DEFAULT NULL,
+ `CLLI` varchar(11) DEFAULT NULL,
+ `CLOUDIFY_ID` varchar(50) DEFAULT NULL,
+ `PLATFORM` varchar(50) DEFAULT NULL,
+ `ORCHESTRATOR` varchar(50) DEFAULT NULL,
+ `LAST_UPDATED_BY` varchar(120) DEFAULT NULL,
+ `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(),
+ `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(),
+ PRIMARY KEY (`ID`),
+ KEY `FK_cloud_sites_identity_services` (`IDENTITY_SERVICE_ID`),
+ CONSTRAINT `FK_cloud_sites_identity_services` FOREIGN KEY (`IDENTITY_SERVICE_ID`) REFERENCES `identity_services` (`ID`)
+) ; \ No newline at end of file