aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-08-13 09:48:57 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-08-13 09:51:54 -0400
commita81aef2172c2cb4c6735f6018aee7deb04140b5d (patch)
tree2ef9daca8d8a075142d1f900bb8862c6ce322491 /adapters/mso-adapter-utils/src
parentc703669697084b5bd9be0f8f016bbf8ed11213a4 (diff)
Cloud config database table support
added cloud config database entities added cloud config repository converted existing cloud config class converted all code interacting with previous cloud config object created migration to automatically load cloud config properties from application.yaml Issue-ID: SO-854 Change-Id: Icf408e5d0fcabd1b7e97298963c555fae6964930 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-adapter-utils/src')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/AuthenticationType.java25
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java134
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudIdentity.java203
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudSite.java196
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudifyManager.java153
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/ServerType.java25
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java4
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java6
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java6
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java3
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java12
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java5
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtils.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java4
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java82
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java42
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java73
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java7
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java117
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudIdentityTest.java100
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudPojoTest.java5
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudifyManagerTest.java46
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java11
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest2.java5
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java6
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/HeatCacheEntryTest.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NeutronCacheEntryTest.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java10
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java13
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java14
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java18
-rw-r--r--adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json6
-rw-r--r--adapters/mso-adapter-utils/src/test/resources/application-test.yaml55
-rw-r--r--adapters/mso-adapter-utils/src/test/resources/data.sql3
35 files changed, 369 insertions, 1028 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/AuthenticationType.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/AuthenticationType.java
deleted file mode 100644
index 7cb2222525..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/AuthenticationType.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*-
- * ============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.cloud;
-
-public enum AuthenticationType {
- USERNAME_PASSWORD, RACKSPACE_APIKEY;
-}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java
index ef5f8232e0..5560282fda 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java
@@ -20,22 +20,16 @@
package org.onap.so.cloud;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
import java.util.Optional;
-import javax.annotation.PostConstruct;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.CloudifyManager;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
/**
* JavaBean JSON class for a CloudConfig. This bean maps a JSON-format cloud
@@ -52,61 +46,17 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
*
*/
-@Configuration
@JsonRootName("cloud_config")
-@ConfigurationProperties(prefix="cloud_config")
+@Component
public class CloudConfig {
private static final String CLOUD_SITE_VERSION = "2.5";
private static final String DEFAULT_CLOUD_SITE_ID = "default";
-
- @JsonProperty("identity_services")
- private Map<String, CloudIdentity> identityServices = new HashMap<>();
-
- @JsonProperty("cloud_sites")
- private Map <String, CloudSite> cloudSites = new HashMap<>();
-
- @JsonProperty("cloudify_managers")
- private Map <String, CloudifyManager> cloudifyManagers = new HashMap<>();
- @PostConstruct
- private void init() {
- for (Entry<String, CloudIdentity> entry : identityServices.entrySet()) {
- entry.getValue().setId(entry.getKey());
- }
-
- for (Entry<String, CloudSite> entry : cloudSites.entrySet()) {
- entry.getValue().setId(entry.getKey());
- }
-
- for (Entry<String, CloudifyManager> entry : cloudifyManagers.entrySet()) {
- entry.getValue().setId(entry.getKey());
- }
- }
-
- /**
- * Get a map of all identity services that have been loaded.
- */
- public Map<String, CloudIdentity> getIdentityServices() {
- return identityServices;
- }
+ @Autowired
+ private CatalogDbClient catalogDbClient;
/**
- * Get a map of all cloud sites that have been loaded.
- */
- public Map<String, CloudSite> getCloudSites() {
- return cloudSites;
- }
-
- /**
- * Get a Map of all CloudifyManagers that have been loaded.
- * @return the Map
- */
- public Map<String,CloudifyManager> getCloudifyManagers() {
- return cloudifyManagers;
- }
-
- /**
* Get a specific CloudSites, based on an ID. The ID is first checked
* against the regions, and if no match is found there, then against
* individual entries to try and find one with a CLLI that matches the ID
@@ -116,39 +66,28 @@ public class CloudConfig {
* @return an Optional of CloudSite object.
*/
public synchronized Optional<CloudSite> getCloudSite(String id) {
- if (id == null) {
- return Optional.empty();
- }
- if (cloudSites.containsKey(id)) {
- return Optional.ofNullable(cloudSites.get(id));
- } else {
- return getCloudSiteWithClli(id);
- }
- }
-
- public String getCloudSiteId(CloudSite cloudSite) {
- for(Entry<String, CloudSite> entry : this.getCloudSites().entrySet()){
- if(entry.getValue().equals(cloudSite))
- return entry.getKey();
- }
- return null;
- }
+ if (id == null) {
+ return Optional.empty();
+ }
+ CloudSite cloudSite = catalogDbClient.getCloudSite(id);
+ if (cloudSite != null) {
+ return Optional.of(cloudSite);
+ } else {
+ return getCloudSiteWithClli(id);
+ }
+ }
+
/**
* Get a specific CloudSites, based on a CLLI and (optional) version, which
* will be matched against the aic_version field of the CloudSite.
*
* @param clli
* the CLLI to match
- * @param version
- * the version to match; may be null in which case any version
- * matches
* @return a CloudSite, or null of no match found
*/
private Optional<CloudSite> getCloudSiteWithClli(String clli) {
- Optional <CloudSite> cloudSiteOptional = cloudSites.values().stream().filter(cs ->
- cs.getClli() != null && clli.equals(cs.getClli()) && (CLOUD_SITE_VERSION.equals(cs.getAicVersion())))
- .findAny();
+ Optional <CloudSite> cloudSiteOptional = Optional.ofNullable(catalogDbClient.getCloudSiteByClliAndAicVersion(clli,CLOUD_SITE_VERSION));
if (cloudSiteOptional.isPresent()) {
return cloudSiteOptional;
} else {
@@ -157,8 +96,7 @@ public class CloudConfig {
}
private Optional<CloudSite> getDefaultCloudSite(String clli) {
- Optional<CloudSite> cloudSiteOpt = cloudSites.values().stream()
- .filter(cs -> cs.getId().equalsIgnoreCase(DEFAULT_CLOUD_SITE_ID)).findAny();
+ Optional<CloudSite> cloudSiteOpt = Optional.ofNullable(catalogDbClient.getCloudSite(DEFAULT_CLOUD_SITE_ID));
if (cloudSiteOpt.isPresent()) {
CloudSite defaultCloudSite = cloudSiteOpt.get();
CloudSite clone = new CloudSite(defaultCloudSite);
@@ -178,7 +116,7 @@ public class CloudConfig {
* @return a CloudIdentity, or null of no match found
*/
public CloudIdentity getIdentityService(String id) {
- return identityServices.get(id);
+ return catalogDbClient.getCloudIdentity(id);
}
/**
@@ -187,30 +125,6 @@ public class CloudConfig {
* @return a CloudifyManager, or null of no match found
*/
public CloudifyManager getCloudifyManager (String id) {
- return cloudifyManagers.get(id);
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
- .append("identityServices", getIdentityServices()).append("cloudSites", getCloudSites()).toString();
- }
-
- @Override
- public boolean equals(final Object other) {
- if (other == null) {
- return false;
- }
- if (!getClass().equals(other.getClass())) {
- return false;
- }
- CloudConfig castOther = (CloudConfig) other;
- return new EqualsBuilder().append(getIdentityServices(), castOther.getIdentityServices())
- .append(getCloudSites(), castOther.getCloudSites()).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder(1, 31).append(getIdentityServices()).append(getCloudSites()).toHashCode();
+ return catalogDbClient.getCloudifyManager(id);
}
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudIdentity.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudIdentity.java
deleted file mode 100644
index 188a93025e..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudIdentity.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*-
- * ============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.cloud;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.openpojo.business.annotation.BusinessKey;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-
-import java.util.Comparator;
-
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-/**
- * JavaBean JSON 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 (a CloudConfig JSON configuration
- * file may contain multiple CloudIdentity definitions).
- *
- * Note that this is only used to access Cloud Configurations loaded from a
- * JSON config file, so there are no explicit setters.
- *
- */
-public class CloudIdentity {
-
- @JsonProperty
- @BusinessKey
- private String id;
- @JsonProperty("identity_url")
- @BusinessKey
- private String identityUrl;
- @JsonProperty("mso_id")
- @BusinessKey
- private String msoId;
- @JsonProperty("mso_pass")
- @BusinessKey
- private String msoPass;
- @JsonProperty("admin_tenant")
- @BusinessKey
- private String adminTenant;
- @JsonProperty("member_role")
- @BusinessKey
- private String memberRole;
- @JsonProperty("tenant_metadata")
- @BusinessKey
- private Boolean tenantMetadata;
- @JsonProperty("identity_server_type")
- @BusinessKey
- private ServerType identityServerType;
- @JsonProperty("identity_authentication_type")
- @BusinessKey
- private AuthenticationType identityAuthenticationType;
-
- public CloudIdentity() {}
-
- 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 void setAdminTenant (String tenant) {
- this.adminTenant = tenant;
- }
-
- public String getMemberRole () {
- return memberRole;
- }
-
- public void setMemberRole (String role) {
- this.memberRole = role;
- }
-
- public Boolean hasTenantMetadata () {
- 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", hasTenantMetadata()).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(hasTenantMetadata(), castOther.hasTenantMetadata())
- .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(hasTenantMetadata())
- .append(getIdentityServerType()).append(getIdentityAuthenticationType()).toHashCode();
- }
-} \ No newline at end of file
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudSite.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudSite.java
deleted file mode 100644
index f38403d0cd..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudSite.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*-
- * ============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.cloud;
-
-
-import java.util.Comparator;
-
-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;
-
-/**
- * JavaBean JSON 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 (a CloudConfig JSON configuration file
- * will contain multiple CloudSite definitions).
- *
- * Note that this is only used to access Cloud Configurations loaded from a
- * JSON config file, so there are no explicit setters.
- *
- */
-public class CloudSite {
- @JsonProperty
- @BusinessKey
- private String id;
- @JsonProperty("region_id")
- @BusinessKey
- private String regionId;
- @JsonProperty("identity_service_id")
- @BusinessKey
- private String identityServiceId;
- @JsonProperty("aic_version")
- @BusinessKey
- private String aicVersion;
- @JsonProperty("clli")
- @BusinessKey
- private String clli;
- @JsonProperty("cloudify_id")
- @BusinessKey
- private String cloudifyId;
- @JsonProperty("platform")
- @BusinessKey
- private String platform;
- @JsonProperty("orchestrator")
- @BusinessKey
- private String orchestrator;
-
- // Derived property (set by CloudConfig loader based on identityServiceId)
- private CloudIdentity identityService;
- // Derived property (set by CloudConfig loader based on cloudifyId)
- private CloudifyManager cloudifyManager;
-
- public CloudSite() {
-
- }
-
- public CloudSite(CloudSite site) {
- this.aicVersion = site.getAicVersion();
- this.clli = site.getClli();
- this.cloudifyId = this.getCloudifyId();
- this.cloudifyManager = this.getCloudifyManager();
- this.id = site.getId();
- this.identityService = site.getIdentityService();
- this.identityServiceId = site.getIdentityServiceId();
- this.orchestrator = site.getOrchestrator();
- this.platform = site.getPlatform();
- this.regionId = this.getRegionId();
- }
- 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;
- }
-
- public void setIdentityServiceId(String identityServiceId) {
- this.identityServiceId = identityServiceId;
- }
- public String getAicVersion() {
- return aicVersion;
- }
-
- public void setAicVersion(String aicVersion) {
- this.aicVersion = aicVersion;
- }
-
- public String getClli() {
- return clli;
- }
-
- public void setClli(String clli) {
- this.clli = clli;
- }
-
- public String getCloudifyId() {
- return cloudifyId;
- }
-
- public void setCloudifyId (String id) {
- this.cloudifyId = id;
- }
-
- 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;
- }
-
- public CloudifyManager getCloudifyManager () {
- return cloudifyManager;
- }
-
- public void setCloudifyManager (CloudifyManager cloudify) {
- this.cloudifyManager = cloudify;
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("regionId", getRegionId())
- .append("identityServiceId", getIdentityServiceId()).append("aicVersion", getAicVersion())
- .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(getAicVersion(), castOther.getAicVersion()).append(getClli(), castOther.getClli()).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder(1, 31).append(getRegionId()).append(getIdentityServiceId()).append(getAicVersion())
- .append(getClli()).toHashCode();
- }
-} \ No newline at end of file
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudifyManager.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudifyManager.java
deleted file mode 100644
index 1bf3f136b0..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudifyManager.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*-
- * ============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.cloud;
-
-import java.security.GeneralSecurityException;
-import java.util.Comparator;
-
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
-import org.onap.so.utils.CryptoUtils;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.openpojo.business.annotation.BusinessKey;
-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;
-
-/**
- * JavaBean JSON 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.
- *
- * Note that this is only used to access Cloud Configurations loaded from a
- * JSON config file, so there are no explicit setters.
- *
- * @author JC1348
- */
-public class CloudifyManager {
-
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, CloudifyManager.class);
-
- @BusinessKey
- @JsonProperty
- private String id;
-
- @BusinessKey
- @JsonProperty ("cloudify_url")
- private String cloudifyUrl;
-
- @BusinessKey
- @JsonProperty("username")
- private String username;
-
- @BusinessKey
- @JsonProperty("password")
- private String password;
-
- @BusinessKey
- @JsonProperty("version")
- private String version;
-
- public CloudifyManager() {}
-
- 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;
- }
-
- @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/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/ServerType.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/ServerType.java
deleted file mode 100644
index ac59018c6b..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/ServerType.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*-
- * ============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.cloud;
-
-public enum ServerType {
- KEYSTONE, ORM;
-}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java
index 5c648eb5e3..1912cd874a 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java
@@ -20,8 +20,8 @@
package org.onap.so.cloud.authentication;
-import org.onap.so.cloud.AuthenticationType;
-import org.onap.so.cloud.CloudIdentity;
+import org.onap.so.db.catalog.beans.AuthenticationType;
+import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.cloud.authentication.models.RackspaceAuthentication;
import org.onap.so.utils.CryptoUtils;
import org.springframework.stereotype.Component;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
index aa8e37f12b..59996fa3d1 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
@@ -42,8 +42,8 @@ import org.onap.so.adapters.vdu.VduPlugin;
import org.onap.so.adapters.vdu.VduStateType;
import org.onap.so.adapters.vdu.VduStatus;
import org.onap.so.cloud.CloudConfig;
-import org.onap.so.cloud.CloudSite;
-import org.onap.so.cloud.CloudifyManager;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.CloudifyManager;
import org.onap.so.cloudify.base.client.CloudifyBaseException;
import org.onap.so.cloudify.base.client.CloudifyClientTokenProvider;
import org.onap.so.cloudify.base.client.CloudifyConnectException;
@@ -898,7 +898,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
{
CloudifyManager cloudifyConfig = cloudConfig.getCloudifyManager(cloudSite.getCloudifyId());
if (cloudifyConfig == null) {
- throw new MsoCloudifyManagerNotFound (cloudConfig.getCloudSiteId(cloudSite));
+ throw new MsoCloudifyManagerNotFound (cloudSite.getId());
}
// Get a Cloudify client
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
index e5ece20cb7..1d5b1a006d 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
@@ -41,8 +41,8 @@ import org.onap.so.adapters.vdu.VduPlugin;
import org.onap.so.adapters.vdu.VduStateType;
import org.onap.so.adapters.vdu.VduStatus;
import org.onap.so.cloud.CloudConfig;
-import org.onap.so.cloud.CloudIdentity;
-import org.onap.so.cloud.CloudSite;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.cloud.authentication.AuthenticationMethodFactory;
import org.onap.so.db.catalog.beans.HeatTemplate;
import org.onap.so.db.catalog.beans.HeatTemplateParam;
@@ -949,7 +949,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
* @return an authenticated Heat object
*/
public Heat getHeatClient (CloudSite cloudSite, String tenantId) throws MsoException {
- String cloudId = cloudConfig.getCloudSiteId(cloudSite);
+ String cloudId = cloudSite.getId();
// Check first in the cache of previously authorized clients
String cacheKey = cloudId + ":" + tenantId;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java
index 0b3f9dfe17..e68a8e764a 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java
@@ -28,8 +28,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.onap.so.cloud.CloudConfig;
-import org.onap.so.cloud.CloudSite;
+import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.StackInfo;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
index d3ec74db8d..2f2a457bed 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
@@ -27,8 +27,8 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
-import org.onap.so.cloud.CloudIdentity;
-import org.onap.so.cloud.CloudSite;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.cloud.authentication.AuthenticationMethodFactory;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoAlarmLogger;
@@ -92,7 +92,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
* <p>
*
* @param tenantName The tenant name to create
- * @param cloudId The cloud identifier (may be a region) in which to create the tenant.
+ * @param cloudSiteId The cloud identifier (may be a region) in which to create the tenant.
* @return the tenant ID of the newly created tenant
* @throws MsoTenantAlreadyExists Thrown if the requested tenant already exists
* @throws MsoOpenstackException Thrown if the Openstack API call returns an exception
@@ -150,7 +150,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
executeAndRecordOpenstackRequest (request);
}
- if (cloudIdentity.hasTenantMetadata () && metadata != null && !metadata.isEmpty ()) {
+ if (cloudIdentity.getTenantMetadata () && metadata != null && !metadata.isEmpty ()) {
Metadata tenantMetadata = new Metadata ();
tenantMetadata.setMetadata (metadata);
@@ -221,7 +221,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
}
Map <String, String> metadata = new HashMap <String, String> ();
- if (cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).hasTenantMetadata ()) {
+ if (cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).getTenantMetadata ()) {
OpenStackRequest <Metadata> request = keystoneAdminClient.tenants ().showMetadata (tenant.getId ());
Metadata tenantMetadata = executeAndRecordOpenstackRequest (request);
if (tenantMetadata != null) {
@@ -267,7 +267,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
}
Map <String, String> metadata = new HashMap <String, String> ();
- if (cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).hasTenantMetadata ()) {
+ if (cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).getTenantMetadata ()) {
OpenStackRequest <Metadata> request = keystoneAdminClient.tenants ().showMetadata (tenant.getId ());
Metadata tenantMetadata = executeAndRecordOpenstackRequest (request);
if (tenantMetadata != null) {
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
index adeb008ad5..18ed94112c 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
@@ -27,8 +27,8 @@ import java.util.List;
import java.util.Map;
import org.onap.so.cloud.CloudConfig;
-import org.onap.so.cloud.CloudIdentity;
-import org.onap.so.cloud.CloudSite;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.cloud.authentication.AuthenticationMethodFactory;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoAlarmLogger;
@@ -42,7 +42,6 @@ import org.onap.so.openstack.exceptions.MsoIOException;
import org.onap.so.openstack.exceptions.MsoNetworkAlreadyExists;
import org.onap.so.openstack.exceptions.MsoNetworkNotFound;
import org.onap.so.openstack.exceptions.MsoOpenstackException;
-import org.onap.so.openstack.exceptions.MsoTenantNotFound;
import org.onap.so.openstack.mappers.NetworkInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtils.java
index 28911bc45c..383409f810 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtils.java
@@ -24,7 +24,7 @@ package org.onap.so.openstack.utils;
import java.util.Map;
import org.onap.so.cloud.CloudConfig;
-import org.onap.so.cloud.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.MsoTenant;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java
index 68d0ef2fad..da9f79aa89 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java
@@ -21,8 +21,8 @@
package org.onap.so.openstack.utils;
import org.onap.so.cloud.CloudConfig;
-import org.onap.so.cloud.CloudSite;
-import org.onap.so.cloud.ServerType;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.ServerType;
import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java
index 36f82e15bd..36a50fd77e 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java
@@ -22,14 +22,30 @@ package org.onap.so;
import com.github.tomakehurst.wiremock.client.WireMock;
+import org.apache.http.HttpHeaders;
+import org.apache.http.HttpStatus;
import org.junit.After;
+import org.junit.Before;
import org.junit.runner.RunWith;
+import org.onap.so.db.catalog.beans.AuthenticationType;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.ServerType;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
+import javax.ws.rs.core.MediaType;
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+
@RunWith(SpringRunner.class)
@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
@@ -43,4 +59,68 @@ public abstract class BaseTest extends TestDataSetup {
public void after() {
WireMock.reset();
}
-}
+
+ protected static String getBody(String body, int port, String urlPath) throws IOException {
+ return body.replaceAll("port", "http://localhost:" + port + urlPath);
+ }
+
+ @Before
+ public void init() throws IOException {
+ CloudIdentity identity = getCloudIdentity();
+ CloudSite cloudSite = getCloudSite(identity);
+ mockCloud(identity, cloudSite);
+ }
+
+ private void mockCloud(CloudIdentity identity, CloudSite cloudSite) throws IOException {
+ stubFor(get(urlPathEqualTo("/cloudSite/MTN13")).willReturn(aResponse()
+ .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, ""))
+ .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/cloudSite/default")).willReturn(aResponse()
+ .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, ""))
+ .withHeader(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/cloudIdentity/mtn13")).willReturn(aResponse()
+ .withBody(getBody(mapper.writeValueAsString(identity),wireMockPort, ""))
+ .withHeader(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+ }
+
+ private CloudIdentity getCloudIdentity() {
+ CloudIdentity identity = new CloudIdentity();
+ identity.setId("mtn13");
+ identity.setMsoId("m93945");
+ identity.setMsoPass("93937EA01B94A10A49279D4572B48369");
+ identity.setAdminTenant("admin");
+ identity.setMemberRole("admin");
+ identity.setTenantMetadata(false);
+ identity.setIdentityUrl("http://localhost:"+wireMockPort+"/v2.0");
+ identity.setIdentityAuthenticationType(AuthenticationType.USERNAME_PASSWORD);
+ identity.setIdentityServerType(ServerType.KEYSTONE);
+ return identity;
+ }
+
+ private CloudSite getCloudSite(CloudIdentity identity) {
+ CloudSite cloudSite = new CloudSite();
+ cloudSite.setId("MTN13");
+ cloudSite.setCloudVersion("3.0");
+ cloudSite.setClli("MDT13");
+ cloudSite.setRegionId("mtn13");
+ cloudSite.setIdentityService(identity);
+ return cloudSite;
+ }
+
+ private static String readFile(String fileName) throws IOException {
+ try (BufferedReader br = new BufferedReader(new FileReader(fileName))) {
+ StringBuilder sb = new StringBuilder();
+ String line = br.readLine();
+
+ while (line != null) {
+ sb.append(line);
+ sb.append("\n");
+ line = br.readLine();
+ }
+ return sb.toString();
+ }
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
new file mode 100644
index 0000000000..d7b30edbe5
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
@@ -0,0 +1,42 @@
+package org.onap.so;
+
+import ch.vorburger.exec.ManagedProcessException;
+import ch.vorburger.mariadb4j.DBConfigurationBuilder;
+import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+
+import javax.sql.DataSource;
+
+@Configuration
+@Profile({"test","local"})
+public class EmbeddedMariaDbConfig {
+
+ @Bean
+ MariaDB4jSpringService mariaDB4jSpringService() {
+ return new MariaDB4jSpringService();
+ }
+
+ @Bean
+ DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService,
+ @Value("${mariaDB4j.databaseName}") String databaseName,
+ @Value("${spring.datasource.username}") String datasourceUsername,
+ @Value("${spring.datasource.password}") String datasourcePassword,
+ @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException {
+ //Create our database with default root user and no password
+ mariaDB4jSpringService.getDB().createDB(databaseName);
+
+ DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration();
+
+ return DataSourceBuilder
+ .create()
+ .username(datasourceUsername)
+ .password(datasourcePassword)
+ .url(config.getURL(databaseName))
+ .driverClassName(datasourceDriver)
+ .build();
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java
index 539e7acef0..012805e774 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java
@@ -21,39 +21,72 @@
package org.onap.so.adapter_utils.tests;
+import org.apache.http.HttpHeaders;
+import org.apache.http.HttpStatus;
+import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.so.cloud.Application;
-import org.onap.so.openstack.utils.MsoCommonUtils;
+import org.onap.so.BaseTest;
+import org.onap.so.db.catalog.beans.AuthenticationType;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.ServerType;
+import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.ws.rs.core.MediaType;
+import java.io.IOException;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static org.junit.Assert.assertEquals;
-/**
+/**PoConfigTest
* This class implements test methods of the MsoHeatUtils
*
*
*/
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = Application.class)
-@ActiveProfiles("test")
-public class MsoHeatUtilsRefactorTest extends MsoCommonUtils {
+public class MsoHeatUtilsRefactorTest extends BaseTest {
@Autowired
private MsoHeatUtils msoHeatUtils;
+
+ @Before
+ public void init() throws IOException {
+ CloudIdentity identity = new CloudIdentity();
+
+ identity.setId("MTN13");
+ identity.setMsoId("m93945");
+ identity.setMsoPass("93937EA01B94A10A49279D4572B48369");
+ identity.setAdminTenant("admin");
+ identity.setMemberRole("admin");
+ identity.setTenantMetadata(true);
+ identity.setIdentityUrl("http://localhost:28090/v2.0");
+ identity.setIdentityAuthenticationType(AuthenticationType.USERNAME_PASSWORD);
+
+ CloudSite cloudSite = new CloudSite();
+ cloudSite.setId("MTN13");
+ cloudSite.setCloudVersion("3.0");
+ cloudSite.setClli("MDT13");
+ cloudSite.setRegionId("MTN13");
+ identity.setIdentityServerType(ServerType.KEYSTONE);
+ cloudSite.setIdentityService(identity);
+
+
+ stubFor(get(urlPathEqualTo("/cloudSite/default")).willReturn(aResponse()
+ .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, ""))
+ .withHeader(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/cloudIdentity/MTN13")).willReturn(aResponse()
+ .withBody(getBody(mapper.writeValueAsString(identity),wireMockPort, ""))
+ .withHeader(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+ }
@Test
- public final void testGetKeystoneUrl() {
- try {
- String keyUrl = msoHeatUtils.getCloudSiteKeystoneUrl("DAN");
- assertEquals("http://192.168.170.21:5000/v2.0",keyUrl);
- } catch (Exception e) {
-
- }
+ public final void testGetKeystoneUrl() throws MsoCloudSiteNotFound {
+ String keyUrl = msoHeatUtils.getCloudSiteKeystoneUrl("DAN");
+ assertEquals("http://localhost:28090/v2.0", keyUrl);
}
-
-
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java
index 6d9687216d..50fc17511b 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java
@@ -23,7 +23,6 @@ package org.onap.so.adapter_utils.tests;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.when;
-import java.security.GeneralSecurityException;
import java.util.HashMap;
import java.util.Map;
@@ -36,9 +35,9 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.onap.so.cloud.CloudConfig;
-import org.onap.so.cloud.CloudIdentity;
-import org.onap.so.cloud.CloudSite;
-import org.onap.so.cloud.ServerType;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.ServerType;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.exceptions.MsoIOException;
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java
index 668b1806ac..c6db998b2b 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java
@@ -22,86 +22,71 @@ package org.onap.so.cloud;
import static org.junit.Assert.*;
-import java.util.Map;
import java.util.Optional;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.onap.so.BaseTest;
+import org.onap.so.db.catalog.beans.AuthenticationType;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.ServerType;
import org.onap.so.openstack.exceptions.MsoException;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
/**
* This class implements test methods of the CloudConfig features.
*
*
*/
-public class CloudConfigTest extends BaseTest {
+public class CloudConfigTest extends BaseTest{
@Autowired
private CloudConfig con;
- /**
- * This method implements a test for the getCloudSites method.
- */
- @Test
- public final void testGetCloudSites () {
- Map<String,CloudSite> siteMap = con.getCloudSites();
- assertNotNull(siteMap);
-
- CloudSite site1 = siteMap.get("regionOne");
-
- assertEquals ("regionOne", site1.getRegionId());
- assertEquals ("MT_KEYSTONE", site1.getIdentityServiceId());
- assertEquals ("MT2", site1.getClli());
- assertEquals ("2.5", site1.getAicVersion());
- }
-
-
- /**
- * This method implements a test for the getIdentityServices method.
- * @throws MsoException
- */
- @Test
- public final void testGetIdentityServices () throws MsoException {
- Map<String,CloudIdentity> identityMap = con.getIdentityServices ();
- assertNotNull(identityMap);
-
- CloudIdentity identity1 = identityMap.get("MT_KEYSTONE");
-
- assertEquals("john", identity1.getMsoId());
- assertEquals("313DECE408AF7759D442D7B06DD9A6AA", identity1.getMsoPass());
- assertEquals("admin", identity1.getAdminTenant());
- assertEquals("_member_", identity1.getMemberRole());
- assertEquals(false, identity1.hasTenantMetadata());
- assertEquals("http://localhost:"+wireMockPort+"/v2.0", identity1.getIdentityUrl());
- assertEquals(ServerType.KEYSTONE, identity1.getIdentityServerType());
- assertEquals(AuthenticationType.USERNAME_PASSWORD, identity1.getIdentityAuthenticationType());
-
- }
-
- /**
- * This method implements a test for the getCloudSite method.
- */
- @Test
- public final void testGetDefaultCloudSite () {
- Optional<CloudSite> site = con.getCloudSite("NotThere");
- assertTrue(site.isPresent());
- CloudSite site1 = site.get();
- assertEquals ("NotThere", site1.getRegionId());
- assertEquals("MTN6", site1.getClli());
- assertEquals("NotThere", site1.getId());
- assertEquals ("ORDM3", site1.getIdentityServiceId());
- }
-
- @Test
- public void testGetIdentityService() {
- CloudIdentity identity = con.getIdentityService("MT_KEYSTONE");
- assertEquals("john", identity.getMsoId());
- assertEquals("MT_KEYSTONE", identity.getId());
- }
-
+ /**
+ * This method implements a test for the getCloudSite method.
+ */
+ @Test
+ public final void testGetCloudSite () {
+ CloudSite site1 = con.getCloudSite("MTN13").get();
+
+ assertEquals ("mtn13", site1.getRegionId());
+ assertEquals ("mtn13", site1.getIdentityServiceId());
+ assertEquals ("MDT13", site1.getClli());
+ assertEquals ("3.0", site1.getCloudVersion());
+ }
+
+
+ /**
+ * This method implements a test for the getIdentityServices method.
+ * @throws MsoException
+ */
+ @Test
+ public final void testGetIdentityServices () throws MsoException {
+
+ CloudIdentity identity1 = con.getIdentityService("mtn13");
+
+ assertEquals("m93945", identity1.getMsoId());
+ assertEquals("93937EA01B94A10A49279D4572B48369", identity1.getMsoPass());
+ assertEquals("admin", identity1.getAdminTenant());
+ assertEquals("admin", identity1.getMemberRole());
+ assertTrue(identity1.getIdentityUrl().contains("http://localhost:"));
+ assertEquals(ServerType.KEYSTONE, identity1.getIdentityServerType());
+ assertEquals(AuthenticationType.USERNAME_PASSWORD, identity1.getIdentityAuthenticationType());
+
+ }
+
+ /**
+ * This method implements a test for the getCloudSite method.
+ */
+ @Test
+ public final void testGetDefaultCloudSite () {
+ Optional<CloudSite> site = con.getCloudSite("NotThere");
+ assertTrue(site.isPresent());
+ CloudSite site1 = site.get();
+ assertEquals ("NotThere", site1.getRegionId());
+ assertEquals("MDT13", site1.getClli());
+ assertEquals("NotThere", site1.getId());
+ }
+
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudIdentityTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudIdentityTest.java
deleted file mode 100644
index db2ba05bf1..0000000000
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudIdentityTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*-
- * ============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.cloud;
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.security.GeneralSecurityException;
-
-import org.junit.Test;
-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.hasTenantMetadata ());
-// 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/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudPojoTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudPojoTest.java
index 89c15b0deb..096d5dad8b 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudPojoTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudPojoTest.java
@@ -21,7 +21,9 @@
package org.onap.so.cloud;
import org.junit.Test;
-import org.onap.so.openpojo.rules.EqualsAndHashCodeTester;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.CloudifyManager;
import org.onap.so.openpojo.rules.ToStringTester;
import com.openpojo.reflection.PojoClass;
@@ -51,7 +53,6 @@ public class CloudPojoTest {
.with(new SetterTester())
.with(new GetterTester())
.with(new ToStringTester())
- .with(new EqualsAndHashCodeTester())
.build();
validator.validate(pojoClass);
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudifyManagerTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudifyManagerTest.java
deleted file mode 100644
index 9a660b4d40..0000000000
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudifyManagerTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-
- * ============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.cloud;
-
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
-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/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java
index e1c533757b..d676bcab3a 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java
@@ -24,11 +24,11 @@ import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.so.BaseTest;
import org.onap.so.cloud.Application;
-import org.onap.so.cloud.AuthenticationType;
-import org.onap.so.cloud.CloudIdentity;
+import org.onap.so.db.catalog.beans.AuthenticationType;
+import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.cloud.authentication.models.RackspaceAuthentication;
-import org.onap.so.openstack.exceptions.MsoException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
@@ -43,10 +43,7 @@ import com.woorea.openstack.keystone.model.authentication.UsernamePassword;
* only are tested.
*
*/
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = Application.class)
-@ActiveProfiles("test")
-public class AuthenticationMethodTest {
+public class AuthenticationMethodTest extends BaseTest {
@Autowired
private AuthenticationMethodFactory authenticationMethodFactory;
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest2.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest2.java
index e75a4aecaf..96202c5122 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest2.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest2.java
@@ -42,13 +42,12 @@ import org.onap.so.adapters.vdu.VduModelInfo;
import org.onap.so.adapters.vdu.VduStateType;
import org.onap.so.adapters.vdu.VduStatus;
import org.onap.so.cloud.CloudConfig;
-import org.onap.so.cloud.CloudIdentity;
-import org.onap.so.cloud.CloudSite;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.cloudify.beans.DeploymentInfo;
import org.onap.so.cloudify.beans.DeploymentStatus;
import org.onap.so.cloudify.v3.client.Cloudify;
import org.onap.so.cloudify.v3.model.AzureConfig;
-import org.onap.so.cloudify.v3.model.OpenstackConfig;
import org.onap.so.openstack.exceptions.MsoException;
public class MsoCloudifyUtilsTest2 {
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java
index d347dedb4f..f069e9f61f 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.so.BaseTest;
import org.onap.so.cloud.Application;
import org.onap.so.config.beans.PoConfig;
import org.springframework.beans.factory.annotation.Autowired;
@@ -31,10 +32,7 @@ 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 = Application.class)
-@ActiveProfiles("test")
-public class PoConfigTest {
+public class PoConfigTest extends BaseTest {
@Autowired
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/HeatCacheEntryTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/HeatCacheEntryTest.java
index 4adf6bf5be..b675f4814d 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/HeatCacheEntryTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/HeatCacheEntryTest.java
@@ -30,7 +30,7 @@ import java.util.GregorianCalendar;
import org.junit.Test;
import org.onap.so.BaseTest;
-public class HeatCacheEntryTest extends BaseTest {
+public class HeatCacheEntryTest {
private static final String HEAT_URL = "testHeatUrl";
private static final String TOKEN = "testToken";
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NeutronCacheEntryTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NeutronCacheEntryTest.java
index 3a652042b7..8626e7d177 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NeutronCacheEntryTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NeutronCacheEntryTest.java
@@ -29,7 +29,7 @@ import java.util.GregorianCalendar;
import org.junit.Test;
import org.onap.so.BaseTest;
-public class NeutronCacheEntryTest extends BaseTest {
+public class NeutronCacheEntryTest {
private static final String NEUTRON_URL = "testNeutronUrl";
private static final String TOKEN = "testToken";
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java
index 522a261fdd..94715f1599 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java
@@ -30,7 +30,7 @@ import com.openpojo.validation.ValidatorBuilder;
import com.openpojo.validation.test.impl.GetterTester;
import com.openpojo.validation.test.impl.SetterTester;
-public class OpenstackBeansPojoTest extends BaseTest {
+public class OpenstackBeansPojoTest {
@Test
public void pojoStructure() {
test(PojoClassFactory.getPojoClass(VnfRollback.class));
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
index 6bcb209125..b304cba93f 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
@@ -47,6 +47,10 @@ import org.onap.so.adapters.vdu.VduInstance;
import org.onap.so.adapters.vdu.VduModelInfo;
import org.onap.so.adapters.vdu.VduStateType;
import org.onap.so.adapters.vdu.VduStatus;
+import org.onap.so.cloud.CloudConfig;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.openstack.beans.HeatStatus;
+import org.onap.so.openstack.beans.StackInfo;
import org.onap.so.openstack.exceptions.MsoException;
import org.springframework.beans.factory.annotation.Autowired;
@@ -67,7 +71,7 @@ public class MsoHeatUtilsTest extends BaseTest{
expected.setStatus(status);
CloudInfo cloudInfo = new CloudInfo();
- cloudInfo.setCloudSiteId("regionOne");
+ cloudInfo.setCloudSiteId("MTN13");
cloudInfo.setTenantId("tenantId");
VduModelInfo vduModel = new VduModelInfo();
vduModel.setModelCustomizationUUID("blueprintId");
@@ -111,7 +115,7 @@ public class MsoHeatUtilsTest extends BaseTest{
expected.setStatus(status);
CloudInfo cloudInfo = new CloudInfo();
- cloudInfo.setCloudSiteId("regionOne");
+ cloudInfo.setCloudSiteId("mtn13");
cloudInfo.setTenantId("tenantId");
String instanceId = "instanceId";
@@ -138,7 +142,7 @@ public class MsoHeatUtilsTest extends BaseTest{
expected.setStatus(status);
CloudInfo cloudInfo = new CloudInfo();
- cloudInfo.setCloudSiteId("regionOne");
+ cloudInfo.setCloudSiteId("mtn13");
cloudInfo.setTenantId("tenantId");
String instanceId = "instanceId";
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java
index c252f61e7f..1a8f4fb098 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java
@@ -25,7 +25,6 @@ import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import java.io.File;
@@ -39,13 +38,12 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
import org.onap.so.TestDataSetup;
import org.onap.so.cloud.CloudConfig;
-import org.onap.so.cloud.CloudSite;
+import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
import org.onap.so.openstack.exceptions.MsoException;
@@ -55,10 +53,7 @@ import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.woorea.openstack.base.client.OpenStackRequest;
import com.woorea.openstack.heat.Heat;
-import com.woorea.openstack.heat.StackResource;
-import com.woorea.openstack.heat.StackResource.UpdateStack;
import com.woorea.openstack.heat.model.Stack;
-import com.woorea.openstack.heat.model.UpdateStackParam;
@RunWith(MockitoJUnitRunner.class)
public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
@@ -95,7 +90,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
@Test
public void updateStackTest() throws MsoException, JsonParseException, JsonMappingException, IOException {
- CloudSite cloudSite = mapper.readValue(new File(RESOURCE_PATH + "CloudSite.json"), CloudSite.class);
+ CloudSite cloudSite = new CloudSite();
Heat heatClient = new Heat("endpoint");
Stack heatStack = mapper.readValue(new File(RESOURCE_PATH + "HeatStack.json"), Stack.class);
Stack updateStack = mapper.readValue(new File(RESOURCE_PATH + "UpdateStack.json"), Stack.class);
@@ -120,7 +115,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
public void updateStackWithEnvironmentTest() throws JsonParseException, JsonMappingException, IOException, MsoException {
String environmentString = "environmentString";
- CloudSite cloudSite = mapper.readValue(new File(RESOURCE_PATH + "CloudSite.json"), CloudSite.class);
+ CloudSite cloudSite = new CloudSite();
Heat heatClient = new Heat("endpoint");
Stack heatStack = mapper.readValue(new File(RESOURCE_PATH + "HeatStack.json"), Stack.class);
Stack updateStack = mapper.readValue(new File(RESOURCE_PATH + "UpdateStack.json"), Stack.class);
@@ -147,7 +142,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
Map<String, Object> files = new HashMap<>();
files.put("file1", new Object());
- CloudSite cloudSite = mapper.readValue(new File(RESOURCE_PATH + "CloudSite.json"), CloudSite.class);
+ CloudSite cloudSite = new CloudSite();
Heat heatClient = new Heat("endpoint");
Stack heatStack = mapper.readValue(new File(RESOURCE_PATH + "HeatStack.json"), Stack.class);
Stack updateStack = mapper.readValue(new File(RESOURCE_PATH + "UpdateStack.json"), Stack.class);
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java
index 706427e985..92f7738c62 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java
@@ -48,7 +48,7 @@ public class MsoKeystoneUtilsTest extends BaseTest {
StubOpenStack.mockOpenStackGetUserById("john");
StubOpenStack.mockOpenStackGetRoles_200("OS-KSADM");
- String response = msoKeystoneUtils.createTenant("tenant", "regionOne", new HashMap<>(), true);
+ String response = msoKeystoneUtils.createTenant("tenant", "MTN13", new HashMap<>(), true);
Assert.assertEquals("tenantId", response);
}
@@ -59,7 +59,7 @@ public class MsoKeystoneUtilsTest extends BaseTest {
StubOpenStack.mockOpenStackGetUserByName("john");
StubOpenStack.mockOpenStackGetRoles_200("OS-KSADM");
- String response = msoKeystoneUtils.createTenant("tenant", "regionOne", new HashMap<>(), true);
+ String response = msoKeystoneUtils.createTenant("tenant", "MTN13", new HashMap<>(), true);
Assert.assertEquals("tenantId", response);
}
@@ -70,14 +70,14 @@ public class MsoKeystoneUtilsTest extends BaseTest {
StubOpenStack.mockOpenStackPostTenantWithBodyFile_200();
StubOpenStack.mockOpenStackGetUserByName_500("john");
StubOpenStack.mockOpenStackGetRoles_200("OS-KSADM");
- msoKeystoneUtils.createTenant("tenant", "regionOne", new HashMap<>(), true);
+ msoKeystoneUtils.createTenant("tenant", "Test", new HashMap<>(), true);
}
@Test
public void queryTenantTest() throws Exception {
StubOpenStack.mockOpenStackGetTenantById("tenantId");
- MsoTenant msoTenant = msoKeystoneUtils.queryTenant("tenantId", "regionOne");
+ MsoTenant msoTenant = msoKeystoneUtils.queryTenant("tenantId", "MTN13");
Assert.assertEquals("testingTenantName", msoTenant.getTenantName());
}
@@ -86,7 +86,7 @@ public class MsoKeystoneUtilsTest extends BaseTest {
public void queryTenantByNameTest() throws Exception {
StubOpenStack.mockOpenStackGetTenantByName("tenant");
- MsoTenant msoTenant = msoKeystoneUtils.queryTenantByName("tenant", "regionOne");
+ MsoTenant msoTenant = msoKeystoneUtils.queryTenantByName("tenant", "MTN13");
Assert.assertEquals("testingTenantName", msoTenant.getTenantName());
}
@@ -95,7 +95,7 @@ public class MsoKeystoneUtilsTest extends BaseTest {
public void deleteTenantTest() throws Exception {
StubOpenStack.mockOpenStackGetTenantById("tenantId");
StubOpenStack.mockOpenStackDeleteTenantById_200("tenantId");
- boolean result = msoKeystoneUtils.deleteTenant("tenantId", "regionOne");
+ boolean result = msoKeystoneUtils.deleteTenant("tenantId", "MTN13");
Assert.assertTrue(result);
}
@@ -104,7 +104,7 @@ public class MsoKeystoneUtilsTest extends BaseTest {
public void deleteTenantByNameTest() throws Exception {
StubOpenStack.mockOpenStackGetTenantByName("tenant");
StubOpenStack.mockOpenStackDeleteTenantById_200("tenantId");
- boolean result = msoKeystoneUtils.deleteTenantByName("tenant", "regionOne");
+ boolean result = msoKeystoneUtils.deleteTenantByName("tenant", "MTN13");
Assert.assertTrue(result);
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java
index 9f8b51a3b7..0442d4d635 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java
@@ -50,14 +50,14 @@ public class MsoNeutronUtilsTest extends BaseTest{
@Test
public void createNetworkTest_OpenStackBaseException() throws Exception {
expectedException.expect(MsoException.class);
- msoNeutronUtils.createNetwork("regionOne", "tenantId",
+ msoNeutronUtils.createNetwork("MTN13", "tenantId",
MsoNeutronUtils.NetworkType.PROVIDER,"networkName", "PROVIDER", vlans);
}
@Test
public void createNetworkTest_NetworkTypeAsMultiProvider() throws Exception {
StubOpenStack.mockOpenstackPostNetwork("OpenstackCreateNeutronNetworkResponse.json");
- NetworkInfo networkInfo = msoNeutronUtils.createNetwork("regionOne", "tenantId",
+ NetworkInfo networkInfo = msoNeutronUtils.createNetwork("MTN13", "tenantId",
MsoNeutronUtils.NetworkType.MULTI_PROVIDER,"networkName","PROVIDER", vlans);
Assert.assertEquals("2a4017ef-31ff-496a-9294-e96ecc3bc9c9",networkInfo.getId());
@@ -66,7 +66,7 @@ public class MsoNeutronUtilsTest extends BaseTest{
@Test
public void createNetworkTest() throws Exception {
StubOpenStack.mockOpenstackPostNetwork("OpenstackCreateNeutronNetworkResponse.json");
- NetworkInfo networkInfo = msoNeutronUtils.createNetwork("regionOne", "tenantId",
+ NetworkInfo networkInfo = msoNeutronUtils.createNetwork("MTN13", "tenantId",
MsoNeutronUtils.NetworkType.PROVIDER,"networkName","PROVIDER", vlans);
Assert.assertEquals("2a4017ef-31ff-496a-9294-e96ecc3bc9c9",networkInfo.getId());
@@ -75,14 +75,14 @@ public class MsoNeutronUtilsTest extends BaseTest{
@Test
public void queryNetworkTest() throws Exception {
StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
- NetworkInfo networkInfo = msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","regionOne");
+ NetworkInfo networkInfo = msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","MTN13");
Assert.assertEquals("net1",networkInfo.getName());
}
@Test
public void queryNetworkTest_404() throws Exception {
- NetworkInfo networkInfo = msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","regionOne");
+ NetworkInfo networkInfo = msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","MTN13");
Assert.assertNull(networkInfo);
}
@@ -90,7 +90,7 @@ public class MsoNeutronUtilsTest extends BaseTest{
public void queryNetworkTest_500() throws Exception {
expectedException.expect(MsoException.class);
StubOpenStack.mockOpenStackGetNeutronNetwork_500("43173f6a-d699-414b-888f-ab243dda6dfe");
- msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","regionOne");
+ msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","MTN13");
}
@@ -98,7 +98,7 @@ public class MsoNeutronUtilsTest extends BaseTest{
public void deleteNetworkkTest() throws Exception {
StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
StubOpenStack.mockOpenStackDeleteNeutronNetwork("43173f6a-d699-414b-888f-ab243dda6dfe");
- Boolean result = msoNeutronUtils.deleteNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","regionOne");
+ Boolean result = msoNeutronUtils.deleteNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","MTN13");
Assert.assertTrue(result);
}
@@ -107,7 +107,7 @@ public class MsoNeutronUtilsTest extends BaseTest{
public void updateNetworkTest() throws Exception {
StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
StubOpenStack.mockOpenstackPutNetwork("OpenstackCreateNeutronNetworkResponse.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
- NetworkInfo networkInfo = msoNeutronUtils.updateNetwork("regionOne", "tenantId",
+ NetworkInfo networkInfo = msoNeutronUtils.updateNetwork("MTN13", "tenantId",
"43173f6a-d699-414b-888f-ab243dda6dfe",MsoNeutronUtils.NetworkType.PROVIDER,"PROVIDER", vlans);
Assert.assertEquals("2a4017ef-31ff-496a-9294-e96ecc3bc9c9",networkInfo.getId());
@@ -117,7 +117,7 @@ public class MsoNeutronUtilsTest extends BaseTest{
public void updateNetworkTest_NetworkTypeAsMultiProvider() throws Exception {
StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
StubOpenStack.mockOpenstackPutNetwork("OpenstackCreateNeutronNetworkResponse.json", "43173f6a-d699-414b-888f-ab243dda6dfe");
- NetworkInfo networkInfo = msoNeutronUtils.updateNetwork("regionOne", "tenantId",
+ NetworkInfo networkInfo = msoNeutronUtils.updateNetwork("MTN13", "tenantId",
"43173f6a-d699-414b-888f-ab243dda6dfe",MsoNeutronUtils.NetworkType.MULTI_PROVIDER,"PROVIDER", vlans);
Assert.assertEquals("2a4017ef-31ff-496a-9294-e96ecc3bc9c9",networkInfo.getId());
diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json
index 7153f8b672..f1c08cc093 100644
--- a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json
+++ b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json
@@ -12,7 +12,7 @@
"name": null,
"endpoints": [
{
- "region": "regionOne",
+ "region": "mtn13",
"publicURL": "port",
"internalURL": null,
"adminURL": null
@@ -25,7 +25,7 @@
"name": null,
"endpoints": [
{
- "region": "regionOne",
+ "region": "mtn13",
"publicURL": "port",
"internalURL": null,
"adminURL": null
@@ -38,7 +38,7 @@
"name": null,
"endpoints": [
{
- "region": "regionOne",
+ "region": "mtn13",
"publicURL": "port",
"internalURL": null,
"adminURL": null
diff --git a/adapters/mso-adapter-utils/src/test/resources/application-test.yaml b/adapters/mso-adapter-utils/src/test/resources/application-test.yaml
index b584088587..f9467d3c12 100644
--- a/adapters/mso-adapter-utils/src/test/resources/application-test.yaml
+++ b/adapters/mso-adapter-utils/src/test/resources/application-test.yaml
@@ -1,12 +1,5 @@
# will be used as entry in DB to say SITE OFF/ON for healthcheck
# MSO Properties go here
-mso:
- catalog:
- db:
- spring:
- endpoint: "http://localhost:"
- db:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
cloud_config:
identity_services:
MT_KEYSTONE:
@@ -48,3 +41,51 @@ adapters:
orm_url_replace_with_this: "7080"
quota_value: "10"
set_default_quota: "false"
+
+server-port: 8080
+ssl-enable: false
+tomcat:
+ max-threads: 50
+mso:
+ logPath: logs
+ catalog:
+ db:
+ spring:
+ endpoint: http://localhost:${wiremock.server.port}
+ db:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ site-name: localDevEnv
+ async:
+ core-pool-size: 50
+ max-pool-size: 50
+ queue-capacity: 500
+spring:
+ datasource:
+ url: jdbc:mariadb://localhost:3307/catalogdb
+ username: root
+ password: password
+ driver-class-name: org.mariadb.jdbc.Driver
+ initialize: true
+ initialization-mode: never
+ jpa:
+ generate-ddl: false
+ show-sql: false
+ hibernate:
+ ddl-auto: none
+ naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
+ enable-lazy-load-no-trans: true
+ database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+
+mariaDB4j:
+ dataDir:
+ port: 3307
+ databaseName: catalogdb
+
+
+#Actuator
+management:
+ endpoints:
+ enabled-by-default: false
+ endpoint:
+ info:
+ enabled: true \ No newline at end of file
diff --git a/adapters/mso-adapter-utils/src/test/resources/data.sql b/adapters/mso-adapter-utils/src/test/resources/data.sql
new file mode 100644
index 0000000000..5e0e558291
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/resources/data.sql
@@ -0,0 +1,3 @@
+INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', NULL, '2018-07-17 14:05:08', '2018-07-17 14:05:08');
+
+INSERT INTO `cloud_sites` (`ID`, `region_id`, `identity_service_id`, `cloud_version`, `clli`, `cloudify_id`, `platform`, `orchestrator`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('MTN13', 'mtn13', 'MTN13', '3.0', 'MDT13', 'mtn13', null, 'orchestrator', '2018-07-17 14:06:28', '2018-07-17 14:06:28'); \ No newline at end of file