From fe4cd8e4c08a19ac543ca93c577b8b3a12a1524f Mon Sep 17 00:00:00 2001 From: Liam Fallon Date: Thu, 14 Dec 2017 07:40:18 -0800 Subject: Cleanup of A&AI message model module. Fields have been made fields private in POJOs, and wrote JUnit unit tests to bring up code coverage. AAIManager also changed to use non-static methods so that it can be stubbed with Mockito. Change-Id: I871427ced5db8a1dfd6495fef4e6d84adf264e65 Signed-off-by: Liam Fallon Issue-ID: POLICY-455 Signed-off-by: Liam Fallon --- .../actor/appclcm/AppcLcmActorServiceProvider.java | 25 +-- .../actor/so/SOActorServiceProvider.java | 59 +++---- .../actor/vfc/VFCActorServiceProvider.java | 7 +- .../eventmanager/ControlLoopEventManager.java | 21 +-- .../eventmanager/ControlLoopOperationManager.java | 2 +- .../eventmanager/ControlLoopEventManagerTest.java | 128 +++++++-------- controlloop/common/model-impl/aai/pom.xml | 34 ++-- .../java/org/onap/policy/aai/AAIGETResponse.java | 61 ++++++- .../org/onap/policy/aai/AAIGETVnfResponse.java | 53 +++++- .../org/onap/policy/aai/AAIGETVserverResponse.java | 43 ++++- .../main/java/org/onap/policy/aai/AAIManager.java | 155 +++++++++++------- .../java/org/onap/policy/aai/AAINQCloudRegion.java | 53 +++++- .../org/onap/policy/aai/AAINQExtraProperties.java | 4 - .../org/onap/policy/aai/AAINQExtraProperty.java | 22 ++- .../java/org/onap/policy/aai/AAINQGenericVNF.java | 173 +++++++++++++++++--- .../policy/aai/AAINQInventoryResponseItem.java | 93 +++++++++-- .../policy/aai/AAINQInventoryResponseItems.java | 4 - .../java/org/onap/policy/aai/AAINQNamedQuery.java | 14 +- .../org/onap/policy/aai/AAINQQueryParameters.java | 14 +- .../java/org/onap/policy/aai/AAINQRequest.java | 25 ++- .../org/onap/policy/aai/AAINQRequestError.java | 11 +- .../java/org/onap/policy/aai/AAINQResponse.java | 16 -- .../org/onap/policy/aai/AAINQServiceExcept.java | 19 ++- .../org/onap/policy/aai/AAINQServiceInstance.java | 84 ++++++++-- .../main/java/org/onap/policy/aai/AAINQTenant.java | 36 +++- .../java/org/onap/policy/aai/AAINQVServer.java | 86 ++++++++-- .../java/org/onap/policy/aai/AAINQVfModule.java | 134 +++++++++++++-- .../aai/src/main/java/org/onap/policy/aai/PNF.java | 4 - .../src/main/java/org/onap/policy/aai/PNFType.java | 5 +- .../org/onap/policy/aai/RelatedToProperty.java | 9 +- .../org/onap/policy/aai/RelatedToPropertyItem.java | 22 ++- .../java/org/onap/policy/aai/Relationship.java | 45 ++++- .../java/org/onap/policy/aai/RelationshipData.java | 4 - .../org/onap/policy/aai/RelationshipDataItem.java | 22 ++- .../java/org/onap/policy/aai/RelationshipItem.java | 4 - .../java/org/onap/policy/aai/RelationshipList.java | 5 +- .../org/onap/policy/aai/AAIGETVnfResponseTest.java | 58 ++++--- .../onap/policy/aai/AAIGETVserverResponseTest.java | 56 ++++--- .../java/org/onap/policy/aai/AAIManagerTest.java | 142 ++++++++++++++++ .../org/onap/policy/aai/AAINQCloudRegionTest.java | 15 +- .../onap/policy/aai/AAINQExtraPropertyTest.java | 8 +- .../org/onap/policy/aai/AAINQGenericVNFTest.java | 52 ++++-- .../onap/policy/aai/AAINQInstanceFiltersTest.java | 4 + .../policy/aai/AAINQInventoryResponseItemTest.java | 182 ++++++++++----------- .../aai/AAINQInventoryResponseItemsTest.java | 176 ++++++++++---------- .../org/onap/policy/aai/AAINQNamedQueryTest.java | 5 +- .../onap/policy/aai/AAINQQueryParametersTest.java | 5 +- .../org/onap/policy/aai/AAINQRequestErrorTest.java | 39 +++++ .../java/org/onap/policy/aai/AAINQRequestTest.java | 17 +- .../org/onap/policy/aai/AAINQResponseTest.java | 180 ++++++++++---------- .../onap/policy/aai/AAINQResponseWrapperTest.java | 182 +++++++++++---------- .../onap/policy/aai/AAINQServiceInstanceTest.java | 22 ++- .../java/org/onap/policy/aai/AAINQTenantTest.java | 12 +- .../java/org/onap/policy/aai/AAINQVServerTest.java | 24 ++- .../org/onap/policy/aai/AAINQVfModuleTest.java | 37 +++-- .../java/org/onap/policy/aai/PNFInstanceTest.java | 49 ++++++ .../src/test/java/org/onap/policy/aai/PNFTest.java | 23 +++ .../test/java/org/onap/policy/aai/PNFTypeTest.java | 1 + .../onap/policy/aai/RelatedToPropertyItemTest.java | 4 +- .../org/onap/policy/aai/RelatedToPropertyTest.java | 14 +- .../onap/policy/aai/RelationshipDataItemTest.java | 4 +- .../org/onap/policy/aai/RelationshipDataTest.java | 17 +- .../org/onap/policy/aai/RelationshipItemTest.java | 8 +- .../org/onap/policy/aai/RelationshipListTest.java | 29 ++-- .../java/org/onap/policy/aai/RelationshipTest.java | 25 +-- .../org/onap/policy/aai/util/AAIExceptionTest.java | 39 +++++ .../java/org/onap/policy/rest/RESTManager.java | 8 +- .../main/java/org/onap/policy/so/SOManager.java | 6 +- .../main/java/org/onap/policy/vfc/VFCManager.java | 4 +- .../onap/policy/simulators/AaiSimulatorJaxRs.java | 6 +- .../onap/policy/simulators/AaiSimulatorTest.java | 25 +-- .../onap/policy/simulators/GuardSimulatorTest.java | 4 +- .../onap/policy/simulators/SoSimulatorTest.java | 2 +- .../onap/policy/simulators/VfcSimulatorTest.java | 4 +- 74 files changed, 2067 insertions(+), 917 deletions(-) create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIManagerTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestErrorTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/util/AAIExceptionTest.java diff --git a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java index 936dd0243..0f4a00423 100644 --- a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java +++ b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java @@ -51,6 +51,7 @@ import org.onap.policy.controlloop.actorServiceProvider.spi.Actor; import org.onap.policy.controlloop.policy.Policy; import org.onap.policy.controlloop.policy.PolicyResult; import org.onap.policy.drools.system.PolicyEngine; +import org.onap.policy.rest.RESTManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -110,15 +111,15 @@ public class AppcLcmActorServiceProvider implements Actor { private static String parseAAIResponse(List items, String resourceId) { String vnfId = null; for (AAINQInventoryResponseItem item: items) { - if ((item.genericVNF != null) - && (item.genericVNF.modelInvariantId != null) - && (resourceId.equals(item.genericVNF.modelInvariantId))) { - vnfId = item.genericVNF.vnfID; + if ((item.getGenericVNF() != null) + && (item.getGenericVNF().getModelInvariantId() != null) + && (resourceId.equals(item.getGenericVNF().getModelInvariantId()))) { + vnfId = item.getGenericVNF().getVnfID(); break; } else { - if((item.items != null) && (item.items.getInventoryResponseItems() != null)) { - vnfId = parseAAIResponse(item.items.getInventoryResponseItems(), resourceId); + if((item.getItems() != null) && (item.getItems().getInventoryResponseItems() != null)) { + vnfId = parseAAIResponse(item.getItems().getInventoryResponseItems(), resourceId); } } } @@ -144,9 +145,9 @@ public class AppcLcmActorServiceProvider implements Actor { UUID requestId = UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087"); AAINQRequest aaiRequest = new AAINQRequest(); - aaiRequest.queryParameters = new AAINQQueryParameters(); - aaiRequest.queryParameters.namedQuery = new AAINQNamedQuery(); - aaiRequest.queryParameters.namedQuery.namedQueryUUID = requestId; + aaiRequest.setQueryParameters(new AAINQQueryParameters()); + aaiRequest.getQueryParameters().setNamedQuery(new AAINQNamedQuery()); + aaiRequest.getQueryParameters().getNamedQuery().setNamedQueryUUID(requestId); Map> filter = new HashMap<>(); Map filterItem = new HashMap<>(); @@ -154,8 +155,8 @@ public class AppcLcmActorServiceProvider implements Actor { filterItem.put("vnf-id", sourceVnfId); filter.put("generic-vnf", filterItem); - aaiRequest.instanceFilters = new AAINQInstanceFilters(); - aaiRequest.instanceFilters.getInstanceFilter().add(filter); + aaiRequest.setInstanceFilters(new AAINQInstanceFilters()); + aaiRequest.getInstanceFilters().getInstanceFilter().add(filter); /* * Obtain A&AI credentials from properties.environment file @@ -165,7 +166,7 @@ public class AppcLcmActorServiceProvider implements Actor { String aaiUsername = PolicyEngine.manager.getEnvironmentProperty("aai.username"); String aaiPassword = PolicyEngine.manager.getEnvironmentProperty("aai.password"); - AAINQResponse aaiResponse = AAIManager.postQuery( + AAINQResponse aaiResponse = new AAIManager(new RESTManager()).postQuery( aaiUrl, aaiUsername, aaiPassword, aaiRequest, requestId); diff --git a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java index de9c58500..ad27a0201 100644 --- a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java +++ b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java @@ -40,6 +40,7 @@ import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actorServiceProvider.spi.Actor; import org.onap.policy.controlloop.policy.Policy; import org.onap.policy.drools.system.PolicyEngine; +import org.onap.policy.rest.RESTManager; import org.onap.policy.so.SOCloudConfiguration; import org.onap.policy.so.SOManager; import org.onap.policy.so.SOModelInfo; @@ -149,9 +150,9 @@ public class SOActorServiceProvider implements Actor { AAINQInstanceFilters aainqinstancefilter = new AAINQInstanceFilters(); // queryParameters - aainqnamedquery.namedQueryUUID = UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469"); // UUID.fromString($params.getAaiNamedQueryUUID()) TO DO: AaiNamedQueryUUID - aainqqueryparam.namedQuery = aainqnamedquery; - aainqrequest.queryParameters = aainqqueryparam; + aainqnamedquery.setNamedQueryUUID(UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469")); // UUID.fromString($params.getAaiNamedQueryUUID()) TO DO: AaiNamedQueryUUID + aainqqueryparam.setNamedQuery(aainqnamedquery); + aainqrequest.setQueryParameters(aainqqueryparam); // // instanceFilters // @@ -160,7 +161,7 @@ public class SOActorServiceProvider implements Actor { aainqinstancefiltermapitem.put("vserver-name", onset.AAI.get("vserver.vserver-name")); // TO DO: get vserver.vname from dcae onset.AAI.get("vserver.vserver-name") aainqinstancefiltermap.put("vserver", aainqinstancefiltermapitem); aainqinstancefilter.getInstanceFilter().add(aainqinstancefiltermap); - aainqrequest.instanceFilters = aainqinstancefilter; + aainqrequest.setInstanceFilters(aainqinstancefilter); // // print aainqrequest for debug // @@ -184,7 +185,7 @@ public class SOActorServiceProvider implements Actor { String aaiPassword = PolicyEngine.manager.getEnvironmentProperty("aai.password"); //***** send the request *****\\ - AAINQResponse aainqresponse = AAIManager.postQuery(aaiUrl, aaiUsername, aaiPassword, + AAINQResponse aainqresponse = new AAIManager(new RESTManager()).postQuery(aaiUrl, aaiUsername, aaiPassword, aainqrequest, onset.requestID); // Check AAI response @@ -220,32 +221,32 @@ public class SOActorServiceProvider implements Actor { try { // vnfItem - setVnfItemVnfId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).genericVNF.vnfID); - setVnfItemVnfType(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).genericVNF.vnfType); + setVnfItemVnfId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getGenericVNF().getVnfID()); + setVnfItemVnfType(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getGenericVNF().getVnfType()); setVnfItemVnfType(vnfItemVnfType.substring(vnfItemVnfType.lastIndexOf("/")+1)); - setVnfItemModelInvariantId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).genericVNF.modelInvariantId); - setVnfItemModelVersionId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).genericVNF.modelVersionId); - setVnfItemModelName(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).extraProperties.getExtraProperty().get(1).propertyValue); - setVnfItemModelNameVersionId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).extraProperties.getExtraProperty().get(0).propertyValue); - setVnfItemModelVersion(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).extraProperties.getExtraProperty().get(4).propertyValue); + setVnfItemModelInvariantId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getGenericVNF().getModelInvariantId()); + setVnfItemModelVersionId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getGenericVNF().getModelVersionId()); + setVnfItemModelName(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getExtraProperties().getExtraProperty().get(1).getPropertyValue()); + setVnfItemModelNameVersionId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getExtraProperties().getExtraProperty().get(0).getPropertyValue()); + setVnfItemModelVersion(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getExtraProperties().getExtraProperty().get(4).getPropertyValue()); // serviceItem - setServiceItemServiceInstanceId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).serviceInstance.serviceInstanceID); - setServiceItemModelInvariantId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).serviceInstance.modelInvariantId); - setServiceItemModelName(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).extraProperties.getExtraProperty().get(1).propertyValue); - setServiceItemModelType(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).extraProperties.getExtraProperty().get(1).propertyValue); - setServiceItemModelNameVersionId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).serviceInstance.modelVersionId); - setServiceItemModelVersion(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).extraProperties.getExtraProperty().get(4).propertyValue); + setServiceItemServiceInstanceId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getServiceInstance().getServiceInstanceID()); + setServiceItemModelInvariantId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getServiceInstance().getModelInvariantId()); + setServiceItemModelName(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getExtraProperties().getExtraProperty().get(1).getPropertyValue()); + setServiceItemModelType(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getExtraProperties().getExtraProperty().get(1).getPropertyValue()); + setServiceItemModelNameVersionId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getServiceInstance().getModelVersionId()); + setServiceItemModelVersion(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getExtraProperties().getExtraProperty().get(4).getPropertyValue()); // Find the index for base vf module and non-base vf module int baseIndex = -1; int nonBaseIndex = -1; - List inventoryItems = namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).items.getInventoryResponseItems(); + List inventoryItems = namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems(); for (AAINQInventoryResponseItem m : inventoryItems) { - if (m.vfModule != null) { - if (m.vfModule.isBaseVfModule) { + if (m.getVfModule() != null) { + if (m.getVfModule().getIsBaseVfModule()) { baseIndex = inventoryItems.indexOf(m); - } else if (m.vfModule.isBaseVfModule == false) { + } else if (m.getVfModule().getIsBaseVfModule() == false) { nonBaseIndex = inventoryItems.indexOf(m); } } @@ -262,20 +263,20 @@ public class SOActorServiceProvider implements Actor { } // This comes from the base module - setVfModuleItemVfModuleName(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(baseIndex).vfModule.vfModuleName); + setVfModuleItemVfModuleName(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(baseIndex).getVfModule().getVfModuleName()); setVfModuleItemVfModuleName(vfModuleItemVfModuleName.replace("Vfmodule", "vDNS")); // vfModuleItem - NOT the base module - setVfModuleItemModelInvariantId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(nonBaseIndex).vfModule.modelInvariantId); - setVfModuleItemModelNameVersionId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(nonBaseIndex).vfModule.modelVersionId); - setVfModuleItemModelName(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(nonBaseIndex).extraProperties.getExtraProperty().get(1).propertyValue); - setVfModuleItemModelVersionId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(nonBaseIndex).extraProperties.getExtraProperty().get(4).propertyValue); + setVfModuleItemModelInvariantId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(nonBaseIndex).getVfModule().getModelInvariantId()); + setVfModuleItemModelNameVersionId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(nonBaseIndex).getVfModule().getModelVersionId()); + setVfModuleItemModelName(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(nonBaseIndex).getExtraProperties().getExtraProperty().get(1).getPropertyValue()); + setVfModuleItemModelVersionId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(nonBaseIndex).getExtraProperties().getExtraProperty().get(4).getPropertyValue()); // tenantItem - setTenantItemTenantId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(1).tenant.tenantId); + setTenantItemTenantId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(1).getTenant().getTenantId()); // cloudRegionItem - setCloudRegionItemCloudRegionId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).items.getInventoryResponseItems().get(1).items.getInventoryResponseItems().get(0).cloudRegion.cloudRegionId); + setCloudRegionItemCloudRegionId(namedQueryResponseWrapper.getAainqresponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(1).getItems().getInventoryResponseItems().get(0).getCloudRegion().getCloudRegionId()); } catch (Exception e) { logger.warn("Problem extracting SO data from AAI query response because of {}", e.getMessage(), e); diff --git a/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VFCActorServiceProvider.java b/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VFCActorServiceProvider.java index 7bf5a2826..efa3dba1f 100644 --- a/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VFCActorServiceProvider.java +++ b/controlloop/common/actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VFCActorServiceProvider.java @@ -29,6 +29,7 @@ import org.onap.policy.vfc.VFCHealActionVmInfo; import org.onap.policy.controlloop.ControlLoopOperation; import org.onap.policy.controlloop.policy.Policy; import org.onap.policy.drools.system.PolicyEngine; +import org.onap.policy.rest.RESTManager; import org.onap.policy.controlloop.actorServiceProvider.spi.Actor; import com.google.common.collect.ImmutableList; @@ -79,7 +80,7 @@ public class VFCActorServiceProvider implements Actor { if (tempVnfResp == null) return null; } - serviceInstance = tempVnfResp.serviceId; + serviceInstance = tempVnfResp.getServiceId(); } request.nsInstanceId = serviceInstance; request.requestId = onset.requestID; @@ -113,10 +114,10 @@ public class VFCActorServiceProvider implements Actor { try { if (vnfName != null) { String url = aaiUrl + "/aai/v11/network/generic-vnfs/generic-vnf?vnf-name="; - response = AAIManager.getQueryByVnfName(url, aaiUsername, aaiPassword, requestID, vnfName); + response = new AAIManager(new RESTManager()).getQueryByVnfName(url, aaiUsername, aaiPassword, requestID, vnfName); } else if (vnfID != null) { String url = aaiUrl + "/aai/v11/network/generic-vnfs/generic-vnf/"; - response = AAIManager.getQueryByVnfID(url, aaiUsername, aaiPassword, requestID, vnfID); + response = new AAIManager(new RESTManager()).getQueryByVnfID(url, aaiUsername, aaiPassword, requestID, vnfID); } else { logger.error("getAAIServiceInstance failed"); } diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java index 4adcff048..559eab9d9 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java @@ -46,6 +46,7 @@ import org.onap.policy.guard.LockCallback; import org.onap.policy.guard.PolicyGuard; import org.onap.policy.guard.PolicyGuard.LockResult; import org.onap.policy.guard.TargetLock; +import org.onap.policy.rest.RESTManager; import org.onap.policy.drools.system.PolicyEngine; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -568,7 +569,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable { if (vnfResponse == null) { throw new AAIException("AAI Response is null (query by vnf-id)"); } - if (vnfResponse.requestError != null) { + if (vnfResponse.getRequestError() != null) { throw new AAIException("AAI Responded with a request error (query by vnf-id)"); } if (isClosedLoopDisabled(vnfResponse) == true) { @@ -579,7 +580,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable { if (vnfResponse == null) { throw new AAIException("AAI Response is null (query by vnf-name)"); } - if (vnfResponse.requestError != null) { + if (vnfResponse.getRequestError() != null) { throw new AAIException("AAI Responded with a request error (query by vnf-name)"); } if (isClosedLoopDisabled(vnfResponse) == true) { @@ -590,7 +591,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable { if (vserverResponse == null) { throw new AAIException("AAI Response is null (query by vserver-name)"); } - if (vserverResponse.requestError != null) { + if (vserverResponse.getRequestError() != null) { throw new AAIException("AAI responded with a request error (query by vserver-name)"); } if (isClosedLoopDisabled(vserverResponse) == true) { @@ -607,8 +608,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable { } public static boolean isClosedLoopDisabled(AAIGETVnfResponse aaiResponse) { - if (aaiResponse != null && aaiResponse.isClosedLoopDisabled != null) { - String value = aaiResponse.isClosedLoopDisabled; + if (aaiResponse != null && aaiResponse.getIsClosedLoopDisabled() != null) { + String value = aaiResponse.getIsClosedLoopDisabled(); if ("true".equalsIgnoreCase(value) || "T".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value) || "Y".equalsIgnoreCase(value)) { return true; @@ -619,8 +620,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable { } public static boolean isClosedLoopDisabled(AAIGETVserverResponse aaiResponse) { - if (aaiResponse != null && aaiResponse.isClosedLoopDisabled != null) { - String value = aaiResponse.isClosedLoopDisabled; + if (aaiResponse != null && aaiResponse.getIsClosedLoopDisabled() != null) { + String value = aaiResponse.getIsClosedLoopDisabled(); if ("true".equalsIgnoreCase(value) || "T".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value) || "Y".equalsIgnoreCase(value)) { return true; @@ -659,7 +660,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable { String aaiGetQueryByVserver = "/aai/v11/nodes/vservers?vserver-name="; String url = aaiHostURL + aaiGetQueryByVserver; logger.info("url: " + url); - response = AAIManager.getQueryByVserverName(url, aaiUser, aaiPassword, requestID, vserverName); + response = new AAIManager(new RESTManager()).getQueryByVserverName(url, aaiUser, aaiPassword, requestID, vserverName); } } catch (Exception e) { logger.error("getAAIVserverInfo exception: ", e); @@ -684,12 +685,12 @@ public class ControlLoopEventManager implements LockCallback, Serializable { String aaiGetQueryByVnfName = "/aai/v11/network/generic-vnfs/generic-vnf?vnf-name="; String url = aaiHostURL + aaiGetQueryByVnfName; logger.info("url: " + url); - response = AAIManager.getQueryByVnfName(url, aaiUser, aaiPassword, requestID, vnfName); + response = new AAIManager(new RESTManager()).getQueryByVnfName(url, aaiUser, aaiPassword, requestID, vnfName); } else if (vnfID != null) { String aaiGetQueryByVnfID = "/aai/v11/network/generic-vnfs/generic-vnf/"; String url = aaiHostURL + aaiGetQueryByVnfID; logger.info("url: " + url); - response = AAIManager.getQueryByVnfID(url, aaiUser, aaiPassword, requestID, vnfID); + response = new AAIManager(new RESTManager()).getQueryByVnfID(url, aaiUser, aaiPassword, requestID, vnfID); } } catch (Exception e) { logger.error("getAAIVnfInfo exception: ", e); diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java index d52f7fd47..5084d4cbc 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java @@ -157,7 +157,7 @@ public class ControlLoopOperationManager implements Serializable { * If the vnf-name was retrieved from the onset then the vnf-id * must be obtained from the event manager's A&AI GET query */ - String vnfId = this.eventManager.getVnfResponse().vnfID; + String vnfId = this.eventManager.getVnfResponse().getVnfID(); if (vnfId == null) { throw new AAIException("No vnf-id found"); } diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java index 99a4c926d..bc832a907 100644 --- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java +++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java @@ -271,46 +271,46 @@ public class ControlLoopEventManagerTest { public static AAIGETVnfResponse getQueryByVnfID2(String urlGet, String username, String password, UUID requestID, String key) { AAIGETVnfResponse response = new AAIGETVnfResponse(); - response.vnfID = "83f674e8-7555-44d7-9a39-bdc3770b0491"; - response.vnfName = "lll_vnf_010317"; - response.vnfType = "Basa-122216-Service/VidVsamp12BaseVolume 1"; - response.serviceId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"; - response.orchestrationStatus = "Created"; - response.inMaint = "false"; - response.isClosedLoopDisabled = "false"; - response.resourceVersion = "1494001988835"; - response.modelInvariantId = "f18be3cd-d446-456e-9109-121d9b62feaa"; + response.setVnfID("83f674e8-7555-44d7-9a39-bdc3770b0491"); + response.setVnfName("lll_vnf_010317"); + response.setVnfType("Basa-122216-Service/VidVsamp12BaseVolume 1"); + response.setServiceId("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + response.setOrchestrationStatus("Created"); + response.setInMaint("false"); + response.setIsClosedLoopDisabled("false"); + response.setResourceVersion("1494001988835"); + response.setModelInvariantId("f18be3cd-d446-456e-9109-121d9b62feaa"); RelationshipList relationshipList = new RelationshipList(); Relationship relationship = new Relationship(); RelationshipData relationshipData = new RelationshipData(); RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.relationshipKey = "customer.global-customer-id"; - relationshipDataItem.relationshipValue = "MSO_1610_ST"; + relationshipDataItem.setRelationshipKey ("customer.global-customer-id"); + relationshipDataItem.setRelationshipValue("MSO_1610_ST"); relationshipData.getRelationshipData().add(relationshipDataItem); - relationshipDataItem.relationshipKey = "service-subscription.service-type"; - relationshipDataItem.relationshipValue = "MSO-dev-service-type"; + relationshipDataItem.setRelationshipKey ("service-subscription.service-type"); + relationshipDataItem.setRelationshipValue("MSO-dev-service-type"); relationshipData.getRelationshipData().add(relationshipDataItem); - relationshipDataItem.relationshipKey = "service-instance.service-instance-id"; - relationshipDataItem.relationshipValue = "e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; + relationshipDataItem.setRelationshipKey ("service-instance.service-instance-id"); + relationshipDataItem.setRelationshipValue("e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"); relationshipData.getRelationshipData().add(relationshipDataItem); RelatedToProperty relatedToProperty = new RelatedToProperty(); RelatedToPropertyItem item = new RelatedToPropertyItem(); - item.propertyKey = "service-instance.service-instance-name"; - item.propertyValue = "lll_svc_010317"; + item.setPropertyKey("service-instance.service-instance-name"); + item.setPropertyValue("lll_svc_010317"); relatedToProperty.getRelatedTo().add(item); - relationship.relatedTo = "service-instance"; - relationship.relatedLink = "/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; - relationship.relationshipData = relationshipData; - relationship.relatedToProperty = relatedToProperty; + relationship.setRelatedTo("service-instance"); + relationship.setRelatedLink("/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"); + relationship.setRelationshipData(relationshipData); + relationship.setRelatedToProperty(relatedToProperty); relationshipList.getRelationshipList().add(relationship); - response.relationshipList = relationshipList; + response.setRelationshipList(relationshipList); return response; } @@ -318,46 +318,46 @@ public class ControlLoopEventManagerTest { public static AAIGETVnfResponse getQueryByVnfName2(String urlGet, String username, String password, UUID requestID, String key) { AAIGETVnfResponse response = new AAIGETVnfResponse(); - response.vnfID = "83f674e8-7555-44d7-9a39-bdc3770b0491"; - response.vnfName = "lll_vnf_010317"; - response.vnfType = "Basa-122216-Service/VidVsamp12BaseVolume 1"; - response.serviceId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"; - response.orchestrationStatus = "Created"; - response.inMaint = "false"; - response.isClosedLoopDisabled = "false"; - response.resourceVersion = "1494001988835"; - response.modelInvariantId = "f18be3cd-d446-456e-9109-121d9b62feaa"; + response.setVnfID("83f674e8-7555-44d7-9a39-bdc3770b0491"); + response.setVnfName("lll_vnf_010317"); + response.setVnfType("Basa-122216-Service/VidVsamp12BaseVolume 1"); + response.setServiceId("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + response.setOrchestrationStatus("Created"); + response.setInMaint("false"); + response.setIsClosedLoopDisabled("false"); + response.setResourceVersion("1494001988835"); + response.setModelInvariantId("f18be3cd-d446-456e-9109-121d9b62feaa"); RelationshipList relationshipList = new RelationshipList(); Relationship relationship = new Relationship(); RelationshipData relationshipData = new RelationshipData(); RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.relationshipKey = "customer.global-customer-id"; - relationshipDataItem.relationshipValue = "MSO_1610_ST"; + relationshipDataItem.setRelationshipKey("customer.global-customer-id"); + relationshipDataItem.setRelationshipValue("MSO_1610_ST"); relationshipData.getRelationshipData().add(relationshipDataItem); - relationshipDataItem.relationshipKey = "service-subscription.service-type"; - relationshipDataItem.relationshipValue = "MSO-dev-service-type"; + relationshipDataItem.setRelationshipKey("service-subscription.service-type"); + relationshipDataItem.setRelationshipValue("MSO-dev-service-type"); relationshipData.getRelationshipData().add(relationshipDataItem); - relationshipDataItem.relationshipKey = "service-instance.service-instance-id"; - relationshipDataItem.relationshipValue = "e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; + relationshipDataItem.setRelationshipKey("service-instance.service-instance-id"); + relationshipDataItem.setRelationshipValue("e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"); relationshipData.getRelationshipData().add(relationshipDataItem); RelatedToProperty relatedToProperty = new RelatedToProperty(); RelatedToPropertyItem item = new RelatedToPropertyItem(); - item.propertyKey = "service-instance.service-instance-name"; - item.propertyValue = "lll_svc_010317"; + item.setPropertyKey("service-instance.service-instance-name"); + item.setPropertyValue("lll_svc_010317"); relatedToProperty.getRelatedTo().add(item); - relationship.relatedTo = "service-instance"; - relationship.relatedLink = "/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; - relationship.relationshipData = relationshipData; - relationship.relatedToProperty = relatedToProperty; + relationship.setRelatedTo("service-instance"); + relationship.setRelatedLink("/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"); + relationship.setRelationshipData(relationshipData); + relationship.setRelatedToProperty(relatedToProperty); relationshipList.getRelationshipList().add(relationship); - response.relationshipList = relationshipList; + response.setRelationshipList(relationshipList); return response; } @@ -365,44 +365,44 @@ public class ControlLoopEventManagerTest { public static AAIGETVserverResponse getQueryByVserverName2(String urlGet, String username, String password, UUID requestID, String key) { AAIGETVserverResponse response = new AAIGETVserverResponse(); - response.vserverID = "d0668d4f-c25e-4a1b-87c4-83845c01efd8"; - response.vserverName = "USMSO1SX7NJ0103UJZZ01-vjunos0"; - response.vserverName2 = "vjunos0"; - response.vserverSelflink = "https://aai-ext1.test.att.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8"; - response.inMaint = "false"; - response.isClosedLoopDisabled = "false"; - response.resourceVersion = "1494001931513"; + response.setVserverID("d0668d4f-c25e-4a1b-87c4-83845c01efd8"); + response.setVserverName("USMSO1SX7NJ0103UJZZ01-vjunos0"); + response.setVserverName2("vjunos0"); + response.setVserverSelflink("https://aai-ext1.test.att.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8"); + response.setInMaint("false"); + response.setIsClosedLoopDisabled("false"); + response.setResourceVersion("1494001931513"); RelationshipList relationshipList = new RelationshipList(); Relationship relationship = new Relationship(); RelationshipData relationshipData = new RelationshipData(); RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.relationshipKey = "customer.global-customer-id"; - relationshipDataItem.relationshipValue = "MSO_1610_ST"; + relationshipDataItem.setRelationshipKey("customer.global-customer-id"); + relationshipDataItem.setRelationshipValue("MSO_1610_ST"); relationshipData.getRelationshipData().add(relationshipDataItem); - relationshipDataItem.relationshipKey = "service-subscription.service-type"; - relationshipDataItem.relationshipValue = "MSO-dev-service-type"; + relationshipDataItem.setRelationshipKey("service-subscription.service-type"); + relationshipDataItem.setRelationshipValue("MSO-dev-service-type"); relationshipData.getRelationshipData().add(relationshipDataItem); - relationshipDataItem.relationshipKey = "service-instance.service-instance-id"; - relationshipDataItem.relationshipValue = "e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; + relationshipDataItem.setRelationshipKey("service-instance.service-instance-id"); + relationshipDataItem.setRelationshipValue("e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"); relationshipData.getRelationshipData().add(relationshipDataItem); RelatedToProperty relatedToProperty = new RelatedToProperty(); RelatedToPropertyItem item = new RelatedToPropertyItem(); - item.propertyKey = "service-instance.service-instance-name"; - item.propertyValue = "lll_svc_010317"; + item.setPropertyKey("service-instance.service-instance-name"); + item.setPropertyValue("lll_svc_010317"); relatedToProperty.getRelatedTo().add(item); - relationship.relatedTo = "service-instance"; - relationship.relatedLink = "/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; - relationship.relationshipData = relationshipData; - relationship.relatedToProperty = relatedToProperty; + relationship.setRelatedTo("service-instance"); + relationship.setRelatedLink("/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"); + relationship.setRelationshipData(relationshipData); + relationship.setRelatedToProperty(relatedToProperty); relationshipList.getRelationshipList().add(relationship); - response.relationshipList = relationshipList; + response.setRelationshipList(relationshipList); return response; } diff --git a/controlloop/common/model-impl/aai/pom.xml b/controlloop/common/model-impl/aai/pom.xml index 61a56fa74..19341af8e 100644 --- a/controlloop/common/model-impl/aai/pom.xml +++ b/controlloop/common/model-impl/aai/pom.xml @@ -1,15 +1,15 @@ 4.0.0 - + aai - - + + org.onap.policy.drools-applications model-impl - 1.2.0-SNAPSHOT - - + 1.2.0-SNAPSHOT + + com.google.code.gson @@ -29,10 +29,22 @@ test - org.onap.policy.drools-pdp - policy-endpoints - ${project.version} - provided - + org.mockito + mockito-core + 2.13.0 + test + + + org.powermock + powermock-core + 1.7.3 + test + + + org.onap.policy.drools-pdp + policy-endpoints + ${project.version} + provided + diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponse.java index ac6e38deb..ef205cfea 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponse.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponse.java @@ -32,20 +32,69 @@ public class AAIGETResponse implements Serializable { private static final long serialVersionUID = 7311418432051756161L; @SerializedName("in-maint") - public String inMaint; + private String inMaint; @SerializedName("is-closed-loop-disabled") - public String isClosedLoopDisabled; + private String isClosedLoopDisabled; @SerializedName("model-invariant-id") - public String modelInvariantId; + private String modelInvariantId; @SerializedName("resource-version") - public String resourceVersion; + private String resourceVersion; @SerializedName("relationship-list") - public RelationshipList relationshipList; + private RelationshipList relationshipList; @SerializedName("requestError") - public AAINQRequestError requestError; + private AAINQRequestError requestError; + + public String getInMaint() { + return inMaint; + } + + public String getIsClosedLoopDisabled() { + return isClosedLoopDisabled; + } + + public String getModelInvariantId() { + return modelInvariantId; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public RelationshipList getRelationshipList() { + return relationshipList; + } + + public AAINQRequestError getRequestError() { + return requestError; + } + + public void setInMaint(String inMaint) { + this.inMaint = inMaint; + } + + public void setIsClosedLoopDisabled(String isClosedLoopDisabled) { + this.isClosedLoopDisabled = isClosedLoopDisabled; + } + + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + public void setRelationshipList(RelationshipList relationshipList) { + this.relationshipList = relationshipList; + } + + public void setRequestError(AAINQRequestError requestError) { + this.requestError = requestError; + } + } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVnfResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVnfResponse.java index c89083b18..a67963698 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVnfResponse.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVnfResponse.java @@ -26,23 +26,60 @@ import com.google.gson.annotations.SerializedName; public class AAIGETVnfResponse extends AAIGETResponse implements Serializable { - /** - * - */ private static final long serialVersionUID = -6247505944905898870L; @SerializedName("vnf-id") - public String vnfID; + private String vnfID; @SerializedName("vnf-name") - public String vnfName; + private String vnfName; @SerializedName("vnf-type") - public String vnfType; + private String vnfType; @SerializedName("service-id") - public String serviceId; + private String serviceId; @SerializedName("orchestration-status") - public String orchestrationStatus; + private String orchestrationStatus; + + public String getVnfID() { + return vnfID; + } + + public String getVnfName() { + return vnfName; + } + + public String getVnfType() { + return vnfType; + } + + public String getServiceId() { + return serviceId; + } + + public String getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setVnfID(String vnfID) { + this.vnfID = vnfID; + } + + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } + + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public void setOrchestrationStatus(String orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } } \ No newline at end of file diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java index 162df0d93..05dffc1dd 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java @@ -26,20 +26,49 @@ import com.google.gson.annotations.SerializedName; public class AAIGETVserverResponse extends AAIGETResponse implements Serializable { - /** - * - */ private static final long serialVersionUID = -6247505944905898870L; @SerializedName("vserver-id") - public String vserverID; + private String vserverID; @SerializedName("vserver-name") - public String vserverName; + private String vserverName; @SerializedName("vserver-name2") - public String vserverName2; + private String vserverName2; @SerializedName("vserver-selflink") - public String vserverSelflink; + private String vserverSelflink; + + public String getVserverID() { + return vserverID; + } + + public String getVserverName() { + return vserverName; + } + + public String getVserverName2() { + return vserverName2; + } + + public String getVserverSelflink() { + return vserverSelflink; + } + + public void setVserverID(String vserverID) { + this.vserverID = vserverID; + } + + public void setVserverName(String vserverName) { + this.vserverName = vserverName; + } + + public void setVserverName2(String vserverName2) { + this.vserverName2 = vserverName2; + } + + public void setVserverSelflink(String vserverSelflink) { + this.vserverSelflink = vserverSelflink; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java index 621398282..53d32b056 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java @@ -32,19 +32,44 @@ import org.slf4j.LoggerFactory; import com.google.gson.JsonSyntaxException; +/** + * This class handles communication towards and responses from A&AI for this module. + */ public final class AAIManager { + + /** The Constant LINE_SEPARATOR. */ private static final String LINE_SEPARATOR = System.lineSeparator(); + /** The Constant logger. */ + private static final Logger logger = LoggerFactory.getLogger(AAIManager.class); + + /** The Constant netLogger. */ + private static final Logger netLogger = LoggerFactory.getLogger(org.onap.policy.drools.event.comm.Topic.NETWORK_LOGGER); + + /** The rest manager. */ + // The REST manager used for processing REST calls for this AAI manager + private final RESTManager restManager; + /** - * Private constructor added to avoid instantiation of static class + * Constructor, create the AAI manager with the specified REST manager. + * + * @param restManager the rest manager to use for REST calls */ - private AAIManager() { + public AAIManager(final RESTManager restManager) { + this.restManager = restManager; } - private static final Logger logger = LoggerFactory.getLogger(AAIManager.class); - private static final Logger netLogger = LoggerFactory.getLogger(org.onap.policy.drools.event.comm.Topic.NETWORK_LOGGER); - - public static AAINQResponse postQuery(String url, String username, String password, AAINQRequest request, UUID requestID) { + /** + * Post a query to A&AI. + * + * @param url the A&AI URL + * @param username the user name for authentication + * @param password the password for authentication + * @param request the request to issue towards A&AI + * @param requestID the UUID of the request + * @return the response from A&AI + */ + public AAINQResponse postQuery(String url, String username, String password, AAINQRequest request, UUID requestID) { Map headers = createHeaders(requestID); @@ -53,7 +78,7 @@ public final class AAIManager { logger.debug("RESTManager.post before"); String requestJson = Serialization.gsonPretty.toJson(request); netLogger.info("[OUT|{}|{}|]{}{}", "AAI", url, LINE_SEPARATOR, requestJson); - Pair httpDetails = RESTManager.post(url, username, password, headers, "application/json", requestJson); + Pair httpDetails = restManager.post(url, username, password, headers, "application/json", requestJson); logger.debug("RESTManager.post after"); if (httpDetails == null) { @@ -62,78 +87,95 @@ public final class AAIManager { } int httpResponseCode = httpDetails.a; - + logger.info(url); logger.info("{}", httpResponseCode); logger.info(httpDetails.b); - + if (httpDetails.b != null) { return composeResponse(httpDetails, url, AAINQResponse.class); } return null; } - public static AAIGETVserverResponse getQueryByVserverName(String urlGet, String username, String password, UUID requestID, String key) { - - Map headers = createHeaders(requestID); - - urlGet = urlGet + key; - - int attemptsLeft = 3; - - while(attemptsLeft-- > 0){ - - netLogger.info("[OUT|{}|{}|]", "AAI", urlGet); - Pair httpDetailsGet = RESTManager.get(urlGet, username, password, headers); - if (httpDetailsGet == null) { - logger.info("AAI GET Null Response to {}", urlGet); - return null; - } - - int httpResponseCode = httpDetailsGet.a; - - logger.info(urlGet); - logger.info("{}", httpResponseCode); - logger.info(httpDetailsGet.b); + /** + * Perform a GET request for a particular virtual server towards A&AI. + * + * @param urlGet the A&AI URL + * @param username the user name for authentication + * @param password the password for authentication + * @param requestID the UUID of the request + * @param key the key of the virtual server + * @return the response for the virtual server from A&AI + */ + public AAIGETVserverResponse getQueryByVserverName(String urlGet, String username, String password, UUID requestID, String key) { + return getQuery(urlGet, username, password, requestID, key, AAIGETVserverResponse.class); + } - if (httpResponseCode == 200) { - AAIGETVserverResponse responseGet = composeResponse(httpDetailsGet, urlGet, AAIGETVserverResponse.class); - if (responseGet != null) { - return responseGet; - } - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { Thread.currentThread().interrupt(); } - } + /** + * Perform a GET request for a particular VNF by VNF ID towards A&AI. + * + * @param urlGet the A&AI URL + * @param username the user name for authentication + * @param password the password for authentication + * @param requestID the UUID of the request + * @param key the ID of the VNF + * @return the response for the virtual server from A&AI + */ + public AAIGETVnfResponse getQueryByVnfID(String urlGet, String username, String password, UUID requestID, String key) { + return getQuery(urlGet, username, password, requestID, key, AAIGETVnfResponse.class); + } - return null; + /** + * Perform a GET request for a particular VNF by VNF name towards A&AI. + * + * @param urlGet the A&AI URL + * @param username the user name for authentication + * @param password the password for authentication + * @param requestID the UUID of the request + * @param key the name of the VNF + * @return the response for the virtual server from A&AI + */ + public AAIGETVnfResponse getQueryByVnfName(String urlGet, String username, String password, UUID requestID, String key) { + return getQuery(urlGet, username, password, requestID, key, AAIGETVnfResponse.class); } - public static AAIGETVnfResponse getQueryByVnfID(String urlGet, String username, String password, UUID requestID, String key) { + /** + * Perform a GET query for a particular entity towards A&AI. + * + * @param the generic type for the response + * @param urlGet the A&AI URL + * @param username the user name for authentication + * @param password the password for authentication + * @param requestID the UUID of the request + * @param key the name of the VNF + * @param classOfT the class of the response to return + * @return the response for the virtual server from A&AI + */ + private T getQuery(final String url, final String username, final String password, final UUID requestID, final String key, final Class classOfResponse) { Map headers = createHeaders(requestID); - urlGet = urlGet + key; + String urlGet = url + key; int attemptsLeft = 3; while(attemptsLeft-- > 0){ netLogger.info("[OUT|{}|{}|]", "AAI", urlGet); - Pair httpDetailsGet = RESTManager.get(urlGet, username, password, headers); + Pair httpDetailsGet = restManager.get(urlGet, username, password, headers); if (httpDetailsGet == null) { logger.info("AAI GET Null Response to {}", urlGet); return null; } int httpResponseCode = httpDetailsGet.a; - + logger.info(urlGet); logger.info("{}", httpResponseCode); logger.info(httpDetailsGet.b); if (httpResponseCode == 200) { - AAIGETVnfResponse responseGet = composeResponse(httpDetailsGet, urlGet, AAIGETVnfResponse.class); + T responseGet = composeResponse(httpDetailsGet, urlGet, classOfResponse); if (responseGet != null) { return responseGet; } @@ -147,16 +189,13 @@ public final class AAIManager { return null; } - public static AAIGETVnfResponse getQueryByVnfName(String urlGet, String username, String password, UUID requestID, String key) { - return getQueryByVnfID(urlGet, username, password, requestID, key); - } - /** - * Create the headers for the HTTP request + * Create the headers for the HTTP request. + * * @param requestID the request ID to insert in the headers * @return the HTTP headers */ - private static Map createHeaders(final UUID requestID) { + private Map createHeaders(final UUID requestID) { Map headers = new HashMap<>(); headers.put("X-FromAppId", "POLICY"); @@ -167,16 +206,18 @@ public final class AAIManager { } /** - * This method uses Google's GSON to create a response object from a JSON string + * This method uses Google's GSON to create a response object from a JSON string. + * + * @param the generic type * @param httpDetails the HTTP response * @param url the URL from which the response came - * @param classOfT The response class + * @param classOfResponse The response class * @return an instance of the response class * @throws JsonSyntaxException on GSON errors instantiating the response */ - private static T composeResponse(final Pair httpDetails, final String url, final Class classOfT) { + private T composeResponse(final Pair httpDetails, final String url, final Class classOfResponse) { try { - T response = Serialization.gsonPretty.fromJson(httpDetails.b, classOfT); + T response = Serialization.gsonPretty.fromJson(httpDetails.b, classOfResponse); netLogger.info("[IN|{}|{}|]{}{}", "AAI", url, LINE_SEPARATOR, httpDetails.b); return response; } catch (JsonSyntaxException e) { diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQCloudRegion.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQCloudRegion.java index bfeb1e56c..e7a8f19c3 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQCloudRegion.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQCloudRegion.java @@ -26,23 +26,60 @@ import com.google.gson.annotations.SerializedName; public class AAINQCloudRegion implements Serializable { - /** - * - */ private static final long serialVersionUID = -897231529157222683L; @SerializedName("cloud-owner") - public String cloudOwner; + private String cloudOwner; @SerializedName("cloud-region-id") - public String cloudRegionId; + private String cloudRegionId; @SerializedName("cloud-region-version") - public String cloudRegionVersion; + private String cloudRegionVersion; @SerializedName("complex-name") - public String complexName; + private String complexName; @SerializedName("resource-version") - public String resourceVersion; + private String resourceVersion; + + public String getCloudOwner() { + return cloudOwner; + } + + public String getCloudRegionId() { + return cloudRegionId; + } + + public String getCloudRegionVersion() { + return cloudRegionVersion; + } + + public String getComplexName() { + return complexName; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } + + public void setCloudRegionId(String cloudRegionId) { + this.cloudRegionId = cloudRegionId; + } + + public void setCloudRegionVersion(String cloudRegionVersion) { + this.cloudRegionVersion = cloudRegionVersion; + } + + public void setComplexName(String complexName) { + this.complexName = complexName; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperties.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperties.java index b11859aeb..2322ef2f9 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperties.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperties.java @@ -27,10 +27,6 @@ import java.util.List; import com.google.gson.annotations.SerializedName; public class AAINQExtraProperties implements Serializable { - - /** - * - */ private static final long serialVersionUID = 4109625574744702319L; @SerializedName("extra-property") diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperty.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperty.java index 4a968c5e6..5761a543b 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperty.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperty.java @@ -26,16 +26,13 @@ import com.google.gson.annotations.SerializedName; public class AAINQExtraProperty implements Serializable { - /** - * - */ private static final long serialVersionUID = -3861240617222397736L; @SerializedName("property-name") - public String propertyName; + private String propertyName; @SerializedName("property-value") - public String propertyValue; + private String propertyValue; public AAINQExtraProperty() { } @@ -45,4 +42,19 @@ public class AAINQExtraProperty implements Serializable { this.propertyValue = propertyValue; } + public String getPropertyName() { + return propertyName; + } + + public String getPropertyValue() { + return propertyValue; + } + + public void setPropertyName(String propertyName) { + this.propertyName = propertyName; + } + + public void setPropertyValue(String propertyValue) { + this.propertyValue = propertyValue; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQGenericVNF.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQGenericVNF.java index 12b8fc42a..62903a083 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQGenericVNF.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQGenericVNF.java @@ -26,59 +26,192 @@ import com.google.gson.annotations.SerializedName; public class AAINQGenericVNF implements Serializable { - /** - * - */ private static final long serialVersionUID = 834322706248060559L; @SerializedName("vnf-id") - public String vnfID; + private String vnfID; @SerializedName("vnf-name") - public String vnfName; + private String vnfName; @SerializedName("vnf-name2") - public String vnfName2; + private String vnfName2; @SerializedName("vnf-type") - public String vnfType; + private String vnfType; @SerializedName("service-id") - public String serviceId; + private String serviceId; @SerializedName("prov-status") - public String provStatus; + private String provStatus; @SerializedName("operational-state") - public String operationalState; + private String operationalState; @SerializedName("ipv4-oam-address") - public String ipv4OamAddress; + private String ipv4OamAddress; @SerializedName("ipv4-loopback0-address") - public String ipv4Loopback0Address; + private String ipv4Loopback0Address; @SerializedName("in-maint") - public Boolean inMaint; + private Boolean inMaint; @SerializedName("is-closed-loop-disabled") - public Boolean isClosedLoopDisabled; + private Boolean isClosedLoopDisabled; @SerializedName("resource-version") - public String resourceVersion; + private String resourceVersion; @SerializedName("encrypted-access-flag") - public Boolean encrypedAccessFlag; + private Boolean encrypedAccessFlag; @SerializedName("persona-model-id") - public String personaModelId; + private String personaModelId; @SerializedName("persona-model-version") - public String personaModelVersion; + private String personaModelVersion; @SerializedName("model-invariant-id") - public String modelInvariantId; + private String modelInvariantId; @SerializedName("model-version-id") - public String modelVersionId; + private String modelVersionId; + + public String getVnfID() { + return vnfID; + } + + public String getVnfName() { + return vnfName; + } + + public String getVnfName2() { + return vnfName2; + } + + public String getVnfType() { + return vnfType; + } + + public String getServiceId() { + return serviceId; + } + + public String getProvStatus() { + return provStatus; + } + + public String getOperationalState() { + return operationalState; + } + + public String getIpv4OamAddress() { + return ipv4OamAddress; + } + + public String getIpv4Loopback0Address() { + return ipv4Loopback0Address; + } + + public Boolean getInMaint() { + return inMaint; + } + + public Boolean getIsClosedLoopDisabled() { + return isClosedLoopDisabled; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public Boolean getEncrypedAccessFlag() { + return encrypedAccessFlag; + } + + public String getPersonaModelId() { + return personaModelId; + } + + public String getPersonaModelVersion() { + return personaModelVersion; + } + + public String getModelInvariantId() { + return modelInvariantId; + } + + public String getModelVersionId() { + return modelVersionId; + } + + public void setVnfID(String vnfID) { + this.vnfID = vnfID; + } + + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } + + public void setVnfName2(String vnfName2) { + this.vnfName2 = vnfName2; + } + + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public void setProvStatus(String provStatus) { + this.provStatus = provStatus; + } + + public void setOperationalState(String operationalState) { + this.operationalState = operationalState; + } + + public void setIpv4OamAddress(String ipv4OamAddress) { + this.ipv4OamAddress = ipv4OamAddress; + } + + public void setIpv4Loopback0Address(String ipv4Loopback0Address) { + this.ipv4Loopback0Address = ipv4Loopback0Address; + } + + public void setInMaint(Boolean inMaint) { + this.inMaint = inMaint; + } + + public void setIsClosedLoopDisabled(Boolean isClosedLoopDisabled) { + this.isClosedLoopDisabled = isClosedLoopDisabled; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + public void setEncrypedAccessFlag(Boolean encrypedAccessFlag) { + this.encrypedAccessFlag = encrypedAccessFlag; + } + + public void setPersonaModelId(String personaModelId) { + this.personaModelId = personaModelId; + } + + public void setPersonaModelVersion(String personaModelVersion) { + this.personaModelVersion = personaModelVersion; + } + + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItem.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItem.java index b4f1767e4..e9a387eff 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItem.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItem.java @@ -26,35 +26,104 @@ import com.google.gson.annotations.SerializedName; public class AAINQInventoryResponseItem implements Serializable { - /** - * - */ private static final long serialVersionUID = 7142072567154675183L; @SerializedName("model-name") - public String modelName; + private String modelName; @SerializedName("vf-module") - public AAINQVfModule vfModule; + private AAINQVfModule vfModule; @SerializedName("service-instance") - public AAINQServiceInstance serviceInstance; + private AAINQServiceInstance serviceInstance; @SerializedName("vserver") - public AAINQVServer vserver; + private AAINQVServer vserver; @SerializedName("tenant") - public AAINQTenant tenant; + private AAINQTenant tenant; @SerializedName("cloud-region") - public AAINQCloudRegion cloudRegion; + private AAINQCloudRegion cloudRegion; @SerializedName("generic-vnf") - public AAINQGenericVNF genericVNF; + private AAINQGenericVNF genericVNF; @SerializedName("extra-properties") - public AAINQExtraProperties extraProperties; + private AAINQExtraProperties extraProperties; @SerializedName("inventory-response-items") - public AAINQInventoryResponseItems items; + private AAINQInventoryResponseItems items; + + public String getModelName() { + return modelName; + } + + public AAINQVfModule getVfModule() { + return vfModule; + } + + public AAINQServiceInstance getServiceInstance() { + return serviceInstance; + } + + public AAINQVServer getVserver() { + return vserver; + } + + public AAINQTenant getTenant() { + return tenant; + } + + public AAINQCloudRegion getCloudRegion() { + return cloudRegion; + } + + public AAINQGenericVNF getGenericVNF() { + return genericVNF; + } + + public AAINQExtraProperties getExtraProperties() { + return extraProperties; + } + + public AAINQInventoryResponseItems getItems() { + return items; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public void setVfModule(AAINQVfModule vfModule) { + this.vfModule = vfModule; + } + + public void setServiceInstance(AAINQServiceInstance serviceInstance) { + this.serviceInstance = serviceInstance; + } + + public void setVserver(AAINQVServer vserver) { + this.vserver = vserver; + } + + public void setTenant(AAINQTenant tenant) { + this.tenant = tenant; + } + + public void setCloudRegion(AAINQCloudRegion cloudRegion) { + this.cloudRegion = cloudRegion; + } + + public void setGenericVNF(AAINQGenericVNF genericVNF) { + this.genericVNF = genericVNF; + } + + public void setExtraProperties(AAINQExtraProperties extraProperties) { + this.extraProperties = extraProperties; + } + + public void setItems(AAINQInventoryResponseItems items) { + this.items = items; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItems.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItems.java index 8e9728ab3..e05bcccb4 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItems.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItems.java @@ -27,10 +27,6 @@ import java.util.List; import com.google.gson.annotations.SerializedName; public class AAINQInventoryResponseItems implements Serializable { - - /** - * - */ private static final long serialVersionUID = 7602807659381179004L; @SerializedName("inventory-response-item") diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQNamedQuery.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQNamedQuery.java index 423c98090..4dddbbe4a 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQNamedQuery.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQNamedQuery.java @@ -26,12 +26,16 @@ import java.util.UUID; import com.google.gson.annotations.SerializedName; public class AAINQNamedQuery implements Serializable { - - /** - * - */ private static final long serialVersionUID = -3277980060302645333L; @SerializedName("named-query-uuid") - public UUID namedQueryUUID; + private UUID namedQueryUUID; + + public UUID getNamedQueryUUID() { + return namedQueryUUID; + } + + public void setNamedQueryUUID(UUID namedQueryUUID) { + this.namedQueryUUID = namedQueryUUID; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQQueryParameters.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQQueryParameters.java index ddff71043..3843676aa 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQQueryParameters.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQQueryParameters.java @@ -25,12 +25,16 @@ import java.io.Serializable; import com.google.gson.annotations.SerializedName; public class AAINQQueryParameters implements Serializable { - - /** - * - */ private static final long serialVersionUID = -4291227193197126982L; @SerializedName("named-query") - public AAINQNamedQuery namedQuery; + private AAINQNamedQuery namedQuery; + + public AAINQNamedQuery getNamedQuery() { + return namedQuery; + } + + public void setNamedQuery(AAINQNamedQuery namedQuery) { + this.namedQuery = namedQuery; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequest.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequest.java index d8d600075..db7317168 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequest.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequest.java @@ -25,14 +25,27 @@ import java.io.Serializable; import com.google.gson.annotations.SerializedName; public class AAINQRequest implements Serializable { - - /** - * - */ private static final long serialVersionUID = -3283942659786236032L; @SerializedName("query-parameters") - public AAINQQueryParameters queryParameters; + private AAINQQueryParameters queryParameters; + @SerializedName("instance-filters") - public AAINQInstanceFilters instanceFilters; + private AAINQInstanceFilters instanceFilters; + + public AAINQQueryParameters getQueryParameters() { + return queryParameters; + } + + public AAINQInstanceFilters getInstanceFilters() { + return instanceFilters; + } + + public void setQueryParameters(AAINQQueryParameters queryParameters) { + this.queryParameters = queryParameters; + } + + public void setInstanceFilters(AAINQInstanceFilters instanceFilters) { + this.instanceFilters = instanceFilters; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequestError.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequestError.java index f2498fb6e..2ebf1c2e3 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequestError.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequestError.java @@ -25,9 +25,16 @@ import java.io.Serializable; import com.google.gson.annotations.SerializedName; public class AAINQRequestError implements Serializable { - private static final long serialVersionUID = -7742674155387022932L; @SerializedName("serviceException") - public AAINQServiceExcept serviceExcept; + private AAINQServiceExcept serviceExcept; + + public AAINQServiceExcept getServiceExcept() { + return serviceExcept; + } + + public void setServiceExcept(AAINQServiceExcept serviceExcept) { + this.serviceExcept = serviceExcept; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponse.java index 2e6776fc6..690e83eb3 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponse.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponse.java @@ -28,10 +28,6 @@ import com.google.gson.annotations.SerializedName; import org.onap.policy.aai.AAINQInventoryResponseItem; public class AAINQResponse implements Serializable { - - /** - * - */ private static final long serialVersionUID = 8411407444051746101L; @SerializedName("inventory-response-item") @@ -43,16 +39,4 @@ public class AAINQResponse implements Serializable { public List getInventoryResponseItems() { return inventoryResponseItems; } - - public void setInventoryResponseItems(List inventoryResponseItems) { - this.inventoryResponseItems = inventoryResponseItems; - } - - public AAINQRequestError getRequestError() { - return requestError; - } - - public void setRequestError(AAINQRequestError requestError) { - this.requestError = requestError; - } } \ No newline at end of file diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceExcept.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceExcept.java index acee98f04..12fb1a0c4 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceExcept.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceExcept.java @@ -25,15 +25,26 @@ import java.io.Serializable; import com.google.gson.annotations.SerializedName; public class AAINQServiceExcept implements Serializable { - private static final long serialVersionUID = 2858343404484338546L; @SerializedName("messageId") - public String messageId; + private String messageId; @SerializedName("text") - public String text; + private String text; @SerializedName("variables") - public String[] variables; + private String[] variables; + + public String getMessageId() { + return messageId; + } + + public String getText() { + return text; + } + + public String[] getVariables() { + return variables; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceInstance.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceInstance.java index 256a057a4..3ae366ea5 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceInstance.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceInstance.java @@ -25,33 +25,93 @@ import java.io.Serializable; import com.google.gson.annotations.SerializedName; public class AAINQServiceInstance implements Serializable { - - /** - * - */ private static final long serialVersionUID = -8000944396593889586L; @SerializedName("service-instance-id") - public String serviceInstanceID; + private String serviceInstanceID; @SerializedName("service-instance-name") - public String serviceInstanceName; + private String serviceInstanceName; @SerializedName("persona-model-id") - public String personaModelId; + private String personaModelId; @SerializedName("persona-model-version") - public String personaModelVersion; + private String personaModelVersion; @SerializedName("service-instance-location-id") - public String serviceInstanceLocationId; + private String serviceInstanceLocationId; @SerializedName("resource-version") - public String resourceVersion; + private String resourceVersion; @SerializedName("model-invariant-id") - public String modelInvariantId; + private String modelInvariantId; @SerializedName("model-version-id") - public String modelVersionId; + private String modelVersionId; + + public String getServiceInstanceID() { + return serviceInstanceID; + } + + public String getServiceInstanceName() { + return serviceInstanceName; + } + + public String getPersonaModelId() { + return personaModelId; + } + + public String getPersonaModelVersion() { + return personaModelVersion; + } + + public String getServiceInstanceLocationId() { + return serviceInstanceLocationId; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public String getModelInvariantId() { + return modelInvariantId; + } + + public String getModelVersionId() { + return modelVersionId; + } + + public void setServiceInstanceID(String serviceInstanceID) { + this.serviceInstanceID = serviceInstanceID; + } + + public void setServiceInstanceName(String serviceInstanceName) { + this.serviceInstanceName = serviceInstanceName; + } + + public void setPersonaModelId(String personaModelId) { + this.personaModelId = personaModelId; + } + + public void setPersonaModelVersion(String personaModelVersion) { + this.personaModelVersion = personaModelVersion; + } + + public void setServiceInstanceLocationId(String serviceInstanceLocationId) { + this.serviceInstanceLocationId = serviceInstanceLocationId; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQTenant.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQTenant.java index afd55fd45..a370b7ddb 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQTenant.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQTenant.java @@ -25,18 +25,40 @@ import java.io.Serializable; import com.google.gson.annotations.SerializedName; public class AAINQTenant implements Serializable { - - /** - * - */ private static final long serialVersionUID = 4702784101671984364L; @SerializedName("tenant-id") - public String tenantId; + private String tenantId; @SerializedName("tenant-name") - public String tenantName; + private String tenantName; @SerializedName("resource-version") - public String resourceVersion; + private String resourceVersion; + + public String getTenantId() { + return tenantId; + } + + public String getTenantName() { + return tenantName; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public void setTenantName(String tenantName) { + this.tenantName = tenantName; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVServer.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVServer.java index f6130e95b..180ac3680 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVServer.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVServer.java @@ -25,33 +25,95 @@ import java.io.Serializable; import com.google.gson.annotations.SerializedName; public class AAINQVServer implements Serializable { - - /** - * - */ private static final long serialVersionUID = -6718526692734215643L; @SerializedName("vserver-id") - public String vserverId; + private String vserverId; @SerializedName("vserver-name") - public String vserverName; + private String vserverName; @SerializedName("vserver-name2") - public String vserverName2; + private String vserverName2; @SerializedName("prov-status") - public String provStatus; + private String provStatus; @SerializedName("vserver-selflink") - public String vserverSelflink; + private String vserverSelflink; @SerializedName("in-maint") - public Boolean inMaint; + private Boolean inMaint; @SerializedName("is-closed-loop-disabled") - public Boolean isClosedLoopDisabled; + private Boolean isClosedLoopDisabled; @SerializedName("resource-version") - public String resourceVersion; + private String resourceVersion; + + public String getVserverId() { + return vserverId; + } + + public String getVserverName() { + return vserverName; + } + + public String getVserverName2() { + return vserverName2; + } + + public String getProvStatus() { + return provStatus; + } + + public String getVserverSelflink() { + return vserverSelflink; + } + + public Boolean getInMaint() { + return inMaint; + } + + public Boolean getIsClosedLoopDisabled() { + return isClosedLoopDisabled; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setVserverId(String vserverId) { + this.vserverId = vserverId; + } + + public void setVserverName(String vserverName) { + this.vserverName = vserverName; + } + + public void setVserverName2(String vserverName2) { + this.vserverName2 = vserverName2; + } + + public void setProvStatus(String provStatus) { + this.provStatus = provStatus; + } + + public void setVserverSelflink(String vserverSelflink) { + this.vserverSelflink = vserverSelflink; + } + + public void setInMaint(Boolean inMaint) { + this.inMaint = inMaint; + } + + public void setIsClosedLoopDisabled(Boolean isClosedLoopDisabled) { + this.isClosedLoopDisabled = isClosedLoopDisabled; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVfModule.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVfModule.java index b20681d7f..97c794f07 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVfModule.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVfModule.java @@ -25,48 +25,148 @@ import java.io.Serializable; import com.google.gson.annotations.SerializedName; public class AAINQVfModule implements Serializable { - - /** - * - */ private static final long serialVersionUID = 8019133081429638231L; @SerializedName("vf-module-id") - public String vfModuleId; + private String vfModuleId; @SerializedName("vf-module-name") - public String vfModuleName; + private String vfModuleName; @SerializedName("heat-stack-id") - public String heatStackId; + private String heatStackId; @SerializedName("orchestration-status") - public String orchestrationStatus; + private String orchestrationStatus; @SerializedName("is-base-vf-module") - public Boolean isBaseVfModule; + private Boolean isBaseVfModule; @SerializedName("resource-version") - public String resourceVersion; + private String resourceVersion; @SerializedName("persona-model-id") - public String personaModelId; + private String personaModelId; @SerializedName("persona-model-version") - public String personaModelVersion; + private String personaModelVersion; @SerializedName("widget-model-id") - public String widgetModelId; + private String widgetModelId; @SerializedName("widget-model-version") - public String widgetModelVersion; + private String widgetModelVersion; @SerializedName("contrail-service-instance-fqdn") - public String contrailServiceInstanceFqdn; + private String contrailServiceInstanceFqdn; @SerializedName("model-invariant-id") - public String modelInvariantId; + private String modelInvariantId; @SerializedName("model-version-id") - public String modelVersionId; + private String modelVersionId; + + public String getVfModuleId() { + return vfModuleId; + } + + public String getVfModuleName() { + return vfModuleName; + } + + public String getHeatStackId() { + return heatStackId; + } + + public String getOrchestrationStatus() { + return orchestrationStatus; + } + + public Boolean getIsBaseVfModule() { + return isBaseVfModule; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public String getPersonaModelId() { + return personaModelId; + } + + public String getPersonaModelVersion() { + return personaModelVersion; + } + + public String getWidgetModelId() { + return widgetModelId; + } + + public String getWidgetModelVersion() { + return widgetModelVersion; + } + + public String getContrailServiceInstanceFqdn() { + return contrailServiceInstanceFqdn; + } + + public String getModelInvariantId() { + return modelInvariantId; + } + + public String getModelVersionId() { + return modelVersionId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + public void setVfModuleName(String vfModuleName) { + this.vfModuleName = vfModuleName; + } + + public void setHeatStackId(String heatStackId) { + this.heatStackId = heatStackId; + } + + public void setOrchestrationStatus(String orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public void setIsBaseVfModule(Boolean isBaseVfModule) { + this.isBaseVfModule = isBaseVfModule; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + public void setPersonaModelId(String personaModelId) { + this.personaModelId = personaModelId; + } + + public void setPersonaModelVersion(String personaModelVersion) { + this.personaModelVersion = personaModelVersion; + } + + public void setWidgetModelId(String widgetModelId) { + this.widgetModelId = widgetModelId; + } + + public void setWidgetModelVersion(String widgetModelVersion) { + this.widgetModelVersion = widgetModelVersion; + } + + public void setContrailServiceInstanceFqdn(String contrailServiceInstanceFqdn) { + this.contrailServiceInstanceFqdn = contrailServiceInstanceFqdn; + } + + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNF.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNF.java index 56fb77362..934fb1edc 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNF.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNF.java @@ -23,10 +23,6 @@ package org.onap.policy.aai; import java.io.Serializable; public class PNF implements Serializable { - - /** - * - */ private static final long serialVersionUID = -3535108358668248501L; private String pnfName; diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNFType.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNFType.java index 996304926..5774b364f 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNFType.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNFType.java @@ -22,8 +22,7 @@ package org.onap.policy.aai; public enum PNFType { ENODEB("eNodeB"), - PSERVER("pserver") - ; + PSERVER("pserver"); private String type; @@ -34,7 +33,5 @@ public enum PNFType { @Override public String toString() { return this.type; - } - } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java index bb3a95f30..a55c04138 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java @@ -27,12 +27,9 @@ import java.util.List; import com.google.gson.annotations.SerializedName; public class RelatedToProperty implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 2088088164920423658L; - @SerializedName("related-to-property") + private static final long serialVersionUID = 2088088164920423658L; + + @SerializedName("related-to-property") private List relatedTo = new LinkedList<>(); public List getRelatedTo() { diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java index 24466d6dc..e23f45c11 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java @@ -25,14 +25,24 @@ import java.io.Serializable; import com.google.gson.annotations.SerializedName; public class RelatedToPropertyItem implements Serializable { - - /** - * - */ private static final long serialVersionUID = 5644372985092588637L; @SerializedName("property-key") - public String propertyKey; + private String propertyKey; @SerializedName("property-value") - public String propertyValue; + private String propertyValue; + + public String getPropertyKey() { + return propertyKey; + } + public String getPropertyValue() { + return propertyValue; + } + + public void setPropertyKey(String propertyKey) { + this.propertyKey = propertyKey; + } + public void setPropertyValue(String propertyValue) { + this.propertyValue = propertyValue; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java index 07169c9ec..ba5d596ea 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java @@ -25,20 +25,49 @@ import java.io.Serializable; import com.google.gson.annotations.SerializedName; public class Relationship implements Serializable { - - /** - * - */ private static final long serialVersionUID = -68508443869003054L; @SerializedName("related-to") - public String relatedTo; + private String relatedTo; + @SerializedName("related-link") - public String relatedLink; + private String relatedLink; @SerializedName("relationship-data") - public RelationshipData relationshipData = new RelationshipData(); + private RelationshipData relationshipData = new RelationshipData(); @SerializedName("related-to-property") - public RelatedToProperty relatedToProperty = new RelatedToProperty(); + private RelatedToProperty relatedToProperty = new RelatedToProperty(); + + public String getRelatedTo() { + return relatedTo; + } + + public String getRelatedLink() { + return relatedLink; + } + + public RelationshipData getRelationshipData() { + return relationshipData; + } + + public RelatedToProperty getRelatedToProperty() { + return relatedToProperty; + } + + public void setRelatedTo(String relatedTo) { + this.relatedTo = relatedTo; + } + + public void setRelatedLink(String relatedLink) { + this.relatedLink = relatedLink; + } + + public void setRelationshipData(RelationshipData relationshipData) { + this.relationshipData = relationshipData; + } + + public void setRelatedToProperty(RelatedToProperty relatedToProperty) { + this.relatedToProperty = relatedToProperty; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java index 08e41a912..be9e8bfda 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java @@ -27,10 +27,6 @@ import java.util.LinkedList; import com.google.gson.annotations.SerializedName; public class RelationshipData implements Serializable { - - /** - * - */ private static final long serialVersionUID = 6809180843309562121L; @SerializedName("relationship-data") private List relationshipDataList = new LinkedList<>(); diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java index 39efdcd4b..eb3a6c85b 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java @@ -25,14 +25,24 @@ import java.io.Serializable; import com.google.gson.annotations.SerializedName; public class RelationshipDataItem implements Serializable { - - /** - * - */ private static final long serialVersionUID = 550450041634939767L; @SerializedName("relationship-key") - public String relationshipKey; + private String relationshipKey; @SerializedName("relationship-value") - public String relationshipValue; + private String relationshipValue; + + public String getRelationshipKey() { + return relationshipKey; + } + public String getRelationshipValue() { + return relationshipValue; + } + + public void setRelationshipKey(String relationshipKey) { + this.relationshipKey = relationshipKey; + } + public void setRelationshipValue(String relationshipValue) { + this.relationshipValue = relationshipValue; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipItem.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipItem.java index 939950561..681574f47 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipItem.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipItem.java @@ -27,10 +27,6 @@ import java.util.LinkedList; import com.google.gson.annotations.SerializedName; public class RelationshipItem implements Serializable { - - /** - * - */ private static final long serialVersionUID = 1543404460741069628L; @SerializedName("related-to-property") diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java index 46e04c8fd..d181f131e 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java @@ -26,11 +26,8 @@ import java.util.List; import java.util.LinkedList; public class RelationshipList implements Serializable { - - /** - * - */ private static final long serialVersionUID = 6115655704973981989L; + @SerializedName("relationship-list") private List relationships = new LinkedList<>(); diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java index 534dd4791..b5de93ccb 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java @@ -20,7 +20,10 @@ package org.onap.policy.aai; +import static org.junit.Assert.*; + import org.junit.Test; + import org.onap.policy.aai.util.Serialization; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,46 +35,57 @@ public class AAIGETVnfResponseTest { public void test() { AAIGETVnfResponse response = new AAIGETVnfResponse(); - response.vnfID = "83f674e8-7555-44d7-9a39-bdc3770b0491"; - response.vnfName = "lll_vnf_010317"; - response.vnfType = "Basa-122216-Service/VidVsamp12BaseVolume 1"; - response.serviceId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"; - response.orchestrationStatus = "Created"; - response.inMaint = "false"; - response.isClosedLoopDisabled = "false"; - response.resourceVersion = "1494001988835"; - response.modelInvariantId = "f18be3cd-d446-456e-9109-121d9b62feaa"; + response.setVnfID("83f674e8-7555-44d7-9a39-bdc3770b0491"); + response.setVnfName("lll_vnf_010317"); + response.setVnfType("Basa-122216-Service/VidVsamp12BaseVolume 1"); + response.setServiceId("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + response.setOrchestrationStatus("Created"); + response.setInMaint("false"); + response.setIsClosedLoopDisabled("false"); + response.setResourceVersion("1494001988835"); + response.setModelInvariantId("f18be3cd-d446-456e-9109-121d9b62feaa"); + assertEquals(response.getVnfID(), "83f674e8-7555-44d7-9a39-bdc3770b0491"); + assertEquals(response.getVnfName(), "lll_vnf_010317"); + assertEquals(response.getVnfType(), "Basa-122216-Service/VidVsamp12BaseVolume 1"); + assertEquals(response.getServiceId(), "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + assertEquals(response.getOrchestrationStatus(), "Created"); + assertEquals(response.getInMaint(), "false"); + assertEquals(response.getIsClosedLoopDisabled(), "false"); + assertEquals(response.getResourceVersion(), "1494001988835"); + assertEquals(response.getModelInvariantId(), "f18be3cd-d446-456e-9109-121d9b62feaa"); RelationshipList relationshipList = new RelationshipList(); Relationship relationship = new Relationship(); RelationshipData relationshipData = new RelationshipData(); RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.relationshipKey = "customer.global-customer-id"; - relationshipDataItem.relationshipValue = "MSO_1610_ST"; + relationshipDataItem.setRelationshipKey("customer.global-customer-id"); + relationshipDataItem.setRelationshipValue("MSO_1610_ST"); relationshipData.getRelationshipData().add(relationshipDataItem); - relationshipDataItem.relationshipKey = "service-subscription.service-type"; - relationshipDataItem.relationshipValue = "MSO-dev-service-type"; + relationshipDataItem.setRelationshipKey("service-subscription.service-type"); + relationshipDataItem.setRelationshipValue("MSO-dev-service-type"); relationshipData.getRelationshipData().add(relationshipDataItem); - relationshipDataItem.relationshipKey = "service-instance.service-instance-id"; - relationshipDataItem.relationshipValue = "e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; + relationshipDataItem.setRelationshipKey("service-instance.service-instance-id"); + relationshipDataItem.setRelationshipValue("e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"); relationshipData.getRelationshipData().add(relationshipDataItem); RelatedToProperty relatedToProperty = new RelatedToProperty(); RelatedToPropertyItem item = new RelatedToPropertyItem(); - item.propertyKey = "service-instance.service-instance-name"; - item.propertyValue = "lll_svc_010317"; + item.setPropertyKey("service-instance.service-instance-name"); + item.setPropertyValue("lll_svc_010317"); relatedToProperty.getRelatedTo().add(item); + assertEquals(item.getPropertyKey(), "service-instance.service-instance-name"); + assertEquals(item.getPropertyValue(), "lll_svc_010317"); - relationship.relatedTo = "service-instance"; - relationship.relatedLink = "/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; - relationship.relationshipData = relationshipData; - relationship.relatedToProperty = relatedToProperty; + relationship.setRelatedTo("service-instance"); + relationship.setRelatedLink("/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"); + relationship.setRelationshipData(relationshipData); + relationship.setRelatedToProperty(relatedToProperty); relationshipList.getRelationshipList().add(relationship); - response.relationshipList = relationshipList; + response.setRelationshipList(relationshipList); logger.info(Serialization.gsonPretty.toJson(response)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java index 1221557dd..7cf0696b5 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java @@ -20,6 +20,9 @@ package org.onap.policy.aai; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + import org.junit.Test; import org.onap.policy.aai.util.Serialization; import org.slf4j.Logger; @@ -32,44 +35,55 @@ public class AAIGETVserverResponseTest { public void test() { AAIGETVserverResponse response = new AAIGETVserverResponse(); - response.vserverID = "d0668d4f-c25e-4a1b-87c4-83845c01efd8"; - response.vserverName = "USMSO1SX7NJ0103UJZZ01-vjunos0"; - response.vserverName2 = "vjunos0"; - response.vserverSelflink = "https://aai-ext1.test.aaa.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/aaa-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8"; - response.inMaint = "false"; - response.isClosedLoopDisabled = "false"; - response.resourceVersion = "1494001931513"; + response.setVserverID("d0668d4f-c25e-4a1b-87c4-83845c01efd8"); + response.setVserverName("USMSO1SX7NJ0103UJZZ01-vjunos0"); + response.setVserverName2("vjunos0"); + response.setVserverSelflink("https://aai-ext1.test.aaa.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/aaa-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8"); + response.setInMaint("false"); + response.setIsClosedLoopDisabled("false"); + response.setResourceVersion("1494001931513"); - RelationshipList relationshipList = new RelationshipList(); + assertEquals(response.getVserverID(), "d0668d4f-c25e-4a1b-87c4-83845c01efd8"); + assertEquals(response.getVserverName(), "USMSO1SX7NJ0103UJZZ01-vjunos0"); + assertEquals(response.getVserverName2(), "vjunos0"); + assertEquals(response.getVserverSelflink(), "https://aai-ext1.test.aaa.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/aaa-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8"); + assertEquals(response.getInMaint(), "false"); + assertEquals(response.getIsClosedLoopDisabled(), "false"); + assertEquals(response.getResourceVersion(), "1494001931513"); + + RelationshipList relationshipList = new RelationshipList(); Relationship relationship = new Relationship(); RelationshipData relationshipData = new RelationshipData(); RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.relationshipKey = "customer.global-customer-id"; - relationshipDataItem.relationshipValue = "MSO_1610_ST"; + relationshipDataItem.setRelationshipKey("customer.global-customer-id"); + relationshipDataItem.setRelationshipValue("MSO_1610_ST"); relationshipData.getRelationshipData().add(relationshipDataItem); - relationshipDataItem.relationshipKey = "service-subscription.service-type"; - relationshipDataItem.relationshipValue = "MSO-dev-service-type"; + relationshipDataItem.setRelationshipKey("service-subscription.service-type"); + relationshipDataItem.setRelationshipValue("MSO-dev-service-type"); relationshipData.getRelationshipData().add(relationshipDataItem); - relationshipDataItem.relationshipKey = "service-instance.service-instance-id"; - relationshipDataItem.relationshipValue = "e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; + relationshipDataItem.setRelationshipKey("service-instance.service-instance-id"); + relationshipDataItem.setRelationshipValue("e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"); relationshipData.getRelationshipData().add(relationshipDataItem); RelatedToProperty relatedToProperty = new RelatedToProperty(); RelatedToPropertyItem item = new RelatedToPropertyItem(); - item.propertyKey = "service-instance.service-instance-name"; - item.propertyValue = "lll_svc_010317"; + item.setPropertyKey("service-instance.service-instance-name"); + item.setPropertyValue("lll_svc_010317"); relatedToProperty.getRelatedTo().add(item); - relationship.relatedTo = "service-instance"; - relationship.relatedLink = "/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; - relationship.relationshipData = relationshipData; - relationship.relatedToProperty = relatedToProperty; + relationship.setRelatedTo("service-instance"); + relationship.setRelatedLink("/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"); + relationship.setRelationshipData(relationshipData); + relationship.setRelatedToProperty(relatedToProperty); relationshipList.getRelationshipList().add(relationship); - response.relationshipList = relationshipList; + response.setRelationshipList(relationshipList); + assertEquals(response.getRelationshipList(), relationshipList); + response.setRequestError(null); + assertNull(response.getRequestError()); logger.info(Serialization.gsonPretty.toJson(response)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIManagerTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIManagerTest.java new file mode 100644 index 000000000..5e1351d13 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIManagerTest.java @@ -0,0 +1,142 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.policy.aai; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.onap.policy.rest.RESTManager; +import org.onap.policy.rest.RESTManager.Pair; + +public class AAIManagerTest { + RESTManager restManagerMock; + UUID aaiNQRequestUUID = UUID.randomUUID(); + Pair httpResponseOK; + Pair httpResponseErr0; + Pair httpResponseErr1; + Pair httpResponseWait; + + @Before + public void beforeTestAAIManager() { + restManagerMock = mock(RESTManager.class); + + Map expectedHeaders = new HashMap<>(); + expectedHeaders.put("X-FromAppId", "POLICY"); + expectedHeaders.put("X-TransactionId", aaiNQRequestUUID.toString()); + expectedHeaders.put("Accept", "application/json"); + + AAINQResponse aaiNQResponse = new AAINQResponseTest().getAAINQResponse(); + httpResponseOK = restManagerMock.new Pair<>(200, Serialization.gsonPretty.toJson(aaiNQResponse)); + httpResponseErr0 = restManagerMock.new Pair<>(200, null); + httpResponseErr1 = restManagerMock.new Pair<>(200, "{"); + httpResponseWait = restManagerMock.new Pair<>(503, null); + } + + @Test + public void testAAIManagerAAINQRequest() { + + AAIManager aaiManager = new AAIManager(restManagerMock); + assertNotNull(aaiManager); + + UUID aaiNQUUID = UUID.randomUUID(); + + AAINQQueryParameters aaiNQQueryParameters = new AAINQQueryParameters(); + AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery(); + aaiNQNamedQuery.setNamedQueryUUID(aaiNQUUID); + aaiNQQueryParameters.setNamedQuery(aaiNQNamedQuery); + + AAINQRequest aaiNQRequest = new AAINQRequest(); + aaiNQRequest.setQueryParameters(aaiNQQueryParameters); + + when(restManagerMock.post(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Gale"), anyMap(), anyString(), anyString())).thenReturn(httpResponseOK); + + AAINQResponse aaiNQOKResponse = aaiManager.postQuery("http://somewhere.over.the.rainbow", "Dorothy", "Gale", aaiNQRequest, aaiNQRequestUUID); + assertNotNull(aaiNQOKResponse); + + when(restManagerMock.post(isNull(), eq("Dorothy"), anyString(), anyMap(), anyString(), anyString())).thenReturn(null); + + AAINQResponse aaiNQNullResponse = aaiManager.postQuery(null, "Dorothy", "Gale", null, aaiNQRequestUUID); + assertNull(aaiNQNullResponse); + + when(restManagerMock.post(startsWith("http://somewhere.over.the.rainbow"), eq("Witch"), eq("West"), anyMap(), anyString(), anyString())).thenReturn(httpResponseErr0); + + AAINQResponse aaiNQNOKResponse0 = aaiManager.postQuery("http://somewhere.over.the.rainbow", "Witch", "West", aaiNQRequest, aaiNQRequestUUID); + assertNull(aaiNQNOKResponse0); + + when(restManagerMock.post(startsWith("http://somewhere.under.the.rainbow"), eq("Witch"), eq("West"), anyMap(), anyString(), anyString())).thenReturn(httpResponseErr1); + + AAINQResponse aaiNQNOKResponse1 = aaiManager.postQuery("http://somewhere.under.the.rainbow", "Witch", "West", aaiNQRequest, aaiNQRequestUUID); + assertNull(aaiNQNOKResponse1); + } + + @Test + public void testAAIManagerQueryByVserverName() { + AAIManager aaiManager = new AAIManager(restManagerMock); + assertNotNull(aaiManager); + + UUID vserverNameRequestId = UUID.randomUUID(); + + when(restManagerMock.get(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Gale"), anyMap())).thenReturn(httpResponseOK); + + AAIGETVserverResponse vserverResponse = aaiManager.getQueryByVserverName("http://somewhere.over.the.rainbow", "Dorothy", "Gale", vserverNameRequestId, "vserverName"); + assertNotNull(vserverResponse); + + AAIGETVserverResponse vserverNullResponse = aaiManager.getQueryByVserverName(null, "Dorothy", "Gale", vserverNameRequestId, "vserverName"); + assertNull(vserverNullResponse); + + when(restManagerMock.get(startsWith("http://somewhere.under.the.rainbow"), eq("Witch"), eq("West"), anyMap())).thenReturn(httpResponseErr0); + + AAIGETVserverResponse vserverNOKResponse0 = aaiManager.getQueryByVserverName("http://somewhere.under.the.rainbow", "Witch", "West", vserverNameRequestId, "vserverName"); + assertNull(vserverNOKResponse0); + } + + @Test + public void testAAIManagerQueryByVNFId() { + AAIManager aaiManager = new AAIManager(restManagerMock); + assertNotNull(aaiManager); + + UUID vserverNameRequestId = UUID.randomUUID(); + + when(restManagerMock.get(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Gale"), anyMap())).thenReturn(httpResponseOK); + + AAIGETVnfResponse vnfResponse = aaiManager.getQueryByVnfID("http://somewhere.over.the.rainbow", "Dorothy", "Gale", vserverNameRequestId, "vnfID"); + assertNotNull(vnfResponse); + } + + @Test + public void testAAIManagerQueryByVNFName() { + AAIManager aaiManager = new AAIManager(restManagerMock); + assertNotNull(aaiManager); + + UUID vserverNameRequestId = UUID.randomUUID(); + + when(restManagerMock.get(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Gale"), anyMap())).thenReturn(httpResponseOK); + + AAIGETVnfResponse vnfResponse = aaiManager.getQueryByVnfID("http://somewhere.over.the.rainbow", "Dorothy", "Gale", vserverNameRequestId, "vnfName"); + assertNotNull(vnfResponse); + } +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQCloudRegionTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQCloudRegionTest.java index 4c04aa41d..f5c594088 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQCloudRegionTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQCloudRegionTest.java @@ -38,11 +38,16 @@ public class AAINQCloudRegionTest { @Test public void test() { AAINQCloudRegion aaiNQCloudRegion = new AAINQCloudRegion(); - aaiNQCloudRegion.cloudOwner = "Rackspace"; - aaiNQCloudRegion.cloudRegionId = "DFW"; - aaiNQCloudRegion.cloudRegionVersion = "v1"; - aaiNQCloudRegion.complexName = "SharedNode"; - aaiNQCloudRegion.resourceVersion = "1504789196021"; + aaiNQCloudRegion.setCloudOwner("Rackspace"); + aaiNQCloudRegion.setCloudRegionId("DFW"); + aaiNQCloudRegion.setCloudRegionVersion("v1"); + aaiNQCloudRegion.setComplexName("SharedNode"); + aaiNQCloudRegion.setResourceVersion("1504789196021"); assertNotNull(aaiNQCloudRegion); + assertEquals(aaiNQCloudRegion.getCloudOwner(), "Rackspace"); + assertEquals(aaiNQCloudRegion.getCloudRegionId(), "DFW"); + assertEquals(aaiNQCloudRegion.getCloudRegionVersion(), "v1"); + assertEquals(aaiNQCloudRegion.getComplexName(), "SharedNode"); + assertEquals(aaiNQCloudRegion.getResourceVersion(), "1504789196021"); } } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertyTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertyTest.java index f193a8de7..2b6dc7452 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertyTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertyTest.java @@ -38,9 +38,11 @@ public class AAINQExtraPropertyTest { @Test public void test() { AAINQExtraProperty aaiNQExtraProperty = new AAINQExtraProperty(); - aaiNQExtraProperty.propertyName = "model.model-name"; - aaiNQExtraProperty.propertyValue= "service-instance"; + aaiNQExtraProperty.setPropertyName("model.model-name"); + aaiNQExtraProperty.setPropertyValue("service-instance"); assertNotNull(aaiNQExtraProperty); - } + assertEquals(aaiNQExtraProperty.getPropertyName(), "model.model-name"); + assertEquals(aaiNQExtraProperty.getPropertyValue(), "service-instance"); + } } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQGenericVNFTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQGenericVNFTest.java index c99c80e6d..7bd7d0270 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQGenericVNFTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQGenericVNFTest.java @@ -38,24 +38,42 @@ public class AAINQGenericVNFTest { @Test public void test() { AAINQGenericVNF aaiNQGenericVNF = new AAINQGenericVNF(); - aaiNQGenericVNF.encrypedAccessFlag = true; - aaiNQGenericVNF.inMaint = false; - aaiNQGenericVNF.ipv4Loopback0Address = "aa"; - aaiNQGenericVNF.ipv4OamAddress = "oamAddress"; - aaiNQGenericVNF.isClosedLoopDisabled = false; - aaiNQGenericVNF.modelInvariantId = "653d2caa-7e47-4614-95b3-26c8d82755b8"; - aaiNQGenericVNF.modelVersionId = "98f410f6-4c63-447b-97d2-42508437cec0"; - aaiNQGenericVNF.operationalState = "active"; - aaiNQGenericVNF.personaModelId = "653d2caa-7e47-4614-95b3-26c8d82755b8"; - aaiNQGenericVNF.personaModelVersion = "98f410f6-4c63-447b-97d2-42508437cec0"; - aaiNQGenericVNF.provStatus = "complete"; - aaiNQGenericVNF.resourceVersion = "1505056714553"; - aaiNQGenericVNF.serviceId = "e8cb8968-5411-478b-906a-f28747de72cd"; - aaiNQGenericVNF.vnfID = "ed8b2bce-6b27-4089-992c-4a2c66024bcd"; - aaiNQGenericVNF.vnfName = "vCPEInfraVNF14a"; - aaiNQGenericVNF.vnfName2 = "malumabb12"; - aaiNQGenericVNF.vnfType = "vCPEInfraService10/vCPEInfraService10 0"; + aaiNQGenericVNF.setEncrypedAccessFlag(true); + aaiNQGenericVNF.setInMaint(false); + aaiNQGenericVNF.setIpv4Loopback0Address("aa"); + aaiNQGenericVNF.setIpv4OamAddress("oamAddress"); + aaiNQGenericVNF.setIsClosedLoopDisabled(false); + aaiNQGenericVNF.setModelInvariantId("653d2caa-7e47-4614-95b3-26c8d82755b8"); + aaiNQGenericVNF.setModelVersionId("98f410f6-4c63-447b-97d2-42508437cec0"); + aaiNQGenericVNF.setOperationalState("active"); + aaiNQGenericVNF.setPersonaModelId("653d2caa-7e47-4614-95b3-26c8d82755b8"); + aaiNQGenericVNF.setPersonaModelVersion("98f410f6-4c63-447b-97d2-42508437cec0"); + aaiNQGenericVNF.setProvStatus("complete"); + aaiNQGenericVNF.setResourceVersion("1505056714553"); + aaiNQGenericVNF.setServiceId("e8cb8968-5411-478b-906a-f28747de72cd"); + aaiNQGenericVNF.setVnfID("ed8b2bce-6b27-4089-992c-4a2c66024bcd"); + aaiNQGenericVNF.setVnfName("vCPEInfraVNF14a"); + aaiNQGenericVNF.setVnfName2("malumabb12"); + aaiNQGenericVNF.setVnfType("vCPEInfraService10/vCPEInfraService10 0"); assertNotNull(aaiNQGenericVNF); + + assertEquals(aaiNQGenericVNF.getEncrypedAccessFlag(), true); + assertEquals(aaiNQGenericVNF.getInMaint(), false); + assertEquals(aaiNQGenericVNF.getIpv4Loopback0Address(), "aa"); + assertEquals(aaiNQGenericVNF.getIpv4OamAddress(), "oamAddress"); + assertEquals(aaiNQGenericVNF.getIsClosedLoopDisabled(), false); + assertEquals(aaiNQGenericVNF.getModelInvariantId(), "653d2caa-7e47-4614-95b3-26c8d82755b8"); + assertEquals(aaiNQGenericVNF.getModelVersionId(), "98f410f6-4c63-447b-97d2-42508437cec0"); + assertEquals(aaiNQGenericVNF.getOperationalState(), "active"); + assertEquals(aaiNQGenericVNF.getPersonaModelId(), "653d2caa-7e47-4614-95b3-26c8d82755b8"); + assertEquals(aaiNQGenericVNF.getPersonaModelVersion(), "98f410f6-4c63-447b-97d2-42508437cec0"); + assertEquals(aaiNQGenericVNF.getProvStatus(), "complete"); + assertEquals(aaiNQGenericVNF.getResourceVersion(), "1505056714553"); + assertEquals(aaiNQGenericVNF.getServiceId(), "e8cb8968-5411-478b-906a-f28747de72cd"); + assertEquals(aaiNQGenericVNF.getVnfID(), "ed8b2bce-6b27-4089-992c-4a2c66024bcd"); + assertEquals(aaiNQGenericVNF.getVnfName(), "vCPEInfraVNF14a"); + assertEquals(aaiNQGenericVNF.getVnfName2(), "malumabb12"); + assertEquals(aaiNQGenericVNF.getVnfType(), "vCPEInfraService10/vCPEInfraService10 0"); } } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInstanceFiltersTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInstanceFiltersTest.java index 0ca5326e3..f3bceaa16 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInstanceFiltersTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInstanceFiltersTest.java @@ -39,6 +39,10 @@ public class AAINQInstanceFiltersTest { public void test() { AAINQInstanceFilters aaiNQInstanceFilters = new AAINQInstanceFilters(); assertNotNull(aaiNQInstanceFilters); + + aaiNQInstanceFilters.setInstanceFilter(aaiNQInstanceFilters.getInstanceFilter());; + assertNotNull(aaiNQInstanceFilters); + assertNotNull(aaiNQInstanceFilters.getInstanceFilter()); } } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemTest.java index 9dd686409..71f8cef60 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemTest.java @@ -43,14 +43,14 @@ public class AAINQInventoryResponseItemTest { @Test public void test() { AAINQInventoryResponseItem aaiNQInventoryResponseItem = new AAINQInventoryResponseItem(); - aaiNQInventoryResponseItem.modelName = "service-instance"; + aaiNQInventoryResponseItem.setModelName("service-instance"); AAINQCloudRegion aaiNQCloudRegion = new AAINQCloudRegion(); - aaiNQCloudRegion.cloudOwner = "OWNER"; - aaiNQCloudRegion.cloudRegionId = "REGIONID"; - aaiNQCloudRegion.cloudRegionVersion = "2.5"; - aaiNQCloudRegion.complexName = "COMPLEXNAME"; - aaiNQCloudRegion.resourceVersion = "1485365988"; - aaiNQInventoryResponseItem.cloudRegion = aaiNQCloudRegion; + aaiNQCloudRegion.setCloudOwner("OWNER"); + aaiNQCloudRegion.setCloudRegionId("REGIONID"); + aaiNQCloudRegion.setCloudRegionVersion("2.5"); + aaiNQCloudRegion.setComplexName("COMPLEXNAME"); + aaiNQCloudRegion.setResourceVersion("1485365988"); + aaiNQInventoryResponseItem.setCloudRegion(aaiNQCloudRegion); AAINQExtraProperties aaiNQExtraProperties = new AAINQExtraProperties(); aaiNQExtraProperties.setExtraProperty(new LinkedList<>()); aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf")); @@ -58,102 +58,102 @@ public class AAINQInventoryResponseItemTest { aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); - aaiNQInventoryResponseItem.extraProperties = aaiNQExtraProperties; + aaiNQInventoryResponseItem.setExtraProperties(aaiNQExtraProperties); AAINQGenericVNF aaiNQGenericVNF = new AAINQGenericVNF(); - aaiNQGenericVNF.vnfID = "dhv-test-gvnf"; - aaiNQGenericVNF.vnfName = "dhv-test-gvnf-name"; - aaiNQGenericVNF.vnfName2 = "dhv-test-gvnf-name2"; - aaiNQGenericVNF.vnfType = "SW"; - aaiNQGenericVNF.serviceId = "d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"; - aaiNQGenericVNF.provStatus = "PREPROV"; - aaiNQGenericVNF.operationalState = "dhv-test-operational-state"; - aaiNQGenericVNF.ipv4OamAddress = "dhv-test-gvnf-ipv4-oam-address"; - aaiNQGenericVNF.ipv4Loopback0Address = "dhv-test-gvnfipv4-loopback0-address"; - aaiNQGenericVNF.inMaint = false; - aaiNQGenericVNF.isClosedLoopDisabled = false; - aaiNQGenericVNF.resourceVersion = "1485366450"; - aaiNQGenericVNF.encrypedAccessFlag = true; - aaiNQGenericVNF.personaModelId = "acc6edd8-a8d4-4b93-afaa-0994068be14c"; - aaiNQGenericVNF.personaModelVersion = "1.0"; - aaiNQInventoryResponseItem.genericVNF = aaiNQGenericVNF; + aaiNQGenericVNF.setVnfID("dhv-test-gvnf"); + aaiNQGenericVNF.setVnfName("dhv-test-gvnf-name"); + aaiNQGenericVNF.setVnfName2("dhv-test-gvnf-name2"); + aaiNQGenericVNF.setVnfType("SW"); + aaiNQGenericVNF.setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"); + aaiNQGenericVNF.setProvStatus("PREPROV"); + aaiNQGenericVNF.setOperationalState("dhv-test-operational-state"); + aaiNQGenericVNF.setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address"); + aaiNQGenericVNF.setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address"); + aaiNQGenericVNF.setInMaint(false); + aaiNQGenericVNF.setIsClosedLoopDisabled(false); + aaiNQGenericVNF.setResourceVersion("1485366450"); + aaiNQGenericVNF.setEncrypedAccessFlag(true); + aaiNQGenericVNF.setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c"); + aaiNQGenericVNF.setPersonaModelVersion("1.0"); + aaiNQInventoryResponseItem.setGenericVNF(aaiNQGenericVNF); AAINQInventoryResponseItems aaiNQInventoryResponseItems = new AAINQInventoryResponseItems(); AAINQInventoryResponseItem serviceItem = new AAINQInventoryResponseItem(); - serviceItem.modelName = "service-instance"; - serviceItem.serviceInstance = new AAINQServiceInstance(); - serviceItem.serviceInstance.serviceInstanceID = "dhv-test-vhnfportal-service-instance-id"; - serviceItem.serviceInstance.serviceInstanceName = "dhv-test-service-instance-name1"; - serviceItem.serviceInstance.personaModelId = "82194af1-3c2c-485a-8f44-420e22a9eaa4"; - serviceItem.serviceInstance.personaModelVersion = "1.0"; - serviceItem.serviceInstance.serviceInstanceLocationId = "dhv-test-service-instance-location-id1"; - serviceItem.serviceInstance.resourceVersion = "1485366092"; - serviceItem.extraProperties = new AAINQExtraProperties(); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); + serviceItem.setModelName("service-instance"); + serviceItem.setServiceInstance(new AAINQServiceInstance()); + serviceItem.getServiceInstance().setServiceInstanceID("dhv-test-vhnfportal-service-instance-id"); + serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1"); + serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4"); + serviceItem.getServiceInstance().setPersonaModelVersion("1.0"); + serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); + serviceItem.getServiceInstance().setResourceVersion("1485366092"); + serviceItem.setExtraProperties(new AAINQExtraProperties()); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); AAINQInventoryResponseItem vfModuleItem = new AAINQInventoryResponseItem(); - vfModuleItem.modelName = "vf-module"; - vfModuleItem.vfModule = new AAINQVfModule(); - vfModuleItem.vfModule.vfModuleId = "example-vf-module-id-val-49261"; - vfModuleItem.vfModule.vfModuleName = "example-vf-module-name-val-73074"; - vfModuleItem.vfModule.heatStackId = "example-heat-stack-id-val-86300"; - vfModuleItem.vfModule.orchestrationStatus = "example-orchestration-status-val-56523"; - vfModuleItem.vfModule.isBaseVfModule = true; - vfModuleItem.vfModule.resourceVersion = "1485366450"; - vfModuleItem.vfModule.personaModelId = "ef86f9c5-2165-44f3-8fc3-96018b609ea5"; - vfModuleItem.vfModule.personaModelVersion = "1.0"; - vfModuleItem.vfModule.widgetModelId = "example-widget-model-id-val-92571"; - vfModuleItem.vfModule.widgetModelVersion = "example-widget-model-version-val-83317"; - vfModuleItem.vfModule.contrailServiceInstanceFqdn = "example-contrail-service-instance-fqdn-val-86796"; - vfModuleItem.extraProperties = new AAINQExtraProperties(); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a")); + vfModuleItem.setModelName("vf-module"); + vfModuleItem.setVfModule(new AAINQVfModule()); + vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261"); + vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074"); + vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300"); + vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523"); + vfModuleItem.getVfModule().setIsBaseVfModule(true); + vfModuleItem.getVfModule().setResourceVersion("1485366450"); + vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5"); + vfModuleItem.getVfModule().setPersonaModelVersion("1.0"); + vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571"); + vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317"); + vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); + vfModuleItem.setExtraProperties(new AAINQExtraProperties()); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a")); aaiNQInventoryResponseItems.getInventoryResponseItems().add(serviceItem); aaiNQInventoryResponseItems.getInventoryResponseItems().add(vfModuleItem); - aaiNQInventoryResponseItem.items = aaiNQInventoryResponseItems; - aaiNQInventoryResponseItem.modelName = "model-name"; + aaiNQInventoryResponseItem.setItems(aaiNQInventoryResponseItems); + aaiNQInventoryResponseItem.setModelName("model-name"); AAINQServiceInstance serviceInstance = new AAINQServiceInstance(); - serviceInstance.serviceInstanceID = "dhv-test-vhnfportal-service-instance-id"; - serviceInstance.serviceInstanceName = "dhv-test-service-instance-name1"; - serviceInstance.personaModelId = "82194af1-3c2c-485a-8f44-420e22a9eaa4"; - serviceInstance.personaModelVersion = "1.0"; - serviceInstance.serviceInstanceLocationId = "dhv-test-service-instance-location-id1"; - serviceInstance.resourceVersion = "1485366092"; - aaiNQInventoryResponseItem.serviceInstance = serviceInstance; + serviceInstance.setServiceInstanceID("dhv-test-vhnfportal-service-instance-id"); + serviceInstance.setServiceInstanceName("dhv-test-service-instance-name1"); + serviceInstance.setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4"); + serviceInstance.setPersonaModelVersion("1.0"); + serviceInstance.setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); + serviceInstance.setResourceVersion("1485366092"); + aaiNQInventoryResponseItem.setServiceInstance(serviceInstance); AAINQTenant aaiNQTenant = new AAINQTenant(); - aaiNQTenant.tenantId = "dhv-test-tenant"; - aaiNQTenant.tenantName = "dhv-test-tenant-name"; - aaiNQTenant.resourceVersion = "1485366334"; - aaiNQInventoryResponseItem.tenant = aaiNQTenant; + aaiNQTenant.setTenantId("dhv-test-tenant"); + aaiNQTenant.setTenantName("dhv-test-tenant-name"); + aaiNQTenant.setResourceVersion("1485366334"); + aaiNQInventoryResponseItem.setTenant(aaiNQTenant); AAINQVfModule aaiNQVfModule = new AAINQVfModule(); - aaiNQVfModule.vfModuleId = "example-vf-module-id-val-49261"; - aaiNQVfModule.vfModuleName = "example-vf-module-name-val-73074"; - aaiNQVfModule.heatStackId = "example-heat-stack-id-val-86300"; - aaiNQVfModule.orchestrationStatus = "example-orchestration-status-val-56523"; - aaiNQVfModule.isBaseVfModule = true; - aaiNQVfModule.resourceVersion = "1485366450"; - aaiNQVfModule.personaModelId = "ef86f9c5-2165-44f3-8fc3-96018b609ea5"; - aaiNQVfModule.personaModelVersion = "1.0"; - aaiNQVfModule.widgetModelId = "example-widget-model-id-val-92571"; - aaiNQVfModule.widgetModelVersion = "example-widget-model-version-val-83317"; - aaiNQVfModule.contrailServiceInstanceFqdn = "example-contrail-service-instance-fqdn-val-86796"; - aaiNQInventoryResponseItem.vfModule = aaiNQVfModule; + aaiNQVfModule.setVfModuleId("example-vf-module-id-val-49261"); + aaiNQVfModule.setVfModuleName("example-vf-module-name-val-73074"); + aaiNQVfModule.setHeatStackId("example-heat-stack-id-val-86300"); + aaiNQVfModule.setOrchestrationStatus("example-orchestration-status-val-56523"); + aaiNQVfModule.setIsBaseVfModule(true); + aaiNQVfModule.setResourceVersion("1485366450"); + aaiNQVfModule.setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5"); + aaiNQVfModule.setPersonaModelVersion("1.0"); + aaiNQVfModule.setWidgetModelId("example-widget-model-id-val-92571"); + aaiNQVfModule.setWidgetModelVersion("example-widget-model-version-val-83317"); + aaiNQVfModule.setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); + aaiNQInventoryResponseItem.setVfModule(aaiNQVfModule); AAINQVServer aaiNQVServer = new AAINQVServer(); - aaiNQVServer.vserverId = "dhv-test-vserver"; - aaiNQVServer.vserverName = "dhv-test-vserver-name"; - aaiNQVServer.vserverName2 = "dhv-test-vserver-name2"; - aaiNQVServer.provStatus = "PREPROV"; - aaiNQVServer.vserverSelflink = "dhv-test-vserver-selflink"; - aaiNQVServer.inMaint = false; - aaiNQVServer.isClosedLoopDisabled = false; - aaiNQVServer.resourceVersion = "1485366417"; - aaiNQInventoryResponseItem.vserver = aaiNQVServer; + aaiNQVServer.setVserverId("dhv-test-vserver"); + aaiNQVServer.setVserverName("dhv-test-vserver-name"); + aaiNQVServer.setVserverName2("dhv-test-vserver-name2"); + aaiNQVServer.setProvStatus("PREPROV"); + aaiNQVServer.setVserverSelflink("dhv-test-vserver-selflink"); + aaiNQVServer.setInMaint(false); + aaiNQVServer.setIsClosedLoopDisabled(false); + aaiNQVServer.setResourceVersion("1485366417"); + aaiNQInventoryResponseItem.setVserver(aaiNQVServer); assertNotNull(aaiNQInventoryResponseItem); logger.info(Serialization.gsonPretty.toJson(aaiNQInventoryResponseItem)); diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemsTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemsTest.java index df6b19959..422824330 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemsTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemsTest.java @@ -45,102 +45,104 @@ public class AAINQInventoryResponseItemsTest { public void test() { AAINQInventoryResponseItems aaiNQInventoryResponseItems = new AAINQInventoryResponseItems(); AAINQInventoryResponseItem serviceItem = new AAINQInventoryResponseItem(); - serviceItem.modelName = "service-instance"; - serviceItem.serviceInstance = new AAINQServiceInstance(); - serviceItem.serviceInstance.serviceInstanceID = "dhv-test-vhnfportal-service-instance-id"; - serviceItem.serviceInstance.serviceInstanceName = "dhv-test-service-instance-name1"; - serviceItem.serviceInstance.personaModelId = "82194af1-3c2c-485a-8f44-420e22a9eaa4"; - serviceItem.serviceInstance.personaModelVersion = "1.0"; - serviceItem.serviceInstance.serviceInstanceLocationId = "dhv-test-service-instance-location-id1"; - serviceItem.serviceInstance.resourceVersion = "1485366092"; - serviceItem.extraProperties = new AAINQExtraProperties(); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); + serviceItem.setModelName("service-instance"); + assertEquals(serviceItem.getModelName(), "service-instance"); + + serviceItem.setServiceInstance(new AAINQServiceInstance()); + serviceItem.getServiceInstance().setServiceInstanceID("dhv-test-vhnfportal-service-instance-id"); + serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1"); + serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4"); + serviceItem.getServiceInstance().setPersonaModelVersion("1.0"); + serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); + serviceItem.getServiceInstance().setResourceVersion("1485366092"); + serviceItem.setExtraProperties(new AAINQExtraProperties()); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); AAINQInventoryResponseItem vfModuleItem = new AAINQInventoryResponseItem(); - vfModuleItem.modelName = "vf-module"; - vfModuleItem.vfModule = new AAINQVfModule(); - vfModuleItem.vfModule.vfModuleId = "example-vf-module-id-val-49261"; - vfModuleItem.vfModule.vfModuleName = "example-vf-module-name-val-73074"; - vfModuleItem.vfModule.heatStackId = "example-heat-stack-id-val-86300"; - vfModuleItem.vfModule.orchestrationStatus = "example-orchestration-status-val-56523"; - vfModuleItem.vfModule.isBaseVfModule = true; - vfModuleItem.vfModule.resourceVersion = "1485366450"; - vfModuleItem.vfModule.personaModelId = "ef86f9c5-2165-44f3-8fc3-96018b609ea5"; - vfModuleItem.vfModule.personaModelVersion = "1.0"; - vfModuleItem.vfModule.widgetModelId = "example-widget-model-id-val-92571"; - vfModuleItem.vfModule.widgetModelVersion = "example-widget-model-version-val-83317"; - vfModuleItem.vfModule.contrailServiceInstanceFqdn = "example-contrail-service-instance-fqdn-val-86796"; - vfModuleItem.extraProperties = new AAINQExtraProperties(); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a")); + vfModuleItem.setModelName("vf-module"); + vfModuleItem.setVfModule(new AAINQVfModule()); + vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261"); + vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074"); + vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300"); + vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523"); + vfModuleItem.getVfModule().setIsBaseVfModule(true); + vfModuleItem.getVfModule().setResourceVersion("1485366450"); + vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5"); + vfModuleItem.getVfModule().setPersonaModelVersion("1.0"); + vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571"); + vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317"); + vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); + vfModuleItem.setExtraProperties(new AAINQExtraProperties()); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a")); AAINQInventoryResponseItem genericVNFItem = new AAINQInventoryResponseItem(); - genericVNFItem.modelName = "generic-vnf"; - genericVNFItem.genericVNF = new AAINQGenericVNF(); - genericVNFItem.genericVNF.vnfID = "dhv-test-gvnf"; - genericVNFItem.genericVNF.vnfName = "dhv-test-gvnf-name"; - genericVNFItem.genericVNF.vnfName2 = "dhv-test-gvnf-name2"; - genericVNFItem.genericVNF.vnfType = "SW"; - genericVNFItem.genericVNF.serviceId = "d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"; - genericVNFItem.genericVNF.provStatus = "PREPROV"; - genericVNFItem.genericVNF.operationalState = "dhv-test-operational-state"; - genericVNFItem.genericVNF.ipv4OamAddress = "dhv-test-gvnf-ipv4-oam-address"; - genericVNFItem.genericVNF.ipv4Loopback0Address = "dhv-test-gvnfipv4-loopback0-address"; - genericVNFItem.genericVNF.inMaint = false; - genericVNFItem.genericVNF.isClosedLoopDisabled = false; - genericVNFItem.genericVNF.resourceVersion = "1485366450"; - genericVNFItem.genericVNF.encrypedAccessFlag = true; - genericVNFItem.genericVNF.personaModelId = "acc6edd8-a8d4-4b93-afaa-0994068be14c"; - genericVNFItem.genericVNF.personaModelVersion = "1.0"; - genericVNFItem.extraProperties = new AAINQExtraProperties(); - genericVNFItem.extraProperties.setExtraProperty(new LinkedList<>()); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); - genericVNFItem.items = new AAINQInventoryResponseItems(); - genericVNFItem.items.setInventoryResponseItems(new LinkedList<>()); - genericVNFItem.items.getInventoryResponseItems().add(serviceItem); - genericVNFItem.items.getInventoryResponseItems().add(vfModuleItem); + genericVNFItem.setModelName("generic-vnf"); + genericVNFItem.setGenericVNF(new AAINQGenericVNF()); + genericVNFItem.getGenericVNF().setVnfID("dhv-test-gvnf"); + genericVNFItem.getGenericVNF().setVnfName("dhv-test-gvnf-name"); + genericVNFItem.getGenericVNF().setVnfName2("dhv-test-gvnf-name2"); + genericVNFItem.getGenericVNF().setVnfType("SW"); + genericVNFItem.getGenericVNF().setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"); + genericVNFItem.getGenericVNF().setProvStatus("PREPROV"); + genericVNFItem.getGenericVNF().setOperationalState("dhv-test-operational-state"); + genericVNFItem.getGenericVNF().setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address"); + genericVNFItem.getGenericVNF().setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address"); + genericVNFItem.getGenericVNF().setInMaint(false); + genericVNFItem.getGenericVNF().setIsClosedLoopDisabled(false); + genericVNFItem.getGenericVNF().setResourceVersion("1485366450"); + genericVNFItem.getGenericVNF().setEncrypedAccessFlag(true); + genericVNFItem.getGenericVNF().setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c"); + genericVNFItem.getGenericVNF().setPersonaModelVersion("1.0"); + genericVNFItem.setExtraProperties(new AAINQExtraProperties()); + genericVNFItem.getExtraProperties().setExtraProperty(new LinkedList<>()); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); + genericVNFItem.setItems(new AAINQInventoryResponseItems()); + genericVNFItem.getItems().setInventoryResponseItems(new LinkedList<>()); + genericVNFItem.getItems().getInventoryResponseItems().add(serviceItem); + genericVNFItem.getItems().getInventoryResponseItems().add(vfModuleItem); AAINQInventoryResponseItem cloudItem = new AAINQInventoryResponseItem(); - cloudItem.cloudRegion = new AAINQCloudRegion(); - cloudItem.cloudRegion.cloudOwner = "OWNER"; - cloudItem.cloudRegion.cloudRegionId = "REGIONID"; - cloudItem.cloudRegion.cloudRegionVersion = "2.5"; - cloudItem.cloudRegion.complexName = "COMPLEXNAME"; - cloudItem.cloudRegion.resourceVersion = "1485365988"; + cloudItem.setCloudRegion(new AAINQCloudRegion()); + cloudItem.getCloudRegion().setCloudOwner("OWNER"); + cloudItem.getCloudRegion().setCloudRegionId("REGIONID"); + cloudItem.getCloudRegion().setCloudRegionVersion("2.5"); + cloudItem.getCloudRegion().setComplexName("COMPLEXNAME"); + cloudItem.getCloudRegion().setResourceVersion("1485365988"); AAINQInventoryResponseItem tenantItem = new AAINQInventoryResponseItem(); - tenantItem.tenant = new AAINQTenant(); - tenantItem.tenant.tenantId = "dhv-test-tenant"; - tenantItem.tenant.tenantName = "dhv-test-tenant-name"; - tenantItem.tenant.resourceVersion = "1485366334"; - tenantItem.items = new AAINQInventoryResponseItems(); - tenantItem.items.setInventoryResponseItems(new LinkedList<>()); - tenantItem.items.getInventoryResponseItems().add(cloudItem); + tenantItem.setTenant(new AAINQTenant()); + tenantItem.getTenant().setTenantId("dhv-test-tenant"); + tenantItem.getTenant().setTenantName("dhv-test-tenant-name"); + tenantItem.getTenant().setResourceVersion("1485366334"); + tenantItem.setItems(new AAINQInventoryResponseItems()); + tenantItem.getItems().setInventoryResponseItems(new LinkedList<>()); + tenantItem.getItems().getInventoryResponseItems().add(cloudItem); AAINQInventoryResponseItem vserverItem = new AAINQInventoryResponseItem(); - vserverItem.vserver = new AAINQVServer(); - vserverItem.vserver.vserverId = "dhv-test-vserver"; - vserverItem.vserver.vserverName = "dhv-test-vserver-name"; - vserverItem.vserver.vserverName2 = "dhv-test-vserver-name2"; - vserverItem.vserver.provStatus = "PREPROV"; - vserverItem.vserver.vserverSelflink = "dhv-test-vserver-selflink"; - vserverItem.vserver.inMaint = false; - vserverItem.vserver.isClosedLoopDisabled = false; - vserverItem.vserver.resourceVersion = "1485366417"; - vserverItem.items = new AAINQInventoryResponseItems(); - vserverItem.items.setInventoryResponseItems(new LinkedList<>()); - vserverItem.items.getInventoryResponseItems().add(genericVNFItem); - vserverItem.items.getInventoryResponseItems().add(tenantItem); + vserverItem.setVserver(new AAINQVServer()); + vserverItem.getVserver().setVserverId("dhv-test-vserver"); + vserverItem.getVserver().setVserverName("dhv-test-vserver-name"); + vserverItem.getVserver().setVserverName2("dhv-test-vserver-name2"); + vserverItem.getVserver().setProvStatus("PREPROV"); + vserverItem.getVserver().setVserverSelflink("dhv-test-vserver-selflink"); + vserverItem.getVserver().setInMaint(false); + vserverItem.getVserver().setIsClosedLoopDisabled(false); + vserverItem.getVserver().setResourceVersion("1485366417"); + vserverItem.setItems(new AAINQInventoryResponseItems()); + vserverItem.getItems().setInventoryResponseItems(new LinkedList<>()); + vserverItem.getItems().getInventoryResponseItems().add(genericVNFItem); + vserverItem.getItems().getInventoryResponseItems().add(tenantItem); aaiNQInventoryResponseItems.getInventoryResponseItems().add(vserverItem); assertNotNull(aaiNQInventoryResponseItems); logger.info(Serialization.gsonPretty.toJson(aaiNQInventoryResponseItems)); diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQNamedQueryTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQNamedQueryTest.java index 5293d4373..510683387 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQNamedQueryTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQNamedQueryTest.java @@ -40,8 +40,9 @@ public class AAINQNamedQueryTest { @Test public void test() { AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery(); - aaiNQNamedQuery.namedQueryUUID = UUID.randomUUID(); + UUID uuid = UUID.randomUUID(); + aaiNQNamedQuery.setNamedQueryUUID(uuid); assertNotNull(aaiNQNamedQuery); + assertEquals(aaiNQNamedQuery.getNamedQueryUUID(), uuid); } - } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQQueryParametersTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQQueryParametersTest.java index 7cfa67a2b..0561fa690 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQQueryParametersTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQQueryParametersTest.java @@ -41,9 +41,10 @@ public class AAINQQueryParametersTest { public void test() { AAINQQueryParameters aaiNQQueryParameters = new AAINQQueryParameters(); AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery(); - aaiNQNamedQuery.namedQueryUUID = UUID.randomUUID(); - aaiNQQueryParameters.namedQuery = aaiNQNamedQuery; + aaiNQNamedQuery.setNamedQueryUUID(UUID.randomUUID()); + aaiNQQueryParameters.setNamedQuery(aaiNQNamedQuery); assertNotNull(aaiNQNamedQuery); + assertEquals(aaiNQQueryParameters.getNamedQuery(), aaiNQNamedQuery); } } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestErrorTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestErrorTest.java new file mode 100644 index 000000000..d13689814 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestErrorTest.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class AAINQRequestErrorTest { + + @Test + public void test() { + AAINQRequestError aainqRequestError = new AAINQRequestError(); + AAINQServiceExcept serviceExcept = new AAINQServiceExcept(); + aainqRequestError.setServiceExcept(serviceExcept); + assertEquals(aainqRequestError.getServiceExcept(), serviceExcept); + + assertNull(serviceExcept.getMessageId()); + assertNull(serviceExcept.getText()); + assertNull(serviceExcept.getVariables()); + } +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestTest.java index 64d93bd95..64e722613 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestTest.java @@ -47,13 +47,20 @@ public class AAINQRequestTest { AAINQInstanceFilters aaiNQInstanceFilters = new AAINQInstanceFilters(); AAINQQueryParameters aaiNQQueryParameters = new AAINQQueryParameters(); - aaiNQRequest.instanceFilters = aaiNQInstanceFilters; - AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery(); - aaiNQNamedQuery.namedQueryUUID = UUID.randomUUID(); - aaiNQQueryParameters.namedQuery = aaiNQNamedQuery; - aaiNQRequest.queryParameters = aaiNQQueryParameters; + aaiNQRequest.setInstanceFilters(aaiNQInstanceFilters); + assertNotNull(aaiNQRequest.getInstanceFilters()); + AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery(); + UUID uuid = UUID.randomUUID(); + aaiNQNamedQuery.setNamedQueryUUID(uuid); + aaiNQQueryParameters.setNamedQuery(aaiNQNamedQuery); + aaiNQRequest.setQueryParameters(aaiNQQueryParameters); assertNotNull(aaiNQRequest); + + assertEquals(aaiNQNamedQuery.getNamedQueryUUID(), uuid); + assertEquals(aaiNQQueryParameters.getNamedQuery(), aaiNQNamedQuery); + assertEquals(aaiNQRequest.getQueryParameters(), aaiNQQueryParameters); + logger.info(Serialization.gsonPretty.toJson(aaiNQRequest)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseTest.java index 5e59429c2..e481f0aca 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseTest.java @@ -31,107 +31,113 @@ public class AAINQResponseTest { @Test public void Test() { + getAAINQResponse(); + } + + public AAINQResponse getAAINQResponse() { AAINQInventoryResponseItem serviceItem = new AAINQInventoryResponseItem(); - serviceItem.modelName = "service-instance"; - serviceItem.serviceInstance = new AAINQServiceInstance(); - serviceItem.serviceInstance.serviceInstanceID = "dhv-test-vhnfportal-service-instance-id"; - serviceItem.serviceInstance.serviceInstanceName = "dhv-test-service-instance-name1"; - serviceItem.serviceInstance.personaModelId = "82194af1-3c2c-485a-8f44-420e22a9eaa4"; - serviceItem.serviceInstance.personaModelVersion = "1.0"; - serviceItem.serviceInstance.serviceInstanceLocationId = "dhv-test-service-instance-location-id1"; - serviceItem.serviceInstance.resourceVersion = "1485366092"; - serviceItem.extraProperties = new AAINQExtraProperties(); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); + serviceItem.setModelName("service-instance"); + serviceItem.setServiceInstance(new AAINQServiceInstance()); + serviceItem.getServiceInstance().setServiceInstanceID("dhv-test-vhnfportal-service-instance-id"); + serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1"); + serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4"); + serviceItem.getServiceInstance().setPersonaModelVersion("1.0"); + serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); + serviceItem.getServiceInstance().setResourceVersion("1485366092"); + serviceItem.setExtraProperties(new AAINQExtraProperties()); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); AAINQInventoryResponseItem vfModuleItem = new AAINQInventoryResponseItem(); - vfModuleItem.modelName = "vf-module"; - vfModuleItem.vfModule = new AAINQVfModule(); - vfModuleItem.vfModule.vfModuleId = "example-vf-module-id-val-49261"; - vfModuleItem.vfModule.vfModuleName = "example-vf-module-name-val-73074"; - vfModuleItem.vfModule.heatStackId = "example-heat-stack-id-val-86300"; - vfModuleItem.vfModule.orchestrationStatus = "example-orchestration-status-val-56523"; - vfModuleItem.vfModule.isBaseVfModule = true; - vfModuleItem.vfModule.resourceVersion = "1485366450"; - vfModuleItem.vfModule.personaModelId = "ef86f9c5-2165-44f3-8fc3-96018b609ea5"; - vfModuleItem.vfModule.personaModelVersion = "1.0"; - vfModuleItem.vfModule.widgetModelId = "example-widget-model-id-val-92571"; - vfModuleItem.vfModule.widgetModelVersion = "example-widget-model-version-val-83317"; - vfModuleItem.vfModule.contrailServiceInstanceFqdn = "example-contrail-service-instance-fqdn-val-86796"; - vfModuleItem.extraProperties = new AAINQExtraProperties(); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a")); + vfModuleItem.setModelName("vf-module"); + vfModuleItem.setVfModule(new AAINQVfModule()); + vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261"); + vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074"); + vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300"); + vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523"); + vfModuleItem.getVfModule().setIsBaseVfModule(true); + vfModuleItem.getVfModule().setResourceVersion("1485366450"); + vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5"); + vfModuleItem.getVfModule().setPersonaModelVersion("1.0"); + vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571"); + vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317"); + vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); + vfModuleItem.setExtraProperties(new AAINQExtraProperties()); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a")); AAINQInventoryResponseItem genericVNFItem = new AAINQInventoryResponseItem(); - genericVNFItem.modelName = "generic-vnf"; - genericVNFItem.genericVNF = new AAINQGenericVNF(); - genericVNFItem.genericVNF.vnfID = "dhv-test-gvnf"; - genericVNFItem.genericVNF.vnfName = "dhv-test-gvnf-name"; - genericVNFItem.genericVNF.vnfName2 = "dhv-test-gvnf-name2"; - genericVNFItem.genericVNF.vnfType = "SW"; - genericVNFItem.genericVNF.serviceId = "d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"; - genericVNFItem.genericVNF.provStatus = "PREPROV"; - genericVNFItem.genericVNF.operationalState = "dhv-test-operational-state"; - genericVNFItem.genericVNF.ipv4OamAddress = "dhv-test-gvnf-ipv4-oam-address"; - genericVNFItem.genericVNF.ipv4Loopback0Address = "dhv-test-gvnfipv4-loopback0-address"; - genericVNFItem.genericVNF.inMaint = false; - genericVNFItem.genericVNF.isClosedLoopDisabled = false; - genericVNFItem.genericVNF.resourceVersion = "1485366450"; - genericVNFItem.genericVNF.encrypedAccessFlag = true; - genericVNFItem.genericVNF.personaModelId = "acc6edd8-a8d4-4b93-afaa-0994068be14c"; - genericVNFItem.genericVNF.personaModelVersion = "1.0"; - genericVNFItem.extraProperties = new AAINQExtraProperties(); - genericVNFItem.extraProperties.setExtraProperty(new LinkedList<>()); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); - genericVNFItem.items = new AAINQInventoryResponseItems(); - genericVNFItem.items.setInventoryResponseItems(new LinkedList<>()); - genericVNFItem.items.getInventoryResponseItems().add(serviceItem); - genericVNFItem.items.getInventoryResponseItems().add(vfModuleItem); + genericVNFItem.setModelName("generic-vnf"); + genericVNFItem.setGenericVNF(new AAINQGenericVNF()); + genericVNFItem.getGenericVNF().setVnfID("dhv-test-gvnf"); + genericVNFItem.getGenericVNF().setVnfName("dhv-test-gvnf-name"); + genericVNFItem.getGenericVNF().setVnfName2("dhv-test-gvnf-name2"); + genericVNFItem.getGenericVNF().setVnfType("SW"); + genericVNFItem.getGenericVNF().setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"); + genericVNFItem.getGenericVNF().setProvStatus("PREPROV"); + genericVNFItem.getGenericVNF().setOperationalState("dhv-test-operational-state"); + genericVNFItem.getGenericVNF().setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address"); + genericVNFItem.getGenericVNF().setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address"); + genericVNFItem.getGenericVNF().setInMaint(false); + genericVNFItem.getGenericVNF().setIsClosedLoopDisabled(false); + genericVNFItem.getGenericVNF().setResourceVersion("1485366450"); + genericVNFItem.getGenericVNF().setEncrypedAccessFlag(true); + genericVNFItem.getGenericVNF().setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c"); + genericVNFItem.getGenericVNF().setPersonaModelVersion("1.0"); + genericVNFItem.setExtraProperties(new AAINQExtraProperties()); + genericVNFItem.getExtraProperties().setExtraProperty(new LinkedList<>()); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); + genericVNFItem.setItems(new AAINQInventoryResponseItems()); + genericVNFItem.getItems().setInventoryResponseItems(new LinkedList<>()); + genericVNFItem.getItems().getInventoryResponseItems().add(serviceItem); + genericVNFItem.getItems().getInventoryResponseItems().add(vfModuleItem); AAINQInventoryResponseItem cloudItem = new AAINQInventoryResponseItem(); - cloudItem.cloudRegion = new AAINQCloudRegion(); - cloudItem.cloudRegion.cloudOwner = "OWNER"; - cloudItem.cloudRegion.cloudRegionId = "REGIONID"; - cloudItem.cloudRegion.cloudRegionVersion = "2.5"; - cloudItem.cloudRegion.complexName = "COMPLEXNAME"; - cloudItem.cloudRegion.resourceVersion = "1485365988"; + cloudItem.setCloudRegion(new AAINQCloudRegion()); + cloudItem.getCloudRegion().setCloudOwner("OWNER"); + cloudItem.getCloudRegion().setCloudRegionId("REGIONID"); + cloudItem.getCloudRegion().setCloudRegionVersion("2.5"); + cloudItem.getCloudRegion().setComplexName("COMPLEXNAME"); + cloudItem.getCloudRegion().setResourceVersion("1485365988"); AAINQInventoryResponseItem tenantItem = new AAINQInventoryResponseItem(); - tenantItem.tenant = new AAINQTenant(); - tenantItem.tenant.tenantId = "dhv-test-tenant"; - tenantItem.tenant.tenantName = "dhv-test-tenant-name"; - tenantItem.tenant.resourceVersion = "1485366334"; - tenantItem.items = new AAINQInventoryResponseItems(); - tenantItem.items.setInventoryResponseItems(new LinkedList<>()); - tenantItem.items.getInventoryResponseItems().add(cloudItem); + tenantItem.setTenant(new AAINQTenant()); + tenantItem.getTenant().setTenantId("dhv-test-tenant"); + tenantItem.getTenant().setTenantName("dhv-test-tenant-name"); + tenantItem.getTenant().setResourceVersion("1485366334"); + tenantItem.setItems(new AAINQInventoryResponseItems()); + tenantItem.getItems().setInventoryResponseItems(new LinkedList<>()); + tenantItem.getItems().getInventoryResponseItems().add(cloudItem); AAINQInventoryResponseItem vserverItem = new AAINQInventoryResponseItem(); - vserverItem.vserver = new AAINQVServer(); - vserverItem.vserver.vserverId = "dhv-test-vserver"; - vserverItem.vserver.vserverName = "dhv-test-vserver-name"; - vserverItem.vserver.vserverName2 = "dhv-test-vserver-name2"; - vserverItem.vserver.provStatus = "PREPROV"; - vserverItem.vserver.vserverSelflink = "dhv-test-vserver-selflink"; - vserverItem.vserver.inMaint = false; - vserverItem.vserver.isClosedLoopDisabled = false; - vserverItem.vserver.resourceVersion = "1485366417"; - vserverItem.items = new AAINQInventoryResponseItems(); - vserverItem.items.setInventoryResponseItems(new LinkedList<>()); - vserverItem.items.getInventoryResponseItems().add(genericVNFItem); - vserverItem.items.getInventoryResponseItems().add(tenantItem); + vserverItem.setVserver(new AAINQVServer()); + vserverItem.getVserver().setVserverId("dhv-test-vserver"); + vserverItem.getVserver().setVserverName("dhv-test-vserver-name"); + vserverItem.getVserver().setVserverName2("dhv-test-vserver-name2"); + vserverItem.getVserver().setProvStatus("PREPROV"); + vserverItem.getVserver().setVserverSelflink("dhv-test-vserver-selflink"); + vserverItem.getVserver().setInMaint(false); + vserverItem.getVserver().setIsClosedLoopDisabled(false); + vserverItem.getVserver().setResourceVersion("1485366417"); + vserverItem.setItems(new AAINQInventoryResponseItems()); + vserverItem.getItems().setInventoryResponseItems(new LinkedList<>()); + vserverItem.getItems().getInventoryResponseItems().add(genericVNFItem); + vserverItem.getItems().getInventoryResponseItems().add(tenantItem); AAINQResponse aaiResponse = new AAINQResponse(); aaiResponse.getInventoryResponseItems().add(vserverItem); logger.info(Serialization.gsonPretty.toJson(aaiResponse)); + + return aaiResponse; } } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseWrapperTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseWrapperTest.java index 9c4bfafa8..8df71fce1 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseWrapperTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseWrapperTest.java @@ -46,103 +46,103 @@ public class AAINQResponseWrapperTest { @Test public void test() { AAINQInventoryResponseItem serviceItem = new AAINQInventoryResponseItem(); - serviceItem.modelName = "service-instance"; - serviceItem.serviceInstance = new AAINQServiceInstance(); - serviceItem.serviceInstance.serviceInstanceID = "dhv-test-vhnfportal-service-instance-id"; - serviceItem.serviceInstance.serviceInstanceName = "dhv-test-service-instance-name1"; - serviceItem.serviceInstance.personaModelId = "82194af1-3c2c-485a-8f44-420e22a9eaa4"; - serviceItem.serviceInstance.personaModelVersion = "1.0"; - serviceItem.serviceInstance.serviceInstanceLocationId = "dhv-test-service-instance-location-id1"; - serviceItem.serviceInstance.resourceVersion = "1485366092"; - serviceItem.extraProperties = new AAINQExtraProperties(); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); + serviceItem.setModelName("service-instance"); + serviceItem.setServiceInstance(new AAINQServiceInstance()); + serviceItem.getServiceInstance().setServiceInstanceID("dhv-test-vhnfportal-service-instance-id"); + serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1"); + serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4"); + serviceItem.getServiceInstance().setPersonaModelVersion("1.0"); + serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); + serviceItem.getServiceInstance().setResourceVersion("1485366092"); + serviceItem.setExtraProperties(new AAINQExtraProperties()); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); AAINQInventoryResponseItem vfModuleItem = new AAINQInventoryResponseItem(); - vfModuleItem.modelName = "vf-module"; - vfModuleItem.vfModule = new AAINQVfModule(); - vfModuleItem.vfModule.vfModuleId = "example-vf-module-id-val-49261"; - vfModuleItem.vfModule.vfModuleName = "example-vf-module-name-val-73074"; - vfModuleItem.vfModule.heatStackId = "example-heat-stack-id-val-86300"; - vfModuleItem.vfModule.orchestrationStatus = "example-orchestration-status-val-56523"; - vfModuleItem.vfModule.isBaseVfModule = true; - vfModuleItem.vfModule.resourceVersion = "1485366450"; - vfModuleItem.vfModule.personaModelId = "ef86f9c5-2165-44f3-8fc3-96018b609ea5"; - vfModuleItem.vfModule.personaModelVersion = "1.0"; - vfModuleItem.vfModule.widgetModelId = "example-widget-model-id-val-92571"; - vfModuleItem.vfModule.widgetModelVersion = "example-widget-model-version-val-83317"; - vfModuleItem.vfModule.contrailServiceInstanceFqdn = "example-contrail-service-instance-fqdn-val-86796"; - vfModuleItem.extraProperties = new AAINQExtraProperties(); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a")); + vfModuleItem.setModelName("vf-module"); + vfModuleItem.setVfModule(new AAINQVfModule()); + vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261"); + vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074"); + vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300"); + vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523"); + vfModuleItem.getVfModule().setIsBaseVfModule(true); + vfModuleItem.getVfModule().setResourceVersion("1485366450"); + vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5"); + vfModuleItem.getVfModule().setPersonaModelVersion("1.0"); + vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571"); + vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317"); + vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); + vfModuleItem.setExtraProperties(new AAINQExtraProperties()); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a")); AAINQInventoryResponseItem genericVNFItem = new AAINQInventoryResponseItem(); - genericVNFItem.modelName = "generic-vnf"; - genericVNFItem.genericVNF = new AAINQGenericVNF(); - genericVNFItem.genericVNF.vnfID = "dhv-test-gvnf"; - genericVNFItem.genericVNF.vnfName = "dhv-test-gvnf-name"; - genericVNFItem.genericVNF.vnfName2 = "dhv-test-gvnf-name2"; - genericVNFItem.genericVNF.vnfType = "SW"; - genericVNFItem.genericVNF.serviceId = "d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"; - genericVNFItem.genericVNF.provStatus = "PREPROV"; - genericVNFItem.genericVNF.operationalState = "dhv-test-operational-state"; - genericVNFItem.genericVNF.ipv4OamAddress = "dhv-test-gvnf-ipv4-oam-address"; - genericVNFItem.genericVNF.ipv4Loopback0Address = "dhv-test-gvnfipv4-loopback0-address"; - genericVNFItem.genericVNF.inMaint = false; - genericVNFItem.genericVNF.isClosedLoopDisabled = false; - genericVNFItem.genericVNF.resourceVersion = "1485366450"; - genericVNFItem.genericVNF.encrypedAccessFlag = true; - genericVNFItem.genericVNF.personaModelId = "acc6edd8-a8d4-4b93-afaa-0994068be14c"; - genericVNFItem.genericVNF.personaModelVersion = "1.0"; - genericVNFItem.extraProperties = new AAINQExtraProperties(); - genericVNFItem.extraProperties.setExtraProperty(new LinkedList<>()); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); - genericVNFItem.items = new AAINQInventoryResponseItems(); - genericVNFItem.items.setInventoryResponseItems(new LinkedList<>()); - genericVNFItem.items.getInventoryResponseItems().add(serviceItem); - genericVNFItem.items.getInventoryResponseItems().add(vfModuleItem); + genericVNFItem.setModelName("generic-vnf"); + genericVNFItem.setGenericVNF(new AAINQGenericVNF()); + genericVNFItem.getGenericVNF().setVnfID("dhv-test-gvnf"); + genericVNFItem.getGenericVNF().setVnfName("dhv-test-gvnf-name"); + genericVNFItem.getGenericVNF().setVnfName2("dhv-test-gvnf-name2"); + genericVNFItem.getGenericVNF().setVnfType("SW"); + genericVNFItem.getGenericVNF().setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"); + genericVNFItem.getGenericVNF().setProvStatus("PREPROV"); + genericVNFItem.getGenericVNF().setOperationalState("dhv-test-operational-state"); + genericVNFItem.getGenericVNF().setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address"); + genericVNFItem.getGenericVNF().setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address"); + genericVNFItem.getGenericVNF().setInMaint(false); + genericVNFItem.getGenericVNF().setIsClosedLoopDisabled(false); + genericVNFItem.getGenericVNF().setResourceVersion("1485366450"); + genericVNFItem.getGenericVNF().setEncrypedAccessFlag(true); + genericVNFItem.getGenericVNF().setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c"); + genericVNFItem.getGenericVNF().setPersonaModelVersion("1.0"); + genericVNFItem.setExtraProperties(new AAINQExtraProperties()); + genericVNFItem.getExtraProperties().setExtraProperty(new LinkedList<>()); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); + genericVNFItem.setItems(new AAINQInventoryResponseItems()); + genericVNFItem.getItems().setInventoryResponseItems(new LinkedList<>()); + genericVNFItem.getItems().getInventoryResponseItems().add(serviceItem); + genericVNFItem.getItems().getInventoryResponseItems().add(vfModuleItem); AAINQInventoryResponseItem cloudItem = new AAINQInventoryResponseItem(); - cloudItem.cloudRegion = new AAINQCloudRegion(); - cloudItem.cloudRegion.cloudOwner = "OWNER"; - cloudItem.cloudRegion.cloudRegionId = "REGIONID"; - cloudItem.cloudRegion.cloudRegionVersion = "2.5"; - cloudItem.cloudRegion.complexName = "COMPLEXNAME"; - cloudItem.cloudRegion.resourceVersion = "1485365988"; + cloudItem.setCloudRegion(new AAINQCloudRegion()); + cloudItem.getCloudRegion().setCloudOwner("OWNER"); + cloudItem.getCloudRegion().setCloudRegionId("REGIONID"); + cloudItem.getCloudRegion().setCloudRegionVersion("2.5"); + cloudItem.getCloudRegion().setComplexName("COMPLEXNAME"); + cloudItem.getCloudRegion().setResourceVersion("1485365988"); AAINQInventoryResponseItem tenantItem = new AAINQInventoryResponseItem(); - tenantItem.tenant = new AAINQTenant(); - tenantItem.tenant.tenantId = "dhv-test-tenant"; - tenantItem.tenant.tenantName = "dhv-test-tenant-name"; - tenantItem.tenant.resourceVersion = "1485366334"; - tenantItem.items = new AAINQInventoryResponseItems(); - tenantItem.items.setInventoryResponseItems(new LinkedList<>()); - tenantItem.items.getInventoryResponseItems().add(cloudItem); + tenantItem.setTenant(new AAINQTenant()); + tenantItem.getTenant().setTenantId("dhv-test-tenant"); + tenantItem.getTenant().setTenantName("dhv-test-tenant-name"); + tenantItem.getTenant().setResourceVersion("1485366334"); + tenantItem.setItems(new AAINQInventoryResponseItems()); + tenantItem.getItems().setInventoryResponseItems(new LinkedList<>()); + tenantItem.getItems().getInventoryResponseItems().add(cloudItem); AAINQInventoryResponseItem vserverItem = new AAINQInventoryResponseItem(); - vserverItem.vserver = new AAINQVServer(); - vserverItem.vserver.vserverId = "dhv-test-vserver"; - vserverItem.vserver.vserverName = "dhv-test-vserver-name"; - vserverItem.vserver.vserverName2 = "dhv-test-vserver-name2"; - vserverItem.vserver.provStatus = "PREPROV"; - vserverItem.vserver.vserverSelflink = "dhv-test-vserver-selflink"; - vserverItem.vserver.inMaint = false; - vserverItem.vserver.isClosedLoopDisabled = false; - vserverItem.vserver.resourceVersion = "1485366417"; - vserverItem.items = new AAINQInventoryResponseItems(); - vserverItem.items.setInventoryResponseItems(new LinkedList<>()); - vserverItem.items.getInventoryResponseItems().add(genericVNFItem); - vserverItem.items.getInventoryResponseItems().add(tenantItem); + vserverItem.setVserver(new AAINQVServer()); + vserverItem.getVserver().setVserverId("dhv-test-vserver"); + vserverItem.getVserver().setVserverName("dhv-test-vserver-name"); + vserverItem.getVserver().setVserverName2("dhv-test-vserver-name2"); + vserverItem.getVserver().setProvStatus("PREPROV"); + vserverItem.getVserver().setVserverSelflink("dhv-test-vserver-selflink"); + vserverItem.getVserver().setInMaint(false); + vserverItem.getVserver().setIsClosedLoopDisabled(false); + vserverItem.getVserver().setResourceVersion("1485366417"); + vserverItem.setItems(new AAINQInventoryResponseItems()); + vserverItem.getItems().setInventoryResponseItems(new LinkedList<>()); + vserverItem.getItems().getInventoryResponseItems().add(genericVNFItem); + vserverItem.getItems().getInventoryResponseItems().add(tenantItem); AAINQResponse aaiResponse = new AAINQResponse(); aaiResponse.getInventoryResponseItems().add(vserverItem); @@ -151,5 +151,13 @@ public class AAINQResponseWrapperTest { aaiNQResponseWarapper.setRequestID(UUID.randomUUID()); assertNotNull(aaiNQResponseWarapper); logger.info(Serialization.gsonPretty.toJson(aaiNQResponseWarapper)); + + AAINQResponse aaiResponse2 = new AAINQResponse(); + aaiResponse2.getInventoryResponseItems().add(vserverItem); + AAINQResponseWrapper aaiNQResponseWarapper2 = new AAINQResponseWrapper(UUID.randomUUID(), aaiResponse); + assertNotNull(aaiNQResponseWarapper2); + assertNotNull(aaiNQResponseWarapper2.getRequestID()); + assertNotNull(aaiNQResponseWarapper2.getAainqresponse()); + logger.info(Serialization.gsonPretty.toJson(aaiNQResponseWarapper2)); } } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQServiceInstanceTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQServiceInstanceTest.java index 3f04abc63..dcb19a4ef 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQServiceInstanceTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQServiceInstanceTest.java @@ -42,13 +42,23 @@ public class AAINQServiceInstanceTest { @Test public void test() { AAINQServiceInstance aaiNQServiceInstance = new AAINQServiceInstance(); - aaiNQServiceInstance.serviceInstanceID = "dhv-test-vhnfportal-service-instance-id"; - aaiNQServiceInstance.serviceInstanceName = "dhv-test-service-instance-name1"; - aaiNQServiceInstance.personaModelId = "82194af1-3c2c-485a-8f44-420e22a9eaa4"; - aaiNQServiceInstance.personaModelVersion = "1.0"; - aaiNQServiceInstance.serviceInstanceLocationId = "dhv-test-service-instance-location-id1"; - aaiNQServiceInstance.resourceVersion = "1485366092"; + aaiNQServiceInstance.setServiceInstanceID("dhv-test-vhnfportal-service-instance-id"); + aaiNQServiceInstance.setServiceInstanceName("dhv-test-service-instance-name1"); + aaiNQServiceInstance.setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4"); + aaiNQServiceInstance.setPersonaModelVersion("1.0"); + aaiNQServiceInstance.setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); + aaiNQServiceInstance.setResourceVersion("1485366092"); + aaiNQServiceInstance.setModelInvariantId("SomeID"); + aaiNQServiceInstance.setModelVersionId("SomeVersion"); assertNotNull(aaiNQServiceInstance); + assertEquals(aaiNQServiceInstance.getServiceInstanceID(), "dhv-test-vhnfportal-service-instance-id"); + assertEquals(aaiNQServiceInstance.getServiceInstanceName(), "dhv-test-service-instance-name1"); + assertEquals(aaiNQServiceInstance.getPersonaModelId(), "82194af1-3c2c-485a-8f44-420e22a9eaa4"); + assertEquals(aaiNQServiceInstance.getPersonaModelVersion(), "1.0"); + assertEquals(aaiNQServiceInstance.getServiceInstanceLocationId(), "dhv-test-service-instance-location-id1"); + assertEquals(aaiNQServiceInstance.getResourceVersion(), "1485366092"); + assertEquals(aaiNQServiceInstance.getModelInvariantId(), "SomeID"); + assertEquals(aaiNQServiceInstance.getModelVersionId(), "SomeVersion"); logger.info(Serialization.gsonPretty.toJson(aaiNQServiceInstance)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQTenantTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQTenantTest.java index f803db889..c40a46246 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQTenantTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQTenantTest.java @@ -42,11 +42,15 @@ public class AAINQTenantTest { @Test public void test() { AAINQTenant aaiNQTenant = new AAINQTenant(); - aaiNQTenant.tenantId = "dhv-test-tenant"; - aaiNQTenant.tenantName = "dhv-test-tenant-name"; - aaiNQTenant.resourceVersion = "1485366334"; + aaiNQTenant.setTenantId("dhv-test-tenant"); + aaiNQTenant.setTenantName("dhv-test-tenant-name"); + aaiNQTenant.setResourceVersion("1485366334"); assertNotNull(aaiNQTenant); - logger.info(Serialization.gsonPretty.toJson(aaiNQTenant)); + assertEquals(aaiNQTenant.getTenantId(), "dhv-test-tenant"); + assertEquals(aaiNQTenant.getTenantName(), "dhv-test-tenant-name"); + assertEquals(aaiNQTenant.getResourceVersion(), "1485366334"); + + logger.info(Serialization.gsonPretty.toJson(aaiNQTenant)); } } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVServerTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVServerTest.java index e8c39e95e..b928e86a6 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVServerTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVServerTest.java @@ -43,15 +43,23 @@ public class AAINQVServerTest { @Test public void test() { AAINQVServer aaiNQVServer = new AAINQVServer(); - aaiNQVServer.vserverId = "dhv-test-vserver"; - aaiNQVServer.vserverName = "dhv-test-vserver-name"; - aaiNQVServer.vserverName2 = "dhv-test-vserver-name2"; - aaiNQVServer.provStatus = "PREPROV"; - aaiNQVServer.vserverSelflink = "dhv-test-vserver-selflink"; - aaiNQVServer.inMaint = false; - aaiNQVServer.isClosedLoopDisabled = false; - aaiNQVServer.resourceVersion = "1485366417"; + aaiNQVServer.setVserverId("dhv-test-vserver"); + aaiNQVServer.setVserverName("dhv-test-vserver-name"); + aaiNQVServer.setVserverName2("dhv-test-vserver-name2"); + aaiNQVServer.setProvStatus("PREPROV"); + aaiNQVServer.setVserverSelflink("dhv-test-vserver-selflink"); + aaiNQVServer.setInMaint(false); + aaiNQVServer.setIsClosedLoopDisabled(false); + aaiNQVServer.setResourceVersion("1485366417"); assertNotNull(aaiNQVServer); + assertEquals(aaiNQVServer.getVserverId(), "dhv-test-vserver"); + assertEquals(aaiNQVServer.getVserverName(), "dhv-test-vserver-name"); + assertEquals(aaiNQVServer.getVserverName2(), "dhv-test-vserver-name2"); + assertEquals(aaiNQVServer.getProvStatus(), "PREPROV"); + assertEquals(aaiNQVServer.getVserverSelflink(), "dhv-test-vserver-selflink"); + assertEquals(aaiNQVServer.getInMaint(), false); + assertEquals(aaiNQVServer.getIsClosedLoopDisabled(), false); + assertEquals(aaiNQVServer.getResourceVersion(), "1485366417"); logger.info(Serialization.gsonPretty.toJson(aaiNQVServer)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVfModuleTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVfModuleTest.java index b4bde7022..21f13d5e8 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVfModuleTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVfModuleTest.java @@ -43,18 +43,33 @@ public class AAINQVfModuleTest { @Test public void test() { AAINQVfModule aaiNQVfModule = new AAINQVfModule(); - aaiNQVfModule.vfModuleId = "example-vf-module-id-val-49261"; - aaiNQVfModule.vfModuleName = "example-vf-module-name-val-73074"; - aaiNQVfModule.heatStackId = "example-heat-stack-id-val-86300"; - aaiNQVfModule.orchestrationStatus = "example-orchestration-status-val-56523"; - aaiNQVfModule.isBaseVfModule = true; - aaiNQVfModule.resourceVersion = "1485366450"; - aaiNQVfModule.personaModelId = "ef86f9c5-2165-44f3-8fc3-96018b609ea5"; - aaiNQVfModule.personaModelVersion = "1.0"; - aaiNQVfModule.widgetModelId = "example-widget-model-id-val-92571"; - aaiNQVfModule.widgetModelVersion = "example-widget-model-version-val-83317"; - aaiNQVfModule.contrailServiceInstanceFqdn = "example-contrail-service-instance-fqdn-val-86796"; + aaiNQVfModule.setVfModuleId("example-vf-module-id-val-49261"); + aaiNQVfModule.setVfModuleName("example-vf-module-name-val-73074"); + aaiNQVfModule.setHeatStackId("example-heat-stack-id-val-86300"); + aaiNQVfModule.setOrchestrationStatus("example-orchestration-status-val-56523"); + aaiNQVfModule.setIsBaseVfModule(true); + aaiNQVfModule.setResourceVersion("1485366450"); + aaiNQVfModule.setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5"); + aaiNQVfModule.setPersonaModelVersion("1.0"); + aaiNQVfModule.setWidgetModelId("example-widget-model-id-val-92571"); + aaiNQVfModule.setWidgetModelVersion("example-widget-model-version-val-83317"); + aaiNQVfModule.setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); + aaiNQVfModule.setModelInvariantId("SomeId"); + aaiNQVfModule.setModelVersionId("SomeVersion"); assertNotNull(aaiNQVfModule); + assertEquals(aaiNQVfModule.getVfModuleId(), "example-vf-module-id-val-49261"); + assertEquals(aaiNQVfModule.getVfModuleName(), "example-vf-module-name-val-73074"); + assertEquals(aaiNQVfModule.getHeatStackId(), "example-heat-stack-id-val-86300"); + assertEquals(aaiNQVfModule.getOrchestrationStatus(), "example-orchestration-status-val-56523"); + assertEquals(aaiNQVfModule.getIsBaseVfModule(), true); + assertEquals(aaiNQVfModule.getResourceVersion(), "1485366450"); + assertEquals(aaiNQVfModule.getPersonaModelId(), "ef86f9c5-2165-44f3-8fc3-96018b609ea5"); + assertEquals(aaiNQVfModule.getPersonaModelVersion(), "1.0"); + assertEquals(aaiNQVfModule.getWidgetModelId(), "example-widget-model-id-val-92571"); + assertEquals(aaiNQVfModule.getWidgetModelVersion(), "example-widget-model-version-val-83317"); + assertEquals(aaiNQVfModule.getContrailServiceInstanceFqdn(), "example-contrail-service-instance-fqdn-val-86796"); + assertEquals(aaiNQVfModule.getModelInvariantId(), "SomeId"); + assertEquals(aaiNQVfModule.getModelVersionId(), "SomeVersion"); logger.info(Serialization.gsonPretty.toJson(aaiNQVfModule)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFInstanceTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFInstanceTest.java index 31243b8d9..a280f546c 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFInstanceTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFInstanceTest.java @@ -44,8 +44,57 @@ public class PNFInstanceTest { PNFInstance pnfInstance = new PNFInstance(); pnfInstance.setPNFInstanceName("pnf-instance-name-test"); pnfInstance.setPNFName("pnf-name-test"); + pnfInstance.setPNFType(PNFType.ENODEB); pnfInstance.setPNFSerial("pnf-serial-test"); assertNotNull(pnfInstance); + assertEquals(pnfInstance.getPNFInstanceName(), "pnf-instance-name-test"); + + PNFInstance pnfInstanceNull = new PNFInstance(null); + assertNotNull(pnfInstanceNull); + + PNFInstance pnfInstanceClone = new PNFInstance(pnfInstance); + assertNotNull(pnfInstanceClone); + + assertEquals("pnf-name-test", pnfInstanceClone.getPNFName()); + assertEquals(PNFType.ENODEB, pnfInstanceClone.getPNFType()); + assertEquals("pnf-serial-test", pnfInstanceClone.getPNFSerial()); + + assertEquals("PNFInstance [PNFName=pnf-name-test, PNFInstanceName=pnf-instance-name-test, PNFType=eNodeB, PNFSerial=pnf-serial-test]", pnfInstanceClone.toString()); + assertNotEquals(0, pnfInstanceClone.hashCode()); + assertNotEquals(0, new PNF().hashCode()); + + PNFInstance pnfInstanceOther0 = new PNFInstance(); + pnfInstanceOther0.setPNFName("pnf-name-test"); + + PNFInstance pnfInstanceOther1 = new PNFInstance(pnfInstance); + pnfInstanceOther1.setPNFName("pnf-name-test-diff"); + + PNFInstance pnfInstanceOther2 = new PNFInstance(pnfInstance); + pnfInstanceOther2.setPNFInstanceName("pnf-instance-name-test-diff"); + + PNFInstance pnfInstanceOther3 = new PNFInstance(pnfInstance); + pnfInstanceOther3.setPNFName(null); + + PNFInstance pnfInstanceOther4 = new PNFInstance(pnfInstance); + pnfInstanceOther4.setPNFSerial(null); + + PNFInstance pnfInstanceOther5 = new PNFInstance(pnfInstance); + pnfInstanceOther5.setPNFSerial("pnf-serial-test-diff"); + + assertTrue(pnfInstance.equals(pnfInstance)); + assertFalse(pnfInstance.equals(null)); + assertFalse(pnfInstance.equals("hello")); + assertTrue(pnfInstance.equals(pnfInstanceClone)); + assertFalse(pnfInstance.equals(new PNF())); + assertFalse(new PNF().equals(pnfInstance)); + assertFalse(new PNF().equals(pnfInstanceOther0)); + assertFalse(pnfInstanceOther0.equals(pnfInstance)); + assertFalse(pnfInstanceOther1.equals(pnfInstance)); + assertFalse(pnfInstanceOther2.equals(pnfInstance)); + assertFalse(pnfInstanceOther3.equals(pnfInstance)); + assertFalse(pnfInstanceOther4.equals(pnfInstance)); + assertFalse(pnfInstanceOther5.equals(pnfInstance)); + logger.info(Serialization.gsonPretty.toJson(pnfInstance)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTest.java index da3593f01..86a037892 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTest.java @@ -45,6 +45,29 @@ public class PNFTest { pnf.setPNFName("pnf-name-test"); pnf.setPNFType(PNFType.ENODEB); assertNotNull(pnf); + + PNF pnfClone = new PNF(pnf); + assertNotNull(pnfClone); + + assertEquals("pnf-name-test", pnfClone.getPNFName()); + assertEquals(PNFType.ENODEB, pnfClone.getPNFType()); + + assertEquals("PNF [PNFName=pnf-name-test, PNFType=eNodeB]", pnfClone.toString()); + assertNotEquals(0, pnfClone.hashCode()); + assertNotEquals(0, new PNF().hashCode()); + + PNF pnfOther = new PNF(); + pnfOther.setPNFName("pnf-name-test"); + + assertTrue(pnf.equals(pnf)); + assertFalse(pnf.equals(null)); + assertFalse(pnf.equals("hello")); + assertTrue(pnf.equals(pnfClone)); + assertFalse(pnf.equals(new PNF())); + assertFalse(new PNF().equals(pnf)); + assertFalse(new PNF().equals(pnfOther)); + assertFalse(pnfOther.equals(pnf)); + logger.info(Serialization.gsonPretty.toJson(pnf)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTypeTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTypeTest.java index e4c5acc12..7081b0e7e 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTypeTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTypeTest.java @@ -44,6 +44,7 @@ public class PNFTypeTest { public void test() { PNFType pnfType = PNFType.ENODEB; assertNotNull(pnfType); + assertNotNull(pnfType.toString()); logger.info(Serialization.gsonPretty.toJson(pnfType)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyItemTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyItemTest.java index 8a35c42ab..a240570d3 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyItemTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyItemTest.java @@ -42,8 +42,8 @@ public class RelatedToPropertyItemTest { @Test public void test() { RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); - relatedToPropertyItem.propertyKey = "model.model-name"; - relatedToPropertyItem.propertyValue = "service-instance"; + relatedToPropertyItem.setPropertyKey("model.model-name"); + relatedToPropertyItem.setPropertyValue("service-instance"); assertNotNull(relatedToPropertyItem); logger.info(Serialization.gsonPretty.toJson(relatedToPropertyItem)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java index 1b0692944..05b72ed6a 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java @@ -43,14 +43,18 @@ public class RelatedToPropertyTest { public void test() { RelatedToProperty relatedToProperty = new RelatedToProperty(); RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); - relatedToPropertyItem.propertyKey = "model.model-name"; - relatedToPropertyItem.propertyValue = "service-instance"; + relatedToPropertyItem.setPropertyKey("model.model-name"); + relatedToPropertyItem.setPropertyValue("service-instance"); relatedToProperty.getRelatedTo().add(relatedToPropertyItem); RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem(); - relatedToPropertyItem2.propertyKey = "model.model-name2"; - relatedToPropertyItem2.propertyValue = "service-instance2"; + relatedToPropertyItem2.setPropertyKey("model.model-name2"); + relatedToPropertyItem2.setPropertyValue("service-instance2"); relatedToProperty.getRelatedTo().add(relatedToPropertyItem2); - assertNotNull(relatedToProperty); + assertNotNull(relatedToProperty); + + relatedToProperty.setRelatedTo(relatedToProperty.getRelatedTo()); + assertNotNull(relatedToProperty); + logger.info(Serialization.gsonPretty.toJson(relatedToProperty)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataItemTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataItemTest.java index dbdce2515..38727b7b5 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataItemTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataItemTest.java @@ -38,8 +38,8 @@ public class RelationshipDataItemTest { @Test public void test() { RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.relationshipKey = "relationship-key"; - relationshipDataItem.relationshipValue = "relationship-value"; + relationshipDataItem.setRelationshipKey("relationship-key"); + relationshipDataItem.setRelationshipValue("relationship-value"); assertNotNull(relationshipDataItem); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java index 5498caeac..b25d3e473 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java @@ -43,15 +43,22 @@ public class RelationshipDataTest { public void test() { RelationshipData relationshipData = new RelationshipData(); RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.relationshipKey = "relationship-key"; - relationshipDataItem.relationshipValue = "relationship-value"; + relationshipDataItem.setRelationshipKey("relationship-key"); + relationshipDataItem.setRelationshipValue("relationship-value"); assertNotNull(relationshipDataItem); + assertEquals(relationshipDataItem.getRelationshipKey(), "relationship-key"); + assertEquals(relationshipDataItem.getRelationshipValue(), "relationship-value"); + relationshipData.getRelationshipData().add(relationshipDataItem); RelationshipDataItem relationshipDataItem2 = new RelationshipDataItem(); - relationshipDataItem2.relationshipKey = "relationship-key2"; - relationshipDataItem2.relationshipValue = "relationship-value2"; + relationshipDataItem2.setRelationshipKey("relationship-key2"); + relationshipDataItem2.setRelationshipValue("relationship-value2"); relationshipData.getRelationshipData().add(relationshipDataItem2); - assertNotNull(relationshipData); + assertNotNull(relationshipData); + + relationshipData.setRelationshipData(relationshipData.getRelationshipData()); + assertNotNull(relationshipData); + logger.info(Serialization.gsonPretty.toJson(relationshipData)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipItemTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipItemTest.java index 4313e0605..625592e76 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipItemTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipItemTest.java @@ -43,10 +43,14 @@ public class RelationshipItemTest { public void test() { RelationshipItem relationshipItem = new RelationshipItem(); RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); - relatedToPropertyItem.propertyKey = "model.model-name"; - relatedToPropertyItem.propertyValue = "service-instance"; + relatedToPropertyItem.setPropertyKey("model.model-name"); + relatedToPropertyItem.setPropertyValue("service-instance"); relationshipItem.getRelatedToProperty().add(relatedToPropertyItem); assertNotNull(relationshipItem); + + relationshipItem.setRelatedToProperty(relationshipItem.getRelatedToProperty()); + assertNotNull(relationshipItem); + logger.info(Serialization.gsonPretty.toJson(relationshipItem)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java index 3d06b0e6b..a5a7d90d0 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java @@ -43,27 +43,34 @@ public class RelationshipListTest { public void test() { RelationshipList relationshipList = new RelationshipList(); Relationship relationship = new Relationship(); - relationship.relatedLink = "related-link"; - relationship.relatedTo = "related-to"; + relationship.setRelatedLink("related-link"); + relationship.setRelatedTo("related-to"); + assertEquals(relationship.getRelatedLink(), "related-link"); + assertEquals(relationship.getRelatedTo(), "related-to"); + RelatedToProperty relatedToProperty = new RelatedToProperty(); RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); - relatedToPropertyItem.propertyKey = "model.model-name"; - relatedToPropertyItem.propertyValue = "service-instance"; + relatedToPropertyItem.setPropertyKey("model.model-name"); + relatedToPropertyItem.setPropertyValue("service-instance"); relatedToProperty.getRelatedTo().add(relatedToPropertyItem); RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem(); - relatedToPropertyItem2.propertyKey = "model.model-name2"; - relatedToPropertyItem2.propertyValue = "service-instance2"; + relatedToPropertyItem2.setPropertyKey("model.model-name2"); + relatedToPropertyItem2.setPropertyValue("service-instance2"); relatedToProperty.getRelatedTo().add(relatedToPropertyItem2); - relationship.relatedToProperty = relatedToProperty; + relationship.setRelatedToProperty(relatedToProperty); RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.relationshipKey = "relationship-key"; - relationshipDataItem.relationshipValue = "relationship-value"; + relationshipDataItem.setRelationshipKey("relationship-key"); + relationshipDataItem.setRelationshipValue("relationship-value"); RelationshipData relationshipData = new RelationshipData(); relationshipData.getRelationshipData().add(relationshipDataItem); - relationship.relationshipData = relationshipData; + relationship.setRelationshipData(relationshipData); relationshipList.getRelationshipList().add(relationship); - assertNotNull(relationshipList); + assertNotNull(relationshipList); + + relationshipList.setRelationshipList(relationshipList.getRelationshipList()); + assertNotNull(relationshipList); + logger.info(Serialization.gsonPretty.toJson(relationshipList)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java index ec55069ca..3f899eb9b 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java @@ -42,24 +42,29 @@ public class RelationshipTest { @Test public void test() { Relationship relationship = new Relationship(); - relationship.relatedLink = "related-link"; - relationship.relatedTo = "related-to"; + relationship.setRelatedLink("related-link"); + relationship.setRelatedTo("related-to"); + assertEquals(relationship.getRelatedLink(), "related-link"); + assertEquals(relationship.getRelatedTo(), "related-to"); + RelatedToProperty relatedToProperty = new RelatedToProperty(); RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); - relatedToPropertyItem.propertyKey = "model.model-name"; - relatedToPropertyItem.propertyValue = "service-instance"; + relatedToPropertyItem.setPropertyKey("model.model-name"); + relatedToPropertyItem.setPropertyValue("service-instance"); relatedToProperty.getRelatedTo().add(relatedToPropertyItem); RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem(); - relatedToPropertyItem2.propertyKey = "model.model-name2"; - relatedToPropertyItem2.propertyValue = "service-instance2"; + relatedToPropertyItem2.setPropertyKey("model.model-name2"); + relatedToPropertyItem2.setPropertyValue("service-instance2"); relatedToProperty.getRelatedTo().add(relatedToPropertyItem2); - relationship.relatedToProperty = relatedToProperty; + relationship.setRelatedToProperty(relatedToProperty); + assertEquals(relationship.getRelatedToProperty(), relatedToProperty); RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.relationshipKey = "relationship-key"; - relationshipDataItem.relationshipValue = "relationship-value"; + relationshipDataItem.setRelationshipKey("relationship-key"); + relationshipDataItem.setRelationshipValue("relationship-value"); RelationshipData relationshipData = new RelationshipData(); relationshipData.getRelationshipData().add(relationshipDataItem); - relationship.relationshipData = relationshipData; + relationship.setRelationshipData(relationshipData); + assertEquals(relationship.getRelationshipData(), relationshipData); assertNotNull(relationship); logger.info(Serialization.gsonPretty.toJson(relationship)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/util/AAIExceptionTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/util/AAIExceptionTest.java new file mode 100644 index 000000000..2a7beb499 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/util/AAIExceptionTest.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.policy.aai.util; + +import static org.junit.Assert.*; + +import java.io.IOException; + +import org.junit.Test; + +public class AAIExceptionTest { + + @Test + public void test() { + assertNotNull(new AAIException()); + assertNotNull(new AAIException("message")); + assertNotNull(new AAIException("message", new IOException())); + assertNotNull(new AAIException("message", new IOException(), true, false)); + assertNotNull(new AAIException(new IOException())); + } + +} diff --git a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java index e2d140c03..c74a75cbe 100644 --- a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java +++ b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RESTManager.java @@ -37,11 +37,11 @@ import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public final class RESTManager { +public class RESTManager { private static final Logger logger = LoggerFactory.getLogger(RESTManager.class); - public static class Pair { + public class Pair { public final A a; public final B b; @@ -51,7 +51,7 @@ public final class RESTManager { } } - public static Pair post(String url, String username, String password, Map headers, String contentType, String body) { + public Pair post(String url, String username, String password, Map headers, String contentType, String body) { CredentialsProvider credentials = new BasicCredentialsProvider(); credentials.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password)); @@ -96,7 +96,7 @@ public final class RESTManager { } } - public static Pair get(String url, String username, String password, Map headers) { + public Pair get(String url, String username, String password, Map headers) { CredentialsProvider credentials = new BasicCredentialsProvider(); credentials.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password)); diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java index 4ac98054f..e4d8af883 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java @@ -61,7 +61,7 @@ public final class SOManager { // String requestJson = Serialization.gsonPretty.toJson(request); netLogger.info("[OUT|{}|{}|]{}{}", "SO", url, System.lineSeparator(), requestJson); - Pair httpDetails = RESTManager.post(url, username, password, headers, "application/json", requestJson); + Pair httpDetails = new RESTManager().post(url, username, password, headers, "application/json", requestJson); if (httpDetails == null) { return null; @@ -84,7 +84,7 @@ public final class SOManager { while(attemptsLeft-- > 0){ - Pair httpDetailsGet = RESTManager.get(urlGet, username, password, headers); + Pair httpDetailsGet = new RESTManager().get(urlGet, username, password, headers); responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.b, SOResponse.class); netLogger.info("[IN|{}|{}|]{}{}", "SO", urlGet, System.lineSeparator(), httpDetailsGet.b); @@ -163,7 +163,7 @@ public final class SOManager { SOResponse so = new SOResponse(); netLogger.info("[OUT|{}|{}|]{}{}", "SO", url, System.lineSeparator(), soJson); - Pair httpResponse = RESTManager.post(url, "policy", "policy", headers, "application/json", soJson); + Pair httpResponse = new RESTManager().post(url, "policy", "policy", headers, "application/json", soJson); if (httpResponse != null ) { if (httpResponse.b != null && httpResponse.a != null) { diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java index ebc3ad6cb..c951984bd 100644 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java +++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VFCManager.java @@ -78,7 +78,7 @@ public final class VFCManager implements Runnable { String vfcRequestJson = Serialization.gsonPretty.toJson(vfcRequest); netLogger.info("[OUT|{}|{}|]{}{}", "VFC", vfcUrl, System.lineSeparator(), vfcRequestJson); - httpDetails = RESTManager.post(vfcUrl, username, password, headers, + httpDetails = new RESTManager().post(vfcUrl, username, password, headers, "application/json", vfcRequestJson); } catch (Exception e) { logger.error(e.getMessage(), e); @@ -108,7 +108,7 @@ public final class VFCManager implements Runnable { while (attemptsLeft-- > 0) { netLogger.info("[OUT|{}|{}|]", "VFC", urlGet); - Pair httpDetailsGet = RESTManager.get(urlGet, username, password, headers); + Pair httpDetailsGet = new RESTManager().get(urlGet, username, password, headers); responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.b, VFCResponse.class); netLogger.info("[IN|{}|{}|]{}{}", "VFC", urlGet, System.lineSeparator(), httpDetailsGet.b); responseGet.requestId = vfcRequest.requestId.toString(); diff --git a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java index 2f511f4bc..c6b22cf70 100644 --- a/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java +++ b/controlloop/common/simulators/src/main/java/org/onap/policy/simulators/AaiSimulatorJaxRs.java @@ -52,9 +52,9 @@ public class AaiSimulatorJaxRs { { AAINQRequest request = Serialization.gsonPretty.fromJson(req, AAINQRequest.class); - if (request.instanceFilters.getInstanceFilter().get(0).containsKey("vserver")) + if (request.getInstanceFilters().getInstanceFilter().get(0).containsKey("vserver")) { - String vserverName = request.instanceFilters.getInstanceFilter().get(0).get("vserver").get("vserver-name"); + String vserverName = request.getInstanceFilters().getInstanceFilter().get(0).get("vserver").get("vserver-name"); if ("error".equals(vserverName)) { return "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3001\",\"text\":\"Resource not found for %1 using id %2 (msg=%3) (ec=%4)\",\"variables\":[\"POST Search\",\"getNamedQueryResponse\",\"Node Not Found:No Node of type vserver found for properties\",\"ERR.5.4.6114\"]}}}"; } @@ -66,7 +66,7 @@ public class AaiSimulatorJaxRs { } else { - String vnfID = request.instanceFilters.getInstanceFilter().get(0).get("generic-vnf").get("vnf-id"); + String vnfID = request.getInstanceFilters().getInstanceFilter().get(0).get("generic-vnf").get("vnf-id"); if ("error".equals(vnfID)) { return "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3001\",\"text\":\"Resource not found for %1 using id %2 (msg=%3) (ec=%4)\",\"variables\":[\"POST Search\",\"getNamedQueryResponse\",\"Node Not Found:No Node of type generic-vnf found for properties\",\"ERR.5.4.6114\"]}}}"; } diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java index 66c65ff82..86168e899 100644 --- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java +++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java @@ -41,6 +41,7 @@ import org.onap.policy.aai.AAINQRequest; import org.onap.policy.aai.AAINQResponse; import org.onap.policy.drools.http.server.HttpServletServer; import org.onap.policy.drools.utils.LoggerUtil; +import org.onap.policy.rest.RESTManager; public class AaiSimulatorTest { @@ -62,11 +63,11 @@ public class AaiSimulatorTest { @Test public void testGet() { - final AAIGETVnfResponse response = AAIManager.getQueryByVnfID( + final AAIGETVnfResponse response = new AAIManager(new RESTManager()).getQueryByVnfID( "http://localhost:6666/aai/v11/network/generic-vnfs/generic-vnf/", "testUser", "testPass", UUID.randomUUID(), "5e49ca06-2972-4532-9ed4-6d071588d792"); assertNotNull(response); - assertNotNull(response.relationshipList); + assertNotNull(response.getRelationshipList()); } @Test @@ -74,9 +75,9 @@ public class AaiSimulatorTest { final AAINQRequest request = new AAINQRequest(); final AAINQQueryParameters tempQueryParameters = new AAINQQueryParameters(); final AAINQNamedQuery tempNamedQuery = new AAINQNamedQuery(); - tempNamedQuery.namedQueryUUID = UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469"); - tempQueryParameters.namedQuery = tempNamedQuery; - request.queryParameters = tempQueryParameters; + tempNamedQuery.setNamedQueryUUID(UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469")); + tempQueryParameters.setNamedQuery(tempNamedQuery); + request.setQueryParameters(tempQueryParameters); Map tempInnerMap = new HashMap<>(); tempInnerMap.put("vserver-name", "vserver-name-16102016-aai3255-data-11-1"); Map> tempOuterMap = new HashMap<>(); @@ -85,16 +86,16 @@ public class AaiSimulatorTest { tempInstanceFilter.add(tempOuterMap); AAINQInstanceFilters tempInstanceFilters = new AAINQInstanceFilters(); tempInstanceFilters.setInstanceFilter(tempInstanceFilter); - request.instanceFilters = tempInstanceFilters; + request.setInstanceFilters(tempInstanceFilters); - AAINQResponse response = AAIManager.postQuery("http://localhost:6666", "testUser", "testPass", + AAINQResponse response = new AAIManager(new RESTManager()).postQuery("http://localhost:6666", "testUser", "testPass", request, UUID.randomUUID()); assertNotNull(response); assertNotNull(response.getInventoryResponseItems()); - tempNamedQuery.namedQueryUUID = UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087"); - tempQueryParameters.namedQuery = tempNamedQuery; - request.queryParameters = tempQueryParameters; + tempNamedQuery.setNamedQueryUUID(UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087")); + tempQueryParameters.setNamedQuery(tempNamedQuery); + request.setQueryParameters(tempQueryParameters); tempInnerMap = new HashMap<>(); tempInnerMap.put("vnf-id", "de7cc3ab-0212-47df-9e64-da1c79234deb"); tempOuterMap = new HashMap<>(); @@ -103,9 +104,9 @@ public class AaiSimulatorTest { tempInstanceFilter.add(tempOuterMap); tempInstanceFilters = new AAINQInstanceFilters(); tempInstanceFilters.setInstanceFilter(tempInstanceFilter); - request.instanceFilters = tempInstanceFilters; + request.setInstanceFilters(tempInstanceFilters); - response = AAIManager.postQuery("http://localhost:6666", "testUser", "testPass", request, + response = new AAIManager(new RESTManager()).postQuery("http://localhost:6666", "testUser", "testPass", request, UUID.randomUUID()); assertNotNull(response); assertNotNull(response.getInventoryResponseItems()); diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java index 86e2c8cf9..ea13ec445 100644 --- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java +++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java @@ -54,14 +54,14 @@ public class GuardSimulatorTest { public void testGuard() { String request = makeRequest("test_actor_id", "test_op_id", "test_target", "test_clName"); String url = "http://localhost:" + Util.GUARDSIM_SERVER_PORT + "/pdp/api/getDecision"; - Pair response = RESTManager.post(url, "testUname", "testPass", null, "application/json", request); + Pair response = new RESTManager().post(url, "testUname", "testPass", null, "application/json", request); assertNotNull(response); assertNotNull(response.a); assertNotNull(response.b); assertEquals("{\"decision\": \"PERMIT\", \"details\": \"Decision Permit. OK!\"}", response.b); request = makeRequest("test_actor_id", "test_op_id", "test_target", "denyGuard"); - response = RESTManager.post(url, "testUname", "testPass", null, "application/json", request); + response = new RESTManager().post(url, "testUname", "testPass", null, "application/json", request); assertNotNull(response); assertNotNull(response.a); assertNotNull(response.b); diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java index 3aaf1dc55..8054d214a 100644 --- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java +++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java @@ -138,7 +138,7 @@ public class SoSimulatorTest { @Test public void testResponse() { final String request = Serialization.gsonPretty.toJson(this.createTestRequest()); - final Pair httpDetails = RESTManager.post( + final Pair httpDetails = new RESTManager().post( "http://localhost:6667/serviceInstances/v5/12345/vnfs/12345/vfModules", "username", "password", new HashMap<>(), "application/json", request); assertNotNull(httpDetails); diff --git a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java index a063277ed..4c29331bf 100644 --- a/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java +++ b/controlloop/common/simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java @@ -57,7 +57,7 @@ public class VfcSimulatorTest { @Test public void testPost() { final Pair httpDetails = - RESTManager.post("http://localhost:6668/api/nslcm/v1/ns/1234567890/heal", "username", + new RESTManager().post("http://localhost:6668/api/nslcm/v1/ns/1234567890/heal", "username", "password", new HashMap(), "application/json", "Some Request Here"); assertNotNull(httpDetails); assertTrue(httpDetails.a == 202); @@ -69,7 +69,7 @@ public class VfcSimulatorTest { @Test public void testGet() { final Pair httpDetails = - RESTManager.get("http://localhost:6668/api/nslcm/v1/jobs/1234", "username", "password", + new RESTManager().get("http://localhost:6668/api/nslcm/v1/jobs/1234", "username", "password", new HashMap()); assertNotNull(httpDetails); final VFCResponse response = -- cgit 1.2.3-korg