From 6adb4ab50bd5c2e32ea0b57fe5a3ba5b7238e57a Mon Sep 17 00:00:00 2001 From: "Smokowski, Steve (ss835w)" Date: Wed, 5 Dec 2018 09:38:22 -0500 Subject: Add Cloud Owner Update ref data, turn test into integration test Fixed junit test to use cloudOwner as "my-custom-cloud-owner". Fixed junit test case for the new method. updates to the junit test case for Update WorkflowAction.queryNorthBoundRequestCatalogDb to have cloud-owner as a param Add a new method to CatalogDBClient- getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner() Update Repeatable Migration to have CloudOwner Populated for all Records Add New Migration Script to Add Cloud_Owner Column to North_Bound_Request Table Add Cloud_Owner Field to Java Bean, as a String Change-Id: I9f135be8923626c6d6f6b4ae23e4cbc0200067e2 Issue-ID: SO-1276 Signed-off-by: Smokowski, Steve (ss835w) --- .../so/db/catalog/client/CatalogDbClientTest.java | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'adapters/mso-catalog-db-adapter/src/test/java') 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; @@ -445,6 +457,21 @@ public class CatalogDbClientTest { Assert.assertNull(service); } + @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" ); -- cgit 1.2.3-korg