aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-catalog-db-adapter/src/test
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-10-11 13:55:37 -0400
committerRob Daugherty <rd472p@att.com>2018-10-12 10:10:16 -0400
commit6ba0a22bc952232d14d2d24c5f73a42aae2791a9 (patch)
tree9046e63bccb77ca3e2df4ae7ceab44cc238dd074 /adapters/mso-catalog-db-adapter/src/test
parent58c1d90a787979e507f559d7075aac8a1428df42 (diff)
Dynamic Cloud Owner Support
added in cloud configuration object to request params Fix Bean scanning so it picks up the resttemplate removed unnecessary RestTemplate Bean configurations corrected typo in CloudConfiguration class updated gr api test cases with dynamic cloud owner updated groovy files to allow for dynamic cloud owner values updated GR API layer to include cloud owner added enum for default cloud owner add cloud owner variable to camunda in mapping removed references to att-aic from BBInputSetup updated aai schema dependency to 1.3.1 from 1.3.0 Fixed incorrect type AAIUri and updated logging in the method. use existing service instance id instead of generating Pass cloudOwner to process to propagate to subprocesses. NOTE: our aai-schema dependency is 1.3.1-SNAPSHOT to be compatible with the cloud owner changes here. The releaesed 1.3.0 version is NOT compatible. Change-Id: I43b46774b77981d1c8bfe7c7a79b9434889e62ae Issue-ID: SO-1128 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com> Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src/test')
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java62
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql3
2 files changed, 60 insertions, 5 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index 5c7b64d054..5e2bd82776 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -20,9 +20,11 @@
package org.onap.so.db.catalog.client;
+import java.util.List;
+import java.util.UUID;
+
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.adapters.catalogdb.CatalogDBApplication;
@@ -30,6 +32,7 @@ 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.CloudifyManager;
+import org.onap.so.db.catalog.beans.ExternalServiceToInternalService;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.ServerType;
@@ -49,10 +52,6 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
-import java.net.URI;
-import java.util.List;
-import java.util.UUID;
-
@RunWith(SpringRunner.class)
@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
@@ -414,4 +413,57 @@ public class CatalogDbClientTest {
Assert.assertEquals("regionId", getCloudSite.getRegionId());
Assert.assertEquals("RANDOMID", getCloudSite.getIdentityServiceId());
}
+ @Test
+ public void testGetServiceByModelName() {
+ Service service = client.getServiceByModelName("MSOTADevInfra_Test_Service");
+ Assert.assertNotNull(service);
+ Assert.assertNotNull(service.getModelVersion());
+ Assert.assertNotNull(service.getModelInvariantUUID());
+ Assert.assertEquals("MSOTADevInfra_Test_Service", service.getModelName());
+ Assert.assertEquals("NA", service.getServiceRole());
+ }
+
+ @Test
+ public void testGetServiceByModelNameNotFound() {
+ Service service = client.getServiceByModelName("Not_Found");
+ Assert.assertNull(service);
+ }
+
+ @Test
+ public void testGetServiceByModelUUID() {
+ Service service = client.getServiceByModelUUID("5df8b6de-2083-11e7-93ae-92361f002679");
+ Assert.assertNotNull(service);
+ Assert.assertNotNull(service.getModelVersion());
+ Assert.assertNotNull(service.getModelInvariantUUID());
+ Assert.assertEquals("5df8b6de-2083-11e7-93ae-92361f002679", service.getModelUUID());
+ Assert.assertEquals("NA", service.getServiceRole());
+ }
+
+ @Test
+ public void testGetServiceByModelUUIDNotFound() {
+ Service service = client.getServiceByModelUUID("Not_Found");
+ Assert.assertNull(service);
+ }
+
+ @Test
+ public void testFindServiceRecipeByActionAndServiceModelUUID() {
+ ServiceRecipe serviceRecipe = client.findServiceRecipeByActionAndServiceModelUUID("createInstance","4694a55f-58b3-4f17-92a5-796d6f5ffd0d" );
+ Assert.assertNotNull(serviceRecipe);
+ Assert.assertNotNull(serviceRecipe.getServiceModelUUID());
+ Assert.assertNotNull(serviceRecipe.getAction());
+ Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", serviceRecipe.getOrchestrationUri());
+ Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
+ }
+
+ @Test
+ public void testFindServiceRecipeByActionAndServiceModelUUIDNotFound() {
+ ServiceRecipe serviceRecipe = client.findServiceRecipeByActionAndServiceModelUUID("not_found","5df8b6de-2083-11e7-93ae-test" );
+ Assert.assertNull(serviceRecipe);
+ }
+
+ @Test
+ public void testFindExternalToInternalServiceByServiceNameNotFound() {
+ ExternalServiceToInternalService externalServiceToInternalService = client.findExternalToInternalServiceByServiceName("Not_Found");
+ Assert.assertNull(externalServiceToInternalService);
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index d5cdb18a0c..c8475564a4 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -60,6 +60,9 @@ insert into tosca_csar(artifact_uuid, name, version, description, artifact_check
insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values
('5df8b6de-2083-11e7-93ae-92361f002671', 'MSOTADevInfra_vSAMP10a_Service', '9647dfc4-2083-11e7-93ae-92361f002671', '1.0', 'MSO aLaCarte Vfmodule with addon', '2017-04-14 13:42:39', '0513f839-459d-46b6-aa3d-2edfef89a079', 'NA', 'NA', 'Luna', 'Oxygen');
+insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values
+('5df8b6de-2083-11e7-93ae-92361f002679', 'MSOTADevInfra_Test_Service', '9647dfc4-2083-11e7-93ae-92361f002673', '3.0', 'MSO aLaCarte Vfmodule with addon', '2017-04-14 13:42:39', '0513f839-459d-46b6-aa3d-2edfef89a079', 'NA', 'NA', 'Luna', 'Oxygen');
+
insert into tosca_csar(ARTIFACT_UUID,NAME,VERSION,DESCRIPTION,ARTIFACT_CHECKSUM,URL,CREATION_TIMESTAMP) values
('266eaf78-af74-45cd-83ec-9c477f189dc1','service-NetworkCollectionSvc0106-csar.csar','1','TOSCA definition package of the asset','OGQ1M2QyYjU0OWMzZTY4MWVlYTNhOWIxNmQ2NjEyZDQ=','/sdc/v1/catalog/services/NetworkCollectionSvc0106/1.0/artifacts/service-NetworkCollectionSvc0106-csar.csar','2018-06-01 16:06:52');
insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values