aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-catalog-db-adapter/src/test/java
diff options
context:
space:
mode:
authorSmokowski, Steve (ss835w) <ss835w@us.att.com>2018-12-05 09:38:22 -0500
committerSmokowski, Steve (ss835w) <ss835w@us.att.com>2018-12-05 09:38:22 -0500
commit6adb4ab50bd5c2e32ea0b57fe5a3ba5b7238e57a (patch)
treeaebefd56c44770158a097a3dd14892b311642435 /adapters/mso-catalog-db-adapter/src/test/java
parent12b82667b31640f815a973dc0762f78254165a52 (diff)
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) <ss835w@us.att.com>
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src/test/java')
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java29
1 files changed, 28 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);