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/beans/macro/NorthBoundRequest.java | 18 ++++++++++++++++-- .../org/onap/so/db/catalog/client/CatalogDbClient.java | 12 ++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) (limited to 'mso-catalog-db/src/main/java') diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/NorthBoundRequest.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/NorthBoundRequest.java index 0df176c3f8..a7ce2da70d 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/NorthBoundRequest.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/NorthBoundRequest.java @@ -83,6 +83,10 @@ public class NorthBoundRequest implements Serializable { @Column(name = "MAX_API_VERSION") private Double maxApiVersion; + @BusinessKey + @Column(name = "CLOUD_OWNER") + private String cloudOwner; + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "northBoundRequest") private List orchestrationFlowList; @@ -90,7 +94,8 @@ public class NorthBoundRequest implements Serializable { public String toString() { return new ToStringBuilder(this).append("id", id).append("action", action).append("requestScope", requestScope) .append("isAlacarte", isAlacarte).append("isToplevelflow", isToplevelflow) - .append("minApiVersion", minApiVersion).append("maxApiVersion", maxApiVersion).toString(); + .append("minApiVersion", minApiVersion).append("maxApiVersion", maxApiVersion) + .append("cloudOwner",cloudOwner).toString(); } @Override @@ -102,13 +107,14 @@ public class NorthBoundRequest implements Serializable { return new EqualsBuilder().append(action, castOther.action).append(requestScope, castOther.requestScope) .append(isAlacarte, castOther.isAlacarte).append(isToplevelflow, castOther.isToplevelflow) .append(minApiVersion, castOther.minApiVersion).append(maxApiVersion, castOther.maxApiVersion) + .append(cloudOwner, castOther.cloudOwner) .isEquals(); } @Override public int hashCode() { return new HashCodeBuilder().append(action).append(requestScope).append(isAlacarte).append(isToplevelflow) - .append(minApiVersion).append(maxApiVersion).toHashCode(); + .append(minApiVersion).append(maxApiVersion).append(cloudOwner).toHashCode(); } public Integer getId() { @@ -174,6 +180,14 @@ public class NorthBoundRequest implements Serializable { public void setMaxApiVersion(Double maxApiVersion) { this.maxApiVersion = maxApiVersion; } + + public String getCloudOwner() { + return cloudOwner; + } + + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } @LinkedResource public List getOrchestrationFlowList() { diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java index 4f070e71c9..51c55bdfce 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java @@ -118,6 +118,7 @@ public class CatalogDbClient { private static final String TARGET_ACTION = "targetAction"; private static final String REQUEST_SCOPE = "requestScope"; private static final String IS_ALACARTE = "isALaCarte"; + private static final String CLOUD_OWNER = "cloudOwner"; private static final String FLOW_NAME = "flowName"; private static final String SERVICE_TYPE = "serviceType"; private static final String VNF_TYPE = "vnfType"; @@ -151,6 +152,7 @@ public class CatalogDbClient { private String findVnfcInstanceGroupCustomizationByModelCustomizationUUID = "/findByModelCustomizationUUID"; private String findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID = "/findByModelCustomizationUUID"; private String findOneByActionAndRequestScopeAndIsAlacarte = "/findOneByActionAndRequestScopeAndIsAlacarte"; + private String findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner = "/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner"; private String findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = "/findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep"; private String findByClliAndCloudVersion = "/findByClliAndCloudVersion"; @@ -248,6 +250,7 @@ public class CatalogDbClient { findVnfcInstanceGroupCustomizationByModelCustomizationUUID = endpoint + VNFC_INSTANCE_GROUP_CUSTOMIZATION + SEARCH + findVnfcInstanceGroupCustomizationByModelCustomizationUUID; findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID = endpoint + COLLECTION_RESOURCE_INSTANCE_GROUP_CUSTOMIZATION + SEARCH + findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID; findOneByActionAndRequestScopeAndIsAlacarte = endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH + findOneByActionAndRequestScopeAndIsAlacarte; + findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner = endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH + findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner; findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH + findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep; findByClliAndCloudVersion = endpoint + CLOUD_SITE + SEARCH + findByClliAndCloudVersion; @@ -477,6 +480,15 @@ public class CatalogDbClient { .queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName) .queryParam(IS_ALACARTE, aLaCarte).build()); } + + public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(String requestAction, + String resourceName, boolean aLaCarte, String cloudOwner) { + return this.getSingleResource(northBoundRequestClient, getUri(UriBuilder + .fromUri(findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner) + .queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName) + .queryParam(IS_ALACARTE, aLaCarte) + .queryParam(CLOUD_OWNER, cloudOwner).build().toString())); + } public RainyDayHandlerStatus getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep( String flowName, String serviceType, String vnfType, String errorCode, String workStep) { -- cgit 1.2.3-korg