From 10b21aae2bde224ab7f91f4b5ab1b89369c8fd1c Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Wed, 8 May 2019 14:33:57 -0400 Subject: Add payload to vFW policy yaml Added new "streams" payload to vFW policy yaml files. Removed references to pg-streams. Also deleted directories that were moved to policy/models. Also removed references to trafficgenerator. Updated licenses. Removed some trailing whitespace. Change-Id: I6becaa573628eee677f0959fadf86f9a9f032f88 Issue-ID: POLICY-1752 Signed-off-by: Jim Hahn --- controlloop/common/model-impl/aai/pom.xml | 66 ---- .../java/org/onap/policy/aai/AaiGetResponse.java | 41 --- .../org/onap/policy/aai/AaiGetVnfResponse.java | 151 -------- .../org/onap/policy/aai/AaiGetVserverResponse.java | 43 --- .../main/java/org/onap/policy/aai/AaiManager.java | 234 ------------ .../java/org/onap/policy/aai/AaiNqCloudRegion.java | 85 ----- .../org/onap/policy/aai/AaiNqExtraProperties.java | 42 --- .../org/onap/policy/aai/AaiNqExtraProperty.java | 59 --- .../java/org/onap/policy/aai/AaiNqGenericVnf.java | 227 ------------ .../org/onap/policy/aai/AaiNqInstanceFilters.java | 44 --- .../policy/aai/AaiNqInventoryResponseItem.java | 129 ------- .../policy/aai/AaiNqInventoryResponseItems.java | 42 --- .../java/org/onap/policy/aai/AaiNqNamedQuery.java | 41 --- .../org/onap/policy/aai/AaiNqQueryParameters.java | 40 -- .../java/org/onap/policy/aai/AaiNqRequest.java | 51 --- .../org/onap/policy/aai/AaiNqRequestError.java | 40 -- .../java/org/onap/policy/aai/AaiNqResponse.java | 53 --- .../org/onap/policy/aai/AaiNqResponseWrapper.java | 152 -------- .../org/onap/policy/aai/AaiNqServiceExcept.java | 50 --- .../org/onap/policy/aai/AaiNqServiceInstance.java | 117 ------ .../main/java/org/onap/policy/aai/AaiNqTenant.java | 64 ---- .../java/org/onap/policy/aai/AaiNqVServer.java | 129 ------- .../java/org/onap/policy/aai/AaiNqVfModule.java | 182 --------- .../aai/src/main/java/org/onap/policy/aai/Pnf.java | 91 ----- .../main/java/org/onap/policy/aai/PnfInstance.java | 137 ------- .../src/main/java/org/onap/policy/aai/PnfType.java | 36 -- .../org/onap/policy/aai/RelatedToProperty.java | 50 --- .../java/org/onap/policy/aai/Relationship.java | 75 ---- .../java/org/onap/policy/aai/RelationshipData.java | 50 --- .../java/org/onap/policy/aai/RelationshipList.java | 44 --- .../org/onap/policy/aai/util/AaiException.java | 47 --- .../org/onap/policy/aai/util/Serialization.java | 33 -- .../org/onap/policy/aai/AaiGetResponseTest.java | 61 ---- .../org/onap/policy/aai/AaiGetVnfResponseTest.java | 107 ------ .../onap/policy/aai/AaiGetVserverResponseTest.java | 77 ---- .../java/org/onap/policy/aai/AaiManagerTest.java | 169 --------- .../org/onap/policy/aai/AaiNqCloudRegionTest.java | 53 --- .../onap/policy/aai/AaiNqExtraPropertiesTest.java | 50 --- .../onap/policy/aai/AaiNqExtraPropertyTest.java | 48 --- .../org/onap/policy/aai/AaiNqGenericVnfTest.java | 81 ----- .../onap/policy/aai/AaiNqInstanceFiltersTest.java | 47 --- .../policy/aai/AaiNqInventoryResponseItemTest.java | 170 --------- .../aai/AaiNqInventoryResponseItemsTest.java | 163 --------- .../org/onap/policy/aai/AaiNqNamedQueryTest.java | 48 --- .../onap/policy/aai/AaiNqQueryParametersTest.java | 50 --- .../org/onap/policy/aai/AaiNqRequestErrorTest.java | 41 --- .../java/org/onap/policy/aai/AaiNqRequestTest.java | 68 ---- .../org/onap/policy/aai/AaiNqResponseTest.java | 160 -------- .../onap/policy/aai/AaiNqResponseWrapperTest.java | 261 ------------- .../onap/policy/aai/AaiNqServiceInstanceTest.java | 65 ---- .../java/org/onap/policy/aai/AaiNqTenantTest.java | 56 --- .../java/org/onap/policy/aai/AaiNqVServerTest.java | 101 ----- .../org/onap/policy/aai/AaiNqVfModuleTest.java | 79 ---- .../java/org/onap/policy/aai/PnfInstanceTest.java | 105 ------ .../src/test/java/org/onap/policy/aai/PnfTest.java | 77 ---- .../test/java/org/onap/policy/aai/PnfTypeTest.java | 50 --- .../org/onap/policy/aai/RelatedToPropertyTest.java | 56 --- .../org/onap/policy/aai/RelationshipDataTest.java | 56 --- .../org/onap/policy/aai/RelationshipListTest.java | 66 ---- .../java/org/onap/policy/aai/RelationshipTest.java | 88 ----- .../org/onap/policy/aai/util/AaiExceptionTest.java | 40 -- .../org/onap/policy/aai/AaiGetResponseError.json | 14 - .../org/onap/policy/aai/AaiGetVnfResponse.json | 123 ------- .../org/onap/policy/aai/AaiGetVserverResponse.json | 82 ----- .../policy/aai/AaiNqResponseWrapper-NoItems.json | 96 ----- .../policy/aai/AaiNqResponseWrapper-NoModules.json | 133 ------- .../policy/aai/AaiNqResponseWrapper-NoNames.json | 133 ------- .../policy/aai/AaiNqResponseWrapper-Vserver.json | 157 -------- .../org/onap/policy/aai/AaiNqVServer.json | 78 ---- .../org/onap/policy/aai/RelatedToProperty.json | 4 - .../org/onap/policy/aai/Relationship.json | 25 -- .../org/onap/policy/aai/RelationshipData.json | 4 - .../org/onap/policy/aai/RelationshipList.json | 68 ---- controlloop/common/model-impl/appc/pom.xml | 45 --- .../java/org/onap/policy/appc/CommonHeader.java | 216 ----------- .../main/java/org/onap/policy/appc/Request.java | 165 --------- .../main/java/org/onap/policy/appc/Response.java | 136 ------- .../java/org/onap/policy/appc/ResponseCode.java | 68 ---- .../java/org/onap/policy/appc/ResponseStatus.java | 110 ------ .../java/org/onap/policy/appc/ResponseValue.java | 70 ---- .../org/onap/policy/appc/util/Serialization.java | 85 ----- .../appc/src/main/resources/definitions.yaml | 118 ------ .../org/onap/policy/appc/CommonHeaderTest.java | 178 --------- .../test/java/org/onap/policy/appc/EnumsTest.java | 74 ---- .../java/org/onap/policy/appc/RequestTest.java | 124 ------- .../org/onap/policy/appc/ResponseStatusTest.java | 88 ----- .../java/org/onap/policy/appc/ResponseTest.java | 104 ------ .../onap/policy/appc/util/SerializationTest.java | 56 --- controlloop/common/model-impl/appclcm/pom.xml | 45 --- .../org/onap/policy/appclcm/LcmCommonHeader.java | 256 ------------- .../java/org/onap/policy/appclcm/LcmRequest.java | 175 --------- .../org/onap/policy/appclcm/LcmRequestWrapper.java | 95 ----- .../java/org/onap/policy/appclcm/LcmResponse.java | 161 -------- .../org/onap/policy/appclcm/LcmResponseCode.java | 64 ---- .../org/onap/policy/appclcm/LcmResponseStatus.java | 116 ------ .../onap/policy/appclcm/LcmResponseWrapper.java | 90 ----- .../java/org/onap/policy/appclcm/LcmWrapper.java | 208 ----------- .../onap/policy/appclcm/util/Serialization.java | 113 ------ .../onap/policy/appclcm/util/StatusCodeEnum.java | 89 ----- .../appclcm/src/main/resources/definitions.yaml | 118 ------ .../java/org/onap/policy/appclcm/AppcLcmTest.java | 232 ------------ .../onap/policy/appclcm/LcmCommonHeaderTest.java | 143 -------- .../org/onap/policy/appclcm/LcmRequestTest.java | 111 ------ .../onap/policy/appclcm/LcmRequestWrapperTest.java | 66 ---- .../onap/policy/appclcm/LcmResonseCodeTest.java | 55 --- .../onap/policy/appclcm/LcmResponseStatusTest.java | 74 ---- .../org/onap/policy/appclcm/LcmResponseTest.java | 113 ------ .../policy/appclcm/LcmResponseWrapperTest.java | 65 ---- .../org/onap/policy/appclcm/LcmWrapperTest.java | 115 ------ .../policy/appclcm/util/SerializationTest.java | 57 --- controlloop/common/model-impl/events/README.md | 11 - controlloop/common/model-impl/events/pom.xml | 44 --- .../onap/policy/controlloop/ControlLoopEvent.java | 192 ---------- .../policy/controlloop/ControlLoopEventStatus.java | 59 --- .../controlloop/ControlLoopNotification.java | 190 ---------- .../controlloop/ControlLoopNotificationType.java | 73 ---- .../policy/controlloop/ControlLoopOperation.java | 229 ------------ .../controlloop/ControlLoopOperationWrapper.java | 54 --- .../policy/controlloop/ControlLoopResponse.java | 142 -------- .../policy/controlloop/ControlLoopTargetType.java | 59 --- .../controlloop/PhysicalControlLoopEvent.java | 36 -- .../PhysicalControlLoopNotification.java | 37 -- .../controlloop/VirtualControlLoopEvent.java | 85 ----- .../VirtualControlLoopNotification.java | 84 ----- .../controlloop/params/ControlLoopParams.java | 92 ----- .../policy/controlloop/util/Serialization.java | 125 ------- .../events/src/main/resources/definitions.yaml | 127 ------- .../controlloop/ControlLoopEventStatusTest.java | 41 --- .../policy/controlloop/ControlLoopEventTest.java | 96 ----- .../controlloop/ControlLoopNotificationTest.java | 117 ------ .../ControlLoopNotificationTypeTest.java | 49 --- .../controlloop/ControlLoopOperationTest.java | 89 ----- .../ControlLoopOperationWrapperTest.java | 50 --- .../controlloop/ControlLoopResponseTest.java | 65 ---- .../controlloop/ControlLoopTargetTypeTest.java | 39 -- .../controlloop/PhysicalControlLoopEventTest.java | 37 -- .../PhysicalControlLoopNotificationTest.java | 38 -- .../controlloop/VirtualControlLoopEventTest.java | 49 --- .../VirtualControlLoopNotificationTest.java | 58 --- .../controlloop/params/ControlLoopParamsTest.java | 50 --- controlloop/common/model-impl/pom.xml | 49 --- controlloop/common/model-impl/rest/pom.xml | 90 ----- .../org/onap/policy/rest/HttpDeleteWithBody.java | 52 --- .../java/org/onap/policy/rest/RestManager.java | 192 ---------- .../test/java/org/onap/policy/rest/GetTest.java | 66 ---- .../onap/policy/rest/HttpDeleteWithBodyTest.java | 36 -- .../test/java/org/onap/policy/rest/PairTest.java | 42 --- .../test/java/org/onap/policy/rest/PostTest.java | 50 --- .../model-impl/sdc/checkstyle-suppressions.xml | 30 -- controlloop/common/model-impl/sdc/pom.xml | 81 ----- .../main/java/org/onap/policy/sdc/Resource.java | 188 ---------- .../java/org/onap/policy/sdc/ResourceInstance.java | 178 --------- .../java/org/onap/policy/sdc/ResourceType.java | 41 --- .../src/main/java/org/onap/policy/sdc/Service.java | 166 --------- .../java/org/onap/policy/sdc/ServiceInstance.java | 201 ---------- .../sdc/src/main/resources/definitions.yaml | 89 ----- .../org/onap/policy/sdc/ResourceInstanceTest.java | 155 -------- .../java/org/onap/policy/sdc/ResourceTest.java | 152 -------- .../org/onap/policy/sdc/ServiceInstanceTest.java | 170 --------- .../test/java/org/onap/policy/sdc/ServiceTest.java | 137 ------- .../sdc/src/test/resources/service_trinity.yaml | 16 - .../sdc/src/test/resources/service_vSCP.yaml | 15 - .../sdc/src/test/resources/service_vUSP.yaml | 15 - controlloop/common/model-impl/sdnc/pom.xml | 72 ---- .../org/onap/policy/sdnc/SdncHealNetworkInfo.java | 43 --- .../java/org/onap/policy/sdnc/SdncHealRequest.java | 98 ----- .../policy/sdnc/SdncHealRequestHeaderInfo.java | 54 --- .../org/onap/policy/sdnc/SdncHealRequestInfo.java | 43 --- .../org/onap/policy/sdnc/SdncHealServiceInfo.java | 43 --- .../policy/sdnc/SdncHealVfModuleParameter.java | 54 --- .../sdnc/SdncHealVfModuleParametersInfo.java | 50 --- .../policy/sdnc/SdncHealVfModuleRequestInput.java | 43 --- .../java/org/onap/policy/sdnc/SdncHealVnfInfo.java | 43 --- .../java/org/onap/policy/sdnc/SdncManager.java | 167 --------- .../java/org/onap/policy/sdnc/SdncRequest.java | 72 ---- .../java/org/onap/policy/sdnc/SdncResponse.java | 54 --- .../onap/policy/sdnc/SdncResponseNetworkInfo.java | 54 --- .../org/onap/policy/sdnc/SdncResponseOutput.java | 67 ---- .../onap/policy/sdnc/SdncResponseServiceInfo.java | 44 --- .../org/onap/policy/sdnc/util/Serialization.java | 32 -- .../test/java/org/onap/policy/sdnc/DemoTest.java | 71 ---- .../policy/sdnc/SdncHealAdditionalParamsTest.java | 47 --- .../org/onap/policy/sdnc/SdncHealRequestTest.java | 43 --- .../onap/policy/sdnc/SdncHealServiceInfoTest.java | 43 --- .../java/org/onap/policy/sdnc/SdncManagerTest.java | 283 -------------- .../java/org/onap/policy/sdnc/SdncRequestTest.java | 53 --- .../policy/sdnc/SdncResponseDescriptorTest.java | 54 --- .../org/onap/policy/sdnc/SdncResponseTest.java | 48 --- .../onap/policy/sdnc/util/SerializationTest.java | 35 -- controlloop/common/model-impl/sdnr/pom.xml | 45 --- .../java/org/onap/policy/sdnr/PciCommonHeader.java | 264 -------------- .../main/java/org/onap/policy/sdnr/PciRequest.java | 143 -------- .../org/onap/policy/sdnr/PciRequestWrapper.java | 96 ----- .../java/org/onap/policy/sdnr/PciResponse.java | 159 -------- .../java/org/onap/policy/sdnr/PciResponseCode.java | 64 ---- .../org/onap/policy/sdnr/PciResponseWrapper.java | 91 ----- .../main/java/org/onap/policy/sdnr/PciWrapper.java | 213 ----------- .../src/main/java/org/onap/policy/sdnr/Status.java | 106 ------ .../org/onap/policy/sdnr/util/Serialization.java | 115 ------ .../org/onap/policy/sdnr/util/StatusCodeEnum.java | 90 ----- .../sdnr/src/main/resources/definitions.yaml | 119 ------ .../org/onap/policy/sdnr/PciCommonHeaderTest.java | 144 -------- .../java/org/onap/policy/sdnr/PciRequestTest.java | 92 ----- .../onap/policy/sdnr/PciRequestWrapperTest.java | 66 ---- .../org/onap/policy/sdnr/PciResponseCodeTest.java | 55 --- .../java/org/onap/policy/sdnr/PciResponseTest.java | 117 ------ .../onap/policy/sdnr/PciResponseWrapperTest.java | 66 ---- .../java/org/onap/policy/sdnr/PciStatusTest.java | 74 ---- .../java/org/onap/policy/sdnr/PciWrapperTest.java | 115 ------ .../test/java/org/onap/policy/sdnr/SdnrTest.java | 215 ----------- .../onap/policy/sdnr/util/SerializationTest.java | 57 --- controlloop/common/model-impl/so/pom.xml | 113 ------ .../org/onap/policy/so/SoAsyncRequestStatus.java | 125 ------- .../org/onap/policy/so/SoCloudConfiguration.java | 57 --- .../org/onap/policy/so/SoInstanceReferences.java | 57 --- .../main/java/org/onap/policy/so/SoManager.java | 374 ------------------- .../main/java/org/onap/policy/so/SoModelInfo.java | 112 ------ .../java/org/onap/policy/so/SoOperationType.java | 41 --- .../onap/policy/so/SoPolicyExceptionHolder.java | 57 --- .../java/org/onap/policy/so/SoRelatedInstance.java | 70 ---- .../policy/so/SoRelatedInstanceListElement.java | 46 --- .../main/java/org/onap/policy/so/SoRequest.java | 123 ------- .../java/org/onap/policy/so/SoRequestDetails.java | 215 ----------- .../java/org/onap/policy/so/SoRequestError.java | 57 --- .../java/org/onap/policy/so/SoRequestInfo.java | 145 -------- .../org/onap/policy/so/SoRequestParameters.java | 71 ---- .../org/onap/policy/so/SoRequestReferences.java | 53 --- .../java/org/onap/policy/so/SoRequestStatus.java | 79 ---- .../main/java/org/onap/policy/so/SoResponse.java | 78 ---- .../java/org/onap/policy/so/SoResponseWrapper.java | 102 ------ .../onap/policy/so/SoServiceExceptionHolder.java | 66 ---- .../java/org/onap/policy/so/SoSubscriberInfo.java | 68 ---- .../org/onap/policy/so/util/Serialization.java | 35 -- .../src/test/java/org/onap/policy/so/DemoTest.java | 186 ---------- .../org/onap/policy/so/DummyWorkingMemory.java | 315 ---------------- .../onap/policy/so/SoAsyncRequestStatusTest.java | 79 ---- .../onap/policy/so/SoCloudConfigurationTest.java | 49 --- .../java/org/onap/policy/so/SoDummyServerTest.java | 239 ------------ .../onap/policy/so/SoInstanceReferencesTest.java | 49 --- .../java/org/onap/policy/so/SoManagerTest.java | 405 --------------------- .../java/org/onap/policy/so/SoModelInfoTest.java | 70 ---- .../policy/so/SoPolicyExceptionHolderTest.java | 48 --- .../so/SoRelatedInstanceListElementTest.java | 46 --- .../org/onap/policy/so/SoRelatedInstanceTest.java | 53 --- .../org/onap/policy/so/SoRequestDetailsTest.java | 176 --------- .../org/onap/policy/so/SoRequestErrorTest.java | 51 --- .../java/org/onap/policy/so/SoRequestInfoTest.java | 82 ----- .../onap/policy/so/SoRequestParametersTest.java | 47 --- .../onap/policy/so/SoRequestReferencesTest.java | 49 --- .../org/onap/policy/so/SoRequestStatusTest.java | 58 --- .../java/org/onap/policy/so/SoRequestTest.java | 76 ---- .../java/org/onap/policy/so/SoResponseTest.java | 60 --- .../org/onap/policy/so/SoResponseWrapperTest.java | 105 ------ .../policy/so/SoServiceExceptionHolderTest.java | 51 --- .../org/onap/policy/so/SoSubscriberInfoTest.java | 53 --- .../common/model-impl/trafficgenerator/pom.xml | 85 ----- .../policy/vnf/trafficgenerator/PgRequest.java | 37 -- .../onap/policy/vnf/trafficgenerator/PgStream.java | 39 -- .../policy/vnf/trafficgenerator/PgStreams.java | 39 -- .../vnf/trafficgenerator/util/Serialization.java | 32 -- .../onap/policy/vnf/trafficgenerator/DemoTest.java | 54 --- controlloop/common/model-impl/vfc/pom.xml | 112 ------ .../org/onap/policy/vfc/VfcHealActionVmInfo.java | 55 --- .../onap/policy/vfc/VfcHealAdditionalParams.java | 55 --- .../java/org/onap/policy/vfc/VfcHealRequest.java | 66 ---- .../main/java/org/onap/policy/vfc/VfcManager.java | 190 ---------- .../main/java/org/onap/policy/vfc/VfcRequest.java | 64 ---- .../main/java/org/onap/policy/vfc/VfcResponse.java | 65 ---- .../org/onap/policy/vfc/VfcResponseDescriptor.java | 100 ----- .../org/onap/policy/vfc/util/Serialization.java | 33 -- .../test/java/org/onap/policy/vfc/DemoTest.java | 81 ----- .../onap/policy/vfc/VfcHealActionVmInfoTest.java | 48 --- .../policy/vfc/VfcHealAdditionalParamsTest.java | 48 --- .../org/onap/policy/vfc/VfcHealRequestTest.java | 52 --- .../java/org/onap/policy/vfc/VfcManagerTest.java | 293 --------------- .../java/org/onap/policy/vfc/VfcRequestTest.java | 54 --- .../onap/policy/vfc/VfcResponseDescriptorTest.java | 67 ---- .../java/org/onap/policy/vfc/VfcResponseTest.java | 52 --- .../onap/policy/vfc/util/SerializationTest.java | 34 -- 279 files changed, 25343 deletions(-) delete mode 100644 controlloop/common/model-impl/aai/pom.xml delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetResponse.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVnfResponse.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVserverResponse.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqCloudRegion.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperties.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperty.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqGenericVnf.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInstanceFilters.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItem.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItems.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqNamedQuery.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqQueryParameters.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequest.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequestError.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponse.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceExcept.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceInstance.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqTenant.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVServer.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVfModule.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Pnf.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PnfInstance.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PnfType.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java delete mode 100644 controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetResponseTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVnfResponseTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVserverResponseTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqCloudRegionTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertyTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqGenericVnfTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInstanceFiltersTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemsTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqNamedQueryTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqQueryParametersTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestErrorTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqServiceInstanceTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqTenantTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVServerTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVfModuleTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfInstanceTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTypeTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java delete mode 100644 controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiGetResponseError.json delete mode 100644 controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiGetVnfResponse.json delete mode 100644 controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiGetVserverResponse.json delete mode 100644 controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoItems.json delete mode 100644 controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoModules.json delete mode 100644 controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoNames.json delete mode 100644 controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-Vserver.json delete mode 100644 controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqVServer.json delete mode 100644 controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/RelatedToProperty.json delete mode 100644 controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/Relationship.json delete mode 100644 controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/RelationshipData.json delete mode 100644 controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/RelationshipList.json delete mode 100644 controlloop/common/model-impl/appc/pom.xml delete mode 100644 controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java delete mode 100644 controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java delete mode 100644 controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java delete mode 100644 controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseCode.java delete mode 100644 controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java delete mode 100644 controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseValue.java delete mode 100644 controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java delete mode 100644 controlloop/common/model-impl/appc/src/main/resources/definitions.yaml delete mode 100644 controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java delete mode 100644 controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/EnumsTest.java delete mode 100644 controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java delete mode 100644 controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java delete mode 100644 controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java delete mode 100644 controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/util/SerializationTest.java delete mode 100644 controlloop/common/model-impl/appclcm/pom.xml delete mode 100644 controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmCommonHeader.java delete mode 100644 controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequest.java delete mode 100644 controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequestWrapper.java delete mode 100644 controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponse.java delete mode 100644 controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseCode.java delete mode 100644 controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseStatus.java delete mode 100644 controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseWrapper.java delete mode 100644 controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmWrapper.java delete mode 100644 controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java delete mode 100644 controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/StatusCodeEnum.java delete mode 100644 controlloop/common/model-impl/appclcm/src/main/resources/definitions.yaml delete mode 100644 controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/AppcLcmTest.java delete mode 100644 controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmCommonHeaderTest.java delete mode 100644 controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmRequestTest.java delete mode 100644 controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmRequestWrapperTest.java delete mode 100644 controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResonseCodeTest.java delete mode 100644 controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseStatusTest.java delete mode 100644 controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseTest.java delete mode 100644 controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseWrapperTest.java delete mode 100644 controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmWrapperTest.java delete mode 100644 controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/util/SerializationTest.java delete mode 100644 controlloop/common/model-impl/events/README.md delete mode 100644 controlloop/common/model-impl/events/pom.xml delete mode 100644 controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java delete mode 100644 controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java delete mode 100644 controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java delete mode 100644 controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java delete mode 100644 controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java delete mode 100644 controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java delete mode 100644 controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopResponse.java delete mode 100644 controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java delete mode 100644 controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java delete mode 100644 controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java delete mode 100644 controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java delete mode 100644 controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java delete mode 100644 controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/params/ControlLoopParams.java delete mode 100644 controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java delete mode 100644 controlloop/common/model-impl/events/src/main/resources/definitions.yaml delete mode 100644 controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventStatusTest.java delete mode 100644 controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventTest.java delete mode 100644 controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTest.java delete mode 100644 controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTypeTest.java delete mode 100644 controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java delete mode 100644 controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationWrapperTest.java delete mode 100644 controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopResponseTest.java delete mode 100644 controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopTargetTypeTest.java delete mode 100644 controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopEventTest.java delete mode 100644 controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopNotificationTest.java delete mode 100644 controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopEventTest.java delete mode 100644 controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopNotificationTest.java delete mode 100644 controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/params/ControlLoopParamsTest.java delete mode 100644 controlloop/common/model-impl/pom.xml delete mode 100644 controlloop/common/model-impl/rest/pom.xml delete mode 100644 controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/HttpDeleteWithBody.java delete mode 100644 controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java delete mode 100755 controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/GetTest.java delete mode 100644 controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/HttpDeleteWithBodyTest.java delete mode 100755 controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/PairTest.java delete mode 100755 controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/PostTest.java delete mode 100644 controlloop/common/model-impl/sdc/checkstyle-suppressions.xml delete mode 100644 controlloop/common/model-impl/sdc/pom.xml delete mode 100644 controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java delete mode 100644 controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java delete mode 100644 controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java delete mode 100644 controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java delete mode 100644 controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java delete mode 100644 controlloop/common/model-impl/sdc/src/main/resources/definitions.yaml delete mode 100644 controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java delete mode 100644 controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java delete mode 100644 controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java delete mode 100644 controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java delete mode 100644 controlloop/common/model-impl/sdc/src/test/resources/service_trinity.yaml delete mode 100644 controlloop/common/model-impl/sdc/src/test/resources/service_vSCP.yaml delete mode 100644 controlloop/common/model-impl/sdc/src/test/resources/service_vUSP.yaml delete mode 100644 controlloop/common/model-impl/sdnc/pom.xml delete mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealNetworkInfo.java delete mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequest.java delete mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestHeaderInfo.java delete mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestInfo.java delete mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealServiceInfo.java delete mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleParameter.java delete mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleParametersInfo.java delete mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleRequestInput.java delete mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVnfInfo.java delete mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java delete mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncRequest.java delete mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponse.java delete mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseNetworkInfo.java delete mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseOutput.java delete mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseServiceInfo.java delete mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/util/Serialization.java delete mode 100644 controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/DemoTest.java delete mode 100644 controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealAdditionalParamsTest.java delete mode 100644 controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealRequestTest.java delete mode 100644 controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealServiceInfoTest.java delete mode 100644 controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncManagerTest.java delete mode 100644 controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncRequestTest.java delete mode 100644 controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncResponseDescriptorTest.java delete mode 100644 controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncResponseTest.java delete mode 100644 controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/util/SerializationTest.java delete mode 100644 controlloop/common/model-impl/sdnr/pom.xml delete mode 100644 controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java delete mode 100644 controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java delete mode 100644 controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequestWrapper.java delete mode 100644 controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponse.java delete mode 100644 controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseCode.java delete mode 100644 controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseWrapper.java delete mode 100644 controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciWrapper.java delete mode 100644 controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/Status.java delete mode 100644 controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java delete mode 100644 controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/StatusCodeEnum.java delete mode 100644 controlloop/common/model-impl/sdnr/src/main/resources/definitions.yaml delete mode 100644 controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java delete mode 100644 controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java delete mode 100644 controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java delete mode 100644 controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseCodeTest.java delete mode 100644 controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java delete mode 100644 controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java delete mode 100644 controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java delete mode 100644 controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java delete mode 100644 controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java delete mode 100644 controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/util/SerializationTest.java delete mode 100644 controlloop/common/model-impl/so/pom.xml delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoAsyncRequestStatus.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoCloudConfiguration.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoInstanceReferences.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoModelInfo.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoOperationType.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoPolicyExceptionHolder.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstance.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstanceListElement.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequest.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestDetails.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestError.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestInfo.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestParameters.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestReferences.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestStatus.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponse.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoServiceExceptionHolder.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoSubscriberInfo.java delete mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java delete mode 100644 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DemoTest.java delete mode 100644 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java delete mode 100644 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServerTest.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java delete mode 100644 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoManagerTest.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestInfoTest.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java delete mode 100755 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java delete mode 100644 controlloop/common/model-impl/trafficgenerator/pom.xml delete mode 100644 controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgRequest.java delete mode 100644 controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgStream.java delete mode 100644 controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgStreams.java delete mode 100644 controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/util/Serialization.java delete mode 100644 controlloop/common/model-impl/trafficgenerator/src/test/java/org/onap/policy/vnf/trafficgenerator/DemoTest.java delete mode 100644 controlloop/common/model-impl/vfc/pom.xml delete mode 100644 controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealActionVmInfo.java delete mode 100644 controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealAdditionalParams.java delete mode 100644 controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealRequest.java delete mode 100644 controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcManager.java delete mode 100644 controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcRequest.java delete mode 100644 controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcResponse.java delete mode 100644 controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcResponseDescriptor.java delete mode 100644 controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java delete mode 100644 controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/DemoTest.java delete mode 100644 controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealActionVmInfoTest.java delete mode 100644 controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealAdditionalParamsTest.java delete mode 100644 controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealRequestTest.java delete mode 100644 controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcManagerTest.java delete mode 100644 controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcRequestTest.java delete mode 100644 controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcResponseDescriptorTest.java delete mode 100644 controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcResponseTest.java delete mode 100644 controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/util/SerializationTest.java (limited to 'controlloop/common/model-impl') diff --git a/controlloop/common/model-impl/aai/pom.xml b/controlloop/common/model-impl/aai/pom.xml deleted file mode 100644 index f563ab4f8..000000000 --- a/controlloop/common/model-impl/aai/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - 4.0.0 - - - org.onap.policy.drools-applications.controlloop.common.model-impl - model-impl - 1.4.0-SNAPSHOT - - - aai - - - - com.google.code.gson - gson - provided - - - org.onap.policy.drools-applications.controlloop.common.model-impl - rest - ${project.version} - - - junit - junit - test - - - org.mockito - mockito-core - 2.13.0 - test - - - org.powermock - powermock-core - test - - - org.onap.policy.common - policy-endpoints - ${version.policy.common} - 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 deleted file mode 100644 index e702db699..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetResponse.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class AaiGetResponse implements Serializable { - private static final long serialVersionUID = 7311418432051756162L; - - @SerializedName("requestError") - private AaiNqRequestError requestError; - - public AaiNqRequestError getRequestError() { - return requestError; - } - - 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 deleted file mode 100644 index b6c38477a..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVnfResponse.java +++ /dev/null @@ -1,151 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class AaiGetVnfResponse extends AaiGetResponse implements Serializable { - - private static final long serialVersionUID = -6247505944905898871L; - - @SerializedName("vnf-id") - private String vnfId; - - @SerializedName("vnf-name") - private String vnfName; - - @SerializedName("vnf-type") - private String vnfType; - - @SerializedName("service-id") - private String serviceId; - - @SerializedName("orchestration-status") - private String orchestrationStatus; - - @SerializedName("in-maint") - private boolean inMaint; - - @SerializedName("is-closed-loop-disabled") - private boolean isClosedLoopDisabled; - - @SerializedName("model-invariant-id") - private String modelInvariantId; - - @SerializedName("prov-status") - private String provStatus; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("relationship-list") - private RelationshipList relationshipList; - - 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 boolean getInMaint() { - return inMaint; - } - - public boolean getIsClosedLoopDisabled() { - return isClosedLoopDisabled; - } - - public String getModelInvariantId() { - return modelInvariantId; - } - - public String getProvStatus() { - return provStatus; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public RelationshipList getRelationshipList() { - return relationshipList; - } - - 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; - } - - public void setInMaint(boolean inMaint) { - this.inMaint = inMaint; - } - - public void setIsClosedLoopDisabled(boolean isClosedLoopDisabled) { - this.isClosedLoopDisabled = isClosedLoopDisabled; - } - - public void setModelInvariantId(String modelInvariantId) { - this.modelInvariantId = modelInvariantId; - } - - public void setProvStatus(String provStatus) { - this.provStatus = provStatus; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } - - public void setRelationshipList(RelationshipList relationshipList) { - this.relationshipList = relationshipList; - } -} 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 deleted file mode 100644 index a2d4b856a..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVserverResponse.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; - -public class AaiGetVserverResponse extends AaiGetResponse implements Serializable { - - private static final long serialVersionUID = -6247505944905898871L; - - @SerializedName("vserver") - private List vserver = new LinkedList<>(); - - public List getVserver() { - return vserver; - } - - public void setVserver(List vserver) { - this.vserver = vserver; - } -} 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 deleted file mode 100644 index e609e932e..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java +++ /dev/null @@ -1,234 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd. - * ================================================================================ - * 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 com.google.gson.JsonSyntaxException; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.onap.policy.aai.util.Serialization; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; -import org.onap.policy.rest.RestManager; -import org.onap.policy.rest.RestManager.Pair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * This class handles communication towards and responses from A&AI for this module. - */ -public final class AaiManager { - - /** The Constant logger. */ - private static final Logger logger = LoggerFactory.getLogger(AaiManager.class); - - /** The rest manager. */ - // The REST manager used for processing REST calls for this AAI manager - private final RestManager restManager; - - /** - * Constructor, create the AAI manager with the specified REST manager. - * - * @param restManager the rest manager to use for REST calls - */ - public AaiManager(final RestManager restManager) { - this.restManager = restManager; - } - - /** - * 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) { - - final Map headers = createHeaders(requestId); - - url = url + "/aai/search/named-query"; - - logger.debug("RestManager.post before"); - String requestJson = Serialization.gsonPretty.toJson(request); - NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, url, requestJson); - Pair httpDetails = - restManager.post(url, username, password, headers, "application/json", requestJson); - logger.debug("RestManager.post after"); - - if (httpDetails == null) { - logger.info("AAI POST Null Response to {}", url); - return null; - } - - int httpResponseCode = httpDetails.first; - - logger.info(url); - logger.info("{}", httpResponseCode); - logger.info(httpDetails.second); - - if (httpDetails.second != null) { - return composeResponse(httpDetails, url, AaiNqResponse.class); - } - return null; - } - - /** - * 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); - } - - /** - * 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); - } - - /** - * 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); - } - - /** - * 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); - - String urlGet = url + key; - - int attemptsLeft = 3; - - while (attemptsLeft-- > 0) { - NetLoggerUtil.getNetworkLogger().info("[OUT|{}|{}|]", CommInfrastructure.REST, 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.first; - - logger.info(urlGet); - logger.info("{}", httpResponseCode); - logger.info(httpDetailsGet.second); - - if (httpResponseCode == 200) { - T responseGet = composeResponse(httpDetailsGet, urlGet, classOfResponse); - if (responseGet != null) { - return responseGet; - } - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - - } - - return null; - } - - /** - * Create the headers for the HTTP request. - * - * @param requestId the request ID to insert in the headers - * @return the HTTP headers - */ - private Map createHeaders(final UUID requestId) { - Map headers = new HashMap<>(); - - headers.put("X-FromAppId", "POLICY"); - headers.put("X-TransactionId", requestId.toString()); - headers.put("Accept", "application/json"); - - return headers; - } - - /** - * 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 classOfResponse The response class - * @return an instance of the response class - * @throws JsonSyntaxException on GSON errors instantiating the response - */ - private T composeResponse(final Pair httpDetails, final String url, - final Class classOfResponse) { - try { - T response = Serialization.gsonPretty.fromJson(httpDetails.second, classOfResponse); - NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, url, httpDetails.second); - return response; - } catch (JsonSyntaxException e) { - logger.error("postQuery threw: ", e); - return null; - } - } -} 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 deleted file mode 100644 index b0715bc7a..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqCloudRegion.java +++ /dev/null @@ -1,85 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class AaiNqCloudRegion implements Serializable { - - private static final long serialVersionUID = -897231529157222683L; - - @SerializedName("cloud-owner") - private String cloudOwner; - - @SerializedName("cloud-region-id") - private String cloudRegionId; - - @SerializedName("cloud-region-version") - private String cloudRegionVersion; - - @SerializedName("complex-name") - private String complexName; - - @SerializedName("resource-version") - 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 deleted file mode 100644 index abe779f32..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperties.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; - -public class AaiNqExtraProperties implements Serializable { - private static final long serialVersionUID = 4109625574744702319L; - - @SerializedName("extra-property") - private List extraProperty = new LinkedList<>(); - - public List getExtraProperty() { - return extraProperty; - } - - public void setExtraProperty(List extraProperty) { - this.extraProperty = extraProperty; - } -} 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 deleted file mode 100644 index d63fe1f08..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperty.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class AaiNqExtraProperty implements Serializable { - - private static final long serialVersionUID = -3861240617222397736L; - - @SerializedName("property-name") - private String propertyName; - - @SerializedName("property-value") - private String propertyValue; - - public AaiNqExtraProperty() {} - - public AaiNqExtraProperty(String propertyName, String propertyValue) { - this.propertyName = propertyName; - 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 deleted file mode 100644 index 788d236e7..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqGenericVnf.java +++ /dev/null @@ -1,227 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; -import java.io.Serializable; - -public class AaiNqGenericVnf implements Serializable { - - private static final long serialVersionUID = 834322706248060560L; - - @SerializedName("vnf-id") - private String vnfId; - - @SerializedName("vnf-name") - private String vnfName; - - @SerializedName("vnf-name2") - private String vnfName2; - - @SerializedName("vnf-type") - private String vnfType; - - @SerializedName("service-id") - private String serviceId; - - @SerializedName("prov-status") - private String provStatus; - - @SerializedName("operational-state") - private String operationalState; - - @SerializedName("ipv4-oam-address") - private String ipv4OamAddress; - - @SerializedName("ipv4-loopback0-address") - private String ipv4Loopback0Address; - - @SerializedName("in-maint") - private Boolean inMaint; - - @SerializedName("is-closed-loop-disabled") - private Boolean isClosedLoopDisabled; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("encrypted-access-flag") - private Boolean encrypedAccessFlag; - - @SerializedName("persona-model-id") - private String personaModelId; - - @SerializedName("persona-model-version") - private String personaModelVersion; - - @SerializedName("model-invariant-id") - private String modelInvariantId; - - @SerializedName("model-version-id") - private String modelVersionId; - - @SerializedName("model-customization-id") - private String modelCustomizationId = null; - - 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 String getModelCustomizationId() { - return modelCustomizationId; - } - - 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; - } - - public void setModelCustomizationId(String modelCustomizationId) { - this.modelCustomizationId = modelCustomizationId; - } -} diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInstanceFilters.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInstanceFilters.java deleted file mode 100644 index 21cd87f82..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInstanceFilters.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -public class AaiNqInstanceFilters implements Serializable { - - private static final long serialVersionUID = 8993824591338121185L; - - @SerializedName("instance-filter") - private List>> instanceFilter = new LinkedList<>(); - - public List>> getInstanceFilter() { - return instanceFilter; - } - - public void setInstanceFilter(List>> instanceFilter) { - this.instanceFilter = instanceFilter; - } -} 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 deleted file mode 100644 index 53ec65fff..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItem.java +++ /dev/null @@ -1,129 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class AaiNqInventoryResponseItem implements Serializable { - - private static final long serialVersionUID = 7142072567154675183L; - - @SerializedName("model-name") - private String modelName; - - @SerializedName("vf-module") - private AaiNqVfModule vfModule; - - @SerializedName("service-instance") - private AaiNqServiceInstance serviceInstance; - - @SerializedName("vserver") - private AaiNqVServer vserver; - - @SerializedName("tenant") - private AaiNqTenant tenant; - - @SerializedName("cloud-region") - private AaiNqCloudRegion cloudRegion; - - @SerializedName("generic-vnf") - private AaiNqGenericVnf genericVnf; - - @SerializedName("extra-properties") - private AaiNqExtraProperties extraProperties; - - @SerializedName("inventory-response-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 deleted file mode 100644 index 3ebbc1644..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItems.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; - -public class AaiNqInventoryResponseItems implements Serializable { - private static final long serialVersionUID = 7602807659381179004L; - - @SerializedName("inventory-response-item") - private List inventoryResponseItems = new LinkedList<>(); - - public List getInventoryResponseItems() { - return inventoryResponseItems; - } - - public void setInventoryResponseItems(List inventoryResponseItems) { - this.inventoryResponseItems = inventoryResponseItems; - } -} 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 deleted file mode 100644 index 1d18eb857..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqNamedQuery.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.UUID; - -public class AaiNqNamedQuery implements Serializable { - private static final long serialVersionUID = -3277980060302645333L; - - @SerializedName("named-query-uuid") - 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 deleted file mode 100644 index 438e5b269..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqQueryParameters.java +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class AaiNqQueryParameters implements Serializable { - private static final long serialVersionUID = -4291227193197126982L; - - @SerializedName("named-query") - 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 deleted file mode 100644 index 9e60ed1a6..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequest.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class AaiNqRequest implements Serializable { - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("query-parameters") - private AaiNqQueryParameters queryParameters; - - @SerializedName("instance-filters") - 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 deleted file mode 100644 index 4a7ce504b..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequestError.java +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class AaiNqRequestError implements Serializable { - private static final long serialVersionUID = -7742674155387022932L; - - @SerializedName("serviceException") - 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 deleted file mode 100644 index 36eb0c299..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponse.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; - -public class AaiNqResponse implements Serializable { - private static final long serialVersionUID = 8411407444051746101L; - - @SerializedName("inventory-response-item") - private List inventoryResponseItems = new LinkedList<>(); - - @SerializedName("requestError") - private AaiNqRequestError requestError; - - public List getInventoryResponseItems() { - return inventoryResponseItems; - } - - public AaiNqRequestError getRequestError() { - return requestError; - } - - public void setRequestError(AaiNqRequestError requestError) { - this.requestError = requestError; - } - - public void setInventoryResponseItems(List inventoryResponseItems) { - this.inventoryResponseItems = inventoryResponseItems; - } -} diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java deleted file mode 100644 index 038e3f88b..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponseWrapper.java +++ /dev/null @@ -1,152 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqResponseWrapper implements Serializable { - private static final long serialVersionUID = 8411407444051746101L; - - private static final Logger logger = LoggerFactory.getLogger(AaiNqResponseWrapper.class); - - private static final Pattern VF_MODULE_NAME_PAT = Pattern.compile("(.*_)(\\d+)"); - - private UUID requestId; - private AaiNqResponse aaiNqResponse; - - public AaiNqResponseWrapper() {} - - public AaiNqResponseWrapper(UUID requestId, AaiNqResponse aaiNqResponse) { - this.requestId = requestId; - this.aaiNqResponse = aaiNqResponse; - } - - public UUID getRequestId() { - return requestId; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public AaiNqResponse getAaiNqResponse() { - return aaiNqResponse; - } - - public void setAaiNqResponse(AaiNqResponse aaiNqResponse) { - this.aaiNqResponse = aaiNqResponse; - } - - /** - * Counts the number of VF modules, if any, in the response. - * - * @return the number of VF modules, or {@code 0} if there are none - */ - public int countVfModules() { - return getVfModuleItems(false).size(); - } - - /** - * Generates the name for the next VF module. - * - * @return the name of the next VF module, or {@code null} if the name could not be - * generated (i.e., because the response has no matching VF module names on - * which to model it) - */ - public String genVfModuleName() { - /* - * Loop through the VF modules, extracting the name prefix and the largest number - * suffix - */ - String prefix = null; - int maxSuffix = -1; - - for (AaiNqInventoryResponseItem item : getVfModuleItems(false)) { - String name = item.getVfModule().getVfModuleName(); - Matcher matcher = VF_MODULE_NAME_PAT.matcher(name); - if (matcher.matches()) { - int suffix = Integer.parseInt(matcher.group(2)); - if (suffix > maxSuffix) { - maxSuffix = suffix; - prefix = matcher.group(1); - } - } - } - - ++maxSuffix; - - return (prefix == null ? null : prefix + maxSuffix); - } - - /** - * Gets a list of VF modules. If the non-base VF modules are requested, then only - * those whose names match the name pattern, {@link #VF_MODULE_NAME_PAT}, are - * returned. - * - * @param wantBaseModule {@code true} if the the base VF module(s) is desired, - * {@code false} otherwise - * @return the list of VF module items - */ - public List getVfModuleItems(boolean wantBaseModule) { - // get the list of items - List itemList; - try { - itemList = aaiNqResponse.getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0) - .getItems().getInventoryResponseItems(); - - } catch (NullPointerException | IndexOutOfBoundsException e) { - logger.debug("no VF modules in AAI response", e); - return Collections.emptyList(); - } - - if (itemList == null) { - return Collections.emptyList(); - } - - /* - * Walk the items looking for VF modules, allocating the list only when an item is - * found. - */ - List vfModuleItems = new ArrayList<>(itemList.size()); - - for (AaiNqInventoryResponseItem inventoryResponseItem : itemList) { - AaiNqVfModule vfmod = inventoryResponseItem.getVfModule(); - if (vfmod == null) { - continue; - } - - if (vfmod.getIsBaseVfModule() == wantBaseModule - && (wantBaseModule || VF_MODULE_NAME_PAT.matcher(vfmod.getVfModuleName()).matches())) { - vfModuleItems.add(inventoryResponseItem); - } - } - - return vfModuleItems; - } -} 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 deleted file mode 100644 index 77ac46d3d..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceExcept.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class AaiNqServiceExcept implements Serializable { - private static final long serialVersionUID = 2858343404484338546L; - - @SerializedName("messageId") - private String messageId; - - @SerializedName("text") - private String text; - - @SerializedName("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 deleted file mode 100644 index a3aa65920..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceInstance.java +++ /dev/null @@ -1,117 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class AaiNqServiceInstance implements Serializable { - private static final long serialVersionUID = -8000944396593889586L; - - @SerializedName("service-instance-id") - private String serviceInstanceId; - - @SerializedName("service-instance-name") - private String serviceInstanceName; - - @SerializedName("persona-model-id") - private String personaModelId; - - @SerializedName("persona-model-version") - private String personaModelVersion; - - @SerializedName("service-instance-location-id") - private String serviceInstanceLocationId; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("model-invariant-id") - private String modelInvariantId; - - @SerializedName("model-version-id") - 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 deleted file mode 100644 index c8c6d106f..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqTenant.java +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * ============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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class AaiNqTenant implements Serializable { - private static final long serialVersionUID = 4702784101671984364L; - - @SerializedName("tenant-id") - private String tenantId; - - @SerializedName("tenant-name") - private String tenantName; - - @SerializedName("resource-version") - 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 deleted file mode 100644 index c624497f1..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVServer.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class AaiNqVServer implements Serializable { - private static final long serialVersionUID = -6718526692734215643L; - - @SerializedName("vserver-id") - private String vserverId; - - @SerializedName("vserver-name") - private String vserverName; - - @SerializedName("vserver-name2") - private String vserverName2; - - @SerializedName("prov-status") - private String provStatus; - - @SerializedName("vserver-selflink") - private String vserverSelflink; - - @SerializedName("in-maint") - private Boolean inMaint; - - @SerializedName("is-closed-loop-disabled") - private Boolean isClosedLoopDisabled; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("relationship-list") - private RelationshipList relationshipList; - - 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 RelationshipList getRelationshipList() { - return relationshipList; - } - - 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; - } - - public void setRelationshipList(RelationshipList relationshipList) { - this.relationshipList = relationshipList; - } - -} 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 deleted file mode 100644 index d8021af28..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVfModule.java +++ /dev/null @@ -1,182 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; -import java.io.Serializable; - -public class AaiNqVfModule implements Serializable { - private static final long serialVersionUID = 8019133081429638232L; - - @SerializedName("vf-module-id") - private String vfModuleId; - - @SerializedName("vf-module-name") - private String vfModuleName; - - @SerializedName("heat-stack-id") - private String heatStackId; - - @SerializedName("orchestration-status") - private String orchestrationStatus; - - @SerializedName("is-base-vf-module") - private Boolean isBaseVfModule; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("persona-model-id") - private String personaModelId; - - @SerializedName("persona-model-version") - private String personaModelVersion; - - @SerializedName("widget-model-id") - private String widgetModelId; - - @SerializedName("widget-model-version") - private String widgetModelVersion; - - @SerializedName("contrail-service-instance-fqdn") - private String contrailServiceInstanceFqdn; - - @SerializedName("model-invariant-id") - private String modelInvariantId; - - @SerializedName("model-version-id") - private String modelVersionId; - - @SerializedName("model-customization-id") - private String modelCustomizationId = null; - - 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 String getModelCustomizationId() { - return modelCustomizationId; - } - - 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; - } - - public void setModelCustomizationId(String modelCustomizationId) { - this.modelCustomizationId = modelCustomizationId; - } -} 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 deleted file mode 100644 index 2ef0bde46..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Pnf.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============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 java.io.Serializable; - -public class Pnf implements Serializable { - private static final long serialVersionUID = -3535108358668248501L; - - private String pnfName; - private PnfType pnfType; - - public Pnf() { - - } - - public Pnf(Pnf pnf) { - this.pnfName = pnf.pnfName; - this.pnfType = pnf.pnfType; - } - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } - - public PnfType getPnfType() { - return pnfType; - } - - public void setPnfType(PnfType pnfType) { - this.pnfType = pnfType; - } - - @Override - public String toString() { - return "PNF [PNFName=" + pnfName + ", PNFType=" + pnfType + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((pnfName == null) ? 0 : pnfName.hashCode()); - result = prime * result + ((pnfType == null) ? 0 : pnfType.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - Pnf other = (Pnf) obj; - if (pnfName == null) { - if (other.pnfName != null) { - return false; - } - } else if (!pnfName.equals(other.pnfName)) { - return false; - } - return pnfType == other.pnfType; - } -} diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PnfInstance.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PnfInstance.java deleted file mode 100644 index 9d9e26c2c..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PnfInstance.java +++ /dev/null @@ -1,137 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 java.io.Serializable; - -public class PnfInstance implements Serializable { - - private static final long serialVersionUID = -3694152433472165034L; - - private String pnfName; - private String pnfInstanceName; - private PnfType pnfType; - private String pnfSerial; - - public PnfInstance() { - - } - - /** - * Create an instance from a given instance. - * - * @param instance the instance - */ - public PnfInstance(PnfInstance instance) { - if (instance == null) { - return; - } - this.pnfName = instance.pnfName; - this.pnfInstanceName = instance.pnfInstanceName; - this.pnfType = instance.pnfType; - this.pnfSerial = instance.pnfSerial; - } - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } - - public String getPnfInstanceName() { - return pnfInstanceName; - } - - public void setPnfInstanceName(String pnfInstanceName) { - this.pnfInstanceName = pnfInstanceName; - } - - public PnfType getPnfType() { - return pnfType; - } - - public void setPnfType(PnfType pnfType) { - this.pnfType = pnfType; - } - - public String getPnfSerial() { - return pnfSerial; - } - - public void setPnfSerial(String pnfSerial) { - this.pnfSerial = pnfSerial; - } - - @Override - public String toString() { - return "PNFInstance [PNFName=" + pnfName + ", PNFInstanceName=" + pnfInstanceName + ", PNFType=" + pnfType - + ", PNFSerial=" + pnfSerial + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((pnfInstanceName == null) ? 0 : pnfInstanceName.hashCode()); - result = prime * result + ((pnfName == null) ? 0 : pnfName.hashCode()); - result = prime * result + ((pnfSerial == null) ? 0 : pnfSerial.hashCode()); - result = prime * result + ((pnfType == null) ? 0 : pnfType.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - PnfInstance other = (PnfInstance) obj; - if (pnfInstanceName == null) { - if (other.pnfInstanceName != null) { - return false; - } - } else if (!pnfInstanceName.equals(other.pnfInstanceName)) { - return false; - } - if (pnfName == null) { - if (other.pnfName != null) { - return false; - } - } else if (!pnfName.equals(other.pnfName)) { - return false; - } - if (pnfSerial == null) { - if (other.pnfSerial != null) { - return false; - } - } else if (!pnfSerial.equals(other.pnfSerial)) { - return false; - } - return pnfType == other.pnfType; - } -} 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 deleted file mode 100644 index 29dd2690c..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PnfType.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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; - -public enum PnfType { - ENODEB("eNodeB"), PSERVER("pserver"); - - private String type; - - private PnfType(String type) { - this.type = type; - } - - @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 deleted file mode 100644 index ca126d12c..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class RelatedToProperty implements Serializable { - private static final long serialVersionUID = 5644372985092588638L; - - @SerializedName("property-key") - private String propertyKey; - @SerializedName("property-value") - 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 deleted file mode 100644 index 496129825..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; - -public class Relationship implements Serializable { - private static final long serialVersionUID = -68508443869003055L; - - @SerializedName("related-to") - private String relatedTo; - - @SerializedName("related-link") - private String relatedLink; - - @SerializedName("relationship-data") - private List relationshipData = new LinkedList<>(); - - @SerializedName("related-to-property") - private List relatedToProperty = new LinkedList<>(); - - public String getRelatedTo() { - return relatedTo; - } - - public String getRelatedLink() { - return relatedLink; - } - - public List getRelationshipData() { - return relationshipData; - } - - public List getRelatedToProperty() { - return relatedToProperty; - } - - public void setRelatedTo(String relatedTo) { - this.relatedTo = relatedTo; - } - - public void setRelatedLink(String relatedLink) { - this.relatedLink = relatedLink; - } - - public void setRelationshipData(List relationshipData) { - this.relationshipData = relationshipData; - } - - public void setRelatedToProperty(List 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 deleted file mode 100644 index 24170803d..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class RelationshipData implements Serializable { - private static final long serialVersionUID = 550450041634939768L; - - @SerializedName("relationship-key") - private String relationshipKey; - @SerializedName("relationship-value") - 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/RelationshipList.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java deleted file mode 100644 index 8db1c7a39..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; - -public class RelationshipList implements Serializable { - private static final long serialVersionUID = 6115655704973981990L; - - @SerializedName("relationship") - private List relationships = new LinkedList<>(); - - public List getRelationships() { - return relationships; - } - - public void setRelationships(List relationships) { - this.relationships = relationships; - } - - -} diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java deleted file mode 100644 index 45ddac431..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============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; - -public class AaiException extends Exception { - - private static final long serialVersionUID = 9220983727706207465L; - - public AaiException() { - super(); - } - - public AaiException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } - - public AaiException(String message, Throwable cause) { - super(message, cause); - } - - public AaiException(String message) { - super(message); - } - - public AaiException(Throwable cause) { - super(cause); - } - -} diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java deleted file mode 100644 index 5b504c09c..000000000 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -public final class Serialization { - - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .create(); - - private Serialization() {} - -} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetResponseTest.java deleted file mode 100644 index 9afa70a59..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetResponseTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.io.File; -import java.nio.file.Files; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiGetResponseTest { - private static final Logger logger = LoggerFactory.getLogger(AaiGetResponseTest.class); - - @Test - public void test() throws Exception { - // deserialize json and verify fields are populated properly - String json = new String(Files.readAllBytes( - new File("src/test/resources/org/onap/policy/aai/AaiGetResponseError.json").toPath())); - - AaiGetResponse resp = Serialization.gsonPretty.fromJson(json, AaiGetResponse.class); - - // don't need to verify this in depth, as it has its own tests that do that - assertNotNull(resp.getRequestError()); - assertNotNull(resp.getRequestError().getServiceExcept()); - assertEquals("SVC3001", resp.getRequestError().getServiceExcept().getMessageId()); - - logger.info(Serialization.gsonPretty.toJson(resp)); - - // verify that setXxx methods work - resp.setRequestError(null); - assertNull(resp.getRequestError()); - - AaiNqRequestError err = new AaiNqRequestError(); - resp.setRequestError(err); - assertEquals(err, resp.getRequestError()); - } - -} 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 deleted file mode 100644 index 26f3ca2dc..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVnfResponseTest.java +++ /dev/null @@ -1,107 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.io.File; -import java.nio.file.Files; -import java.util.List; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiGetVnfResponseTest { - private static final Logger logger = LoggerFactory.getLogger(AaiGetVnfResponseTest.class); - - @Test - public void test() throws Exception { - // deserialize json and verify fields are populated properly - String json = new String(Files.readAllBytes( - new File("src/test/resources/org/onap/policy/aai/AaiGetVnfResponse.json").toPath())); - - AaiGetVnfResponse resp = Serialization.gsonPretty.fromJson(json, AaiGetVnfResponse.class); - - assertEquals("807a3f02-f878-436b-870c-f0e91e81570d", resp.getVnfId()); - assertEquals("vLoadBalancerMS-Vnf-0809-2", resp.getVnfName()); - assertEquals("vLoadBalancerMS/vLoadBalancerMS 0", resp.getVnfType()); - assertEquals("1533850960381", resp.getResourceVersion()); - assertEquals(false, resp.getInMaint()); - assertEquals(true, resp.getIsClosedLoopDisabled()); - assertEquals("53638a85-361a-437d-8830-4b0d5329225e", resp.getModelInvariantId()); - assertEquals("PROV", resp.getProvStatus()); - assertEquals("Active", resp.getOrchestrationStatus()); - assertEquals("50e1b0be-e0c9-48e2-9f42-15279a783ee8", resp.getServiceId()); - - // don't need to verify this in depth, as it has its own tests that do that - RelationshipList relationshipList = resp.getRelationshipList(); - assertNotNull(relationshipList); - - List lst = relationshipList.getRelationships(); - assertNotNull(lst); - - assertEquals(5, lst.size()); - assertEquals("service-instance", lst.get(0).getRelatedTo()); - assertEquals("line-of-business", lst.get(1).getRelatedTo()); - - logger.info(Serialization.gsonPretty.toJson(resp)); - - // verify that setXxx methods work - relationshipList = new RelationshipList(); - - resp.setInMaint(true); - resp.setIsClosedLoopDisabled(false); - resp.setModelInvariantId("modiv"); - resp.setOrchestrationStatus("orch"); - resp.setProvStatus("mystatus"); - resp.setRelationshipList(relationshipList); - resp.setResourceVersion("vers"); - resp.setServiceId("svc"); - resp.setVnfId("vnfid"); - resp.setVnfName("vnfname"); - resp.setVnfType("vnftype"); - - assertEquals("vnfid", resp.getVnfId()); - assertEquals("vnfname", resp.getVnfName()); - assertEquals("vnftype", resp.getVnfType()); - assertEquals("vers", resp.getResourceVersion()); - assertEquals(true, resp.getInMaint()); - assertEquals(false, resp.getIsClosedLoopDisabled()); - assertEquals("modiv", resp.getModelInvariantId()); - assertEquals("mystatus", resp.getProvStatus()); - assertEquals("orch", resp.getOrchestrationStatus()); - assertEquals("svc", resp.getServiceId()); - assertEquals(relationshipList, resp.getRelationshipList()); - - - // test error case - json = new String(Files.readAllBytes( - new File("src/test/resources/org/onap/policy/aai/AaiGetResponseError.json").toPath())); - resp = Serialization.gsonPretty.fromJson(json, AaiGetVnfResponse.class); - - // don't need to verify this in depth, as it has its own tests that do that - assertNotNull(resp.getRequestError()); - assertNotNull(resp.getRequestError().getServiceExcept()); - assertEquals("SVC3001", resp.getRequestError().getServiceExcept().getMessageId()); - } -} 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 deleted file mode 100644 index c0160e421..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVserverResponseTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.io.File; -import java.nio.file.Files; -import java.util.LinkedList; -import java.util.List; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiGetVserverResponseTest { - private static final Logger logger = LoggerFactory.getLogger(AaiGetVserverResponseTest.class); - - @Test - public void test() throws Exception { - // deserialize json and verify fields are populated properly - String json = new String(Files.readAllBytes( - new File("src/test/resources/org/onap/policy/aai/AaiGetVserverResponse.json").toPath())); - - AaiGetVserverResponse resp = Serialization.gsonPretty.fromJson(json, AaiGetVserverResponse.class); - - // don't need to verify this in depth, as it has its own tests that do that - List lst = resp.getVserver(); - assertEquals(1, lst.size()); - - AaiNqVServer svr = lst.get(0); - assertNotNull(svr); - assertEquals("1c94da3f-16f1-4fc7-9ed1-e018dfa62774", svr.getVserverId()); - - logger.info(Serialization.gsonPretty.toJson(resp)); - - // verify that setXxx methods work - lst = new LinkedList<>(); - lst.add(new AaiNqVServer()); - lst.add(new AaiNqVServer()); - - resp.setVserver(lst); - - assertEquals(lst, resp.getVserver()); - - - // test error case - json = new String(Files.readAllBytes( - new File("src/test/resources/org/onap/policy/aai/AaiGetResponseError.json").toPath())); - resp = Serialization.gsonPretty.fromJson(json, AaiGetVserverResponse.class); - - // don't need to verify this in depth, as it has its own tests that do that - assertNotNull(resp.getRequestError()); - assertNotNull(resp.getRequestError().getServiceExcept()); - assertEquals("SVC3001", resp.getRequestError().getServiceExcept().getMessageId()); - } - -} 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 deleted file mode 100644 index 3717740d5..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java +++ /dev/null @@ -1,169 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2019 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.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.ArgumentMatchers.startsWith; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -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; - - /** - * Set up test cases. - */ - @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 aaiNqNotOkResponse0 = aaiManager.postQuery("http://somewhere.over.the.rainbow", "Witch", "West", - aaiNqRequest, aaiNqRequestUuid); - assertNull(aaiNqNotOkResponse0); - - when(restManagerMock.post(startsWith("http://somewhere.under.the.rainbow"), eq("Witch"), eq("West"), anyMap(), - anyString(), anyString())).thenReturn(httpResponseErr1); - - AaiNqResponse aaiNqNotOkResponse1 = aaiManager.postQuery("http://somewhere.under.the.rainbow", "Witch", "West", - aaiNqRequest, aaiNqRequestUuid); - assertNull(aaiNqNotOkResponse1); - } - - @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 vserverNotOkResponse0 = aaiManager.getQueryByVserverName( - "http://somewhere.under.the.rainbow", "Witch", "West", vserverNameRequestId, "vserverName"); - assertNull(vserverNotOkResponse0); - } - - @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 deleted file mode 100644 index dea981a0a..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqCloudRegionTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -public class AaiNqCloudRegionTest { - - @BeforeClass - public static void setUpBeforeClass() throws Exception {} - - @AfterClass - public static void tearDownAfterClass() throws Exception {} - - @Test - public void test() { - AaiNqCloudRegion aaiNqCloudRegion = new AaiNqCloudRegion(); - aaiNqCloudRegion.setCloudOwner("Rackspace"); - aaiNqCloudRegion.setCloudRegionId("DFW"); - aaiNqCloudRegion.setCloudRegionVersion("v1"); - aaiNqCloudRegion.setComplexName("SharedNode"); - aaiNqCloudRegion.setResourceVersion("1504789196021"); - assertNotNull(aaiNqCloudRegion); - assertEquals("Rackspace", aaiNqCloudRegion.getCloudOwner()); - assertEquals("DFW", aaiNqCloudRegion.getCloudRegionId()); - assertEquals("v1", aaiNqCloudRegion.getCloudRegionVersion()); - assertEquals("SharedNode", aaiNqCloudRegion.getComplexName()); - assertEquals("1504789196021", aaiNqCloudRegion.getResourceVersion()); - } -} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java deleted file mode 100644 index adbd9379b..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertNotNull; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -public class AaiNqExtraPropertiesTest { - - @BeforeClass - public static void setUpBeforeClass() throws Exception {} - - @AfterClass - public static void tearDownAfterClass() throws Exception {} - - @Test - public void test() { - AaiNqExtraProperties aaiNqExtraProperties = new AaiNqExtraProperties(); - aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty("model.model-name", "service-instance")); - aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty("model.model-type", "widget")); - aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty("model.model-version", "1.0")); - aaiNqExtraProperties.getExtraProperty() - .add(new AaiNqExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); - aaiNqExtraProperties.getExtraProperty() - .add(new AaiNqExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); - assertNotNull(aaiNqExtraProperties); - } - -} 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 deleted file mode 100644 index 25f125945..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertyTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -public class AaiNqExtraPropertyTest { - - @BeforeClass - public static void setUpBeforeClass() throws Exception {} - - @AfterClass - public static void tearDownAfterClass() throws Exception {} - - @Test - public void test() { - AaiNqExtraProperty aaiNqExtraProperty = new AaiNqExtraProperty(); - aaiNqExtraProperty.setPropertyName("model.model-name"); - aaiNqExtraProperty.setPropertyValue("service-instance"); - assertNotNull(aaiNqExtraProperty); - - assertEquals("model.model-name", aaiNqExtraProperty.getPropertyName()); - assertEquals("service-instance", aaiNqExtraProperty.getPropertyValue()); - } -} 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 deleted file mode 100644 index 7a94dccf0..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqGenericVnfTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -public class AaiNqGenericVnfTest { - - @BeforeClass - public static void setUpBeforeClass() throws Exception {} - - @AfterClass - public static void tearDownAfterClass() throws Exception {} - - @Test - public void test() { - AaiNqGenericVnf aaiNqGenericVnf = new AaiNqGenericVnf(); - 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.setModelCustomizationId("SomeCustomizationId"); - 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(true, aaiNqGenericVnf.getEncrypedAccessFlag()); - assertEquals(false, aaiNqGenericVnf.getInMaint()); - assertEquals("aa", aaiNqGenericVnf.getIpv4Loopback0Address()); - assertEquals("oamAddress", aaiNqGenericVnf.getIpv4OamAddress()); - assertEquals(false, aaiNqGenericVnf.getIsClosedLoopDisabled()); - assertEquals("653d2caa-7e47-4614-95b3-26c8d82755b8", aaiNqGenericVnf.getModelInvariantId()); - assertEquals("98f410f6-4c63-447b-97d2-42508437cec0", aaiNqGenericVnf.getModelVersionId()); - assertEquals("SomeCustomizationId", aaiNqGenericVnf.getModelCustomizationId()); - assertEquals("active", aaiNqGenericVnf.getOperationalState()); - assertEquals("653d2caa-7e47-4614-95b3-26c8d82755b8", aaiNqGenericVnf.getPersonaModelId()); - assertEquals("98f410f6-4c63-447b-97d2-42508437cec0", aaiNqGenericVnf.getPersonaModelVersion()); - assertEquals("complete", aaiNqGenericVnf.getProvStatus()); - assertEquals("1505056714553", aaiNqGenericVnf.getResourceVersion()); - assertEquals("e8cb8968-5411-478b-906a-f28747de72cd", aaiNqGenericVnf.getServiceId()); - assertEquals("ed8b2bce-6b27-4089-992c-4a2c66024bcd", aaiNqGenericVnf.getVnfId()); - assertEquals("vCPEInfraVNF14a", aaiNqGenericVnf.getVnfName()); - assertEquals("malumabb12", aaiNqGenericVnf.getVnfName2()); - assertEquals("vCPEInfraService10/vCPEInfraService10 0", aaiNqGenericVnf.getVnfType()); - } - -} 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 deleted file mode 100644 index 1508891b4..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInstanceFiltersTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============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.assertNotNull; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -public class AaiNqInstanceFiltersTest { - - @BeforeClass - public static void setUpBeforeClass() throws Exception {} - - @AfterClass - public static void tearDownAfterClass() throws Exception {} - - @Test - 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 deleted file mode 100644 index 8b5265a00..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemTest.java +++ /dev/null @@ -1,170 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertNotNull; - -import java.util.LinkedList; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqInventoryResponseItemTest { - private static final Logger logger = LoggerFactory.getLogger(AaiNqInventoryResponseItemTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception {} - - @AfterClass - public static void tearDownAfterClass() throws Exception {} - - @Test - public void test() { - AaiNqInventoryResponseItem aaiNqInventoryResponseItem = new AaiNqInventoryResponseItem(); - aaiNqInventoryResponseItem.setModelName("service-instance"); - AaiNqCloudRegion aaiNqCloudRegion = new 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")); - aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty("model.model-type", "widget")); - 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.setExtraProperties(aaiNqExtraProperties); - AaiNqGenericVnf aaiNqGenericVnf = new 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); - AaiNqInventoryResponseItem serviceItem = new AaiNqInventoryResponseItem(); - 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.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 aaiNqInventoryResponseItems = new AaiNqInventoryResponseItems(); - aaiNqInventoryResponseItems.getInventoryResponseItems().add(serviceItem); - aaiNqInventoryResponseItems.getInventoryResponseItems().add(vfModuleItem); - aaiNqInventoryResponseItem.setItems(aaiNqInventoryResponseItems); - aaiNqInventoryResponseItem.setModelName("model-name"); - AaiNqServiceInstance serviceInstance = new AaiNqServiceInstance(); - 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.setTenantId("dhv-test-tenant"); - aaiNqTenant.setTenantName("dhv-test-tenant-name"); - aaiNqTenant.setResourceVersion("1485366334"); - aaiNqInventoryResponseItem.setTenant(aaiNqTenant); - AaiNqVfModule aaiNqVfModule = new 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.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 deleted file mode 100644 index 99c6e5e92..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemsTest.java +++ /dev/null @@ -1,163 +0,0 @@ -/*- - * ============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.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.LinkedList; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqInventoryResponseItemsTest { - private static final Logger logger = LoggerFactory.getLogger(AaiNqInventoryResponseItemsTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception {} - - @AfterClass - public static void tearDownAfterClass() throws Exception {} - - @Test - public void test() { - AaiNqInventoryResponseItem serviceItem = new AaiNqInventoryResponseItem(); - serviceItem.setModelName("service-instance"); - assertEquals("service-instance", serviceItem.getModelName()); - - 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.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.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.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.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.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 aaiNqInventoryResponseItems = new AaiNqInventoryResponseItems(); - 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 deleted file mode 100644 index 2e65a843d..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqNamedQueryTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.UUID; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -public class AaiNqNamedQueryTest { - - @BeforeClass - public static void setUpBeforeClass() throws Exception {} - - @AfterClass - public static void tearDownAfterClass() throws Exception {} - - @Test - public void test() { - AaiNqNamedQuery aaiNqNamedQuery = new AaiNqNamedQuery(); - 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 deleted file mode 100644 index 1f0a8354a..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqQueryParametersTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.UUID; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -public class AaiNqQueryParametersTest { - - @BeforeClass - public static void setUpBeforeClass() throws Exception {} - - @AfterClass - public static void tearDownAfterClass() throws Exception {} - - @Test - public void test() { - AaiNqQueryParameters aaiNqQueryParameters = new AaiNqQueryParameters(); - AaiNqNamedQuery aaiNqNamedQuery = new 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 deleted file mode 100644 index e943c0c01..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestErrorTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertNull; - -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 deleted file mode 100644 index 1ac5e457b..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.UUID; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqRequestTest { - private static final Logger logger = LoggerFactory.getLogger(AaiNqRequestTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception {} - - @AfterClass - public static void tearDownAfterClass() throws Exception {} - - @Test - public void test() { - AaiNqRequest aaiNqRequest = new AaiNqRequest(); - AaiNqInstanceFilters aaiNqInstanceFilters = new AaiNqInstanceFilters(); - - aaiNqRequest.setInstanceFilters(aaiNqInstanceFilters); - assertNotNull(aaiNqRequest.getInstanceFilters()); - AaiNqNamedQuery aaiNqNamedQuery = new AaiNqNamedQuery(); - UUID uuid = UUID.randomUUID(); - aaiNqNamedQuery.setNamedQueryUuid(uuid); - - AaiNqQueryParameters aaiNqQueryParameters = new AaiNqQueryParameters(); - 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 deleted file mode 100644 index c715a22c2..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseTest.java +++ /dev/null @@ -1,160 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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 java.util.LinkedList; - -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqResponseTest { - private static final Logger logger = LoggerFactory.getLogger(AaiNqResponseTest.class); - - @Test - public void test() { - getAaiNqResponse(); - } - - /** - * Get A&AI NQ response. - * - * @return the A&AI NG response - */ - public AaiNqResponse getAaiNqResponse() { - AaiNqInventoryResponseItem serviceItem = new AaiNqInventoryResponseItem(); - 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.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.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.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.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.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 deleted file mode 100644 index d1e8e964e..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java +++ /dev/null @@ -1,261 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.LinkedList; -import java.util.List; -import java.util.UUID; -import org.apache.commons.io.IOUtils; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqResponseWrapperTest { - private static final Logger logger = LoggerFactory.getLogger(AaiNqResponseWrapperTest.class); - - @Test - public void test() { - AaiNqInventoryResponseItem serviceItem = new AaiNqInventoryResponseItem(); - 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.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.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.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.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.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); - AaiNqResponseWrapper aaiNqResponseWarapper = new AaiNqResponseWrapper(); - aaiNqResponseWarapper.setAaiNqResponse(aaiResponse); - 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)); - } - - @Test - public void testCountVfModules() throws Exception { - AaiNqResponseWrapper resp; - - // null item - resp = new AaiNqResponseWrapper(); - assertEquals(0, resp.countVfModules()); - - // no names - resp.setAaiNqResponse(load("AaiNqResponseWrapper-NoNames.json")); - assertEquals(0, resp.countVfModules()); - - // has VF modules - resp.setAaiNqResponse(load("AaiNqResponseWrapper-Vserver.json")); - assertEquals(3, resp.countVfModules()); - } - - @Test - public void testGenVfModuleName() throws Exception { - AaiNqResponseWrapper resp; - - // null item - resp = new AaiNqResponseWrapper(); - assertEquals(null, resp.genVfModuleName()); - - // no names - resp.setAaiNqResponse(load("AaiNqResponseWrapper-NoNames.json")); - assertEquals(null, resp.genVfModuleName()); - - // has VF modules - resp.setAaiNqResponse(load("AaiNqResponseWrapper-Vserver.json")); - assertEquals("my-module-abc_124", resp.genVfModuleName()); - } - - @Test - public void testGetVfModules() throws Exception { - AaiNqResponseWrapper resp; - - // null item - resp = new AaiNqResponseWrapper(); - assertTrue(resp.getVfModuleItems(true).isEmpty()); - - // missing item - resp = new AaiNqResponseWrapper(); - resp.setAaiNqResponse(new AaiNqResponse()); - assertTrue(resp.getVfModuleItems(false).isEmpty()); - - // null item list - resp.setAaiNqResponse(load("AaiNqResponseWrapper-NoItems.json")); - resp.getAaiNqResponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0) - .getItems().setInventoryResponseItems(null); - assertTrue(resp.getVfModuleItems(false).isEmpty()); - - // no modules - resp.setAaiNqResponse(load("AaiNqResponseWrapper-NoModules.json")); - assertTrue(resp.getVfModuleItems(false).isEmpty()); - - // no names - resp.setAaiNqResponse(load("AaiNqResponseWrapper-NoNames.json")); - List lst; - lst = resp.getVfModuleItems(false); - assertEquals(0, lst.size()); - - // base VF modules - resp.setAaiNqResponse(load("AaiNqResponseWrapper-Vserver.json")); - lst = resp.getVfModuleItems(true); - assertEquals(1, lst.size()); - assertEquals("Vfmodule_vLBMS-0809-1", lst.get(0).getVfModule().getVfModuleName()); - - // non base VF modules - resp.setAaiNqResponse(load("AaiNqResponseWrapper-Vserver.json")); - lst = resp.getVfModuleItems(false); - assertEquals(3, lst.size()); - int index; - index = 0; - assertEquals("my-module-abc_1", lst.get(index++).getVfModule().getVfModuleName()); - assertEquals("my-module-abc_123", lst.get(index++).getVfModule().getVfModuleName()); - assertEquals("my-module-abc_34", lst.get(index++).getVfModule().getVfModuleName()); - } - - /** - * Loads a response from a JSON file. - * - * @param fileName name of the file containing the JSON response - * @return the response - * @throws IOException if the file cannot be read - */ - private AaiNqResponse load(String fileName) throws IOException { - String json = IOUtils.toString(getClass().getResource(fileName), StandardCharsets.UTF_8); - return Serialization.gsonPretty.fromJson(json, AaiNqResponse.class); - } -} 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 deleted file mode 100644 index add616dce..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqServiceInstanceTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqServiceInstanceTest { - private static final Logger logger = LoggerFactory.getLogger(AaiNqServiceInstanceTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception {} - - @AfterClass - public static void tearDownAfterClass() throws Exception {} - - @Test - public void test() { - AaiNqServiceInstance aaiNqServiceInstance = new AaiNqServiceInstance(); - 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("dhv-test-vhnfportal-service-instance-id", aaiNqServiceInstance.getServiceInstanceId()); - assertEquals("dhv-test-service-instance-name1", aaiNqServiceInstance.getServiceInstanceName()); - assertEquals("82194af1-3c2c-485a-8f44-420e22a9eaa4", aaiNqServiceInstance.getPersonaModelId()); - assertEquals("1.0", aaiNqServiceInstance.getPersonaModelVersion()); - assertEquals("dhv-test-service-instance-location-id1", aaiNqServiceInstance.getServiceInstanceLocationId()); - assertEquals("1485366092", aaiNqServiceInstance.getResourceVersion()); - assertEquals("SomeID", aaiNqServiceInstance.getModelInvariantId()); - assertEquals("SomeVersion", aaiNqServiceInstance.getModelVersionId()); - 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 deleted file mode 100644 index c1755f9cb..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqTenantTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqTenantTest { - private static final Logger logger = LoggerFactory.getLogger(AaiNqTenantTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception {} - - @AfterClass - public static void tearDownAfterClass() throws Exception {} - - @Test - public void test() { - AaiNqTenant aaiNqTenant = new AaiNqTenant(); - aaiNqTenant.setTenantId("dhv-test-tenant"); - aaiNqTenant.setTenantName("dhv-test-tenant-name"); - aaiNqTenant.setResourceVersion("1485366334"); - assertNotNull(aaiNqTenant); - assertEquals("dhv-test-tenant", aaiNqTenant.getTenantId()); - assertEquals("dhv-test-tenant-name", aaiNqTenant.getTenantName()); - assertEquals("1485366334", aaiNqTenant.getResourceVersion()); - - 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 deleted file mode 100644 index bdda679d5..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVServerTest.java +++ /dev/null @@ -1,101 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.io.File; -import java.nio.file.Files; -import java.util.List; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqVServerTest { - private static final Logger logger = LoggerFactory.getLogger(AaiNqVServerTest.class); - - - @BeforeClass - public static void setUpBeforeClass() throws Exception {} - - @AfterClass - public static void tearDownAfterClass() throws Exception {} - - @Test - public void test() throws Exception { - // deserialize json and verify fields are populated properly - String json = new String(Files - .readAllBytes(new File("src/test/resources/org/onap/policy/aai/AaiNqVServer.json").toPath())); - - AaiNqVServer resp = Serialization.gsonPretty.fromJson(json, AaiNqVServer.class); - - assertEquals(false, resp.getInMaint()); - assertEquals(true, resp.getIsClosedLoopDisabled()); - assertEquals("ACTIVE", resp.getProvStatus()); - assertEquals("1533850964910", resp.getResourceVersion()); - assertEquals("1c94da3f-16f1-4fc7-9ed1-e018dfa62774", resp.getVserverId()); - assertEquals("vlb-ms-0809-1", resp.getVserverName()); - assertEquals("vlb-ms-0809-7", resp.getVserverName2()); - assertEquals("http://localhost:8774/v2.1/4086f396c5e04caf9502c5fdeca575c4/servers/1c94da3f-16f1-4fc7-9ed1-e018dfa62774", - resp.getVserverSelflink()); - - // don't need to verify this in depth, as it has its own tests that do that - RelationshipList relationshipList = resp.getRelationshipList(); - assertNotNull(relationshipList); - - List lst = relationshipList.getRelationships(); - assertNotNull(lst); - - assertEquals(3, lst.size()); - assertEquals("generic-vnf", lst.get(0).getRelatedTo()); - assertEquals("image", lst.get(1).getRelatedTo()); - - logger.info(Serialization.gsonPretty.toJson(resp)); - - // verify that setXxx methods work - relationshipList = new RelationshipList(); - - resp.setInMaint(true); - resp.setIsClosedLoopDisabled(false); - resp.setProvStatus("inactive"); - resp.setRelationshipList(relationshipList); - resp.setResourceVersion("vers"); - resp.setVserverId("vid"); - resp.setVserverName("vname"); - resp.setVserverName2("vname2"); - resp.setVserverSelflink("link"); - - assertEquals(true, resp.getInMaint()); - assertEquals(false, resp.getIsClosedLoopDisabled()); - assertEquals("inactive", resp.getProvStatus()); - assertEquals("vers", resp.getResourceVersion()); - assertEquals("vid", resp.getVserverId()); - assertEquals("vname", resp.getVserverName()); - assertEquals("vname2", resp.getVserverName2()); - assertEquals("link", resp.getVserverSelflink()); - assertEquals(relationshipList, resp.getRelationshipList()); - } - -} 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 deleted file mode 100644 index b82f2b377..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVfModuleTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AaiNqVfModuleTest { - private static final Logger logger = LoggerFactory.getLogger(AaiNqVfModuleTest.class); - - - @BeforeClass - public static void setUpBeforeClass() throws Exception {} - - @AfterClass - public static void tearDownAfterClass() throws Exception {} - - @Test - public void test() { - AaiNqVfModule aaiNqVfModule = new 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"); - aaiNqVfModule.setModelInvariantId("SomeId"); - aaiNqVfModule.setModelVersionId("SomeVersion"); - aaiNqVfModule.setModelCustomizationId("SomeCustomizationId"); - assertNotNull(aaiNqVfModule); - assertEquals("example-vf-module-id-val-49261", aaiNqVfModule.getVfModuleId()); - assertEquals("example-vf-module-name-val-73074", aaiNqVfModule.getVfModuleName()); - assertEquals("example-heat-stack-id-val-86300", aaiNqVfModule.getHeatStackId()); - assertEquals("example-orchestration-status-val-56523", aaiNqVfModule.getOrchestrationStatus()); - assertEquals(true, aaiNqVfModule.getIsBaseVfModule()); - assertEquals("1485366450", aaiNqVfModule.getResourceVersion()); - assertEquals("ef86f9c5-2165-44f3-8fc3-96018b609ea5", aaiNqVfModule.getPersonaModelId()); - assertEquals("1.0", aaiNqVfModule.getPersonaModelVersion()); - assertEquals("example-widget-model-id-val-92571", aaiNqVfModule.getWidgetModelId()); - assertEquals("example-widget-model-version-val-83317", aaiNqVfModule.getWidgetModelVersion()); - assertEquals("example-contrail-service-instance-fqdn-val-86796", - aaiNqVfModule.getContrailServiceInstanceFqdn()); - assertEquals("SomeId", aaiNqVfModule.getModelInvariantId()); - assertEquals("SomeVersion", aaiNqVfModule.getModelVersionId()); - assertEquals("SomeCustomizationId", aaiNqVfModule.getModelCustomizationId()); - 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 deleted file mode 100644 index 495d9f134..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfInstanceTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class PnfInstanceTest { - private static final Logger logger = LoggerFactory.getLogger(PnfInstanceTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception {} - - @AfterClass - public static void tearDownAfterClass() throws Exception {} - - @Test - public void test() { - 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("pnf-instance-name-test", pnfInstance.getPnfInstanceName()); - - 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 deleted file mode 100644 index 0380c15b0..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class PnfTest { - private static final Logger logger = LoggerFactory.getLogger(PnfTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception {} - - @AfterClass - public static void tearDownAfterClass() throws Exception {} - - @Test - public void test() { - Pnf pnf = new Pnf(); - 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 deleted file mode 100644 index e62430ade..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTypeTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertNotNull; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class PnfTypeTest { - private static final Logger logger = LoggerFactory.getLogger(PnfTypeTest.class); - - - @BeforeClass - public static void setUpBeforeClass() throws Exception {} - - @AfterClass - public static void tearDownAfterClass() throws Exception {} - - @Test - 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/RelatedToPropertyTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java deleted file mode 100644 index 832d59f89..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; - -import java.io.File; -import java.nio.file.Files; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class RelatedToPropertyTest { - private static final Logger logger = LoggerFactory.getLogger(RelatedToPropertyTest.class); - - @Test - public void test() throws Exception { - // deserialize json and verify fields are populated properly - String json = new String(Files.readAllBytes( - new File("src/test/resources/org/onap/policy/aai/RelatedToProperty.json").toPath())); - - RelatedToProperty relatedToProperty = Serialization.gsonPretty.fromJson(json, RelatedToProperty.class); - - assertEquals("generic-vnf.vnf-name", relatedToProperty.getPropertyKey()); - assertEquals("vLoadBalancerMS-Vnf-0809-1", relatedToProperty.getPropertyValue()); - - logger.info(Serialization.gsonPretty.toJson(relatedToProperty)); - - // verify that setXxx methods work - relatedToProperty.setPropertyKey("a key"); - relatedToProperty.setPropertyValue("a value"); - - assertEquals("a key", relatedToProperty.getPropertyKey()); - assertEquals("a value", relatedToProperty.getPropertyValue()); - } - -} 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 deleted file mode 100644 index 93b1d32c4..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; - -import java.io.File; -import java.nio.file.Files; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class RelationshipDataTest { - private static final Logger logger = LoggerFactory.getLogger(RelationshipDataTest.class); - - @Test - public void test() throws Exception { - // deserialize json and verify fields are populated properly - String json = new String(Files.readAllBytes( - new File("src/test/resources/org/onap/policy/aai/RelationshipData.json").toPath())); - - RelationshipData relationshipData = Serialization.gsonPretty.fromJson(json, RelationshipData.class); - - assertEquals("generic-vnf.vnf-id", relationshipData.getRelationshipKey()); - assertEquals("807a3f02-f878-436b-870c-f0e91e81570d", relationshipData.getRelationshipValue()); - - logger.info(Serialization.gsonPretty.toJson(relationshipData)); - - // verify that setXxx methods work - relationshipData.setRelationshipKey("a key"); - relationshipData.setRelationshipValue("a value"); - - assertEquals("a key", relationshipData.getRelationshipKey()); - assertEquals("a value", relationshipData.getRelationshipValue()); - } - -} 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 deleted file mode 100644 index d67f2bb8b..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.io.File; -import java.nio.file.Files; -import java.util.LinkedList; -import java.util.List; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class RelationshipListTest { - private static final Logger logger = LoggerFactory.getLogger(RelationshipListTest.class); - - @Test - public void test() throws Exception { - // deserialize json and verify fields are populated properly - String json = new String(Files.readAllBytes( - new File("src/test/resources/org/onap/policy/aai/RelationshipList.json").toPath())); - - RelationshipList relationshipList = Serialization.gsonPretty.fromJson(json, RelationshipList.class); - - List lst = relationshipList.getRelationships(); - assertNotNull(lst); - assertEquals(3, lst.size()); - - // don't need to verify this in depth, as it has its own tests that do that - assertEquals("generic-vnf", lst.get(0).getRelatedTo()); - assertEquals("image", lst.get(1).getRelatedTo()); - assertEquals("flavor", lst.get(2).getRelatedTo()); - - logger.info(Serialization.gsonPretty.toJson(relationshipList)); - - // verify that setXxx methods work - lst = new LinkedList<>(); - lst.add(new Relationship()); - lst.add(new Relationship()); - - relationshipList.setRelationships(lst); - assertEquals(lst, relationshipList.getRelationships()); - } - -} 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 deleted file mode 100644 index f229a091a..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017-2018 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.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.io.File; -import java.nio.file.Files; -import java.util.LinkedList; -import java.util.List; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class RelationshipTest { - private static final Logger logger = LoggerFactory.getLogger(RelationshipTest.class); - - @Test - public void test() throws Exception { - // deserialize json and verify fields are populated properly - String json = new String(Files - .readAllBytes(new File("src/test/resources/org/onap/policy/aai/Relationship.json").toPath())); - - Relationship relationship = Serialization.gsonPretty.fromJson(json, Relationship.class); - - assertEquals("/aai/v11/network/generic-vnfs/generic-vnf/807a3f02-f878-436b-870c-f0e91e81570d", - relationship.getRelatedLink()); - assertEquals("generic-vnf", relationship.getRelatedTo()); - - // don't need to verify this in depth, as it has its own tests that do that - List relatedToProperty = relationship.getRelatedToProperty(); - assertNotNull(relatedToProperty); - assertEquals(2, relatedToProperty.size()); - assertEquals("vLoadBalancerMS-Vnf-0809-1", relatedToProperty.get(0).getPropertyValue()); - assertEquals("vLoadBalancerMS-Vnf-0809-2", relatedToProperty.get(1).getPropertyValue()); - - // don't need to verify this in depth, as it has its own tests that do that - List relationshipData = relationship.getRelationshipData(); - assertNotNull(relationshipData); - assertEquals(2, relationshipData.size()); - assertEquals("807a3f02-f878-436b-870c-f0e91e81570d", relationshipData.get(0).getRelationshipValue()); - assertEquals("907a3f02-f878-436b-870c-f0e91e81570e", relationshipData.get(1).getRelationshipValue()); - - logger.info(Serialization.gsonPretty.toJson(relationship)); - - // verify that setXxx methods work - relatedToProperty = new LinkedList<>(); - relatedToProperty.add(new RelatedToProperty()); - relatedToProperty.add(new RelatedToProperty()); - relatedToProperty.add(new RelatedToProperty()); - - relationshipData = new LinkedList<>(); - relationshipData.add(new RelationshipData()); - relationshipData.add(new RelationshipData()); - relationshipData.add(new RelationshipData()); - - relationship.setRelatedLink("related-link"); - relationship.setRelatedTo("related-to"); - relationship.setRelatedToProperty(relatedToProperty); - relationship.setRelationshipData(relationshipData); - - assertEquals("related-link", relationship.getRelatedLink()); - assertEquals("related-to", relationship.getRelatedTo()); - assertEquals(relatedToProperty, relationship.getRelatedToProperty()); - assertEquals(relationshipData, relationship.getRelationshipData()); - } - -} 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 deleted file mode 100644 index 69004e7f3..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ============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.assertNotNull; - -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/aai/src/test/resources/org/onap/policy/aai/AaiGetResponseError.json b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiGetResponseError.json deleted file mode 100644 index 6751fef5c..000000000 --- a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiGetResponseError.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "requestError": { - "serviceException": { - "messageId": "SVC3001", - "text": "Resource not found for %1 using id %2 (msg=%3) (ec=%4)", - "variables": [ - "GET", - "network/generic-vnfs/generic-vnf/3f02-f878-436b-870c-f0e91e81570d", - "Node Not Found:No Node of type generic-vnf found at: network/generic-vnfs/generic-vnf/3f02-f878-436b-870c-f0e91e81570d", - "ERR.5.4.6114" - ] - } - } -} diff --git a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiGetVnfResponse.json b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiGetVnfResponse.json deleted file mode 100644 index faa0e0e1b..000000000 --- a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiGetVnfResponse.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "in-maint": false, - "ipv4-oam-address": "10.0.150.1", - "is-closed-loop-disabled": true, - "model-customization-id": "6c1a5439-3b77-4d8a-bb2b-9fe7006ad671", - "model-invariant-id": "53638a85-361a-437d-8830-4b0d5329225e", - "model-version-id": "a82cd55f-1452-4c36-941a-c9f970a3e67c", - "nf-function": "", - "nf-naming-code": "", - "nf-role": "vLB", - "nf-type": "", - "orchestration-status": "Active", - "prov-status": "PROV", - "relationship-list": { - "relationship": [ - { - "related-link": "/aai/v11/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vLB/service-instances/service-instance/b66d24cc-feca-4fdc-8090-2e9539a8bbac", - "related-to": "service-instance", - "related-to-property": [ - { - "property-key": "service-instance.service-instance-name", - "property-value": "vLoadBalancerMS-Service-0809-1" - } - ], - "relationship-data": [ - { - "relationship-key": "customer.global-customer-id", - "relationship-value": "Demonstration" - }, - { - "relationship-key": "service-subscription.service-type", - "relationship-value": "vLB" - }, - { - "relationship-key": "service-instance.service-instance-id", - "relationship-value": "b66d24cc-feca-4fdc-8090-2e9539a8bbac" - } - ] - }, - { - "related-link": "/aai/v11/business/lines-of-business/line-of-business/Test-Business", - "related-to": "line-of-business", - "relationship-data": [ - { - "relationship-key": "line-of-business.line-of-business-name", - "relationship-value": "Test-Business" - } - ] - }, - { - "related-link": "/aai/v11/business/platforms/platform/Test-Platform", - "related-to": "platform", - "relationship-data": [ - { - "relationship-key": "platform.platform-name", - "relationship-value": "Test-Platform" - } - ] - }, - { - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/4086f396c5e04caf9502c5fdeca575c4/vservers/vserver/191729bd-cb1d-485d-aa06-b20c888272a8", - "related-to": "vserver", - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vdns-ms01-0809-1" - } - ], - "relationship-data": [ - { - "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "CloudOwner" - }, - { - "relationship-key": "cloud-region.cloud-region-id", - "relationship-value": "RegionOne" - }, - { - "relationship-key": "tenant.tenant-id", - "relationship-value": "4086f396c5e04caf9502c5fdeca575c4" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "191729bd-cb1d-485d-aa06-b20c888272a8" - } - ] - }, - { - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/4086f396c5e04caf9502c5fdeca575c4/vservers/vserver/1c94da3f-16f1-4fc7-9ed1-e018dfa62774", - "related-to": "vserver", - "related-to-property": [ - { - "property-key": "vserver.vserver-name", - "property-value": "vlb-ms-0809-1" - } - ], - "relationship-data": [ - { - "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "CloudOwner" - }, - { - "relationship-key": "cloud-region.cloud-region-id", - "relationship-value": "RegionOne" - }, - { - "relationship-key": "tenant.tenant-id", - "relationship-value": "4086f396c5e04caf9502c5fdeca575c4" - }, - { - "relationship-key": "vserver.vserver-id", - "relationship-value": "1c94da3f-16f1-4fc7-9ed1-e018dfa62774" - } - ] - } - ] - }, - "resource-version": "1533850960381", - "service-id": "50e1b0be-e0c9-48e2-9f42-15279a783ee8", - "vnf-id": "807a3f02-f878-436b-870c-f0e91e81570d", - "vnf-name": "vLoadBalancerMS-Vnf-0809-2", - "vnf-type": "vLoadBalancerMS/vLoadBalancerMS 0" -} diff --git a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiGetVserverResponse.json b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiGetVserverResponse.json deleted file mode 100644 index 19885942e..000000000 --- a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiGetVserverResponse.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "vserver": [ - { - "in-maint": false, - "is-closed-loop-disabled": true, - "prov-status": "ACTIVE", - "relationship-list": { - "relationship": [ - { - "related-link": "/aai/v11/network/generic-vnfs/generic-vnf/807a3f02-f878-436b-870c-f0e91e81570d", - "related-to": "generic-vnf", - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "vLoadBalancerMS-Vnf-0809-2" - } - ], - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "807a3f02-f878-436b-870c-f0e91e81570d" - } - ] - }, - { - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/6e219e86-cd94-4989-9119-def29aa10b12", - "related-to": "image", - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ], - "relationship-data": [ - { - "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "CloudOwner" - }, - { - "relationship-key": "cloud-region.cloud-region-id", - "relationship-value": "RegionOne" - }, - { - "relationship-key": "image.image-id", - "relationship-value": "6e219e86-cd94-4989-9119-def29aa10b12" - } - ] - }, - { - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "related-to": "flavor", - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ], - "relationship-data": [ - { - "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "CloudOwner" - }, - { - "relationship-key": "cloud-region.cloud-region-id", - "relationship-value": "RegionOne" - }, - { - "relationship-key": "flavor.flavor-id", - "relationship-value": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ] - } - ] - }, - "resource-version": "1533850964910", - "vserver-id": "1c94da3f-16f1-4fc7-9ed1-e018dfa62774", - "vserver-name": "vlb-ms-0809-1", - "vserver-name2": "vlb-ms-0809-7", - "vserver-selflink": "http://localhost:8774/v2.1/4086f396c5e04caf9502c5fdeca575c4/servers/1c94da3f-16f1-4fc7-9ed1-e018dfa62774" - } - ] -} diff --git a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoItems.json b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoItems.json deleted file mode 100644 index 996692402..000000000 --- a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoItems.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "inventory-response-item": [ - { - "extra-properties": {}, - "inventory-response-items": { - "inventory-response-item": [ - { - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "a82cd55f-1452-4c36-941a-c9f970a3e67c" - }, - { - "property-name": "model-ver.model-name", - "property-value": "vLoadBalancerMS" - }, - { - "property-name": "model.model-type", - "property-value": "resource" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "53638a85-361a-437d-8830-4b0d5329225e" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1.0" - } - ] - }, - "generic-vnf": { - "in-maint": false, - "ipv4-oam-address": "10.0.150.1", - "is-closed-loop-disabled": false, - "model-customization-id": "6c1a5439-3b77-4d8a-bb2b-9fe7006ad671", - "model-invariant-id": "53638a85-361a-437d-8830-4b0d5329225e", - "model-version-id": "a82cd55f-1452-4c36-941a-c9f970a3e67c", - "nf-function": "", - "nf-naming-code": "", - "nf-role": "vLB", - "nf-type": "", - "orchestration-status": "Active", - "prov-status": "PROV", - "resource-version": "1533850960381", - "service-id": "50e1b0be-e0c9-48e2-9f42-15279a783ee8", - "vnf-id": "807a3f02-f878-436b-870c-f0e91e81570d", - "vnf-name": "vLoadBalancerMS-Vnf-0809-2", - "vnf-type": "vLoadBalancerMS/vLoadBalancerMS 0" - }, - "inventory-response-items": { - "inventory-response-item": [ - ] - }, - "model-name": "vLoadBalancerMS" - }, - { - "extra-properties": {}, - "inventory-response-items": { - "inventory-response-item": [ - { - "cloud-region": { - "cloud-owner": "CloudOwner", - "cloud-region-id": "RegionOne", - "cloud-region-version": "v2.5", - "cloud-type": "openstack", - "cloud-zone": "zone-1", - "owner-defined-type": "owner type", - "resource-version": "1533652058185", - "sriov-automation": false - }, - "extra-properties": {} - } - ] - }, - "tenant": { - "resource-version": "1533652058206", - "tenant-id": "4086f396c5e04caf9502c5fdeca575c4", - "tenant-name": "PFPP" - } - } - ] - }, - "vserver": { - "in-maint": false, - "is-closed-loop-disabled": false, - "prov-status": "ACTIVE", - "resource-version": "1533850964910", - "vserver-id": "1c94da3f-16f1-4fc7-9ed1-e018dfa62774", - "vserver-name": "vlb-ms-0809-1", - "vserver-name2": "vlb-ms-0809-1", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/4086f396c5e04caf9502c5fdeca575c4/servers/1c94da3f-16f1-4fc7-9ed1-e018dfa62774" - } - } - ] -} diff --git a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoModules.json b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoModules.json deleted file mode 100644 index 2dd6090c7..000000000 --- a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoModules.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "inventory-response-item": [ - { - "extra-properties": {}, - "inventory-response-items": { - "inventory-response-item": [ - { - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "a82cd55f-1452-4c36-941a-c9f970a3e67c" - }, - { - "property-name": "model-ver.model-name", - "property-value": "vLoadBalancerMS" - }, - { - "property-name": "model.model-type", - "property-value": "resource" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "53638a85-361a-437d-8830-4b0d5329225e" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1.0" - } - ] - }, - "generic-vnf": { - "in-maint": false, - "ipv4-oam-address": "10.0.150.1", - "is-closed-loop-disabled": false, - "model-customization-id": "6c1a5439-3b77-4d8a-bb2b-9fe7006ad671", - "model-invariant-id": "53638a85-361a-437d-8830-4b0d5329225e", - "model-version-id": "a82cd55f-1452-4c36-941a-c9f970a3e67c", - "nf-function": "", - "nf-naming-code": "", - "nf-role": "vLB", - "nf-type": "", - "orchestration-status": "Active", - "prov-status": "PROV", - "resource-version": "1533850960381", - "service-id": "50e1b0be-e0c9-48e2-9f42-15279a783ee8", - "vnf-id": "807a3f02-f878-436b-870c-f0e91e81570d", - "vnf-name": "vLoadBalancerMS-Vnf-0809-2", - "vnf-type": "vLoadBalancerMS/vLoadBalancerMS 0" - }, - "inventory-response-items": { - "inventory-response-item": [ - { - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "4feb459d-d8ef-4cde-a714-235c79787962" - }, - { - "property-name": "model-ver.model-name", - "property-value": "vLoadBalancerMS" - }, - { - "property-name": "model.model-type", - "property-value": "service" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "b5477216-9b7d-4e75-8777-5b632d406759" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1.0" - } - ] - }, - "model-name": "vLoadBalancerMS", - "service-instance": { - "environment-context": "General_Revenue-Bearing", - "model-invariant-id": "b5477216-9b7d-4e75-8777-5b632d406759", - "model-version-id": "4feb459d-d8ef-4cde-a714-235c79787962", - "orchestration-status": "Active", - "resource-version": "1533848425145", - "service-instance-id": "b66d24cc-feca-4fdc-8090-2e9539a8bbac", - "service-instance-name": "vLoadBalancerMS-Service-0809-1", - "workload-context": "Production" - } - } - ] - }, - "model-name": "vLoadBalancerMS" - }, - { - "extra-properties": {}, - "inventory-response-items": { - "inventory-response-item": [ - { - "cloud-region": { - "cloud-owner": "CloudOwner", - "cloud-region-id": "RegionOne", - "cloud-region-version": "v2.5", - "cloud-type": "openstack", - "cloud-zone": "zone-1", - "owner-defined-type": "owner type", - "resource-version": "1533652058185", - "sriov-automation": false - }, - "extra-properties": {} - } - ] - }, - "tenant": { - "resource-version": "1533652058206", - "tenant-id": "4086f396c5e04caf9502c5fdeca575c4", - "tenant-name": "PFPP" - } - } - ] - }, - "vserver": { - "in-maint": false, - "is-closed-loop-disabled": false, - "prov-status": "ACTIVE", - "resource-version": "1533850964910", - "vserver-id": "1c94da3f-16f1-4fc7-9ed1-e018dfa62774", - "vserver-name": "vlb-ms-0809-1", - "vserver-name2": "vlb-ms-0809-1", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/4086f396c5e04caf9502c5fdeca575c4/servers/1c94da3f-16f1-4fc7-9ed1-e018dfa62774" - } - } - ] -} diff --git a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoNames.json b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoNames.json deleted file mode 100644 index 9c1a9bc5d..000000000 --- a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-NoNames.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "inventory-response-item": [ - { - "extra-properties": {}, - "inventory-response-items": { - "inventory-response-item": [ - { - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "a82cd55f-1452-4c36-941a-c9f970a3e67c" - }, - { - "property-name": "model-ver.model-name", - "property-value": "vLoadBalancerMS" - }, - { - "property-name": "model.model-type", - "property-value": "resource" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "53638a85-361a-437d-8830-4b0d5329225e" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1.0" - } - ] - }, - "generic-vnf": { - "in-maint": false, - "ipv4-oam-address": "10.0.150.1", - "is-closed-loop-disabled": false, - "model-customization-id": "6c1a5439-3b77-4d8a-bb2b-9fe7006ad671", - "model-invariant-id": "53638a85-361a-437d-8830-4b0d5329225e", - "model-version-id": "a82cd55f-1452-4c36-941a-c9f970a3e67c", - "nf-function": "", - "nf-naming-code": "", - "nf-role": "vLB", - "nf-type": "", - "orchestration-status": "Active", - "prov-status": "PROV", - "resource-version": "1533850960381", - "service-id": "50e1b0be-e0c9-48e2-9f42-15279a783ee8", - "vnf-id": "807a3f02-f878-436b-870c-f0e91e81570d", - "vnf-name": "vLoadBalancerMS-Vnf-0809-2", - "vnf-type": "vLoadBalancerMS/vLoadBalancerMS 0" - }, - "inventory-response-items": { - "inventory-response-item": [ - { - "model-name": "vLoadBalancerMS", - "service-instance": { - "environment-context": "General_Revenue-Bearing", - "model-invariant-id": "b5477216-9b7d-4e75-8777-5b632d406759", - "model-version-id": "4feb459d-d8ef-4cde-a714-235c79787962", - "orchestration-status": "Active", - "resource-version": "1533848425145", - "service-instance-id": "b66d24cc-feca-4fdc-8090-2e9539a8bbac", - "service-instance-name": "vLoadBalancerMS-Service-0809-1", - "workload-context": "Production" - } - }, - { - "vf-module": { - "is-base-vf-module": false, - "model-invariant-id": "6d01b7f1-769a-4080-b8ea-57fd03ef1572", - "model-version-id": "3302088a-457e-496c-9282-2eb3d5b8dd24", - "resource-version": "1534270663202", - "vf-module-id": "dummy_807a3f02-f878-436b-870c-f0e91e81570d", - "vf-module-name": "dummy_807a3f02-f878-436b-870c-f0e91e81570d" - } - }, - { - "vf-module": { - "heat-stack-id": "Vfmodule_vLBMS-0809-1/83ab2394-2b22-40f9-8ba2-383698dd2958", - "is-base-vf-module": true, - "model-customization-id": "5198f732-8f22-48f9-98f8-d6b8b50118be", - "model-invariant-id": "1f566a81-58ba-4762-81f9-d2259509429a", - "model-version-id": "94827d25-4ac3-4850-abfc-7b6e3c531db4", - "module-index": 0, - "orchestration-status": "active", - "resource-version": "1533850416834", - "vf-module-id": "b861467d-d3a7-4b21-81b3-94d928a7e8b7", - "vf-module-name": "Vfmodule_vLBMS-0809-1" - } - } - ] - }, - "model-name": "vLoadBalancerMS" - }, - { - "extra-properties": {}, - "inventory-response-items": { - "inventory-response-item": [ - { - "cloud-region": { - "cloud-owner": "CloudOwner", - "cloud-region-id": "RegionOne", - "cloud-region-version": "v2.5", - "cloud-type": "openstack", - "cloud-zone": "zone-1", - "owner-defined-type": "owner type", - "resource-version": "1533652058185", - "sriov-automation": false - }, - "extra-properties": {} - } - ] - }, - "tenant": { - "resource-version": "1533652058206", - "tenant-id": "4086f396c5e04caf9502c5fdeca575c4", - "tenant-name": "PFPP" - } - } - ] - }, - "vserver": { - "in-maint": false, - "is-closed-loop-disabled": false, - "prov-status": "ACTIVE", - "resource-version": "1533850964910", - "vserver-id": "1c94da3f-16f1-4fc7-9ed1-e018dfa62774", - "vserver-name": "vlb-ms-0809-1", - "vserver-name2": "vlb-ms-0809-1", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/4086f396c5e04caf9502c5fdeca575c4/servers/1c94da3f-16f1-4fc7-9ed1-e018dfa62774" - } - } - ] -} diff --git a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-Vserver.json b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-Vserver.json deleted file mode 100644 index fb341dc65..000000000 --- a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqResponseWrapper-Vserver.json +++ /dev/null @@ -1,157 +0,0 @@ -{ - "inventory-response-item": [ - { - "extra-properties": {}, - "inventory-response-items": { - "inventory-response-item": [ - { - "extra-properties": { - "extra-property": [ - { - "property-name": "model-ver.model-version-id", - "property-value": "a82cd55f-1452-4c36-941a-c9f970a3e67c" - }, - { - "property-name": "model-ver.model-name", - "property-value": "vLoadBalancerMS" - }, - { - "property-name": "model.model-type", - "property-value": "resource" - }, - { - "property-name": "model.model-invariant-id", - "property-value": "53638a85-361a-437d-8830-4b0d5329225e" - }, - { - "property-name": "model-ver.model-version", - "property-value": "1.0" - } - ] - }, - "generic-vnf": { - "in-maint": false, - "ipv4-oam-address": "10.0.150.1", - "is-closed-loop-disabled": false, - "model-customization-id": "6c1a5439-3b77-4d8a-bb2b-9fe7006ad671", - "model-invariant-id": "53638a85-361a-437d-8830-4b0d5329225e", - "model-version-id": "a82cd55f-1452-4c36-941a-c9f970a3e67c", - "nf-function": "", - "nf-naming-code": "", - "nf-role": "vLB", - "nf-type": "", - "orchestration-status": "Active", - "prov-status": "PROV", - "resource-version": "1533850960381", - "service-id": "50e1b0be-e0c9-48e2-9f42-15279a783ee8", - "vnf-id": "807a3f02-f878-436b-870c-f0e91e81570d", - "vnf-name": "vLoadBalancerMS-Vnf-0809-2", - "vnf-type": "vLoadBalancerMS/vLoadBalancerMS 0" - }, - "inventory-response-items": { - "inventory-response-item": [ - { - "model-name": "vLoadBalancerMS", - "service-instance": { - "environment-context": "General_Revenue-Bearing", - "model-invariant-id": "b5477216-9b7d-4e75-8777-5b632d406759", - "model-version-id": "4feb459d-d8ef-4cde-a714-235c79787962", - "orchestration-status": "Active", - "resource-version": "1533848425145", - "service-instance-id": "b66d24cc-feca-4fdc-8090-2e9539a8bbac", - "service-instance-name": "vLoadBalancerMS-Service-0809-1", - "workload-context": "Production" - } - }, - { - "vf-module": { - "is-base-vf-module": false, - "model-invariant-id": "6d01b7f1-769a-4080-b8ea-57fd03ef1572", - "model-version-id": "3302088a-457e-496c-9282-2eb3d5b8dd24", - "resource-version": "1534270663202", - "vf-module-id": "dummy_807a3f02-f878-436b-870c-f0e91e81570d", - "vf-module-name": "dummy_807a3f02-f878-436b-870c-f0e91e81570d" - } - }, - { - "vf-module": { - "is-base-vf-module": false, - "vf-module-name": "my-module-abc_1" - } - }, - { - "vf-module": { - "heat-stack-id": "Vfmodule_vLBMS-0809-1/83ab2394-2b22-40f9-8ba2-383698dd2958", - "is-base-vf-module": true, - "model-customization-id": "5198f732-8f22-48f9-98f8-d6b8b50118be", - "model-invariant-id": "1f566a81-58ba-4762-81f9-d2259509429a", - "model-version-id": "94827d25-4ac3-4850-abfc-7b6e3c531db4", - "module-index": 0, - "orchestration-status": "active", - "resource-version": "1533850416834", - "vf-module-id": "b861467d-d3a7-4b21-81b3-94d928a7e8b7", - "vf-module-name": "Vfmodule_vLBMS-0809-1" - } - }, - { - "vf-module": { - "is-base-vf-module": false, - "vf-module-name": "my-module-abc_123" - } - }, - { - "vf-module": { - "is-base-vf-module": false, - "vf-module-name": "no-underscore-number-9999" - } - }, - { - "vf-module": { - "is-base-vf-module": false, - "vf-module-name": "my-module-abc_34" - } - } - ] - }, - "model-name": "vLoadBalancerMS" - }, - { - "extra-properties": {}, - "inventory-response-items": { - "inventory-response-item": [ - { - "cloud-region": { - "cloud-owner": "CloudOwner", - "cloud-region-id": "RegionOne", - "cloud-region-version": "v2.5", - "cloud-type": "openstack", - "cloud-zone": "zone-1", - "owner-defined-type": "owner type", - "resource-version": "1533652058185", - "sriov-automation": false - }, - "extra-properties": {} - } - ] - }, - "tenant": { - "resource-version": "1533652058206", - "tenant-id": "4086f396c5e04caf9502c5fdeca575c4", - "tenant-name": "PFPP" - } - } - ] - }, - "vserver": { - "in-maint": false, - "is-closed-loop-disabled": false, - "prov-status": "ACTIVE", - "resource-version": "1533850964910", - "vserver-id": "1c94da3f-16f1-4fc7-9ed1-e018dfa62774", - "vserver-name": "vlb-ms-0809-1", - "vserver-name2": "vlb-ms-0809-1", - "vserver-selflink": "http://10.12.25.2:8774/v2.1/4086f396c5e04caf9502c5fdeca575c4/servers/1c94da3f-16f1-4fc7-9ed1-e018dfa62774" - } - } - ] -} diff --git a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqVServer.json b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqVServer.json deleted file mode 100644 index 0a59d8a87..000000000 --- a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/AaiNqVServer.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "in-maint": false, - "is-closed-loop-disabled": true, - "prov-status": "ACTIVE", - "relationship-list": { - "relationship": [ - { - "related-link": "/aai/v11/network/generic-vnfs/generic-vnf/807a3f02-f878-436b-870c-f0e91e81570d", - "related-to": "generic-vnf", - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "vLoadBalancerMS-Vnf-0809-2" - } - ], - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "807a3f02-f878-436b-870c-f0e91e81570d" - } - ] - }, - { - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/6e219e86-cd94-4989-9119-def29aa10b12", - "related-to": "image", - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ], - "relationship-data": [ - { - "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "CloudOwner" - }, - { - "relationship-key": "cloud-region.cloud-region-id", - "relationship-value": "RegionOne" - }, - { - "relationship-key": "image.image-id", - "relationship-value": "6e219e86-cd94-4989-9119-def29aa10b12" - } - ] - }, - { - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "related-to": "flavor", - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ], - "relationship-data": [ - { - "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "CloudOwner" - }, - { - "relationship-key": "cloud-region.cloud-region-id", - "relationship-value": "RegionOne" - }, - { - "relationship-key": "flavor.flavor-id", - "relationship-value": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ] - } - ] - }, - "resource-version": "1533850964910", - "vserver-id": "1c94da3f-16f1-4fc7-9ed1-e018dfa62774", - "vserver-name": "vlb-ms-0809-1", - "vserver-name2": "vlb-ms-0809-7", - "vserver-selflink": "http://localhost:8774/v2.1/4086f396c5e04caf9502c5fdeca575c4/servers/1c94da3f-16f1-4fc7-9ed1-e018dfa62774" -} diff --git a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/RelatedToProperty.json b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/RelatedToProperty.json deleted file mode 100644 index 2211b3725..000000000 --- a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/RelatedToProperty.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "property-key": "generic-vnf.vnf-name", - "property-value": "vLoadBalancerMS-Vnf-0809-1" -} diff --git a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/Relationship.json b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/Relationship.json deleted file mode 100644 index 39d9ce1b6..000000000 --- a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/Relationship.json +++ /dev/null @@ -1,25 +0,0 @@ - -{ - "related-link": "/aai/v11/network/generic-vnfs/generic-vnf/807a3f02-f878-436b-870c-f0e91e81570d", - "related-to": "generic-vnf", - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "vLoadBalancerMS-Vnf-0809-1" - }, - { - "property-key": "generic-vnf.vnf-name", - "property-value": "vLoadBalancerMS-Vnf-0809-2" - } - ], - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "807a3f02-f878-436b-870c-f0e91e81570d" - }, - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "907a3f02-f878-436b-870c-f0e91e81570e" - } - ] -} diff --git a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/RelationshipData.json b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/RelationshipData.json deleted file mode 100644 index 4bbb39e8f..000000000 --- a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/RelationshipData.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "807a3f02-f878-436b-870c-f0e91e81570d" -} diff --git a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/RelationshipList.json b/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/RelationshipList.json deleted file mode 100644 index ae180f056..000000000 --- a/controlloop/common/model-impl/aai/src/test/resources/org/onap/policy/aai/RelationshipList.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "relationship": [ - { - "related-link": "/aai/v11/network/generic-vnfs/generic-vnf/807a3f02-f878-436b-870c-f0e91e81570d", - "related-to": "generic-vnf", - "related-to-property": [ - { - "property-key": "generic-vnf.vnf-name", - "property-value": "vLoadBalancerMS-Vnf-0809-2" - } - ], - "relationship-data": [ - { - "relationship-key": "generic-vnf.vnf-id", - "relationship-value": "807a3f02-f878-436b-870c-f0e91e81570d" - } - ] - }, - { - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/6e219e86-cd94-4989-9119-def29aa10b12", - "related-to": "image", - "related-to-property": [ - { - "property-key": "image.image-name", - "property-value": "unknown" - } - ], - "relationship-data": [ - { - "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "CloudOwner" - }, - { - "relationship-key": "cloud-region.cloud-region-id", - "relationship-value": "RegionOne" - }, - { - "relationship-key": "image.image-id", - "relationship-value": "6e219e86-cd94-4989-9119-def29aa10b12" - } - ] - }, - { - "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", - "related-to": "flavor", - "related-to-property": [ - { - "property-key": "flavor.flavor-name", - "property-value": "m1.medium" - } - ], - "relationship-data": [ - { - "relationship-key": "cloud-region.cloud-owner", - "relationship-value": "CloudOwner" - }, - { - "relationship-key": "cloud-region.cloud-region-id", - "relationship-value": "RegionOne" - }, - { - "relationship-key": "flavor.flavor-id", - "relationship-value": "764efb04-5a46-4806-a766-2bdd24559f39" - } - ] - } - ] -} diff --git a/controlloop/common/model-impl/appc/pom.xml b/controlloop/common/model-impl/appc/pom.xml deleted file mode 100644 index 628e27ed4..000000000 --- a/controlloop/common/model-impl/appc/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - 4.0.0 - - - org.onap.policy.drools-applications.controlloop.common.model-impl - model-impl - 1.4.0-SNAPSHOT - - - appc - - - - junit - junit - test - - - com.google.code.gson - gson - provided - - - - diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java deleted file mode 100644 index e58c45b5b..000000000 --- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java +++ /dev/null @@ -1,216 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2019 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.appc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Map; -import java.util.UUID; - -public class CommonHeader implements Serializable { - private static final long serialVersionUID = -3581658269910980336L; - - @SerializedName("TimeStamp") - private Instant timeStamp = Instant.now(); - - @SerializedName("APIver") - private String apiVer = "1.01"; - - @SerializedName("OriginatorID") - private String originatorId; - - @SerializedName("RequestID") - private UUID requestId; - - @SerializedName("SubRequestID") - private String subRequestId; - - @SerializedName("RequestTrack") - private Collection requestTrack = new ArrayList<>(); - - @SerializedName("Flags") - private Collection> flags = new ArrayList<>(); - - public CommonHeader() {} - - /** - * Construct an instance from an existing instance. - * - * @param commonHeader the existing instance - */ - public CommonHeader(CommonHeader commonHeader) { - this.originatorId = commonHeader.originatorId; - this.requestId = commonHeader.requestId; - this.subRequestId = commonHeader.subRequestId; - if (commonHeader.requestTrack != null) { - this.requestTrack.addAll(commonHeader.requestTrack); - } - if (commonHeader.flags != null) { - this.flags.addAll(commonHeader.flags); - } - } - - public Instant getTimeStamp() { - return timeStamp; - } - - public void setTimeStamp(Instant timeStamp) { - this.timeStamp = timeStamp; - } - - public String getApiVer() { - return apiVer; - } - - public void setApiVer(String apiVer) { - this.apiVer = apiVer; - } - - public String getOriginatorId() { - return originatorId; - } - - public void setOriginatorId(String originatorId) { - this.originatorId = originatorId; - } - - public UUID getRequestId() { - return requestId; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public String getSubRequestId() { - return subRequestId; - } - - public void setSubRequestId(String subRequestId) { - this.subRequestId = subRequestId; - } - - public Collection getRequestTrack() { - return requestTrack; - } - - public void setRequestTrack(Collection requestTrack) { - this.requestTrack = requestTrack; - } - - public Collection> getFlags() { - return flags; - } - - public void setFlags(Collection> flags) { - this.flags = flags; - } - - @Override - public String toString() { - return "CommonHeader [TimeStamp=" + timeStamp + ", APIver=" + apiVer + ", OriginatorId=" + originatorId - + ", RequestId=" + requestId + ", SubrequestId=" + subRequestId + ", RequestTrack=" + requestTrack - + ", Flags=" + flags + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((apiVer == null) ? 0 : apiVer.hashCode()); - result = prime * result + ((flags == null) ? 0 : flags.hashCode()); - result = prime * result + ((originatorId == null) ? 0 : originatorId.hashCode()); - result = prime * result + ((requestId == null) ? 0 : requestId.hashCode()); - result = prime * result + ((requestTrack == null) ? 0 : requestTrack.hashCode()); - result = prime * result + ((subRequestId == null) ? 0 : subRequestId.hashCode()); - result = prime * result + ((timeStamp == null) ? 0 : timeStamp.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - CommonHeader other = (CommonHeader) obj; - if (apiVer == null) { - if (other.apiVer != null) { - return false; - } - } else if (!apiVer.equals(other.apiVer)) { - return false; - } - if (flags == null) { - if (other.flags != null) { - return false; - } - } else if (!flags.equals(other.flags)) { - return false; - } - if (originatorId == null) { - if (other.originatorId != null) { - return false; - } - } else if (!originatorId.equals(other.originatorId)) { - return false; - } - if (requestId == null) { - if (other.requestId != null) { - return false; - } - } else if (!requestId.equals(other.requestId)) { - return false; - } - if (requestTrack == null) { - if (other.requestTrack != null) { - return false; - } - } else if (!requestTrack.equals(other.requestTrack)) { - return false; - } - if (subRequestId == null) { - if (other.subRequestId != null) { - return false; - } - } else if (!subRequestId.equals(other.subRequestId)) { - return false; - } - if (timeStamp == null) { - if (other.timeStamp != null) { - return false; - } - } else if (!timeStamp.equals(other.timeStamp)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java deleted file mode 100644 index cbf5b44d6..000000000 --- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java +++ /dev/null @@ -1,165 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2019 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.appc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -public class Request implements Serializable { - private static final long serialVersionUID = -3912323643990646431L; - - @SerializedName("CommonHeader") - private CommonHeader commonHeader; - - @SerializedName("Action") - private String action; - - @SerializedName("TargetID") - private String targetId; - - @SerializedName("ObjectID") - private String objectId; - - @SerializedName("Payload") - private HashMap payload = new HashMap<>(); - - public Request() { - // Initiate an empty Request instance - } - - public CommonHeader getCommonHeader() { - return commonHeader; - } - - public Map getPayload() { - return payload; - } - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - - public String getTargetId() { - return targetId; - } - - public void setTargetId(String targetId) { - this.targetId = targetId; - } - - public String getObjectId() { - return objectId; - } - - public void setObjectId(String objectId) { - this.objectId = objectId; - } - - public void setCommonHeader(CommonHeader commonHeader) { - this.commonHeader = commonHeader; - } - - public void setPayload(Map payload) { - this.payload = new HashMap<>(payload); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((action == null) ? 0 : action.hashCode()); - result = prime * result + ((commonHeader == null) ? 0 : commonHeader.hashCode()); - result = prime * result + ((objectId == null) ? 0 : objectId.hashCode()); - result = prime * result + ((payload == null) ? 0 : payload.hashCode()); - result = prime * result + ((targetId == null) ? 0 : targetId.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - - Request other = (Request) obj; - if (action == null) { - if (other.action != null) { - return false; - } - } else if (!action.equals(other.action)) { - return false; - } - - if (commonHeader == null) { - if (other.commonHeader != null) { - return false; - } - } else if (!commonHeader.equals(other.commonHeader)) { - return false; - } - - if (objectId == null) { - if (other.objectId != null) { - return false; - } - } else if (!objectId.equals(other.objectId)) { - return false; - } - - if (payload == null) { - if (other.payload != null) { - return false; - } - } else if (!payload.equals(other.payload)) { - return false; - } - - if (targetId == null) { - if (other.targetId != null) { - return false; - } - } else if (!targetId.equals(other.targetId)) { - return false; - } - - return true; - } - - @Override - public String toString() { - return "Request [CommonHeader=" + commonHeader + ", Action=" + action + ", TargetId=" + targetId + ", ObjectId=" - + objectId + ", Payload=" + payload + "]"; - } - -} diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java deleted file mode 100644 index af503b104..000000000 --- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Response.java +++ /dev/null @@ -1,136 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2018 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.appc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -public class Response implements Serializable { - private static final long serialVersionUID = 434953706339865151L; - - @SerializedName("CommonHeader") - private CommonHeader commonHeader; - - @SerializedName("Status") - private ResponseStatus status = new ResponseStatus(); - - @SerializedName("Payload") - private HashMap payload = new HashMap<>(); - - public Response() { - - } - - /** - * Construct an instance from an existing instance. - * - * @param request the existing instance - */ - public Response(Request request) { - if (request.getCommonHeader() != null) { - this.commonHeader = new CommonHeader(request.getCommonHeader()); - } - if (request.getPayload() != null) { - this.payload.putAll(request.getPayload()); - } - } - - public CommonHeader getCommonHeader() { - return commonHeader; - } - - public void setCommonHeader(CommonHeader commonHeader) { - this.commonHeader = commonHeader; - } - - public ResponseStatus getStatus() { - return status; - } - - public void setStatus(ResponseStatus status) { - this.status = status; - } - - public Map getPayload() { - return payload; - } - - public void setPayload(Map payload) { - this.payload = new HashMap<>(payload); - } - - @Override - public String toString() { - return "Response [CommonHeader=" + commonHeader + ", Status=" + status + ", Payload=" + payload + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((commonHeader == null) ? 0 : commonHeader.hashCode()); - result = prime * result + ((payload == null) ? 0 : payload.hashCode()); - result = prime * result + ((status == null) ? 0 : status.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - Response other = (Response) obj; - if (commonHeader == null) { - if (other.commonHeader != null) { - return false; - } - } else if (!commonHeader.equals(other.commonHeader)) { - return false; - } - if (payload == null) { - if (other.payload != null) { - return false; - } - } else if (!payload.equals(other.payload)) { - return false; - } - if (status == null) { - if (other.status != null) { - return false; - } - } else if (!status.equals(other.status)) { - return false; - } - return true; - } - - - -} diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseCode.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseCode.java deleted file mode 100644 index b62f917ba..000000000 --- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseCode.java +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2018 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.appc; - -import com.google.gson.annotations.SerializedName; - -public enum ResponseCode { - ACCEPT(100), ERROR(200), REJECT(300), SUCCESS(400), FAILURE(500); - - @SerializedName("Code") - private Integer code; - - private ResponseCode(int code) { - this.code = code; - } - - public int getValue() { - return this.code; - } - - @Override - public String toString() { - return Integer.toString(this.code); - } - - /** - * Convert an integer code to a ResponseCode. - * - * @param code the integer code - * @return the ResponseCode - */ - public static ResponseCode toResponseCode(int code) { - if (code == ACCEPT.code) { - return ACCEPT; - } - if (code == ERROR.code) { - return ERROR; - } - if (code == REJECT.code) { - return REJECT; - } - if (code == SUCCESS.code) { - return SUCCESS; - } - if (code == FAILURE.code) { - return FAILURE; - } - return null; - } -} diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java deleted file mode 100644 index f54117862..000000000 --- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java +++ /dev/null @@ -1,110 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2018 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.appc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class ResponseStatus implements Serializable { - private static final long serialVersionUID = 2421770469587860452L; - - @SerializedName("Code") - private int code; - - @SerializedName("Value") - private String value; - - @SerializedName("Description") - private String description; - - @Override - public String toString() { - return "ResponseStatus [Code=" + code + ", Value=" + value + ", Description=" + description + "]"; - } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + code; - result = prime * result + ((description == null) ? 0 : description.hashCode()); - result = prime * result + ((value == null) ? 0 : value.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - ResponseStatus other = (ResponseStatus) obj; - if (code != other.code) { - return false; - } - if (description == null) { - if (other.description != null) { - return false; - } - } else if (!description.equals(other.description)) { - return false; - } - if (value == null) { - if (other.value != null) { - return false; - } - } else if (!value.equals(other.value)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseValue.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseValue.java deleted file mode 100644 index a12f9d139..000000000 --- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseValue.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2018 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.appc; - -import com.google.gson.annotations.SerializedName; - -public enum ResponseValue { - ACCEPT("ACCEPT"), ERROR("ERROR"), REJECT("REJECT"), SUCCESS("SUCCESS"), FAILURE("FAILURE"); - - @SerializedName("Value") - private String value; - - private ResponseValue(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - /** - * Convert a String value to a ResponseValue. - * - * @param value the String value - * @return the ResponseValue - */ - public static ResponseValue toResponseValue(String value) { - if (value == null) { - return null; - } - - if (value.equals(ACCEPT.toString())) { - return ACCEPT; - } - if (value.equals(ERROR.toString())) { - return ERROR; - } - if (value.equals(REJECT.toString())) { - return REJECT; - } - if (value.equals(SUCCESS.toString())) { - return SUCCESS; - } - if (value.equals(FAILURE.toString())) { - return FAILURE; - } - - return null; - } - -} diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java deleted file mode 100644 index d8a397dca..000000000 --- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java +++ /dev/null @@ -1,85 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2018 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.appc.util; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - -import java.lang.reflect.Type; -import java.time.Instant; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public final class Serialization { - public static final DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSxxx"); - - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) - .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) - // .registerTypeAdapter(CommonHeader1607.class, new gsonCommonHeaderInstance()) - // .registerTypeAdapter(ResponseStatus1607.class, new gsonResponseStatus()) - .create(); - - private Serialization() {} - - public static class GsonUtcAdapter implements JsonSerializer, JsonDeserializer { - private static final Logger logger = LoggerFactory.getLogger(GsonUtcAdapter.class); - - @Override - public ZonedDateTime deserialize(JsonElement element, Type type, JsonDeserializationContext context) { - try { - return ZonedDateTime.parse(element.getAsString(), format); - } catch (Exception e) { - logger.error("deserialize threw: ", e); - } - return null; - } - - @Override - public JsonElement serialize(ZonedDateTime datetime, Type type, JsonSerializationContext context) { - return new JsonPrimitive(datetime.format(format)); - } - } - - public static class GsonInstantAdapter implements JsonSerializer, JsonDeserializer { - - @Override - public Instant deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return Instant.ofEpochMilli(json.getAsLong()); - } - - @Override - public JsonElement serialize(Instant src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src.toEpochMilli()); - } - - } - -} diff --git a/controlloop/common/model-impl/appc/src/main/resources/definitions.yaml b/controlloop/common/model-impl/appc/src/main/resources/definitions.yaml deleted file mode 100644 index 680a9929c..000000000 --- a/controlloop/common/model-impl/appc/src/main/resources/definitions.yaml +++ /dev/null @@ -1,118 +0,0 @@ -### -# ============LICENSE_START======================================================= -# appc -# ================================================================================ -# 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========================================================= -### - -Request: - type: object - properties: - CommonHeader: - type: object - properties: - TimeStamp: - type: string - APIver: - type: string - value: '1.01' - OriginatorID: - type: string - RequestID: - type: string - pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - SubRequestID: - type: string - Flags: - type: object - required: - - TimeStamp - - APIver - - OriginatorID - - RequestID - Action: - type: string - enum: - - Audit - - ActionStatus - - BlockAudits - - Configure - - HealthCheck - - Install - - LiveUpgrade - - Migrate - - ModifyConfig - - Query - - Rebuild - - Reconfigure - - Restart - - Rollback - - Scale - - Start - - Stop - - Sync - - Terminate - - Test - - Upgrade - TargetID: - type: string - ObjectID: - type: string - Payload: - type: object - required: - - CommonHeader - - Action - - TargetID -Response: - type: object - properties: - CommonHeader: - type: object - properties: - TimeStamp: - type: string - APIver: - type: string - OriginatorID: - type: string - RequestID: - type: string - SubRequestID: - type: string - Flags: - type: object - required: - - TimeStamp - - APIver - - OriginatorID - - RequestID - Status: - type: object - properties: - Code: - type: integer - Value: - type: string - required: - - Code - - Value - Payload: - type: object - required: - - CommonHeader - - Status - diff --git a/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java b/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java deleted file mode 100644 index 93a05f424..000000000 --- a/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java +++ /dev/null @@ -1,178 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2018 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========================================================= - */ - -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * 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.appc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.time.Instant; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.junit.Test; - -public class CommonHeaderTest { - - @Test - public void testCommonHeader() { - CommonHeader commonHeader = new CommonHeader(); - assertNotNull(commonHeader); - assertNotNull(new CommonHeader(commonHeader)); - assertNotEquals(0, commonHeader.hashCode()); - - commonHeader.setApiVer("Kansas"); - assertEquals("Kansas", commonHeader.getApiVer()); - - List> flagSet = new ArrayList<>(); - commonHeader.setFlags(flagSet); - assertEquals(flagSet, commonHeader.getFlags()); - - commonHeader.setOriginatorId("Dorothy"); - assertEquals("Dorothy", commonHeader.getOriginatorId()); - - UUID requestId = UUID.randomUUID(); - commonHeader.setRequestId(requestId); - assertEquals(requestId, commonHeader.getRequestId()); - - List requestTrackSet = new ArrayList<>(); - commonHeader.setRequestTrack(requestTrackSet); - assertEquals(requestTrackSet, commonHeader.getRequestTrack()); - - commonHeader.setSubRequestId("Can I go home?"); - assertEquals("Can I go home?", commonHeader.getSubRequestId()); - - Instant timestamp = Instant.now(); - commonHeader.setTimeStamp(timestamp); - assertEquals(timestamp, commonHeader.getTimeStamp()); - - assertNotEquals(0, commonHeader.hashCode()); - - assertEquals("CommonHeader [TimeStamp=", commonHeader.toString().substring(0, 24)); - - CommonHeader copiedCommonHeader = new CommonHeader(); - copiedCommonHeader.setApiVer(commonHeader.getApiVer()); - copiedCommonHeader.setFlags(commonHeader.getFlags()); - copiedCommonHeader.setOriginatorId(commonHeader.getOriginatorId()); - copiedCommonHeader.setRequestId(commonHeader.getRequestId()); - copiedCommonHeader.setRequestTrack(commonHeader.getRequestTrack()); - copiedCommonHeader.setSubRequestId(commonHeader.getSubRequestId()); - copiedCommonHeader.setTimeStamp(commonHeader.getTimeStamp()); - - assertTrue(commonHeader.equals(commonHeader)); - assertTrue(commonHeader.equals(copiedCommonHeader)); - assertFalse(commonHeader.equals(null)); - assertFalse(commonHeader.equals("Hello")); - - CommonHeader clonedCommonHeader = new CommonHeader(commonHeader); - clonedCommonHeader.setApiVer(commonHeader.getApiVer()); - clonedCommonHeader.setTimeStamp(commonHeader.getTimeStamp()); - - assertTrue(commonHeader.equals(clonedCommonHeader)); - - commonHeader.setApiVer(null); - assertFalse(commonHeader.equals(copiedCommonHeader)); - copiedCommonHeader.setApiVer(null); - assertTrue(commonHeader.equals(copiedCommonHeader)); - commonHeader.setApiVer("Kansas"); - assertFalse(commonHeader.equals(copiedCommonHeader)); - copiedCommonHeader.setApiVer("Kansas"); - assertTrue(commonHeader.equals(copiedCommonHeader)); - - commonHeader.setFlags(null); - assertFalse(commonHeader.equals(copiedCommonHeader)); - copiedCommonHeader.setFlags(null); - assertTrue(commonHeader.equals(copiedCommonHeader)); - commonHeader.setFlags(flagSet); - assertFalse(commonHeader.equals(copiedCommonHeader)); - copiedCommonHeader.setFlags(flagSet); - assertTrue(commonHeader.equals(copiedCommonHeader)); - - commonHeader.setOriginatorId(null); - assertFalse(commonHeader.equals(copiedCommonHeader)); - copiedCommonHeader.setOriginatorId(null); - assertTrue(commonHeader.equals(copiedCommonHeader)); - commonHeader.setOriginatorId("Dorothy"); - assertFalse(commonHeader.equals(copiedCommonHeader)); - copiedCommonHeader.setOriginatorId("Dorothy"); - assertTrue(commonHeader.equals(copiedCommonHeader)); - - commonHeader.setRequestId(null); - assertFalse(commonHeader.equals(copiedCommonHeader)); - copiedCommonHeader.setRequestId(null); - assertTrue(commonHeader.equals(copiedCommonHeader)); - commonHeader.setRequestId(requestId); - assertFalse(commonHeader.equals(copiedCommonHeader)); - copiedCommonHeader.setRequestId(requestId); - assertTrue(commonHeader.equals(copiedCommonHeader)); - - commonHeader.setRequestTrack(null); - assertFalse(commonHeader.equals(copiedCommonHeader)); - copiedCommonHeader.setRequestTrack(null); - assertTrue(commonHeader.equals(copiedCommonHeader)); - commonHeader.setRequestTrack(requestTrackSet); - assertFalse(commonHeader.equals(copiedCommonHeader)); - copiedCommonHeader.setRequestTrack(requestTrackSet); - assertTrue(commonHeader.equals(copiedCommonHeader)); - - commonHeader.setSubRequestId(null); - assertFalse(commonHeader.equals(copiedCommonHeader)); - copiedCommonHeader.setSubRequestId(null); - assertTrue(commonHeader.equals(copiedCommonHeader)); - commonHeader.setSubRequestId("Can I go home?"); - assertFalse(commonHeader.equals(copiedCommonHeader)); - copiedCommonHeader.setSubRequestId("Can I go home?"); - assertTrue(commonHeader.equals(copiedCommonHeader)); - - commonHeader.setTimeStamp(null); - assertFalse(commonHeader.equals(copiedCommonHeader)); - copiedCommonHeader.setTimeStamp(null); - assertTrue(commonHeader.equals(copiedCommonHeader)); - commonHeader.setTimeStamp(timestamp); - assertFalse(commonHeader.equals(copiedCommonHeader)); - copiedCommonHeader.setTimeStamp(timestamp); - assertTrue(commonHeader.equals(copiedCommonHeader)); - } -} diff --git a/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/EnumsTest.java b/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/EnumsTest.java deleted file mode 100644 index afb9a312e..000000000 --- a/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/EnumsTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2018 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.appc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import org.junit.Test; - -public class EnumsTest { - - @Test - public void testResponseCode() { - assertEquals(5, ResponseCode.values().length); - - assertNull(ResponseCode.toResponseCode(0)); - - assertEquals(ResponseCode.ACCEPT, ResponseCode.toResponseCode(100)); - assertEquals(ResponseCode.ERROR, ResponseCode.toResponseCode(200)); - assertEquals(ResponseCode.REJECT, ResponseCode.toResponseCode(300)); - assertEquals(ResponseCode.SUCCESS, ResponseCode.toResponseCode(400)); - assertEquals(ResponseCode.FAILURE, ResponseCode.toResponseCode(500)); - - assertEquals(100, ResponseCode.ACCEPT.getValue()); - assertEquals(200, ResponseCode.ERROR.getValue()); - assertEquals(300, ResponseCode.REJECT.getValue()); - assertEquals(400, ResponseCode.SUCCESS.getValue()); - assertEquals(500, ResponseCode.FAILURE.getValue()); - - assertEquals("100", ResponseCode.ACCEPT.toString()); - assertEquals("200", ResponseCode.ERROR.toString()); - assertEquals("300", ResponseCode.REJECT.toString()); - assertEquals("400", ResponseCode.SUCCESS.toString()); - assertEquals("500", ResponseCode.FAILURE.toString()); - } - - @Test - public void testResponseValue() { - assertEquals(5, ResponseValue.values().length); - - assertNull(ResponseValue.toResponseValue("Dorothy")); - assertNull(ResponseValue.toResponseValue(null)); - - assertEquals(ResponseValue.ACCEPT, ResponseValue.toResponseValue("ACCEPT")); - assertEquals(ResponseValue.ERROR, ResponseValue.toResponseValue("ERROR")); - assertEquals(ResponseValue.REJECT, ResponseValue.toResponseValue("REJECT")); - assertEquals(ResponseValue.SUCCESS, ResponseValue.toResponseValue("SUCCESS")); - assertEquals(ResponseValue.FAILURE, ResponseValue.toResponseValue("FAILURE")); - - assertEquals("ACCEPT", ResponseValue.ACCEPT.toString()); - assertEquals("ERROR", ResponseValue.ERROR.toString()); - assertEquals("REJECT", ResponseValue.REJECT.toString()); - assertEquals("SUCCESS", ResponseValue.SUCCESS.toString()); - assertEquals("FAILURE", ResponseValue.FAILURE.toString()); - } -} diff --git a/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java b/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java deleted file mode 100644 index e0c850b60..000000000 --- a/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2018 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.appc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; - -public class RequestTest { - - @Test - public void testRequest() { - Request request = new Request(); - assertNotNull(request); - assertNotEquals(0, request.hashCode()); - - CommonHeader commonHeader = new CommonHeader(); - - request.setCommonHeader(commonHeader); - assertEquals(commonHeader, request.getCommonHeader()); - - request.setAction("Go to Oz"); - assertEquals("Go to Oz", request.getAction()); - - request.setObjectId("Wizard"); - assertEquals("Wizard", request.getObjectId()); - - request.setTargetId("Oz"); - assertEquals("Oz", request.getTargetId()); - - Map payload = new HashMap<>(); - payload.put("North", "Good Witch"); - payload.put("West", "Bad Witch"); - - request.setPayload(payload); - assertEquals(payload, request.getPayload()); - - assertNotEquals(0, request.hashCode()); - - assertEquals("Request [CommonHeader=CommonHeader [TimeStamp=", request.toString().substring(0, 46)); - - Request copiedRequest = new Request(); - copiedRequest.setCommonHeader(request.getCommonHeader()); - copiedRequest.setAction(request.getAction()); - copiedRequest.setObjectId(request.getObjectId()); - copiedRequest.setPayload(request.getPayload()); - copiedRequest.setTargetId(request.getTargetId()); - - assertTrue(request.equals(request)); - assertTrue(request.equals(copiedRequest)); - assertFalse(request.equals(null)); - assertFalse(request.equals("Hello")); - - request.setCommonHeader(null); - assertFalse(request.equals(copiedRequest)); - copiedRequest.setCommonHeader(null); - assertTrue(request.equals(copiedRequest)); - request.setCommonHeader(commonHeader); - assertFalse(request.equals(copiedRequest)); - copiedRequest.setCommonHeader(commonHeader); - assertTrue(request.equals(copiedRequest)); - - request.setAction(null); - assertFalse(request.equals(copiedRequest)); - copiedRequest.setAction(null); - assertTrue(request.equals(copiedRequest)); - request.setAction("Go to Oz"); - assertFalse(request.equals(copiedRequest)); - copiedRequest.setAction("Go to Oz"); - assertTrue(request.equals(copiedRequest)); - - request.setObjectId(null); - assertFalse(request.equals(copiedRequest)); - copiedRequest.setObjectId(null); - assertTrue(request.equals(copiedRequest)); - request.setObjectId("Wizard"); - assertFalse(request.equals(copiedRequest)); - copiedRequest.setObjectId("Wizard"); - assertTrue(request.equals(copiedRequest)); - - request.setTargetId(null); - assertFalse(request.equals(copiedRequest)); - copiedRequest.setTargetId(null); - assertTrue(request.equals(copiedRequest)); - request.setTargetId("Oz"); - assertFalse(request.equals(copiedRequest)); - copiedRequest.setTargetId("Oz"); - assertTrue(request.equals(copiedRequest)); - - request.setPayload(new HashMap()); - assertFalse(request.equals(copiedRequest)); - copiedRequest.setPayload(new HashMap()); - assertTrue(request.equals(copiedRequest)); - request.setPayload(payload); - assertFalse(request.equals(copiedRequest)); - copiedRequest.setPayload(payload); - assertTrue(request.equals(copiedRequest)); - } -} diff --git a/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java b/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java deleted file mode 100644 index ab8811d37..000000000 --- a/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2018 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.appc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class ResponseStatusTest { - - @Test - public void testResonseStatus() { - ResponseStatus status = new ResponseStatus(); - assertNotNull(status); - assertNotEquals(0, status.hashCode()); - - status.setCode(1234); - assertEquals(1234, status.getCode()); - - status.setDescription("The wonderful land of Oz"); - assertEquals("The wonderful land of Oz", status.getDescription()); - - status.setValue("There's no place like home"); - assertEquals("There's no place like home", status.getValue()); - assertNotEquals(0, status.hashCode()); - - assertEquals("ResponseStatus [Code=1234, Value=There's no pla", status.toString().substring(0, 47)); - - ResponseStatus copiedStatus = new ResponseStatus(); - copiedStatus.setCode(status.getCode()); - copiedStatus.setDescription(status.getDescription()); - copiedStatus.setValue(status.getValue()); - - assertTrue(status.equals(status)); - assertTrue(status.equals(copiedStatus)); - assertFalse(status.equals(null)); - assertFalse(status.equals("Hello")); - - status.setCode(-1); - assertFalse(status.equals(copiedStatus)); - copiedStatus.setCode(-1); - assertTrue(status.equals(copiedStatus)); - status.setCode(1234); - assertFalse(status.equals(copiedStatus)); - copiedStatus.setCode(1234); - assertTrue(status.equals(copiedStatus)); - - status.setDescription(null); - assertFalse(status.equals(copiedStatus)); - copiedStatus.setDescription(null); - assertTrue(status.equals(copiedStatus)); - status.setDescription("The wonderful land of Oz"); - assertFalse(status.equals(copiedStatus)); - copiedStatus.setDescription("The wonderful land of Oz"); - assertTrue(status.equals(copiedStatus)); - - status.setValue(null); - assertFalse(status.equals(copiedStatus)); - copiedStatus.setValue(null); - assertTrue(status.equals(copiedStatus)); - status.setValue("There's no place like home"); - assertFalse(status.equals(copiedStatus)); - copiedStatus.setValue("There's no place like home"); - assertTrue(status.equals(copiedStatus)); - } -} diff --git a/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java b/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java deleted file mode 100644 index ce0ba90a5..000000000 --- a/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2018 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.appc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; - -public class ResponseTest { - - @Test - public void testResonse() { - Response response = new Response(); - assertNotNull(response); - assertNotNull(new Response(new Request())); - assertNotEquals(0, response.hashCode()); - - CommonHeader commonHeader = new CommonHeader(); - - Request request = new Request(); - request.setCommonHeader(commonHeader); - assertNotNull(new Response(request)); - - response.setCommonHeader(commonHeader); - assertEquals(commonHeader, response.getCommonHeader()); - - ResponseStatus status = new ResponseStatus(); - response.setStatus(status); - assertEquals(status, response.getStatus()); - - Map payload = new HashMap<>(); - payload.put("North", "Good Witch"); - payload.put("West", "Bad Witch"); - - response.setPayload(payload); - assertEquals(payload, response.getPayload()); - - assertNotEquals(0, response.hashCode()); - - assertEquals("Response [CommonHeader=CommonHeader [TimeStamp=", response.toString().substring(0, 47)); - - Response copiedResponse = new Response(); - copiedResponse.setCommonHeader(response.getCommonHeader()); - copiedResponse.setStatus(response.getStatus()); - copiedResponse.setPayload(response.getPayload()); - - assertTrue(response.equals(response)); - assertTrue(response.equals(copiedResponse)); - assertFalse(response.equals(null)); - assertFalse(response.equals("Hello")); - - response.setCommonHeader(null); - assertFalse(response.equals(copiedResponse)); - copiedResponse.setCommonHeader(null); - assertTrue(response.equals(copiedResponse)); - response.setCommonHeader(commonHeader); - assertFalse(response.equals(copiedResponse)); - copiedResponse.setCommonHeader(commonHeader); - assertTrue(response.equals(copiedResponse)); - - response.setStatus(null); - assertFalse(response.equals(copiedResponse)); - copiedResponse.setStatus(null); - assertTrue(response.equals(copiedResponse)); - response.setStatus(status); - assertFalse(response.equals(copiedResponse)); - copiedResponse.setStatus(status); - assertTrue(response.equals(copiedResponse)); - - response.setPayload(new HashMap()); - assertFalse(response.equals(copiedResponse)); - copiedResponse.setPayload(new HashMap()); - assertTrue(response.equals(copiedResponse)); - response.setPayload(payload); - assertFalse(response.equals(copiedResponse)); - copiedResponse.setPayload(payload); - assertTrue(response.equals(copiedResponse)); - } -} diff --git a/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/util/SerializationTest.java b/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/util/SerializationTest.java deleted file mode 100644 index 6a3a3a099..000000000 --- a/controlloop/common/model-impl/appc/src/test/java/org/onap/policy/appc/util/SerializationTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2018 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.appc.util; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import java.time.Instant; -import java.time.ZoneId; -import java.time.ZonedDateTime; - -import org.junit.Test; - -public class SerializationTest { - - @Test - public void test() { - String nameString = "Dorothy"; - String jsonName = Serialization.gsonPretty.toJson(nameString, String.class); - assertEquals("\"Dorothy\"", jsonName); - String jsonInOutName = Serialization.gsonPretty.fromJson(jsonName, String.class); - assertEquals("Dorothy", jsonInOutName); - - Instant instant = Instant.ofEpochMilli(1516127215000L); - String instantString = Serialization.gsonPretty.toJson(instant, Instant.class); - assertEquals("1516127215000", instantString); - Instant outInstant = Serialization.gsonPretty.fromJson(instantString, Instant.class); - assertEquals(instant, outInstant); - - ZonedDateTime zdt = ZonedDateTime.ofInstant(instant, ZoneId.of("UTC")); - String zdtString = Serialization.gsonPretty.toJson(zdt, ZonedDateTime.class); - assertEquals("\"2018-01-16 18:26:55.000000+00:00\"", zdtString); - ZonedDateTime outZdt = Serialization.gsonPretty.fromJson(zdtString, ZonedDateTime.class); - assertEquals(zdt.getDayOfWeek(), outZdt.getDayOfWeek()); - - assertNull(Serialization.gsonPretty.fromJson("oz time is weird", ZonedDateTime.class)); - } -} diff --git a/controlloop/common/model-impl/appclcm/pom.xml b/controlloop/common/model-impl/appclcm/pom.xml deleted file mode 100644 index 9341e7bb6..000000000 --- a/controlloop/common/model-impl/appclcm/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - 4.0.0 - - - org.onap.policy.drools-applications.controlloop.common.model-impl - model-impl - 1.4.0-SNAPSHOT - - - appclcm - - - - junit - junit - test - - - com.google.code.gson - gson - provided - - - - diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmCommonHeader.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmCommonHeader.java deleted file mode 100644 index dbf8dd0cd..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmCommonHeader.java +++ /dev/null @@ -1,256 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * Copyright (C) 2017-2018 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.appclcm; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -public class LcmCommonHeader implements Serializable { - - private static final long serialVersionUID = 6581963539127062114L; - - @SerializedName(value = "timestamp") - private Instant timeStamp = Instant.now(); - - @SerializedName(value = "api-ver") - private String apiVer = "2.00"; - - @SerializedName(value = "originator-id") - private String originatorId; - - @SerializedName(value = "request-id") - private UUID requestId; - - @SerializedName(value = "sub-request-id") - private String subRequestId; - - @SerializedName(value = "flags") - private Map flags = new HashMap<>(); - - public LcmCommonHeader() { - - } - - /** - * Used to copy a common header. - * - * @param commonHeader a header that is defined by the lcm api guide that contains information - * about the request (requestId, flags, etc.) - */ - public LcmCommonHeader(LcmCommonHeader commonHeader) { - this.originatorId = commonHeader.originatorId; - this.requestId = commonHeader.requestId; - this.subRequestId = commonHeader.subRequestId; - if (commonHeader.flags != null) { - this.flags.putAll(commonHeader.flags); - } - } - - /** - * Get the timestamp. - * - * @return the timeStamp - */ - public Instant getTimeStamp() { - return timeStamp; - } - - /** - * Set the timestamp. - * - * @param timeStamp the timeStamp to set - */ - public void setTimeStamp(Instant timeStamp) { - this.timeStamp = timeStamp; - } - - /** - * Get the API version. - * - * @return the apiVer - */ - public String getApiVer() { - return apiVer; - } - - /** - * Set the API version. - * - * @param apiVer the apiVer to set - */ - public void setApiVer(String apiVer) { - this.apiVer = apiVer; - } - - /** - * Get the originator Id. - * - * @return the originatorId - */ - public String getOriginatorId() { - return originatorId; - } - - /** - * Set the originator Id. - * - * @param originatorId the originatorId to set - */ - public void setOriginatorId(String originatorId) { - this.originatorId = originatorId; - } - - /** - * Get the request Id. - * - * @return the requestId - */ - public UUID getRequestId() { - return requestId; - } - - /** - * Set the request Id. - * - * @param requestId the requestId to set - */ - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - /** - * Get the sub request Id. - * - * @return the subRequestId - */ - public String getSubRequestId() { - return subRequestId; - } - - /** - * Set the sub request Id. - * - * @param subRequestId the subRequestId to set - */ - public void setSubRequestId(String subRequestId) { - this.subRequestId = subRequestId; - } - - /** - * Get the flags. - * - * @return the flags - */ - public Map getFlags() { - return flags; - } - - /** - * Set the flags. - * - * @param flags the flags to set - */ - public void setFlags(Map flags) { - this.flags = flags; - } - - @Override - public String toString() { - return "CommonHeader [timeStamp=" + timeStamp + ", apiVer=" + apiVer + ", originatorId=" + originatorId - + ", requestId=" + requestId + ", subRequestId=" + subRequestId + ", flags=" + flags + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((apiVer == null) ? 0 : apiVer.hashCode()); - result = prime * result + ((flags == null) ? 0 : flags.hashCode()); - result = prime * result + ((originatorId == null) ? 0 : originatorId.hashCode()); - result = prime * result + ((requestId == null) ? 0 : requestId.hashCode()); - result = prime * result + ((subRequestId == null) ? 0 : subRequestId.hashCode()); - result = prime * result + ((timeStamp == null) ? 0 : timeStamp.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - LcmCommonHeader other = (LcmCommonHeader) obj; - if (apiVer == null) { - if (other.apiVer != null) { - return false; - } - } else if (!apiVer.equals(other.apiVer)) { - return false; - } - if (flags == null) { - if (other.flags != null) { - return false; - } - } else if (!flags.equals(other.flags)) { - return false; - } - if (originatorId == null) { - if (other.originatorId != null) { - return false; - } - } else if (!originatorId.equals(other.originatorId)) { - return false; - } - if (requestId == null) { - if (other.requestId != null) { - return false; - } - } else if (!requestId.equals(other.requestId)) { - return false; - } - if (subRequestId == null) { - if (other.subRequestId != null) { - return false; - } - } else if (!subRequestId.equals(other.subRequestId)) { - return false; - } - if (timeStamp == null) { - if (other.timeStamp != null) { - return false; - } - } else if (!timeStamp.equals(other.timeStamp)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequest.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequest.java deleted file mode 100644 index afac0dece..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequest.java +++ /dev/null @@ -1,175 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * Copyright (C) 2017-2018 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.appclcm; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.Map; - -public class LcmRequest implements Serializable { - - private static final long serialVersionUID = 219375564922846624L; - - @SerializedName(value = "common-header") - private LcmCommonHeader commonHeader; - - @SerializedName(value = "action") - private String action; - - @SerializedName(value = "action-identifiers") - private Map actionIdentifiers; - - @SerializedName(value = "payload") - private String payload; - - public LcmRequest() { - // Create a default LCM request - } - - public LcmCommonHeader getCommonHeader() { - return commonHeader; - } - - /** - * Get the action. - * - * @return the action - */ - public String getAction() { - return action; - } - - /** - * Set the action. - * - * @param action the action to set - */ - public void setAction(String action) { - this.action = action; - } - - /** - * Get the action identifiers. - * - * @return the actionIdentifiers - */ - public Map getActionIdentifiers() { - return actionIdentifiers; - } - - /** - * Set the action identifiers. - * - * @param actionIdentifiers the actionIdentifiers to set - */ - public void setActionIdentifiers(Map actionIdentifiers) { - this.actionIdentifiers = actionIdentifiers; - } - - /** - * Get the payload. - * - * @return the payload - */ - public String getPayload() { - return payload; - } - - /** - * Set the payload. - * - * @param payload the payload to set - */ - public void setPayload(String payload) { - this.payload = payload; - } - - /** - * Get the common header. - * - * @param commonHeader the commonHeader to set - */ - public void setCommonHeader(LcmCommonHeader commonHeader) { - this.commonHeader = commonHeader; - } - - @Override - public String toString() { - return "Request [commonHeader=" + commonHeader + ", action=" + action + ", actionIdentifiers=" - + actionIdentifiers + ", payload=" + payload + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((commonHeader == null) ? 0 : commonHeader.hashCode()); - result = prime * result + ((action == null) ? 0 : action.hashCode()); - result = prime * result + ((actionIdentifiers == null) ? 0 : actionIdentifiers.hashCode()); - result = prime * result + ((payload == null) ? 0 : payload.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - LcmRequest other = (LcmRequest) obj; - if (commonHeader == null) { - if (other.commonHeader != null) { - return false; - } - } else if (!commonHeader.equals(other.commonHeader)) { - return false; - } - if (action == null) { - if (other.action != null) { - return false; - } - } else if (!action.equals(other.action)) { - return false; - } - if (actionIdentifiers == null) { - if (other.actionIdentifiers != null) { - return false; - } - } else if (!actionIdentifiers.equals(other.actionIdentifiers)) { - return false; - } - if (payload == null) { - if (other.payload != null) { - return false; - } - } else if (!payload.equals(other.payload)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequestWrapper.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequestWrapper.java deleted file mode 100644 index b77303ad0..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequestWrapper.java +++ /dev/null @@ -1,95 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * Copyright (C) 2017-2018 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.appclcm; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class LcmRequestWrapper extends LcmWrapper implements Serializable { - - private static final long serialVersionUID = 424866914715980798L; - - @SerializedName(value = "body") - private LcmRequest body; - - public LcmRequestWrapper() { - super(); - } - - public LcmRequestWrapper(LcmRequest request) { - body = request; - } - - /** - * Get the body. - * - * @return the body - */ - public LcmRequest getBody() { - return body; - } - - /** - * Set the body. - * - * @param body the body to set - */ - public void setBody(LcmRequest body) { - this.body = body; - } - - @Override - public String toString() { - return "RequestWrapper [body=" + body + ", toString()=" + super.toString() + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((body == null) ? 0 : body.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!super.equals(obj)) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - LcmRequestWrapper other = (LcmRequestWrapper) obj; - if (body == null) { - if (other.body != null) { - return false; - } - } else if (!body.equals(other.body)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponse.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponse.java deleted file mode 100644 index 2a65c9a14..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponse.java +++ /dev/null @@ -1,161 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * Copyright (C) 2017-2018 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.appclcm; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class LcmResponse implements Serializable { - - private static final long serialVersionUID = 6332508597287669750L; - - @SerializedName(value = "common-header") - private LcmCommonHeader commonHeader; - - @SerializedName(value = "status") - private LcmResponseStatus status = new LcmResponseStatus(); - - @SerializedName(value = "payload") - private String payload; - - public LcmResponse() { - // EMPTY - } - - /** - * Constructs a response using the common header of the request since they will be the same. - * - * @param request an appc lcm request object specified by the lcm api guide - */ - public LcmResponse(LcmRequest request) { - this.commonHeader = new LcmCommonHeader(request.getCommonHeader()); - String requestPayload = request.getPayload(); - if (requestPayload != null) { - this.payload = requestPayload; - } - } - - /** - * Get the common header. - * - * @return the commonHeader - */ - public LcmCommonHeader getCommonHeader() { - return commonHeader; - } - - /** - * Set the common header. - * - * @param commonHeader the commonHeader to set - */ - public void setCommonHeader(LcmCommonHeader commonHeader) { - this.commonHeader = commonHeader; - } - - /** - * Get the status. - * - * @return the status - */ - public LcmResponseStatus getStatus() { - return status; - } - - /** - * Set the status. - * - * @param status the status to set - */ - public void setStatus(LcmResponseStatus status) { - this.status = status; - } - - /** - * Get the payload. - * - * @return the payload - */ - public String getPayload() { - return payload; - } - - /** - * Set the payload. - * - * @param payload the payload to set - */ - public void setPayload(String payload) { - this.payload = payload; - } - - @Override - public String toString() { - return "Response [commonHeader=" + commonHeader + ", status=" + status + ", payload=" + payload + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((commonHeader == null) ? 0 : commonHeader.hashCode()); - result = prime * result + ((payload == null) ? 0 : payload.hashCode()); - result = prime * result + ((status == null) ? 0 : status.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - LcmResponse other = (LcmResponse) obj; - if (commonHeader == null) { - if (other.commonHeader != null) { - return false; - } - } else if (!commonHeader.equals(other.commonHeader)) { - return false; - } - if (payload == null) { - if (other.payload != null) { - return false; - } - } else if (!payload.equals(other.payload)) { - return false; - } - if (status == null) { - if (other.status != null) { - return false; - } - } else if (!status.equals(other.status)) { - return false; - } - return true; - } -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseCode.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseCode.java deleted file mode 100644 index d3c3464ed..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseCode.java +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd. 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.appclcm; - -import java.io.Serializable; -import org.onap.policy.appclcm.util.StatusCodeEnum; - -public class LcmResponseCode implements Serializable { - - /* These fields define the key to the response code value. */ - public static final String ACCEPTED = "ACCEPTED"; - public static final String ERROR = "ERROR"; - public static final String REJECT = "REJECT"; - public static final String SUCCESS = "SUCCESS"; - public static final String FAILURE = "FAILURE"; - public static final String PARTIAL_SUCCESS = "PARTIAL SUCCESS"; - public static final String PARTIAL_FAILURE = "PARTIAL FAILURE"; - private static final long serialVersionUID = 8189456447227022582L; - - private final Integer code; - - protected LcmResponseCode(final int code) { - this.code = code; - } - - public int getCode() { - return this.code; - } - - @Override - public String toString() { - return Integer.toString(this.code); - } - - /** - * Translates the code to a string value that represents the meaning of the code. - * - * @param code the numeric value that is returned by APPC based on success, failure, etc. of the action requested - * @return the string value equivalent of the APPC response code - */ - public static String toResponseValue(int code) { - StatusCodeEnum statusCodeEnum = StatusCodeEnum.fromStatusCode(code); - return (statusCodeEnum != null) ? statusCodeEnum.toString() : null; - } -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseStatus.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseStatus.java deleted file mode 100644 index 4c044a0a8..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseStatus.java +++ /dev/null @@ -1,116 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * Copyright (C) 2017-2018 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.appclcm; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class LcmResponseStatus implements Serializable { - - private static final long serialVersionUID = 974891505135467199L; - - @SerializedName(value = "code") - private int code; - - @SerializedName(value = "message") - private String message; - - public LcmResponseStatus() { - // Create a default LCMResponseStatus instance - } - - /** - * Get the code. - * - * @return the code - */ - public int getCode() { - return code; - } - - /** - * Set the code. - * - * @param code the code to set - */ - public void setCode(int code) { - this.code = code; - } - - /** - * Get the message. - * - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * Set the message. - * - * @param message the message to set - */ - public void setMessage(String message) { - this.message = message; - } - - @Override - public String toString() { - return "ResponseStatus [code=" + code + ", message=" + message + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + code; - result = prime * result + ((message == null) ? 0 : message.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - LcmResponseStatus other = (LcmResponseStatus) obj; - if (code != other.code) { - return false; - } - if (message == null) { - if (other.message != null) { - return false; - } - } else if (!message.equals(other.message)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseWrapper.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseWrapper.java deleted file mode 100644 index 43cc32511..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseWrapper.java +++ /dev/null @@ -1,90 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * Copyright (C) 2017-2018 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.appclcm; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class LcmResponseWrapper extends LcmWrapper implements Serializable { - - private static final long serialVersionUID = 463937813781086802L; - - @SerializedName(value = "body") - private LcmResponse body; - - public LcmResponseWrapper() { - super(); - } - - /** - * Get the body. - * - * @return the body - */ - public LcmResponse getBody() { - return body; - } - - /** - * Set the body. - * - * @param body the body to set - */ - public void setBody(LcmResponse body) { - this.body = body; - } - - @Override - public String toString() { - return "ResponseWrapper [body=" + body + ", toString()=" + super.toString() + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((body == null) ? 0 : body.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!super.equals(obj)) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - LcmResponseWrapper other = (LcmResponseWrapper) obj; - if (body == null) { - if (other.body != null) { - return false; - } - } else if (!body.equals(other.body)) { - return false; - } - return true; - } -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmWrapper.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmWrapper.java deleted file mode 100644 index 322abb015..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmWrapper.java +++ /dev/null @@ -1,208 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * Copyright (C) 2017-2018 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.appclcm; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class LcmWrapper implements Serializable { - - private static final long serialVersionUID = 753005805432396532L; - - @SerializedName(value = "version") - private String version; - - @SerializedName(value = "cambria-partition") - private String cambriaPartition; - - @SerializedName(value = "rpc-name") - private String rpcName; - - @SerializedName(value = "correlation-id") - private String correlationId; - - @SerializedName(value = "type") - private String type; - - public LcmWrapper() { - // Create a default LCMWrapper instance - } - - /** - * Get the version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Set the version. - * - * @param version the version to set - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * Get the cambria partition. - * - * @return the cambriaPartition - */ - public String getCambriaPartition() { - return cambriaPartition; - } - - /** - * Set the cambria partition. - * - * @param cambriaPartition the cambriaPartition to set - */ - public void setCambriaPartition(String cambriaPartition) { - this.cambriaPartition = cambriaPartition; - } - - /** - * Get the RPN name. - * - * @return the rpcName - */ - public String getRpcName() { - return rpcName; - } - - /** - * Set the RPC name. - * - * @param rpcName the rpcName to set - */ - public void setRpcName(String rpcName) { - this.rpcName = rpcName; - } - - /** - * Get the correlation Id. - * - * @return the correlationId - */ - public String getCorrelationId() { - return correlationId; - } - - /** - * Set the correclation Id. - * - * @param correlationId the correlationId to set - */ - public void setCorrelationId(String correlationId) { - this.correlationId = correlationId; - } - - /** - * Get the type. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Set the type. - * - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - - @Override - public String toString() { - return "Wrapper [version=" + version + ", cambriaPartition=" + cambriaPartition + ", rpcName=" + rpcName - + ", correlationId=" + correlationId + ", type=" + type + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((cambriaPartition == null) ? 0 : cambriaPartition.hashCode()); - result = prime * result + ((correlationId == null) ? 0 : correlationId.hashCode()); - result = prime * result + ((rpcName == null) ? 0 : rpcName.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - result = prime * result + ((version == null) ? 0 : version.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - LcmWrapper other = (LcmWrapper) obj; - if (cambriaPartition == null) { - if (other.cambriaPartition != null) { - return false; - } - } else if (!cambriaPartition.equals(other.cambriaPartition)) { - return false; - } - if (correlationId == null) { - if (other.correlationId != null) { - return false; - } - } else if (!correlationId.equals(other.correlationId)) { - return false; - } - if (rpcName == null) { - if (other.rpcName != null) { - return false; - } - } else if (!rpcName.equals(other.rpcName)) { - return false; - } - if (type == null) { - if (other.type != null) { - return false; - } - } else if (!type.equals(other.type)) { - return false; - } - if (version == null) { - if (other.version != null) { - return false; - } - } else if (!version.equals(other.version)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java deleted file mode 100644 index ee2d28094..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java +++ /dev/null @@ -1,113 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2018 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.appclcm.util; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - -import java.lang.reflect.Type; -import java.time.Instant; - -import org.onap.policy.appclcm.LcmRequest; -import org.onap.policy.appclcm.LcmResponse; - -public final class Serialization { - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(Instant.class, new InstantAdapter()).create(); - - public static final Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(LcmRequest.class, new RequestAdapter()) - .registerTypeAdapter(LcmResponse.class, new ResponseAdapter()).create(); - - public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(Instant.class, new InstantJunitAdapter()).create(); - - private Serialization() {} - - public static class RequestAdapter implements JsonSerializer, JsonDeserializer { - - @Override - public JsonElement serialize(LcmRequest src, Type typeOfSrc, JsonSerializationContext context) { - JsonElement requestJson = gsonPretty.toJsonTree(src, LcmRequest.class); - JsonObject input = new JsonObject(); - input.add("input", requestJson); - - return input; - } - - @Override - public LcmRequest deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return gsonPretty.fromJson(json.getAsJsonObject().get("input"), LcmRequest.class); - } - } - - public static class ResponseAdapter implements JsonSerializer, JsonDeserializer { - - @Override - public JsonElement serialize(LcmResponse src, Type typeOfSrc, JsonSerializationContext context) { - JsonElement responseJson = gsonPretty.toJsonTree(src, LcmResponse.class); - JsonObject output = new JsonObject(); - output.add("output", responseJson); - return output; - } - - @Override - public LcmResponse deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return gsonPretty.fromJson(json.getAsJsonObject().get("output"), LcmResponse.class); - } - } - - public static class InstantAdapter implements JsonSerializer, JsonDeserializer { - - @Override - public Instant deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return Instant.parse(json.getAsString()); - } - - @Override - public JsonElement serialize(Instant src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src.toString()); - } - - } - - public static class InstantJunitAdapter implements JsonSerializer, JsonDeserializer { - - @Override - public Instant deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return Instant.ofEpochMilli(json.getAsLong()); - } - - @Override - public JsonElement serialize(Instant src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src.toEpochMilli()); - } - - } - -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/StatusCodeEnum.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/StatusCodeEnum.java deleted file mode 100644 index d954789e8..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/StatusCodeEnum.java +++ /dev/null @@ -1,89 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Samsung Electronics Co., Ltd. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.appclcm.util; - -import java.util.HashMap; -import java.util.Map; - -public enum StatusCodeEnum { - ACCEPTED("ACCEPTED"), ERROR("ERROR"), REJECT("REJECT"), SUCCESS("SUCCESS"), FAILURE("FAILURE"), - PARTIAL_SUCCESS("PARTIAL SUCCESS"), PARTIAL_FAILURE("PARTIAL FAILURE"); - - private String name; - - StatusCodeEnum(final String name) { - this.name = name; - } - - public String toString() { - return this.name; - } - - /** - * Determine status enum from the code. - * - * @param statusCode integer code indicating the status - * @return enum representation of status code - */ - public static StatusCodeEnum fromStatusCode(final int statusCode) { - if (statusCode == 100) { - return ACCEPTED; - } - - if (statusCode == 200) { - return ERROR; - } - - if (isRejectStatusCode(statusCode)) { - return REJECT; - } - - if (statusCode == 400) { - return SUCCESS; - } - - if (isFailureStatusCode(statusCode)) { - return FAILURE; - } - - if (statusCode == 500) { - return PARTIAL_SUCCESS; - } - - if (isPartialFailureStatusCode(statusCode)) { - return PARTIAL_FAILURE; - } - - return null; - } - - private static boolean isRejectStatusCode(final int statusCode) { - return statusCode >= 300 && statusCode <= 313; - } - - private static boolean isFailureStatusCode(final int statusCode) { - return statusCode == 450 || (statusCode >= 401 && statusCode <= 406); - } - - private static boolean isPartialFailureStatusCode(final int statusCode) { - return statusCode >= 501 && statusCode <= 599; - } -} \ No newline at end of file diff --git a/controlloop/common/model-impl/appclcm/src/main/resources/definitions.yaml b/controlloop/common/model-impl/appclcm/src/main/resources/definitions.yaml deleted file mode 100644 index 680a9929c..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/resources/definitions.yaml +++ /dev/null @@ -1,118 +0,0 @@ -### -# ============LICENSE_START======================================================= -# appc -# ================================================================================ -# 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========================================================= -### - -Request: - type: object - properties: - CommonHeader: - type: object - properties: - TimeStamp: - type: string - APIver: - type: string - value: '1.01' - OriginatorID: - type: string - RequestID: - type: string - pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - SubRequestID: - type: string - Flags: - type: object - required: - - TimeStamp - - APIver - - OriginatorID - - RequestID - Action: - type: string - enum: - - Audit - - ActionStatus - - BlockAudits - - Configure - - HealthCheck - - Install - - LiveUpgrade - - Migrate - - ModifyConfig - - Query - - Rebuild - - Reconfigure - - Restart - - Rollback - - Scale - - Start - - Stop - - Sync - - Terminate - - Test - - Upgrade - TargetID: - type: string - ObjectID: - type: string - Payload: - type: object - required: - - CommonHeader - - Action - - TargetID -Response: - type: object - properties: - CommonHeader: - type: object - properties: - TimeStamp: - type: string - APIver: - type: string - OriginatorID: - type: string - RequestID: - type: string - SubRequestID: - type: string - Flags: - type: object - required: - - TimeStamp - - APIver - - OriginatorID - - RequestID - Status: - type: object - properties: - Code: - type: integer - Value: - type: string - required: - - Code - - Value - Payload: - type: object - required: - - CommonHeader - - Status - diff --git a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/AppcLcmTest.java b/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/AppcLcmTest.java deleted file mode 100644 index cee87077a..000000000 --- a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/AppcLcmTest.java +++ /dev/null @@ -1,232 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * Copyright (C) 2017-2018 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.appclcm; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.HashMap; -import java.util.UUID; - -import org.junit.Test; -import org.onap.policy.appclcm.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AppcLcmTest { - - private static final Logger logger = LoggerFactory.getLogger(AppcLcmTest.class); - - private static LcmRequestWrapper dmaapRequest; - private static LcmResponseWrapper dmaapResponse; - - static { - /* - * Construct an APPCLCM Request to be Serialized - */ - dmaapRequest = new LcmRequestWrapper(); - dmaapRequest.setCorrelationId("664be3d2-6c12-4f4b-a3e7-c349acced200" + "-" + "1"); - dmaapRequest.setRpcName("restart"); - dmaapRequest.setType("request"); - - dmaapResponse = new LcmResponseWrapper(); - dmaapResponse.setCorrelationId("664be3d2-6c12-4f4b-a3e7-c349acced200" + "-" + "1"); - dmaapResponse.setRpcName("restart"); - dmaapResponse.setType("response"); - - LcmRequest appcRequest = new LcmRequest(); - - appcRequest.setAction("restart"); - - HashMap actionIdentifiers = new HashMap<>(); - actionIdentifiers.put("vnf-id", "trial-vnf-003"); - actionIdentifiers.put("vserver-id", "08f6c1f9-99e7-49f3-a662-c62b9f200d79"); - - appcRequest.setActionIdentifiers(actionIdentifiers); - - LcmCommonHeader commonHeader = new LcmCommonHeader(); - commonHeader.setRequestId(UUID.fromString("664be3d2-6c12-4f4b-a3e7-c349acced200")); - commonHeader.setSubRequestId("1"); - commonHeader.setOriginatorId("664be3d2-6c12-4f4b-a3e7-c349acced200"); - - appcRequest.setCommonHeader(commonHeader); - - appcRequest.setPayload(null); - - dmaapRequest.setBody(appcRequest); - - /* - * Construct an APPCLCM Response to be Serialized - */ - LcmResponse appcResponse = new LcmResponse(appcRequest); - appcResponse.getStatus().setCode(400); - appcResponse.getStatus().setMessage("Restart Successful"); - appcResponse.setPayload(null); - - dmaapResponse.setBody(appcResponse); - } - - @Test - public void testRequestSerialization() { - - /* - * Use the gson serializer to obtain json - */ - String jsonRequest = Serialization.gson.toJson(dmaapRequest, LcmRequestWrapper.class); - assertNotNull(jsonRequest); - - /* - * The serializer should have added an extra sub-tag called "input" that wraps the request - */ - assertTrue(jsonRequest.contains("input")); - - /* - * The common-header, request-id, and sub-request-id should exist - */ - assertTrue(jsonRequest.contains("common-header")); - assertTrue(jsonRequest.contains("request-id")); - assertTrue(jsonRequest.contains("sub-request-id")); - - /* - * action-identifiers should exist and contain a vnf-id - */ - assertTrue(jsonRequest.contains("action-identifiers")); - assertTrue(jsonRequest.contains("vnf-id")); - - /* - * The action sub-tag should exist - */ - assertTrue(jsonRequest.contains("action")); - - logger.debug("Request as JSON: " + jsonRequest + "\n\n"); - } - - @Test - public void testRequestDeserialization() { - - /* - * Convert the LCM request object into json so we have a string of json to use for testing - */ - String jsonRequest = Serialization.gson.toJson(dmaapRequest, LcmRequestWrapper.class); - - /* - * Use the serializer to convert the json string into a java object - */ - LcmRequestWrapper dmaapRequest = Serialization.gson.fromJson(jsonRequest, LcmRequestWrapper.class); - assertNotNull(dmaapRequest); - - /* - * The type of the DMAAP wrapper should be request - */ - assertEquals("request", dmaapRequest.getType()); - - /* - * The DMAAP wrapper must have a body as that is the true APPC request - */ - assertNotNull(dmaapRequest.getBody()); - LcmRequest appcRequest = dmaapRequest.getBody(); - assertNotNull(appcRequest); - - /* - * The common header should not be null - */ - assertNotNull(appcRequest.getCommonHeader()); - - /* - * The action should not be null and should be set to restart - */ - assertNotNull(appcRequest.getAction()); - assertEquals("restart", appcRequest.getAction()); - - /* - * The action-identifiers should not be null and should contain a vnf-id - */ - assertNotNull(appcRequest.getActionIdentifiers()); - assertNotNull(appcRequest.getActionIdentifiers().get("vnf-id")); - - logger.debug("Request as a Java Object: \n" + appcRequest.toString() + "\n\n"); - } - - @Test - public void testResponseSerialization() { - - /* - * Use the serializer to convert the object into json - */ - String jsonResponse = Serialization.gson.toJson(dmaapResponse, LcmResponseWrapper.class); - assertNotNull(jsonResponse); - - /* - * The serializer should have added an extra sub-tag called "input" that wraps the request - */ - assertTrue(jsonResponse.contains("output")); - - /* - * The response should contain a common-header, request-id, sub-request-id, and status - */ - assertTrue(jsonResponse.contains("common-header")); - assertTrue(jsonResponse.contains("request-id")); - assertTrue(jsonResponse.contains("sub-request-id")); - assertTrue(jsonResponse.contains("status")); - - logger.debug("Response as JSON: " + jsonResponse + "\n\n"); - } - - @Test - public void testResponseDeserialization() { - /* - * Convert the LCM response object into json so we have a string of json to use for testing - */ - String jsonResponse = Serialization.gson.toJson(dmaapResponse, LcmResponseWrapper.class); - - /* - * Use the serializer to convert the json string into a java object - */ - LcmResponseWrapper dmaapResponse = Serialization.gson.fromJson(jsonResponse, LcmResponseWrapper.class); - assertNotNull(dmaapResponse); - - /* - * The type of the DMAAP wrapper should be response - */ - assertEquals("response", dmaapResponse.getType()); - - /* - * The DMAAP wrapper must have a body as that is the true APPC response - */ - assertNotNull(dmaapResponse.getBody()); - LcmResponse appcResponse = dmaapResponse.getBody(); - assertNotNull(appcResponse); - - /* - * The common header should not be null - */ - assertNotNull(appcResponse.getCommonHeader()); - - /* - * The status should not be null and the status code should be 400 - */ - assertNotNull(appcResponse.getStatus()); - assertEquals(400, appcResponse.getStatus().getCode()); - - logger.debug("Response as a Java Object: \n" + appcResponse.toString() + "\n\n"); - } -} diff --git a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmCommonHeaderTest.java b/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmCommonHeaderTest.java deleted file mode 100644 index d48771a5c..000000000 --- a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmCommonHeaderTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2018 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.appclcm; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.junit.Test; - -public class LcmCommonHeaderTest { - - @Test - public void testLcmCommonHeader() { - LcmCommonHeader commonHeader = new LcmCommonHeader(); - assertNotNull(commonHeader); - assertNotNull(new LcmCommonHeader(commonHeader)); - assertNotEquals(0, commonHeader.hashCode()); - - commonHeader.setApiVer("Kansas"); - assertEquals("Kansas", commonHeader.getApiVer()); - - Map flagMap = new HashMap<>(); - commonHeader.setFlags(flagMap); - assertEquals(flagMap, commonHeader.getFlags()); - - commonHeader.setOriginatorId("Dorothy"); - assertEquals("Dorothy", commonHeader.getOriginatorId()); - - UUID requestId = UUID.randomUUID(); - commonHeader.setRequestId(requestId); - assertEquals(requestId, commonHeader.getRequestId()); - - commonHeader.setSubRequestId("Can I go home?"); - assertEquals("Can I go home?", commonHeader.getSubRequestId()); - - Instant timestamp = Instant.now(); - commonHeader.setTimeStamp(timestamp); - assertEquals(timestamp, commonHeader.getTimeStamp()); - - assertNotEquals(0, commonHeader.hashCode()); - - assertEquals("CommonHeader [timeStamp=", commonHeader.toString().substring(0, 24)); - - LcmCommonHeader copiedLcmCommonHeader = new LcmCommonHeader(); - copiedLcmCommonHeader.setApiVer(commonHeader.getApiVer()); - copiedLcmCommonHeader.setFlags(commonHeader.getFlags()); - copiedLcmCommonHeader.setOriginatorId(commonHeader.getOriginatorId()); - copiedLcmCommonHeader.setRequestId(commonHeader.getRequestId()); - copiedLcmCommonHeader.setSubRequestId(commonHeader.getSubRequestId()); - copiedLcmCommonHeader.setTimeStamp(commonHeader.getTimeStamp()); - - assertTrue(commonHeader.equals(commonHeader)); - assertTrue(commonHeader.equals(copiedLcmCommonHeader)); - assertFalse(commonHeader.equals(null)); - assertFalse(commonHeader.equals("Hello")); - - LcmCommonHeader clonedLcmCommonHeader = new LcmCommonHeader(commonHeader); - clonedLcmCommonHeader.setApiVer(commonHeader.getApiVer()); - clonedLcmCommonHeader.setTimeStamp(commonHeader.getTimeStamp()); - - assertTrue(commonHeader.equals(clonedLcmCommonHeader)); - - commonHeader.setApiVer(null); - assertFalse(commonHeader.equals(copiedLcmCommonHeader)); - copiedLcmCommonHeader.setApiVer(null); - assertTrue(commonHeader.equals(copiedLcmCommonHeader)); - commonHeader.setApiVer("Kansas"); - assertFalse(commonHeader.equals(copiedLcmCommonHeader)); - copiedLcmCommonHeader.setApiVer("Kansas"); - assertTrue(commonHeader.equals(copiedLcmCommonHeader)); - - commonHeader.setFlags(null); - assertFalse(commonHeader.equals(copiedLcmCommonHeader)); - copiedLcmCommonHeader.setFlags(null); - assertTrue(commonHeader.equals(copiedLcmCommonHeader)); - commonHeader.setFlags(flagMap); - assertFalse(commonHeader.equals(copiedLcmCommonHeader)); - copiedLcmCommonHeader.setFlags(flagMap); - assertTrue(commonHeader.equals(copiedLcmCommonHeader)); - - commonHeader.setOriginatorId(null); - assertFalse(commonHeader.equals(copiedLcmCommonHeader)); - copiedLcmCommonHeader.setOriginatorId(null); - assertTrue(commonHeader.equals(copiedLcmCommonHeader)); - commonHeader.setOriginatorId("Dorothy"); - assertFalse(commonHeader.equals(copiedLcmCommonHeader)); - copiedLcmCommonHeader.setOriginatorId("Dorothy"); - assertTrue(commonHeader.equals(copiedLcmCommonHeader)); - - commonHeader.setRequestId(null); - assertFalse(commonHeader.equals(copiedLcmCommonHeader)); - copiedLcmCommonHeader.setRequestId(null); - assertTrue(commonHeader.equals(copiedLcmCommonHeader)); - commonHeader.setRequestId(requestId); - assertFalse(commonHeader.equals(copiedLcmCommonHeader)); - copiedLcmCommonHeader.setRequestId(requestId); - assertTrue(commonHeader.equals(copiedLcmCommonHeader)); - - commonHeader.setSubRequestId(null); - assertFalse(commonHeader.equals(copiedLcmCommonHeader)); - copiedLcmCommonHeader.setSubRequestId(null); - assertTrue(commonHeader.equals(copiedLcmCommonHeader)); - commonHeader.setSubRequestId("Can I go home?"); - assertFalse(commonHeader.equals(copiedLcmCommonHeader)); - copiedLcmCommonHeader.setSubRequestId("Can I go home?"); - assertTrue(commonHeader.equals(copiedLcmCommonHeader)); - - commonHeader.setTimeStamp(null); - assertFalse(commonHeader.equals(copiedLcmCommonHeader)); - copiedLcmCommonHeader.setTimeStamp(null); - assertTrue(commonHeader.equals(copiedLcmCommonHeader)); - commonHeader.setTimeStamp(timestamp); - assertFalse(commonHeader.equals(copiedLcmCommonHeader)); - copiedLcmCommonHeader.setTimeStamp(timestamp); - assertTrue(commonHeader.equals(copiedLcmCommonHeader)); - } -} diff --git a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmRequestTest.java b/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmRequestTest.java deleted file mode 100644 index 5cc817d5e..000000000 --- a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmRequestTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2018 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.appclcm; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; - -public class LcmRequestTest { - - @Test - public void testLcmRequest() { - LcmRequest request = new LcmRequest(); - assertNotNull(request); - assertNotEquals(0, request.hashCode()); - - LcmCommonHeader commonHeader = new LcmCommonHeader(); - - request.setCommonHeader(commonHeader); - assertEquals(commonHeader, request.getCommonHeader()); - - request.setAction("Go to Oz"); - assertEquals("Go to Oz", request.getAction()); - - Map actionIdentifiers = new HashMap<>(); - actionIdentifiers.put("North", "Good Witch"); - actionIdentifiers.put("West", "Bad Witch"); - - request.setActionIdentifiers(actionIdentifiers); - assertEquals(actionIdentifiers, request.getActionIdentifiers()); - - request.setPayload("The Emerald City"); - assertEquals("The Emerald City", request.getPayload()); - - assertNotEquals(0, request.hashCode()); - - assertEquals("Request [commonHeader=CommonHeader [timeStamp=", request.toString().substring(0, 46)); - - LcmRequest copiedLcmRequest = new LcmRequest(); - copiedLcmRequest.setCommonHeader(request.getCommonHeader()); - copiedLcmRequest.setAction(request.getAction()); - copiedLcmRequest.setActionIdentifiers(request.getActionIdentifiers()); - copiedLcmRequest.setPayload(request.getPayload()); - - assertTrue(request.equals(request)); - assertTrue(request.equals(copiedLcmRequest)); - assertFalse(request.equals(null)); - assertFalse(request.equals("Hello")); - - request.setCommonHeader(null); - assertFalse(request.equals(copiedLcmRequest)); - copiedLcmRequest.setCommonHeader(null); - assertTrue(request.equals(copiedLcmRequest)); - request.setCommonHeader(commonHeader); - assertFalse(request.equals(copiedLcmRequest)); - copiedLcmRequest.setCommonHeader(commonHeader); - assertTrue(request.equals(copiedLcmRequest)); - - request.setAction(null); - assertFalse(request.equals(copiedLcmRequest)); - copiedLcmRequest.setAction(null); - assertTrue(request.equals(copiedLcmRequest)); - request.setAction("Go to Oz"); - assertFalse(request.equals(copiedLcmRequest)); - copiedLcmRequest.setAction("Go to Oz"); - assertTrue(request.equals(copiedLcmRequest)); - - request.setActionIdentifiers(null); - assertFalse(request.equals(copiedLcmRequest)); - copiedLcmRequest.setActionIdentifiers(null); - assertTrue(request.equals(copiedLcmRequest)); - request.setActionIdentifiers(actionIdentifiers); - assertFalse(request.equals(copiedLcmRequest)); - copiedLcmRequest.setActionIdentifiers(actionIdentifiers); - assertTrue(request.equals(copiedLcmRequest)); - - request.setPayload(null); - assertFalse(request.equals(copiedLcmRequest)); - copiedLcmRequest.setPayload(null); - assertTrue(request.equals(copiedLcmRequest)); - request.setPayload("The Emerald City"); - assertFalse(request.equals(copiedLcmRequest)); - copiedLcmRequest.setPayload("The Emerald City"); - assertTrue(request.equals(copiedLcmRequest)); - } -} diff --git a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmRequestWrapperTest.java b/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmRequestWrapperTest.java deleted file mode 100644 index 42bb91876..000000000 --- a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmRequestWrapperTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2018 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.appclcm; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class LcmRequestWrapperTest { - - @Test - public void testLcmRequestWrapperWrapper() { - assertNotNull(new LcmRequestWrapper(new LcmRequest())); - LcmRequestWrapper requestWrapper = new LcmRequestWrapper(); - assertNotNull(requestWrapper); - assertNotEquals(0, requestWrapper.hashCode()); - - LcmRequest request = new LcmRequest(); - - requestWrapper.setBody(request); - assertEquals(request, requestWrapper.getBody()); - - assertNotEquals(0, requestWrapper.hashCode()); - - assertEquals("RequestWrapper [body=Request [commonHeader=nul", requestWrapper.toString().substring(0, 46)); - - LcmRequestWrapper copiedLcmRequestWrapper = new LcmRequestWrapper(); - copiedLcmRequestWrapper.setBody(requestWrapper.getBody()); - - assertTrue(requestWrapper.equals(requestWrapper)); - assertTrue(requestWrapper.equals(copiedLcmRequestWrapper)); - assertFalse(requestWrapper.equals(null)); - assertFalse(requestWrapper.equals("Hello")); - - requestWrapper.setBody(null); - assertFalse(requestWrapper.equals(copiedLcmRequestWrapper)); - copiedLcmRequestWrapper.setBody(null); - assertTrue(requestWrapper.equals(copiedLcmRequestWrapper)); - requestWrapper.setBody(request); - assertFalse(requestWrapper.equals(copiedLcmRequestWrapper)); - copiedLcmRequestWrapper.setBody(request); - assertTrue(requestWrapper.equals(copiedLcmRequestWrapper)); - } -} diff --git a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResonseCodeTest.java b/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResonseCodeTest.java deleted file mode 100644 index b83fc8d79..000000000 --- a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResonseCodeTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2018 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.appclcm; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import org.junit.Test; - -public class LcmResonseCodeTest { - - @Test - public void testLcmResponseCode() { - assertNull(LcmResponseCode.toResponseValue(0)); - - assertEquals(LcmResponseCode.ACCEPTED, LcmResponseCode.toResponseValue(100)); - assertEquals(LcmResponseCode.ERROR, LcmResponseCode.toResponseValue(200)); - assertEquals(LcmResponseCode.REJECT, LcmResponseCode.toResponseValue(300)); - assertEquals(LcmResponseCode.SUCCESS, LcmResponseCode.toResponseValue(400)); - assertEquals(LcmResponseCode.FAILURE, LcmResponseCode.toResponseValue(450)); - assertEquals(LcmResponseCode.FAILURE, LcmResponseCode.toResponseValue(401)); - assertEquals(LcmResponseCode.FAILURE, LcmResponseCode.toResponseValue(406)); - assertEquals(LcmResponseCode.PARTIAL_SUCCESS, LcmResponseCode.toResponseValue(500)); - assertEquals(LcmResponseCode.PARTIAL_FAILURE, LcmResponseCode.toResponseValue(501)); - assertEquals(LcmResponseCode.PARTIAL_FAILURE, LcmResponseCode.toResponseValue(599)); - - assertEquals("100", new LcmResponseCode(100).toString()); - assertEquals("200", new LcmResponseCode(200).toString()); - assertEquals("300", new LcmResponseCode(300).toString()); - assertEquals("400", new LcmResponseCode(400).toString()); - assertEquals("450", new LcmResponseCode(450).toString()); - assertEquals("500", new LcmResponseCode(500).toString()); - assertEquals("510", new LcmResponseCode(510).toString()); - - assertEquals(300, new LcmResponseCode(300).getCode()); - } -} diff --git a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseStatusTest.java b/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseStatusTest.java deleted file mode 100644 index c1a78e10a..000000000 --- a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseStatusTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * Copyright (C) 2017-2018 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.appclcm; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class LcmResponseStatusTest { - - @Test - public void testResonseStatus() { - LcmResponseStatus status = new LcmResponseStatus(); - assertNotNull(status); - assertNotEquals(0, status.hashCode()); - - status.setCode(1234); - assertEquals(1234, status.getCode()); - - status.setMessage("The wonderful land of Oz"); - assertEquals("The wonderful land of Oz", status.getMessage()); - - assertEquals("ResponseStatus [code=1234, message=The wonderfu", status.toString().substring(0, 47)); - - LcmResponseStatus copiedStatus = new LcmResponseStatus(); - copiedStatus.setCode(status.getCode()); - copiedStatus.setMessage(status.getMessage()); - - assertTrue(status.equals(status)); - assertTrue(status.equals(copiedStatus)); - assertFalse(status.equals(null)); - assertFalse(status.equals("Hello")); - - status.setCode(-1); - assertFalse(status.equals(copiedStatus)); - copiedStatus.setCode(-1); - assertTrue(status.equals(copiedStatus)); - status.setCode(1234); - assertFalse(status.equals(copiedStatus)); - copiedStatus.setCode(1234); - assertTrue(status.equals(copiedStatus)); - - status.setMessage(null); - assertFalse(status.equals(copiedStatus)); - copiedStatus.setMessage(null); - assertTrue(status.equals(copiedStatus)); - status.setMessage("The wonderful land of Oz"); - assertFalse(status.equals(copiedStatus)); - copiedStatus.setMessage("The wonderful land of Oz"); - assertTrue(status.equals(copiedStatus)); - } -} diff --git a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseTest.java b/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseTest.java deleted file mode 100644 index 7583ee0c4..000000000 --- a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseTest.java +++ /dev/null @@ -1,113 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * Copyright (C) 2017-2018 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.appclcm; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class LcmResponseTest { - - private static final String PAYLOAD = "payload"; - - @Test - public void testHashCode() { - LcmResponse response = new LcmResponse(); - assertTrue(response.hashCode() != 0); - response.setCommonHeader(new LcmCommonHeader()); - assertTrue(response.hashCode() != 0); - response.setPayload(PAYLOAD); - assertTrue(response.hashCode() != 0); - response.setStatus(null); - assertTrue(response.hashCode() != 0); - } - - @Test - public void testLcmResponse() { - LcmResponse response = new LcmResponse(); - assertNull(response.getCommonHeader()); - assertNull(response.getPayload()); - assertNotNull(response.getStatus()); - } - - @Test - public void testToString() { - LcmResponse response = new LcmResponse(); - assertFalse(response.toString().isEmpty()); - } - - @Test - public void testEqualsObject() { - LcmResponse response = new LcmResponse(); - assertTrue(response.equals(response)); - assertFalse(response.equals(null)); - assertFalse(response.equals(new Object())); - - LcmResponse response2 = new LcmResponse(); - assertTrue(response.equals(response2)); - - response.setCommonHeader(new LcmCommonHeader()); - assertFalse(response.equals(response2)); - response2.setCommonHeader(response.getCommonHeader()); - assertTrue(response.equals(response2)); - - response.setPayload(PAYLOAD); - assertFalse(response.equals(response2)); - response2.setPayload(response.getPayload()); - assertTrue(response.equals(response2)); - - response.setCommonHeader(null); - assertFalse(response.equals(response2)); - response2.setCommonHeader(null); - assertTrue(response.equals(response2)); - - response.setPayload(null); - assertFalse(response.equals(response2)); - response2.setPayload(response.getPayload()); - assertTrue(response.equals(response2)); - - response.setStatus(null); - assertFalse(response.equals(response2)); - response2.setStatus(response.getStatus()); - assertTrue(response.equals(response2)); - - LcmResponseStatus status = new LcmResponseStatus(); - status.setCode(5); - response.setStatus(status); - response2.setStatus(new LcmResponseStatus()); - assertFalse(response.equals(response2)); - } - - @Test - public void testResponseRequest() { - LcmRequest request = new LcmRequest(); - request.setCommonHeader(new LcmCommonHeader()); - request.setPayload(PAYLOAD); - - LcmResponse response = new LcmResponse(request); - - assertTrue(response.getPayload().equals(PAYLOAD)); - } - -} diff --git a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseWrapperTest.java b/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseWrapperTest.java deleted file mode 100644 index 2fc04794e..000000000 --- a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseWrapperTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * 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.appclcm; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class LcmResponseWrapperTest { - - @Test - public void testLcmResponseWrapperWrapper() { - LcmResponseWrapper responseWrapper = new LcmResponseWrapper(); - assertNotNull(responseWrapper); - assertNotEquals(0, responseWrapper.hashCode()); - - LcmResponse response = new LcmResponse(); - - responseWrapper.setBody(response); - assertEquals(response, responseWrapper.getBody()); - - assertNotEquals(0, responseWrapper.hashCode()); - - assertEquals("ResponseWrapper [body=Response [commonHeader=n", responseWrapper.toString().substring(0, 46)); - - LcmResponseWrapper copiedLcmResponseWrapper = new LcmResponseWrapper(); - copiedLcmResponseWrapper.setBody(responseWrapper.getBody()); - - assertTrue(responseWrapper.equals(responseWrapper)); - assertTrue(responseWrapper.equals(copiedLcmResponseWrapper)); - assertFalse(responseWrapper.equals(null)); - assertFalse(responseWrapper.equals("Hello")); - - responseWrapper.setBody(null); - assertFalse(responseWrapper.equals(copiedLcmResponseWrapper)); - copiedLcmResponseWrapper.setBody(null); - assertTrue(responseWrapper.equals(copiedLcmResponseWrapper)); - responseWrapper.setBody(response); - assertFalse(responseWrapper.equals(copiedLcmResponseWrapper)); - copiedLcmResponseWrapper.setBody(response); - assertTrue(responseWrapper.equals(copiedLcmResponseWrapper)); - } -} diff --git a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmWrapperTest.java b/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmWrapperTest.java deleted file mode 100644 index a12b7f775..000000000 --- a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmWrapperTest.java +++ /dev/null @@ -1,115 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * 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.appclcm; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class LcmWrapperTest { - - @Test - public void testLcmWrapper() { - LcmWrapper wrapper = new LcmWrapper(); - assertNotNull(wrapper); - assertNotEquals(0, wrapper.hashCode()); - - wrapper.setVersion("19.3.9"); - assertEquals("19.3.9", wrapper.getVersion()); - - wrapper.setCambriaPartition("The Emerald City"); - assertEquals("The Emerald City", wrapper.getCambriaPartition()); - - wrapper.setRpcName("Tornado"); - assertEquals("Tornado", wrapper.getRpcName()); - - wrapper.setCorrelationId("YellowBrickRoad"); - assertEquals("YellowBrickRoad", wrapper.getCorrelationId()); - - wrapper.setType("Munchkin"); - assertEquals("Munchkin", wrapper.getType()); - - assertNotEquals(0, wrapper.hashCode()); - - assertEquals("Wrapper [version=19.3.9, cambriaPartition=The ", wrapper.toString().substring(0, 46)); - - LcmWrapper copiedLcmWrapper = new LcmWrapper(); - copiedLcmWrapper.setVersion(wrapper.getVersion()); - copiedLcmWrapper.setCambriaPartition(wrapper.getCambriaPartition()); - copiedLcmWrapper.setRpcName(wrapper.getRpcName()); - copiedLcmWrapper.setCorrelationId(wrapper.getCorrelationId()); - copiedLcmWrapper.setType(wrapper.getType()); - - assertTrue(wrapper.equals(wrapper)); - assertTrue(wrapper.equals(copiedLcmWrapper)); - assertFalse(wrapper.equals(null)); - assertFalse(wrapper.equals("Hello")); - - wrapper.setVersion(null); - assertFalse(wrapper.equals(copiedLcmWrapper)); - copiedLcmWrapper.setVersion(null); - assertTrue(wrapper.equals(copiedLcmWrapper)); - wrapper.setVersion("19.3.9"); - assertFalse(wrapper.equals(copiedLcmWrapper)); - copiedLcmWrapper.setVersion("19.3.9"); - assertTrue(wrapper.equals(copiedLcmWrapper)); - - wrapper.setCambriaPartition(null); - assertFalse(wrapper.equals(copiedLcmWrapper)); - copiedLcmWrapper.setCambriaPartition(null); - assertTrue(wrapper.equals(copiedLcmWrapper)); - wrapper.setCambriaPartition("The Emerald City"); - assertFalse(wrapper.equals(copiedLcmWrapper)); - copiedLcmWrapper.setCambriaPartition("The Emerald City"); - assertTrue(wrapper.equals(copiedLcmWrapper)); - - wrapper.setRpcName(null); - assertFalse(wrapper.equals(copiedLcmWrapper)); - copiedLcmWrapper.setRpcName(null); - assertTrue(wrapper.equals(copiedLcmWrapper)); - wrapper.setRpcName("Tornado"); - assertFalse(wrapper.equals(copiedLcmWrapper)); - copiedLcmWrapper.setRpcName("Tornado"); - assertTrue(wrapper.equals(copiedLcmWrapper)); - - wrapper.setCorrelationId(null); - assertFalse(wrapper.equals(copiedLcmWrapper)); - copiedLcmWrapper.setCorrelationId(null); - assertTrue(wrapper.equals(copiedLcmWrapper)); - wrapper.setCorrelationId("YellowBrickRoad"); - assertFalse(wrapper.equals(copiedLcmWrapper)); - copiedLcmWrapper.setCorrelationId("YellowBrickRoad"); - assertTrue(wrapper.equals(copiedLcmWrapper)); - - wrapper.setType(null); - assertFalse(wrapper.equals(copiedLcmWrapper)); - copiedLcmWrapper.setType(null); - assertTrue(wrapper.equals(copiedLcmWrapper)); - wrapper.setType("Munchkin"); - assertFalse(wrapper.equals(copiedLcmWrapper)); - copiedLcmWrapper.setType("Munchkin"); - assertTrue(wrapper.equals(copiedLcmWrapper)); - } -} diff --git a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/util/SerializationTest.java b/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/util/SerializationTest.java deleted file mode 100644 index 62f98644f..000000000 --- a/controlloop/common/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/util/SerializationTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * 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.appclcm.util; - -import static org.junit.Assert.assertEquals; - -import java.time.Instant; -import java.time.ZoneId; -import java.time.ZonedDateTime; - -import org.junit.Test; - -public class SerializationTest { - - @Test - public void test() { - String nameString = "Dorothy"; - String jsonName = Serialization.gsonPretty.toJson(nameString, String.class); - assertEquals("\"Dorothy\"", jsonName); - String jsonInOutName = Serialization.gsonPretty.fromJson(jsonName, String.class); - assertEquals("Dorothy", jsonInOutName); - - Instant instant0 = Instant.ofEpochMilli(1516127215000L); - String instantString0 = Serialization.gsonPretty.toJson(instant0, Instant.class); - assertEquals("\"2018-01-16T18:26:55Z\"", instantString0); - Instant outInstant0 = Serialization.gsonPretty.fromJson(instantString0, Instant.class); - assertEquals(instant0, outInstant0); - - Instant instant1 = Instant.ofEpochMilli(1516127215000L); - String instantString1 = Serialization.gsonJunit.toJson(instant1, Instant.class); - assertEquals("1516127215000", instantString1); - Instant outInstant1 = Serialization.gsonJunit.fromJson(instantString1, Instant.class); - assertEquals(instant1, outInstant1); - - ZonedDateTime zdt = ZonedDateTime.ofInstant(instant0, ZoneId.of("UTC")); - String zdtString = Serialization.gsonPretty.toJson(zdt, ZonedDateTime.class); - assertEquals("{\n \"dateTime\": {\n \"date\":", zdtString.substring(0, 29)); - } -} diff --git a/controlloop/common/model-impl/events/README.md b/controlloop/common/model-impl/events/README.md deleted file mode 100644 index 6ebd725d2..000000000 --- a/controlloop/common/model-impl/events/README.md +++ /dev/null @@ -1,11 +0,0 @@ -Copyright 2018 AT&T Intellectual Property. All rights reserved. -This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE -Full license text at https://creativecommons.org/licenses/by/4.0/legalcode - -Policy Control Loop - -This is the implementation of the Policy's Control Loop messages. This includes the Events consumed and Notifications produced by the ONAP Policy Platform. - - - - diff --git a/controlloop/common/model-impl/events/pom.xml b/controlloop/common/model-impl/events/pom.xml deleted file mode 100644 index cfe8c4ad7..000000000 --- a/controlloop/common/model-impl/events/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - 4.0.0 - - - org.onap.policy.drools-applications.controlloop.common.model-impl - model-impl - 1.4.0-SNAPSHOT - - - events - - - - com.google.code.gson - gson - provided - - - junit - junit - test - - - diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java deleted file mode 100644 index 944bef754..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java +++ /dev/null @@ -1,192 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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.controlloop; - -import com.google.gson.annotations.SerializedName; -import java.io.Serializable; -import java.util.UUID; - -public abstract class ControlLoopEvent implements Serializable { - - private static final long serialVersionUID = 2391252138583119195L; - - @SerializedName("closedLoopControlName") - private String closedLoopControlName; - - @SerializedName("version") - private String version = "1.0.2"; - - @SerializedName("requestID") - private UUID requestId; - - @SerializedName("closedLoopEventClient") - private String closedLoopEventClient; - - @SerializedName("target_type") - private ControlLoopTargetType targetType; - - @SerializedName("target") - private String target; - - @SerializedName("from") - private String from; - - @SerializedName("policyScope") - private String policyScope; - - @SerializedName("policyName") - private String policyName; - - @SerializedName("policyVersion") - private String policyVersion; - - @SerializedName("closedLoopEventStatus") - private ControlLoopEventStatus closedLoopEventStatus; - - @SerializedName("payload") - private String payload; - - public ControlLoopEvent() { - - } - - /** - * Construct an instace from an existing instance. - * - * @param event the existing instance - */ - public ControlLoopEvent(ControlLoopEvent event) { - if (event == null) { - return; - } - this.closedLoopControlName = event.closedLoopControlName; - this.requestId = event.requestId; - this.closedLoopEventClient = event.closedLoopEventClient; - this.targetType = event.targetType; - this.target = event.target; - this.from = event.from; - this.policyScope = event.policyScope; - this.policyName = event.policyName; - this.policyVersion = event.policyVersion; - this.closedLoopEventStatus = event.closedLoopEventStatus; - this.payload = event.payload; - } - - public boolean isEventStatusValid() { - return this.closedLoopEventStatus != null; - } - - public String getClosedLoopControlName() { - return closedLoopControlName; - } - - public void setClosedLoopControlName(String closedLoopControlName) { - this.closedLoopControlName = closedLoopControlName; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public UUID getRequestId() { - return requestId; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public String getClosedLoopEventClient() { - return closedLoopEventClient; - } - - public void setClosedLoopEventClient(String closedLoopEventClient) { - this.closedLoopEventClient = closedLoopEventClient; - } - - public ControlLoopTargetType getTargetType() { - return targetType; - } - - public void setTargetType(ControlLoopTargetType targetType) { - this.targetType = targetType; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public String getFrom() { - return from; - } - - public void setFrom(String from) { - this.from = from; - } - - public String getPolicyScope() { - return policyScope; - } - - public void setPolicyScope(String policyScope) { - this.policyScope = policyScope; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getPolicyVersion() { - return policyVersion; - } - - public void setPolicyVersion(String policyVersion) { - this.policyVersion = policyVersion; - } - - public ControlLoopEventStatus getClosedLoopEventStatus() { - return closedLoopEventStatus; - } - - public void setClosedLoopEventStatus(ControlLoopEventStatus closedLoopEventStatus) { - this.closedLoopEventStatus = closedLoopEventStatus; - } - - public String getPayload() { - return payload; - } - - public void setPayload(String payload) { - this.payload = payload; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java deleted file mode 100644 index f439e70ab..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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.controlloop; - -public enum ControlLoopEventStatus { - ONSET("ONSET"), ABATED("ABATED"); - - private String status; - - private ControlLoopEventStatus(String status) { - this.status = status; - } - - @Override - public String toString() { - return this.status; - } - - /** - * Convert a String status to a ControlLoopEventStatus. - * - * @param status the String status - * @return the ControlLoopEventStatus - */ - public static ControlLoopEventStatus toStatus(String status) { - if (ONSET.status.equalsIgnoreCase(status)) { - return ONSET; - } - if (ABATED.status.equalsIgnoreCase(status)) { - return ABATED; - } - // - // In case DCAE uses the old abatement - // - if ("abatement".equalsIgnoreCase(status)) { - return ABATED; - } - return null; - } - -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java deleted file mode 100644 index 8c670fe9e..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java +++ /dev/null @@ -1,190 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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.controlloop; - -import java.io.Serializable; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import java.util.LinkedList; -import java.util.List; -import java.util.UUID; - -public abstract class ControlLoopNotification implements Serializable { - - private static final long serialVersionUID = 7538596984567127915L; - - private String closedLoopControlName; - private String version = "1.0.2"; - private UUID requestId; - private String closedLoopEventClient; - private ControlLoopTargetType targetType; - private String target; - private String from; - private String policyScope; - private String policyName; - private String policyVersion; - private ControlLoopNotificationType notification; - private String message; - private ZonedDateTime notificationTime = ZonedDateTime.now(ZoneOffset.UTC); - private Integer opsClTimer; - private List history = new LinkedList<>(); - - public ControlLoopNotification() { - - } - - /** - * Construct an instance. - * - * @param event the event - */ - public ControlLoopNotification(ControlLoopEvent event) { - if (event == null) { - return; - } - - this.setClosedLoopControlName(event.getClosedLoopControlName()); - this.setRequestId(event.getRequestId()); - this.setClosedLoopEventClient(event.getClosedLoopEventClient()); - this.setTargetType(event.getTargetType()); - this.setTarget(event.getTarget()); - } - - public String getClosedLoopControlName() { - return closedLoopControlName; - } - - public void setClosedLoopControlName(String closedLoopControlName) { - this.closedLoopControlName = closedLoopControlName; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public UUID getRequestId() { - return requestId; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public String getClosedLoopEventClient() { - return closedLoopEventClient; - } - - public void setClosedLoopEventClient(String closedLoopEventClient) { - this.closedLoopEventClient = closedLoopEventClient; - } - - public ControlLoopTargetType getTargetType() { - return targetType; - } - - public void setTargetType(ControlLoopTargetType targetType) { - this.targetType = targetType; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public String getFrom() { - return from; - } - - public void setFrom(String from) { - this.from = from; - } - - public String getPolicyScope() { - return policyScope; - } - - public void setPolicyScope(String policyScope) { - this.policyScope = policyScope; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getPolicyVersion() { - return policyVersion; - } - - public void setPolicyVersion(String policyVersion) { - this.policyVersion = policyVersion; - } - - public ControlLoopNotificationType getNotification() { - return notification; - } - - public void setNotification(ControlLoopNotificationType notification) { - this.notification = notification; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public ZonedDateTime getNotificationTime() { - return notificationTime; - } - - public void setNotificationTime(ZonedDateTime notificationTime) { - this.notificationTime = notificationTime; - } - - public Integer getOpsClTimer() { - return opsClTimer; - } - - public void setOpsClTimer(Integer opsClTimer) { - this.opsClTimer = opsClTimer; - } - - public List getHistory() { - return history; - } - - public void setHistory(List history) { - this.history = history; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java deleted file mode 100644 index 9f5a41d39..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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.controlloop; - -public enum ControlLoopNotificationType { - ACTIVE("ACTIVE"), REJECTED("REJECTED"), OPERATION("OPERATION"), OPERATION_SUCCESS( - "OPERATION: SUCCESS"), OPERATION_FAILURE("OPERATION: FAILURE"), FINAL_FAILURE( - "FINAL: FAILURE"), FINAL_SUCCESS("FINAL: SUCCESS"), FINAL_OPENLOOP("FINAL: OPENLOOP"); - - private String type; - - private ControlLoopNotificationType(String type) { - this.type = type; - } - - @Override - public String toString() { - return this.type; - } - - /** - * Convert a String type to a ControlLoopNotificationType. - * - * @param type the String type - * @return the ControlLoopNotificationType - */ - public static ControlLoopNotificationType toType(String type) { - if (ACTIVE.toString().equals(type)) { - return ACTIVE; - } - if (REJECTED.toString().equals(type)) { - return REJECTED; - } - if (OPERATION.toString().equals(type)) { - return OPERATION; - } - if (OPERATION_SUCCESS.toString().equals(type)) { - return OPERATION_SUCCESS; - } - if (OPERATION_FAILURE.toString().equals(type)) { - return OPERATION_FAILURE; - } - if (FINAL_FAILURE.toString().equals(type)) { - return FINAL_FAILURE; - } - if (FINAL_SUCCESS.toString().equals(type)) { - return FINAL_SUCCESS; - } - if (FINAL_OPENLOOP.toString().equals(type)) { - return FINAL_OPENLOOP; - } - return null; - } - -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java deleted file mode 100644 index 3ef731687..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java +++ /dev/null @@ -1,229 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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.controlloop; - -import java.io.Serializable; -import java.time.Instant; - -public class ControlLoopOperation implements Serializable { - - private static final long serialVersionUID = 8662706581293017099L; - - private String actor; - private String operation; - private String target; - private Instant start = Instant.now(); - private Instant end; - private String subRequestId; - private String outcome; - private String message; - - public ControlLoopOperation() { - - } - - /** - * Construct an instance from an existing instance. - * - * @param op the existing instance - */ - public ControlLoopOperation(ControlLoopOperation op) { - if (op == null) { - return; - } - - this.actor = op.actor; - this.operation = op.operation; - this.target = op.target; - this.start = op.start; - this.end = op.end; - this.subRequestId = op.subRequestId; - this.outcome = op.outcome; - this.message = op.message; - } - - public String toMessage() { - return "actor=" + actor + ",operation=" + operation + ",target=" + target + ",subRequestId=" + subRequestId; - } - - public String toHistory() { - return "actor=" + actor + ",operation=" + operation + ",target=" + target + ",start=" + start + ",end=" + end - + ",subRequestId=" + subRequestId + ",outcome=" + outcome + ",message=" + message; - } - - public String getActor() { - return actor; - } - - public void setActor(String actor) { - this.actor = actor; - } - - public String getOperation() { - return operation; - } - - public void setOperation(String operation) { - this.operation = operation; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public Instant getStart() { - return start; - } - - public void setStart(Instant start) { - this.start = start; - } - - public Instant getEnd() { - return end; - } - - public void setEnd(Instant end) { - this.end = end; - } - - public String getSubRequestId() { - return subRequestId; - } - - public void setSubRequestId(String subRequestId) { - this.subRequestId = subRequestId; - } - - public String getOutcome() { - return outcome; - } - - public void setOutcome(String outcome) { - this.outcome = outcome; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - @Override - public String toString() { - return "ControlLoopOperation [actor=" + actor + ", operation=" + operation + ", target=" + target + ", start=" - + start + ", end=" + end + ", subRequestId=" + subRequestId + ", outcome=" + outcome + ", message=" - + message + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((actor == null) ? 0 : actor.hashCode()); - result = prime * result + ((end == null) ? 0 : end.hashCode()); - result = prime * result + ((message == null) ? 0 : message.hashCode()); - result = prime * result + ((operation == null) ? 0 : operation.hashCode()); - result = prime * result + ((outcome == null) ? 0 : outcome.hashCode()); - result = prime * result + ((start == null) ? 0 : start.hashCode()); - result = prime * result + ((subRequestId == null) ? 0 : subRequestId.hashCode()); - result = prime * result + ((target == null) ? 0 : target.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - ControlLoopOperation other = (ControlLoopOperation) obj; - if (actor == null) { - if (other.actor != null) { - return false; - } - } else if (!actor.equals(other.actor)) { - return false; - } - if (end == null) { - if (other.end != null) { - return false; - } - } else if (!end.equals(other.end)) { - return false; - } - if (message == null) { - if (other.message != null) { - return false; - } - } else if (!message.equals(other.message)) { - return false; - } - if (operation == null) { - if (other.operation != null) { - return false; - } - } else if (!operation.equals(other.operation)) { - return false; - } - if (outcome == null) { - if (other.outcome != null) { - return false; - } - } else if (!outcome.equals(other.outcome)) { - return false; - } - if (start == null) { - if (other.start != null) { - return false; - } - } else if (!start.equals(other.start)) { - return false; - } - if (subRequestId == null) { - if (other.subRequestId != null) { - return false; - } - } else if (!subRequestId.equals(other.subRequestId)) { - return false; - } - if (target == null) { - if (other.target != null) { - return false; - } - } else if (!target.equals(other.target)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java deleted file mode 100644 index 0bdc5cace..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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.controlloop; - -import java.util.UUID; - -public class ControlLoopOperationWrapper { - - private UUID requestId; - private ControlLoopOperation operation; - - public ControlLoopOperationWrapper() { - - } - - public ControlLoopOperationWrapper(UUID requestId, ControlLoopOperation operation) { - this.requestId = requestId; - this.operation = operation; - } - - public UUID getRequestId() { - return requestId; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public ControlLoopOperation getOperation() { - return operation; - } - - public void setOperation(ControlLoopOperation operation) { - this.operation = operation; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopResponse.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopResponse.java deleted file mode 100644 index 483aaacfa..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopResponse.java +++ /dev/null @@ -1,142 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2019 Wipro Limited 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.controlloop; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.UUID; - -public class ControlLoopResponse implements Serializable { - - private static final long serialVersionUID = 2391252138583119195L; - - @SerializedName("closedLoopControlName") - private String closedLoopControlName; - - @SerializedName("version") - private String version = "1.0.0"; - - @SerializedName("requestID") - private UUID requestId; - - @SerializedName("target") - private String target; - - @SerializedName("from") - private String from; - - @SerializedName("policyName") - private String policyName; - - @SerializedName("policyVersion") - private String policyVersion; - - @SerializedName("payload") - private String payload; - - public ControlLoopResponse() { - - } - - /** - * Construct an instace from an existing instance. - * - * @param response - * the existing instance - */ - public ControlLoopResponse(ControlLoopResponse response) { - if (response == null) { - return; - } - this.closedLoopControlName = response.closedLoopControlName; - this.requestId = response.requestId; - this.target = response.target; - this.from = response.from; - this.policyName = response.policyName; - this.policyVersion = response.policyVersion; - this.payload = response.payload; - } - - public String getClosedLoopControlName() { - return closedLoopControlName; - } - - public void setClosedLoopControlName(String closedLoopControlName) { - this.closedLoopControlName = closedLoopControlName; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public UUID getRequestId() { - return requestId; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public String getFrom() { - return from; - } - - public void setFrom(String from) { - this.from = from; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getPolicyVersion() { - return policyVersion; - } - - public void setPolicyVersion(String policyVersion) { - this.policyVersion = policyVersion; - } - - public String getPayload() { - return payload; - } - - public void setPayload(String payload) { - this.payload = payload; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java deleted file mode 100644 index 4782654fc..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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.controlloop; - -public enum ControlLoopTargetType { - VM("VM"), VF("VF"), VFC("VFC"), VNF("VNF"); - - private String type; - - private ControlLoopTargetType(String type) { - this.type = type; - } - - @Override - public String toString() { - return this.type; - } - - /** - * Convert a String type to a ControlLoopTargetType. - * - * @param type the String type - * @return the ControlLoopTargetType - */ - public static ControlLoopTargetType toType(String type) { - if (VM.toString().equals(type)) { - return VM; - } - if (VF.toString().equals(type)) { - return VF; - } - if (VFC.toString().equals(type)) { - return VFC; - } - if (VNF.toString().equals(type)) { - return VNF; - } - - return null; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java deleted file mode 100644 index 9cb85ae7f..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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.controlloop; - -public class PhysicalControlLoopEvent extends ControlLoopEvent { - private static final long serialVersionUID = -7282930271094849487L; - - public PhysicalControlLoopEvent() {} - - /** - * Construct an instance from an existing instance. - * - * @param event the existing instance - */ - public PhysicalControlLoopEvent(PhysicalControlLoopEvent event) { - super(event); - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java deleted file mode 100644 index 0b5db3a1f..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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.controlloop; - -public class PhysicalControlLoopNotification extends ControlLoopNotification { - private static final long serialVersionUID = 8105197217140032892L; - - public PhysicalControlLoopNotification() {} - - /** - * Construct an instance from an existing instance. - * - * @param event the existing instance - */ - public PhysicalControlLoopNotification(PhysicalControlLoopEvent event) { - super(event); - } - -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java deleted file mode 100644 index b5ae50ac8..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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.controlloop; - -import com.google.gson.annotations.SerializedName; - -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; - -public class VirtualControlLoopEvent extends ControlLoopEvent { - - private static final long serialVersionUID = -5752405682246066226L; - - @SerializedName("closedLoopAlarmStart") - private Instant closedLoopAlarmStart; - - @SerializedName("closedLoopAlarmEnd") - private Instant closedLoopAlarmEnd; - - @SerializedName("AAI") - private Map aai = new HashMap<>(); - - public VirtualControlLoopEvent() {} - - - /** - * Construct an instance from an existing instance. - * - * @param event the existing instance - */ - public VirtualControlLoopEvent(VirtualControlLoopEvent event) { - super(event); - if (event == null) { - return; - } - if (event.aai != null) { - this.aai = new HashMap<>(event.aai); - } - this.closedLoopAlarmStart = event.closedLoopAlarmStart; - this.closedLoopAlarmEnd = event.closedLoopAlarmEnd; - } - - public Instant getClosedLoopAlarmStart() { - return closedLoopAlarmStart; - } - - public void setClosedLoopAlarmStart(Instant closedLoopAlarmStart) { - this.closedLoopAlarmStart = closedLoopAlarmStart; - } - - public Instant getClosedLoopAlarmEnd() { - return closedLoopAlarmEnd; - } - - public void setClosedLoopAlarmEnd(Instant closedLoopAlarmEnd) { - this.closedLoopAlarmEnd = closedLoopAlarmEnd; - } - - public Map getAai() { - return aai; - } - - public void setAai(Map aai) { - this.aai = aai; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java deleted file mode 100644 index 71a901505..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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.controlloop; - -import com.google.gson.annotations.SerializedName; - -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; - -public class VirtualControlLoopNotification extends ControlLoopNotification { - - private static final long serialVersionUID = 5354756047932144017L; - - @SerializedName("AAI") - private Map aai = new HashMap<>(); - - @SerializedName("closedLoopAlarmStart") - private Instant closedLoopAlarmStart; - - @SerializedName("closedLoopAlarmEnd") - private Instant closedLoopAlarmEnd; - - public VirtualControlLoopNotification() {} - - /** - * Construct an instance. - * - * @param event the event - */ - public VirtualControlLoopNotification(VirtualControlLoopEvent event) { - super(event); - if (event == null) { - return; - } - if (event.getAai() != null) { - this.setAai(new HashMap<>(event.getAai())); - } - this.closedLoopAlarmStart = event.getClosedLoopAlarmStart(); - this.closedLoopAlarmEnd = event.getClosedLoopAlarmEnd(); - } - - public Map getAai() { - return aai; - } - - public void setAai(Map aai) { - this.aai = aai; - } - - public Instant getClosedLoopAlarmStart() { - return closedLoopAlarmStart; - } - - public void setClosedLoopAlarmStart(Instant closedLoopAlarmStart) { - this.closedLoopAlarmStart = closedLoopAlarmStart; - } - - public Instant getClosedLoopAlarmEnd() { - return closedLoopAlarmEnd; - } - - public void setClosedLoopAlarmEnd(Instant closedLoopAlarmEnd) { - this.closedLoopAlarmEnd = closedLoopAlarmEnd; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/params/ControlLoopParams.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/params/ControlLoopParams.java deleted file mode 100644 index ab93f5e9b..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/params/ControlLoopParams.java +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * AppcLcmActorServiceProvider - * ================================================================================ - * Copyright (C) 2018 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.controlloop.params; - -import java.io.Serializable; - -public class ControlLoopParams implements Serializable { - - private static final long serialVersionUID = 970755684770982776L; - - private String closedLoopControlName; - private String controlLoopYaml; - private String policyName; - private String policyScope; - private String policyVersion; - - public ControlLoopParams() { - super(); - } - - /** - * Construct an instance from an existing instance. - * - * @param params the existing instance - */ - public ControlLoopParams(ControlLoopParams params) { - this.closedLoopControlName = params.closedLoopControlName; - this.controlLoopYaml = params.controlLoopYaml; - this.policyName = params.policyName; - this.policyScope = params.policyScope; - this.policyVersion = params.policyVersion; - } - - public String getClosedLoopControlName() { - return closedLoopControlName; - } - - public void setClosedLoopControlName(String closedLoopControlName) { - this.closedLoopControlName = closedLoopControlName; - } - - public String getControlLoopYaml() { - return controlLoopYaml; - } - - public void setControlLoopYaml(String controlLoopYaml) { - this.controlLoopYaml = controlLoopYaml; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getPolicyScope() { - return policyScope; - } - - public void setPolicyScope(String policyScope) { - this.policyScope = policyScope; - } - - public String getPolicyVersion() { - return policyVersion; - } - - public void setPolicyVersion(String policyVersion) { - this.policyVersion = policyVersion; - } - -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java deleted file mode 100644 index 4bbab7a50..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java +++ /dev/null @@ -1,125 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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.controlloop.util; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - -import java.lang.reflect.Type; -import java.time.Instant; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; - -import org.onap.policy.controlloop.ControlLoopNotificationType; -import org.onap.policy.controlloop.ControlLoopTargetType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public final class Serialization { - public static final Gson gson = - new GsonBuilder().disableHtmlEscaping().registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) - .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) - .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter()) - .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create(); - - - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) - .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) - .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter()) - .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create(); - - public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) - .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) - .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create(); - - private Serialization() {} - - public static class NotificationTypeAdapter - implements JsonSerializer, JsonDeserializer { - @Override - public JsonElement serialize(ControlLoopNotificationType src, Type typeOfSrc, - JsonSerializationContext context) { - return new JsonPrimitive(src.toString()); - } - - @Override - public ControlLoopNotificationType deserialize(JsonElement json, Type typeOfT, - JsonDeserializationContext context) { - return ControlLoopNotificationType.toType(json.getAsString()); - } - } - - public static class TargetTypeAdapter - implements JsonSerializer, JsonDeserializer { - @Override - public JsonElement serialize(ControlLoopTargetType src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src.toString()); - } - - @Override - public ControlLoopTargetType deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return ControlLoopTargetType.toType(json.getAsString()); - } - } - - public static class GsonUtcAdapter implements JsonSerializer, JsonDeserializer { - private static final Logger logger = LoggerFactory.getLogger(GsonUtcAdapter.class); - public static final DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSxxx"); - - @Override - public ZonedDateTime deserialize(JsonElement element, Type type, JsonDeserializationContext context) { - try { - return ZonedDateTime.parse(element.getAsString(), format); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override - public JsonElement serialize(ZonedDateTime datetime, Type type, JsonSerializationContext context) { - return new JsonPrimitive(datetime.format(format)); - } - } - - public static class GsonInstantAdapter implements JsonSerializer, JsonDeserializer { - - @Override - public Instant deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return Instant.ofEpochMilli(json.getAsLong()); - } - - @Override - public JsonElement serialize(Instant src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src.toEpochMilli()); - } - - } - -} diff --git a/controlloop/common/model-impl/events/src/main/resources/definitions.yaml b/controlloop/common/model-impl/events/src/main/resources/definitions.yaml deleted file mode 100644 index e7f147300..000000000 --- a/controlloop/common/model-impl/events/src/main/resources/definitions.yaml +++ /dev/null @@ -1,127 +0,0 @@ -# Copyright 2018 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. -AAI: - type: object - properties: - AICVServerSelfLink: - type: string - VNF_NAME: - type: string - AICVMID: - type: string - AICTenantID: - type: string - LOC_ID: - type: string - in_maint: - type: boolean - AICIdentity: - type: string - Prov_status: - type: string - OAM_IPV4: - type: string - is_closed_loop_disabled: - type: boolean - VM_NAME: - type: string - OAM_IPV6: - type: string - required: - - AICVServerSelfLink - - AICIdentity - - is_closed_loop_disabled -ControlLoop: - type: object - description: Common fields for control loop events and notifications - properties: - closedLoopControlName: - type: string - description: A UNIQUE string identifying the Closed Loop ID this event is for. There are no semantics behind this string. - serviceInstance: - $ref: '../../../../sdc/src/main/resources/definitions.yaml#/serviceInstance' - resourceInstance: - $ref: '../../../../sdc/src/main/resources/definitions.yaml#/resourceInstance' - requestID: - type: string - description: This is required via ONAP Platform Logging Requirements. - pattern: /[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/ - triggerID: - type: string - description: ID that maps back to Highland Park. Concatenation between eventID and firstEPOCH. - triggerSourceName: - type: string - description: pulled from eventSourceName of trigger H.P. alarm. The contents of this field should also be contained in the AAI Json sub-tag (see below). - closedLoopAlarmStart: - type: string - description: firstEpoch. UTC Timestamp when this event was detected by DCAE. Conform to ONAP Logging requirements. - closedLoopAlarmEnd: - type: string - description: lastEpoch. UTC Timestamp when this event was detected as cleared by DCAE. Conform to ONAP Logging requirements. - closedLoopEventClient: - type: string - description: Open DCAE sub-system that detected the event and published this event message. - target: - type: string - description: The target entity that is being administered. This could be VM_NAME, VNF_NAME, etc. This should map to a field name in the AAI sub-tag shown below. - AAI: - $ref: '#/AAI' - from: - type: string - policyScope: - type: string - policyName: - type: string - policyVersion: - type: string - required: - - closedLoopControlName - - requestID - - triggerID - - triggerSourceName - - closedLoopAlarmStart - - closedLoopEventClient - - target - - AAI - - from - - policyScope - - policyName - - policyVersion -Event: - allOf: - - $ref: '#/ControlLoop' - - properties: - closedLoopEventStatus: - type: string - description: The status for the event within Open DCAE. A value of “ONSET” indicates the event has been encountered. “ABATED” indicates the event has been abated. - valid_values: - - ONSET - - ABATEMENT - - required: - - closedLoopEventStatus -Notification: - - $ref: '#/ControlLoop' - - properties: - notification: - type: string - notificationTime: - type: string - message: - type: string - OPS_CL_timer: - type: int - - required: - - notification - - notificationTime - - OPS_CL_timer diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventStatusTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventStatusTest.java deleted file mode 100644 index b4944fc42..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventStatusTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; - -import org.junit.Test; - -public class ControlLoopEventStatusTest { - - @Test - public void test() { - ControlLoopEventStatus status = ControlLoopEventStatus.ABATED; - assertEquals(ControlLoopEventStatus.ABATED, ControlLoopEventStatus.toStatus(status.toString())); - assertNotEquals(ControlLoopEventStatus.ONSET, ControlLoopEventStatus.toStatus(status.toString())); - - status = ControlLoopEventStatus.ONSET; - assertEquals(ControlLoopEventStatus.ONSET, ControlLoopEventStatus.toStatus(status.toString())); - assertNotEquals(ControlLoopEventStatus.ABATED, ControlLoopEventStatus.toStatus(status.toString())); - assertEquals(ControlLoopEventStatus.ABATED, ControlLoopEventStatus.toStatus("abatement")); - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventTest.java deleted file mode 100644 index 9da12aaab..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.util.UUID; -import org.junit.Test; - -public class ControlLoopEventTest { - - private class TestControlLoopEvent extends ControlLoopEvent { - private static final long serialVersionUID = 1L; - - public TestControlLoopEvent() { - super(); - } - - public TestControlLoopEvent(ControlLoopEvent event) { - super(event); - } - } - - @Test - public void test() { - ControlLoopEvent event = new TestControlLoopEvent(); - - assertEquals("1.0.2", event.getVersion()); - - event = new TestControlLoopEvent(null); - assertEquals("1.0.2", event.getVersion()); - - event.setClosedLoopControlName("name"); - assertEquals("name", event.getClosedLoopControlName()); - - event.setClosedLoopEventClient("client"); - assertEquals("client", event.getClosedLoopEventClient()); - - event.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); - assertEquals(ControlLoopEventStatus.ONSET, event.getClosedLoopEventStatus()); - - event.setFrom("from"); - assertEquals("from", event.getFrom()); - - event.setPayload("payload"); - assertEquals("payload", event.getPayload()); - - event.setPolicyName("policyname"); - assertEquals("policyname", event.getPolicyName()); - - event.setPolicyScope("scope"); - assertEquals("scope", event.getPolicyScope()); - - event.setPolicyVersion("1"); - assertEquals("1", event.getPolicyVersion()); - - UUID id = UUID.randomUUID(); - event.setRequestId(id); - assertEquals(id, event.getRequestId()); - - event.setTarget("target"); - assertEquals("target", event.getTarget()); - - event.setTargetType(ControlLoopTargetType.VF); - assertEquals(ControlLoopTargetType.VF, event.getTargetType()); - - event.setVersion("foo"); - assertEquals("foo", event.getVersion()); - - ControlLoopEvent event2 = new TestControlLoopEvent(event); - assertTrue(event2.isEventStatusValid()); - - event2.setClosedLoopEventStatus(null); - assertFalse(event2.isEventStatusValid()); - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTest.java deleted file mode 100644 index de03cc265..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import java.util.Collections; -import java.util.UUID; -import org.junit.Test; -import org.onap.policy.controlloop.util.Serialization; - -public class ControlLoopNotificationTest { - - private class TestControlLoopNotification extends ControlLoopNotification { - private static final long serialVersionUID = 1L; - - public TestControlLoopNotification() { - super(); - } - - public TestControlLoopNotification(ControlLoopEvent event) { - super(event); - } - } - - @Test - public void test() { - ControlLoopNotification notification = new TestControlLoopNotification(); - - assertEquals("1.0.2", notification.getVersion()); - - notification.setClosedLoopControlName("name"); - assertEquals("name", notification.getClosedLoopControlName()); - - notification.setClosedLoopEventClient("client"); - assertEquals("client", notification.getClosedLoopEventClient()); - - notification.setFrom("from"); - assertEquals("from", notification.getFrom()); - - notification.setHistory(Collections.emptyList()); - assertTrue(notification.getHistory().size() == 0); - - notification.setMessage("message"); - assertEquals("message", notification.getMessage()); - - notification.setNotification(ControlLoopNotificationType.ACTIVE); - assertEquals(ControlLoopNotificationType.ACTIVE, notification.getNotification()); - - ZonedDateTime time = ZonedDateTime.now(ZoneOffset.UTC); - notification.setNotificationTime(time); - assertEquals(time, notification.getNotificationTime()); - - notification.setOpsClTimer(Integer.valueOf(1000)); - assertEquals(Integer.valueOf(1000), notification.getOpsClTimer()); - - notification.setPolicyName("name"); - assertEquals("name", notification.getPolicyName()); - - notification.setPolicyScope("scope"); - assertEquals("scope", notification.getPolicyScope()); - - notification.setPolicyVersion("1"); - assertEquals("1", notification.getPolicyVersion()); - - UUID id = UUID.randomUUID(); - notification.setRequestId(id); - assertEquals(id, notification.getRequestId()); - - notification.setTarget("target"); - assertEquals("target", notification.getTarget()); - - notification.setTargetType(ControlLoopTargetType.VFC); - assertEquals(ControlLoopTargetType.VFC, notification.getTargetType()); - - VirtualControlLoopEvent event = new VirtualControlLoopEvent(); - event.setClosedLoopControlName("controlloop"); - - TestControlLoopNotification notification2 = new TestControlLoopNotification(event); - assertEquals("controlloop", notification2.getClosedLoopControlName()); - - notification2.setVersion("1"); - assertEquals("1", notification2.getVersion()); - - String json = Serialization.gsonPretty.toJson(notification); - - TestControlLoopNotification notification3 = Serialization.gson.fromJson(json, - TestControlLoopNotification.class); - - // - // There is no equals for the class - chose not to create one - // - assertEquals(notification.getRequestId(), notification3.getRequestId()); - - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTypeTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTypeTest.java deleted file mode 100644 index 63103ac8f..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTypeTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import org.junit.Test; - -public class ControlLoopNotificationTypeTest { - - @Test - public void test() { - - assertEquals(ControlLoopNotificationType.ACTIVE, ControlLoopNotificationType.toType("ACTIVE")); - assertEquals(ControlLoopNotificationType.REJECTED, ControlLoopNotificationType.toType("REJECTED")); - assertEquals(ControlLoopNotificationType.OPERATION, ControlLoopNotificationType.toType("OPERATION")); - assertEquals(ControlLoopNotificationType.OPERATION_SUCCESS, - ControlLoopNotificationType.toType("OPERATION: SUCCESS")); - assertEquals(ControlLoopNotificationType.OPERATION_FAILURE, - ControlLoopNotificationType.toType("OPERATION: FAILURE")); - assertEquals(ControlLoopNotificationType.FINAL_FAILURE, - ControlLoopNotificationType.toType("FINAL: FAILURE")); - assertEquals(ControlLoopNotificationType.FINAL_SUCCESS, - ControlLoopNotificationType.toType("FINAL: SUCCESS")); - assertEquals(ControlLoopNotificationType.FINAL_OPENLOOP, - ControlLoopNotificationType.toType("FINAL: OPENLOOP")); - - assertNull(ControlLoopNotificationType.toType("foo")); - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java deleted file mode 100644 index 6c6a83e85..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.time.Instant; -import org.junit.Test; - -public class ControlLoopOperationTest { - - @Test - public void test() { - ControlLoopOperation operation = new ControlLoopOperation(); - - assertEquals(operation, operation); - assertNotEquals(operation, new String()); - assertNotEquals(operation, null); - - assertTrue(operation.hashCode() != 0); - assertTrue(operation.toString().startsWith("ControlLoopOperation")); - - assertNotNull(operation); - - operation.setActor("actor"); - assertEquals("actor", operation.getActor()); - - operation.setOperation("operation"); - assertEquals("operation", operation.getOperation()); - - Instant now = Instant.now(); - operation.setStart(now); - assertEquals(now, operation.getStart()); - operation.setEnd(now); - assertEquals(now, operation.getEnd()); - - operation.setMessage("message"); - assertEquals("message", operation.getMessage()); - - operation.setOutcome("outcome"); - assertEquals("outcome", operation.getOutcome()); - - operation.setSubRequestId("1"); - assertEquals("1", operation.getSubRequestId()); - - operation.setTarget("target"); - assertEquals("target", operation.getTarget()); - - assertTrue(operation.hashCode() != 0); - - ControlLoopOperation operation2 = new ControlLoopOperation(operation); - assertEquals(now, operation2.getEnd()); - - assertEquals(operation, operation2); - - operation2.setActor("foo"); - assertNotEquals(operation, operation2); - - operation = new ControlLoopOperation(null); - assertNotNull(operation.getStart()); - - assertNotEquals(operation, operation2); - - assertTrue(operation.toMessage().startsWith("actor=")); - assertTrue(operation.toHistory().startsWith("actor=")); - - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationWrapperTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationWrapperTest.java deleted file mode 100644 index 8d25c8eac..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationWrapperTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.UUID; -import org.junit.Test; - -public class ControlLoopOperationWrapperTest { - - @Test - public void test() { - ControlLoopOperationWrapper wrapper = new ControlLoopOperationWrapper(); - - assertNotNull(wrapper); - - ControlLoopOperation operation = new ControlLoopOperation(); - wrapper.setOperation(operation); - UUID id = UUID.randomUUID(); - wrapper.setRequestId(id); - - ControlLoopOperationWrapper wrapper2 = new ControlLoopOperationWrapper(wrapper.getRequestId(), - wrapper.getOperation()); - - assertEquals(operation, wrapper2.getOperation()); - assertEquals(id, wrapper2.getRequestId()); - - - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopResponseTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopResponseTest.java deleted file mode 100644 index 3bab0aef4..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopResponseTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2019 Wipro Limited 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.controlloop; - -import static org.junit.Assert.assertEquals; - -import java.util.UUID; -import org.junit.Test; - -public class ControlLoopResponseTest { - - @Test - public void test() { - ControlLoopResponse rsp = new ControlLoopResponse(); - - assertEquals("1.0.0", rsp.getVersion()); - - rsp = new ControlLoopResponse(null); - assertEquals("1.0.0", rsp.getVersion()); - - rsp.setClosedLoopControlName("name"); - assertEquals("name", rsp.getClosedLoopControlName()); - - rsp.setFrom("from"); - assertEquals("from", rsp.getFrom()); - - rsp.setPayload("payload"); - assertEquals("payload", rsp.getPayload()); - - rsp.setPolicyName("policyname"); - assertEquals("policyname", rsp.getPolicyName()); - - rsp.setPolicyVersion("1"); - assertEquals("1", rsp.getPolicyVersion()); - - UUID id = UUID.randomUUID(); - rsp.setRequestId(id); - assertEquals(id, rsp.getRequestId()); - - rsp.setTarget("target"); - assertEquals("target", rsp.getTarget()); - - rsp.setVersion("foo"); - assertEquals("foo", rsp.getVersion()); - - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopTargetTypeTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopTargetTypeTest.java deleted file mode 100644 index 1afd1f674..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopTargetTypeTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import org.junit.Test; - -public class ControlLoopTargetTypeTest { - - @Test - public void test() { - assertEquals(ControlLoopTargetType.VM, ControlLoopTargetType.toType("VM")); - assertEquals(ControlLoopTargetType.VF, ControlLoopTargetType.toType("VF")); - assertEquals(ControlLoopTargetType.VFC, ControlLoopTargetType.toType("VFC")); - assertEquals(ControlLoopTargetType.VNF, ControlLoopTargetType.toType("VNF")); - - assertNull(ControlLoopTargetType.toType("foo")); - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopEventTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopEventTest.java deleted file mode 100644 index b0f08e15b..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopEventTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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.controlloop; - -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class PhysicalControlLoopEventTest { - - @Test - public void test() { - PhysicalControlLoopEvent event = new PhysicalControlLoopEvent(); - assertNotNull(event); - - PhysicalControlLoopEvent event2 = new PhysicalControlLoopEvent(event); - assertNotNull(event2); - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopNotificationTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopNotificationTest.java deleted file mode 100644 index e10707bc1..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopNotificationTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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.controlloop; - -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class PhysicalControlLoopNotificationTest { - - @Test - public void test() { - PhysicalControlLoopNotification notification = new PhysicalControlLoopNotification(); - assertNotNull(notification); - - PhysicalControlLoopNotification notification2 = new PhysicalControlLoopNotification( - new PhysicalControlLoopEvent()); - assertNotNull(notification2); - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopEventTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopEventTest.java deleted file mode 100644 index 49837d191..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopEventTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.time.Instant; -import org.junit.Test; - -public class VirtualControlLoopEventTest { - - @Test - public void test() { - VirtualControlLoopEvent event = new VirtualControlLoopEvent(); - - assertNotNull(event); - assertNotNull(event.getAai()); - - Instant now = Instant.now(); - event.setClosedLoopAlarmStart(now); - event.setClosedLoopAlarmEnd(now); - - VirtualControlLoopEvent event2 = new VirtualControlLoopEvent(event); - assertEquals(now, event2.getClosedLoopAlarmStart()); - - event = new VirtualControlLoopEvent(null); - assertNull(event.getClosedLoopAlarmStart()); - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopNotificationTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopNotificationTest.java deleted file mode 100644 index 9adfebea2..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopNotificationTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.time.Instant; -import java.util.Collections; -import org.junit.Test; - -public class VirtualControlLoopNotificationTest { - - @Test - public void test() { - VirtualControlLoopNotification notification = new VirtualControlLoopNotification(); - assertNotNull(notification); - - notification.setAai(Collections.emptyMap()); - assertTrue(notification.getAai().isEmpty()); - - Instant now = Instant.now(); - notification.setClosedLoopAlarmStart(now); - - notification.setClosedLoopAlarmEnd(now); - - VirtualControlLoopEvent event = new VirtualControlLoopEvent(); - - Instant later = Instant.now(); - event.setAai(Collections.emptyMap()); - event.setClosedLoopAlarmStart(later); - event.setClosedLoopAlarmEnd(later); - - notification = new VirtualControlLoopNotification(event); - assertEquals(later, notification.getClosedLoopAlarmStart()); - assertEquals(later, notification.getClosedLoopAlarmEnd()); - - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/params/ControlLoopParamsTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/params/ControlLoopParamsTest.java deleted file mode 100644 index 065345a1a..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/params/ControlLoopParamsTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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.controlloop.params; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class ControlLoopParamsTest { - - @Test - public void test() { - ControlLoopParams params = new ControlLoopParams(); - assertNotNull(params); - - params.setClosedLoopControlName("name"); - params.setControlLoopYaml("yaml"); - params.setPolicyName("name"); - params.setPolicyScope("scope"); - params.setPolicyVersion("1"); - - ControlLoopParams params2 = new ControlLoopParams(params); - - assertTrue(params2.getClosedLoopControlName().equals("name")); - assertTrue(params2.getControlLoopYaml().equals("yaml")); - assertTrue(params2.getPolicyName().equals("name")); - assertTrue(params2.getPolicyScope().equals("scope")); - assertTrue(params2.getPolicyVersion().equals("1")); - - } -} diff --git a/controlloop/common/model-impl/pom.xml b/controlloop/common/model-impl/pom.xml deleted file mode 100644 index 4c3a5e625..000000000 --- a/controlloop/common/model-impl/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - 4.0.0 - pom - - - org.onap.policy.drools-applications.controlloop.common - common - 1.4.0-SNAPSHOT - - - org.onap.policy.drools-applications.controlloop.common.model-impl - model-impl - - - aai - appc - appclcm - sdnr - events - so - rest - sdc - trafficgenerator - vfc - sdnc - - - - diff --git a/controlloop/common/model-impl/rest/pom.xml b/controlloop/common/model-impl/rest/pom.xml deleted file mode 100644 index 43f84fe76..000000000 --- a/controlloop/common/model-impl/rest/pom.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - 4.0.0 - - - org.onap.policy.drools-applications.controlloop.common.model-impl - model-impl - 1.4.0-SNAPSHOT - - - rest - - - - junit - junit - test - - - com.google.code.gson - gson - provided - - - org.apache.httpcomponents - httpclient - provided - - - - - - - maven-checkstyle-plugin - - - onap-java-style - - check - - process-sources - - - onap-checkstyle/onap-java-style.xml - - ${project.build.sourceDirectory} - true - true - true - - - true - true - warning - - - - - - org.onap.oparent - checkstyle - ${oparent.version} - compile - - - - - - diff --git a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/HttpDeleteWithBody.java b/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/HttpDeleteWithBody.java deleted file mode 100644 index 3e52d4f10..000000000 --- a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/HttpDeleteWithBody.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * rest - * ================================================================================ - * Copyright (C) 2018 Amdocs. All rights reserved. - * Modifications Copyright (C) 2018 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.rest; - -import java.net.URI; -import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; - -/** - * Allows for HTTP DELETE requests to contain a body, which the HttpDelete - * class does not support. - */ -public class HttpDeleteWithBody extends HttpEntityEnclosingRequestBase { - public static final String METHOD_NAME = "DELETE"; - - public HttpDeleteWithBody(final String uri) { - super(); - setURI(URI.create(uri)); - } - - public HttpDeleteWithBody(final URI uri) { - super(); - setURI(uri); - } - - public HttpDeleteWithBody() { - super(); - } - - public String getMethod() { - return METHOD_NAME; - } - -} 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 deleted file mode 100644 index 84a220b9a..000000000 --- a/controlloop/common/model-impl/rest/src/main/java/org/onap/policy/rest/RestManager.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * rest - * ================================================================================ - * Copyright (C) 2017-2019 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.rest; - -import java.nio.charset.Charset; -import java.util.Map; -import java.util.Map.Entry; -import javax.xml.bind.DatatypeConverter; - -import org.apache.http.HttpHeaders; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpRequestBase; -import org.apache.http.conn.ssl.NoopHostnameVerifier; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.util.EntityUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class RestManager { - - private static final Logger logger = LoggerFactory.getLogger(RestManager.class); - - public class Pair { - public final A first; - public final B second; - - public Pair(A first, B second) { - this.first = first; - this.second = second; - } - } - - /** - * Perform REST Post. - * - * @param url the url - * @param username the user name - * @param password the password - * @param headers any headers - * @param contentType what the content type is - * @param body body to send - * @return the response status code and the body - */ - public Pair post(String url, String username, String password, - Map headers, String contentType, String body) { - HttpPost post = new HttpPost(url); - addHeaders(post, username, password, headers); - post.addHeader("Content-Type", contentType); - try { - StringEntity input = new StringEntity(body); - input.setContentType(contentType); - post.setEntity(input); - } catch (Exception e) { - logger.error("post threw: ", e); - return null; - } - return sendRequest(post); - } - - /** - * Do a REST get. - * - * @param url URL - * @param username user name - * @param password password - * @param headers any headers to add - * @return a Pair for the response status and the body - */ - public Pair get(String url, String username, String password, - Map headers) { - HttpGet get = new HttpGet(url); - addHeaders(get, username, password, headers); - return sendRequest(get); - } - - /** - * Perform REST Delete. - * - * @param url the url - * @param username the user name - * @param password the password - * @param headers any headers - * @param contentType what the content type is - * @param body body (optional) to send - * @return the response status code and the body - */ - public Pair delete(String url, String username, String password, Map headers, - String contentType, String body) { - HttpDeleteWithBody delete = new HttpDeleteWithBody(url); - addHeaders(delete, username, password, headers); - delete.addHeader("Content-Type", contentType); - if (body != null && !body.isEmpty()) { - try { - StringEntity input = new StringEntity(body); - input.setContentType(contentType); - delete.setEntity(input); - } catch (Exception e) { - logger.error("delete threw: ", e); - return null; - } - } - return sendRequest(delete); - } - - /** - * Send REST request. - * - * @param request http request to send - * @return the response status code and the body - */ - private Pair sendRequest(HttpRequestBase request) { - if (logger.isDebugEnabled()) { - logger.debug("***** sendRequest to url {}:", request.getURI()); - } - - try (CloseableHttpClient client = - HttpClientBuilder - .create() - .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) - .build()) { - HttpResponse response = client.execute(request); - if (response != null) { - String returnBody = EntityUtils.toString(response.getEntity(), "UTF-8"); - logger.debug("HTTP Response Status Code: {}", - response.getStatusLine().getStatusCode()); - logger.debug("HTTP Response Body:"); - logger.debug(returnBody); - - return new Pair<>(response.getStatusLine().getStatusCode(), - returnBody); - } else { - logger.error("Response from {} is null", request.getURI()); - return null; - } - } catch (Exception e) { - logger.error("Request failed to {}", request.getURI(), e); - return null; - } - } - - /** - * Add header to the request. - * - * @param request http request to send - * @param username the user name - * @param password the password - * @param headers any headers - */ - private void addHeaders(HttpRequestBase request, String username, String password, Map headers) { - String authHeader = makeAuthHeader(username, password); - if (headers != null) { - for (Entry entry : headers.entrySet()) { - request.addHeader(entry.getKey(), headers.get(entry.getKey())); - } - } - if (authHeader != null) { - request.setHeader(HttpHeaders.AUTHORIZATION, authHeader); - } - } - - private String makeAuthHeader(String username, String password) { - if (username == null || username.isEmpty()) { - return null; - } - - String auth = username + ":" + (password == null ? "" : password); - return "Basic " + DatatypeConverter.printBase64Binary(auth.getBytes(Charset.forName("ISO-8859-1"))); - } -} diff --git a/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/GetTest.java b/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/GetTest.java deleted file mode 100755 index 37e38ec70..000000000 --- a/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/GetTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * rest - * ================================================================================ - * Copyright (C) 2017-2019 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.rest; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; -import org.onap.policy.rest.RestManager.Pair; - -public class GetTest { - - @Test(expected = NullPointerException.class) - public void testUrlNull() { - RestManager mgr = new RestManager(); - mgr.get(null, "user", null, null); - } - - @Test - public void testUsernameNull() { - RestManager mgr = new RestManager(); - - Pair result = mgr.get("http://www.example.org", null, null, null); - assertEquals((Integer)200, result.first); - assertTrue(result.second != null); - assertTrue(result.second.length() > 0); - } - - @Test - public void testUsernameEmpty() { - RestManager mgr = new RestManager(); - - Pair result = mgr.get("http://www.example.org", "", null, null); - assertEquals((Integer)200, result.first); - assertTrue(result.second != null); - assertTrue(result.second.length() > 0); - } - - @Test - public void testUrlExampleOrg() { - RestManager mgr = new RestManager(); - - Pair result = mgr.get("http://www.example.org", "user", null, null); - assertEquals((Integer)200, result.first); - assertTrue(result.second != null); - assertTrue(result.second.length() > 0); - } -} diff --git a/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/HttpDeleteWithBodyTest.java b/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/HttpDeleteWithBodyTest.java deleted file mode 100644 index 0cb5f3aef..000000000 --- a/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/HttpDeleteWithBodyTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * rest - * ================================================================================ - * Copyright (C) 2018 Amdocs. 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.rest; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -public class HttpDeleteWithBodyTest { - - @Test - public void getMethod() { - String url = "http://www.example.org"; - HttpDeleteWithBody deleteWithBody = new HttpDeleteWithBody(url); - assertEquals("DELETE", deleteWithBody.getMethod()); - assertEquals(url, deleteWithBody.getURI().toString()); - } -} \ No newline at end of file diff --git a/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/PairTest.java b/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/PairTest.java deleted file mode 100755 index 6269e9de4..000000000 --- a/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/PairTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * rest - * ================================================================================ - * Modifications Copyright (C) 2019 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.rest; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.onap.policy.rest.RestManager.Pair; - -public class PairTest { - - @Test - public void testPair() { - RestManager mgr = new RestManager(); - - Pair pii = mgr.new Pair<>(1, 2); - assertEquals((Integer) 1, (Integer) pii.first); - assertEquals((Integer) 2, (Integer) pii.second); - - Pair pis = mgr.new Pair<>(1, "test"); - assertEquals((Integer) 1, (Integer) pis.first); - assertEquals("test", pis.second); - } -} diff --git a/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/PostTest.java b/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/PostTest.java deleted file mode 100755 index 834c29873..000000000 --- a/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/PostTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * rest - * ================================================================================ - * Copyright (C) 2017-2019 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.rest; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.onap.policy.rest.RestManager.Pair; - -public class PostTest { - - @Test - public void testUsernameNull() { - RestManager mgr = new RestManager(); - Pair result = mgr.post("http://www.example.org", null, null, null, null, null); - assertEquals(null, result); - } - - @Test - public void testUsernameEmpty() { - RestManager mgr = new RestManager(); - Pair result = mgr.post("http://www.example.org", "", null, null, null, null); - assertEquals(null, result); - } - - @Test - public void testBodyNull() { - RestManager mgr = new RestManager(); - Pair result = mgr.post("http://www.example.org", "user", null, null, null, null); - assertEquals(null, result); - } -} diff --git a/controlloop/common/model-impl/sdc/checkstyle-suppressions.xml b/controlloop/common/model-impl/sdc/checkstyle-suppressions.xml deleted file mode 100644 index fd73d24e3..000000000 --- a/controlloop/common/model-impl/sdc/checkstyle-suppressions.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - diff --git a/controlloop/common/model-impl/sdc/pom.xml b/controlloop/common/model-impl/sdc/pom.xml deleted file mode 100644 index 9c3bc0ab8..000000000 --- a/controlloop/common/model-impl/sdc/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - 4.0.0 - - - org.onap.policy.drools-applications.controlloop.common.model-impl - model-impl - 1.4.0-SNAPSHOT - - - sdc - - - - junit - junit - test - - - - - - - maven-checkstyle-plugin - - - onap-java-style - - check - - process-sources - - - onap-checkstyle/onap-java-style.xml - - ${project.build.sourceDirectory} - true - true - true - - - ${project.basedir}/checkstyle-suppressions.xml - true - true - warning - - - - - - org.onap.oparent - checkstyle - ${oparent.version} - compile - - - - - - diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java deleted file mode 100644 index a747f8fd6..000000000 --- a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java +++ /dev/null @@ -1,188 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdc - * ================================================================================ - * Copyright (C) 2017-2019 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.sdc; - -import java.io.Serializable; -import java.util.UUID; - -public class Resource implements Serializable { - - private static final long serialVersionUID = -913729158733348027L; - - private UUID resourceUuid; - private UUID resourceInvariantUuid; - private String resourceName; - private String resourceVersion; - private ResourceType resourceType; - - public Resource() { - //Empty Constructor - } - - /** - * Constructor. - * - * @param resource copy object - */ - public Resource(Resource resource) { - this.resourceUuid = resource.resourceUuid; - this.resourceInvariantUuid = resource.resourceInvariantUuid; - this.resourceName = resource.resourceName; - this.resourceVersion = resource.resourceVersion; - this.resourceType = resource.resourceType; - } - - public Resource(UUID uuid) { - this.resourceUuid = uuid; - } - - public Resource(String name, ResourceType type) { - this.resourceName = name; - this.resourceType = type; - } - - /** - * Constructor. - * - * @param uuid uuid - * @param invariantUuid invariant uuid - * @param name name - * @param version version - * @param type type - */ - public Resource(UUID uuid, UUID invariantUuid, String name, String version, ResourceType type) { - this.resourceUuid = uuid; - this.resourceInvariantUuid = invariantUuid; - this.resourceName = name; - this.resourceVersion = version; - this.resourceType = type; - } - - public UUID getResourceUuid() { - return resourceUuid; - } - - public void setResourceUuid(UUID resourceUuid) { - this.resourceUuid = resourceUuid; - } - - public UUID getResourceInvariantUuid() { - return resourceInvariantUuid; - } - - public void setResourceInvariantUuid(UUID resourceInvariantUuid) { - this.resourceInvariantUuid = resourceInvariantUuid; - } - - public String getResourceName() { - return resourceName; - } - - public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } - - public ResourceType getResourceType() { - return resourceType; - } - - public void setResourceType(ResourceType resourceType) { - this.resourceType = resourceType; - } - - @Override - public String toString() { - return "Resource [resourceUuid=" + resourceUuid + ", resourceInvariantUuid=" + resourceInvariantUuid - + ", resourceName=" + resourceName + ", resourceVersion=" + resourceVersion + ", resourceType=" - + resourceType + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((resourceInvariantUuid == null) ? 0 : resourceInvariantUuid.hashCode()); - result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode()); - result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode()); - result = prime * result + ((resourceUuid == null) ? 0 : resourceUuid.hashCode()); - result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - Resource other = (Resource) obj; - if (resourceInvariantUuid == null) { - if (other.resourceInvariantUuid != null) { - return false; - } - } else if (!resourceInvariantUuid.equals(other.resourceInvariantUuid)) { - return false; - } - if (resourceName == null) { - if (other.resourceName != null) { - return false; - } - } else if (!resourceName.equals(other.resourceName)) { - return false; - } - if (resourceType == null) { - if (other.resourceType != null) { - return false; - } - } else if (!resourceType.equals(other.resourceType)) { - return false; - } - if (resourceUuid == null) { - if (other.resourceUuid != null) { - return false; - } - } else if (!resourceUuid.equals(other.resourceUuid)) { - return false; - } - if (resourceVersion == null) { - if (other.resourceVersion != null) { - return false; - } - } else if (!resourceVersion.equals(other.resourceVersion)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java deleted file mode 100644 index dcf663e64..000000000 --- a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java +++ /dev/null @@ -1,178 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdc - * ================================================================================ - * Copyright (C) 2017-2019 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.sdc; - -import java.io.Serializable; -import java.util.UUID; - -public class ResourceInstance implements Serializable { - private static final long serialVersionUID = -5506162340393802424L; - - private String resourceInstanceName; - private String resourceName; - private UUID resourceInvariantUuid; - private String resourceVersion; - private ResourceType resourceType; - private UUID resourceUuid; - - public ResourceInstance() { - //Empty Constructor - } - - /** - * Constructor. - * - * @param instance copy object - */ - public ResourceInstance(ResourceInstance instance) { - if (instance == null) { - return; - } - this.resourceInstanceName = instance.resourceInstanceName; - this.resourceName = instance.resourceName; - this.resourceInvariantUuid = instance.resourceInvariantUuid; - this.resourceVersion = instance.resourceVersion; - this.resourceType = instance.resourceType; - this.resourceUuid = instance.resourceUuid; - } - - public String getResourceInstanceName() { - return resourceInstanceName; - } - - public void setResourceInstanceName(String resourceInstanceName) { - this.resourceInstanceName = resourceInstanceName; - } - - public String getResourceName() { - return resourceName; - } - - public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } - - public UUID getResourceInvariantUUID() { - return resourceInvariantUuid; - } - - public void setResourceInvariantUUID(UUID resourceInvariantUuid) { - this.resourceInvariantUuid = resourceInvariantUuid; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } - - public ResourceType getResourceType() { - return resourceType; - } - - public void setResourceType(ResourceType resourceType) { - this.resourceType = resourceType; - } - - public UUID getResourceUuid() { - return resourceUuid; - } - - public void setResourceUuid(UUID resourceUuid) { - this.resourceUuid = resourceUuid; - } - - @Override - public String toString() { - return "ResourceInstance [resourceInstanceName=" + resourceInstanceName + ", resourceName=" + resourceName - + ", resourceInvariantUuid=" + resourceInvariantUuid + ", resourceVersion=" + resourceVersion - + ", resourceType=" + resourceType + ", resourceUuid=" + resourceUuid + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((resourceInstanceName == null) ? 0 : resourceInstanceName.hashCode()); - result = prime * result + ((resourceInvariantUuid == null) ? 0 : resourceInvariantUuid.hashCode()); - result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode()); - result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode()); - result = prime * result + ((resourceUuid == null) ? 0 : resourceUuid.hashCode()); - result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - ResourceInstance other = (ResourceInstance) obj; - if (resourceInstanceName == null) { - if (other.resourceInstanceName != null) { - return false; - } - } else if (!resourceInstanceName.equals(other.resourceInstanceName)) { - return false; - } - if (resourceInvariantUuid == null) { - if (other.resourceInvariantUuid != null) { - return false; - } - } else if (!resourceInvariantUuid.equals(other.resourceInvariantUuid)) { - return false; - } - if (resourceName == null) { - if (other.resourceName != null) { - return false; - } - } else if (!resourceName.equals(other.resourceName)) { - return false; - } - if (resourceType != other.resourceType) { - return false; - } - if (resourceUuid == null) { - if (other.resourceUuid != null) { - return false; - } - } else if (!resourceUuid.equals(other.resourceUuid)) { - return false; - } - if (resourceVersion == null) { - if (other.resourceVersion != null) { - return false; - } - } else if (!resourceVersion.equals(other.resourceVersion)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java deleted file mode 100644 index 6202d64e0..000000000 --- a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdc - * ================================================================================ - * Copyright (C) 2017-2018 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.sdc; - -public enum ResourceType { - VF("VF"), - VFC("VFC"), - VL("VL"), - CP("CP") - ; - - private String type; - - private ResourceType(String type) { - this.type = type; - } - - @Override - public String toString() { - return this.type; - } - -} diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java deleted file mode 100644 index b3ebcc238..000000000 --- a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java +++ /dev/null @@ -1,166 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdc - * ================================================================================ - * Copyright (C) 2017-2018 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.sdc; - -import java.io.Serializable; -import java.util.UUID; - -public class Service implements Serializable { - - private static final long serialVersionUID = -1249276698549996806L; - - private UUID serviceUUID; - private UUID serviceInvariantUUID; - private String serviceName; - private String serviceVersion; - - public Service() { - //Empty Constructor - } - - public Service(UUID uuid) { - this.serviceUUID = uuid; - } - - public Service(String name) { - this.serviceName = name; - } - - /** - * Constructor. - * - * @param uuid service id - * @param invariantUUID service invariant id - * @param name name - * @param version version - */ - public Service(UUID uuid, UUID invariantUUID, String name, String version) { - this.serviceUUID = uuid; - this.serviceInvariantUUID = invariantUUID; - this.serviceName = name; - this.serviceVersion = version; - } - - /** - * Constructor. - * - * @param service copy object - */ - public Service(Service service) { - this.serviceUUID = service.serviceUUID; - this.serviceInvariantUUID = service.serviceInvariantUUID; - this.serviceName = service.serviceName; - this.serviceVersion = service.serviceVersion; - } - - public UUID getServiceUUID() { - return serviceUUID; - } - - public void setServiceUUID(UUID serviceUUID) { - this.serviceUUID = serviceUUID; - } - - public UUID getServiceInvariantUUID() { - return serviceInvariantUUID; - } - - public void setServiceInvariantUUID(UUID serviceInvariantUUID) { - this.serviceInvariantUUID = serviceInvariantUUID; - } - - public String getServiceName() { - return serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - } - - public String getServiceVersion() { - return serviceVersion; - } - - public void setServiceVersion(String serviceVersion) { - this.serviceVersion = serviceVersion; - } - - @Override - public String toString() { - return "Service [serviceUUID=" + serviceUUID + ", serviceInvariantUUID=" + serviceInvariantUUID - + ", serviceName=" + serviceName + ", serviceVersion=" + serviceVersion + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((serviceInvariantUUID == null) ? 0 : serviceInvariantUUID.hashCode()); - result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode()); - result = prime * result + ((serviceUUID == null) ? 0 : serviceUUID.hashCode()); - result = prime * result + ((serviceVersion == null) ? 0 : serviceVersion.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - Service other = (Service) obj; - if (serviceInvariantUUID == null) { - if (other.serviceInvariantUUID != null) { - return false; - } - } else if (!serviceInvariantUUID.equals(other.serviceInvariantUUID)) { - return false; - } - if (serviceName == null) { - if (other.serviceName != null) { - return false; - } - } else if (!serviceName.equals(other.serviceName)) { - return false; - } - if (serviceUUID == null) { - if (other.serviceUUID != null) { - return false; - } - } else if (!serviceUUID.equals(other.serviceUUID)) { - return false; - } - if (serviceVersion == null) { - if (other.serviceVersion != null) { - return false; - } - } else if (!serviceVersion.equals(other.serviceVersion)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java deleted file mode 100644 index a477267a3..000000000 --- a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java +++ /dev/null @@ -1,201 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdc - * ================================================================================ - * Copyright (C) 2017-2018 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.sdc; - -import java.io.Serializable; -import java.util.UUID; - -public class ServiceInstance implements Serializable { - private static final long serialVersionUID = 6285260780966679625L; - - private UUID personaModelUUID; - private UUID serviceUUID; - private UUID serviceInstanceUUID; - private UUID widgetModelUUID; - private String widgetModelVersion; - private String serviceName; - private String serviceInstanceName; - - public ServiceInstance() { - //Empty Constructor - } - - /** - * Constructor. - * - * @param instance copy object - */ - public ServiceInstance(ServiceInstance instance) { - if (instance == null) { - return; - } - this.personaModelUUID = instance.personaModelUUID; - this.serviceUUID = instance.serviceUUID; - this.serviceInstanceUUID = instance.serviceInstanceUUID; - this.widgetModelUUID = instance.widgetModelUUID; - this.widgetModelVersion = instance.widgetModelVersion; - this.serviceName = instance.serviceName; - this.serviceInstanceName = instance.serviceInstanceName; - } - - public UUID getPersonaModelUUID() { - return personaModelUUID; - } - - public void setPersonaModelUUID(UUID personaModelUUID) { - this.personaModelUUID = personaModelUUID; - } - - public UUID getServiceUUID() { - return serviceUUID; - } - - public void setServiceUUID(UUID serviceUUID) { - this.serviceUUID = serviceUUID; - } - - public UUID getServiceInstanceUUID() { - return serviceInstanceUUID; - } - - public void setServiceInstanceUUID(UUID serviceInstanceUUID) { - this.serviceInstanceUUID = serviceInstanceUUID; - } - - public UUID getWidgetModelUUID() { - return widgetModelUUID; - } - - public void setWidgetModelUUID(UUID widgetModelUUID) { - this.widgetModelUUID = widgetModelUUID; - } - - public String getWidgetModelVersion() { - return widgetModelVersion; - } - - public void setWidgetModelVersion(String widgetModelVersion) { - this.widgetModelVersion = widgetModelVersion; - } - - public String getServiceName() { - return serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - } - - public String getServiceInstanceName() { - return serviceInstanceName; - } - - public void setServiceInstanceName(String serviceInstanceName) { - this.serviceInstanceName = serviceInstanceName; - } - - @Override - public String toString() { - return "ServiceInstance [personaModelUUID=" + personaModelUUID + ", serviceUUID=" + serviceUUID - + ", serviceInstanceUUID=" + serviceInstanceUUID + ", widgetModelUUID=" + widgetModelUUID - + ", widgetModelVersion=" + widgetModelVersion + ", serviceName=" + serviceName - + ", serviceInstanceName=" + serviceInstanceName + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((personaModelUUID == null) ? 0 : personaModelUUID.hashCode()); - result = prime * result + ((serviceInstanceName == null) ? 0 : serviceInstanceName.hashCode()); - result = prime * result + ((serviceInstanceUUID == null) ? 0 : serviceInstanceUUID.hashCode()); - result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode()); - result = prime * result + ((serviceUUID == null) ? 0 : serviceUUID.hashCode()); - result = prime * result + ((widgetModelUUID == null) ? 0 : widgetModelUUID.hashCode()); - result = prime * result + ((widgetModelVersion == null) ? 0 : widgetModelVersion.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - ServiceInstance other = (ServiceInstance) obj; - if (personaModelUUID == null) { - if (other.personaModelUUID != null) { - return false; - } - } else if (!personaModelUUID.equals(other.personaModelUUID)) { - return false; - } - if (serviceInstanceName == null) { - if (other.serviceInstanceName != null) { - return false; - } - } else if (!serviceInstanceName.equals(other.serviceInstanceName)) { - return false; - } - if (serviceInstanceUUID == null) { - if (other.serviceInstanceUUID != null) { - return false; - } - } else if (!serviceInstanceUUID.equals(other.serviceInstanceUUID)) { - return false; - } - if (serviceName == null) { - if (other.serviceName != null) { - return false; - } - } else if (!serviceName.equals(other.serviceName)) { - return false; - } - if (serviceUUID == null) { - if (other.serviceUUID != null) { - return false; - } - } else if (!serviceUUID.equals(other.serviceUUID)) { - return false; - } - if (widgetModelUUID == null) { - if (other.widgetModelUUID != null) { - return false; - } - } else if (!widgetModelUUID.equals(other.widgetModelUUID)) { - return false; - } - if (widgetModelVersion == null) { - if (other.widgetModelVersion != null) { - return false; - } - } else if (!widgetModelVersion.equals(other.widgetModelVersion)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/sdc/src/main/resources/definitions.yaml b/controlloop/common/model-impl/sdc/src/main/resources/definitions.yaml deleted file mode 100644 index 55eff8a87..000000000 --- a/controlloop/common/model-impl/sdc/src/main/resources/definitions.yaml +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright 2018 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. -Service: - type: Object - properties: - serviceUUID: - type: string - pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - serviceInvariantUUID: - type: string - pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - serviceName: - type: string - serviceVersion: - type: string -Resource: - type: Object - properties: - resourceUUID: - type: string - pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - resourceInvariantUUID: - type: string - pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - resourceName: - type: string - resourceVersion: - type: string - resourceType: - type: string - valid_values: - - VF - - VFC - - CP - - VL -ServiceInstance: - type: Object - properties: - personaModelUUID: - type: string - pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - serviceUUID: - type: string - pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - serviceInstanceUUID: - type: string - pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - widgetModelUUID: - type: string - pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - widgetModelVersion: - type: string - serviceName: - type: string - serviceInstanceName: - type: string -ResourceInstance: - type: object - properties: - resourceInstanceName: - type: string - resourceName: - type: string - resourceInvariantUUID: - type: string - pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - resourceVersion: - type: string - resourceType: - type: string - valid_values: - - VF - - VFC - - CP - - VL - resourceUUID: - type: string - pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" diff --git a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java deleted file mode 100644 index 572a1186a..000000000 --- a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java +++ /dev/null @@ -1,155 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdc - * ================================================================================ - * - * ================================================================================ - * 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.sdc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.UUID; - -import org.junit.Test; - -public class ResourceInstanceTest { - - @Test - public void testConstructors() { - ResourceInstance ri = new ResourceInstance(); - assertEquals(null, ri.getResourceInstanceName()); - assertEquals(null, ri.getResourceUuid()); - assertEquals(null, ri.getResourceInvariantUUID()); - assertEquals(null, ri.getResourceName()); - assertEquals(null, ri.getResourceType()); - assertEquals(null, ri.getResourceVersion()); - - ResourceInstance ri2 = new ResourceInstance((ResourceInstance) null); - assertEquals(null, ri2.getResourceInstanceName()); - assertEquals(null, ri2.getResourceUuid()); - assertEquals(null, ri2.getResourceInvariantUUID()); - assertEquals(null, ri2.getResourceName()); - assertEquals(null, ri2.getResourceType()); - assertEquals(null, ri2.getResourceVersion()); - - ri2 = new ResourceInstance(ri); - assertEquals(ri2.getResourceInstanceName(), ri.getResourceInstanceName()); - assertEquals(ri2.getResourceUuid(), ri.getResourceUuid()); - assertEquals(ri2.getResourceInvariantUUID(), ri.getResourceInvariantUUID()); - assertEquals(ri2.getResourceName(), ri.getResourceName()); - assertEquals(ri2.getResourceType(), ri.getResourceType()); - assertEquals(ri2.getResourceVersion(), ri.getResourceVersion()); - } - - @Test - public void testInstanceName() { - ResourceInstance ri = new ResourceInstance(); - String name = "nameTestInstance"; - ri.setResourceInstanceName(name);; - assertEquals(name, ri.getResourceInstanceName()); - } - - @Test - public void testUuid() { - ResourceInstance ri = new ResourceInstance(); - UUID uuid = UUID.randomUUID(); - ri.setResourceUuid(uuid); - assertEquals(uuid, ri.getResourceUuid()); - } - - @Test - public void testInvariantUuid() { - ResourceInstance ri = new ResourceInstance(); - UUID uuid = UUID.randomUUID(); - ri.setResourceInvariantUUID(uuid); - assertEquals(uuid, ri.getResourceInvariantUUID()); - } - - @Test - public void testName() { - ResourceInstance ri = new ResourceInstance(); - String name = "nameTest"; - ri.setResourceName(name); - assertEquals(name, ri.getResourceName()); - } - - @Test - public void testVersion() { - ResourceInstance ri = new ResourceInstance(); - String version = "versionTest"; - ri.setResourceVersion(version); - assertEquals(version, ri.getResourceVersion()); - } - - @Test - public void testType() { - ResourceInstance ri = new ResourceInstance(); - ri.setResourceType(ResourceType.CP); - assertEquals(ResourceType.CP, ri.getResourceType()); - } - - @Test - public void testEquals() { - ResourceInstance ri1 = new ResourceInstance(); - ResourceInstance ri2 = new ResourceInstance(ri1); - assertTrue(ri1.equals(ri2)); - assertTrue(ri2.equals(ri1)); - - ri1.setResourceInstanceName("instance"); - ri1.setResourceName("resource"); - ri1.setResourceInvariantUUID(UUID.randomUUID()); - ri1.setResourceInvariantUUID(UUID.randomUUID()); - ri1.setResourceVersion("0.0.0"); - ri1.setResourceType(ResourceType.VL); - ri2 = new ResourceInstance(ri1); - assertTrue(ri1.equals(ri2)); - assertTrue(ri2.equals(ri1)); - } - - @Test - public void testToString() { - ResourceInstance ri1 = new ResourceInstance(); - ResourceInstance ri2 = new ResourceInstance(ri1); - assertEquals(ri1.toString(), ri2.toString()); - - ri1.setResourceInstanceName("instance"); - ri1.setResourceName("resource"); - ri1.setResourceInvariantUUID(UUID.randomUUID()); - ri1.setResourceInvariantUUID(UUID.randomUUID()); - ri1.setResourceVersion("0.0.0"); - ri1.setResourceType(ResourceType.VL); - ri2 = new ResourceInstance(ri1); - assertEquals(ri1.toString(), ri2.toString()); - } - - @Test - public void testHashCode() { - ResourceInstance ri1 = new ResourceInstance(); - ResourceInstance ri2 = new ResourceInstance(ri1); - assertEquals(ri1.hashCode(), ri2.hashCode()); - - ri1.setResourceInstanceName("instance"); - ri1.setResourceName("resource"); - ri1.setResourceInvariantUUID(UUID.randomUUID()); - ri1.setResourceInvariantUUID(UUID.randomUUID()); - ri1.setResourceVersion("0.0.0"); - ri1.setResourceType(ResourceType.VL); - ri2 = new ResourceInstance(ri1); - assertEquals(ri1.hashCode(), ri2.hashCode()); - } -} diff --git a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java deleted file mode 100644 index 0ee68a11e..000000000 --- a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceTest.java +++ /dev/null @@ -1,152 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdc - * ================================================================================ - * - * ================================================================================ - * 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.sdc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.UUID; - -import org.junit.Test; - -public class ResourceTest { - - @Test - public void testConstructors() { - Resource res = new Resource(); - assertEquals(null, res.getResourceUuid()); - assertEquals(null, res.getResourceInvariantUuid()); - assertEquals(null, res.getResourceName()); - assertEquals(null, res.getResourceType()); - assertEquals(null, res.getResourceVersion()); - - UUID uuid = UUID.randomUUID(); - res = new Resource(uuid); - assertEquals(uuid, res.getResourceUuid()); - assertEquals(null, res.getResourceInvariantUuid()); - assertEquals(null, res.getResourceName()); - assertEquals(null, res.getResourceType()); - assertEquals(null, res.getResourceVersion()); - - String name = "constTest"; - res = new Resource(name, ResourceType.CP); - assertEquals(null, res.getResourceUuid()); - assertEquals(name, res.getResourceName()); - assertEquals(ResourceType.CP, res.getResourceType()); - assertEquals(null, res.getResourceInvariantUuid()); - assertEquals(null, res.getResourceVersion()); - - uuid = UUID.randomUUID(); - UUID uuidInvariant = UUID.randomUUID(); - name = "constTestUUID"; - String version = "0.0.1"; - res = new Resource(uuid, uuidInvariant, name, version, ResourceType.VF); - assertEquals(uuid, res.getResourceUuid()); - assertEquals(uuidInvariant, res.getResourceInvariantUuid()); - assertEquals(name, res.getResourceName()); - assertEquals(ResourceType.VF, res.getResourceType()); - assertEquals(version, res.getResourceVersion()); - - Resource r2 = new Resource(res); - assertEquals(uuid, r2.getResourceUuid()); - assertEquals(uuidInvariant, r2.getResourceInvariantUuid()); - assertEquals(name, r2.getResourceName()); - assertEquals(ResourceType.VF, r2.getResourceType()); - assertEquals(version, r2.getResourceVersion()); - } - - @Test - public void testUuid() { - Resource res = new Resource(); - UUID uuid = UUID.randomUUID(); - res.setResourceUuid(uuid); - assertEquals(uuid, res.getResourceUuid()); - } - - @Test - public void testInvariantUuid() { - Resource res = new Resource(); - UUID uuid = UUID.randomUUID(); - res.setResourceInvariantUuid(uuid); - assertEquals(uuid, res.getResourceInvariantUuid()); - } - - @Test - public void testName() { - Resource res = new Resource(); - String name = "nameTest"; - res.setResourceName(name); - assertEquals(name, res.getResourceName()); - } - - @Test - public void testVersion() { - Resource res = new Resource(); - String version = "versionTest"; - res.setResourceVersion(version); - assertEquals(version, res.getResourceVersion()); - } - - @Test - public void testType() { - Resource res = new Resource(); - res.setResourceType(ResourceType.CP); - assertEquals(ResourceType.CP, res.getResourceType()); - } - - @Test - public void testEquals() { - Resource r1 = new Resource(); - Resource r2 = new Resource(r1); - assertTrue(r1.equals(r2)); - assertTrue(r2.equals(r1)); - - r1 = new Resource(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1", - ResourceType.VFC); - r2 = new Resource(r1); - assertTrue(r1.equals(r2)); - assertTrue(r2.equals(r1)); - } - - @Test - public void testToString() { - Resource r1 = new Resource(); - Resource r2 = new Resource(r1); - assertEquals(r1.toString(), r2.toString()); - - r1 = new Resource(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1", - ResourceType.VFC); - r2 = new Resource(r1); - assertEquals(r1.toString(), r2.toString()); - } - - @Test - public void testHashCode() { - Resource r1 = new Resource(); - Resource r2 = new Resource(r1); - assertEquals(r1.hashCode(), r2.hashCode()); - - r1 = new Resource(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1", - ResourceType.VFC); - r2 = new Resource(r1); - assertEquals(r1.hashCode(), r2.hashCode()); - } -} diff --git a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java deleted file mode 100644 index 14f2d3d37..000000000 --- a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java +++ /dev/null @@ -1,170 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdc - * ================================================================================ - * - * ================================================================================ - * 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.sdc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.UUID; - -import org.junit.Test; - -public class ServiceInstanceTest { - - @Test - public void testConstructors() { - ServiceInstance si = new ServiceInstance(); - assertEquals(null, si.getServiceInstanceName()); - assertEquals(null, si.getServiceUUID()); - assertEquals(null, si.getServiceInstanceUUID()); - assertEquals(null, si.getServiceName()); - assertEquals(null, si.getPersonaModelUUID()); - assertEquals(null, si.getWidgetModelUUID()); - assertEquals(null, si.getWidgetModelVersion()); - - ServiceInstance si2 = new ServiceInstance((ServiceInstance) null); - assertEquals(null, si2.getServiceInstanceName()); - assertEquals(null, si2.getServiceUUID()); - assertEquals(null, si2.getServiceInstanceUUID()); - assertEquals(null, si2.getServiceName()); - assertEquals(null, si2.getPersonaModelUUID()); - assertEquals(null, si2.getWidgetModelUUID()); - assertEquals(null, si2.getWidgetModelVersion()); - - si2 = new ServiceInstance(si); - assertEquals(si2.getServiceInstanceName(), si.getServiceInstanceName()); - assertEquals(si2.getServiceUUID(), si.getServiceUUID()); - assertEquals(si2.getServiceInstanceUUID(), si.getServiceInstanceUUID()); - assertEquals(si2.getServiceName(), si.getServiceName()); - assertEquals(si2.getPersonaModelUUID(), si.getPersonaModelUUID()); - assertEquals(si2.getWidgetModelUUID(), si.getWidgetModelUUID()); - assertEquals(si2.getWidgetModelVersion(), si.getWidgetModelVersion()); - } - - @Test - public void testInstanceName() { - ServiceInstance si = new ServiceInstance(); - String name = "nameTestInstance"; - si.setServiceInstanceName(name);; - assertEquals(name, si.getServiceInstanceName()); - } - - @Test - public void testUuid() { - ServiceInstance si = new ServiceInstance(); - UUID uuid = UUID.randomUUID(); - si.setServiceUUID(uuid); - assertEquals(uuid, si.getServiceUUID()); - } - - @Test - public void testInstanceUuid() { - ServiceInstance si = new ServiceInstance(); - UUID uuid = UUID.randomUUID(); - si.setServiceInstanceUUID(uuid); - assertEquals(uuid, si.getServiceInstanceUUID()); - } - - @Test - public void testName() { - ServiceInstance si = new ServiceInstance(); - String name = "nameTest"; - si.setServiceName(name); - assertEquals(name, si.getServiceName()); - } - - @Test - public void testPersonaModelUuid() { - ServiceInstance si = new ServiceInstance(); - UUID uuid = UUID.randomUUID(); - si.setPersonaModelUUID(uuid); - assertEquals(uuid, si.getPersonaModelUUID()); - } - - @Test - public void testWidgetModelUuid() { - ServiceInstance si = new ServiceInstance(); - UUID uuid = UUID.randomUUID(); - si.setWidgetModelUUID(uuid); - assertEquals(uuid, si.getWidgetModelUUID()); - } - - @Test - public void testWidgetModelVersion() { - ServiceInstance si = new ServiceInstance(); - String version = "2.2.2"; - si.setWidgetModelVersion(version);; - assertEquals(version, si.getWidgetModelVersion()); - } - - @Test - public void testEquals() { - ServiceInstance si1 = new ServiceInstance(); - ServiceInstance si2 = new ServiceInstance(si1); - assertTrue(si1.equals(si2)); - assertTrue(si2.equals(si1)); - - si1.setServiceInstanceName("instance"); - si1.setServiceName("service"); - si1.setServiceInstanceUUID(UUID.randomUUID()); - si1.setServiceUUID(UUID.randomUUID()); - si1.setPersonaModelUUID(UUID.randomUUID()); - si1.setWidgetModelUUID(UUID.randomUUID()); - si1.setWidgetModelVersion("3.3.3"); - si2 = new ServiceInstance(si1); - assertTrue(si1.equals(si2)); - assertTrue(si2.equals(si1)); - } - - @Test - public void testToString() { - ServiceInstance si1 = new ServiceInstance(); - ServiceInstance si2 = new ServiceInstance(si1); - assertEquals(si1.toString(), si2.toString()); - - si1.setServiceInstanceName("instance"); - si1.setServiceName("service"); - si1.setServiceInstanceUUID(UUID.randomUUID()); - si1.setServiceUUID(UUID.randomUUID()); - si1.setPersonaModelUUID(UUID.randomUUID()); - si1.setWidgetModelUUID(UUID.randomUUID()); - si1.setWidgetModelVersion("3.3.3"); - si2 = new ServiceInstance(si1); - assertEquals(si1.toString(), si2.toString()); - } - - @Test - public void testHashCode() { - ServiceInstance si1 = new ServiceInstance(); - ServiceInstance si2 = new ServiceInstance(si1); - assertEquals(si1.hashCode(), si2.hashCode()); - - si1.setServiceInstanceName("instance"); - si1.setServiceName("service"); - si1.setServiceInstanceUUID(UUID.randomUUID()); - si1.setServiceUUID(UUID.randomUUID()); - si1.setPersonaModelUUID(UUID.randomUUID()); - si1.setWidgetModelUUID(UUID.randomUUID()); - si1.setWidgetModelVersion("3.3.3"); - si2 = new ServiceInstance(si1); - assertEquals(si1.hashCode(), si2.hashCode()); - } -} diff --git a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java b/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java deleted file mode 100644 index a7d223d18..000000000 --- a/controlloop/common/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdc - * ================================================================================ - * - * ================================================================================ - * 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.sdc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.UUID; - -import org.junit.Test; - -public class ServiceTest { - - @Test - public void testConstructors() { - Service svc = new Service(); - assertEquals(null, svc.getServiceUUID()); - assertEquals(null, svc.getServiceInvariantUUID()); - assertEquals(null, svc.getServiceName()); - assertEquals(null, svc.getServiceVersion()); - - UUID uuid = UUID.randomUUID(); - svc = new Service(uuid); - assertEquals(uuid, svc.getServiceUUID()); - assertEquals(null, svc.getServiceInvariantUUID()); - assertEquals(null, svc.getServiceName()); - assertEquals(null, svc.getServiceVersion()); - - String name = "constTest"; - svc = new Service(name); - assertEquals(null, svc.getServiceUUID()); - assertEquals(name, svc.getServiceName()); - assertEquals(null, svc.getServiceInvariantUUID()); - assertEquals(null, svc.getServiceVersion()); - - uuid = UUID.randomUUID(); - UUID uuidInvariant = UUID.randomUUID(); - name = "constTestUUID"; - String version = "0.0.1"; - svc = new Service(uuid, uuidInvariant, name, version); - assertEquals(uuid, svc.getServiceUUID()); - assertEquals(uuidInvariant, svc.getServiceInvariantUUID()); - assertEquals(name, svc.getServiceName()); - assertEquals(version, svc.getServiceVersion()); - - Service s2 = new Service(svc); - assertEquals(uuid, s2.getServiceUUID()); - assertEquals(uuidInvariant, s2.getServiceInvariantUUID()); - assertEquals(name, s2.getServiceName()); - assertEquals(version, s2.getServiceVersion()); - } - - @Test - public void testUuid() { - Service svc = new Service(); - UUID uuid = UUID.randomUUID(); - svc.setServiceUUID(uuid); - assertEquals(uuid, svc.getServiceUUID()); - } - - @Test - public void testInvariantUuid() { - Service svc = new Service(); - UUID uuid = UUID.randomUUID(); - svc.setServiceInvariantUUID(uuid); - assertEquals(uuid, svc.getServiceInvariantUUID()); - } - - @Test - public void testName() { - Service svc = new Service(); - String name = "nameTest"; - svc.setServiceName(name); - assertEquals(name, svc.getServiceName()); - } - - @Test - public void testVersion() { - Service svc = new Service(); - String version = "versionTest"; - svc.setServiceVersion(version); - assertEquals(version, svc.getServiceVersion()); - } - - @Test - public void testEquals() { - Service s1 = new Service(); - Service s2 = new Service(s1); - assertTrue(s1.equals(s2)); - assertTrue(s2.equals(s1)); - - s1 = new Service(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1"); - s2 = new Service(s1); - assertTrue(s1.equals(s2)); - assertTrue(s2.equals(s1)); - } - - @Test - public void testToString() { - Service s1 = new Service(); - Service s2 = new Service(s1); - assertEquals(s1.toString(), s2.toString()); - - s1 = new Service(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1"); - s2 = new Service(s1); - assertEquals(s1.toString(), s2.toString()); - } - - @Test - public void testHashCode() { - Service s1 = new Service(); - Service s2 = new Service(s1); - assertEquals(s1.hashCode(), s2.hashCode()); - - s1 = new Service(UUID.randomUUID(), UUID.randomUUID(), "equalsTest", "1.1.1"); - s2 = new Service(s1); - assertEquals(s1.hashCode(), s2.hashCode()); - } -} diff --git a/controlloop/common/model-impl/sdc/src/test/resources/service_trinity.yaml b/controlloop/common/model-impl/sdc/src/test/resources/service_trinity.yaml deleted file mode 100644 index d28749b1a..000000000 --- a/controlloop/common/model-impl/sdc/src/test/resources/service_trinity.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2018 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. -Service: - serviceName: trinity - \ No newline at end of file diff --git a/controlloop/common/model-impl/sdc/src/test/resources/service_vSCP.yaml b/controlloop/common/model-impl/sdc/src/test/resources/service_vSCP.yaml deleted file mode 100644 index 5463c5ec8..000000000 --- a/controlloop/common/model-impl/sdc/src/test/resources/service_vSCP.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2018 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. -Service: - serviceName: vSCP \ No newline at end of file diff --git a/controlloop/common/model-impl/sdc/src/test/resources/service_vUSP.yaml b/controlloop/common/model-impl/sdc/src/test/resources/service_vUSP.yaml deleted file mode 100644 index 3ed3e78f5..000000000 --- a/controlloop/common/model-impl/sdc/src/test/resources/service_vUSP.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2018 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. -Service: - serviceName: vUSP diff --git a/controlloop/common/model-impl/sdnc/pom.xml b/controlloop/common/model-impl/sdnc/pom.xml deleted file mode 100644 index d761c67ac..000000000 --- a/controlloop/common/model-impl/sdnc/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - 4.0.0 - - - org.onap.policy.drools-applications.controlloop.common.model-impl - model-impl - 1.4.0-SNAPSHOT - - - sdnc - - - - junit - junit - test - - - org.mockito - mockito-core - 2.13.0 - test - - - com.google.code.gson - gson - provided - - - org.onap.policy.drools-applications.controlloop.common.model-impl - rest - ${project.version} - - - org.drools - drools-core - 6.5.0.Final - provided - - - org.onap.policy.common - policy-endpoints - ${version.policy.common} - provided - - - org.onap.policy.drools-pdp - policy-management - ${version.policy.drools-pdp} - provided - - - diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealNetworkInfo.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealNetworkInfo.java deleted file mode 100644 index 4039d9441..000000000 --- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealNetworkInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Huawei. 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.sdnc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SdncHealNetworkInfo implements Serializable { - - private static final long serialVersionUID = 3208673205100673119L; - - @SerializedName("network-id") - private String networkId; - - public SdncHealNetworkInfo() { - // Default constructor for SdncHealActionVmInfo - } - - public String getNetworkId() { - return networkId; - } - - public void setNetworkId(String networkId) { - this.networkId = networkId; - } -} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequest.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequest.java deleted file mode 100644 index 983084878..000000000 --- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequest.java +++ /dev/null @@ -1,98 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018-2019 Huawei Technologies Co., Ltd. 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.sdnc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SdncHealRequest implements Serializable { - - private static final long serialVersionUID = -7341931593089709247L; - - @SerializedName("sdnc-request-header") - private SdncHealRequestHeaderInfo requestHeaderInfo; - - @SerializedName("request-information") - private SdncHealRequestInfo requestInfo; - - @SerializedName("service-information") - private SdncHealServiceInfo serviceInfo; - - @SerializedName("network-information") - private SdncHealNetworkInfo networkInfo; - - @SerializedName("vnf-information") - private SdncHealVnfInfo vnfInfo; - - @SerializedName("vf-module-request-input") - private SdncHealVfModuleRequestInput vfModuleRequestInput; - - public SdncHealRequest() { - // Default constructor for SdncHealRequest - } - - public SdncHealRequestHeaderInfo getRequestHeaderInfo() { - return requestHeaderInfo; - } - - public void setRequestHeaderInfo(SdncHealRequestHeaderInfo requestHeaderInfo) { - this.requestHeaderInfo = requestHeaderInfo; - } - - public SdncHealRequestInfo getRequestInfo() { - return requestInfo; - } - - public void setRequestInfo(SdncHealRequestInfo requestInfo) { - this.requestInfo = requestInfo; - } - - public SdncHealServiceInfo getServiceInfo() { - return serviceInfo; - } - - public void setServiceInfo(SdncHealServiceInfo serviceInfo) { - this.serviceInfo = serviceInfo; - } - - public SdncHealNetworkInfo getNetworkInfo() { - return networkInfo; - } - - public void setNetworkInfo(SdncHealNetworkInfo networkInfo) { - this.networkInfo = networkInfo; - } - - public SdncHealVnfInfo getVnfInfo() { - return vnfInfo; - } - - public void setVnfInfo(SdncHealVnfInfo vnfInfo) { - this.vnfInfo = vnfInfo; - } - - public SdncHealVfModuleRequestInput getVfModuleRequestInput() { - return vfModuleRequestInput; - } - - public void setVfModuleRequestInput(SdncHealVfModuleRequestInput input) { - this.vfModuleRequestInput = input; - } -} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestHeaderInfo.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestHeaderInfo.java deleted file mode 100644 index 97426b40e..000000000 --- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestHeaderInfo.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Huawei. 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.sdnc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SdncHealRequestHeaderInfo implements Serializable { - - private static final long serialVersionUID = 3208673205100673119L; - - @SerializedName("svc-request-id") - private String svcRequestId; - - @SerializedName("svc-action") - private String svcAction; - - public SdncHealRequestHeaderInfo() { - // Default constructor for SdncHealActionVmInfo - } - - public String getSvcRequestId() { - return svcRequestId; - } - - public void setSvcRequestId(String svcRequestId) { - this.svcRequestId = svcRequestId; - } - - public String getSvcAction() { - return svcAction; - } - - public void setSvcAction(String svcAction) { - this.svcAction = svcAction; - } -} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestInfo.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestInfo.java deleted file mode 100644 index 91de4b2d2..000000000 --- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Huawei. 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.sdnc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SdncHealRequestInfo implements Serializable { - - private static final long serialVersionUID = 3208673205100673119L; - - @SerializedName("request-action") - private String requestAction; - - public SdncHealRequestInfo() { - // Default constructor for SdncHealActionVmInfo - } - - public String getRequestAction() { - return requestAction; - } - - public void setRequestAction(String requestAction) { - this.requestAction = requestAction; - } -} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealServiceInfo.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealServiceInfo.java deleted file mode 100644 index d86d32fea..000000000 --- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealServiceInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Huawei. 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.sdnc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SdncHealServiceInfo implements Serializable { - - private static final long serialVersionUID = 3208673205100673119L; - - @SerializedName("service-instance-id") - private String serviceInstanceId; - - public SdncHealServiceInfo() { - // Default constructor for SdncHealActionVmInfo - } - - public String getServiceInstanceId() { - return serviceInstanceId; - } - - public void setServiceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } -} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleParameter.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleParameter.java deleted file mode 100644 index 0ad772301..000000000 --- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleParameter.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.sdnc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SdncHealVfModuleParameter implements Serializable { - - private static final long serialVersionUID = 3208673205100673119L; - - @SerializedName("name") - private String name; - - @SerializedName("value") - private String value; - - public SdncHealVfModuleParameter() { - // Default constructor for SdncHealVfModuleParameter - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } -} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleParametersInfo.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleParametersInfo.java deleted file mode 100644 index 0463c6a5a..000000000 --- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleParametersInfo.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.sdnc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; - -public class SdncHealVfModuleParametersInfo implements Serializable { - - private static final long serialVersionUID = 3208673205100673119L; - - @SerializedName("param") - private List parameters; - - public SdncHealVfModuleParametersInfo() { - // Default constructor for SdncHealVfModuleParametersInfo - parameters = new LinkedList<>(); - } - - public List getParameters() { - return parameters; - } - - public void setParameters(List parameters) { - this.parameters = parameters; - } - - public void addParameters(SdncHealVfModuleParameter parameter) { - parameters.add(parameter); - } -} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleRequestInput.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleRequestInput.java deleted file mode 100644 index 98cfc7ee7..000000000 --- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVfModuleRequestInput.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.sdnc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SdncHealVfModuleRequestInput implements Serializable { - - private static final long serialVersionUID = 3208673205100673119L; - - @SerializedName("vf-module-input-parameters") - private SdncHealVfModuleParametersInfo vfModuleParametersInfo; - - public SdncHealVfModuleRequestInput() { - // Default constructor for SdncHealVfModuleRequestInput - } - - public SdncHealVfModuleParametersInfo getVfModuleParametersInfo() { - return vfModuleParametersInfo; - } - - public void setVfModuleParametersInfo(SdncHealVfModuleParametersInfo info) { - this.vfModuleParametersInfo = info; - } -} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVnfInfo.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVnfInfo.java deleted file mode 100644 index 16a6203ec..000000000 --- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealVnfInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.sdnc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SdncHealVnfInfo implements Serializable { - - private static final long serialVersionUID = 3208673205100673119L; - - @SerializedName("vnf-id") - private String vnfId; - - public SdncHealVnfInfo() { - // Default constructor for SdncHealVnfInfo - } - - public String getVnfId() { - return vnfId; - } - - public void setVnfId(String vnfId) { - this.vnfId = vnfId; - } -} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java deleted file mode 100644 index c5ce6b295..000000000 --- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * Copyright (C) 2018-2019 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd. - * ================================================================================ - * 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.sdnc; - - -import com.google.gson.JsonSyntaxException; - -import java.util.HashMap; -import java.util.Map; - -import org.drools.core.WorkingMemory; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; -import org.onap.policy.drools.system.PolicyEngine; -import org.onap.policy.rest.RestManager; -import org.onap.policy.rest.RestManager.Pair; -import org.onap.policy.sdnc.util.Serialization; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public final class SdncManager implements Runnable { - - private String sdncUrlBase; - private String username; - private String password; - private SdncRequest sdncRequest; - private WorkingMemory workingMem; - private static final Logger logger = LoggerFactory.getLogger(SdncManager.class); - - // The REST manager used for processing REST calls for this Sdnc manager - private RestManager restManager; - - /** - * Constructor. - * - * @param wm Drools working memory - * @param request request - */ - public SdncManager(WorkingMemory wm, SdncRequest request) { - if (wm == null || request == null) { - throw new IllegalArgumentException( - "the parameters \"wm\" and \"request\" on the SdncManager constructor may not be null" - ); - } - workingMem = wm; - sdncRequest = request; - - restManager = new RestManager(); - - setSdncParams(getPeManagerEnvProperty("sdnc.url"), getPeManagerEnvProperty("sdnc.username"), - getPeManagerEnvProperty("sdnc.password")); - } - - /** - * Set the parameters. - * - * @param baseUrl base URL - * @param name username - * @param pwd password - */ - public void setSdncParams(String baseUrl, String name, String pwd) { - sdncUrlBase = baseUrl; - username = name; - password = pwd; - } - - @Override - public void run() { - Map headers = new HashMap<>(); - Pair httpDetails; - - SdncResponse responseError = new SdncResponse(); - SdncResponseOutput responseOutput = new SdncResponseOutput(); - responseOutput.setResponseCode("404"); - responseError.setResponseOutput(responseOutput); - - headers.put("Accept", "application/json"); - String sdncUrl = sdncUrlBase + sdncRequest.getUrl(); - - try { - String sdncRequestJson = Serialization.gsonPretty.toJson(sdncRequest); - NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, sdncUrl, sdncRequestJson); - logger.info("[OUT|{}|{}|]{}{}", CommInfrastructure.REST, sdncUrl, NetLoggerUtil.SYSTEM_LS, sdncRequestJson); - - httpDetails = restManager.post(sdncUrl, username, password, headers, "application/json", - sdncRequestJson); - } catch (Exception e) { - logger.info(e.getMessage(), e); - workingMem.insert(responseError); - return; - } - - if (httpDetails == null) { - workingMem.insert(responseError); - return; - } - - try { - SdncResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, SdncResponse.class); - NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, sdncUrl, httpDetails.second); - logger.info("[IN|{}|{}|]{}{}", "Sdnc", sdncUrl, NetLoggerUtil.SYSTEM_LS, httpDetails.second); - String body = Serialization.gsonPretty.toJson(response); - logger.info("Response to Sdnc Heal post:"); - logger.info(body); - response.setRequestId(sdncRequest.getRequestId().toString()); - - if (!response.getResponseOutput().getResponseCode().equals("200")) { - logger.info( - "Sdnc Heal Restcall failed with http error code {} {}", httpDetails.first, httpDetails.second - ); - } - - workingMem.insert(response); - } catch (JsonSyntaxException e) { - logger.info("Failed to deserialize into SdncResponse {}", e.getLocalizedMessage(), e); - } catch (Exception e) { - logger.info("Unknown error deserializing into SdncResponse {}", e.getLocalizedMessage(), e); - } - } - - /** - * Protected setter for rest manager to allow mocked rest manager to be used for testing. - * @param restManager the test REST manager - */ - protected void setRestManager(final RestManager restManager) { - this.restManager = restManager; - } - - /** - * This method reads and validates environmental properties coming from the policy engine. Null properties cause - * an {@link IllegalArgumentException} runtime exception to be thrown - * @param enginePropertyName name of the parameter to retrieve - * @return the property value - */ - - private String getPeManagerEnvProperty(String enginePropertyName) { - String enginePropertyValue = PolicyEngine.manager.getEnvironmentProperty(enginePropertyName); - if (enginePropertyValue == null) { - throw new IllegalArgumentException( - "The value of policy engine manager environment property \"" - + enginePropertyName + "\" may not be null" - ); - } - return enginePropertyValue; - } -} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncRequest.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncRequest.java deleted file mode 100644 index 7590c0da4..000000000 --- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncRequest.java +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018-2019 Huawei Technologies Co., Ltd. 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.sdnc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.UUID; - -public class SdncRequest implements Serializable { - - private static final long serialVersionUID = 3736300970326332512L; - // These fields are not serialized and not part of JSON - private transient String nsInstanceId; - private transient UUID requestId; - private transient String url; - - @SerializedName("input") - private SdncHealRequest healRequest; - - public SdncRequest() { - // Default constructor for SdncRequest - } - - public String getNsInstanceId() { - return nsInstanceId; - } - - public void setNsInstanceId(String nsInstanceId) { - this.nsInstanceId = nsInstanceId; - } - - public UUID getRequestId() { - return requestId; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public SdncHealRequest getHealRequest() { - return healRequest; - } - - public void setHealRequest(SdncHealRequest healRequest) { - this.healRequest = healRequest; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } -} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponse.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponse.java deleted file mode 100644 index c0f244413..000000000 --- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponse.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Huawei. 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.sdnc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SdncResponse implements Serializable { - - private static final long serialVersionUID = 9151443891238218455L; - - @SerializedName("output") - private SdncResponseOutput responseOutput; - - private transient String requestId; - - public SdncResponse() { - // Default constructor for SdncResponse - } - - public String getRequestId() { - return requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public SdncResponseOutput getResponseOutput() { - return responseOutput; - } - - public void setResponseOutput(SdncResponseOutput responseOutput) { - this.responseOutput = responseOutput; - } - -} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseNetworkInfo.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseNetworkInfo.java deleted file mode 100644 index 75582ff45..000000000 --- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseNetworkInfo.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Huawei. 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.sdnc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SdncResponseNetworkInfo implements Serializable { - - private static final long serialVersionUID = 6827782899144150158L; - - @SerializedName("instance-id") - private String instanceId; - - @SerializedName("object-path") - private String objectPath; - - public SdncResponseNetworkInfo() { - // Default constructor for SdncResponseNetworkInfo - } - - public String getInstanceId() { - return instanceId; - } - - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - - public String getObjectPath() { - return objectPath; - } - - public void setObjectPath(String objectPath) { - this.objectPath = objectPath; - } -} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseOutput.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseOutput.java deleted file mode 100644 index 48acc5e9a..000000000 --- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseOutput.java +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Huawei. 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.sdnc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.List; - -public class SdncResponseOutput implements Serializable { - - private static final long serialVersionUID = 6827782899144150158L; - - @SerializedName("svc-request-id") - private String svcRequestId; - - @SerializedName("response-code") - private String responseCode; - - @SerializedName("ack-final-indicator") - private String ackFinalIndicator; - - public SdncResponseOutput() { - // Default constructor for SdncResponseDescriptor - } - - public String getSvcRequestId() { - return svcRequestId; - } - - public void setSvcRequestId(String svcRequestId) { - this.svcRequestId = svcRequestId; - } - - public String getResponseCode() { - return responseCode; - } - - public void setResponseCode(String responseCode) { - this.responseCode = responseCode; - } - - public String getAckFinalIndicator() { - return ackFinalIndicator; - } - - public void setAckFinalIndicator(String ackFinalIndicator) { - this.ackFinalIndicator = ackFinalIndicator; - } - -} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseServiceInfo.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseServiceInfo.java deleted file mode 100644 index 745ba2475..000000000 --- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseServiceInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Huawei. 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.sdnc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SdncResponseServiceInfo implements Serializable { - - private static final long serialVersionUID = 6827782899144150158L; - - @SerializedName("instance-id") - private String instanceId; - - public SdncResponseServiceInfo() { - // Default constructor for SdncResponseServiceInfo - } - - public String getInstanceId() { - return instanceId; - } - - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - -} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/util/Serialization.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/util/Serialization.java deleted file mode 100644 index 260407af2..000000000 --- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/util/Serialization.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Huawei Corp. 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.sdnc.util; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -public final class Serialization { - private Serialization() { - } - - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping() - .setPrettyPrinting() - .create(); - -} diff --git a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/DemoTest.java b/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/DemoTest.java deleted file mode 100644 index 843f24dd1..000000000 --- a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/DemoTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Huawei. 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.sdnc; - -import java.util.LinkedList; - -import org.junit.Test; -import org.onap.policy.sdnc.util.Serialization; - -public class DemoTest { - - @Test - public void test() { - SdncRequest request = new SdncRequest(); - - request.setNsInstanceId("100"); - request.setHealRequest(new SdncHealRequest()); - - request.getHealRequest().setRequestHeaderInfo(new SdncHealRequestHeaderInfo()); - request.getHealRequest().getRequestHeaderInfo().setSvcRequestId("service-req-01"); - request.getHealRequest().getRequestHeaderInfo().setSvcAction("servive-action"); - - request.getHealRequest().setRequestInfo(new SdncHealRequestInfo()); - request.getHealRequest().getRequestInfo().setRequestAction("request-action"); - - request.getHealRequest().setServiceInfo(new SdncHealServiceInfo()); - request.getHealRequest().getServiceInfo().setServiceInstanceId("service-instance-01"); - - request.getHealRequest().setNetworkInfo(new SdncHealNetworkInfo()); - request.getHealRequest().getNetworkInfo().setNetworkId("network-5555"); - - - String body = Serialization.gsonPretty.toJson(request); - System.out.println(body); - - SdncResponse response = new SdncResponse(); - - body = Serialization.gsonPretty.toJson(response); - System.out.println(body); - - response.setRequestId("request-01"); - response.setResponseOutput(new SdncResponseOutput()); - response.getResponseOutput().setSvcRequestId("service-req-01"); - response.getResponseOutput().setResponseCode("200"); - response.getResponseOutput().setAckFinalIndicator("final-indicator-00"); - - body = Serialization.gsonPretty.toJson(response); - System.out.println(body); - - response = Serialization.gsonPretty.fromJson(body, SdncResponse.class); - body = Serialization.gsonPretty.toJson(response); - System.out.println(body); - - } -} diff --git a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealAdditionalParamsTest.java b/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealAdditionalParamsTest.java deleted file mode 100644 index 0403dd0a5..000000000 --- a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealAdditionalParamsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * vfc - * ================================================================================ - * Copyright (C) 2018 Huawei. 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.sdnc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class SdncHealAdditionalParamsTest { - - @Test - public void testSdncHealAdditionalParameters() { - SdncHealRequestHeaderInfo additionalParams = new SdncHealRequestHeaderInfo(); - assertNotNull(additionalParams); - assertNotEquals(0, additionalParams.hashCode()); - - String action = "Go Home"; - additionalParams.setSvcAction(action); - assertEquals(action, additionalParams.getSvcAction()); - - String requestId = "My Request"; - additionalParams.setSvcRequestId(requestId); - assertEquals(requestId, additionalParams.getSvcRequestId()); - - assertNotEquals(0, additionalParams.hashCode()); - } -} diff --git a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealRequestTest.java b/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealRequestTest.java deleted file mode 100644 index 705d3573f..000000000 --- a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealRequestTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * vfc - * ================================================================================ - * Copyright (C) 2018 Huawei. 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.sdnc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class SdncHealRequestTest { - - @Test - public void testSdncHealRequest() { - SdncHealRequest request = new SdncHealRequest(); - assertNotNull(request); - assertNotEquals(0, request.hashCode()); - - SdncHealRequestInfo requestInfo = new SdncHealRequestInfo(); - request.setRequestInfo(requestInfo); - assertEquals(requestInfo, request.getRequestInfo()); - - assertNotEquals(0, request.hashCode()); - } -} diff --git a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealServiceInfoTest.java b/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealServiceInfoTest.java deleted file mode 100644 index 17791a1d9..000000000 --- a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealServiceInfoTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnc - * ================================================================================ - * Copyright (C) 2018 Huawei. 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.sdnc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class SdncHealServiceInfoTest { - - @Test - public void testSdncHealServiceInfo() { - SdncHealServiceInfo serviceInfo = new SdncHealServiceInfo(); - assertNotNull(serviceInfo); - assertNotEquals(0, serviceInfo.hashCode()); - - String svrid = "ECity"; - serviceInfo.setServiceInstanceId(svrid); - assertEquals(svrid, serviceInfo.getServiceInstanceId()); - - assertNotEquals(0, serviceInfo.hashCode()); - } -} diff --git a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncManagerTest.java b/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncManagerTest.java deleted file mode 100644 index 2431fc715..000000000 --- a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncManagerTest.java +++ /dev/null @@ -1,283 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnc - * ================================================================================ - * Copyright (C) 2018 Huawei. All rights reserved. - * ================================================================================ - * Modifications Copyright (C) 2019 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.sdnc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.endsWith; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.startsWith; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import org.drools.core.WorkingMemory; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.drools.system.PolicyEngine; -import org.onap.policy.rest.RestManager; -import org.onap.policy.rest.RestManager.Pair; -import org.onap.policy.sdnc.util.Serialization; - -public class SdncManagerTest { - private static WorkingMemory mockedWorkingMemory; - - private RestManager mockedRestManager; - - private Pair httpResponsePutOk; - private Pair httpResponseGetOk; - private Pair httpResponseBadResponse; - private Pair httpResponseErr; - - private SdncRequest request; - private SdncResponse response; - - @BeforeClass - public static void beforeTestSdncManager() { - mockedWorkingMemory = mock(WorkingMemory.class); - } - - /** - * Set up the mocked REST manager. - */ - @Before - public void setupMockedRest() { - mockedRestManager = mock(RestManager.class); - - httpResponsePutOk = mockedRestManager.new Pair<>(202, Serialization.gsonPretty.toJson(response)); - httpResponseGetOk = mockedRestManager.new Pair<>(200, Serialization.gsonPretty.toJson(response)); - httpResponseBadResponse = mockedRestManager.new Pair<>(202, Serialization.gsonPretty.toJson(null)); - httpResponseErr = mockedRestManager.new Pair<>(200, null); - } - - /** - * Create the request and response before. - */ - @Before - public void createRequestAndResponse() { - SdncHealServiceInfo serviceInfo = new SdncHealServiceInfo(); - serviceInfo.setServiceInstanceId("E-City"); - - SdncHealRequestHeaderInfo additionalParams = new SdncHealRequestHeaderInfo(); - additionalParams.setSvcAction("Go Home"); - additionalParams.setSvcRequestId("My Request"); - - SdncHealRequest healRequest = new SdncHealRequest(); - healRequest.setRequestHeaderInfo(additionalParams); - healRequest.setServiceInfo(serviceInfo); - - UUID requestId = UUID.randomUUID(); - request = new SdncRequest(); - request.setRequestId(requestId); - request.setHealRequest(healRequest); - request.setNsInstanceId("Dorothy"); - - SdncResponseOutput responseDescriptor = new SdncResponseOutput(); - responseDescriptor.setSvcRequestId("1234"); - responseDescriptor.setResponseCode("200"); - responseDescriptor.setAckFinalIndicator("final-indicator-00"); - - response = new SdncResponse(); - response.setRequestId(request.getRequestId().toString()); - response.setResponseOutput(responseDescriptor); - } - - /** - * After Test clean up. - */ - @After - public void afterTestSdncManager() throws InterruptedException { - PolicyEngine.manager.getEnvironment().remove("sdnc.password"); - PolicyEngine.manager.getEnvironment().remove("sdnc.username"); - PolicyEngine.manager.getEnvironment().remove("sdnc.url"); - } - - @Test - public void testSdncInitiation() throws InterruptedException { - try { - new SdncManager(null, null); - fail("test should throw an exception here"); - } - catch (IllegalArgumentException e) { - assertEquals( - "the parameters \"wm\" and \"request\" on the SdncManager constructor may not be null", - e.getMessage() - ); - } - - try { - new SdncManager(mockedWorkingMemory, null); - fail("test should throw an exception here"); - } - catch (IllegalArgumentException e) { - assertEquals( - "the parameters \"wm\" and \"request\" on the SdncManager constructor may not be null", - e.getMessage() - ); - } - - try { - new SdncManager(mockedWorkingMemory, request); - fail("test should throw an exception here"); - } - catch (IllegalArgumentException e) { - assertEquals( - "The value of policy engine manager environment property \"sdnc.url\" may not be null", - e.getMessage() - ); - } - - PolicyEngine.manager.getEnvironment().put("sdnc.url", "http://somewhere.over.the.rainbow"); - try { - new SdncManager(mockedWorkingMemory, request); - fail("test should throw an exception here"); - } - catch (IllegalArgumentException e) { - assertEquals( - "The value of policy engine manager environment property \"sdnc.username\" may not be null", - e.getMessage() - ); - } - - PolicyEngine.manager.getEnvironment().put("sdnc.username", "Dorothy"); - try { - new SdncManager(mockedWorkingMemory, request); - fail("test should throw an exception here"); - } - catch (IllegalArgumentException e) { - assertEquals( - "The value of policy engine manager environment property \"sdnc.password\" may not be null", - e.getMessage() - ); - } - - PolicyEngine.manager.getEnvironment().put("sdnc.password", "Toto"); - new SdncManager(mockedWorkingMemory, request); - } - - @Test - public void testSdncExecutionException() throws InterruptedException { - PolicyEngine.manager.getEnvironment().put("sdnc.url", "http://somewhere.over.the.rainbow"); - PolicyEngine.manager.getEnvironment().put("sdnc.username", "Dorothy"); - PolicyEngine.manager.getEnvironment().put("sdnc.password", "Exception"); - - SdncManager manager = new SdncManager(mockedWorkingMemory, request); - manager.setRestManager(mockedRestManager); - - Thread managerThread = new Thread(manager); - managerThread.start(); - - when(mockedRestManager.post(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Exception"), anyMap(), anyString(), anyString())) - .thenThrow(new RuntimeException("OzException")); - - - managerThread.join(100); - } - - @Test - public void testSdncExecutionNull() throws InterruptedException { - PolicyEngine.manager.getEnvironment().put("sdnc.url", "http://somewhere.over.the.rainbow"); - PolicyEngine.manager.getEnvironment().put("sdnc.username", "Dorothy"); - PolicyEngine.manager.getEnvironment().put("sdnc.password", "Null"); - - SdncManager manager = new SdncManager(mockedWorkingMemory, request); - manager.setRestManager(mockedRestManager); - - Thread managerThread = new Thread(manager); - managerThread.start(); - - when(mockedRestManager.post(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Null"), anyMap(), anyString(), anyString())) - .thenReturn(null); - - managerThread.join(100); - } - - - @Test - public void testSdncExecutionError0() throws InterruptedException { - PolicyEngine.manager.getEnvironment().put("sdnc.url", "http://somewhere.over.the.rainbow"); - PolicyEngine.manager.getEnvironment().put("sdnc.username", "Dorothy"); - PolicyEngine.manager.getEnvironment().put("sdnc.password", "Error0"); - - SdncManager manager = new SdncManager(mockedWorkingMemory, request); - manager.setRestManager(mockedRestManager); - - Thread managerThread = new Thread(manager); - managerThread.start(); - - when(mockedRestManager.post(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Error0"), anyMap(), anyString(), anyString())) - .thenReturn(httpResponseErr); - - managerThread.join(100); - } - - @Test - public void testSdncExecutionBadResponse() throws InterruptedException { - PolicyEngine.manager.getEnvironment().put("sdnc.url", "http://somewhere.over.the.rainbow"); - PolicyEngine.manager.getEnvironment().put("sdnc.username", "Dorothy"); - PolicyEngine.manager.getEnvironment().put("sdnc.password", "BadResponse"); - - SdncManager manager = new SdncManager(mockedWorkingMemory, request); - manager.setRestManager(mockedRestManager); - - Thread managerThread = new Thread(manager); - managerThread.start(); - - when(mockedRestManager.post(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("OK"), anyMap(), anyString(), anyString())) - .thenReturn(httpResponseBadResponse); - - managerThread.join(100); - } - - @Test - public void testSdncExecutionOk() throws InterruptedException { - PolicyEngine.manager.getEnvironment().put("sdnc.url", "http://somewhere.over.the.rainbow"); - PolicyEngine.manager.getEnvironment().put("sdnc.username", "Dorothy"); - PolicyEngine.manager.getEnvironment().put("sdnc.password", "OK"); - - SdncManager manager = new SdncManager(mockedWorkingMemory, request); - manager.setRestManager(mockedRestManager); - - Thread managerThread = new Thread(manager); - managerThread.start(); - - when(mockedRestManager.post(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("OK"), anyMap(), anyString(), anyString())) - .thenReturn(httpResponsePutOk); - - when(mockedRestManager.get(endsWith("1234"), eq("Dorothy"), eq("OK"), anyMap())) - .thenReturn(httpResponseGetOk); - - - managerThread.join(100); - } -} diff --git a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncRequestTest.java b/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncRequestTest.java deleted file mode 100644 index 0c8a44898..000000000 --- a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncRequestTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnc - * ================================================================================ - * Copyright (C) 2018 Huawei. 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.sdnc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.UUID; - -import org.junit.Test; - -public class SdncRequestTest { - - @Test - public void testSdncRequest() { - SdncRequest request = new SdncRequest(); - assertNotNull(request); - assertNotEquals(0, request.hashCode()); - - String nsInstanceId = "Dorothy"; - request.setNsInstanceId(nsInstanceId); - assertEquals(nsInstanceId, request.getNsInstanceId()); - - UUID requestId = UUID.randomUUID(); - request.setRequestId(requestId); - assertEquals(requestId, request.getRequestId()); - - SdncHealRequest healRequest = new SdncHealRequest(); - request.setHealRequest(healRequest); - assertEquals(healRequest, request.getHealRequest()); - - assertNotEquals(0, request.hashCode()); - } -} diff --git a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncResponseDescriptorTest.java b/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncResponseDescriptorTest.java deleted file mode 100644 index 5fdf2b3e2..000000000 --- a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncResponseDescriptorTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnc - * ================================================================================ - * Copyright (C) 2018 Huawei. 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.sdnc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; - -public class SdncResponseDescriptorTest { - - @Test - public void testSdncResponseDescriptor() { - SdncResponseOutput output = new SdncResponseOutput(); - assertNotNull(output); - assertNotEquals(0, output.hashCode()); - - String responseCode = "200"; - output.setResponseCode(responseCode); - assertEquals(responseCode, output.getResponseCode()); - - String svcRequest = "svc-request-01"; - output.setSvcRequestId(svcRequest); - assertEquals(svcRequest, output.getSvcRequestId()); - - String indicator = "final-indicator-00"; - output.setAckFinalIndicator(indicator); - assertEquals(indicator, output.getAckFinalIndicator()); - - assertNotEquals(0, output.hashCode()); - } -} diff --git a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncResponseTest.java b/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncResponseTest.java deleted file mode 100644 index aa879f04e..000000000 --- a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncResponseTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnc - * ================================================================================ - * Copyright (C) 2018 Huawei. 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.sdnc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - - -import org.junit.Test; - -public class SdncResponseTest { - - @Test - public void testSdncResponse() { - SdncResponse response = new SdncResponse(); - assertNotNull(response); - assertNotEquals(0, response.hashCode()); - - String requestId = "Get Home"; - response.setRequestId(requestId); - assertEquals(requestId, response.getRequestId()); - - SdncResponseOutput responseDescriptor = new SdncResponseOutput(); - response.setResponseOutput(responseDescriptor); - assertEquals(responseDescriptor, response.getResponseOutput()); - - assertNotEquals(0, response.hashCode()); - } -} diff --git a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/util/SerializationTest.java b/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/util/SerializationTest.java deleted file mode 100644 index 9b3ab7856..000000000 --- a/controlloop/common/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/util/SerializationTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * vfc - * ================================================================================ - * Copyright (C) 2018 Huawei. 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.sdnc.util; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class SerializationTest { - - @Test - public void test() { - assertNotNull(Serialization.gsonPretty); - } -} diff --git a/controlloop/common/model-impl/sdnr/pom.xml b/controlloop/common/model-impl/sdnr/pom.xml deleted file mode 100644 index 6515e5186..000000000 --- a/controlloop/common/model-impl/sdnr/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - 4.0.0 - - - org.onap.policy.drools-applications.controlloop.common.model-impl - model-impl - 1.4.0-SNAPSHOT - - - sdnr - - - - junit - junit - test - - - com.google.code.gson - gson - provided - - - diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java deleted file mode 100644 index d9e59ad3b..000000000 --- a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java +++ /dev/null @@ -1,264 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited 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.sdnr; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -public class PciCommonHeader implements Serializable { - - private static final long serialVersionUID = 5435363539127062114L; - - @SerializedName(value = "TimeStamp") - private Instant timeStamp = Instant.now(); - - @SerializedName(value = "APIVer") - private String apiVer = "1.0"; - - @SerializedName(value = "RequestID") - private UUID requestId; - - @SerializedName(value = "SubRequestID") - private String subRequestId; - - @SerializedName(value = "RequestTrack") - private Map requestTrack = new HashMap<>(); - - @SerializedName(value = "Flags") - private Map flags = new HashMap<>(); - - public PciCommonHeader() { - - } - - /** - * Used to copy a pci common header. - * - * @param commonHeader a header that is defined by the Pci api guide that contains information - * about the request (requestId, flags, etc.) - */ - public PciCommonHeader(PciCommonHeader commonHeader) { - this.timeStamp = commonHeader.timeStamp; - this.requestId = commonHeader.requestId; - this.subRequestId = commonHeader.subRequestId; - if (commonHeader.requestTrack != null) { - this.requestTrack.putAll(commonHeader.requestTrack); - } - if (commonHeader.flags != null) { - this.flags.putAll(commonHeader.flags); - } - } - - /** - * Get the timestamp. - * - * @return the timeStamp - */ - public Instant getTimeStamp() { - return timeStamp; - } - - /** - * Set the timestamp. - * - * @param timeStamp - * the timeStamp to set - */ - public void setTimeStamp(Instant timeStamp) { - this.timeStamp = timeStamp; - } - - /** - * Get the API version. - * - * @return the apiVer - */ - public String getApiVer() { - return apiVer; - } - - /** - * Set the API version. - * - * @param apiVer - * the apiVer to set - */ - public void setApiVer(String apiVer) { - this.apiVer = apiVer; - } - - /** - * Get the request Id. - * - * @return the requestId - */ - public UUID getRequestId() { - return requestId; - } - - /** - * Set the request Id. - * - * @param requestId - * the requestId to set - */ - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - /** - * Get the sub request Id. - * - * @return the subRequestId - */ - public String getSubRequestId() { - return subRequestId; - } - - /** - * Set the sub request Id. - * - * @param subRequestId - * the subRequestId to set - */ - public void setSubRequestId(String subRequestId) { - this.subRequestId = subRequestId; - } - /** - * Set the request track. - * - * @param requestTrack - * the requestTrack to set - */ - public void setRequestTrack(Map requestTrack) { - this.requestTrack = requestTrack; - } - /** - * Get the request track. - * - * @return the requestTrack - */ - public Map getRequestTrack() { - return requestTrack; - } - - /** - * Get the flags. - * - * @return the flags - */ - public Map getFlags() { - return flags; - } - - /** - * Set the flags. - * - * @param flags - * the flags to set - */ - public void setFlags(Map flags) { - this.flags = flags; - } - - @Override - public String toString() { - return "CommonHeader [timeStamp=" + timeStamp + ", apiVer=" + apiVer - + ", requestId=" + requestId + ", subRequestId=" + subRequestId + ", requestTrack=" + requestTrack - + ", flags=" + flags + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((apiVer == null) ? 0 : apiVer.hashCode()); - result = prime * result + ((flags == null) ? 0 : flags.hashCode()); - result = prime * result + ((requestTrack == null) ? 0 : requestTrack.hashCode()); - result = prime * result + ((requestId == null) ? 0 : requestId.hashCode()); - result = prime * result + ((subRequestId == null) ? 0 : subRequestId.hashCode()); - result = prime * result + ((timeStamp == null) ? 0 : timeStamp.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - PciCommonHeader other = (PciCommonHeader) obj; - if (apiVer == null) { - if (other.apiVer != null) { - return false; - } - } else if (!apiVer.equals(other.apiVer)) { - return false; - } - if (flags == null) { - if (other.flags != null) { - return false; - } - } else if (!flags.equals(other.flags)) { - return false; - } - if (requestTrack == null) { - if (other.requestTrack != null) { - return false; - } - } else if (!requestTrack.equals(other.requestTrack)) { - return false; - } - if (requestId == null) { - if (other.requestId != null) { - return false; - } - } else if (!requestId.equals(other.requestId)) { - return false; - } - if (subRequestId == null) { - if (other.subRequestId != null) { - return false; - } - } else if (!subRequestId.equals(other.subRequestId)) { - return false; - } - if (timeStamp == null) { - if (other.timeStamp != null) { - return false; - } - } else if (!timeStamp.equals(other.timeStamp)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java deleted file mode 100644 index 5155f0b5c..000000000 --- a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java +++ /dev/null @@ -1,143 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited 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.sdnr; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class PciRequest implements Serializable { - - private static final long serialVersionUID = 323235565922846624L; - - @SerializedName(value = "CommonHeader") - private PciCommonHeader commonHeader; - - @SerializedName(value = "Action") - private String action; - - @SerializedName(value = "Payload") - private String payload; - - public PciRequest() { - // Create a default PCI request - } - - public PciCommonHeader getCommonHeader() { - return commonHeader; - } - - public void setCommonHeader(PciCommonHeader commonHeader) { - this.commonHeader = commonHeader; - } - - /** - * Get the action. - * - * @return the action - */ - public String getAction() { - return action; - } - - /** - * Set the action. - * - * @param action - * the action to set - */ - public void setAction(String action) { - this.action = action; - } - - /** - * Get the payload. - * - * @return the payload - */ - - public String getPayload() { - return payload; - } - - /** - * Set the payload. - * - * @param action - * the action to set - */ - - public void setPayload(String payload) { - this.payload = payload; - } - - @Override - public String toString() { - return "PciRequest[commonHeader=" + commonHeader + ", action=" + action + ", payload=" + payload + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((commonHeader == null) ? 0 : commonHeader.hashCode()); - result = prime * result + ((action == null) ? 0 : action.hashCode()); - result = prime * result + ((payload == null) ? 0 : payload.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - PciRequest other = (PciRequest) obj; - if (commonHeader == null) { - if (other.commonHeader != null) { - return false; - } - } else if (!commonHeader.equals(other.commonHeader)) { - return false; - } - if (action == null) { - if (other.action != null) { - return false; - } - } else if (!action.equals(other.action)) { - return false; - } - if (payload == null) { - if (other.payload != null) { - return false; - } - } else if (!payload.equals(other.payload)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequestWrapper.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequestWrapper.java deleted file mode 100644 index 5a84009c0..000000000 --- a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequestWrapper.java +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited 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.sdnr; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class PciRequestWrapper extends PciWrapper implements Serializable { - - private static final long serialVersionUID = 879766924715980798L; - - @SerializedName(value = "body") - private PciRequest body; - - public PciRequestWrapper() { - super(); - } - - public PciRequestWrapper(PciRequest request) { - body = request; - } - - /** - * Get the body. - * - * @return the body - */ - public PciRequest getBody() { - return body; - } - - /** - * Set the body. - * - * @param body - * the body to set - */ - public void setBody(PciRequest body) { - this.body = body; - } - - @Override - public String toString() { - return "RequestWrapper [body=" + body + ", toString()=" + super.toString() + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((body == null) ? 0 : body.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!super.equals(obj)) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - PciRequestWrapper other = (PciRequestWrapper) obj; - if (body == null) { - if (other.body != null) { - return false; - } - } else if (!body.equals(other.body)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponse.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponse.java deleted file mode 100644 index 21750e1bd..000000000 --- a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponse.java +++ /dev/null @@ -1,159 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited 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.sdnr; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class PciResponse implements Serializable { - - private static final long serialVersionUID = 8375708697287669750L; - - @SerializedName(value = "CommonHeader") - private PciCommonHeader commonHeader; - - @SerializedName(value = "Status") - private Status status = new Status(); - - @SerializedName(value = "Payload") - private String payload; - - public PciResponse() { - // EMPTY - } - - /** - * Constructs a response using the common header of the request since they will - * be the same. - * - * @param request - * an sdnr Pci request object specified by the Pci api guide - */ - public PciResponse(PciRequest request) { - this.commonHeader = new PciCommonHeader(request.getCommonHeader()); - - } - - /** - * Get the common header. - * - * @return the commonHeader - */ - public PciCommonHeader getCommonHeader() { - return commonHeader; - } - - /** - * Set the common header. - * - * @param commonHeader - * the commonHeader to set - */ - public void setCommonHeader(PciCommonHeader commonHeader) { - this.commonHeader = commonHeader; - } - - /** - * Get the status. - * - * @return the status - */ - public Status getStatus() { - return status; - } - - /** - * Set the status. - * - * @param status - * the status to set - */ - public void setStatus(Status status) { - this.status = status; - } - - /** - * Get the payload. - * - * @return the payload - */ - - public String getPayload() { - return payload; - } - - public void setPayload(String payload) { - this.payload = payload; - } - - @Override - public String toString() { - return "PciResponse[CommonHeader=" + commonHeader + ", Status=" + status + ", Payload=" - + payload + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((commonHeader == null) ? 0 : commonHeader.hashCode()); - result = prime * result + ((payload == null) ? 0 : payload.hashCode()); - result = prime * result + ((status == null) ? 0 : status.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - PciResponse other = (PciResponse) obj; - if (commonHeader == null) { - if (other.commonHeader != null) { - return false; - } - } else if (!commonHeader.equals(other.commonHeader)) { - return false; - } - if (payload == null) { - if (other.payload != null) { - return false; - } - } else if (!payload.equals(other.payload)) { - return false; - } - if (status == null) { - if (other.status != null) { - return false; - } - } else if (!status.equals(other.status)) { - return false; - } - return true; - } -} diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseCode.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseCode.java deleted file mode 100644 index 430adcb92..000000000 --- a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseCode.java +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd. 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.sdnr; - -import java.io.Serializable; -import org.onap.policy.sdnr.util.StatusCodeEnum; - -public class PciResponseCode implements Serializable { - - /* These fields define the key to the response code value. */ - public static final String ACCEPTED = "ACCEPTED"; - public static final String ERROR = "ERROR"; - public static final String REJECT = "REJECT"; - public static final String SUCCESS = "SUCCESS"; - public static final String FAILURE = "FAILURE"; - public static final String PARTIAL_SUCCESS = "PARTIAL SUCCESS"; - public static final String PARTIAL_FAILURE = "PARTIAL FAILURE"; - private static final long serialVersionUID = -5371924429933449763L; - - private final Integer code; - - protected PciResponseCode(final int code) { - this.code = code; - } - - public int getCode() { - return this.code; - } - - @Override - public String toString() { - return Integer.toString(this.code); - } - - /** - * Translates the code to a string value that represents the meaning of the code. - * - * @param code the numeric value that is returned by SDNR based on success, failure, etc. of the action requested - * @return the string value equivalent of the SDNR response code - */ - public static String toResponseValue(int code) { - StatusCodeEnum statusCodeEnum = StatusCodeEnum.fromStatusCode(code); - return (statusCodeEnum != null) ? statusCodeEnum.toString() : null; - } -} diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseWrapper.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseWrapper.java deleted file mode 100644 index 696d08623..000000000 --- a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseWrapper.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited 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.sdnr; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class PciResponseWrapper extends PciWrapper implements Serializable { - - private static final long serialVersionUID = 109837814781086802L; - - @SerializedName(value = "body") - private PciResponse body; - - public PciResponseWrapper() { - super(); - } - - /** - * Get the body. - * - * @return the body - */ - public PciResponse getBody() { - return body; - } - - /** - * Set the body. - * - * @param body - * the body to set - */ - public void setBody(PciResponse body) { - this.body = body; - } - - @Override - public String toString() { - return "ResponseWrapper [body=" + body + ", toString()=" + super.toString() + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((body == null) ? 0 : body.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!super.equals(obj)) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - PciResponseWrapper other = (PciResponseWrapper) obj; - if (body == null) { - if (other.body != null) { - return false; - } - } else if (!body.equals(other.body)) { - return false; - } - return true; - } -} diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciWrapper.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciWrapper.java deleted file mode 100644 index 456c57877..000000000 --- a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciWrapper.java +++ /dev/null @@ -1,213 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited 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.sdnr; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class PciWrapper implements Serializable { - - private static final long serialVersionUID = 375215806432396532L; - - @SerializedName(value = "version") - private String version; - - @SerializedName(value = "cambria-partition") - private String cambriaPartition; - - @SerializedName(value = "rpc-name") - private String rpcName; - - @SerializedName(value = "correlation-id") - private String correlationId; - - @SerializedName(value = "type") - private String type; - - public PciWrapper() { - // Create a default PciWrapper instance - } - - /** - * Get the version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Set the version. - * - * @param version - * the version to set - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * Get the cambria partition. - * - * @return the cambriaPartition - */ - public String getCambriaPartition() { - return cambriaPartition; - } - - /** - * Set the cambria partition. - * - * @param cambriaPartition - * the cambriaPartition to set - */ - public void setCambriaPartition(String cambriaPartition) { - this.cambriaPartition = cambriaPartition; - } - - /** - * Get the RPN name. - * - * @return the rpcName - */ - public String getRpcName() { - return rpcName; - } - - /** - * Set the RPC name. - * - * @param rpcName - * the rpcName to set - */ - public void setRpcName(String rpcName) { - this.rpcName = rpcName; - } - - /** - * Get the correlation Id. - * - * @return the correlationId - */ - public String getCorrelationId() { - return correlationId; - } - - /** - * Set the correclation Id. - * - * @param correlationId - * the correlationId to set - */ - public void setCorrelationId(String correlationId) { - this.correlationId = correlationId; - } - - /** - * Get the type. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Set the type. - * - * @param type - * the type to set - */ - public void setType(String type) { - this.type = type; - } - - @Override - public String toString() { - return "Wrapper [version=" + version + ", cambriaPartition=" + cambriaPartition + ", rpcName=" + rpcName - + ", correlationId=" + correlationId + ", type=" + type + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((cambriaPartition == null) ? 0 : cambriaPartition.hashCode()); - result = prime * result + ((correlationId == null) ? 0 : correlationId.hashCode()); - result = prime * result + ((rpcName == null) ? 0 : rpcName.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - result = prime * result + ((version == null) ? 0 : version.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - PciWrapper other = (PciWrapper) obj; - if (cambriaPartition == null) { - if (other.cambriaPartition != null) { - return false; - } - } else if (!cambriaPartition.equals(other.cambriaPartition)) { - return false; - } - if (correlationId == null) { - if (other.correlationId != null) { - return false; - } - } else if (!correlationId.equals(other.correlationId)) { - return false; - } - if (rpcName == null) { - if (other.rpcName != null) { - return false; - } - } else if (!rpcName.equals(other.rpcName)) { - return false; - } - if (type == null) { - if (other.type != null) { - return false; - } - } else if (!type.equals(other.type)) { - return false; - } - if (version == null) { - if (other.version != null) { - return false; - } - } else if (!version.equals(other.version)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/Status.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/Status.java deleted file mode 100644 index dc0295ae1..000000000 --- a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/Status.java +++ /dev/null @@ -1,106 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited 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.sdnr; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class Status implements Serializable { - - private static final long serialVersionUID = 877641506135467199L; - - @SerializedName(value = "Code") - private int code; - - @SerializedName(value = "Value") - private String value; - - public Status() { - // Create a default PciResponseStatus instance - } - - /** - * Constructor for the class Status. - * - */ - public Status(int code, String value) { - super(); - this.code = code; - this.value = value; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - @Override - public String toString() { - return "Status [code = " + code + ", value = " + value + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + code; - result = prime * result + ((value == null) ? 0 : value.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - Status other = (Status) obj; - if (code != other.code) { - return false; - } - if (value == null) { - if (other.value != null) { - return false; - } - } else if (!value.equals(other.value)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java deleted file mode 100644 index 3a116d741..000000000 --- a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java +++ /dev/null @@ -1,115 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2018 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.sdnr.util; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - -import java.lang.reflect.Type; -import java.time.Instant; - -import org.onap.policy.sdnr.PciRequest; -import org.onap.policy.sdnr.PciResponse; - - -public final class Serialization { - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(Instant.class, new InstantAdapter()).create(); - - public static final Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(PciRequest.class, new RequestAdapter()) - .registerTypeAdapter(PciResponse.class, new ResponseAdapter()).create(); - - public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(Instant.class, new InstantJunitAdapter()).create(); - - private Serialization() {} - - public static class RequestAdapter implements JsonSerializer, JsonDeserializer { - - @Override - public JsonElement serialize(PciRequest src, Type typeOfSrc, JsonSerializationContext context) { - JsonElement requestJson = gsonPretty.toJsonTree(src, PciRequest.class); - JsonObject input = new JsonObject(); - input.add("input", requestJson); - - return input; - } - - @Override - public PciRequest deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return gsonPretty.fromJson(json.getAsJsonObject().get("input"), PciRequest.class); - } - } - - public static class ResponseAdapter implements JsonSerializer, JsonDeserializer { - - @Override - public JsonElement serialize(PciResponse src, Type typeOfSrc, JsonSerializationContext context) { - JsonElement responseJson = gsonPretty.toJsonTree(src, PciResponse.class); - JsonObject output = new JsonObject(); - output.add("output", responseJson); - return output; - } - - @Override - public PciResponse deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return gsonPretty.fromJson(json.getAsJsonObject().get("output"), PciResponse.class); - } - } - - public static class InstantAdapter implements JsonSerializer, JsonDeserializer { - - @Override - public Instant deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return Instant.parse(json.getAsString()); - } - - @Override - public JsonElement serialize(Instant src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src.toString()); - } - - } - - public static class InstantJunitAdapter implements JsonSerializer, JsonDeserializer { - - @Override - public Instant deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return Instant.ofEpochMilli(json.getAsLong()); - } - - @Override - public JsonElement serialize(Instant src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src.toEpochMilli()); - } - - } - -} diff --git a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/StatusCodeEnum.java b/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/StatusCodeEnum.java deleted file mode 100644 index 8830545da..000000000 --- a/controlloop/common/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/StatusCodeEnum.java +++ /dev/null @@ -1,90 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Samsung Electronics Co., Ltd. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.sdnr.util; - -import java.util.HashMap; -import java.util.Map; - -public enum StatusCodeEnum { - ACCEPTED("ACCEPTED"), ERROR("ERROR"), REJECT("REJECT"), SUCCESS("SUCCESS"), FAILURE("FAILURE"), - PARTIAL_SUCCESS("PARTIAL SUCCESS"), PARTIAL_FAILURE("PARTIAL FAILURE"); - - private String name; - - StatusCodeEnum(final String name) { - this.name = name; - } - - public String toString() { - return this.name; - } - - /** - * Determine status enum from the code. - * - * @param statusCode integer code indicating the status - * @return enum representation of status code - */ - public static StatusCodeEnum fromStatusCode(final int statusCode) { - if (statusCode == 100) { - return ACCEPTED; - } - - if (statusCode == 200) { - return SUCCESS; - } - - if (isRejectStatusCode(statusCode)) { - return REJECT; - } - - if (statusCode == 400) { - return ERROR; - } - - if (isFailureStatusCode(statusCode)) { - return FAILURE; - } - - if (statusCode == 500) { - return PARTIAL_SUCCESS; - } - - if (isPartialFailureStatusCode(statusCode)) { - return PARTIAL_FAILURE; - } - - return null; - } - - private static boolean isRejectStatusCode(final int statusCode) { - return statusCode >= 300 && statusCode <= 313; - } - - private static boolean isFailureStatusCode(final int statusCode) { - return statusCode == 450 || (statusCode >= 401 && statusCode <= 406); - } - - private static boolean isPartialFailureStatusCode(final int statusCode) { - return statusCode >= 501 && statusCode <= 599; - } - -} diff --git a/controlloop/common/model-impl/sdnr/src/main/resources/definitions.yaml b/controlloop/common/model-impl/sdnr/src/main/resources/definitions.yaml deleted file mode 100644 index 19c91e50d..000000000 --- a/controlloop/common/model-impl/sdnr/src/main/resources/definitions.yaml +++ /dev/null @@ -1,119 +0,0 @@ -### -# ============LICENSE_START======================================================= -# sdnr -# ================================================================================ -# Copyright (C) 2018 Wipro Limited 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========================================================= -### - -Request: - type: object - properties: - CommonHeader: - type: object - properties: - TimeStamp: - type: string - APIver: - type: string - value: '1.01' - OriginatorID: - type: string - RequestID: - type: string - pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - SubRequestID: - type: string - Flags: - type: object - required: - - TimeStamp - - APIver - - OriginatorID - - RequestID - Action: - type: string - enum: - - Audit - - ActionStatus - - BlockAudits - - Configure - - HealthCheck - - Install - - LiveUpgrade - - Migrate - - ModifyConfig - - ModifyConfigANR - - Query - - Rebuild - - Reconfigure - - Restart - - Rollback - - Scale - - Start - - Stop - - Sync - - Terminate - - Test - - Upgrade - TargetID: - type: string - ObjectID: - type: string - Payload: - type: object - required: - - CommonHeader - - Action - - TargetID -Response: - type: object - properties: - CommonHeader: - type: object - properties: - TimeStamp: - type: string - APIver: - type: string - OriginatorID: - type: string - RequestID: - type: string - SubRequestID: - type: string - Flags: - type: object - required: - - TimeStamp - - APIver - - OriginatorID - - RequestID - Status: - type: object - properties: - Code: - type: integer - Value: - type: string - required: - - Code - - Value - Payload: - type: object - required: - - CommonHeader - - Status - diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java deleted file mode 100644 index 4b3201440..000000000 --- a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited 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.sdnr; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.junit.Test; - -public class PciCommonHeaderTest { - - @Test - public void testPciCommonHeader() { - PciCommonHeader commonHeader = new PciCommonHeader(); - assertNotNull(commonHeader); - assertNotNull(new PciCommonHeader(commonHeader)); - assertNotEquals(0, commonHeader.hashCode()); - - commonHeader.setApiVer("Kansas"); - assertEquals("Kansas", commonHeader.getApiVer()); - - Map flagMap = new HashMap<>(); - commonHeader.setFlags(flagMap); - assertEquals(flagMap, commonHeader.getFlags()); - - Map requestMap = new HashMap<>(); - commonHeader.setRequestTrack(requestMap); - assertEquals(requestMap, commonHeader.getRequestTrack()); - - UUID requestId = UUID.randomUUID(); - commonHeader.setRequestId(requestId); - assertEquals(requestId, commonHeader.getRequestId()); - - commonHeader.setSubRequestId("Can I go home?"); - assertEquals("Can I go home?", commonHeader.getSubRequestId()); - - Instant timestamp = Instant.now(); - commonHeader.setTimeStamp(timestamp); - assertEquals(timestamp, commonHeader.getTimeStamp()); - - assertNotEquals(0, commonHeader.hashCode()); - - assertEquals("CommonHeader [timeStamp=", commonHeader.toString().substring(0, 24)); - - PciCommonHeader copiedPciCommonHeader = new PciCommonHeader(); - copiedPciCommonHeader.setApiVer(commonHeader.getApiVer()); - copiedPciCommonHeader.setFlags(commonHeader.getFlags()); - copiedPciCommonHeader.setRequestId(commonHeader.getRequestId()); - copiedPciCommonHeader.setSubRequestId(commonHeader.getSubRequestId()); - copiedPciCommonHeader.setTimeStamp(commonHeader.getTimeStamp()); - - assertTrue(commonHeader.equals(commonHeader)); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); - assertFalse(commonHeader.equals(null)); - assertFalse(commonHeader.equals("Hello")); - - PciCommonHeader clonedPciCommonHeader = new PciCommonHeader(commonHeader); - clonedPciCommonHeader.setApiVer(commonHeader.getApiVer()); - clonedPciCommonHeader.setTimeStamp(commonHeader.getTimeStamp()); - - assertTrue(commonHeader.equals(clonedPciCommonHeader)); - - commonHeader.setApiVer(null); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); - copiedPciCommonHeader.setApiVer(null); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); - commonHeader.setApiVer("Kansas"); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); - copiedPciCommonHeader.setApiVer("Kansas"); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); - - commonHeader.setFlags(null); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); - copiedPciCommonHeader.setFlags(null); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); - commonHeader.setFlags(flagMap); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); - copiedPciCommonHeader.setFlags(flagMap); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); - - commonHeader.setRequestTrack(null); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); - copiedPciCommonHeader.setRequestTrack(null); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); - commonHeader.setRequestTrack(requestMap); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); - copiedPciCommonHeader.setRequestTrack(requestMap); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); - - - commonHeader.setRequestId(null); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); - copiedPciCommonHeader.setRequestId(null); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); - commonHeader.setRequestId(requestId); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); - copiedPciCommonHeader.setRequestId(requestId); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); - - commonHeader.setSubRequestId(null); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); - copiedPciCommonHeader.setSubRequestId(null); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); - commonHeader.setSubRequestId("Can I go home?"); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); - copiedPciCommonHeader.setSubRequestId("Can I go home?"); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); - - commonHeader.setTimeStamp(null); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); - copiedPciCommonHeader.setTimeStamp(null); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); - commonHeader.setTimeStamp(timestamp); - assertFalse(commonHeader.equals(copiedPciCommonHeader)); - copiedPciCommonHeader.setTimeStamp(timestamp); - assertTrue(commonHeader.equals(copiedPciCommonHeader)); - } -} diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java deleted file mode 100644 index 64d976710..000000000 --- a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited 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.sdnr; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class PciRequestTest { - - @Test - public void testPciRequest() { - PciRequest request = new PciRequest(); - assertNotNull(request); - assertNotEquals(0, request.hashCode()); - - PciCommonHeader commonHeader = new PciCommonHeader(); - String requestPayload = ""; - - request.setCommonHeader(commonHeader); - assertEquals(commonHeader, request.getCommonHeader()); - - request.setPayload(requestPayload); - assertEquals(requestPayload, request.getPayload()); - - request.setAction("Modify"); - assertEquals("Modify", request.getAction()); - - assertNotEquals(0, request.hashCode()); - - assertEquals("PciRequest[commonHeader=CommonHeader [timeStamp=", request.toString().substring(0, 48)); - - PciRequest copiedPciRequest = new PciRequest(); - copiedPciRequest.setCommonHeader(request.getCommonHeader()); - copiedPciRequest.setAction(request.getAction()); - copiedPciRequest.setPayload(request.getPayload()); - - assertTrue(request.equals(request)); - assertTrue(request.equals(copiedPciRequest)); - assertFalse(request.equals(null)); - assertFalse(request.equals("Hello")); - - request.setCommonHeader(null); - assertFalse(request.equals(copiedPciRequest)); - copiedPciRequest.setCommonHeader(null); - assertTrue(request.equals(copiedPciRequest)); - request.setCommonHeader(commonHeader); - assertFalse(request.equals(copiedPciRequest)); - copiedPciRequest.setCommonHeader(commonHeader); - assertTrue(request.equals(copiedPciRequest)); - - request.setAction(null); - assertFalse(request.equals(copiedPciRequest)); - copiedPciRequest.setAction(null); - assertTrue(request.equals(copiedPciRequest)); - request.setAction("Modify"); - assertFalse(request.equals(copiedPciRequest)); - copiedPciRequest.setAction("Modify"); - assertTrue(request.equals(copiedPciRequest)); - - request.setPayload(null); - assertFalse(request.equals(copiedPciRequest)); - copiedPciRequest.setPayload(null); - assertTrue(request.equals(copiedPciRequest)); - request.setPayload(requestPayload); - assertFalse(request.equals(copiedPciRequest)); - copiedPciRequest.setPayload(requestPayload); - assertTrue(request.equals(copiedPciRequest)); - } -} diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java deleted file mode 100644 index 79f3c0d6f..000000000 --- a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited 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.sdnr; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class PciRequestWrapperTest { - - @Test - public void testPciRequestWrapperWrapper() { - assertNotNull(new PciRequestWrapper(new PciRequest())); - PciRequestWrapper requestWrapper = new PciRequestWrapper(); - assertNotNull(requestWrapper); - assertNotEquals(0, requestWrapper.hashCode()); - - PciRequest request = new PciRequest(); - - requestWrapper.setBody(request); - assertEquals(request, requestWrapper.getBody()); - - assertNotEquals(0, requestWrapper.hashCode()); - - assertEquals("RequestWrapper [body=PciRequest[commonHeader=nul", requestWrapper.toString().substring(0, 48)); - - PciRequestWrapper copiedPciRequestWrapper = new PciRequestWrapper(); - copiedPciRequestWrapper.setBody(requestWrapper.getBody()); - - assertTrue(requestWrapper.equals(requestWrapper)); - assertTrue(requestWrapper.equals(copiedPciRequestWrapper)); - assertFalse(requestWrapper.equals(null)); - assertFalse(requestWrapper.equals("Hello")); - - requestWrapper.setBody(null); - assertFalse(requestWrapper.equals(copiedPciRequestWrapper)); - copiedPciRequestWrapper.setBody(null); - assertTrue(requestWrapper.equals(copiedPciRequestWrapper)); - requestWrapper.setBody(request); - assertFalse(requestWrapper.equals(copiedPciRequestWrapper)); - copiedPciRequestWrapper.setBody(request); - assertTrue(requestWrapper.equals(copiedPciRequestWrapper)); - } -} diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseCodeTest.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseCodeTest.java deleted file mode 100644 index 355713133..000000000 --- a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseCodeTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited 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.sdnr; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import org.junit.Test; - -public class PciResponseCodeTest { - - @Test - public void testPciResponseCode() { - assertNull(PciResponseCode.toResponseValue(0)); - - assertEquals(PciResponseCode.ACCEPTED, PciResponseCode.toResponseValue(100)); - assertEquals(PciResponseCode.SUCCESS, PciResponseCode.toResponseValue(200)); - assertEquals(PciResponseCode.REJECT, PciResponseCode.toResponseValue(300)); - assertEquals(PciResponseCode.ERROR, PciResponseCode.toResponseValue(400)); - assertEquals(PciResponseCode.FAILURE, PciResponseCode.toResponseValue(450)); - assertEquals(PciResponseCode.FAILURE, PciResponseCode.toResponseValue(401)); - assertEquals(PciResponseCode.FAILURE, PciResponseCode.toResponseValue(406)); - assertEquals(PciResponseCode.PARTIAL_SUCCESS, PciResponseCode.toResponseValue(500)); - assertEquals(PciResponseCode.PARTIAL_FAILURE, PciResponseCode.toResponseValue(501)); - assertEquals(PciResponseCode.PARTIAL_FAILURE, PciResponseCode.toResponseValue(599)); - - assertEquals("100", new PciResponseCode(100).toString()); - assertEquals("200", new PciResponseCode(200).toString()); - assertEquals("300", new PciResponseCode(300).toString()); - assertEquals("400", new PciResponseCode(400).toString()); - assertEquals("450", new PciResponseCode(450).toString()); - assertEquals("500", new PciResponseCode(500).toString()); - assertEquals("510", new PciResponseCode(510).toString()); - - assertEquals(300, new PciResponseCode(300).getCode()); - } -} diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java deleted file mode 100644 index 52137ef7d..000000000 --- a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited 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.sdnr; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class PciResponseTest { - - Status status = new Status(0, ""); - - String responsePayload = ""; - String requestPayload = ""; - - - @Test - public void testHashCode() { - PciResponse response = new PciResponse(); - assertTrue(response.hashCode() != 0); - response.setCommonHeader(new PciCommonHeader()); - assertTrue(response.hashCode() != 0); - response.setPayload(responsePayload); - assertTrue(response.hashCode() != 0); - response.setStatus(null); - assertTrue(response.hashCode() != 0); - } - - @Test - public void testPciResponse() { - PciResponse response = new PciResponse(); - assertNull(response.getCommonHeader()); - assertNull(response.getPayload()); - assertNotNull(response.getStatus()); - } - - @Test - public void testToString() { - PciResponse response = new PciResponse(); - assertFalse(response.toString().isEmpty()); - } - - @Test - public void testEqualsObject() { - PciResponse response = new PciResponse(); - assertTrue(response.equals(response)); - assertFalse(response.equals(null)); - assertFalse(response.equals(new Object())); - - PciResponse response2 = new PciResponse(); - assertTrue(response.equals(response2)); - - response.setCommonHeader(new PciCommonHeader()); - assertFalse(response.equals(response2)); - response2.setCommonHeader(response.getCommonHeader()); - assertTrue(response.equals(response2)); - - response.setPayload(responsePayload); - assertFalse(response.equals(response2)); - response2.setPayload(response.getPayload()); - assertTrue(response.equals(response2)); - - response.setCommonHeader(null); - assertFalse(response.equals(response2)); - response2.setCommonHeader(null); - assertTrue(response.equals(response2)); - - response.setPayload(null); - assertFalse(response.equals(response2)); - response2.setPayload(response.getPayload()); - assertTrue(response.equals(response2)); - - response.setStatus(null); - assertFalse(response.equals(response2)); - response2.setStatus(response.getStatus()); - assertTrue(response.equals(response2)); - - Status status = new Status(); - status.setCode(5); - response.setStatus(status); - response2.setStatus(new Status()); - assertFalse(response.equals(response2)); - } - - @Test - public void testResponseRequest() { - PciRequest request = new PciRequest(); - request.setCommonHeader(new PciCommonHeader()); - request.setPayload(requestPayload); - - PciResponse response = new PciResponse(request); - - assertTrue(response.getCommonHeader().equals(request.getCommonHeader())); - } - -} diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java deleted file mode 100644 index 16f6f59e9..000000000 --- a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited 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.sdnr; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class PciResponseWrapperTest { - - @Test - public void testPciResponseWrapperWrapper() { - - PciResponseWrapper responseWrapper = new PciResponseWrapper(); - assertNotNull(responseWrapper); - assertNotEquals(0, responseWrapper.hashCode()); - - PciResponse response = new PciResponse(); - - responseWrapper.setBody(response); - assertEquals(response, responseWrapper.getBody()); - - assertNotEquals(0, responseWrapper.hashCode()); - - assertNotEquals("ResponseWrapper [body=Response [commonHeader=n", responseWrapper.toString().substring(0, 46)); - - PciResponseWrapper copiedPciResponseWrapper = new PciResponseWrapper(); - copiedPciResponseWrapper.setBody(responseWrapper.getBody()); - - assertTrue(responseWrapper.equals(responseWrapper)); - //assertTrue(responseWrapper.equals(copiedPciResponseWrapper)); - assertFalse(responseWrapper.equals(null)); - assertFalse(responseWrapper.equals("Hello")); - - responseWrapper.setBody(null); - assertFalse(responseWrapper.equals(copiedPciResponseWrapper)); - copiedPciResponseWrapper.setBody(null); - //assertTrue(responseWrapper.equals(copiedPciResponseWrapper)); - responseWrapper.setBody(response); - //assertFalse(responseWrapper.equals(copiedPciResponseWrapper)); - copiedPciResponseWrapper.setBody(response); - //assertTrue(responseWrapper.equals(copiedPciResponseWrapper)); - } -} diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java deleted file mode 100644 index b38eed3e3..000000000 --- a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited 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.sdnr; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class PciStatusTest { - - @Test - public void testResponseStatus() { - Status status = new Status(); - assertNotNull(status); - assertNotEquals(0, status.hashCode()); - - status.setCode(1234); - assertEquals(1234, status.getCode()); - - status.setValue("The wonderful land of Oz"); - assertEquals("The wonderful land of Oz", status.getValue()); - - assertEquals("Status [code = 1234, value = The wonderfu", status.toString().substring(0, 41)); - - Status copiedStatus = new Status(); - copiedStatus.setCode(status.getCode()); - copiedStatus.setValue(status.getValue()); - - assertTrue(status.equals(status)); - assertTrue(status.equals(copiedStatus)); - assertFalse(status.equals(null)); - assertFalse(status.equals("Hello")); - - status.setCode(-1); - assertFalse(status.equals(copiedStatus)); - copiedStatus.setCode(-1); - assertTrue(status.equals(copiedStatus)); - status.setCode(1234); - assertFalse(status.equals(copiedStatus)); - copiedStatus.setCode(1234); - assertTrue(status.equals(copiedStatus)); - - status.setValue(null); - assertFalse(status.equals(copiedStatus)); - copiedStatus.setValue(null); - assertTrue(status.equals(copiedStatus)); - status.setValue("The wonderful land of Oz"); - assertFalse(status.equals(copiedStatus)); - copiedStatus.setValue("The wonderful land of Oz"); - assertTrue(status.equals(copiedStatus)); - } -} diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java deleted file mode 100644 index a9501dddc..000000000 --- a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java +++ /dev/null @@ -1,115 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited 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.sdnr; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class PciWrapperTest { - - @Test - public void testPciWrapper() { - PciWrapper wrapper = new PciWrapper(); - assertNotNull(wrapper); - assertNotEquals(0, wrapper.hashCode()); - - wrapper.setVersion("19.3.9"); - assertEquals("19.3.9", wrapper.getVersion()); - - wrapper.setCambriaPartition("The Emerald City"); - assertEquals("The Emerald City", wrapper.getCambriaPartition()); - - wrapper.setRpcName("Tornado"); - assertEquals("Tornado", wrapper.getRpcName()); - - wrapper.setCorrelationId("YellowBrickRoad"); - assertEquals("YellowBrickRoad", wrapper.getCorrelationId()); - - wrapper.setType("Munchkin"); - assertEquals("Munchkin", wrapper.getType()); - - assertNotEquals(0, wrapper.hashCode()); - - assertEquals("Wrapper [version=19.3.9, cambriaPartition=The ", wrapper.toString().substring(0, 46)); - - PciWrapper copiedPciWrapper = new PciWrapper(); - copiedPciWrapper.setVersion(wrapper.getVersion()); - copiedPciWrapper.setCambriaPartition(wrapper.getCambriaPartition()); - copiedPciWrapper.setRpcName(wrapper.getRpcName()); - copiedPciWrapper.setCorrelationId(wrapper.getCorrelationId()); - copiedPciWrapper.setType(wrapper.getType()); - - assertTrue(wrapper.equals(wrapper)); - assertTrue(wrapper.equals(copiedPciWrapper)); - assertFalse(wrapper.equals(null)); - assertFalse(wrapper.equals("Hello")); - - wrapper.setVersion(null); - assertFalse(wrapper.equals(copiedPciWrapper)); - copiedPciWrapper.setVersion(null); - assertTrue(wrapper.equals(copiedPciWrapper)); - wrapper.setVersion("19.3.9"); - assertFalse(wrapper.equals(copiedPciWrapper)); - copiedPciWrapper.setVersion("19.3.9"); - assertTrue(wrapper.equals(copiedPciWrapper)); - - wrapper.setCambriaPartition(null); - assertFalse(wrapper.equals(copiedPciWrapper)); - copiedPciWrapper.setCambriaPartition(null); - assertTrue(wrapper.equals(copiedPciWrapper)); - wrapper.setCambriaPartition("The Emerald City"); - assertFalse(wrapper.equals(copiedPciWrapper)); - copiedPciWrapper.setCambriaPartition("The Emerald City"); - assertTrue(wrapper.equals(copiedPciWrapper)); - - wrapper.setRpcName(null); - assertFalse(wrapper.equals(copiedPciWrapper)); - copiedPciWrapper.setRpcName(null); - assertTrue(wrapper.equals(copiedPciWrapper)); - wrapper.setRpcName("Tornado"); - assertFalse(wrapper.equals(copiedPciWrapper)); - copiedPciWrapper.setRpcName("Tornado"); - assertTrue(wrapper.equals(copiedPciWrapper)); - - wrapper.setCorrelationId(null); - assertFalse(wrapper.equals(copiedPciWrapper)); - copiedPciWrapper.setCorrelationId(null); - assertTrue(wrapper.equals(copiedPciWrapper)); - wrapper.setCorrelationId("YellowBrickRoad"); - assertFalse(wrapper.equals(copiedPciWrapper)); - copiedPciWrapper.setCorrelationId("YellowBrickRoad"); - assertTrue(wrapper.equals(copiedPciWrapper)); - - wrapper.setType(null); - assertFalse(wrapper.equals(copiedPciWrapper)); - copiedPciWrapper.setType(null); - assertTrue(wrapper.equals(copiedPciWrapper)); - wrapper.setType("Munchkin"); - assertFalse(wrapper.equals(copiedPciWrapper)); - copiedPciWrapper.setType("Munchkin"); - assertTrue(wrapper.equals(copiedPciWrapper)); - } -} diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java deleted file mode 100644 index f975e5575..000000000 --- a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java +++ /dev/null @@ -1,215 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited 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.sdnr; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.UUID; - -import org.junit.Test; -import org.onap.policy.sdnr.util.Serialization; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class SdnrTest { - - private static final Logger logger = LoggerFactory.getLogger(SdnrTest.class); - - private static PciRequestWrapper dmaapRequest; - private static PciResponseWrapper dmaapResponse; - - static { - /* - * Construct an SDNR Request to be Serialized - */ - dmaapRequest = new PciRequestWrapper(); - dmaapRequest.setCorrelationId("664be3d2-6c12-4f4b-a3e7-c349acced200" + "-" + "1"); - dmaapRequest.setRpcName("restart"); - dmaapRequest.setType("request"); - - dmaapResponse = new PciResponseWrapper(); - dmaapResponse.setCorrelationId("664be3d2-6c12-4f4b-a3e7-c349acced200" + "-" + "1"); - dmaapResponse.setRpcName("restart"); - dmaapResponse.setType("response"); - - PciRequest sdnrRequest = new PciRequest(); - - sdnrRequest.setAction("ModifyConfig"); - - PciCommonHeader commonHeader = new PciCommonHeader(); - commonHeader.setRequestId(UUID.fromString("664be3d2-6c12-4f4b-a3e7-c349acced200")); - commonHeader.setSubRequestId("1"); - - sdnrRequest.setCommonHeader(commonHeader); - - sdnrRequest.setPayload(null); - - dmaapRequest.setBody(sdnrRequest); - - /* - * Construct an SDNR Response to be Serialized - */ - PciResponse sdnrResponse = new PciResponse(sdnrRequest); - sdnrResponse.getStatus().setCode(400); - sdnrResponse.getStatus().setValue("Restart Successful"); - sdnrResponse.setPayload(null); - - dmaapResponse.setBody(sdnrResponse); - } - - @Test - public void testRequestSerialization() { - - /* - * Use the gson serializer to obtain json - */ - String jsonRequest = Serialization.gson.toJson(dmaapRequest, PciRequestWrapper.class); - assertNotNull(jsonRequest); - - /* - * The serializer should have added an extra sub-tag called "input" that wraps the request - */ - assertTrue(jsonRequest.contains("input")); - - /* - * The common-header, request-id, and sub-request-id should exist - */ - assertTrue(jsonRequest.contains("CommonHeader")); - assertTrue(jsonRequest.contains("RequestID")); - assertTrue(jsonRequest.contains("SubRequestID")); - - /* - * The action sub-tag should exist - */ - assertTrue(jsonRequest.contains("Action")); - - logger.debug("Request as JSON: " + jsonRequest + "\n\n"); - } - - @Test - public void testRequestDeserialization() { - - /* - * Convert the PCI request object into json so we have a string of json to use for testing - */ - String jsonRequest = Serialization.gson.toJson(dmaapRequest, PciRequestWrapper.class); - - /* - * Use the serializer to convert the json string into a java object - */ - PciRequestWrapper pciRequestWrapper = Serialization.gson.fromJson(jsonRequest, PciRequestWrapper.class); - assertNotNull(pciRequestWrapper); - assertEquals(dmaapRequest, pciRequestWrapper); - - /* - * The type of the DMAAP wrapper should be request - */ - assertEquals("request", dmaapRequest.getType()); - - /* - * The DMAAP wrapper must have a body as that is the true SDNR request - */ - assertNotNull(dmaapRequest.getBody()); - PciRequest sdnrRequest = dmaapRequest.getBody(); - assertNotNull(sdnrRequest); - - /* - * The common header should not be null - */ - assertNotNull(sdnrRequest.getCommonHeader()); - - /* - * The action should not be null and should be set to restart - */ - assertNotNull(sdnrRequest.getAction()); - assertEquals("ModifyConfig", sdnrRequest.getAction()); - - logger.debug("Request as a Java Object: \n" + sdnrRequest.toString() + "\n\n"); - } - - @Test - public void testResponseSerialization() { - - /* - * Use the serializer to convert the object into json - */ - String jsonResponse = Serialization.gson.toJson(dmaapResponse, PciResponseWrapper.class); - assertNotNull(jsonResponse); - - /* - * The serializer should have added an extra sub-tag called "input" that wraps the request - */ - assertTrue(jsonResponse.contains("output")); - - /* - * The response should contain a common-header, request-id, sub-request-id, and status - */ - assertTrue(jsonResponse.contains("CommonHeader")); - assertTrue(jsonResponse.contains("RequestID")); - assertTrue(jsonResponse.contains("SubRequestID")); - assertTrue(jsonResponse.contains("Status")); - - logger.debug("Response as JSON: " + jsonResponse + "\n\n"); - } - - @Test - public void testResponseDeserialization() { - /* - * Convert the PCI response object into json so we have a string of json to use for testing - */ - String jsonResponse = Serialization.gson.toJson(dmaapResponse, PciResponseWrapper.class); - - /* - * Use the serializer to convert the json string into a java object - */ - PciResponseWrapper pciResponseWrapper = Serialization.gson.fromJson(jsonResponse, PciResponseWrapper.class); - assertNotNull(pciResponseWrapper); - assertEquals(dmaapResponse, pciResponseWrapper); - - /* - * The type of the DMAAP wrapper should be response - */ - assertEquals("response", dmaapResponse.getType()); - - /* - * The DMAAP wrapper must have a body as that is the true SDNR response - */ - assertNotNull(dmaapResponse.getBody()); - PciResponse sdnrResponse = dmaapResponse.getBody(); - assertNotNull(sdnrResponse); - - /* - * The common header should not be null - */ - assertNotNull(sdnrResponse.getCommonHeader()); - - /* - * The status should not be null and the status code should be 400 - */ - assertNotNull(sdnrResponse.getStatus()); - assertEquals(400, sdnrResponse.getStatus().getCode()); - - logger.debug("Response as a Java Object: \n" + sdnrResponse.toString() + "\n\n"); - } -} diff --git a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/util/SerializationTest.java b/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/util/SerializationTest.java deleted file mode 100644 index e9793b286..000000000 --- a/controlloop/common/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/util/SerializationTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * sdnr - * ================================================================================ - * Copyright (C) 2018 Wipro Limited 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.sdnr.util; - -import static org.junit.Assert.assertEquals; - -import java.time.Instant; -import java.time.ZoneId; -import java.time.ZonedDateTime; - -import org.junit.Test; - -public class SerializationTest { - - @Test - public void test() { - String nameString = "Dorothy"; - String jsonName = Serialization.gsonPretty.toJson(nameString, String.class); - assertEquals("\"Dorothy\"", jsonName); - String jsonInOutName = Serialization.gsonPretty.fromJson(jsonName, String.class); - assertEquals("Dorothy", jsonInOutName); - - Instant instant0 = Instant.ofEpochMilli(1516127215000L); - String instantString0 = Serialization.gsonPretty.toJson(instant0, Instant.class); - assertEquals("\"2018-01-16T18:26:55Z\"", instantString0); - Instant outInstant0 = Serialization.gsonPretty.fromJson(instantString0, Instant.class); - assertEquals(instant0, outInstant0); - - Instant instant1 = Instant.ofEpochMilli(1516127215000L); - String instantString1 = Serialization.gsonJunit.toJson(instant1, Instant.class); - assertEquals("1516127215000", instantString1); - Instant outInstant1 = Serialization.gsonJunit.fromJson(instantString1, Instant.class); - assertEquals(instant1, outInstant1); - - ZonedDateTime zdt = ZonedDateTime.ofInstant(instant0, ZoneId.of("UTC")); - String zdtString = Serialization.gsonPretty.toJson(zdt, ZonedDateTime.class); - assertEquals("{\n \"dateTime\": {\n \"date\":", zdtString.substring(0, 29)); - } -} diff --git a/controlloop/common/model-impl/so/pom.xml b/controlloop/common/model-impl/so/pom.xml deleted file mode 100644 index 7ddaf2e79..000000000 --- a/controlloop/common/model-impl/so/pom.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - 4.0.0 - - - org.onap.policy.drools-applications.controlloop.common.model-impl - model-impl - 1.4.0-SNAPSHOT - - - so - - - - junit - junit - test - - - com.google.code.gson - gson - provided - - - org.drools - drools-core - 6.5.0.Final - provided - - - org.onap.policy.drools-applications.controlloop.common.model-impl - rest - ${project.version} - - - org.onap.policy.common - policy-endpoints - ${version.policy.common} - provided - - - org.onap.policy.drools-pdp - policy-management - ${version.policy.drools-pdp} - provided - - - org.glassfish.jersey.containers - jersey-container-grizzly2-http - 2.25.1 - test - - - - - - maven-checkstyle-plugin - - - onap-java-style - - check - - process-sources - - - onap-checkstyle/onap-java-style.xml - - ${project.build.sourceDirectory} - true - true - true - - - true - true - warning - - - - - - org.onap.oparent - checkstyle - ${oparent.version} - compile - - - - - - diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoAsyncRequestStatus.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoAsyncRequestStatus.java deleted file mode 100644 index a596b1b07..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoAsyncRequestStatus.java +++ /dev/null @@ -1,125 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.time.LocalDateTime; - -public class SoAsyncRequestStatus implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("correlator") - private String correlator; - - @SerializedName("requestId") - private String requestId; - - @SerializedName("instanceReferences") - private SoInstanceReferences instanceReferences; - - @SerializedName("startTime") - private LocalDateTime startTime; - - @SerializedName("finishTime") - private LocalDateTime finishTime; - - @SerializedName("requestScope") - private String requestScope; - - @SerializedName("requestType") - private String requestType; - - @SerializedName("requestStatus") - private SoRequestStatus requestStatus; - - public SoAsyncRequestStatus() { - // required by author - } - - public String getCorrelator() { - return correlator; - } - - - public LocalDateTime getFinishTime() { - return finishTime; - } - - public SoInstanceReferences getInstanceReferences() { - return instanceReferences; - } - - public String getRequestId() { - return requestId; - } - - public String getRequestScope() { - return requestScope; - } - - public SoRequestStatus getRequestStatus() { - return requestStatus; - } - - public String getRequestType() { - return requestType; - } - - public LocalDateTime getStartTime() { - return startTime; - } - - public void setCorrelator(String correlator) { - this.correlator = correlator; - } - - public void setFinishTime(LocalDateTime finishTime) { - this.finishTime = finishTime; - } - - public void setInstanceReferences(SoInstanceReferences instanceReferences) { - this.instanceReferences = instanceReferences; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public void setRequestScope(String requestScope) { - this.requestScope = requestScope; - } - - public void setRequestStatus(SoRequestStatus requestStatus) { - this.requestStatus = requestStatus; - } - - public void setRequestType(String requestType) { - this.requestType = requestType; - } - - public void setStartTime(LocalDateTime startTime) { - this.startTime = startTime; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoCloudConfiguration.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoCloudConfiguration.java deleted file mode 100644 index 48a2489ab..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoCloudConfiguration.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SoCloudConfiguration implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("lcpCloudRegionId") - private String lcpCloudRegionId; - - @SerializedName("tenantId") - private String tenantId; - - public SoCloudConfiguration() { - //required by author - } - - public String getLcpCloudRegionId() { - return lcpCloudRegionId; - } - - public String getTenantId() { - return tenantId; - } - - public void setLcpCloudRegionId(String lcpCloudRegionId) { - this.lcpCloudRegionId = lcpCloudRegionId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoInstanceReferences.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoInstanceReferences.java deleted file mode 100644 index f4065e613..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoInstanceReferences.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SoInstanceReferences implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("requestId") - private String requestId; - - @SerializedName("instanceId") - private String instanceId; - - public SoInstanceReferences() { - //requried by author - } - - public String getInstanceId() { - return instanceId; - } - - public String getRequestId() { - return requestId; - } - - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - -} 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 deleted file mode 100644 index 836ebc85b..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java +++ /dev/null @@ -1,374 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd. - * ================================================================================ - * 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.so; - -import com.google.gson.GsonBuilder; -import com.google.gson.JsonSyntaxException; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import org.drools.core.WorkingMemory; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; -import org.onap.policy.drools.system.PolicyEngine; -import org.onap.policy.rest.RestManager; -import org.onap.policy.rest.RestManager.Pair; -import org.onap.policy.so.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * This class handles the interface towards SO (Service Orchestrator) for the ONAP Policy - * Framework. The SO API is defined at this link: - * http://onap.readthedocs.io/en/latest/submodules/so.git/docs/SO_R1_Interface.html#get-orchestration-request - * - */ -public final class SoManager { - private static final Logger logger = LoggerFactory.getLogger(SoManager.class); - - private static ExecutorService executors = Executors.newCachedThreadPool(); - - private static final int SO_RESPONSE_ERROR = 999; - private static final String MEDIA_TYPE = "application/json"; - private static final String LINE_SEPARATOR = System.lineSeparator(); - - // REST get timeout value in milliseconds - private static final int GET_REQUESTS_BEFORE_TIMEOUT = 20; - private static final long GET_REQUEST_WAIT_INTERVAL = 20000; - - // The REST manager used for processing REST calls for this VFC manager - private RestManager restManager; - - private long restGetTimeout = GET_REQUEST_WAIT_INTERVAL; - - /** - * Default constructor. - */ - public SoManager() { - restManager = new RestManager(); - } - - /** - * Create a service instance in SO. - * - * @param url the SO URL - * @param urlBase the base URL - * @param username user name on SO - * @param password password on SO - * @param request the request to issue to SO - * @return the SO Response object - */ - public SoResponse createModuleInstance(final String url, final String urlBase, final String username, - final String password, final SoRequest request) { - // Issue the HTTP POST request to SO to create the service instance - String requestJson = Serialization.gsonPretty.toJson(request); - NetLoggerUtil.getNetworkLogger().info("[OUT|{}|{}|{}|{}|{}|{}|]{}{}", "SO", url, username, password, - createSimpleHeaders(), MEDIA_TYPE, LINE_SEPARATOR, requestJson); - Pair httpResponse = - restManager.post(url, username, password, createSimpleHeaders(), MEDIA_TYPE, requestJson); - - // Process the response from SO - SoResponse response = waitForSoOperationCompletion(urlBase, username, password, url, httpResponse); - if (SO_RESPONSE_ERROR != response.getHttpResponseCode()) { - return response; - } else { - return null; - } - } - - /** - * Works just like SOManager#asyncSORestCall(String, WorkingMemory, String, String, String, SORequest) - * except the vfModuleInstanceId is always null. - * - */ - public Future asyncSoRestCall(final String requestId, final WorkingMemory wm, - final String serviceInstanceId, final String vnfInstanceId, - final SoRequest request) { - return asyncSoRestCall(requestId, wm, serviceInstanceId, vnfInstanceId, null, request); - } - - /** - * This method makes an asynchronous Rest call to MSO and inserts the response into - * Drools working memory. - * - * @param requestId the request id - * @param wm the Drools working memory - * @param serviceInstanceId service instance id to construct the request url - * @param vnfInstanceId vnf instance id to construct the request url - * @param vfModuleInstanceId vfModule instance id to construct the request url (required in case of delete vf - * module) - * @param request the SO request - * @return a concurrent Future for the thread that handles the request - */ - public Future asyncSoRestCall(final String requestId, - final WorkingMemory wm, - final String serviceInstanceId, - final String vnfInstanceId, - final String vfModuleInstanceId, final SoRequest request) { - return executors.submit(new AsyncSoRestCallThread(requestId, wm, serviceInstanceId, vnfInstanceId, - vfModuleInstanceId, request)); - } - - /** - * This class handles an asynchronous request to SO as a thread. - */ - private class AsyncSoRestCallThread implements Callable { - final String requestId; - final WorkingMemory wm; - final String serviceInstanceId; - final String vnfInstanceId; - final String vfModuleInstanceId; - final SoRequest request; - - /** - * Constructor, sets the context of the request. - * - * @param requestID The request ID - * @param wm reference to the Drools working memory - * @param serviceInstanceId the service instance in SO to use - * @param vnfInstanceId the VNF instance that is the subject of the request - * @param vfModuleInstanceId the vf module instance id (not null in case of delete vf module request) - * @param request the request itself - */ - private AsyncSoRestCallThread(final String requestId, - final WorkingMemory wm, final String serviceInstanceId, - final String vnfInstanceId, final String vfModuleInstanceId, - final SoRequest request) { - this.requestId = requestId; - this.wm = wm; - this.serviceInstanceId = serviceInstanceId; - this.vnfInstanceId = vnfInstanceId; - this.vfModuleInstanceId = vfModuleInstanceId; - this.request = request; - } - - /** - * Process the asynchronous SO request. - */ - @Override - public SoResponse call() { - String urlBase = PolicyEngine.manager.getEnvironmentProperty("so.url"); - String username = PolicyEngine.manager.getEnvironmentProperty("so.username"); - String password = PolicyEngine.manager.getEnvironmentProperty("so.password"); - - // Create a JSON representation of the request - String soJson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create().toJson(request); - String url = null; - Pair httpResponse = null; - - if (request.getOperationType() != null && request.getOperationType() - .equals(SoOperationType.SCALE_OUT)) { - url = urlBase + "/serviceInstantiation/v7/serviceInstances/" + serviceInstanceId + "/vnfs/" - + vnfInstanceId + "/vfModules/scaleOut"; - NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, url, soJson); - httpResponse = restManager.post(url, username, password, createSimpleHeaders(), MEDIA_TYPE, soJson); - } else if (request.getOperationType() != null && request.getOperationType() - .equals(SoOperationType.DELETE_VF_MODULE)) { - url = urlBase + "/serviceInstances/v7/" + serviceInstanceId + "/vnfs/" + vnfInstanceId - + "/vfModules/" + vfModuleInstanceId; - NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, url, soJson); - httpResponse = restManager.delete(url, username, password, createSimpleHeaders(), MEDIA_TYPE, soJson); - } else { - return null; - } - - // Process the response from SO - SoResponse response = waitForSoOperationCompletion(urlBase, username, password, url, httpResponse); - - // Return the response to Drools in its working memory - SoResponseWrapper soWrapper = new SoResponseWrapper(response, requestId); - wm.insert(soWrapper); - - return response; - } - } - - /** - * Wait for the SO operation we have ordered to complete. - * - * @param urlBaseSo The base URL for SO - * @param username user name on SO - * @param password password on SO - * @param initialRequestUrl The URL of the initial HTTP request - * @param initialHttpResponse The initial HTTP message returned from SO - * @return The parsed final response of SO to the request - */ - private SoResponse waitForSoOperationCompletion(final String urlBaseSo, final String username, - final String password, final String initialRequestUrl, - final Pair initialHttpResponse) { - // Process the initial response from SO, the response to a post - SoResponse response = processSoResponse(initialRequestUrl, initialHttpResponse); - if (SO_RESPONSE_ERROR == response.getHttpResponseCode()) { - return response; - } - - // The SO URL to use to get the status of orchestration requests - String urlGet = urlBaseSo + "/orchestrationRequests/v5/" + response.getRequestReferences().getRequestId(); - - // The HTTP status code of the latest response - Pair latestHttpResponse = initialHttpResponse; - - // Wait for the response from SO - for (int attemptsLeft = GET_REQUESTS_BEFORE_TIMEOUT; attemptsLeft >= 0; attemptsLeft--) { - // The SO request may have completed even on the first request so we check the - // response - // here before - // issuing any other requests - if (isRequestStateFinished(latestHttpResponse, response)) { - return response; - } - - // Wait for the defined interval before issuing a get - try { - Thread.sleep(restGetTimeout); - } catch (InterruptedException e) { - logger.error("Interrupted exception: ", e); - Thread.currentThread().interrupt(); - response.setHttpResponseCode(SO_RESPONSE_ERROR); - return response; - } - - // Issue a GET to find the current status of our request - NetLoggerUtil.getNetworkLogger().info("[OUT|{}|{}|{}|{}|{}|{}|]{}", "SO", urlGet, username, password, - createSimpleHeaders(), MEDIA_TYPE, LINE_SEPARATOR); - Pair httpResponse = restManager.get(urlGet, username, password, createSimpleHeaders()); - - // Get our response - response = processSoResponse(urlGet, httpResponse); - if (SO_RESPONSE_ERROR == response.getHttpResponseCode()) { - return response; - } - - // Our latest HTTP response code - latestHttpResponse = httpResponse; - } - - // We have timed out on the SO request - response.setHttpResponseCode(SO_RESPONSE_ERROR); - return response; - } - - /** - * Parse the response message from SO into a SOResponse object. - * - * @param requestURL The URL of the HTTP request - * @param httpResponse The HTTP message returned from SO - * @return The parsed response - */ - private SoResponse processSoResponse(final String requestUrl, final Pair httpResponse) { - SoResponse response = new SoResponse(); - - // A null httpDetails indicates a HTTP problem, a valid response from SO must be - // either 200 - // or 202 - if (!httpResultIsNullFree(httpResponse) || (httpResponse.first != 200 && httpResponse.first != 202)) { - logger.error("Invalid HTTP response received from SO"); - response.setHttpResponseCode(SO_RESPONSE_ERROR); - return response; - } - - // Parse the JSON of the response into our POJO - try { - response = Serialization.gsonPretty.fromJson(httpResponse.second, SoResponse.class); - } catch (JsonSyntaxException e) { - logger.error("Failed to deserialize HTTP response into SOResponse: ", e); - response.setHttpResponseCode(SO_RESPONSE_ERROR); - return response; - } - - // Set the HTTP response code of the response if needed - if (response.getHttpResponseCode() == 0) { - response.setHttpResponseCode(httpResponse.first); - } - - NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, requestUrl, httpResponse.second); - - if (logger.isDebugEnabled()) { - logger.debug("***** Response to SO Request to URL {}:", requestUrl); - logger.debug(httpResponse.second); - } - - return response; - } - - /** - * Method to allow tuning of REST get timeout. - * - * @param restGetTimeout the timeout value - */ - protected void setRestGetTimeout(final long restGetTimeout) { - this.restGetTimeout = restGetTimeout; - } - - /** - * Check that the request state of a response is defined. - * - * @param response The response to check - * @return true if the request for the response is defined - */ - private boolean isRequestStateDefined(final SoResponse response) { - return response != null && response.getRequest() != null && response.getRequest().getRequestStatus() != null - && response.getRequest().getRequestStatus().getRequestState() != null; - } - - /** - * Check that the request state of a response is finished. - * - * @param latestHttpDetails the HTTP details of the response - * @param response The response to check - * @return true if the request for the response is finished - */ - private boolean isRequestStateFinished(final Pair latestHttpDetails, final SoResponse response) { - if (latestHttpDetails != null && 200 == latestHttpDetails.first && isRequestStateDefined(response)) { - String requestState = response.getRequest().getRequestStatus().getRequestState(); - return "COMPLETE".equalsIgnoreCase(requestState) || "FAILED".equalsIgnoreCase(requestState); - } else { - return false; - } - } - - /** - * Check that a HTTP operation result has no nulls. - * - * @param httpOperationResult the result to check - * @return true if no nulls are found - */ - private boolean httpResultIsNullFree(Pair httpOperationResult) { - return httpOperationResult != null && httpOperationResult.first != null && httpOperationResult.second != null; - } - - /** - * Create simple HTTP headers for unauthenticated requests to SO. - * - * @return the HTTP headers - */ - private Map createSimpleHeaders() { - Map headers = new HashMap<>(); - headers.put("Accept", MEDIA_TYPE); - return headers; - } -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoModelInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoModelInfo.java deleted file mode 100644 index 8ab13201c..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoModelInfo.java +++ /dev/null @@ -1,112 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SoModelInfo implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("modelType") - private String modelType; - - @SerializedName("modelInvariantId") - private String modelInvariantId; - - @SerializedName("modelVersionId") - private String modelVersionId; - - @SerializedName("modelName") - private String modelName; - - @SerializedName("modelVersion") - private String modelVersion; - - @SerializedName("modelCustomizationName") - private String modelCustomizationName; - - @SerializedName("modelCustomizationId") - private String modelCustomizationId; - - public SoModelInfo() { - //required by author - } - - public String getModelCustomizationId() { - return modelCustomizationId; - } - - public String getModelCustomizationName() { - return modelCustomizationName; - } - - public String getModelInvariantId() { - return modelInvariantId; - } - - public String getModelName() { - return modelName; - } - - public String getModelType() { - return modelType; - } - - public String getModelVersion() { - return modelVersion; - } - - public String getModelVersionId() { - return modelVersionId; - } - - public void setModelCustomizationId(String modelCustomizationId) { - this.modelCustomizationId = modelCustomizationId; - } - - public void setModelCustomizationName(String modelCustomizationName) { - this.modelCustomizationName = modelCustomizationName; - } - - public void setModelInvariantId(String modelInvariantId) { - this.modelInvariantId = modelInvariantId; - } - - public void setModelName(String modelName) { - this.modelName = modelName; - } - - public void setModelType(String modelType) { - this.modelType = modelType; - } - - public void setModelVersion(String modelVersion) { - this.modelVersion = modelVersion; - } - - public void setModelVersionId(String modelVersionId) { - this.modelVersionId = modelVersionId; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoOperationType.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoOperationType.java deleted file mode 100644 index 191ee05d2..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoOperationType.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2018 Amdocs. All rights reserved. - * Modifications Copyright (C) 2018 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.so; - -/** - * Enumeration of SO Operations type that can be performed by a policy. - */ -public enum SoOperationType { - SCALE_OUT("Create Vf Module"), - DELETE_VF_MODULE("Delete Vf Module"); - - private String operationType; - - SoOperationType(String operationType) { - this.operationType = operationType; - } - - @Override - public String toString() { - return this.operationType; - } -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoPolicyExceptionHolder.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoPolicyExceptionHolder.java deleted file mode 100644 index 0553eac76..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoPolicyExceptionHolder.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SoPolicyExceptionHolder implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("messageId") - private String messageId; - - @SerializedName("text") - private String text; - - public SoPolicyExceptionHolder() { - //required by author - } - - public String getMessageId() { - return messageId; - } - - public String getText() { - return text; - } - - public void setMessageId(String messageId) { - this.messageId = messageId; - } - - public void setText(String text) { - this.text = text; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstance.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstance.java deleted file mode 100644 index f4e329643..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstance.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SoRelatedInstance implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("instanceId") - private String instanceId; - - @SerializedName("instanceName") - private String instanceName; - - @SerializedName("modelInfo") - private SoModelInfo modelInfo; - - public SoRelatedInstance() { - //required by author - } - - public String getInstanceId() { - return instanceId; - } - - - public String getInstanceName() { - return instanceName; - } - - public SoModelInfo getModelInfo() { - return modelInfo; - } - - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - - public void setInstanceName(String instanceName) { - this.instanceName = instanceName; - } - - - public void setModelInfo(SoModelInfo modelInfo) { - this.modelInfo = modelInfo; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstanceListElement.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstanceListElement.java deleted file mode 100644 index d4bf98680..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstanceListElement.java +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SoRelatedInstanceListElement implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("relatedInstance") - private SoRelatedInstance relatedInstance; - - public SoRelatedInstanceListElement() { - //required by author - } - - public SoRelatedInstance getRelatedInstance() { - return relatedInstance; - } - - public void setRelatedInstance(SoRelatedInstance relatedInstance) { - this.relatedInstance = relatedInstance; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequest.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequest.java deleted file mode 100644 index 255c5b79e..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequest.java +++ /dev/null @@ -1,123 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.time.LocalDateTime; -import java.util.UUID; - -public class SoRequest implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("requestId") - private UUID requestId; - - @SerializedName("startTime") - private String startTime; - - @SerializedName("finishTime") - private LocalDateTime finishTime; - - @SerializedName("requestScope") - private String requestScope; - - @SerializedName("requestType") - private String requestType; - - @SerializedName("requestDetails") - private SoRequestDetails requestDetails; - - @SerializedName("requestStatus") - private SoRequestStatus requestStatus; - - private transient SoOperationType operationType; - - public SoRequest() { - // required by author - } - - public LocalDateTime getFinishTime() { - return finishTime; - } - - public SoRequestDetails getRequestDetails() { - return requestDetails; - } - - public UUID getRequestId() { - return requestId; - } - - public String getRequestScope() { - return requestScope; - } - - public SoRequestStatus getRequestStatus() { - return requestStatus; - } - - public String getRequestType() { - return requestType; - } - - public String getStartTime() { - return startTime; - } - - public void setFinishTime(LocalDateTime finishTime) { - this.finishTime = finishTime; - } - - public void setRequestDetails(SoRequestDetails requestDetails) { - this.requestDetails = requestDetails; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public void setRequestScope(String requestScope) { - this.requestScope = requestScope; - } - - public void setRequestStatus(SoRequestStatus requestStatus) { - this.requestStatus = requestStatus; - } - - public void setRequestType(String requestType) { - this.requestType = requestType; - } - - public void setStartTime(String startTime) { - this.startTime = startTime; - } - - public SoOperationType getOperationType() { - return operationType; - } - - public void setOperationType(SoOperationType operationType) { - this.operationType = operationType; - } -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestDetails.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestDetails.java deleted file mode 100644 index 0ea1a272d..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestDetails.java +++ /dev/null @@ -1,215 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -public class SoRequestDetails implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("modelInfo") - private SoModelInfo modelInfo; - - @SerializedName("cloudConfiguration") - private SoCloudConfiguration cloudConfiguration; - - @SerializedName("requestInfo") - private SoRequestInfo requestInfo; - - @SerializedName("subscriberInfo") - private SoSubscriberInfo subscriberInfo; - - @SerializedName("relatedInstanceList") - private List relatedInstanceList = new LinkedList<>(); - - @SerializedName("requestParameters") - private SoRequestParameters requestParameters; - - @SerializedName("configurationParameters") - private List> configurationParameters = new LinkedList<>(); - - public SoRequestDetails() { - - } - - /** - * Constructor. - * - * @param soRequestDetails copy object - */ - public SoRequestDetails(SoRequestDetails soRequestDetails) { - this.modelInfo = soRequestDetails.modelInfo; - this.cloudConfiguration = soRequestDetails.cloudConfiguration; - this.requestInfo = soRequestDetails.requestInfo; - this.relatedInstanceList = soRequestDetails.relatedInstanceList; - this.requestParameters = soRequestDetails.requestParameters; - this.subscriberInfo = soRequestDetails.subscriberInfo; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - SoRequestDetails other = (SoRequestDetails) obj; - if (cloudConfiguration == null) { - if (other.cloudConfiguration != null) { - return false; - } - } else if (!cloudConfiguration.equals(other.cloudConfiguration)) { - return false; - } - if (configurationParameters == null) { - if (other.configurationParameters != null) { - return false; - } - } else if (!configurationParameters.equals(other.configurationParameters)) { - return false; - } - if (modelInfo == null) { - if (other.modelInfo != null) { - return false; - } - } else if (!modelInfo.equals(other.modelInfo)) { - return false; - } - if (relatedInstanceList == null) { - if (other.relatedInstanceList != null) { - return false; - } - } else if (!relatedInstanceList.equals(other.relatedInstanceList)) { - return false; - } - if (requestInfo == null) { - if (other.requestInfo != null) { - return false; - } - } else if (!requestInfo.equals(other.requestInfo)) { - return false; - } - if (requestParameters == null) { - if (other.requestParameters != null) { - return false; - } - } else if (!requestParameters.equals(other.requestParameters)) { - return false; - } - if (subscriberInfo == null) { - if (other.subscriberInfo != null) { - return false; - } - } else if (!subscriberInfo.equals(other.subscriberInfo)) { - return false; - } - return true; - } - - public SoCloudConfiguration getCloudConfiguration() { - return cloudConfiguration; - } - - public SoModelInfo getModelInfo() { - return modelInfo; - } - - public List getRelatedInstanceList() { - return relatedInstanceList; - } - - public SoRequestInfo getRequestInfo() { - return requestInfo; - } - - public SoRequestParameters getRequestParameters() { - return requestParameters; - } - - public List> getConfigurationParameters() { - return configurationParameters; - } - - public SoSubscriberInfo getSubscriberInfo() { - return subscriberInfo; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((cloudConfiguration == null) ? 0 : cloudConfiguration.hashCode()); - result = prime * result + ((configurationParameters == null) ? 0 : configurationParameters.hashCode()); - result = prime * result + ((modelInfo == null) ? 0 : modelInfo.hashCode()); - result = prime * result + ((relatedInstanceList == null) ? 0 : relatedInstanceList.hashCode()); - result = prime * result + ((requestInfo == null) ? 0 : requestInfo.hashCode()); - result = prime * result + ((requestParameters == null) ? 0 : requestParameters.hashCode()); - result = prime * result + ((subscriberInfo == null) ? 0 : subscriberInfo.hashCode()); - return result; - } - - public void setCloudConfiguration(SoCloudConfiguration cloudConfiguration) { - this.cloudConfiguration = cloudConfiguration; - } - - public void setModelInfo(SoModelInfo modelInfo) { - this.modelInfo = modelInfo; - } - - public void setRequestInfo(SoRequestInfo requestInfo) { - this.requestInfo = requestInfo; - } - - public void setRequestParameters(SoRequestParameters requestParameters) { - this.requestParameters = requestParameters; - } - - public void setConfigurationParameters(List> configurationParameters) { - this.configurationParameters = configurationParameters; - } - - public void setSubscriberInfo(SoSubscriberInfo subscriberInfo) { - this.subscriberInfo = subscriberInfo; - } - - public void setRelatedInstanceList(List relatedInstanceList) { - this.relatedInstanceList = relatedInstanceList; - } - - @Override - public String toString() { - return "SORequestDetails [modelInfo=" + modelInfo + ", cloudConfiguration=" + cloudConfiguration - + ", requestInfo=" + requestInfo + ", subscriberInfo=" + subscriberInfo - + ", relatedInstanceList=" + relatedInstanceList + ", requestParameters=" + requestParameters - + ", configurationParameters=" + configurationParameters + "]"; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestError.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestError.java deleted file mode 100644 index 1214a6c8c..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestError.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SoRequestError implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("policyException") - private SoPolicyExceptionHolder policyException; - - @SerializedName("serviceException") - private SoServiceExceptionHolder serviceException; - - public SoRequestError() { - // required by author - } - - public SoPolicyExceptionHolder getPolicyException() { - return policyException; - } - - public SoServiceExceptionHolder getServiceException() { - return serviceException; - } - - public void setPolicyException(SoPolicyExceptionHolder policyException) { - this.policyException = policyException; - } - - public void setServiceException(SoServiceExceptionHolder serviceException) { - this.serviceException = serviceException; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestInfo.java deleted file mode 100644 index ae0b57bc2..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestInfo.java +++ /dev/null @@ -1,145 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SoRequestInfo implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("instanceName") - private String instanceName; - - @SerializedName("source") - private String source; - - @SerializedName("productFamilyId") - private String productFamilyId; - - @SerializedName("suppressRollback") - private boolean suppressRollback; - - @SerializedName("billingAccountNumber") - private String billingAccountNumber; - - @SerializedName("callbackUrl") - private String callbackUrl; - - @SerializedName("correlator") - private String correlator; - - @SerializedName("orderNumber") - private String orderNumber; - - @SerializedName("orderVersion") - private Integer orderVersion; - - @SerializedName("requestorId") - private String requestorId; - - public SoRequestInfo() { - // required by author - } - - public String getBillingAccountNumber() { - return billingAccountNumber; - } - - public String getCallbackUrl() { - return callbackUrl; - } - - public String getCorrelator() { - return correlator; - } - - public String getInstanceName() { - return instanceName; - } - - public String getOrderNumber() { - return orderNumber; - } - - public Integer getOrderVersion() { - return orderVersion; - } - - public String getProductFamilyId() { - return productFamilyId; - } - - public String getRequestorId() { - return requestorId; - } - - public String getSource() { - return source; - } - - public boolean isSuppressRollback() { - return suppressRollback; - } - - public void setBillingAccountNumber(String billingAccountNumber) { - this.billingAccountNumber = billingAccountNumber; - } - - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - } - - public void setCorrelator(String correlator) { - this.correlator = correlator; - } - - public void setInstanceName(String instanceName) { - this.instanceName = instanceName; - } - - public void setOrderNumber(String orderNumber) { - this.orderNumber = orderNumber; - } - - public void setOrderVersion(Integer orderVersion) { - this.orderVersion = orderVersion; - } - - public void setProductFamilyId(String productFamilyId) { - this.productFamilyId = productFamilyId; - } - - public void setRequestorId(String requestorId) { - this.requestorId = requestorId; - } - - public void setSource(String source) { - this.source = source; - } - - public void setSuppressRollback(boolean suppressRollback) { - this.suppressRollback = suppressRollback; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestParameters.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestParameters.java deleted file mode 100644 index bc545455b..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestParameters.java +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -public class SoRequestParameters implements Serializable { - - private static final long serialVersionUID = -3283942659786236033L; - - @SerializedName("subscriptionServiceType") - private String subscriptionServiceType; - - @SerializedName("usePreload") - private boolean usePreload; - - @SerializedName("userParams") - private List> userParams = new LinkedList<>(); - - public SoRequestParameters() { - // required by author - } - - public String getSubscriptionServiceType() { - return subscriptionServiceType; - } - - public boolean isUsePreload() { - return usePreload; - } - - public List> getUserParams() { - return userParams; - } - - public void setSubscriptionServiceType(String subscriptionServiceType) { - this.subscriptionServiceType = subscriptionServiceType; - } - - public void setUsePreload(boolean usePreload) { - this.usePreload = usePreload; - } - - public void setUserParams(List> userParams) { - this.userParams = userParams; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestReferences.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestReferences.java deleted file mode 100644 index 8006142ed..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestReferences.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SoRequestReferences implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("instanceId") - private String instanceId; - - @SerializedName("requestId") - private String requestId; - - public String getInstanceId() { - return instanceId; - } - - public String getRequestId() { - return requestId; - } - - public void setInstanceId(String instanceId) { - this.instanceId = instanceId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestStatus.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestStatus.java deleted file mode 100644 index 2d2e5bf24..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoRequestStatus.java +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SoRequestStatus implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("percentProgress") - private int percentProgress; - - @SerializedName("requestState") - private String requestState; - - @SerializedName("timestamp") - private String timestamp; - - @SerializedName("wasRolledBack") - private boolean wasRolledBack; - - public SoRequestStatus() { - //required by author - } - - public int getPercentProgress() { - return percentProgress; - } - - public String getRequestState() { - return requestState; - } - - public String getTimestamp() { - return timestamp; - } - - public boolean isWasRolledBack() { - return wasRolledBack; - } - - public void setPercentProgress(int percentProgress) { - this.percentProgress = percentProgress; - } - - public void setRequestState(String requestState) { - this.requestState = requestState; - } - - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } - - public void setWasRolledBack(boolean wasRolledBack) { - this.wasRolledBack = wasRolledBack; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponse.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponse.java deleted file mode 100644 index 08b01c9f8..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SoResponse implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("requestReferences") - private SoRequestReferences requestReferences; - - @SerializedName("requestError") - private SoRequestError requestError; - - @SerializedName("request") - private SoRequest request; - - private int httpResponseCode; - - public SoResponse() { - // required by author - } - - public int getHttpResponseCode() { - return httpResponseCode; - } - - public SoRequest getRequest() { - return request; - } - - public SoRequestError getRequestError() { - return requestError; - } - - public SoRequestReferences getRequestReferences() { - return requestReferences; - } - - public void setHttpResponseCode(int httpResponseCode) { - this.httpResponseCode = httpResponseCode; - } - - public void setRequest(SoRequest request) { - this.request = request; - } - - public void setRequestError(SoRequestError requestError) { - this.requestError = requestError; - } - - public void setRequestReferences(SoRequestReferences requestReferences) { - this.requestReferences = requestReferences; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java deleted file mode 100644 index 3262d03eb..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SoResponseWrapper implements Serializable { - - private static final long serialVersionUID = 7673023687132889069L; - - @SerializedName("SoResponse") - private SoResponse soResponse; - - private transient String requestId; - - public SoResponseWrapper(SoResponse response, String reqId) { - this.soResponse = response; - this.requestId = reqId; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - SoResponseWrapper other = (SoResponseWrapper) obj; - if (soResponse == null) { - if (other.soResponse != null) { - return false; - } - } - else if (!soResponse.equals(other.soResponse)) { - return false; - } - if (requestId == null) { - if (other.requestId != null) { - return false; - } - } - else if (!requestId.equals(other.requestId)) { - return false; - } - return true; - } - - public String getRequestId() { - return requestId; - } - - public SoResponse getSoResponse() { - return soResponse; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((soResponse == null) ? 0 : soResponse.hashCode()); - result = prime * result + ((requestId == null) ? 0 : requestId.hashCode()); - return result; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public void setSoResponse(SoResponse response) { - soResponse = response; - } - - @Override - public String toString() { - return "SOResponseWrapper [SOResponse=" + soResponse + ", RequestId=" + requestId + "]"; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoServiceExceptionHolder.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoServiceExceptionHolder.java deleted file mode 100644 index 5dd87e539..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoServiceExceptionHolder.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; - -public class SoServiceExceptionHolder implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("messageId") - private String messageId; - - @SerializedName("text") - private String text; - - @SerializedName("variables") - private List variables = new LinkedList<>(); - - public SoServiceExceptionHolder() { - // required by author - } - - public String getMessageId() { - return messageId; - } - - public String getText() { - return text; - } - - public List getVariables() { - return variables; - } - - public void setMessageId(String messageId) { - this.messageId = messageId; - } - - public void setText(String text) { - this.text = text; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoSubscriberInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoSubscriberInfo.java deleted file mode 100644 index 208cff23d..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoSubscriberInfo.java +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017-2019 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.so; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class SoSubscriberInfo implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("globalSubscriberId") - private String globalSubscriberId; - - @SerializedName("subscriberCommonSiteId") - private String subscriberCommonSiteId; - - @SerializedName("subscriberName") - private String subscriberName; - - public SoSubscriberInfo() { - //required by author - } - - public String getGlobalSubscriberId() { - return globalSubscriberId; - } - - public String getSubscriberCommonSiteId() { - return subscriberCommonSiteId; - } - - public String getSubscriberName() { - return subscriberName; - } - - public void setGlobalSubscriberId(String globalSubscriberId) { - this.globalSubscriberId = globalSubscriberId; - } - - public void setSubscriberCommonSiteId(String subscriberCommonSiteId) { - this.subscriberCommonSiteId = subscriberCommonSiteId; - } - - public void setSubscriberName(String subscriberName) { - this.subscriberName = subscriberName; - } - -} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java deleted file mode 100644 index 9bcd5e5c9..000000000 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * 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.so.util; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -public final class Serialization { - - public static final Gson gsonPretty = - new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create(); - - private Serialization() { - // utility class with explicit private constructor - // change if class is more than utility - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DemoTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DemoTest.java deleted file mode 100644 index 2db347846..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DemoTest.java +++ /dev/null @@ -1,186 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017, 2019 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.so; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; -import org.onap.policy.so.SoCloudConfiguration; -import org.onap.policy.so.SoModelInfo; -import org.onap.policy.so.SoRelatedInstance; -import org.onap.policy.so.SoRelatedInstanceListElement; -import org.onap.policy.so.SoRequest; -import org.onap.policy.so.SoRequestDetails; -import org.onap.policy.so.SoRequestInfo; -import org.onap.policy.so.SoRequestParameters; -import org.onap.policy.so.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class DemoTest { - private static final Logger logger = LoggerFactory.getLogger(DemoTest.class); - - @Test - public void test() { - - SoRequest request = new SoRequest(); - request.setRequestDetails(new SoRequestDetails()); - request.getRequestDetails().setModelInfo(new SoModelInfo()); - request.getRequestDetails().setCloudConfiguration(new SoCloudConfiguration()); - request.getRequestDetails().setRequestInfo(new SoRequestInfo()); - request.getRequestDetails().setRequestParameters(new SoRequestParameters()); - - request.getRequestDetails().getModelInfo().setModelType("vfModule"); - request.getRequestDetails().getModelInfo().setModelInvariantId("ff5256d2-5a33-55df-13ab-12abad84e7ff"); - request.getRequestDetails().getModelInfo().setModelVersionId("fe6478e5-ea33-3346-ac12-ab121484a3fe"); - request.getRequestDetails().getModelInfo().setModelName("vSAMP12..base..module-0"); - request.getRequestDetails().getModelInfo().setModelVersion("1"); - - request.getRequestDetails().getCloudConfiguration().setLcpCloudRegionId("mdt1"); - request.getRequestDetails().getCloudConfiguration().setTenantId("88a6ca3ee0394ade9403f075db23167e"); - - request.getRequestDetails().getRequestInfo().setInstanceName("SOTEST103a-vSAMP12_base_module-0"); - request.getRequestDetails().getRequestInfo().setSource("VID"); - request.getRequestDetails().getRequestInfo().setSuppressRollback(true); - - SoRelatedInstanceListElement relatedInstanceListElement1 = - new SoRelatedInstanceListElement(); - SoRelatedInstanceListElement relatedInstanceListElement2 = - new SoRelatedInstanceListElement(); - SoRelatedInstanceListElement relatedInstanceListElement3 = - new SoRelatedInstanceListElement(); - relatedInstanceListElement1.setRelatedInstance(new SoRelatedInstance()); - relatedInstanceListElement2.setRelatedInstance(new SoRelatedInstance()); - relatedInstanceListElement3.setRelatedInstance(new SoRelatedInstance()); - - relatedInstanceListElement1.getRelatedInstance().setInstanceId( - "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c"); - relatedInstanceListElement1.getRelatedInstance().setInstanceName( - "SOTESTVOL103a-vSAMP12_base_module-0_vol"); - relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SoModelInfo()); - relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("volumeGroup"); - - relatedInstanceListElement2.getRelatedInstance().setInstanceId("serviceInstanceId"); - relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SoModelInfo()); - relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("service"); - relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelInvariantId( - "ff3514e3-5a33-55df-13ab-12abad84e7ff"); - relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelVersionId( - "fe6985cd-ea33-3346-ac12-ab121484a3fe"); - relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelName( - "parent service model name"); - relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelVersion("1.0"); - - relatedInstanceListElement3.getRelatedInstance().setInstanceId("vnfInstanceId"); - relatedInstanceListElement3.getRelatedInstance().setModelInfo(new SoModelInfo()); - relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelType("vnf"); - relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelInvariantId( - "ff5256d1-5a33-55df-13ab-12abad84e7ff"); - relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelVersionId( - "fe6478e4-ea33-3346-ac12-ab121484a3fe"); - relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelName("vSAMP12"); - relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelVersion("1.0"); - relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelCustomizationName("vSAMP12 1"); - - request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement1); - request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement2); - request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement3); - - Map userParam1 = new HashMap<>(); - userParam1.put("name1", "value1"); - - Map userParam2 = new HashMap<>(); - userParam2.put("name2", "value2"); - - request.getRequestDetails().getRequestParameters().getUserParams().add(userParam1); - request.getRequestDetails().getRequestParameters().getUserParams().add(userParam2); - - logger.debug(Serialization.gsonPretty.toJson(request)); - - } - - @Test - public void testHack() { - - logger.debug("** HACK **"); - - SoRequest request = new SoRequest(); - - request.setRequestDetails(new SoRequestDetails()); - request.getRequestDetails().setModelInfo(new SoModelInfo()); - request.getRequestDetails().setCloudConfiguration(new SoCloudConfiguration()); - request.getRequestDetails().setRequestInfo(new SoRequestInfo()); - request.getRequestDetails().setRequestParameters(new SoRequestParameters()); - request.getRequestDetails().getRequestParameters().setUserParams(null); - - request.getRequestDetails().getModelInfo().setModelType("vfModule"); - request.getRequestDetails().getModelInfo().setModelInvariantId("a9c4a35a-de48-451a-9e4e-343f2ac52928"); - request.getRequestDetails().getModelInfo().setModelVersionId("e0d98ad1-238d-4555-b439-023d3f9079f6"); - request.getRequestDetails().getModelInfo().setModelName("0d9e0d9d352749f4B3cb..dnsscaling..module-0"); - request.getRequestDetails().getModelInfo().setModelVersion("2.0"); - - request.getRequestDetails().getCloudConfiguration().setLcpCloudRegionId("DFW"); - request.getRequestDetails().getCloudConfiguration().setTenantId("1015548"); - - request.getRequestDetails().getRequestInfo().setInstanceName( - "Vfmodule_Ete_Name1eScaling63928f-ccdc-4b34-bdef-9bf64109026e"); - request.getRequestDetails().getRequestInfo().setSource("POLICY"); - request.getRequestDetails().getRequestInfo().setSuppressRollback(false); - - SoRelatedInstanceListElement relatedInstanceListElement1 = - new SoRelatedInstanceListElement(); - SoRelatedInstanceListElement relatedInstanceListElement2 = - new SoRelatedInstanceListElement(); - relatedInstanceListElement1.setRelatedInstance(new SoRelatedInstance()); - relatedInstanceListElement2.setRelatedInstance(new SoRelatedInstance()); - - String serviceInstanceId = "98af39ce-6408-466b-921f-c2c7a8f59ed6"; - relatedInstanceListElement1.getRelatedInstance().setInstanceId(serviceInstanceId); - relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SoModelInfo()); - relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("service"); - relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelInvariantId( - "24329a0c-1d57-4210-b1af-a65df64e9d59"); - relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelVersionId( - "ac642881-8e7e-4217-bd64-16ad41c42e30"); - relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelName("5116d67e-0b4f-46bf-a46f"); - relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelVersion("2.0"); - - String vnfInstanceId = "8eb411b8-a936-412f-b01f-9a9a435c0e93"; - relatedInstanceListElement2.getRelatedInstance().setInstanceId(vnfInstanceId); - relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SoModelInfo()); - relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("vnf"); - relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelInvariantId( - "09fd971e-db5f-475d-997c-cf6704b6b8fe"); - relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelVersionId( - "152ed917-6dcc-46ee-bf8a-a775c5aa5a74"); - relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelName("9e4c31d2-4b25-4d9e-9fb4"); - relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelVersion("2.0"); - relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelCustomizationName( - "0d9e0d9d-3527-49f4-b3cb 2"); - - request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement1); - request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement2); - - logger.debug(Serialization.gsonPretty.toJson(request)); - } - -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java deleted file mode 100644 index b8fd036c5..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java +++ /dev/null @@ -1,315 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2018 Ericsson. 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.so; - -import java.util.Collection; -import java.util.Iterator; -import java.util.Map; - -import org.drools.core.WorkingMemory; -import org.drools.core.WorkingMemoryEntryPoint; -import org.drools.core.common.InternalFactHandle; -import org.drools.core.impl.InternalKnowledgeBase; -import org.drools.core.spi.AsyncExceptionHandler; -import org.drools.core.spi.GlobalResolver; -import org.kie.api.event.kiebase.KieBaseEventListener; -import org.kie.api.event.rule.AgendaEventListener; -import org.kie.api.event.rule.RuleRuntimeEventListener; -import org.kie.api.runtime.Environment; -import org.kie.api.runtime.ObjectFilter; -import org.kie.api.runtime.process.ProcessInstance; -import org.kie.api.runtime.process.WorkItemManager; -import org.kie.api.runtime.rule.Agenda; -import org.kie.api.runtime.rule.AgendaFilter; -import org.kie.api.runtime.rule.FactHandle; -import org.kie.api.runtime.rule.FactHandle.State; -import org.kie.api.runtime.rule.QueryResults; -import org.kie.api.time.SessionClock; - -public class DummyWorkingMemory implements WorkingMemory { - - @Override - public void addEventListener(RuleRuntimeEventListener listener) { - } - - @Override - public void addEventListener(AgendaEventListener listener) { - } - - @Override - public void addEventListener(KieBaseEventListener listener) { - } - - @Override - public void removeEventListener(RuleRuntimeEventListener listener) { - } - - @Override - public void removeEventListener(AgendaEventListener listener) { - } - - @Override - public void removeEventListener(KieBaseEventListener listener) { - } - - @Override - public Collection getRuleRuntimeEventListeners() { - return null; - } - - @Override - public Collection getAgendaEventListeners() { - return null; - } - - @Override - public Collection getKieBaseEventListeners() { - return null; - } - - @Override - public FactHandle insert(Object object, boolean dynamic) { - return null; - } - - @Override - public FactHandle insert(Object object) { - return null; - } - - @Override - public void dispose() { - } - - @Override - public String getEntryPointId() { - return null; - } - - @Override - public void retract(FactHandle handle) { - } - - @Override - public void delete(FactHandle handle) { - } - - @Override - public void delete(FactHandle handle, State fhState) { - - - } - - @Override - public void update(FactHandle handle, Object object) { - } - - @Override - public void update(FactHandle handle, Object object, String... modifiedProperties) { - } - - @Override - public Collection getObjects() { - return null; - } - - @Override - public Collection getObjects(ObjectFilter filter) { - return null; - } - - @Override - public Collection getFactHandles() { - return null; - } - - @Override - public Collection getFactHandles(ObjectFilter filter) { - return null; - } - - @Override - public long getFactCount() { - return 0; - } - - @Override - public Agenda getAgenda() { - return null; - } - - @Override - public void setGlobal(String identifier, Object value) { - } - - @Override - public Object getGlobal(String identifier) { - return null; - } - - @Override - public Environment getEnvironment() { - return null; - } - - @Override - public void setGlobalResolver(GlobalResolver globalResolver) { - } - - @Override - public GlobalResolver getGlobalResolver() { - return null; - } - - @Override - public InternalKnowledgeBase getKnowledgeBase() { - return null; - } - - @Override - public int fireAllRules() { - return 0; - } - - @Override - public int fireAllRules(AgendaFilter agendaFilter) { - return 0; - } - - @Override - public int fireAllRules(int fireLimit) { - return 0; - } - - @Override - public int fireAllRules(AgendaFilter agendaFilter, int fireLimit) { - return 0; - } - - @Override - public Object getObject(FactHandle handle) { - return null; - } - - @Override - public FactHandle getFactHandle(Object object) { - return null; - } - - @Override - public FactHandle getFactHandleByIdentity(Object object) { - return null; - } - - @Override - public Iterator iterateObjects() { - return null; - } - - @Override - public Iterator iterateObjects(ObjectFilter filter) { - return null; - } - - @Override - public Iterator iterateFactHandles() { - return null; - } - - @Override - public Iterator iterateFactHandles(ObjectFilter filter) { - return null; - } - - @Override - public void setFocus(String focus) { - } - - @Override - public QueryResults getQueryResults(String query, Object... arguments) { - return null; - } - - @Override - public void setAsyncExceptionHandler(AsyncExceptionHandler handler) { - } - - @Override - public void clearAgenda() { - } - - @Override - public void clearAgendaGroup(String group) { - } - - @Override - public void clearActivationGroup(String group) { - } - - @Override - public void clearRuleFlowGroup(String group) { - } - - @Override - public ProcessInstance startProcess(String processId) { - return null; - } - - @Override - public ProcessInstance startProcess(String processId, Map parameters) { - return null; - } - - @Override - public Collection getProcessInstances() { - return null; - } - - @Override - public ProcessInstance getProcessInstance(long id) { - return null; - } - - @Override - public ProcessInstance getProcessInstance(long id, boolean readOnly) { - return null; - } - - @Override - public WorkItemManager getWorkItemManager() { - return null; - } - - @Override - public void halt() { - } - - @Override - public WorkingMemoryEntryPoint getWorkingMemoryEntryPoint(String id) { - return null; - } - - @Override - public SessionClock getSessionClock() { - return null; - } - -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java deleted file mode 100755 index 64467b299..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * - * Modifications Copyright (C) 2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.time.LocalDateTime; - -import org.junit.Test; - -public class SoAsyncRequestStatusTest { - - @Test - public void testConstructor() { - SoAsyncRequestStatus obj = new SoAsyncRequestStatus(); - - assertTrue(obj.getCorrelator() == null); - assertTrue(obj.getFinishTime() == null); - assertTrue(obj.getInstanceReferences() == null); - assertTrue(obj.getRequestId() == null); - assertTrue(obj.getRequestScope() == null); - assertTrue(obj.getRequestStatus() == null); - assertTrue(obj.getStartTime() == null); - } - - @Test - public void testSetGet() { - SoAsyncRequestStatus obj = new SoAsyncRequestStatus(); - - obj.setCorrelator("correlator"); - assertEquals("correlator", obj.getCorrelator()); - - LocalDateTime finishTime = LocalDateTime.now(); - obj.setFinishTime(finishTime); - assertEquals(finishTime, obj.getFinishTime()); - - SoInstanceReferences instanceReferences = new SoInstanceReferences(); - obj.setInstanceReferences(instanceReferences); - assertEquals(instanceReferences, obj.getInstanceReferences()); - - obj.setRequestId("requestId"); - assertEquals("requestId", obj.getRequestId()); - - obj.setRequestScope("requestScope"); - assertEquals("requestScope", obj.getRequestScope()); - - SoRequestStatus requestStatus = new SoRequestStatus(); - obj.setRequestStatus(requestStatus); - assertEquals(requestStatus, obj.getRequestStatus()); - - obj.setRequestType("requestType"); - assertEquals("requestType", obj.getRequestType()); - - LocalDateTime startTime = LocalDateTime.now(); - obj.setStartTime(startTime); - assertEquals(startTime, obj.getStartTime()); - - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java deleted file mode 100755 index 0b6521be1..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * - * Modifications Copyright (C) 2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class SoCloudConfigurationTest { - - @Test - public void testConstructor() { - SoCloudConfiguration obj = new SoCloudConfiguration(); - - assertTrue(obj.getLcpCloudRegionId() == null); - assertTrue(obj.getTenantId() == null); - } - - @Test - public void testSetGet() { - SoCloudConfiguration obj = new SoCloudConfiguration(); - - obj.setLcpCloudRegionId("lcpCloudRegionId"); - assertEquals("lcpCloudRegionId", obj.getLcpCloudRegionId()); - - obj.setTenantId("tenantId"); - assertEquals("tenantId", obj.getTenantId()); - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServerTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServerTest.java deleted file mode 100644 index 5c302474a..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoDummyServerTest.java +++ /dev/null @@ -1,239 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2018 Ericsson. All rights reserved. - * ================================================================================ - * Modifications Copyright (C) 2018-2019 AT&T. 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.so; - -import com.google.gson.Gson; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.core.Response; - -@Path("/SO") -public class SoDummyServerTest { - - private static int postMessagesReceived = 0; - private static int putMessagesReceived = 0; - private static int statMessagesReceived = 0; - private static int getMessagesReceived = 0; - private static int deleteMessagesReceived = 0; - - private static Map ongoingRequestMap = new ConcurrentHashMap<>(); - - /** - * Stats method. - * - * @return response - */ - @GET - @Path("/Stats") - public Response serviceGetStats() { - statMessagesReceived++; - return Response.status(200).entity("{\"GET\": " + getMessagesReceived + ",\"STAT\": " + statMessagesReceived - + ",\"POST\": " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived - + ",\"DELETE\": " + deleteMessagesReceived + "}").build(); - - } - - /** - * Get stat type. - * - * @param statType the stat type - * @return http response - */ - @GET - @Path("/OneStat/{statType}") - public Response serviceGetStat(@PathParam("statType") final String statType) { - statMessagesReceived++; - return Response.status(200).entity("{\"TYPE\": " + statType + "}").build(); - } - - /** - * Post to service instantiation. - * - * @param jsonString string to send - * @return http response - */ - @POST - @Path("/serviceInstantiation/v7") - public Response servicePostRequest(final String jsonString) { - postMessagesReceived++; - return buildResponse(jsonString); - } - - /** - * Post. - * - * @param serviceInstanceId service instance id - * @param vnfInstanceId vnf instance id - * @param jsonString json body - * @return http response - */ - @POST - @Path("/serviceInstantiation/v7/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/scaleOut") - public Response servicePostRequestVfModules(@PathParam("serviceInstanceId") final String serviceInstanceId, - @PathParam("vnfInstanceId") final String vnfInstanceId, final String jsonString) { - postMessagesReceived++; - return buildResponse(jsonString); - } - - /** - * Get instance ID. - * - * @param nsInstanceId node instance id - * @return http response - */ - @GET - @Path("/orchestrationRequests/v5/{nsInstanceId}") - public Response soRequestStatus(@PathParam("nsInstanceId") final String nsInstanceId) { - - SoResponse response = ongoingRequestMap.get(nsInstanceId); - - int iterationsLeft = Integer.valueOf(response.getRequest().getRequestScope()); - if (--iterationsLeft > 0) { - response.getRequest().setRequestScope(new Integer(iterationsLeft).toString()); - String responseString = new Gson().toJson(response, SoResponse.class); - return Response.status(response.getHttpResponseCode()).entity(responseString).build(); - } - - ongoingRequestMap.remove(nsInstanceId); - - if ("ReturnBadAfterWait".equals(response.getRequest().getRequestType())) { - return Response.status(400).build(); - } - - response.getRequest().getRequestStatus().setRequestState("COMPLETE"); - response.getRequest().setRequestScope("0"); - response.setHttpResponseCode(200); - String responseString = new Gson().toJson(response, SoResponse.class); - return Response.status(response.getHttpResponseCode()).entity(responseString).build(); - } - - /** - * Delete. - * - * @param serviceInstanceId service instance id - * @param vnfInstanceId vnf instance id - * @param vfModuleInstanceId vf module instance id - * @param jsonString json body - * @return http response - */ - @DELETE - @Path("/serviceInstances/v7/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfModuleInstanceId}") - public Response serviceDeleteRequestVfModules( - @PathParam("serviceInstanceId") final String serviceInstanceId, - @PathParam("vnfInstanceId") final String vnfInstanceId, - @PathParam("vfModuleInstanceId") final String vfModuleInstanceId, - final String jsonString) { - deleteMessagesReceived++; - return buildResponse(jsonString); - } - - private Response buildResponse(String jsonString) { - if (jsonString == null) { - return Response.status(400).build(); - } - - SoRequest request = null; - try { - request = new Gson().fromJson(jsonString, SoRequest.class); - } catch (Exception e) { - return Response.status(400).build(); - } - - if (request == null) { - return Response.status(400).build(); - } - - if (request.getRequestType() == null) { - return Response.status(400).build(); - } - - if ("ReturnBadJson".equals(request.getRequestType())) { - return Response.status(200) - .entity("{\"GET\": , " + getMessagesReceived + ",\"STAT\": " + statMessagesReceived - + ",\"POST\":" + " , " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived - + ",\"DELETE\": " + deleteMessagesReceived + "}").build(); - } - - SoResponse response = new SoResponse(); - response.setRequest(request); - response.setRequestReferences(new SoRequestReferences()); - response.getRequestReferences().setRequestId(request.getRequestId().toString()); - - if ("ReturnCompleted".equals(request.getRequestType())) { - response.getRequest().getRequestStatus().setRequestState("COMPLETE"); - response.setHttpResponseCode(200); - String responseString = new Gson().toJson(response, SoResponse.class); - return Response.status(response.getHttpResponseCode()) - .entity(responseString) - .build(); - } - - if ("ReturnFailed".equals(request.getRequestType())) { - response.getRequest().getRequestStatus().setRequestState("FAILED"); - response.setHttpResponseCode(200); - String responseString = new Gson().toJson(response, SoResponse.class); - return Response.status(response.getHttpResponseCode()) - .entity(responseString) - .build(); - } - - if ("ReturnOnging202".equals(request.getRequestType())) { - ongoingRequestMap.put(request.getRequestId().toString(), response); - - response.getRequest().getRequestStatus().setRequestState("ONGOING"); - response.setHttpResponseCode(202); - String responseString = new Gson().toJson(response, SoResponse.class); - return Response.status(response.getHttpResponseCode()) - .entity(responseString) - .build(); - } - - if ("ReturnOnging200".equals(request.getRequestType())) { - ongoingRequestMap.put(request.getRequestId().toString(), response); - - response.getRequest().getRequestStatus().setRequestState("ONGOING"); - response.setHttpResponseCode(200); - String responseString = new Gson().toJson(response, SoResponse.class); - return Response.status(response.getHttpResponseCode()) - .entity(responseString) - .build(); - } - - if ("ReturnBadAfterWait".equals(request.getRequestType())) { - ongoingRequestMap.put(request.getRequestId().toString(), response); - - response.getRequest().getRequestStatus().setRequestState("ONGOING"); - response.setHttpResponseCode(200); - String responseString = new Gson().toJson(response, SoResponse.class); - return Response.status(response.getHttpResponseCode()) - .entity(responseString) - .build(); - } - return null; - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java deleted file mode 100755 index 13d7dd83b..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoInstanceReferencesTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * - * Modifications Copyright (C) 2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class SoInstanceReferencesTest { - - @Test - public void testConstructor() { - SoInstanceReferences obj = new SoInstanceReferences(); - - assertTrue(obj.getInstanceId() == null); - assertTrue(obj.getRequestId() == null); - } - - @Test - public void testSetGet() { - SoInstanceReferences obj = new SoInstanceReferences(); - - obj.setInstanceId("instanceId"); - assertEquals("instanceId", obj.getInstanceId()); - - obj.setRequestId("requestId"); - assertEquals("requestId", obj.getRequestId()); - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoManagerTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoManagerTest.java deleted file mode 100644 index e2482569d..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoManagerTest.java +++ /dev/null @@ -1,405 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * TestSOManager - * ================================================================================ - * Copyright (C) 2018 Ericsson. All rights reserved. - * ================================================================================ - * Modifications Copyright (C) 2018-2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.IOException; -import java.net.URI; -import java.util.UUID; -import java.util.concurrent.Future; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; -import org.drools.core.WorkingMemory; -import org.glassfish.grizzly.http.server.HttpServer; -import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory; -import org.glassfish.jersey.server.ResourceConfig; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.drools.system.PolicyEngine; - -public class SoManagerTest { - private static final String BASE_URI = "http://localhost:46553/TestSOManager"; - private static final String BASE_SO_URI = BASE_URI + "/SO"; - private static HttpServer server; - - /** - * Set up test class. - */ - @BeforeClass - public static void setUp() throws IOException { - final ResourceConfig rc = new ResourceConfig(SoDummyServerTest.class); - //Grizzly by default doesn't allow payload for HTTP methods (ex: DELETE), for which HTTP spec doesn't - // explicitly state that. - //allow it before starting the server - server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc, false); - server.getServerConfiguration().setAllowPayloadForUndefinedHttpMethods(true); - server.start(); - } - - @AfterClass - public static void tearDown() throws Exception { - server.shutdown(); - } - - @Test - public void testGrizzlyServer() throws ClientProtocolException, IOException { - CloseableHttpClient httpclient = HttpClients.createDefault(); - HttpGet httpGet = new HttpGet("http://localhost:46553/TestSOManager/SO/Stats"); - CloseableHttpResponse response = httpclient.execute(httpGet); - - String returnBody = EntityUtils.toString(response.getEntity(), "UTF-8"); - assertTrue(returnBody.matches("^\\{\"GET\": [0-9]*,\"STAT\": [0-9]*,\"POST\": [0-9]*,\"PUT\": [0-9]*," - + "\"DELETE\": [0-9]*\\}$")); - } - - @Test - public void testServiceInstantiation() throws IOException { - SoManager manager = new SoManager(); - assertNotNull(manager); - manager.setRestGetTimeout(100); - - SoResponse response = manager.createModuleInstance("http:/localhost:99999999", BASE_SO_URI, "sean", - "citizen", null); - assertNull(response); - - response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean", - "citizen", null); - assertNull(response); - - response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean", - "citizen", new SoRequest()); - assertNull(response); - - SoRequest request = new SoRequest(); - request.setRequestId(UUID.randomUUID()); - request.setRequestScope("Test"); - request.setRequestType("ReturnBadJson"); - request.setStartTime("2018-03-23 16:31"); - request.setRequestStatus(new SoRequestStatus()); - request.getRequestStatus().setRequestState("ONGOING"); - - response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean", - "citizen", request); - assertNull(response); - - request.setRequestType("ReturnCompleted"); - response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean", - "citizen", request); - assertNotNull(response); - assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState()); - - request.setRequestType("ReturnFailed"); - response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean", - "citizen", request); - assertNotNull(response); - assertEquals("FAILED", response.getRequest().getRequestStatus().getRequestState()); - - // Use scope to set the number of iterations we'll wait for - - request.setRequestType("ReturnOnging200"); - request.setRequestScope(new Integer(10).toString()); - response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean", - "citizen", request); - assertNotNull(response); - assertNotNull(response.getRequest()); - assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState()); - - request.setRequestType("ReturnOnging202"); - request.setRequestScope(new Integer(20).toString()); - response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean", - "citizen", request); - assertNotNull(response); - assertNotNull(response.getRequest()); - assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState()); - - // Test timeout after 20 attempts for a response - request.setRequestType("ReturnOnging202"); - request.setRequestScope(new Integer(21).toString()); - response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean", - "citizen", request); - assertNull(response); - - // Test bad response after 3 attempts for a response - request.setRequestType("ReturnBadAfterWait"); - request.setRequestScope(new Integer(3).toString()); - response = manager.createModuleInstance(BASE_SO_URI + "/serviceInstantiation/v7", BASE_SO_URI, "sean", - "citizen", request); - assertNull(response); - } - - @Test - public void testVfModuleCreation() throws IOException { - SoManager manager = new SoManager(); - assertNotNull(manager); - manager.setRestGetTimeout(100); - - PolicyEngine.manager.setEnvironmentProperty("so.username", "sean"); - PolicyEngine.manager.setEnvironmentProperty("so.password", "citizen"); - - WorkingMemory wm = new DummyWorkingMemory(); - - SoRequest soRequest = new SoRequest(); - soRequest.setOperationType(SoOperationType.SCALE_OUT); - PolicyEngine.manager.setEnvironmentProperty("so.url", "http:/localhost:99999999"); - Future asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, - UUID.randomUUID().toString(), UUID.randomUUID().toString(), soRequest); - try { - SoResponse response = asyncRestCallFuture.get(); - assertEquals(999, response.getHttpResponseCode()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - - PolicyEngine.manager.setEnvironmentProperty("so.url", BASE_SO_URI); - asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), - UUID.randomUUID().toString(), soRequest); - try { - SoResponse response = asyncRestCallFuture.get(); - assertEquals(999, response.getHttpResponseCode()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - - SoRequest request = new SoRequest(); - request.setRequestId(UUID.randomUUID()); - request.setRequestScope("Test"); - request.setRequestType("ReturnBadJson"); - request.setStartTime("2018-03-23 16:31"); - request.setRequestStatus(new SoRequestStatus()); - request.getRequestStatus().setRequestState("ONGOING"); - request.setOperationType(SoOperationType.SCALE_OUT); - - asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), - UUID.randomUUID().toString(), request); - try { - SoResponse response = asyncRestCallFuture.get(); - assertEquals(999, response.getHttpResponseCode()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - - request.setRequestType("ReturnCompleted"); - - asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), - UUID.randomUUID().toString(), request); - try { - SoResponse response = asyncRestCallFuture.get(); - assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - - request.setRequestType("ReturnFailed"); - asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), - UUID.randomUUID().toString(), request); - try { - SoResponse response = asyncRestCallFuture.get(); - assertEquals("FAILED", response.getRequest().getRequestStatus().getRequestState()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - - // Use scope to set the number of iterations we'll wait for - - request.setRequestType("ReturnOnging200"); - request.setRequestScope(new Integer(10).toString()); - asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), - UUID.randomUUID().toString(), request); - try { - SoResponse response = asyncRestCallFuture.get(); - assertNotNull(response.getRequest()); - assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - - request.setRequestType("ReturnOnging202"); - request.setRequestScope(new Integer(20).toString()); - asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), - UUID.randomUUID().toString(), request); - try { - SoResponse response = asyncRestCallFuture.get(); - assertNotNull(response.getRequest()); - assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - - // Test timeout after 20 attempts for a response - request.setRequestType("ReturnOnging202"); - request.setRequestScope(new Integer(21).toString()); - asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), - UUID.randomUUID().toString(), request); - try { - SoResponse response = asyncRestCallFuture.get(); - assertEquals(999, response.getHttpResponseCode()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - - // Test bad response after 3 attempts for a response - request.setRequestType("ReturnBadAfterWait"); - request.setRequestScope(new Integer(3).toString()); - asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), - UUID.randomUUID().toString(), request); - try { - SoResponse response = asyncRestCallFuture.get(); - assertEquals(999, response.getHttpResponseCode()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - } - - @Test - public void testVfModuleDeletion() { - SoManager manager = new SoManager(); - assertNotNull(manager); - manager.setRestGetTimeout(100); - - PolicyEngine.manager.setEnvironmentProperty("so.username", "sean"); - PolicyEngine.manager.setEnvironmentProperty("so.password", "citizen"); - - WorkingMemory wm = new DummyWorkingMemory(); - - SoRequest soRequest = new SoRequest(); - soRequest.setOperationType(SoOperationType.DELETE_VF_MODULE); - PolicyEngine.manager.setEnvironmentProperty("so.url", "http:/localhost:99999999"); - Future asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, - UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString(), soRequest); - try { - SoResponse response = asyncRestCallFuture.get(); - assertEquals(999, response.getHttpResponseCode()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - - PolicyEngine.manager.setEnvironmentProperty("so.url", BASE_SO_URI); - asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), - UUID.randomUUID().toString(), UUID.randomUUID().toString(), soRequest); - try { - SoResponse response = asyncRestCallFuture.get(); - assertEquals(999, response.getHttpResponseCode()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - - SoRequest request = new SoRequest(); - request.setRequestId(UUID.randomUUID()); - request.setRequestScope("Test"); - request.setRequestType("ReturnBadJson"); - request.setStartTime("2018-03-23 16:31"); - request.setRequestStatus(new SoRequestStatus()); - request.getRequestStatus().setRequestState("ONGOING"); - request.setOperationType(SoOperationType.DELETE_VF_MODULE); - - asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), - UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); - try { - SoResponse response = asyncRestCallFuture.get(); - assertEquals(999, response.getHttpResponseCode()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - - request.setRequestType("ReturnCompleted"); - - asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), - UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); - try { - SoResponse response = asyncRestCallFuture.get(); - assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - - request.setRequestType("ReturnFailed"); - asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), - UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); - try { - SoResponse response = asyncRestCallFuture.get(); - assertEquals("FAILED", response.getRequest().getRequestStatus().getRequestState()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - - // Use scope to set the number of iterations we'll wait for - - request.setRequestType("ReturnOnging200"); - request.setRequestScope(new Integer(10).toString()); - asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), - UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); - try { - SoResponse response = asyncRestCallFuture.get(); - assertNotNull(response.getRequest()); - assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - - request.setRequestType("ReturnOnging202"); - request.setRequestScope(new Integer(20).toString()); - asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), - UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); - try { - SoResponse response = asyncRestCallFuture.get(); - assertNotNull(response.getRequest()); - assertEquals("COMPLETE", response.getRequest().getRequestStatus().getRequestState()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - - // Test timeout after 20 attempts for a response - request.setRequestType("ReturnOnging202"); - request.setRequestScope(new Integer(21).toString()); - asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), - UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); - try { - SoResponse response = asyncRestCallFuture.get(); - assertEquals(999, response.getHttpResponseCode()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - - // Test bad response after 3 attempts for a response - request.setRequestType("ReturnBadAfterWait"); - request.setRequestScope(new Integer(3).toString()); - asyncRestCallFuture = manager.asyncSoRestCall(UUID.randomUUID().toString(), wm, UUID.randomUUID().toString(), - UUID.randomUUID().toString(), UUID.randomUUID().toString(), request); - try { - SoResponse response = asyncRestCallFuture.get(); - assertEquals(999, response.getHttpResponseCode()); - } catch (Exception e) { - fail("test should not throw an exception"); - } - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java deleted file mode 100755 index 3cc415cdd..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * - * Modifications Copyright (C) 2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class SoModelInfoTest { - - @Test - public void testConstructor() { - SoModelInfo obj = new SoModelInfo(); - - assertTrue(obj.getModelCustomizationId() == null); - assertTrue(obj.getModelCustomizationName() == null); - assertTrue(obj.getModelInvariantId() == null); - assertTrue(obj.getModelName() == null); - assertTrue(obj.getModelType() == null); - assertTrue(obj.getModelVersion() == null); - assertTrue(obj.getModelVersionId() == null); - } - - @Test - public void testSetGet() { - SoModelInfo obj = new SoModelInfo(); - - obj.setModelCustomizationId("modelCustomizationId"); - assertEquals("modelCustomizationId", obj.getModelCustomizationId()); - - obj.setModelCustomizationName("modelCustomizationName"); - assertEquals("modelCustomizationName", obj.getModelCustomizationName()); - - obj.setModelInvariantId("modelInvariantId"); - assertEquals("modelInvariantId", obj.getModelInvariantId()); - - obj.setModelName("modelName"); - assertEquals("modelName", obj.getModelName()); - - obj.setModelType("modelType"); - assertEquals("modelType", obj.getModelType()); - - obj.setModelVersion("modelVersion"); - assertEquals("modelVersion", obj.getModelVersion()); - - obj.setModelVersionId("modelVersionId"); - assertEquals("modelVersionId", obj.getModelVersionId()); - - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java deleted file mode 100755 index 00dfb8dc6..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017, 2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class SoPolicyExceptionHolderTest { - - @Test - public void testConstructor() { - SoPolicyExceptionHolder obj = new SoPolicyExceptionHolder(); - - assertTrue(obj.getMessageId() == null); - assertTrue(obj.getText() == null); - } - - @Test - public void testSetGet() { - SoPolicyExceptionHolder obj = new SoPolicyExceptionHolder(); - - obj.setMessageId("messageId"); - assertEquals("messageId", obj.getMessageId()); - - obj.setText("text"); - assertEquals("text", obj.getText()); - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java deleted file mode 100755 index c73a0ea05..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * - * Modifications Copyright (C) 2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class SoRelatedInstanceListElementTest { - - @Test - public void testConstructor() { - SoRelatedInstanceListElement obj = new SoRelatedInstanceListElement(); - - assertTrue(obj.getRelatedInstance() == null); - } - - @Test - public void testSetGet() { - SoRelatedInstanceListElement obj = new SoRelatedInstanceListElement(); - - SoRelatedInstance relatedInstance = new SoRelatedInstance(); - obj.setRelatedInstance(relatedInstance); - assertEquals(relatedInstance, obj.getRelatedInstance()); - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java deleted file mode 100755 index 70f585efe..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2017, 2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class SoRelatedInstanceTest { - - @Test - public void testConstructor() { - SoRelatedInstance obj = new SoRelatedInstance(); - - assertTrue(obj.getInstanceId() == null); - assertTrue(obj.getInstanceName() == null); - assertTrue(obj.getModelInfo() == null); - } - - @Test - public void testSetGet() { - SoRelatedInstance obj = new SoRelatedInstance(); - - obj.setInstanceId("instanceId"); - assertEquals("instanceId", obj.getInstanceId()); - - obj.setInstanceName("instanceName"); - assertEquals("instanceName", obj.getInstanceName()); - - SoModelInfo modelInfo = new SoModelInfo(); - obj.setModelInfo(modelInfo); - assertEquals(modelInfo, obj.getModelInfo()); - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java deleted file mode 100755 index 7233482f6..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java +++ /dev/null @@ -1,176 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2018 Ericsson. All rights reserved. - * ================================================================================ - * Modifications Copyright (C) 2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; - -public class SoRequestDetailsTest { - - @Test - public void testConstructor() { - SoRequestDetails obj = new SoRequestDetails(); - - assertTrue(obj.getCloudConfiguration() == null); - assertTrue(obj.getModelInfo() == null); - assertTrue(obj.getRequestInfo() == null); - assertTrue(obj.getRequestParameters() == null); - assertTrue(obj.getSubscriberInfo() == null); - - assertTrue(obj.getRelatedInstanceList() != null); - assertEquals(0, obj.getRelatedInstanceList().size()); - } - - @Test - public void testSetGet() { - SoRequestDetails obj = new SoRequestDetails(); - - SoCloudConfiguration cloudConfiguration = new SoCloudConfiguration(); - obj.setCloudConfiguration(cloudConfiguration); - assertEquals(cloudConfiguration, obj.getCloudConfiguration()); - - SoModelInfo modelInfo = new SoModelInfo(); - obj.setModelInfo(modelInfo); - assertEquals(modelInfo, obj.getModelInfo()); - - SoRequestInfo requestInfo = new SoRequestInfo(); - obj.setRequestInfo(requestInfo); - assertEquals(requestInfo, obj.getRequestInfo()); - - SoRequestParameters requestParameters = new SoRequestParameters(); - obj.setRequestParameters(requestParameters); - assertEquals(requestParameters, obj.getRequestParameters()); - - SoSubscriberInfo subscriberInfo = new SoSubscriberInfo(); - obj.setSubscriberInfo(subscriberInfo); - assertEquals(subscriberInfo, obj.getSubscriberInfo()); - } - - @Test - public void testSoMRequestDetailsMethods() { - SoRequestDetails details = new SoRequestDetails(); - assertNotNull(details); - assertNotEquals(0, details.hashCode()); - - SoCloudConfiguration cloudConfiguration = new SoCloudConfiguration(); - details.setCloudConfiguration(cloudConfiguration); - assertEquals(cloudConfiguration, details.getCloudConfiguration()); - assertNotEquals(0, details.hashCode()); - - SoModelInfo modelInfo = new SoModelInfo(); - details.setModelInfo(modelInfo); - assertEquals(modelInfo, details.getModelInfo()); - assertNotEquals(0, details.hashCode()); - - List relatedInstanceList = new ArrayList<>(); - details.setRelatedInstanceList(relatedInstanceList); - assertEquals(relatedInstanceList, details.getRelatedInstanceList()); - assertNotEquals(0, details.hashCode()); - - SoRequestInfo requestInfo = new SoRequestInfo(); - details.setRequestInfo(requestInfo); - assertEquals(requestInfo, details.getRequestInfo()); - assertNotEquals(0, details.hashCode()); - - SoRequestParameters requestParameters = new SoRequestParameters(); - details.setRequestParameters(requestParameters); - assertEquals(requestParameters, details.getRequestParameters()); - assertNotEquals(0, details.hashCode()); - - SoSubscriberInfo subscriberInfo = new SoSubscriberInfo(); - details.setSubscriberInfo(subscriberInfo); - assertEquals(subscriberInfo, details.getSubscriberInfo()); - assertNotEquals(0, details.hashCode()); - - assertEquals("SORequestDetails [modelInfo=org.onap.policy.so", details.toString().substring(0, 46)); - - SoRequestDetails copiedDetails = new SoRequestDetails(details); - - assertTrue(details.equals(details)); - assertTrue(details.equals(copiedDetails)); - assertFalse(details.equals(null)); - assertFalse(details.equals("Hello")); - - details.setCloudConfiguration(null); - assertFalse(details.equals(copiedDetails)); - copiedDetails.setCloudConfiguration(null); - assertTrue(details.equals(copiedDetails)); - details.setCloudConfiguration(cloudConfiguration); - assertFalse(details.equals(copiedDetails)); - copiedDetails.setCloudConfiguration(cloudConfiguration); - assertTrue(details.equals(copiedDetails)); - - details.setModelInfo(null); - assertFalse(details.equals(copiedDetails)); - copiedDetails.setModelInfo(null); - assertTrue(details.equals(copiedDetails)); - details.setModelInfo(modelInfo); - assertFalse(details.equals(copiedDetails)); - copiedDetails.setModelInfo(modelInfo); - assertTrue(details.equals(copiedDetails)); - - details.setRequestInfo(null); - assertFalse(details.equals(copiedDetails)); - copiedDetails.setRequestInfo(null); - assertTrue(details.equals(copiedDetails)); - details.setRequestInfo(requestInfo); - assertFalse(details.equals(copiedDetails)); - copiedDetails.setRequestInfo(requestInfo); - assertTrue(details.equals(copiedDetails)); - - details.setRequestParameters(null); - assertFalse(details.equals(copiedDetails)); - copiedDetails.setRequestParameters(null); - assertTrue(details.equals(copiedDetails)); - details.setRequestParameters(requestParameters); - assertFalse(details.equals(copiedDetails)); - copiedDetails.setRequestParameters(requestParameters); - assertTrue(details.equals(copiedDetails)); - - details.setSubscriberInfo(null); - assertFalse(details.equals(copiedDetails)); - copiedDetails.setSubscriberInfo(null); - assertTrue(details.equals(copiedDetails)); - details.setSubscriberInfo(subscriberInfo); - assertFalse(details.equals(copiedDetails)); - copiedDetails.setSubscriberInfo(subscriberInfo); - assertTrue(details.equals(copiedDetails)); - - details.setRelatedInstanceList(null); - assertFalse(details.equals(copiedDetails)); - copiedDetails.setRelatedInstanceList(null); - assertTrue(details.equals(copiedDetails)); - details.setRelatedInstanceList(relatedInstanceList); - assertFalse(details.equals(copiedDetails)); - copiedDetails.setRelatedInstanceList(relatedInstanceList); - assertTrue(details.equals(copiedDetails)); - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java deleted file mode 100755 index b870dbd99..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestErrorTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * - * Modifications Copyright (C) 2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class SoRequestErrorTest { - - @Test - public void testConstructor() { - SoRequestError obj = new SoRequestError(); - - assertTrue(obj.getPolicyException() == null); - assertTrue(obj.getServiceException() == null); - } - - @Test - public void testSetGet() { - SoRequestError obj = new SoRequestError(); - - SoPolicyExceptionHolder policyException = new SoPolicyExceptionHolder(); - obj.setPolicyException(policyException); - assertEquals(policyException, obj.getPolicyException()); - - SoServiceExceptionHolder serviceException = new SoServiceExceptionHolder(); - obj.setServiceException(serviceException); - assertEquals(serviceException, obj.getServiceException()); - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestInfoTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestInfoTest.java deleted file mode 100755 index 0e518018b..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestInfoTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * - * Modifications Copyright (C) 2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class SoRequestInfoTest { - - @Test - public void testConstructor() { - SoRequestInfo obj = new SoRequestInfo(); - - assertTrue(obj.getBillingAccountNumber() == null); - assertTrue(obj.getCallbackUrl() == null); - assertTrue(obj.getCorrelator() == null); - assertTrue(obj.getInstanceName() == null); - assertTrue(obj.getOrderNumber() == null); - assertTrue(obj.getOrderVersion() == null); - assertTrue(obj.getProductFamilyId() == null); - assertTrue(obj.getRequestorId() == null); - assertTrue(obj.getSource() == null); - assertTrue(obj.isSuppressRollback() == false); - } - - @Test - public void testSetGet() { - SoRequestInfo obj = new SoRequestInfo(); - - obj.setBillingAccountNumber("billingAccountNumber"); - assertEquals("billingAccountNumber", obj.getBillingAccountNumber()); - - obj.setCallbackUrl("callbackUrl"); - assertEquals("callbackUrl", obj.getCallbackUrl()); - - obj.setCorrelator("correlator"); - assertEquals("correlator", obj.getCorrelator()); - - obj.setInstanceName("instanceName"); - assertEquals("instanceName", obj.getInstanceName()); - - obj.setOrderNumber("orderNumber"); - assertEquals("orderNumber", obj.getOrderNumber()); - - int orderVersion = 2008; - obj.setOrderVersion(orderVersion); - assertEquals((Integer) orderVersion, obj.getOrderVersion()); - - obj.setProductFamilyId("productFamilyId"); - assertEquals("productFamilyId", obj.getProductFamilyId()); - - obj.setRequestorId("requestorId"); - assertEquals("requestorId", obj.getRequestorId()); - - obj.setSource("source"); - assertEquals("source", obj.getSource()); - - obj.setSuppressRollback(true); - assertEquals(true, obj.isSuppressRollback()); - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java deleted file mode 100755 index 7d671f5e1..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestParametersTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * - * Modifications Copyright (C) 2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class SoRequestParametersTest { - - @Test - public void testConstructor() { - SoRequestParameters obj = new SoRequestParameters(); - - assertTrue(obj.getSubscriptionServiceType() == null); - assertTrue(obj.getUserParams() != null); - assertEquals(0, obj.getUserParams().size()); - } - - @Test - public void testSetGet() { - SoRequestParameters obj = new SoRequestParameters(); - - obj.setSubscriptionServiceType("subscriptionServiceType"); - assertEquals("subscriptionServiceType", obj.getSubscriptionServiceType()); - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java deleted file mode 100755 index 549147e4b..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestReferencesTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * - * Modifications Copyright (C) 2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class SoRequestReferencesTest { - - @Test - public void testConstructor() { - SoRequestReferences obj = new SoRequestReferences(); - - assertTrue(obj.getInstanceId() == null); - assertTrue(obj.getRequestId() == null); - } - - @Test - public void testSetGet() { - SoRequestReferences obj = new SoRequestReferences(); - - obj.setInstanceId("instanceId"); - assertEquals("instanceId", obj.getInstanceId()); - - obj.setRequestId("requestId"); - assertEquals("requestId", obj.getRequestId()); - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java deleted file mode 100755 index 39a3241a3..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestStatusTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * - * Modifications Copyright (C) 2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class SoRequestStatusTest { - - @Test - public void testConstructor() { - SoRequestStatus obj = new SoRequestStatus(); - - assertEquals(0, obj.getPercentProgress()); - assertTrue(obj.getRequestState() == null); - assertTrue(obj.getTimestamp() == null); - assertFalse(obj.isWasRolledBack()); - } - - @Test - public void testSetGet() { - SoRequestStatus obj = new SoRequestStatus(); - - obj.setPercentProgress(2008); - assertEquals(2008, obj.getPercentProgress()); - - obj.setRequestState("requestState"); - assertEquals("requestState", obj.getRequestState()); - - obj.setTimestamp("timestamp"); - assertEquals("timestamp", obj.getTimestamp()); - - obj.setWasRolledBack(true); - assertTrue(obj.isWasRolledBack()); - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java deleted file mode 100755 index 971b1d190..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoRequestTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * - * Modifications Copyright (C) 2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.time.LocalDateTime; -import java.util.UUID; - -import org.junit.Test; - -public class SoRequestTest { - - @Test - public void testConstructor() { - SoRequest obj = new SoRequest(); - - assertTrue(obj.getFinishTime() == null); - assertTrue(obj.getRequestDetails() == null); - assertTrue(obj.getRequestId() == null); - assertTrue(obj.getRequestScope() == null); - assertTrue(obj.getRequestStatus() == null); - assertTrue(obj.getRequestType() == null); - assertTrue(obj.getStartTime() == null); - } - - @Test - public void testSetGet() { - SoRequest obj = new SoRequest(); - - LocalDateTime finishTime = LocalDateTime.now(); - obj.setFinishTime(finishTime); - assertEquals(finishTime, obj.getFinishTime()); - - UUID uuid = UUID.randomUUID(); - obj.setRequestId(uuid); - assertEquals(uuid, obj.getRequestId()); - - obj.setRequestScope("requestScope"); - assertEquals("requestScope", obj.getRequestScope()); - - SoRequestStatus requestStatus = new SoRequestStatus(); - obj.setRequestStatus(requestStatus); - assertEquals(requestStatus, obj.getRequestStatus()); - - obj.setRequestType("requestType"); - assertEquals("requestType", obj.getRequestType()); - - obj.setOperationType(SoOperationType.DELETE_VF_MODULE); - assertEquals(SoOperationType.DELETE_VF_MODULE, obj.getOperationType()); - - LocalDateTime startTime = LocalDateTime.now(); - obj.setStartTime(startTime.toString()); - assertEquals(startTime.toString(), obj.getStartTime()); - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java deleted file mode 100755 index c932ac969..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoResponseTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * - * Modifications Copyright (C) 2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class SoResponseTest { - - @Test - public void testConstructor() { - SoResponse obj = new SoResponse(); - - assertEquals(0, obj.getHttpResponseCode()); - assertTrue(obj.getRequest() == null); - assertTrue(obj.getRequestError() == null); - assertTrue(obj.getRequestReferences() == null); - } - - @Test - public void testSetGet() { - SoResponse obj = new SoResponse(); - - obj.setHttpResponseCode(2008); - assertEquals(2008, obj.getHttpResponseCode()); - - SoRequest request = new SoRequest(); - obj.setRequest(request); - assertEquals(request, obj.getRequest()); - - SoRequestError requestError = new SoRequestError(); - obj.setRequestError(requestError); - assertEquals(requestError, obj.getRequestError()); - - SoRequestReferences requestReferences = new SoRequestReferences(); - obj.setRequestReferences(requestReferences); - assertEquals(requestReferences, obj.getRequestReferences()); - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java deleted file mode 100755 index 26bd75d2a..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoResponseWrapperTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * Copyright (C) 2018-2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.UUID; - -import org.junit.Test; - -public class SoResponseWrapperTest { - - @Test - public void testConstructor() { - SoResponse response = new SoResponse(); - SoResponseWrapper obj = new SoResponseWrapper(response, "reqID"); - - assertEquals(response, obj.getSoResponse()); - assertEquals("reqID", obj.getRequestId()); - } - - @Test - public void testSetGet() { - SoResponse response = new SoResponse(); - SoResponseWrapper obj = new SoResponseWrapper(response, "reqID"); - - SoResponse response2 = new SoResponse(); - response2.setHttpResponseCode(2008); - obj.setSoResponse(response2); - assertEquals(response2, obj.getSoResponse()); - - obj.setRequestId("id2"); - assertEquals("id2", obj.getRequestId()); - } - - @Test - public void testSoResponseWrapperMethods() { - String requestId = UUID.randomUUID().toString(); - SoResponse response = new SoResponse(); - - SoResponseWrapper responseWrapper = new SoResponseWrapper(response, requestId); - assertNotNull(responseWrapper); - assertNotEquals(0, responseWrapper.hashCode()); - - assertEquals(response, responseWrapper.getSoResponse()); - - assertNotEquals(0, responseWrapper.hashCode()); - - assertEquals("SOResponseWrapper [SOResponse=org.onap.policy.", responseWrapper.toString().substring(0, 46)); - - SoResponseWrapper identicalResponseWrapper = new SoResponseWrapper(response, requestId); - - assertEquals(responseWrapper, responseWrapper); - assertEquals(responseWrapper, identicalResponseWrapper); - assertNotEquals(null, responseWrapper); - assertNotEquals("Hello", responseWrapper); - assertFalse(responseWrapper.equals(null)); - assertFalse(responseWrapper.equals("AString")); - - assertEquals(new SoResponseWrapper(null, null), new SoResponseWrapper(null, null)); - assertNotEquals(new SoResponseWrapper(null, null), identicalResponseWrapper); - - assertNotEquals(0, new SoResponseWrapper(null, null).hashCode()); - - identicalResponseWrapper.setSoResponse(new SoResponse()); - assertNotEquals(responseWrapper, identicalResponseWrapper); - identicalResponseWrapper.setSoResponse(response); - assertEquals(responseWrapper, identicalResponseWrapper); - - identicalResponseWrapper.setRequestId(UUID.randomUUID().toString()); - assertNotEquals(responseWrapper, identicalResponseWrapper); - identicalResponseWrapper.setRequestId(requestId); - assertEquals(responseWrapper, identicalResponseWrapper); - - responseWrapper.setRequestId(null); - assertNotEquals(responseWrapper, identicalResponseWrapper); - identicalResponseWrapper.setRequestId(null); - assertEquals(responseWrapper, identicalResponseWrapper); - responseWrapper.setRequestId(requestId); - assertNotEquals(responseWrapper, identicalResponseWrapper); - identicalResponseWrapper.setRequestId(requestId); - assertEquals(responseWrapper, identicalResponseWrapper); - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java deleted file mode 100755 index 8c9d3a730..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoServiceExceptionHolderTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * - * Modifications Copyright (C) 2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class SoServiceExceptionHolderTest { - - @Test - public void testConstructor() { - SoServiceExceptionHolder obj = new SoServiceExceptionHolder(); - - assertTrue(obj.getMessageId() == null); - assertTrue(obj.getText() == null); - assertTrue(obj.getVariables() != null); - assertEquals(0, obj.getVariables().size()); - } - - @Test - public void testSetGet() { - SoServiceExceptionHolder obj = new SoServiceExceptionHolder(); - - obj.setMessageId("messageId"); - assertEquals("messageId", obj.getMessageId()); - - obj.setText("text"); - assertEquals("text", obj.getText()); - } -} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java deleted file mode 100755 index e68e74e3f..000000000 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/SoSubscriberInfoTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * so - * ================================================================================ - * - * Modifications Copyright (C) 2019 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.so; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class SoSubscriberInfoTest { - - @Test - public void testConstructor() { - SoSubscriberInfo obj = new SoSubscriberInfo(); - - assertTrue(obj.getGlobalSubscriberId() == null); - assertTrue(obj.getSubscriberCommonSiteId() == null); - assertTrue(obj.getSubscriberName() == null); - } - - @Test - public void testSetGet() { - SoSubscriberInfo obj = new SoSubscriberInfo(); - - obj.setGlobalSubscriberId("globalSubscriberId"); - assertEquals("globalSubscriberId", obj.getGlobalSubscriberId()); - - obj.setSubscriberCommonSiteId("subscriberCommonSiteId"); - assertEquals("subscriberCommonSiteId", obj.getSubscriberCommonSiteId()); - - obj.setSubscriberName("subscriberName"); - assertEquals("subscriberName", obj.getSubscriberName()); - } -} diff --git a/controlloop/common/model-impl/trafficgenerator/pom.xml b/controlloop/common/model-impl/trafficgenerator/pom.xml deleted file mode 100644 index 922da378f..000000000 --- a/controlloop/common/model-impl/trafficgenerator/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - 4.0.0 - - - org.onap.policy.drools-applications.controlloop.common.model-impl - model-impl - 1.4.0-SNAPSHOT - - - trafficgenerator - - - - junit - junit - test - - - com.google.code.gson - gson - provided - - - - - - - maven-checkstyle-plugin - - - onap-java-style - - check - - process-sources - - - onap-checkstyle/onap-java-style.xml - - ${project.build.sourceDirectory} - true - true - true - - - true - true - warning - - - - - - org.onap.oparent - checkstyle - ${oparent.version} - compile - - - - - - diff --git a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgRequest.java b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgRequest.java deleted file mode 100644 index 026d7d9cc..000000000 --- a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgRequest.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * trafficgenerator - * ================================================================================ - * Copyright (C) 2017-2019 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.vnf.trafficgenerator; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class PgRequest implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("pg-streams") - public PgStreams pgStreams; - - public PgRequest() { - //required by author - } -} diff --git a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgStream.java b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgStream.java deleted file mode 100644 index 499d20f96..000000000 --- a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgStream.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * trafficgenerator - * ================================================================================ - * Copyright (C) 2017-2019 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.vnf.trafficgenerator; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class PgStream implements Serializable { - - private static final long serialVersionUID = 5567635677419358210L; - - @SerializedName("id") - public String streamId; - @SerializedName("is-enabled") - public String isEnabled; - - public PgStream() { - //required by author - } -} diff --git a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgStreams.java b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgStreams.java deleted file mode 100644 index 566a9eed0..000000000 --- a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgStreams.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * trafficgenerator - * ================================================================================ - * Copyright (C) 2017-2019 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.vnf.trafficgenerator; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; - -public class PgStreams implements Serializable { - - private static final long serialVersionUID = 5567635677419358210L; - - @SerializedName("pg-stream") - public List pgStream = new LinkedList<>(); - - public PgStreams() { - // required by author - } -} diff --git a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/util/Serialization.java b/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/util/Serialization.java deleted file mode 100644 index 3443bfcdf..000000000 --- a/controlloop/common/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/util/Serialization.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * trafficgenerator - * ================================================================================ - * 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.vnf.trafficgenerator.util; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -public final class Serialization { - - public static final Gson gsonPretty = - new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create(); - - private Serialization() {} -} diff --git a/controlloop/common/model-impl/trafficgenerator/src/test/java/org/onap/policy/vnf/trafficgenerator/DemoTest.java b/controlloop/common/model-impl/trafficgenerator/src/test/java/org/onap/policy/vnf/trafficgenerator/DemoTest.java deleted file mode 100644 index 963bf0b99..000000000 --- a/controlloop/common/model-impl/trafficgenerator/src/test/java/org/onap/policy/vnf/trafficgenerator/DemoTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * trafficgenerator - * ================================================================================ - * Copyright (C) 2017-2019 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.vnf.trafficgenerator; - -import org.junit.Test; - -import org.onap.policy.vnf.trafficgenerator.PgRequest; -import org.onap.policy.vnf.trafficgenerator.PgStream; -import org.onap.policy.vnf.trafficgenerator.PgStreams; -import org.onap.policy.vnf.trafficgenerator.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class DemoTest { - private static final Logger logger = LoggerFactory.getLogger(DemoTest.class); - - @Test - public void test() { - PgRequest request = new PgRequest(); - request.pgStreams = new PgStreams(); - - PgStream pgStream; - for (int i = 0; i < 5; i++) { - pgStream = new PgStream(); - pgStream.streamId = "fw_udp" + (i + 1); - pgStream.isEnabled = "true"; - request.pgStreams.pgStream.add(pgStream); - } - - String body = Serialization.gsonPretty.toJson(request); - logger.debug(body); - - // fail("Not yet implemented"); - } - -} diff --git a/controlloop/common/model-impl/vfc/pom.xml b/controlloop/common/model-impl/vfc/pom.xml deleted file mode 100644 index 1df42831b..000000000 --- a/controlloop/common/model-impl/vfc/pom.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - 4.0.0 - - - org.onap.policy.drools-applications.controlloop.common.model-impl - model-impl - 1.4.0-SNAPSHOT - - - vfc - - - - junit - junit - test - - - org.mockito - mockito-core - 2.13.0 - test - - - com.google.code.gson - gson - provided - - - org.onap.policy.drools-applications.controlloop.common.model-impl - rest - ${project.version} - - - org.drools - drools-core - 6.5.0.Final - provided - - - org.onap.policy.common - policy-endpoints - ${version.policy.common} - provided - - - org.onap.policy.drools-pdp - policy-management - ${version.policy.drools-pdp} - provided - - - - - - maven-checkstyle-plugin - - - onap-java-style - - check - - process-sources - - - onap-checkstyle/onap-java-style.xml - - ${project.build.sourceDirectory} - true - true - true - - - true - true - warning - - - - - - org.onap.oparent - checkstyle - ${oparent.version} - compile - - - - - - diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealActionVmInfo.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealActionVmInfo.java deleted file mode 100644 index c154f7226..000000000 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealActionVmInfo.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2017 Intel Corp. All rights reserved. - * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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.vfc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class VfcHealActionVmInfo implements Serializable { - - private static final long serialVersionUID = 3208673205100673119L; - - @SerializedName("vmid") - private String vmid; - - @SerializedName("vmname") - private String vmname; - - public VfcHealActionVmInfo() { - // Default constructor - } - - public String getVmid() { - return vmid; - } - - public void setVmid(String vmid) { - this.vmid = vmid; - } - - public String getVmname() { - return vmname; - } - - public void setVmname(String vmname) { - this.vmname = vmname; - } -} diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealAdditionalParams.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealAdditionalParams.java deleted file mode 100644 index 2c5de3a22..000000000 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealAdditionalParams.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2017 Intel Corp. All rights reserved. - * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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.vfc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class VfcHealAdditionalParams implements Serializable { - - private static final long serialVersionUID = 2656694137285096191L; - - @SerializedName("action") - private String action; - - @SerializedName("actionvminfo") - private VfcHealActionVmInfo actionInfo; - - public VfcHealAdditionalParams() { - // Default constructor - } - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - - public VfcHealActionVmInfo getActionInfo() { - return actionInfo; - } - - public void setActionInfo(VfcHealActionVmInfo actionInfo) { - this.actionInfo = actionInfo; - } -} diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealRequest.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealRequest.java deleted file mode 100644 index 55ca4ac5c..000000000 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcHealRequest.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2017 Intel Corp. All rights reserved. - * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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.vfc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class VfcHealRequest implements Serializable { - - private static final long serialVersionUID = -7341931593089709247L; - - @SerializedName("vnfInstanceId") - private String vnfInstanceId; - - @SerializedName("cause") - private String cause; - - @SerializedName("additionalParams") - private VfcHealAdditionalParams additionalParams; - - public VfcHealRequest() { - // Default constructor - } - - public String getVnfInstanceId() { - return vnfInstanceId; - } - - public void setVnfInstanceId(String vnfInstanceId) { - this.vnfInstanceId = vnfInstanceId; - } - - public String getCause() { - return cause; - } - - public void setCause(String cause) { - this.cause = cause; - } - - public VfcHealAdditionalParams getAdditionalParams() { - return additionalParams; - } - - public void setAdditionalParams(VfcHealAdditionalParams additionalParams) { - this.additionalParams = additionalParams; - } -} 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 deleted file mode 100644 index 7cea2f181..000000000 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcManager.java +++ /dev/null @@ -1,190 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2017-2018 Intel Corp, AT&T. All rights reserved. - * Modifications Copyright (C) 2018-2019 AT&T Corporation. All rights reserved. - * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd. - * ================================================================================ - * 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.vfc; - -import com.google.gson.JsonSyntaxException; - -import java.util.HashMap; -import java.util.Map; - -import org.drools.core.WorkingMemory; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; -import org.onap.policy.drools.system.PolicyEngine; -import org.onap.policy.rest.RestManager; -import org.onap.policy.rest.RestManager.Pair; -import org.onap.policy.vfc.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public final class VfcManager implements Runnable { - - private String vfcUrlBase; - private String username; - private String password; - private VfcRequest vfcRequest; - private WorkingMemory workingMem; - private static final Logger logger = LoggerFactory.getLogger(VfcManager.class); - - // The REST manager used for processing REST calls for this VFC manager - private RestManager restManager; - - /** - * Constructor. - * - * @param wm Drools working memory - * @param request request - */ - public VfcManager(WorkingMemory wm, VfcRequest request) { - if (wm == null || request == null) { - throw new IllegalArgumentException( - "the parameters \"wm\" and \"request\" on the VfcManager constructor may not be null"); - } - workingMem = wm; - vfcRequest = request; - - restManager = new RestManager(); - - // use getPEManagerEnvProperty() for required properties; others are optional - setVfcParams(getPeManagerEnvProperty("vfc.url"), PolicyEngine.manager.getEnvironmentProperty("vfc.username"), - PolicyEngine.manager.getEnvironmentProperty("vfc.password")); - } - - /** - * Set the parameters. - * - * @param baseUrl base URL - * @param name username - * @param pwd password - */ - public void setVfcParams(String baseUrl, String name, String pwd) { - vfcUrlBase = baseUrl + "/api/nslcm/v1"; - username = name; - password = pwd; - } - - @Override - public void run() { - Map headers = new HashMap<>(); - Pair httpDetails; - - VfcResponse responseError = new VfcResponse(); - responseError.setResponseDescriptor(new VfcResponseDescriptor()); - responseError.getResponseDescriptor().setStatus("error"); - - headers.put("Accept", "application/json"); - String vfcUrl = vfcUrlBase + "/ns/" + vfcRequest.getNsInstanceId() + "/heal"; - try { - String vfcRequestJson = Serialization.gsonPretty.toJson(vfcRequest); - NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, vfcUrl, vfcRequestJson); - - httpDetails = restManager.post(vfcUrl, username, password, headers, "application/json", vfcRequestJson); - } catch (Exception e) { - logger.error(e.getMessage(), e); - workingMem.insert(responseError); - return; - } - - if (httpDetails == null) { - workingMem.insert(responseError); - return; - } - - if (httpDetails.first != 202) { - logger.warn("VFC Heal Restcall failed"); - return; - } - - try { - VfcResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, VfcResponse.class); - NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, vfcUrl, httpDetails.second); - String body = Serialization.gsonPretty.toJson(response); - logger.debug("Response to VFC Heal post:"); - logger.debug(body); - - String jobId = response.getJobId(); - int attemptsLeft = 20; - - String urlGet = vfcUrlBase + "/jobs/" + jobId; - VfcResponse responseGet = null; - - while (attemptsLeft-- > 0) { - NetLoggerUtil.getNetworkLogger().info("[OUT|{}|{}|]", "VFC", urlGet); - Pair httpDetailsGet = restManager.get(urlGet, username, password, headers); - responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.second, VfcResponse.class); - NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, vfcUrl, httpDetailsGet.second); - responseGet.setRequestId(vfcRequest.getRequestId().toString()); - body = Serialization.gsonPretty.toJson(responseGet); - logger.debug("Response to VFC Heal get:"); - logger.debug(body); - - String responseStatus = responseGet.getResponseDescriptor().getStatus(); - if (httpDetailsGet.first == 200 - && ("finished".equalsIgnoreCase(responseStatus) || "error".equalsIgnoreCase(responseStatus))) { - logger.debug("VFC Heal Status {}", responseGet.getResponseDescriptor().getStatus()); - workingMem.insert(responseGet); - break; - } - Thread.sleep(20000); - } - if ((attemptsLeft <= 0) && (responseGet != null) && (responseGet.getResponseDescriptor() != null) - && (responseGet.getResponseDescriptor().getStatus() != null) - && (!responseGet.getResponseDescriptor().getStatus().isEmpty())) { - logger.debug("VFC timeout. Status: ({})", responseGet.getResponseDescriptor().getStatus()); - workingMem.insert(responseGet); - } - } catch (JsonSyntaxException e) { - logger.error("Failed to deserialize into VfcResponse {}", e.getLocalizedMessage(), e); - } catch (InterruptedException e) { - logger.error("Interrupted exception: {}", e.getLocalizedMessage(), e); - Thread.currentThread().interrupt(); - } catch (Exception e) { - logger.error("Unknown error deserializing into VfcResponse {}", e.getLocalizedMessage(), e); - } - } - - /** - * Protected setter for rest manager to allow mocked rest manager to be used for testing. - * - * @param restManager the test REST manager - */ - protected void setRestManager(final RestManager restManager) { - this.restManager = restManager; - } - - /** - * This method reads and validates environmental properties coming from the policy engine. Null - * properties cause an {@link IllegalArgumentException} runtime exception to be thrown - * - * @param string the name of the parameter to retrieve - * @return the property value - */ - - private String getPeManagerEnvProperty(String enginePropertyName) { - String enginePropertyValue = PolicyEngine.manager.getEnvironmentProperty(enginePropertyName); - if (enginePropertyValue == null) { - throw new IllegalArgumentException("The value of policy engine manager environment property \"" - + enginePropertyName + "\" may not be null"); - } - return enginePropertyValue; - } -} diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcRequest.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcRequest.java deleted file mode 100644 index c4473e7f1..000000000 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcRequest.java +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2017 Intel Corp. All rights reserved. - * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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.vfc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.UUID; - -public class VfcRequest implements Serializable { - - private static final long serialVersionUID = 3736300970326332512L; - // These fields are not serialized and not part of JSON - private transient String nsInstanceId; - private transient UUID requestId; - - @SerializedName("healVnfData") - private VfcHealRequest healRequest; - - public VfcRequest() { - // Default constructor - } - - public String getNsInstanceId() { - return nsInstanceId; - } - - public void setNsInstanceId(String nsInstanceId) { - this.nsInstanceId = nsInstanceId; - } - - public UUID getRequestId() { - return requestId; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public VfcHealRequest getHealRequest() { - return healRequest; - } - - public void setHealRequest(VfcHealRequest healRequest) { - this.healRequest = healRequest; - } -} diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcResponse.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcResponse.java deleted file mode 100644 index 2183be71b..000000000 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcResponse.java +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2017 Intel Corp. All rights reserved. - * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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.vfc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class VfcResponse implements Serializable { - - private static final long serialVersionUID = 9151443891238218455L; - - @SerializedName("jobId") - private String jobId; - - @SerializedName("responseDescriptor") - private VfcResponseDescriptor responseDescriptor; - - private transient String requestId; - - public VfcResponse() { - // Default constructor - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public VfcResponseDescriptor getResponseDescriptor() { - return responseDescriptor; - } - - public void setResponseDescriptor(VfcResponseDescriptor responseDescriptor) { - this.responseDescriptor = responseDescriptor; - } - - public String getRequestId() { - return requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } -} diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcResponseDescriptor.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcResponseDescriptor.java deleted file mode 100644 index 147b937dc..000000000 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcResponseDescriptor.java +++ /dev/null @@ -1,100 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2017 Intel Corp. All rights reserved. - * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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.vfc; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.List; - -public class VfcResponseDescriptor implements Serializable { - - private static final long serialVersionUID = 6827782899144150158L; - - @SerializedName("progress") - private String progress; - - @SerializedName("status") - private String status; - - @SerializedName("statusDescription") - private String statusDescription; - - @SerializedName("errorCode") - private String errorCode; - - @SerializedName("responseId") - private String responseId; - - @SerializedName("responseHistoryList") - private List responseHistoryList; - - public VfcResponseDescriptor() { - // Default constructor - } - - public String getStatus() { - return status; - } - - public String getProgress() { - return progress; - } - - public void setProgress(String progress) { - this.progress = progress; - } - - public String getStatusDescription() { - return statusDescription; - } - - public void setStatusDescription(String statusDescription) { - this.statusDescription = statusDescription; - } - - public String getErrorCode() { - return errorCode; - } - - public void setErrorCode(String errorCode) { - this.errorCode = errorCode; - } - - public String getResponseId() { - return responseId; - } - - public void setResponseId(String responseId) { - this.responseId = responseId; - } - - public List getResponseHistoryList() { - return responseHistoryList; - } - - public void setResponseHistoryList(List responseHistoryList) { - this.responseHistoryList = responseHistoryList; - } - - public void setStatus(String status) { - this.status = status; - } -} diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java deleted file mode 100644 index 19aca3aae..000000000 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2017-2018 Intel Corp. All rights reserved. - * Modifications Copyright (C) 2018 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.vfc.util; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -public final class Serialization { - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping() - .setPrettyPrinting() - .create(); - - private Serialization() { - } - -} diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/DemoTest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/DemoTest.java deleted file mode 100644 index d334d232f..000000000 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/DemoTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2017 Intel Corp. All rights reserved. - * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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.vfc; - -import java.util.LinkedList; - -import org.junit.Test; -import org.onap.policy.vfc.util.Serialization; - -public class DemoTest { - - @Test - public void test() { - VfcRequest request = new VfcRequest(); - - request.setNsInstanceId("100"); - request.setHealRequest(new VfcHealRequest()); - request.getHealRequest().setVnfInstanceId("1"); - request.getHealRequest().setCause("vm is down"); - - request.getHealRequest().setAdditionalParams(new VfcHealAdditionalParams()); - request.getHealRequest().getAdditionalParams().setAction("restartvm"); - - request.getHealRequest().getAdditionalParams().setActionInfo(new VfcHealActionVmInfo()); - request.getHealRequest().getAdditionalParams().getActionInfo().setVmid("33"); - request.getHealRequest().getAdditionalParams().getActionInfo().setVmname("xgw-smp11"); - - String body = Serialization.gsonPretty.toJson(request); - System.out.println(body); - - VfcResponse response = new VfcResponse(); - response.setJobId("1"); - - body = Serialization.gsonPretty.toJson(response); - System.out.println(body); - - response.setResponseDescriptor(new VfcResponseDescriptor()); - response.getResponseDescriptor().setProgress("40"); - response.getResponseDescriptor().setStatus("processing"); - response.getResponseDescriptor().setStatusDescription("OMC VMs are decommissioned in VIM"); - response.getResponseDescriptor().setErrorCode(null); - response.getResponseDescriptor().setResponseId("42"); - body = Serialization.gsonPretty.toJson(response); - System.out.println(body); - - VfcResponseDescriptor responseDescriptor = new VfcResponseDescriptor(); - responseDescriptor.setProgress("20"); - responseDescriptor.setStatus("processing"); - responseDescriptor.setStatusDescription("OMC VMs are decommissioned in VIM"); - responseDescriptor.setErrorCode(null); - responseDescriptor.setResponseId("11"); - - response.getResponseDescriptor().setResponseHistoryList(new LinkedList<>()); - response.getResponseDescriptor().getResponseHistoryList().add(responseDescriptor); - - body = Serialization.gsonPretty.toJson(response); - System.out.println(body); - - response = Serialization.gsonPretty.fromJson(body, VfcResponse.class); - body = Serialization.gsonPretty.toJson(response); - System.out.println(body); - - } -} diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealActionVmInfoTest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealActionVmInfoTest.java deleted file mode 100644 index 8b5b118d2..000000000 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealActionVmInfoTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * vfc - * ================================================================================ - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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.vfc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class VfcHealActionVmInfoTest { - - @Test - public void testVfcHealActionVmInfo() { - VfcHealActionVmInfo actionInfo = new VfcHealActionVmInfo(); - assertNotNull(actionInfo); - assertNotEquals(0, actionInfo.hashCode()); - - String vmid = "ECity"; - actionInfo.setVmid(vmid); - assertEquals(vmid, actionInfo.getVmid()); - - String vmName = "Emerald City"; - actionInfo.setVmname(vmName); - assertEquals(vmName, actionInfo.getVmname()); - - assertNotEquals(0, actionInfo.hashCode()); - } -} diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealAdditionalParamsTest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealAdditionalParamsTest.java deleted file mode 100644 index e7cb79fef..000000000 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealAdditionalParamsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * vfc - * ================================================================================ - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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.vfc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class VfcHealAdditionalParamsTest { - - @Test - public void testVfcHealAdditionalParameters() { - VfcHealAdditionalParams additionalParams = new VfcHealAdditionalParams(); - assertNotNull(additionalParams); - assertNotEquals(0, additionalParams.hashCode()); - - String action = "Go Home"; - additionalParams.setAction(action); - assertEquals(action, additionalParams.getAction()); - - VfcHealActionVmInfo actionInfo = new VfcHealActionVmInfo(); - additionalParams.setActionInfo(actionInfo ); - assertEquals(actionInfo, additionalParams.getActionInfo()); - - assertNotEquals(0, additionalParams.hashCode()); - } -} diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealRequestTest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealRequestTest.java deleted file mode 100644 index b67b9ac07..000000000 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcHealRequestTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * vfc - * ================================================================================ - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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.vfc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class VfcHealRequestTest { - - @Test - public void testVfcHealRequest() { - VfcHealRequest request = new VfcHealRequest(); - assertNotNull(request); - assertNotEquals(0, request.hashCode()); - - String vnfInstanceId = "Go To Oz"; - request.setVnfInstanceId(vnfInstanceId); - assertEquals(vnfInstanceId, request.getVnfInstanceId()); - - String cause = "West Witch"; - request.setCause(cause); - assertEquals(cause, request.getCause()); - - VfcHealAdditionalParams additionalParams = new VfcHealAdditionalParams(); - request.setAdditionalParams(additionalParams); - assertEquals(additionalParams, request.getAdditionalParams()); - - assertNotEquals(0, request.hashCode()); - } -} diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcManagerTest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcManagerTest.java deleted file mode 100644 index f9e6e8260..000000000 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcManagerTest.java +++ /dev/null @@ -1,293 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * vfc - * ================================================================================ - * Copyright (C) 2018 Ericsson, AT&T. All rights reserved. - * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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.vfc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.endsWith; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.startsWith; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import org.drools.core.WorkingMemory; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.drools.system.PolicyEngine; -import org.onap.policy.rest.RestManager; -import org.onap.policy.rest.RestManager.Pair; -import org.onap.policy.vfc.util.Serialization; - -public class VfcManagerTest { - private static WorkingMemory mockedWorkingMemory; - - private RestManager mockedRestManager; - - private Pair httpResponsePutOk; - private Pair httpResponseGetOk; - private Pair httpResponseBadResponse; - private Pair httpResponseErr; - - private VfcRequest request; - private VfcResponse response; - - @BeforeClass - public static void beforeTestVfcManager() { - mockedWorkingMemory = mock(WorkingMemory.class); - } - - /** - * Set up the mocked REST manager. - */ - @Before - public void setupMockedRest() { - mockedRestManager = mock(RestManager.class); - - httpResponsePutOk = mockedRestManager.new Pair<>(202, Serialization.gsonPretty.toJson(response)); - httpResponseGetOk = mockedRestManager.new Pair<>(200, Serialization.gsonPretty.toJson(response)); - httpResponseBadResponse = mockedRestManager.new Pair<>(202, Serialization.gsonPretty.toJson(null)); - httpResponseErr = mockedRestManager.new Pair<>(200, null); - } - - /** - * Create the request and response before. - */ - @Before - public void createRequestAndResponse() { - VfcHealActionVmInfo actionInfo = new VfcHealActionVmInfo(); - actionInfo.setVmid("TheWizard"); - actionInfo.setVmname("The Wizard of Oz"); - - VfcHealAdditionalParams additionalParams = new VfcHealAdditionalParams(); - additionalParams.setAction("Go Home"); - additionalParams.setActionInfo(actionInfo); - - VfcHealRequest healRequest = new VfcHealRequest(); - healRequest.setAdditionalParams(additionalParams); - healRequest.setCause("WestWitch"); - healRequest.setVnfInstanceId("EmeraldCity"); - - final UUID requestId = UUID.randomUUID(); - request = new VfcRequest(); - request.setHealRequest(healRequest); - request.setNsInstanceId("Dorothy"); - request.setRequestId(requestId); - - List responseHistoryList = new ArrayList<>();; - - VfcResponseDescriptor responseDescriptor = new VfcResponseDescriptor(); - responseDescriptor.setErrorCode("1234"); - responseDescriptor.setProgress("Follow The Yellow Brick Road"); - responseDescriptor.setResponseHistoryList(responseHistoryList); - responseDescriptor.setResponseId(UUID.randomUUID().toString()); - responseDescriptor.setStatus("finished"); - responseDescriptor.setStatusDescription("There's no place like home"); - - response = new VfcResponse(); - response.setJobId("1234"); - response.setRequestId(request.getRequestId().toString()); - response.setResponseDescriptor(responseDescriptor); - } - - /** - * Remove the environnment. - */ - @After - public void tearDown() { - PolicyEngine.manager.getEnvironment().remove("vfc.password"); - PolicyEngine.manager.getEnvironment().remove("vfc.username"); - PolicyEngine.manager.getEnvironment().remove("vfc.url"); - } - - @Test - public void testVfcInitiation() { - try { - new VfcManager(null, null); - fail("test should throw an exception here"); - } - catch (IllegalArgumentException e) { - assertEquals("the parameters \"wm\" and \"request\" on the VfcManager constructor may not be null", - e.getMessage()); - } - - try { - new VfcManager(mockedWorkingMemory, null); - fail("test should throw an exception here"); - } - catch (IllegalArgumentException e) { - assertEquals("the parameters \"wm\" and \"request\" on the VfcManager constructor may not be null", - e.getMessage()); - } - - try { - new VfcManager(mockedWorkingMemory, request); - fail("test should throw an exception here"); - } - catch (IllegalArgumentException e) { - assertEquals("The value of policy engine manager environment property \"vfc.url\" may not be null", - e.getMessage()); - } - - // add url; username & password are not required - PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow"); - new VfcManager(mockedWorkingMemory, request); - - // url & username, but no password - PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy"); - - // url, username, and password - PolicyEngine.manager.getEnvironment().put("vfc.password", "Toto"); - new VfcManager(mockedWorkingMemory, request); - } - - @Test - public void testVfcExecutionException() throws InterruptedException { - PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow"); - PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy"); - PolicyEngine.manager.getEnvironment().put("vfc.password", "Exception"); - - VfcManager manager = new VfcManager(mockedWorkingMemory, request); - manager.setRestManager(mockedRestManager); - - Thread managerThread = new Thread(manager); - managerThread.start(); - - when(mockedRestManager.post( - startsWith("http://somewhere.over.the.rainbow"), - eq("Dorothy"), - eq("Exception"), - anyMap(), - anyString(), - anyString())) - .thenThrow(new RuntimeException("OzException")); - - managerThread.join(); - - PolicyEngine.manager.getEnvironment().remove("vfc.password"); - PolicyEngine.manager.getEnvironment().remove("vfc.username"); - PolicyEngine.manager.getEnvironment().remove("vfc.url"); - } - - @Test - public void testVfcExecutionNull() throws InterruptedException { - PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow"); - PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy"); - PolicyEngine.manager.getEnvironment().put("vfc.password", "Null"); - - VfcManager manager = new VfcManager(mockedWorkingMemory, request); - manager.setRestManager(mockedRestManager); - - Thread managerThread = new Thread(manager); - managerThread.start(); - - when(mockedRestManager.post(startsWith("http://somewhere.over.the.rainbow"), - eq("Dorothy"), eq("Null"), anyMap(), anyString(), anyString())) - .thenReturn(null); - - managerThread.join(); - - PolicyEngine.manager.getEnvironment().remove("vfc.password"); - PolicyEngine.manager.getEnvironment().remove("vfc.username"); - PolicyEngine.manager.getEnvironment().remove("vfc.url"); - } - - @Test - public void testVfcExecutionError0() throws InterruptedException { - PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow"); - PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy"); - PolicyEngine.manager.getEnvironment().put("vfc.password", "Error0"); - - VfcManager manager = new VfcManager(mockedWorkingMemory, request); - manager.setRestManager(mockedRestManager); - - Thread managerThread = new Thread(manager); - managerThread.start(); - - when(mockedRestManager.post(startsWith("http://somewhere.over.the.rainbow"), - eq("Dorothy"), eq("Error0"), anyMap(), anyString(), anyString())) - .thenReturn(httpResponseErr); - - managerThread.join(); - - PolicyEngine.manager.getEnvironment().remove("vfc.password"); - PolicyEngine.manager.getEnvironment().remove("vfc.username"); - PolicyEngine.manager.getEnvironment().remove("vfc.url"); - } - - @Test - public void testVfcExecutionBadResponse() throws InterruptedException { - PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow"); - PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy"); - PolicyEngine.manager.getEnvironment().put("vfc.password", "BadResponse"); - - VfcManager manager = new VfcManager(mockedWorkingMemory, request); - manager.setRestManager(mockedRestManager); - - Thread managerThread = new Thread(manager); - managerThread.start(); - - when(mockedRestManager.post(startsWith("http://somewhere.over.the.rainbow"), - eq("Dorothy"), eq("OK"), anyMap(), anyString(), anyString())) - .thenReturn(httpResponseBadResponse); - - managerThread.join(); - - PolicyEngine.manager.getEnvironment().remove("vfc.password"); - PolicyEngine.manager.getEnvironment().remove("vfc.username"); - PolicyEngine.manager.getEnvironment().remove("vfc.url"); - } - - @Test - public void testVfcExecutionOk() throws InterruptedException { - PolicyEngine.manager.getEnvironment().put("vfc.url", "http://somewhere.over.the.rainbow"); - PolicyEngine.manager.getEnvironment().put("vfc.username", "Dorothy"); - PolicyEngine.manager.getEnvironment().put("vfc.password", "OK"); - - VfcManager manager = new VfcManager(mockedWorkingMemory, request); - manager.setRestManager(mockedRestManager); - - Thread managerThread = new Thread(manager); - managerThread.start(); - - when(mockedRestManager.post(startsWith("http://somewhere.over.the.rainbow"), - eq("Dorothy"), eq("OK"), anyMap(), anyString(), anyString())) - .thenReturn(httpResponsePutOk); - - when(mockedRestManager.get(endsWith("1234"), eq("Dorothy"), eq("OK"), anyMap())) - .thenReturn(httpResponseGetOk); - - managerThread.join(); - - PolicyEngine.manager.getEnvironment().remove("vfc.password"); - PolicyEngine.manager.getEnvironment().remove("vfc.username"); - PolicyEngine.manager.getEnvironment().remove("vfc.url"); - } -} diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcRequestTest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcRequestTest.java deleted file mode 100644 index 7dede1b7b..000000000 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcRequestTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * vfc - * ================================================================================ - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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.vfc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.UUID; - -import org.junit.Test; - -public class VfcRequestTest { - - @Test - public void testVfcRequest() { - VfcRequest request = new VfcRequest(); - assertNotNull(request); - assertNotEquals(0, request.hashCode()); - - String nsInstanceId = "Dorothy"; - request.setNsInstanceId(nsInstanceId); - assertEquals(nsInstanceId, request.getNsInstanceId()); - - UUID requestId = UUID.randomUUID(); - request.setRequestId(requestId); - assertEquals(requestId, request.getRequestId()); - - VfcHealRequest healRequest = new VfcHealRequest(); - request.setHealRequest(healRequest); - assertEquals(healRequest, request.getHealRequest()); - - assertNotEquals(0, request.hashCode()); - } -} diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcResponseDescriptorTest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcResponseDescriptorTest.java deleted file mode 100644 index b4dc81b44..000000000 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcResponseDescriptorTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * vfc - * ================================================================================ - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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.vfc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; - -public class VfcResponseDescriptorTest { - - @Test - public void testVfcResponseDescriptor() { - VfcResponseDescriptor descriptor = new VfcResponseDescriptor(); - assertNotNull(descriptor); - assertNotEquals(0, descriptor.hashCode()); - - String errorCode = "WitchIsDead"; - descriptor.setErrorCode(errorCode); - assertEquals(errorCode, descriptor.getErrorCode()); - - String progress = "Visited Wizard"; - descriptor.setProgress(progress); - assertEquals(progress, descriptor.getProgress()); - - List responseHistoryList = new ArrayList<>(); - descriptor.setResponseHistoryList(responseHistoryList); - assertEquals(responseHistoryList, descriptor.getResponseHistoryList()); - - String responseId = "WishHard"; - descriptor.setResponseId(responseId); - assertEquals(responseId, descriptor.getResponseId()); - - String status = "Back in Kansas"; - descriptor.setStatus(status); - assertEquals(status, descriptor.getStatus()); - - String statusDescription = "Back on the prairie"; - descriptor.setStatusDescription(statusDescription); - assertEquals(statusDescription, descriptor.getStatusDescription()); - - assertNotEquals(0, descriptor.hashCode()); - } -} diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcResponseTest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcResponseTest.java deleted file mode 100644 index 15ba6f520..000000000 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcResponseTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * vfc - * ================================================================================ - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2018-2019 AT&T Corporation. 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.vfc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class VfcResponseTest { - - @Test - public void testVfcResponse() { - VfcResponse response = new VfcResponse(); - assertNotNull(response); - assertNotEquals(0, response.hashCode()); - - String jobId = "GetToOz"; - response.setJobId(jobId); - assertEquals(jobId, response.getJobId()); - - String requestId = "Get Home"; - response.setRequestId(requestId); - assertEquals(requestId, response.getRequestId()); - - VfcResponseDescriptor responseDescriptor = new VfcResponseDescriptor(); - response.setResponseDescriptor(responseDescriptor); - assertEquals(responseDescriptor, response.getResponseDescriptor()); - - assertNotEquals(0, response.hashCode()); - } -} diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/util/SerializationTest.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/util/SerializationTest.java deleted file mode 100644 index beceb045a..000000000 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/util/SerializationTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * vfc - * ================================================================================ - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2018 AT&T Corporation. 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.vfc.util; - -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class SerializationTest { - - @Test - public void test() { - assertNotNull(Serialization.gsonPretty); - } -} -- cgit 1.2.3-korg