diff options
author | Rob Daugherty <rd472p@att.com> | 2018-12-05 19:08:54 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-12-05 19:08:54 +0000 |
commit | 35726250e078b57ebe6ea4e53b4b8ccd56573e50 (patch) | |
tree | 9dd38886e940ae494534be19da15126707417423 /adapters/mso-catalog-db-adapter/src/test | |
parent | 03b31bd484e2a46da210f0b2d31b1d5447b41952 (diff) | |
parent | 6adb4ab50bd5c2e32ea0b57fe5a3ba5b7238e57a (diff) |
Merge "Add Cloud Owner"
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src/test')
2 files changed, 36 insertions, 1 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 ec9ad8c29c..e249285867 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,15 @@ package org.onap.so.db.catalog.client; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; + import java.util.List; import java.util.UUID; +import javax.ws.rs.core.UriBuilder; + import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -44,25 +50,31 @@ import org.onap.so.db.catalog.beans.VnfComponentsRecipe; import org.onap.so.db.catalog.beans.VnfRecipe; import org.onap.so.db.catalog.beans.VnfResource; import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.ExternalServiceToInternalService; +import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; +import com.fasterxml.jackson.databind.ObjectMapper; + @RunWith(SpringRunner.class) @SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") public class CatalogDbClientTest { public static final String MTN13 = "mtn13"; + @LocalServerPort private int port; @Value("${mso.db.auth}") private String msoAdaptersAuth; - + @Autowired CatalogDbClientPortChanger client; @@ -446,6 +458,21 @@ public class CatalogDbClientTest { } @Test + public void testGetNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(){ + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + northBoundRequest.setAction("createService"); + northBoundRequest.setRequestScope("service"); + northBoundRequest.setIsAlacarte(true); + northBoundRequest.setCloudOwner("my-custom-cloud-owner"); + client.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner("createService", "service", true, "my-custom-cloud-owner"); + Assert.assertNotNull(northBoundRequest); + Assert.assertEquals("createService",northBoundRequest.getAction()); + Assert.assertEquals("service",northBoundRequest.getRequestScope()); + Assert.assertEquals(true,northBoundRequest.getIsAlacarte() ); + Assert.assertEquals("my-custom-cloud-owner", northBoundRequest.getCloudOwner()); + } + + @Test public void testFindServiceRecipeByActionAndServiceModelUUID() { ServiceRecipe serviceRecipe = client.findServiceRecipeByActionAndServiceModelUUID("createInstance","4694a55f-58b3-4f17-92a5-796d6f5ffd0d" ); Assert.assertNotNull(serviceRecipe); 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 4d5105dec6..98d1917050 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 @@ -209,3 +209,11 @@ VALUES INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_MODEL_UUID) VALUES ('volumeGroup', 'createInstance', '1', 'Gr api recipe to create volume-group', '/mso/async/services/WorkflowActionBB', 180, '20c4431c-246d-11e7-93ae-92361f002671'); + + +INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, CLOUD_OWNER) VALUES +('Service-Create', 'createInstance', 'Service', true, '7','7', 'my-custom-cloud-owner'); + + +INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES +('Service-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create' and CLOUD_OWNER = 'my-custom-cloud-owner')); |