From 8ec41ca447dcaa27daf1b3195412ff27d8f22d6d Mon Sep 17 00:00:00 2001 From: "Benjamin, Max" Date: Wed, 29 Apr 2020 16:18:28 -0400 Subject: rename package for external use rename package for external use Issue-ID: SO-2852 Signed-off-by: Benjamin, Max (mb388a) Change-Id: Id883f0c847c24a260dbf8c63ce5e1330c045d6de --- .../onap/so/adapters/vevnfm/aai/AaiConnection.java | 10 +- .../so/adapters/vevnfm/aai/AaiPropertiesExt.java | 4 +- .../lcm/extclients/aai/AaiClientProvider.java | 2 +- .../lcm/extclients/aai/AaiPropertiesImpl.java | 4 +- .../lcm/extclients/aai/AaiServiceProviderImpl.java | 6 +- .../lcm/rest/Sol003GrantControllerTest.java | 4 +- .../adapter/lcm/rest/Sol003LcnControllerTest.java | 4 +- .../lcm/rest/VnfmAdapterControllerTest.java | 6 +- .../extclients/aai/AaiClientPropertiesImpl.java | 4 +- .../nssmf/extclients/aai/AaiClientProvider.java | 2 +- .../extclients/aai/AaiServiceProviderImpl.java | 4 +- .../so/adapters/cloudregion/CloudRestImpl.java | 12 +- .../inventory/delete/DeleteAAIInventory.java | 2 +- .../openstack/AaiClientPropertiesImpl.java | 4 +- .../so/adapters/tasks/audit/AbstractAudit.java | 2 +- .../tasks/audit/AuditCreateStackService.java | 2 +- .../so/adapters/tasks/audit/AuditDataService.java | 2 +- .../tasks/audit/AuditDeleteStackService.java | 2 +- .../onap/so/adapters/tasks/audit/AuditVServer.java | 14 +- .../so/adapters/tasks/audit/HeatStackAudit.java | 4 +- .../tasks/inventory/CreateAAIInventory.java | 2 +- .../org/onap/so/heatbridge/HeatBridgeImpl.java | 18 +- .../org/onap/so/heatbridge/helpers/AaiHelper.java | 6 +- .../cloudregion/CloudRegionRestImplTest.java | 8 +- .../adapters/tasks/audit/AuditDataServiceTest.java | 2 +- .../so/adapters/tasks/audit/AuditVServerTest.java | 13 +- .../tasks/inventory/CreateAAIInventoryTest.java | 2 +- .../tasks/inventory/CreateInventoryTaskTest.java | 2 +- .../org/onap/so/heatbridge/HeatBridgeImplTest.java | 12 +- .../service/ApplicationControllerTaskImpl.java | 2 +- .../ApplicationControllerTaskImplITTest.java | 2 +- .../service/ApplicationControllerTaskImplTest.java | 2 +- .../tenantIsolation/AaiClientPropertiesImpl.java | 4 +- .../asdc/tenantIsolation/WatchdogDistribution.java | 10 +- .../AaiClientPropertiesImplTest.java | 2 +- .../tenantIsolation/WatchdogDistributionTest.java | 4 +- .../org/onap/so/bpmn/common/scripts/AaiUtil.groovy | 4 +- .../scripts/AbstractServiceTaskProcessor.groovy | 2 +- .../common/scripts/AllottedResourceUtils.groovy | 10 +- .../common/scripts/ConfirmVolumeGroupName.groovy | 6 +- .../common/scripts/ConfirmVolumeGroupTenant.groovy | 10 +- .../bpmn/common/scripts/CreateAAIVfModule.groovy | 10 +- .../scripts/CreateAAIVfModuleVolumeGroup.groovy | 6 +- .../bpmn/common/scripts/DeleteAAIVfModule.groovy | 8 +- .../common/scripts/GenerateVfModuleName.groovy | 8 +- .../common/scripts/PrepareUpdateAAIVfModule.groovy | 12 +- .../bpmn/common/scripts/UpdateAAIGenericVnf.groovy | 8 +- .../bpmn/common/scripts/UpdateAAIVfModule.groovy | 6 +- .../org/onap/so/bpmn/common/InjectionHelper.java | 8 +- .../servicedecomposition/tasks/BBInputSetup.java | 12 +- .../tasks/BBInputSetupUtils.java | 16 +- .../tasks/CloudInfoFromAAI.java | 8 +- .../onap/so/client/exception/ExceptionBuilder.java | 4 +- .../client/restproperties/AAIPropertiesImpl.java | 4 +- .../scripts/AllottedResourceUtilsTest.groovy | 8 +- .../scripts/ConfirmVolumeGroupNameTest.groovy | 8 +- .../scripts/ConfirmVolumeGroupTenantTest.groovy | 8 +- .../common/scripts/CreateAAIVfModuleTest.groovy | 2 +- .../CreateAAIVfModuleVolumeGroupTest.groovy | 6 +- .../common/scripts/DeleteAAIVfModuleTest.groovy | 2 +- .../so/bpmn/common/scripts/MsoGroovyTest.groovy | 16 +- .../common/scripts/UpdateAAIVfModuleTest.groovy | 6 +- .../org/onap/so/bpmn/common/SPIPropertiesTest.java | 2 +- .../tasks/BBInputSetupTest.java | 10 +- .../tasks/BBInputSetupUtilsTest.java | 14 +- .../tasks/CloudInfoFromAAITest.java | 8 +- .../so/client/exception/ExceptionBuilderTest.java | 4 +- .../restproperties/AAIPropertiesImplTest.java | 2 +- .../so/client/restproperties/ThreadedReadTest.java | 2 +- .../org/onap/so/bpmn/common/SPIPropertiesTest.java | 2 +- .../scripts/ActivateCommunicationService.groovy | 10 +- .../scripts/ActivateSliceService.groovy | 10 +- .../scripts/CheckServiceProcessStatus.groovy | 2 +- .../scripts/Create3rdONAPE2EServiceInstance.groovy | 8 +- .../scripts/CreateCommunicationService.groovy | 8 +- .../scripts/CreateCustomE2EServiceInstance.groovy | 8 +- .../scripts/CreateSDNCNetworkResource.groovy | 10 +- .../scripts/CreateSliceService.groovy | 8 +- .../scripts/CreateVFCNSResource.groovy | 6 +- .../scripts/CreateVfModuleVolumeInfraV1.groovy | 6 +- .../scripts/Delete3rdONAPE2EServiceInstance.groovy | 8 +- .../scripts/DeleteCommunicationService.groovy | 10 +- .../scripts/DeleteDeviceResource.groovy | 8 +- .../scripts/DeleteSDNCNetworkResource.groovy | 10 +- .../scripts/DeleteSliceService.groovy | 10 +- .../scripts/DeleteVfModuleVolumeInfraV1.groovy | 8 +- .../scripts/DoAllocateNSIandNSSI.groovy | 12 +- .../infrastructure/scripts/DoAllocateNSSI.groovy | 10 +- .../DoCompareModelofE2EServiceInstance.groovy | 10 +- .../scripts/DoCreateCommunicationService.groovy | 8 +- .../scripts/DoCreateE2EServiceInstance.groovy | 10 +- .../DoCreateE2EServiceInstanceRollback.groovy | 8 +- .../scripts/DoCreateNetworkInstance.groovy | 18 +- .../scripts/DoCreateServiceInstance.groovy | 8 +- .../scripts/DoCreateSliceServiceInstance.groovy | 8 +- .../scripts/DoCreateSliceServiceOption.groovy | 10 +- .../DoCreateVFCNetworkServiceInstance.groovy | 6 +- .../infrastructure/scripts/DoCreateVfModule.groovy | 16 +- .../scripts/DoCreateVfModuleRollback.groovy | 10 +- .../scripts/DoCreateVfModuleVolumeRollback.groovy | 10 +- .../scripts/DoCreateVfModuleVolumeV2.groovy | 10 +- .../bpmn/infrastructure/scripts/DoCreateVnf.groovy | 8 +- .../DoCustomDeleteE2EServiceInstance.groovy | 8 +- .../DoCustomDeleteE2EServiceInstanceV2.groovy | 10 +- .../infrastructure/scripts/DoDeallocateNSSI.groovy | 8 +- .../scripts/DoDeleteE2EServiceInstance.groovy | 10 +- .../scripts/DoDeleteNetworkInstance.groovy | 12 +- .../scripts/DoDeleteServiceInstance.groovy | 10 +- .../scripts/DoDeleteSliceService.groovy | 8 +- .../DoDeleteVFCNetworkServiceInstance.groovy | 6 +- .../infrastructure/scripts/DoDeleteVfModule.groovy | 10 +- .../scripts/DoDeleteVfModuleFromVnf.groovy | 12 +- .../scripts/DoDeleteVfModuleVolumeV2.groovy | 10 +- .../bpmn/infrastructure/scripts/DoDeleteVnf.groovy | 12 +- .../scripts/DoDeleteVnfAndModules.groovy | 8 +- .../scripts/DoUpdateE2EServiceInstance.groovy | 14 +- .../DoUpdateE2EServiceInstanceRollback.groovy | 10 +- .../scripts/DoUpdateNetworkInstance.groovy | 12 +- .../infrastructure/scripts/DoUpdateVfModule.groovy | 12 +- .../scripts/DoUpdateVnfAndModules.groovy | 8 +- .../infrastructure/scripts/ReplaceVnfInfra.groovy | 2 +- .../scripts/UpdateCustomE2EServiceInstance.groovy | 10 +- .../scripts/UpdateVfModuleInfraV2.groovy | 2 +- .../scripts/UpdateVfModuleVolume.groovy | 10 +- .../scripts/UpdateVfModuleVolumeInfraV1.groovy | 10 +- .../infrastructure/scripts/UpdateVnfInfra.groovy | 6 +- .../bpmn/infrastructure/scripts/VnfCmBase.groovy | 10 +- .../infrastructure/scripts/VnfConfigUpdate.groovy | 8 +- .../infrastructure/scripts/VnfInPlaceUpdate.groovy | 8 +- .../vcpe/scripts/DeleteVcpeResCustService.groovy | 12 +- .../scripts/DoCreateAllottedResourceBRG.groovy | 8 +- .../scripts/DoCreateAllottedResourceTXC.groovy | 6 +- .../infrastructure/aai/AAICreateResources.java | 8 +- .../aai/AAIDeleteServiceInstance.java | 6 +- .../so/bpmn/infrastructure/aai/AAIResource.java | 2 +- .../aai/groovyflows/AAICreateResources.java | 10 +- .../aai/groovyflows/AAIDeleteServiceInstance.java | 8 +- .../pnf/management/PnfManagementImpl.java | 10 +- .../workflow/service/ServicePluginFactory.java | 16 +- .../scripts/CreateVFCNSResourceTest.groovy | 6 +- .../scripts/CreateVfModuleVolumeInfraV1Test.groovy | 8 +- .../scripts/DeleteCommunicationServiceTest.groovy | 8 +- .../scripts/DeleteSliceServiceTest.groovy | 8 +- .../scripts/DeleteVfModuleVolumeInfraV1Test.groovy | 10 +- .../DoCreateCommunicationServiceTest.groovy | 2 +- .../scripts/DoCreateNetworkInstanceTest.groovy | 4 +- .../scripts/DoCreateServiceInstanceTest.groovy | 2 +- .../DoCreateVFCNetworkServiceInstanceTest.groovy | 6 +- .../scripts/DoCreateVfModuleRollbackTest.groovy | 12 +- .../DoCreateVfModuleVolumeRollbackTest.groovy | 8 +- .../scripts/DoCreateVfModuleVolumeV2Test.groovy | 10 +- .../DoCustomDeleteE2EServiceInstanceV2Test.groovy | 6 +- .../scripts/DoDeallocateNSSITest.groovy | 6 +- .../scripts/DoDeleteNetworkInstanceTest.groovy | 8 +- .../scripts/DoDeleteSliceServiceTest.groovy | 8 +- .../DoDeleteVFCNetworkServiceInstanceTest.groovy | 8 +- .../scripts/DoDeleteVfModuleFromVnfTest.groovy | 12 +- .../scripts/DoDeleteVfModuleTest.groovy | 10 +- .../scripts/DoDeleteVfModuleVolumeV2Test.groovy | 10 +- .../scripts/DoDeleteVnfAndModulesTest.groovy | 10 +- .../scripts/DoUpdateNetworkInstanceTest.groovy | 2 +- .../scripts/UpdateVfModuleVolumeInfraV1Test.groovy | 8 +- .../scripts/UpdateVfModuleVolumeTest.groovy | 8 +- .../scripts/DoCreateAllottedResourceBRGTest.groovy | 6 +- .../scripts/DoCreateAllottedResourceTXCTest.groovy | 6 +- .../so/bpmn/vcpe/scripts/GroovyTestBase.groovy | 2 +- .../infrastructure/aai/AAICreateResourcesTest.java | 10 +- .../aai/AAIDeleteServiceInstanceTest.java | 4 +- .../CreateVcpeResCustServiceSimplifiedTest.java | 2 +- .../process/PNFSWUPDownloadTest.java | 2 +- .../process/PNFSoftwareUpgradeTest.java | 2 +- .../infrastructure/aai/tasks/AAICreateTasks.java | 6 +- .../infrastructure/aai/tasks/AAIDeleteTasks.java | 6 +- .../infrastructure/aai/tasks/AAIQueryTasks.java | 8 +- .../appc/tasks/AppcOrchestratorPreProcessor.java | 8 +- .../infrastructure/appc/tasks/AppcRunTasks.java | 8 +- .../flowspecific/tasks/AssignVnf.java | 2 +- .../flowspecific/tasks/UnassignNetworkBB.java | 2 +- .../infrastructure/vfmodule/CreateVFModule.java | 16 +- .../workflow/tasks/VrfValidation.java | 6 +- .../workflow/tasks/WorkflowAction.java | 12 +- .../workflow/tasks/WorkflowActionBBTasks.java | 4 +- .../tasks/WorkflowActionExtractResourcesAAI.java | 8 +- .../orchestration/AAICollectionResources.java | 6 +- .../orchestration/AAIConfigurationResources.java | 8 +- .../orchestration/AAIInstanceGroupResources.java | 12 +- .../client/orchestration/AAINetworkResources.java | 18 +- .../so/client/orchestration/AAIPnfResources.java | 6 +- .../orchestration/AAIServiceInstanceResources.java | 12 +- .../client/orchestration/AAIVfModuleResources.java | 10 +- .../so/client/orchestration/AAIVnfResources.java | 18 +- .../orchestration/AAIVolumeGroupResources.java | 10 +- .../orchestration/AAIVpnBindingResources.java | 10 +- .../org/onap/so/client/sdno/SDNOValidatorImpl.java | 8 +- .../test/java/org/onap/so/bpmn/BaseTaskTest.java | 6 +- .../so/bpmn/common/aai/tasks/AAIFlagTasksTest.java | 2 +- .../aai/tasks/AAICreateTasksTest.java | 4 +- .../aai/tasks/AAIDeleteTasksTest.java | 4 +- .../tasks/AppcOrchestratorPreProcessorTest.java | 4 +- .../infrastructure/appc/tasks/AppcRunTasksIT.java | 2 +- .../appc/tasks/AppcRunTasksTest.java | 4 +- .../bpmn/infrastructure/audit/AuditTasksTest.java | 2 +- .../impl/camunda/ControllerExecutionDETestIT.java | 2 +- .../flowspecific/tasks/AssignVnfTest.java | 2 +- .../flowspecific/tasks/NetworkBBUtilsTest.java | 2 +- .../flowspecific/tasks/UnassignNetworkBBTest.java | 2 +- .../tasks/NamingServiceCreateTasksTest.java | 6 +- .../vfmodule/CreateVFModuleTest.java | 10 +- .../workflow/tasks/VrfValidationTest.java | 6 +- .../workflow/tasks/WorkflowActionTest.java | 10 +- .../so/client/namingservice/NamingClientIT.java | 116 ++++++ .../so/client/namingservice/NamingClientTest.java | 116 ------ .../orchestration/AAICollectionResourcesTest.java | 6 +- .../AAIConfigurationResourcesTest.java | 10 +- .../AAIInstanceGroupResourcesTest.java | 14 +- .../orchestration/AAINetworkResourcesTest.java | 18 +- .../client/orchestration/AAIPnfResourcesTest.java | 4 +- .../AAIServiceInstanceResourcesTest.java | 10 +- .../orchestration/AAIVfModuleResourcesTest.java | 10 +- .../client/orchestration/AAIVnfResourcesTest.java | 20 +- .../orchestration/AAIVolumeGroupResourcesTest.java | 10 +- .../orchestration/AAIVpnBindingResourcesTest.java | 4 +- .../org/onap/aaiclient/client/aai/AAIClient.java | 78 ++++ .../aai/AAIClientResponseExceptionMapper.java | 59 +++ .../aai/AAICommonObjectMapperPatchProvider.java | 31 ++ .../client/aai/AAICommonObjectMapperProvider.java | 31 ++ .../aaiclient/client/aai/AAIDSLQueryClient.java | 56 +++ .../aaiclient/client/aai/AAIErrorFormatter.java | 57 +++ .../client/aai/AAINamespaceConstants.java | 31 ++ .../onap/aaiclient/client/aai/AAIObjectBase.java | 7 + .../aaiclient/client/aai/AAIObjectPlurals.java | 117 ++++++ .../onap/aaiclient/client/aai/AAIObjectType.java | 322 ++++++++++++++++ .../onap/aaiclient/client/aai/AAIProperties.java | 37 ++ .../onap/aaiclient/client/aai/AAIQueryClient.java | 60 +++ .../client/aai/AAIQueryObjectMapperProvider.java | 39 ++ .../aaiclient/client/aai/AAIResourcesClient.java | 88 +++++ .../aai/AAIResourcesObjectMapperProvider.java | 29 ++ .../onap/aaiclient/client/aai/AAIRestClient.java | 67 ++++ .../onap/aaiclient/client/aai/AAIRestClientI.java | 43 +++ .../aaiclient/client/aai/AAIRestClientImpl.java | 100 +++++ .../client/aai/AAISingleTransactionClient.java | 175 +++++++++ .../client/aai/AAITransactionalClient.java | 228 +++++++++++ .../org/onap/aaiclient/client/aai/AAIUpdator.java | 29 ++ .../onap/aaiclient/client/aai/AAIUpdatorImpl.java | 49 +++ .../onap/aaiclient/client/aai/AAIValidator.java | 32 ++ .../aaiclient/client/aai/AAIValidatorImpl.java | 71 ++++ .../org/onap/aaiclient/client/aai/AAIVersion.java | 50 +++ .../client/aai/entities/AAIEdgeLabel.java | 42 +++ .../aaiclient/client/aai/entities/AAIEntity.java | 25 ++ .../client/aai/entities/AAIEntityObject.java | 29 ++ .../aaiclient/client/aai/entities/AAIError.java | 44 +++ .../client/aai/entities/AAIResultWrapper.java | 45 +++ .../client/aai/entities/Configuration.java | 153 ++++++++ .../aaiclient/client/aai/entities/CustomQuery.java | 79 ++++ .../aaiclient/client/aai/entities/QueryStep.java | 28 ++ .../client/aai/entities/Relationships.java | 74 ++++ .../client/aai/entities/RequestError.java | 44 +++ .../aaiclient/client/aai/entities/Results.java | 49 +++ .../client/aai/entities/ServiceException.java | 70 ++++ .../aai/entities/bulkprocess/OperationBody.java | 68 ++++ .../bulkprocess/OperationBodySerializer.java | 54 +++ .../aai/entities/bulkprocess/Transaction.java | 90 +++++ .../aai/entities/bulkprocess/Transactions.java | 51 +++ .../singletransaction/OperationBodyRequest.java | 84 +++++ .../OperationBodyRequestSerializer.java | 54 +++ .../singletransaction/OperationBodyResponse.java | 73 ++++ .../SingleTransactionRequest.java | 44 +++ .../SingleTransactionResponse.java | 46 +++ .../aai/entities/uri/AAIBaseResourceUri.java | 29 ++ .../aai/entities/uri/AAIPluralResourceUri.java | 9 + .../client/aai/entities/uri/AAIResourceUri.java | 10 + .../aai/entities/uri/AAISimplePluralUri.java | 68 ++++ .../client/aai/entities/uri/AAISimpleUri.java | 73 ++++ .../aaiclient/client/aai/entities/uri/AAIUri.java | 32 ++ .../client/aai/entities/uri/AAIUriFactory.java | 114 ++++++ .../entities/uri/AllottedResourceLookupUri.java | 54 +++ .../client/aai/entities/uri/HttpLookupUri.java | 174 +++++++++ .../client/aai/entities/uri/NodesPluralUri.java | 19 + .../client/aai/entities/uri/NodesSingleUri.java | 21 ++ .../client/aai/entities/uri/NodesUri.java | 26 ++ .../aai/entities/uri/ServiceInstanceUri.java | 54 +++ .../EmptyStringToNullSerializer.java | 52 +++ .../aaiclient/client/graphinventory/Format.java | 45 +++ .../graphinventory/GraphInventoryClient.java | 67 ++++ ...phInventoryCommonObjectMapperPatchProvider.java | 35 ++ .../GraphInventoryCommonObjectMapperProvider.java | 52 +++ .../graphinventory/GraphInventoryObjectBase.java | 9 + .../graphinventory/GraphInventoryObjectName.java | 30 ++ .../GraphInventoryObjectPlurals.java | 27 ++ .../graphinventory/GraphInventoryObjectType.java | 25 ++ .../GraphInventoryObjectUriPartial.java | 26 ++ .../GraphInventoryObjectUriTemplate.java | 26 ++ .../GraphInventoryPatchConverter.java | 83 ++++ .../graphinventory/GraphInventoryQueryClient.java | 141 +++++++ .../GraphInventoryResourcesClient.java | 418 +++++++++++++++++++++ .../graphinventory/GraphInventoryRestClient.java | 76 ++++ .../graphinventory/GraphInventorySubgraphType.java | 37 ++ .../GraphInventoryTransactionClient.java | 256 +++++++++++++ .../graphinventory/GraphInventoryVersion.java | 25 ++ .../client/graphinventory/TransactionBuilder.java | 32 ++ .../graphinventory/entities/DSLNodeBase.java | 88 +++++ .../client/graphinventory/entities/DSLNodeKey.java | 75 ++++ .../graphinventory/entities/DSLOutputNode.java | 8 + .../client/graphinventory/entities/DSLQuery.java | 41 ++ .../graphinventory/entities/DSLQueryBuilder.java | 158 ++++++++ .../graphinventory/entities/DSLStartNode.java | 19 + .../graphinventory/entities/DSLTraversal.java | 33 ++ .../entities/GraphInventoryEdgeLabel.java | 28 ++ .../entities/GraphInventoryRelationships.java | 133 +++++++ .../entities/GraphInventoryResultWrapper.java | 125 ++++++ .../client/graphinventory/entities/Id.java | 25 ++ .../client/graphinventory/entities/Node.java | 5 + .../client/graphinventory/entities/Output.java | 7 + .../client/graphinventory/entities/Pathed.java | 25 ++ .../client/graphinventory/entities/Resource.java | 57 +++ .../graphinventory/entities/ResourceAndUrl.java | 61 +++ .../client/graphinventory/entities/Start.java | 7 + .../graphinventory/entities/TraversalBuilder.java | 17 + .../client/graphinventory/entities/__.java | 62 +++ .../client/graphinventory/entities/uri/Depth.java | 38 ++ .../uri/GraphInventoryPluralResourceUri.java | 8 + .../entities/uri/GraphInventoryResourceUri.java | 31 ++ .../uri/GraphInventorySingleResourceUri.java | 16 + .../entities/uri/GraphInventoryUri.java | 81 ++++ .../graphinventory/entities/uri/HttpAwareUri.java | 32 ++ .../graphinventory/entities/uri/SimpleBaseUri.java | 237 ++++++++++++ .../entities/uri/SimplePluralUri.java | 77 ++++ .../graphinventory/entities/uri/SimpleUri.java | 83 ++++ .../entities/uri/parsers/UriParser.java | 30 ++ .../entities/uri/parsers/UriParserSpringImpl.java | 63 ++++ .../exceptions/BulkProcessFailed.java | 28 ++ .../GraphInventoryMultipleItemsException.java | 13 + .../GraphInventoryPatchDepthExceededException.java | 31 ++ .../exceptions/GraphInventoryPayloadException.java | 40 ++ .../GraphInventoryUriComputationException.java | 34 ++ .../GraphInventoryUriNotFoundException.java | 29 ++ .../exceptions/IncorrectNumberOfUriKeys.java | 31 ++ .../java/org/onap/so/client/aai/AAIClient.java | 78 ---- .../aai/AAIClientResponseExceptionMapper.java | 59 --- .../aai/AAICommonObjectMapperPatchProvider.java | 31 -- .../client/aai/AAICommonObjectMapperProvider.java | 31 -- .../org/onap/so/client/aai/AAIDSLQueryClient.java | 56 --- .../org/onap/so/client/aai/AAIErrorFormatter.java | 57 --- .../onap/so/client/aai/AAINamespaceConstants.java | 31 -- .../java/org/onap/so/client/aai/AAIObjectBase.java | 7 - .../org/onap/so/client/aai/AAIObjectPlurals.java | 117 ------ .../java/org/onap/so/client/aai/AAIObjectType.java | 322 ---------------- .../java/org/onap/so/client/aai/AAIProperties.java | 37 -- .../org/onap/so/client/aai/AAIQueryClient.java | 60 --- .../client/aai/AAIQueryObjectMapperProvider.java | 39 -- .../org/onap/so/client/aai/AAIResourcesClient.java | 88 ----- .../aai/AAIResourcesObjectMapperProvider.java | 29 -- .../java/org/onap/so/client/aai/AAIRestClient.java | 67 ---- .../org/onap/so/client/aai/AAIRestClientI.java | 43 --- .../org/onap/so/client/aai/AAIRestClientImpl.java | 100 ----- .../so/client/aai/AAISingleTransactionClient.java | 175 --------- .../onap/so/client/aai/AAITransactionalClient.java | 228 ----------- .../java/org/onap/so/client/aai/AAIUpdator.java | 29 -- .../org/onap/so/client/aai/AAIUpdatorImpl.java | 49 --- .../java/org/onap/so/client/aai/AAIValidator.java | 32 -- .../org/onap/so/client/aai/AAIValidatorImpl.java | 71 ---- .../java/org/onap/so/client/aai/AAIVersion.java | 50 --- .../onap/so/client/aai/entities/AAIEdgeLabel.java | 42 --- .../org/onap/so/client/aai/entities/AAIEntity.java | 25 -- .../so/client/aai/entities/AAIEntityObject.java | 29 -- .../org/onap/so/client/aai/entities/AAIError.java | 44 --- .../so/client/aai/entities/AAIResultWrapper.java | 45 --- .../onap/so/client/aai/entities/Configuration.java | 153 -------- .../onap/so/client/aai/entities/CustomQuery.java | 79 ---- .../org/onap/so/client/aai/entities/QueryStep.java | 28 -- .../onap/so/client/aai/entities/Relationships.java | 74 ---- .../onap/so/client/aai/entities/RequestError.java | 44 --- .../org/onap/so/client/aai/entities/Results.java | 49 --- .../so/client/aai/entities/ServiceException.java | 70 ---- .../aai/entities/bulkprocess/OperationBody.java | 68 ---- .../bulkprocess/OperationBodySerializer.java | 54 --- .../aai/entities/bulkprocess/Transaction.java | 90 ----- .../aai/entities/bulkprocess/Transactions.java | 51 --- .../singletransaction/OperationBodyRequest.java | 84 ----- .../OperationBodyRequestSerializer.java | 54 --- .../singletransaction/OperationBodyResponse.java | 73 ---- .../SingleTransactionRequest.java | 44 --- .../SingleTransactionResponse.java | 46 --- .../aai/entities/uri/AAIBaseResourceUri.java | 29 -- .../aai/entities/uri/AAIPluralResourceUri.java | 9 - .../so/client/aai/entities/uri/AAIResourceUri.java | 10 - .../aai/entities/uri/AAISimplePluralUri.java | 68 ---- .../so/client/aai/entities/uri/AAISimpleUri.java | 73 ---- .../onap/so/client/aai/entities/uri/AAIUri.java | 32 -- .../so/client/aai/entities/uri/AAIUriFactory.java | 114 ------ .../entities/uri/AllottedResourceLookupUri.java | 54 --- .../so/client/aai/entities/uri/HttpLookupUri.java | 174 --------- .../so/client/aai/entities/uri/NodesPluralUri.java | 19 - .../so/client/aai/entities/uri/NodesSingleUri.java | 21 -- .../onap/so/client/aai/entities/uri/NodesUri.java | 26 -- .../aai/entities/uri/ServiceInstanceUri.java | 54 --- .../EmptyStringToNullSerializer.java | 52 --- .../org/onap/so/client/graphinventory/Format.java | 45 --- .../graphinventory/GraphInventoryClient.java | 67 ---- ...phInventoryCommonObjectMapperPatchProvider.java | 35 -- .../GraphInventoryCommonObjectMapperProvider.java | 52 --- .../graphinventory/GraphInventoryObjectBase.java | 9 - .../graphinventory/GraphInventoryObjectName.java | 30 -- .../GraphInventoryObjectPlurals.java | 27 -- .../graphinventory/GraphInventoryObjectType.java | 25 -- .../GraphInventoryObjectUriPartial.java | 26 -- .../GraphInventoryObjectUriTemplate.java | 26 -- .../GraphInventoryPatchConverter.java | 83 ---- .../graphinventory/GraphInventoryQueryClient.java | 141 ------- .../GraphInventoryResourcesClient.java | 418 --------------------- .../graphinventory/GraphInventoryRestClient.java | 76 ---- .../graphinventory/GraphInventorySubgraphType.java | 37 -- .../GraphInventoryTransactionClient.java | 256 ------------- .../graphinventory/GraphInventoryVersion.java | 25 -- .../client/graphinventory/TransactionBuilder.java | 32 -- .../graphinventory/entities/DSLNodeBase.java | 88 ----- .../client/graphinventory/entities/DSLNodeKey.java | 75 ---- .../graphinventory/entities/DSLOutputNode.java | 8 - .../client/graphinventory/entities/DSLQuery.java | 41 -- .../graphinventory/entities/DSLQueryBuilder.java | 158 -------- .../graphinventory/entities/DSLStartNode.java | 19 - .../graphinventory/entities/DSLTraversal.java | 33 -- .../entities/GraphInventoryEdgeLabel.java | 28 -- .../entities/GraphInventoryRelationships.java | 133 ------- .../entities/GraphInventoryResultWrapper.java | 125 ------ .../onap/so/client/graphinventory/entities/Id.java | 25 -- .../so/client/graphinventory/entities/Node.java | 5 - .../so/client/graphinventory/entities/Output.java | 7 - .../so/client/graphinventory/entities/Pathed.java | 25 -- .../client/graphinventory/entities/Resource.java | 57 --- .../graphinventory/entities/ResourceAndUrl.java | 61 --- .../so/client/graphinventory/entities/Start.java | 7 - .../graphinventory/entities/TraversalBuilder.java | 17 - .../onap/so/client/graphinventory/entities/__.java | 62 --- .../client/graphinventory/entities/uri/Depth.java | 38 -- .../uri/GraphInventoryPluralResourceUri.java | 8 - .../entities/uri/GraphInventoryResourceUri.java | 31 -- .../uri/GraphInventorySingleResourceUri.java | 16 - .../entities/uri/GraphInventoryUri.java | 81 ---- .../graphinventory/entities/uri/HttpAwareUri.java | 32 -- .../graphinventory/entities/uri/SimpleBaseUri.java | 237 ------------ .../entities/uri/SimplePluralUri.java | 77 ---- .../graphinventory/entities/uri/SimpleUri.java | 83 ---- .../entities/uri/parsers/UriParser.java | 30 -- .../entities/uri/parsers/UriParserSpringImpl.java | 63 ---- .../exceptions/BulkProcessFailed.java | 28 -- .../GraphInventoryMultipleItemsException.java | 13 - .../GraphInventoryPatchDepthExceededException.java | 31 -- .../exceptions/GraphInventoryPayloadException.java | 40 -- .../GraphInventoryUriComputationException.java | 34 -- .../GraphInventoryUriNotFoundException.java | 29 -- .../exceptions/IncorrectNumberOfUriKeys.java | 31 -- .../aai/AAIClientResponseExceptionMapperTest.java | 68 ++++ .../client/aai/AAIErrorFormatterTest.java | 104 +++++ .../aaiclient/client/aai/AAIObjectTypeTest.java | 91 +++++ .../onap/aaiclient/client/aai/AAIPServerTest.java | 52 +++ .../aaiclient/client/aai/AAIQueryClientTest.java | 150 ++++++++ .../client/aai/AAIResourcesClientTest.java | 308 +++++++++++++++ ...IResourcesClientWithServiceInstanceUriTest.java | 121 ++++++ .../aaiclient/client/aai/AAIRestClientTest.java | 76 ++++ .../client/aai/AAISingleTransactionClientTest.java | 140 +++++++ .../client/aai/AAITransactionalClientTest.java | 174 +++++++++ .../org/onap/aaiclient/client/aai/AAIURITest.java | 41 ++ .../aaiclient/client/aai/AAIUpdatorImplTest.java | 53 +++ .../onap/aaiclient/client/aai/AAIUpdatorTest.java | 60 +++ .../aaiclient/client/aai/AAIValidatorTest.java | 113 ++++++ .../aaiclient/client/aai/DSLQueryBuilderTest.java | 149 ++++++++ .../client/aai/entities/AAIResultWrapperTest.java | 110 ++++++ .../client/aai/entities/RelationshipsTest.java | 56 +++ .../uri/AAISimpleUriFromParentUriTest.java | 43 +++ .../aai/entities/uri/AAISimpleUriFromUriTest.java | 76 ++++ .../client/aai/entities/uri/AAISimpleUriTest.java | 133 +++++++ .../client/aai/entities/uri/AAIUriFactoryTest.java | 68 ++++ .../uri/AllottedResourceLookupUriTest.java | 54 +++ .../entities/uri/IncorrectNumberOfUriKeysTest.java | 69 ++++ .../aai/entities/uri/ServiceInstanceUriTest.java | 301 +++++++++++++++ .../client/aai/objects/CustomAAIObjectType.java | 42 +++ .../DefaultAAIPropertiesImpl.java | 95 +++++ .../GraphInventoryPatchConverterTest.java | 118 ++++++ .../uri/parsers/UriParserSpringImplTest.java | 47 +++ .../GraphInventoryPayloadExceptionTest.java | 40 ++ .../aai/AAIClientResponseExceptionMapperTest.java | 68 ---- .../onap/so/client/aai/AAIErrorFormatterTest.java | 104 ----- .../org/onap/so/client/aai/AAIObjectTypeTest.java | 91 ----- .../org/onap/so/client/aai/AAIPServerTest.java | 52 --- .../org/onap/so/client/aai/AAIQueryClientTest.java | 150 -------- .../onap/so/client/aai/AAIResourcesClientTest.java | 308 --------------- ...IResourcesClientWithServiceInstanceUriTest.java | 121 ------ .../org/onap/so/client/aai/AAIRestClientTest.java | 76 ---- .../client/aai/AAISingleTransactionClientTest.java | 140 ------- .../so/client/aai/AAITransactionalClientTest.java | 174 --------- .../java/org/onap/so/client/aai/AAIURITest.java | 41 -- .../org/onap/so/client/aai/AAIUpdatorImplTest.java | 53 --- .../org/onap/so/client/aai/AAIUpdatorTest.java | 60 --- .../org/onap/so/client/aai/AAIValidatorTest.java | 113 ------ .../onap/so/client/aai/DSLQueryBuilderTest.java | 149 -------- .../client/aai/entities/AAIResultWrapperTest.java | 110 ------ .../so/client/aai/entities/RelationshipsTest.java | 56 --- .../uri/AAISimpleUriFromParentUriTest.java | 43 --- .../aai/entities/uri/AAISimpleUriFromUriTest.java | 76 ---- .../client/aai/entities/uri/AAISimpleUriTest.java | 133 ------- .../client/aai/entities/uri/AAIUriFactoryTest.java | 68 ---- .../uri/AllottedResourceLookupUriTest.java | 54 --- .../entities/uri/IncorrectNumberOfUriKeysTest.java | 69 ---- .../aai/entities/uri/ServiceInstanceUriTest.java | 301 --------------- .../so/client/aai/objects/CustomAAIObjectType.java | 42 --- .../DefaultAAIPropertiesImpl.java | 95 ----- .../GraphInventoryPatchConverterTest.java | 118 ------ .../uri/parsers/UriParserSpringImplTest.java | 47 --- .../GraphInventoryPayloadExceptionTest.java | 40 -- .../so/apihandlerinfra/E2EServiceInstances.java | 8 +- .../infra/rest/AAIDataRetrieval.java | 26 +- .../infra/rest/BpmnRequestBuilder.java | 8 +- .../tenantisolation/AaiClientPropertiesImpl.java | 4 +- .../tenantisolation/helpers/AAIClientHelper.java | 12 +- .../process/ActivateVnfOperationalEnvironment.java | 8 +- .../ActivateVnfStatusOperationalEnvironment.java | 2 +- .../process/CreateVnfOperationalEnvironment.java | 2 +- .../DeactivateVnfOperationalEnvironment.java | 2 +- .../so/apihandlerinfra/AAIDeserializeTest.java | 2 +- .../infra/rest/BpmnRequestBuilderTest.java | 10 +- .../helpers/AAIClientHelperTest.java | 4 +- .../ActivateVnfOperationalEnvironmentTest.java | 4 +- ...ctivateVnfStatusOperationalEnvironmentTest.java | 2 +- .../CreateEcompOperationalEnvironmentTest.java | 2 +- .../CreateVnfOperationalEnvironmentTest.java | 2 +- .../DeactivateVnfOperationalEnvironmentTest.java | 2 +- .../org/onap/so/simulator/AAIPropertiesImpl.java | 4 +- .../so/simulator/actions/aai/DeleteVServers.java | 8 +- .../so/simulator/actions/aai/ProcessNetwork.java | 8 +- .../onap/so/simulator/actions/aai/ProcessVnfc.java | 8 +- .../scenarios/openstack/CreateAAInventory.java | 10 +- 532 files changed, 11111 insertions(+), 11112 deletions(-) create mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientIT.java delete mode 100644 bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClientResponseExceptionMapper.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperPatchProvider.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperProvider.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIErrorFormatter.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAINamespaceConstants.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectBase.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIProperties.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIQueryClient.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIQueryObjectMapperProvider.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIResourcesClient.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIResourcesObjectMapperProvider.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientI.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAISingleTransactionClient.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAITransactionalClient.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIUpdator.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIUpdatorImpl.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIValidator.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIValidatorImpl.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIVersion.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEdgeLabel.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEntity.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEntityObject.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIError.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIResultWrapper.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Configuration.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/CustomQuery.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/QueryStep.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Relationships.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/RequestError.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Results.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/ServiceException.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/OperationBody.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/OperationBodySerializer.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/Transaction.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/Transactions.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyRequest.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyResponse.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/SingleTransactionRequest.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/SingleTransactionResponse.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIBaseResourceUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIPluralResourceUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIResourceUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimplePluralUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/HttpLookupUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesPluralUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesSingleUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/EmptyStringToNullSerializer.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/Format.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryClient.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryCommonObjectMapperPatchProvider.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectBase.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectName.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectPlurals.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectType.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectUriPartial.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectUriTemplate.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryPatchConverter.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryResourcesClient.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryRestClient.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventorySubgraphType.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryTransactionClient.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryVersion.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/TransactionBuilder.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeBase.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeKey.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLOutputNode.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQuery.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLStartNode.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLTraversal.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryEdgeLabel.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryResultWrapper.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Id.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Node.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Output.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Pathed.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Resource.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/ResourceAndUrl.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Start.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/TraversalBuilder.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/__.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/Depth.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventoryResourceUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventoryUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/HttpAwareUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleBaseUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimplePluralUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleUri.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/parsers/UriParser.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/BulkProcessFailed.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryPayloadException.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryUriComputationException.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.java create mode 100644 graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/IncorrectNumberOfUriKeys.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIClient.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAINamespaceConstants.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIObjectBase.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIObjectType.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIProperties.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIQueryClient.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIQueryObjectMapperProvider.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIResourcesObjectMapperProvider.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIRestClient.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIRestClientI.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIUpdator.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIValidator.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIVersion.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIEntity.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIEntityObject.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIError.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/Configuration.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/QueryStep.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/Relationships.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/RequestError.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/Results.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/ServiceException.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBodySerializer.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transaction.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transactions.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyResponse.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionRequest.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionResponse.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIBaseResourceUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIPluralResourceUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAISimplePluralUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/NodesPluralUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/NodesSingleUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/EmptyStringToNullSerializer.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/Format.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperPatchProvider.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectBase.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectName.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriPartial.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriTemplate.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverter.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventorySubgraphType.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryVersion.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeBase.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLOutputNode.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLStartNode.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLTraversal.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Id.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Node.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Output.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Start.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/TraversalBuilder.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/__.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/Depth.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleBaseUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimplePluralUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParser.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/BulkProcessFailed.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadException.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriComputationException.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.java delete mode 100644 graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/IncorrectNumberOfUriKeys.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIClientResponseExceptionMapperTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIErrorFormatterTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIObjectTypeTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIPServerTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIQueryClientTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIResourcesClientTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIRestClientTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAISingleTransactionClientTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAITransactionalClientTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIURITest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIUpdatorImplTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIUpdatorTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIValidatorTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/DSLQueryBuilderTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/AAIResultWrapperTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/RelationshipsTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriFromUriTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactoryTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUriTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUriTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/objects/CustomAAIObjectType.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/defaultproperties/DefaultAAIPropertiesImpl.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/graphinventory/GraphInventoryPatchConverterTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/graphinventory/entities/uri/parsers/UriParserSpringImplTest.java create mode 100644 graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryPayloadExceptionTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIClientResponseExceptionMapperTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIPServerTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIURITest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIUpdatorImplTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIUpdatorTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/objects/CustomAAIObjectType.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/defaultproperties/DefaultAAIPropertiesImpl.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverterTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImplTest.java delete mode 100644 graph-inventory/aai-client/src/test/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadExceptionTest.java diff --git a/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java index 70e4e1d88b..038b0e44d3 100644 --- a/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java +++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java @@ -27,11 +27,11 @@ import java.util.Optional; import org.apache.logging.log4j.util.Strings; import org.onap.aai.domain.yang.*; import org.onap.so.adapters.vevnfm.exception.VeVnfmException; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.entities.uri.Depth; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; diff --git a/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiPropertiesExt.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiPropertiesExt.java index e8660086c0..5e3212a225 100644 --- a/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiPropertiesExt.java +++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiPropertiesExt.java @@ -23,8 +23,8 @@ package org.onap.so.adapters.vevnfm.aai; import java.net.MalformedURLException; import java.net.URL; import org.onap.so.adapters.vevnfm.configuration.ConfigProperties; -import org.onap.so.client.aai.AAIProperties; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIProperties; +import org.onap.aaiclient.client.aai.AAIVersion; import org.onap.so.spring.SpringContextHelper; import org.springframework.context.ApplicationContext; diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/extclients/aai/AaiClientProvider.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/extclients/aai/AaiClientProvider.java index f12ff4c89b..be1b68470a 100644 --- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/extclients/aai/AaiClientProvider.java +++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/extclients/aai/AaiClientProvider.java @@ -20,7 +20,7 @@ package org.onap.so.adapters.etsi.sol003.adapter.lcm.extclients.aai; -import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.AAIResourcesClient; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/extclients/aai/AaiPropertiesImpl.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/extclients/aai/AaiPropertiesImpl.java index cc1af3d215..8a14e8f59e 100644 --- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/extclients/aai/AaiPropertiesImpl.java +++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/extclients/aai/AaiPropertiesImpl.java @@ -20,8 +20,8 @@ package org.onap.so.adapters.etsi.sol003.adapter.lcm.extclients.aai; -import org.onap.so.client.aai.AAIProperties; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIProperties; +import org.onap.aaiclient.client.aai.AAIVersion; import org.onap.so.spring.SpringContextHelper; import org.springframework.context.ApplicationContext; import java.net.MalformedURLException; diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/extclients/aai/AaiServiceProviderImpl.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/extclients/aai/AaiServiceProviderImpl.java index 140d0370e0..5c7b0bec47 100644 --- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/extclients/aai/AaiServiceProviderImpl.java +++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/extclients/aai/AaiServiceProviderImpl.java @@ -27,9 +27,9 @@ import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.GenericVnfs; import org.onap.aai.domain.yang.Vserver; import org.onap.etsi.sol003.adapter.lcm.v1.model.Tenant; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.entities.uri.Depth; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/rest/Sol003GrantControllerTest.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/rest/Sol003GrantControllerTest.java index d15693ddfc..f7b84a4ee0 100644 --- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/rest/Sol003GrantControllerTest.java +++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/rest/Sol003GrantControllerTest.java @@ -50,8 +50,8 @@ import org.onap.so.adapters.etsi.sol003.adapter.lcm.grant.model.GrantsLinks; import org.onap.so.adapters.etsi.sol003.adapter.lcm.grant.model.GrantsLinksVnfLcmOpOcc; import org.onap.so.adapters.etsi.sol003.adapter.lcm.grant.model.InlineResponse201; import org.onap.so.adapters.etsi.sol003.adapter.lcm.grant.model.InlineResponse201VimConnections; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.test.context.SpringBootTest; diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/rest/Sol003LcnControllerTest.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/rest/Sol003LcnControllerTest.java index ec35099469..e67e840e35 100644 --- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/rest/Sol003LcnControllerTest.java +++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/rest/Sol003LcnControllerTest.java @@ -70,8 +70,8 @@ import org.onap.so.adapters.etsi.sol003.adapter.lcm.lcn.model.VnfIdentifierCreat import org.onap.so.adapters.etsi.sol003.adapter.lcm.lcn.model.VnfLcmOperationOccurrenceNotification; import org.onap.so.adapters.etsi.sol003.adapter.lcm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationEnum; import org.onap.so.adapters.etsi.sol003.adapter.lcm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationStateEnum; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.test.context.SpringBootTest; diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/rest/VnfmAdapterControllerTest.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/rest/VnfmAdapterControllerTest.java index 4280e579be..2901af7673 100644 --- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/rest/VnfmAdapterControllerTest.java +++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsi/sol003/adapter/lcm/rest/VnfmAdapterControllerTest.java @@ -67,9 +67,9 @@ import org.onap.so.adapters.etsi.sol003.adapter.lcm.extclients.vnfm.model.Inline import org.onap.so.adapters.etsi.sol003.adapter.lcm.extclients.vnfm.model.InlineResponse201LinksSelf; import org.onap.so.adapters.etsi.sol003.adapter.lcm.lcn.JSON; import org.onap.so.adapters.etsi.sol003.adapter.lcm.rest.exceptions.VnfmNotFoundException; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.AAIVersion; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.test.context.SpringBootTest; diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientPropertiesImpl.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientPropertiesImpl.java index 3333c64cd8..61adfcf061 100644 --- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientPropertiesImpl.java +++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientPropertiesImpl.java @@ -22,8 +22,8 @@ package org.onap.so.adapters.nssmf.extclients.aai; import java.net.MalformedURLException; import java.net.URL; -import org.onap.so.client.aai.AAIProperties; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIProperties; +import org.onap.aaiclient.client.aai.AAIVersion; import org.onap.so.spring.SpringContextHelper; import org.springframework.context.ApplicationContext; diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientProvider.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientProvider.java index 48e3ef1666..5959b0e6d9 100644 --- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientProvider.java +++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientProvider.java @@ -20,7 +20,7 @@ package org.onap.so.adapters.nssmf.extclients.aai; -import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.AAIResourcesClient; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java index f8422e2a8f..8cb47ebf38 100644 --- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java +++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java @@ -23,8 +23,8 @@ package org.onap.so.adapters.nssmf.extclients.aai; import org.onap.aai.domain.yang.EsrSystemInfoList; import org.onap.aai.domain.yang.EsrThirdpartySdncList; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java index 380f42fa69..2849907e38 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java @@ -5,12 +5,12 @@ import java.util.Optional; import org.onap.aai.domain.yang.CloudRegion; import org.onap.aai.domain.yang.Complex; import org.onap.aai.domain.yang.NetworkTechnologies; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.NetworkTechnologyReference; import org.onap.so.db.catalog.client.CatalogDbClient; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteAAIInventory.java index 77a7435295..15c5eda054 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteAAIInventory.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteAAIInventory.java @@ -20,7 +20,7 @@ package org.onap.so.adapters.inventory.delete; -import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.AAIResourcesClient; import org.onap.so.cloud.CloudConfig; import org.onap.so.cloud.resource.beans.CloudInformation; import org.onap.so.db.catalog.beans.CloudIdentity; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java index 68b8598267..12e416f43c 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java @@ -22,8 +22,8 @@ package org.onap.so.adapters.openstack; import java.net.MalformedURLException; import java.net.URL; -import org.onap.so.client.aai.AAIProperties; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIProperties; +import org.onap.aaiclient.client.aai.AAIVersion; import org.onap.so.spring.SpringContextHelper; import org.springframework.context.ApplicationContext; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java index 7622c1ba28..0c6bb6f387 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java @@ -20,7 +20,7 @@ package org.onap.so.adapters.tasks.audit; -import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.AAIResourcesClient; public class AbstractAudit { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java index 182ae11166..010475c87a 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java @@ -29,7 +29,7 @@ import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.audit.beans.AuditInventory; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.logging.tasks.AuditMDCSetup; import org.onap.so.objects.audit.AAIObjectAuditList; import org.slf4j.Logger; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java index 2c76acdb1b..4e8443bf45 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java @@ -4,7 +4,7 @@ import java.io.IOException; import java.util.List; import java.util.Optional; import org.onap.so.audit.beans.AuditInventory; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.db.request.beans.RequestProcessingData; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.objects.audit.AAIObjectAuditList; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java index 55cde4d174..a7fdc352cd 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java @@ -27,7 +27,7 @@ import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.audit.beans.AuditInventory; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.logging.tasks.AuditMDCSetup; import org.onap.so.objects.audit.AAIObjectAuditList; import org.slf4j.Logger; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java index 63853c34fa..1445622357 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java @@ -27,13 +27,13 @@ import org.onap.aai.domain.yang.LInterface; import org.onap.aai.domain.yang.VfModule; import org.onap.aai.domain.yang.VfModules; import org.onap.aai.domain.yang.Vserver; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.objects.audit.AAIObjectAudit; import org.onap.so.objects.audit.AAIObjectAuditList; import org.slf4j.Logger; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java index 1554881193..ed45346131 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java @@ -37,8 +37,8 @@ import org.onap.aai.domain.yang.LInterfaces; import org.onap.aai.domain.yang.Vlan; import org.onap.aai.domain.yang.Vlans; import org.onap.aai.domain.yang.Vserver; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.objects.audit.AAIObjectAudit; import org.onap.so.objects.audit.AAIObjectAuditList; import org.onap.so.openstack.utils.MsoHeatUtils; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java index e7c0fe21e0..eab0451aa6 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java @@ -23,7 +23,7 @@ package org.onap.so.adapters.tasks.inventory; import java.util.ArrayList; import java.util.List; import org.apache.commons.collections.CollectionUtils; -import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.AAIResourcesClient; import org.onap.so.cloud.CloudConfig; import org.onap.so.cloud.resource.beans.CloudInformation; import org.onap.so.db.catalog.beans.CloudIdentity; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java index 6b980cb590..dcf33da128 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java @@ -60,15 +60,15 @@ import org.onap.aai.domain.yang.Vlan; import org.onap.aai.domain.yang.Vlans; import org.onap.aai.domain.yang.Vserver; import org.onap.logging.filter.base.ErrorCode; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.AAISingleTransactionClient; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.entities.uri.Depth; -import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.AAISingleTransactionClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; +import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed; import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.db.catalog.beans.ServerType; import org.onap.so.heatbridge.constants.HeatBridgeConstants; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java index 5271528e91..e9e25db376 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java @@ -48,9 +48,9 @@ import org.onap.aai.domain.yang.RelationshipData; import org.onap.aai.domain.yang.RelationshipList; import org.onap.aai.domain.yang.SriovVf; import org.onap.aai.domain.yang.Vserver; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.heatbridge.constants.HeatBridgeConstants; import org.openstack4j.model.compute.Server; import org.openstack4j.model.network.Port; diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java index 2df56ede10..76bc8d2456 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java @@ -17,10 +17,10 @@ import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.onap.aai.domain.yang.CloudRegion; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.catalog.data.repository.NetworkTechnologyReferenceRepository; diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java index d5f8f865a8..fd36995f3d 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java @@ -15,7 +15,7 @@ import org.mockito.junit.MockitoJUnitRunner; import org.onap.aai.domain.yang.Vserver; import org.onap.so.adapters.tasks.audit.AuditDataService; import org.onap.so.audit.beans.AuditInventory; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.db.request.beans.RequestProcessingData; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.objects.audit.AAIObjectAudit; diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java index af4afd41a1..e70b56dfc5 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java @@ -41,13 +41,12 @@ import org.onap.aai.domain.yang.LInterfaces; import org.onap.aai.domain.yang.VfModule; import org.onap.aai.domain.yang.VfModules; import org.onap.aai.domain.yang.Vserver; -import org.onap.so.adapters.tasks.audit.AuditVServer; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.objects.audit.AAIObjectAudit; import org.onap.so.objects.audit.AAIObjectAuditList; import org.skyscreamer.jsonassert.JSONAssert; diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java index 583bfbadb2..1b7b5ff9a1 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java @@ -30,7 +30,7 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.onap.so.adapters.tasks.inventory.CreateAAIInventory; import org.onap.so.audit.beans.AuditInventory; -import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.AAIResourcesClient; import org.onap.so.objects.audit.AAIObjectAuditList; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java index 653099a0ea..12c42877fd 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java @@ -33,7 +33,7 @@ import org.mockito.MockitoAnnotations; import org.onap.so.adapters.tasks.inventory.CreateAAIInventory; import org.onap.so.adapters.tasks.inventory.CreateInventoryTask; import org.onap.so.adapters.tasks.inventory.InventoryException; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.logging.tasks.AuditMDCSetup; import org.onap.so.objects.audit.AAIObjectAudit; import org.onap.so.objects.audit.AAIObjectAuditList; diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java index 6ecdcf9f28..8ce537bb97 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java @@ -64,12 +64,12 @@ import org.onap.aai.domain.yang.LInterface; import org.onap.aai.domain.yang.PInterface; import org.onap.aai.domain.yang.SriovPf; import org.onap.aai.domain.yang.Vserver; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.AAISingleTransactionClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.AAISingleTransactionClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed; import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.heatbridge.constants.HeatBridgeConstants; import org.onap.so.heatbridge.openstack.api.OpenstackClient; diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java index 99d6b4dc12..8e38935441 100644 --- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java +++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java @@ -11,7 +11,7 @@ import org.onap.so.adapters.appc.orchestrator.client.beans.Parameters; import org.onap.so.adapters.appc.orchestrator.client.beans.RequestParameters; import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest; import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVm; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java index 3eac851f13..82b0695ed9 100644 --- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java +++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java @@ -23,7 +23,7 @@ import org.onap.so.adapters.appc.orchestrator.client.beans.RequestParameters; import org.onap.so.adapters.appc.orchestrator.service.ApplicationControllerTaskImpl; import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest; import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVnf; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java index 973430c37e..ff979acf7b 100644 --- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java +++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java @@ -22,7 +22,7 @@ import org.onap.so.adapters.appc.orchestrator.client.beans.RequestParameters; import org.onap.so.adapters.appc.orchestrator.service.ApplicationControllerTaskImpl; import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest; import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVnf; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import com.fasterxml.jackson.core.JsonProcessingException; import org.onap.appc.client.lcm.model.Action; diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java index 6ca97c7c67..3ae815dd71 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java @@ -22,8 +22,8 @@ package org.onap.so.asdc.tenantIsolation; import java.net.MalformedURLException; import java.net.URL; -import org.onap.so.client.aai.AAIProperties; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIProperties; +import org.onap.aaiclient.client.aai.AAIVersion; import org.onap.so.spring.SpringContextHelper; import org.springframework.context.ApplicationContext; diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java index 0128078a59..85442675c0 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java @@ -25,11 +25,11 @@ package org.onap.so.asdc.tenantIsolation; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.entities.uri.Depth; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.data.repository.ServiceRepository; import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImplTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImplTest.java index 9aad96cbc4..1c81553d38 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImplTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImplTest.java @@ -24,7 +24,7 @@ import static org.junit.Assert.assertEquals; import org.junit.BeforeClass; import org.junit.Test; import org.onap.so.asdc.BaseTest; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIVersion; public class AaiClientPropertiesImplTest extends BaseTest { diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java index 9ef41c7cbf..67889c60da 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java @@ -35,8 +35,8 @@ import org.junit.rules.ExpectedException; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.onap.so.asdc.BaseTest; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.so.db.catalog.beans.Service; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy index ecd90165c2..66e896ead7 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy @@ -38,8 +38,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.client.HttpClient -import org.onap.so.client.aai.AAIVersion -import org.onap.so.client.aai.entities.uri.AAIUri +import org.onap.aaiclient.client.aai.AAIVersion +import org.onap.aaiclient.client.aai.entities.uri.AAIUri import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy index e83e7e2ea2..ec3dac511d 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy @@ -33,7 +33,7 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.client.HttpClientFactory -import org.onap.so.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.AAIResourcesClient import org.springframework.web.util.UriUtils import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy index e5fff9c100..d85c387029 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy @@ -23,7 +23,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor -import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper import org.onap.logging.filter.base.ErrorCode import static org.apache.commons.lang3.StringUtils.isBlank; @@ -37,10 +37,10 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.AllottedResource import org.onap.so.bpmn.core.WorkflowException import org.onap.so.client.PreconditionFailedException -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy index 9c8d8bfa12..c5a0e46fe5 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy @@ -26,9 +26,9 @@ package org.onap.so.bpmn.common.scripts import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.VolumeGroup -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.LoggingAnchor diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy index 24375e59cc..83be39c264 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy @@ -26,11 +26,11 @@ import org.onap.so.logger.LoggingAnchor import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.VolumeGroup -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.Relationships -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.Relationships +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy index c0124cfd50..9758c126a9 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy @@ -27,11 +27,11 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.GenericVnfs import org.onap.so.bpmn.core.RollbackData -import org.onap.so.client.aai.AAIObjectPlurals -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.so.db.catalog.beans.OrchestrationStatus import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.LoggingAnchor diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy index 7e46784af2..8a74307df6 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy @@ -24,9 +24,9 @@ package org.onap.so.bpmn.common.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy index 4b33676955..8c6ebefc49 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy @@ -25,10 +25,10 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy index 203ccb97f6..9593aa15be 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy @@ -38,10 +38,10 @@ import org.springframework.web.util.UriUtils import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.client.HttpClient -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.logger.MessageEnum import org.slf4j.Logger diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy index 50c4e56547..051f69381a 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy @@ -30,12 +30,12 @@ import org.hibernate.engine.jdbc.Size.LobMultiplier import org.onap.so.bpmn.core.WorkflowException import org.onap.aai.domain.yang.GenericVnf import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.springframework.web.util.UriUtils import org.onap.so.logger.MessageEnum import org.slf4j.Logger diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy index f19933fa8b..9a78472540 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy @@ -27,10 +27,10 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy index 9b12413177..20f9721b2e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy @@ -27,9 +27,9 @@ import javax.ws.rs.NotFoundException import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java index 5a9ef25c03..21132aa665 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java @@ -20,10 +20,10 @@ package org.onap.so.bpmn.common; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.aai.AAIQueryClient; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIQueryClient; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.so.client.cds.CDSProcessingClient; import org.onap.so.client.cds.CDSProcessingListener; import org.onap.so.client.policy.PolicyClientImpl; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index 01a0c3aeea..0fd38badad 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -52,12 +52,12 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ServiceModelNotFoundException; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java index 85f5f1f728..4e0b5634ea 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -48,14 +48,14 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.entities.uri.Depth; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java index e4012e1290..c7e3234a56 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java @@ -28,10 +28,10 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index 4455c9fe9d..79e957155d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -38,8 +38,8 @@ import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java index c88e9ae34f..c2283f1627 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java @@ -23,8 +23,8 @@ package org.onap.so.client.restproperties; import java.net.MalformedURLException; import java.net.URL; import org.onap.so.bpmn.core.UrnPropertiesReader; -import org.onap.so.client.aai.AAIProperties; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIProperties; +import org.onap.aaiclient.client.aai.AAIVersion; import org.springframework.stereotype.Component; @Component diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy index 97db9775c9..f0b1bfe047 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy @@ -27,10 +27,10 @@ import org.junit.Test import org.mockito.Mockito import org.mockito.internal.stubbing.answers.DoesNothing import org.onap.aai.domain.yang.AllottedResource -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.core.UriBuilder import static org.junit.Assert.assertEquals import static org.junit.Assert.assertTrue diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy index 79aacdfbe9..8a80d79cf9 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy @@ -34,10 +34,10 @@ import org.onap.aai.domain.yang.VolumeGroup import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupName import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupNameFactory import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.springframework.http.HttpStatus diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy index e40b877177..cd57434d5f 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy @@ -36,10 +36,10 @@ import org.onap.aai.domain.yang.Relationship import org.onap.aai.domain.yang.RelationshipData import org.onap.aai.domain.yang.RelationshipList import org.onap.aai.domain.yang.VolumeGroup -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults class ConfirmVolumeGroupTenantTest extends MsoGroovyTest { diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy index dac038fab3..6994639e0f 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy @@ -41,7 +41,7 @@ import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.VfModule import org.onap.aai.domain.yang.VfModules import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.springframework.core.env.Environment class CreateAAIVfModuleTest extends MsoGroovyTest{ diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy index ea38ed8c83..4f36aec827 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy @@ -28,9 +28,9 @@ import org.junit.Before import org.junit.Test import org.mockito.Mockito import org.mockito.Spy -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{ diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy index 2a872511e7..32a50776e6 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy @@ -39,7 +39,7 @@ import org.mockito.Mockito import org.mockito.Spy import org.onap.aai.domain.yang.GenericVnf import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri class DeleteAAIVfModuleTest extends MsoGroovyTest{ diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy index 79b40ba385..c8eeb0a957 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy @@ -33,14 +33,14 @@ import org.mockito.junit.MockitoJUnitRunner import org.onap.aai.domain.yang.GenericVnf import org.onap.so.bpmn.mock.FileUtil import org.onap.so.client.HttpClient -import org.onap.so.client.aai.AAIObjectPlurals -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults @RunWith(MockitoJUnitRunner.Silent.class) diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy index 39aadd29d7..1918d10fe7 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy @@ -35,9 +35,9 @@ import org.mockito.ArgumentCaptor import org.mockito.Captor import org.mockito.MockitoAnnotations import org.mockito.Spy -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.aai.domain.yang.VfModule import com.github.tomakehurst.wiremock.junit.WireMockRule diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java index 96ea1cad9b..9d64977577 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java @@ -27,7 +27,7 @@ import java.io.IOException; import org.junit.BeforeClass; import org.junit.Test; import org.onap.so.client.RestPropertiesLoader; -import org.onap.so.client.aai.AAIProperties; +import org.onap.aaiclient.client.aai.AAIProperties; import org.onap.so.client.dmaap.DmaapProperties; import org.onap.so.client.dmaap.DmaapPropertiesLoader; import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index c730844aac..b327847c11 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -94,11 +94,11 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ServiceModelNotFoundException; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java index 64e1b40739..b623475939 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java @@ -71,13 +71,13 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.entities.uri.Depth; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.Service; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java index 1f4c8d3f1d..edd214f85f 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java @@ -42,10 +42,10 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java index aae62445de..e05a3bda8f 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java @@ -40,8 +40,8 @@ import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.mock.FileUtil; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.objects.audit.AAIObjectAudit; import org.onap.so.objects.audit.AAIObjectAuditList; import org.springframework.beans.BeanUtils; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/AAIPropertiesImplTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/AAIPropertiesImplTest.java index 0d6fede4bf..fc8dfa86c4 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/AAIPropertiesImplTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/AAIPropertiesImplTest.java @@ -24,7 +24,7 @@ import static org.junit.Assert.assertEquals; import java.net.MalformedURLException; import java.net.URL; import org.junit.Test; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIVersion; public class AAIPropertiesImplTest { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java index badf444fc6..cd07f7b970 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java @@ -35,7 +35,7 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.junit.Test; import org.onap.so.client.RestPropertiesLoader; -import org.onap.so.client.aai.AAIProperties; +import org.onap.aaiclient.client.aai.AAIProperties; import org.onap.so.BaseTest; public class ThreadedReadTest { diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java index 96ea1cad9b..9d64977577 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java @@ -27,7 +27,7 @@ import java.io.IOException; import org.junit.BeforeClass; import org.junit.Test; import org.onap.so.client.RestPropertiesLoader; -import org.onap.so.client.aai.AAIProperties; +import org.onap.aaiclient.client.aai.AAIProperties; import org.onap.so.client.dmaap.DmaapProperties; import org.onap.so.client.dmaap.DmaapPropertiesLoader; import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationService.groovy index 4ed0ea6a44..8e3bef69de 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationService.groovy @@ -33,11 +33,11 @@ import org.onap.so.bpmn.common.scripts.RequestDBUtil import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.db.request.beans.OperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy index a8c3ef189e..334f5b4e4f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy @@ -32,11 +32,11 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.RequestDBUtil import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.db.request.beans.OperationStatus import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.LoggingAnchor diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy index 3233bfff61..169c00b68b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy @@ -26,7 +26,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.RequestDBUtil import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.AAIResourcesClient import org.onap.so.db.request.beans.OperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy index ced1b928fc..be5a029062 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy @@ -41,10 +41,10 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory import java.util.Map diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy index 71da2abd05..8689972c73 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy @@ -36,10 +36,10 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.ServiceInfo import org.onap.so.bpmn.core.domain.ServiceProxy import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.db.request.beans.OperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy index 650f79b633..c9ad18b0be 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy @@ -35,10 +35,10 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index 7d1bc4c779..2b9e43109c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -41,11 +41,11 @@ import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.ResourceType import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.client.aai.AAIObjectPlurals -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy index 1efc1c11aa..b3f030d480 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy @@ -24,10 +24,10 @@ import com.fasterxml.jackson.databind.ObjectMapper import org.onap.aai.domain.yang.ServiceInstance import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.core.Response diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy index 2e664d90da..80b6641bb7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy @@ -23,9 +23,9 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.client.HttpClientFactory -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy index 33a607268d..1dfe13738e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy @@ -29,9 +29,9 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; import org.onap.so.bpmn.common.scripts.ExceptionUtil; import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy index da486bb1c3..057863be28 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy @@ -41,10 +41,10 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.ExternalAPIUtil import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy index b121083954..84da1e4ec9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy @@ -36,11 +36,11 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.db.request.beans.OperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy index 1d3b2757e7..99289b85b1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy @@ -37,10 +37,10 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder import org.onap.so.client.HttpClient -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index cdc242dbd8..cc5b8cf1e8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -38,11 +38,11 @@ import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.ResourceType import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy index d8160a97bc..f5e90000b3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy @@ -30,11 +30,11 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.RequestDBUtil import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.db.request.beans.OperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy index eb2ec2bc9d..bc118791a3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy @@ -33,10 +33,10 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.VidUtils; import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy index d5b554d841..f58cd9a60d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy @@ -13,12 +13,12 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.ServiceProxy import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIEdgeLabel -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.db.request.client.RequestsDbClient import org.onap.so.db.request.beans.OrchestrationTask import org.slf4j.Logger diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy index d786cb0ba1..e2aa7972df 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy @@ -31,11 +31,11 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIEdgeLabel -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy index 9f378e567c..8cd9dee011 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy @@ -37,11 +37,11 @@ import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.domain.ResourceModelInfo import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy index fb4bd158b7..26dcaa7ac4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy @@ -27,10 +27,10 @@ import org.onap.aai.domain.yang.ServiceInstance import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index 6af7cc069e..b90a34ea94 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -44,12 +44,12 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy index a12c2f4b85..3638d89faa 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy @@ -38,10 +38,10 @@ import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.logger.MessageEnum import org.onap.so.bpmn.common.scripts.ExceptionUtil; -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient import java.util.UUID; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy index 4d1807b796..00242b27f6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy @@ -38,15 +38,15 @@ import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectPlurals -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.Relationships -import org.onap.so.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.Relationships +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy index 78b8e2d8a7..fce12e56b0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy @@ -40,10 +40,10 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.ServiceInstance import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy index 5a955e65f5..b71379449e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy @@ -23,10 +23,10 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.ServiceInstance import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy index c66a89b9c6..8ab7c7a2d1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy @@ -19,11 +19,11 @@ import org.onap.so.bpmn.core.domain.ServiceProxy import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.db.request.client.RequestsDbClient import org.onap.so.db.request.beans.OrchestrationTask import org.slf4j.Logger diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy index 4835c9b84b..d5469c81a2 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy @@ -24,9 +24,9 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.so.logger.LoggingAnchor import org.onap.so.client.HttpClientFactory -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 1a3df6ff4e..366cdfdb09 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -51,14 +51,14 @@ import org.onap.so.bpmn.core.json.DecomposeJsonUtil import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.client.aai.AAIObjectPlurals -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults import org.onap.so.db.catalog.beans.HomingInstance import org.onap.so.logger.LoggingAnchor diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy index a505aa1a34..b3c4698ab8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy @@ -34,11 +34,11 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.client.aai.AAIObjectPlurals -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy index 7f2a3e4245..80f6e0edb2 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy @@ -30,11 +30,11 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectPlurals -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy index fafe97b0eb..b1d909b6b4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy @@ -36,11 +36,11 @@ import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectPlurals -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.onap.so.db.catalog.beans.OrchestrationStatus import org.slf4j.Logger diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy index 823217c4f7..9a584224ff 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy @@ -44,10 +44,10 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory /** * This class supports the DoCreateVnf building block subflow diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy index 72f71686d9..76629dd1ba 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy @@ -50,10 +50,10 @@ import org.w3c.dom.Element import org.w3c.dom.Node import org.w3c.dom.NodeList import org.xml.sax.InputSource -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient import groovy.json.* diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy index bc535a348f..53a98c2ec6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy @@ -44,11 +44,11 @@ import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils; -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.json.JSONObject import javax.ws.rs.NotFoundException import groovy.json.* diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy index 8d8e97328d..e6f6af5ab7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy @@ -38,10 +38,10 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.db.request.beans.OperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index 35af3d34d6..21fc50c9b6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -47,11 +47,11 @@ import org.onap.so.bpmn.core.domain.VnfcResource import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.logging.filter.base.ONAPComponents; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy index 0d49d91910..51be632f47 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy @@ -38,12 +38,12 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.Relationships -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.Relationships +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy index 1acadbdad8..a55381b295 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy @@ -35,11 +35,11 @@ import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy index 76086dab49..5354d52fce 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy @@ -28,10 +28,10 @@ import org.onap.aai.domain.yang.ServiceInstance import org.onap.aai.domain.yang.SliceProfiles import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy index 28f4460d71..42f4cb7bd7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy @@ -29,9 +29,9 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.logging.filter.base.ONAPComponents; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy index e776eaf422..33a1ece091 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy @@ -39,11 +39,11 @@ import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectPlurals -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy index 350de4a03d..786cd3d747 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy @@ -40,12 +40,12 @@ import org.onap.so.bpmn.common.scripts.VfModuleBase import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.graphinventory.entities.uri.Depth -import org.onap.so.client.aai.AAIObjectPlurals -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy index c419f0dc7d..db90cd0d7b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy @@ -35,11 +35,11 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.Relationships -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.Relationships +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy index 25303473c7..25fbc93c0a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy @@ -34,12 +34,12 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.graphinventory.entities.uri.Depth; -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.w3c.dom.Document import org.w3c.dom.Element import org.w3c.dom.Node diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy index ff58fd567d..2a0cb5e610 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy @@ -41,10 +41,10 @@ import org.onap.so.bpmn.core.domain.ModuleResource import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.graphinventory.entities.uri.Depth -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.aai.AAIObjectType +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy index 508131279a..6b91fec03e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy @@ -20,8 +20,8 @@ * ============LICENSE_END========================================================= */ package org.onap.so.bpmn.infrastructure.scripts -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import static org.apache.commons.lang3.StringUtils.*; @@ -36,11 +36,11 @@ import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.springframework.web.util.UriUtils; import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy index 0a635c6bc6..154de6b887 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy @@ -32,11 +32,11 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.bpmn.common.scripts.ExceptionUtil; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy index 87e56791fc..868ed214be 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy @@ -38,12 +38,12 @@ import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy index ff63bc945b..00cf2a3ff1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy @@ -37,12 +37,12 @@ import org.onap.so.bpmn.common.scripts.VfModuleBase import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy index 7caa63ec72..7e180ca542 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy @@ -37,11 +37,11 @@ import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.ModuleResource import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.so.client.HttpClient -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy index 275cef0b0c..841c2a44cd 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy @@ -32,7 +32,7 @@ import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.* +import org.onap.aaiclient.client.aai.* import org.onap.so.client.appc.ApplicationControllerOrchestrator import org.onap.so.client.appc.ApplicationControllerSupport import org.onap.logging.filter.base.ErrorCode diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy index 8e554e286d..282e9611fd 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy @@ -39,11 +39,11 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.springframework.web.util.UriUtils import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy index 575a8f3f1a..75ee556cfb 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy @@ -29,7 +29,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.client.aai.AAIValidatorImpl +import org.onap.aaiclient.client.aai.AAIValidatorImpl import org.onap.so.client.appc.ApplicationControllerClient import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy index f1fbafc7de..3928747e17 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy @@ -31,11 +31,11 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.VfModuleBase import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.Relationships -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.Relationships +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy index 5449ba6708..a89ea5925b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy @@ -36,11 +36,11 @@ import org.onap.so.bpmn.common.scripts.VfModuleBase import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.Relationships -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.Relationships +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy index 053e2b36d1..8dd014a076 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy @@ -32,9 +32,9 @@ import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIRestClientImpl -import org.onap.so.client.aai.AAIUpdatorImpl -import org.onap.so.client.aai.AAIValidatorImpl +import org.onap.aaiclient.client.aai.AAIRestClientImpl +import org.onap.aaiclient.client.aai.AAIUpdatorImpl +import org.onap.aaiclient.client.aai.AAIValidatorImpl import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy index 980128c848..c2da495bff 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy @@ -39,11 +39,11 @@ import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.* -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.Relationships -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.* +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.Relationships +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.appc.ApplicationControllerClient import org.onap.so.client.appc.ApplicationControllerSupport import org.onap.so.logger.MessageEnum diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy index 70b7ec102b..ddc80f6a50 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy @@ -28,10 +28,10 @@ import org.onap.logging.filter.base.ErrorCode import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.* -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.* +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy index c5f117b35f..603d5e4dd9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy @@ -31,10 +31,10 @@ import org.onap.logging.filter.base.ErrorCode import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.* -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.* +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.appc.ApplicationControllerClient import org.onap.so.client.appc.ApplicationControllerSupport import org.onap.so.logger.LoggingAnchor diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy index 5205fa1874..8b67790ffc 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy @@ -36,12 +36,12 @@ import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.Relationships -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.Relationships +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.NotFoundException /** diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy index a4f7766c15..683b82e4a7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy @@ -32,10 +32,10 @@ import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy index fc50d3a3b3..9782440e85 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy @@ -31,9 +31,9 @@ import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java index ce53044052..1cc68953f8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java @@ -24,10 +24,10 @@ import java.util.HashMap; import java.util.Map; import java.util.Optional; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java index c489ef29ce..22166483b1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java @@ -23,9 +23,9 @@ package org.onap.so.bpmn.infrastructure.aai; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.bpmn.common.scripts.ExceptionUtil; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java index 1410752f76..a6971318b7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.aai; -import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.AAIResourcesClient; import org.springframework.stereotype.Component; @Component diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java index bbca10be0f..c2e2a3c258 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java @@ -27,11 +27,11 @@ import java.util.Map; import java.util.Optional; import org.onap.aai.domain.yang.OwningEntities; import org.onap.aai.domain.yang.OwningEntity; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java index 11707c4149..bb7415da93 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java @@ -23,10 +23,10 @@ package org.onap.so.bpmn.infrastructure.aai.groovyflows; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.bpmn.common.scripts.ExceptionUtil; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java index e6df8070a3..001e166893 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java @@ -22,11 +22,11 @@ package org.onap.so.bpmn.infrastructure.pnf.management; import java.util.Optional; import org.onap.aai.domain.yang.Pnf; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.AAIRestClientImpl; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.AAIRestClientImpl; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.springframework.stereotype.Component; @Component diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java index e7e0951d04..99ed7b1e91 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java @@ -59,14 +59,14 @@ import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.domain.Resource; import org.onap.so.bpmn.core.domain.ServiceDecomposition; import org.onap.so.bpmn.core.json.JsonUtils; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResourceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResourceTest.groovy index d4857503b5..1551533e53 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResourceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResourceTest.groovy @@ -27,9 +27,9 @@ import org.mockito.Mockito import org.mockito.MockitoAnnotations import org.mockito.Spy import org.onap.so.bpmn.common.scripts.MsoGroovyTest -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.NotFoundException diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy index 1b92592e37..09b17701a6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy @@ -34,10 +34,10 @@ import org.mockito.runners.MockitoJUnitRunner import org.onap.aai.domain.yang.ResultData import org.onap.aai.domain.yang.SearchResults import org.onap.so.bpmn.common.scripts.MsoGroovyTest -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import static org.junit.Assert.assertEquals import static org.mockito.Mockito.* diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy index 8c08e51efe..39d0334bef 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy @@ -30,10 +30,10 @@ import org.onap.so.bpmn.common.scripts.MsoGroovyTest import org.onap.so.bpmn.core.WorkflowException import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.NotFoundException import javax.ws.rs.core.Response diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceServiceTest.groovy index fb50fcc43b..1a9c6bb474 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceServiceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceServiceTest.groovy @@ -27,10 +27,10 @@ import org.mockito.Captor import org.mockito.Mockito import org.onap.so.bpmn.common.scripts.MsoGroovyTest import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.NotFoundException diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy index 50d5506c23..7137799433 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy @@ -35,11 +35,11 @@ import org.onap.aai.domain.yang.VolumeGroup import org.onap.so.bpmn.common.scripts.DeleteAAIVfModule import org.onap.so.bpmn.common.scripts.MsoGroovyTest import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException import javax.ws.rs.NotFoundException diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationServiceTest.groovy index 37207f8022..12783ae047 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationServiceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationServiceTest.groovy @@ -30,7 +30,7 @@ import org.mockito.Mockito import org.onap.aai.domain.yang.CommunicationServiceProfile import org.onap.aai.domain.yang.ServiceInstance import org.onap.so.bpmn.common.scripts.MsoGroovyTest -import org.onap.so.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.AAIResourcesClient import static com.shazam.shazamcrest.MatcherAssert.assertThat import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy index e8170ed2cb..2b1e748de5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy @@ -46,8 +46,8 @@ import org.mockito.runners.MockitoJUnitRunner import org.onap.aai.domain.yang.L3Network import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import com.github.tomakehurst.wiremock.client.WireMock import com.github.tomakehurst.wiremock.junit.WireMockRule import org.apache.commons.lang3.* diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy index 90c7b71a07..158c43c27a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy @@ -33,7 +33,7 @@ import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.ServiceInstance import org.onap.so.bpmn.mock.StubResponseAAI -import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import static org.mockito.Mockito.* diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy index c359f74d7f..32ebf09531 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy @@ -32,9 +32,9 @@ import org.mockito.Mockito import org.mockito.MockitoAnnotations import org.mockito.Spy import org.onap.so.bpmn.common.scripts.MsoGroovyTest -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.NotFoundException import static org.junit.Assert.assertEquals import static org.mockito.ArgumentMatchers.isA diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy index 7107d15602..b2573f1b51 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy @@ -43,12 +43,12 @@ import org.onap.so.bpmn.common.scripts.utils.XmlComparator import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.mock.FileUtil -import org.onap.so.client.aai.AAIObjectPlurals -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException +import org.onap.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException import javax.ws.rs.NotFoundException diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy index 8941a24ebc..cc522544de 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy @@ -26,10 +26,10 @@ import org.onap.aai.domain.yang.VfModule import org.onap.aai.domain.yang.VolumeGroup import org.onap.aai.domain.yang.VolumeGroups; import org.onap.so.bpmn.common.scripts.MsoGroovyTest -import org.onap.so.client.aai.AAIObjectPlurals -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import static org.mockito.Mockito.spy diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy index 22414b770e..7aa162cae7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy @@ -38,11 +38,11 @@ import org.onap.aai.domain.yang.VolumeGroup import org.onap.aai.domain.yang.VolumeGroups import org.onap.so.bpmn.common.scripts.MsoGroovyTest import org.onap.so.bpmn.core.RollbackData -import org.onap.so.client.aai.AAIObjectPlurals -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import static org.junit.Assert.assertEquals diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2Test.groovy index 6b3674d908..a3b2a1c8b9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2Test.groovy @@ -27,9 +27,9 @@ import org.mockito.Spy import org.onap.aai.domain.yang.AllottedResource import org.onap.so.bpmn.common.scripts.MsoGroovyTest import org.onap.so.bpmn.mock.FileUtil -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.core.UriBuilder import static org.mockito.Mockito.times import static org.mockito.Mockito.when diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSITest.groovy index 493e2c9e1e..88140d83ce 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSITest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSITest.groovy @@ -35,9 +35,9 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.ServiceInfo import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.core.Response diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy index a95a01912d..3b172f3015 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy @@ -42,10 +42,10 @@ import org.onap.aai.domain.yang.RelationshipList import org.onap.so.bpmn.common.scripts.MsoGroovyTest import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults import com.github.tomakehurst.wiremock.client.WireMock diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceServiceTest.groovy index 8a18376819..9dbb6a5a56 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceServiceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceServiceTest.groovy @@ -27,10 +27,10 @@ import org.mockito.Captor import org.mockito.Mockito import org.onap.aai.domain.yang.ServiceInstance import org.onap.so.bpmn.common.scripts.MsoGroovyTest -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.NotFoundException diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstanceTest.groovy index c2113e2f28..0251eab668 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstanceTest.groovy @@ -28,10 +28,10 @@ import org.junit.rules.ExpectedException import org.onap.aai.domain.yang.VolumeGroup import org.onap.aai.domain.yang.VolumeGroups import org.onap.so.bpmn.common.scripts.MsoGroovyTest -import org.onap.so.client.aai.AAIObjectPlurals -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import static org.mockito.ArgumentMatchers.isA diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy index a8d07b696c..daf005eabf 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy @@ -42,12 +42,12 @@ import org.onap.aai.domain.yang.NetworkPolicies import org.onap.aai.domain.yang.NetworkPolicy import org.onap.so.bpmn.common.scripts.MsoGroovyTest import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.client.aai.AAIObjectPlurals -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import static com.github.tomakehurst.wiremock.client.WireMock.* import static org.mockito.Mockito.* diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy index 815b3a389c..0e47958249 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy @@ -45,11 +45,11 @@ import org.onap.so.bpmn.common.scripts.MsoGroovyTest import org.onap.so.bpmn.common.scripts.utils.XmlComparator import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.mock.FileUtil -import org.onap.so.client.aai.AAIObjectPlurals -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.NotFoundException diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy index 2885d6919e..dd8601fb43 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy @@ -49,11 +49,11 @@ import org.onap.so.bpmn.common.scripts.utils.XmlComparator import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.mock.FileUtil -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException import org.springframework.core.env.Environment import org.springframework.mock.env.MockEnvironment diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy index 9e4ab6f757..2da6eca84e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy @@ -39,11 +39,11 @@ import org.mockito.runners.MockitoJUnitRunner import org.onap.aai.domain.yang.GenericVnf import org.onap.so.bpmn.common.scripts.MsoGroovyTest import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.client.graphinventory.entities.uri.Depth -import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException import static com.github.tomakehurst.wiremock.client.WireMock.* import static org.mockito.Mockito.* diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy index 19bb7c86b4..a7d6cad990 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy @@ -39,7 +39,7 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.mock.FileUtil -import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper import org.springframework.mock.env.MockEnvironment import static org.mockito.ArgumentMatchers.eq diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy index 80e2c863e8..bf877bd725 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy @@ -40,10 +40,10 @@ import org.onap.aai.domain.yang.VfModule import org.onap.aai.domain.yang.VolumeGroup import org.onap.so.bpmn.common.scripts.MsoGroovyTest import org.onap.so.bpmn.mock.FileUtil -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import javax.ws.rs.core.UriBuilder diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeTest.groovy index 6771476955..6a8465e2b6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeTest.groovy @@ -38,10 +38,10 @@ import org.onap.aai.domain.yang.VfModule import org.onap.aai.domain.yang.VolumeGroup import org.onap.so.bpmn.common.scripts.MsoGroovyTest import org.onap.so.bpmn.mock.FileUtil -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import javax.ws.rs.core.UriBuilder diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy index 09244bedc4..d7f7547459 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy @@ -31,9 +31,9 @@ import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.mock.FileUtil -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.core.UriBuilder diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy index 901bdaf7b3..2a6894785e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy @@ -29,9 +29,9 @@ import org.mockito.MockitoAnnotations import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.mock.FileUtil -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.AAIResourcesClient -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.core.UriBuilder diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/GroovyTestBase.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/GroovyTestBase.groovy index 1ff098b940..36cb5ac195 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/GroovyTestBase.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/GroovyTestBase.groovy @@ -33,7 +33,7 @@ import org.mockito.junit.MockitoJUnitRunner import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.AllottedResourceUtils import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.AAIResourcesClient import static org.mockito.ArgumentMatchers.any import static org.mockito.Mockito.* diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java index 05b0db5d25..978814be7f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java @@ -36,11 +36,11 @@ import org.junit.runner.RunWith; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; @RunWith(MockitoJUnitRunner.class) public class AAICreateResourcesTest { diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java index 1aca331a17..64d3fca811 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java @@ -34,8 +34,8 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; public class AAIDeleteServiceInstanceTest { private AAIDeleteServiceInstance aaiDeleteServiceInstance; diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java index d426dc3f66..05839c1a3a 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java @@ -30,7 +30,7 @@ import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceIn import org.onap.so.BaseBPMNTest; import org.onap.so.GrpcNettyServer; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIVersion; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSWUPDownloadTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSWUPDownloadTest.java index 065d2a54a8..a0ef90d7b8 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSWUPDownloadTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSWUPDownloadTest.java @@ -32,7 +32,7 @@ import org.onap.so.BaseBPMNTest; import org.onap.so.GrpcNettyServer; import org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIVersion; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java index 2993ed6724..22cf72b262 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java @@ -32,7 +32,7 @@ import org.onap.so.BaseBPMNTest; import org.onap.so.GrpcNettyServer; import org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIVersion; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index a8eb791484..a55cd4c169 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -52,9 +52,9 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIConfigurationResources; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java index 04f47e0306..42fb719f89 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java @@ -38,9 +38,9 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.client.orchestration.AAIInstanceGroupResources; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java index 7668c6b00f..0912cba94a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java @@ -37,10 +37,10 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAINetworkResources; import org.slf4j.Logger; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java index 9c55d0a922..2668357f63 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java @@ -17,10 +17,10 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIVnfResources; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java index 332c390c7d..52edacc29d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java @@ -40,10 +40,10 @@ import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.appc.ApplicationControllerAction; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java index 1b06fe114f..edb4a4e508 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java @@ -28,7 +28,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.aai.entities.AAIEdgeLabel; +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIInstanceGroupResources; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java index f95e7afed9..c266d6c6ab 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java @@ -28,7 +28,7 @@ import org.onap.so.bpmn.infrastructure.flowspecific.exceptions.UnassignNetworkEx import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAINetworkResources; import org.slf4j.Logger; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java index 4b1e40917a..751e91d009 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java @@ -8,14 +8,14 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.cloud.resource.beans.CloudInformation; import org.onap.so.cloud.resource.beans.NodeType; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java index 1e0208b6ec..905862880f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java @@ -24,9 +24,9 @@ import java.util.List; import java.util.Optional; import org.onap.aai.domain.yang.L3Network; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index f83c0fce86..677100cfc1 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -60,12 +60,12 @@ import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.client.orchestration.AAIEntityNotFoundException; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index 5edb2b9dd8..2454274ae6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -44,8 +44,8 @@ import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.Configuration; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.Configuration; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java index f672aa4b59..de674daca3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java @@ -25,10 +25,10 @@ import java.util.Optional; import org.onap.aai.domain.yang.VpnBinding; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java index 5df7518698..7386740c25 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java @@ -22,9 +22,9 @@ package org.onap.so.client.orchestration; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java index 47be2f5bd6..a832930723 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java @@ -24,10 +24,10 @@ import java.util.Optional; import javax.ws.rs.core.UriBuilder; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIEdgeLabel; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java index 12c1d5572f..05c8f7dd8f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java @@ -25,12 +25,12 @@ import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIEdgeLabel; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java index f040627155..611d715331 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java @@ -34,16 +34,16 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIEdgeLabel; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; -import org.onap.so.client.graphinventory.entities.uri.Depth; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java index 1dde814584..a3df22a840 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java @@ -24,9 +24,9 @@ import java.util.Optional; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java index 0879e24bfb..424b3ecefa 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java @@ -32,12 +32,12 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java index f750cf2453..d5d0b0868a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java @@ -28,11 +28,11 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java index cd0a584218..c2e84f668c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java @@ -31,16 +31,16 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIRestClientImpl; -import org.onap.so.client.aai.AAIValidatorImpl; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIRestClientImpl; +import org.onap.aaiclient.client.aai.AAIValidatorImpl; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; -import org.onap.so.client.graphinventory.entities.uri.Depth; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java index 152dd0dad2..886dafe626 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java @@ -26,11 +26,11 @@ import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java index 4cdb5adfd4..5ce8268d55 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java @@ -25,11 +25,11 @@ import org.onap.aai.domain.yang.VpnBindings; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java index 8e674fb77b..9fc95a6f3f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java @@ -26,10 +26,10 @@ import java.util.Optional; import java.util.UUID; import javax.ws.rs.NotFoundException; import org.onap.aai.domain.yang.GenericVnf; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.dmaap.DmaapConsumer; import org.onap.so.client.dmaap.DmaapPublisher; import org.onap.so.client.sdno.beans.Body; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java index 29177f8275..e8ce828652 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java @@ -32,9 +32,9 @@ import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionExtractResou import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; import org.onap.so.client.appc.ApplicationControllerAction; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java index 95689e49cd..cb46d2de8a 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java @@ -44,7 +44,7 @@ import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.infrastructure.aai.tasks.AAIFlagTasks; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.AAIResourcesClient; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java index 6f96331e7f..cb1b9e5ffe 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java @@ -64,8 +64,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; -import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.db.catalog.beans.OrchestrationStatus; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java index 41589af067..243b452d18 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java @@ -51,8 +51,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri; import org.onap.so.client.exception.BBObjectNotFoundException; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java index ea1f7b47ad..38c74eecc7 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java @@ -46,8 +46,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.policy.JettisonStyleMapperProvider; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java index 21b472b0f3..db489f6f5f 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java @@ -40,7 +40,7 @@ import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIVersion; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java index f0c333007e..d2a38cb693 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java @@ -46,8 +46,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java index 3e1cd5eabe..27f40c5bce 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java @@ -41,7 +41,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.client.exception.BBObjectNotFoundException; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.objects.audit.AAIObjectAudit; import org.onap.so.objects.audit.AAIObjectAuditList; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/ControllerExecutionDETestIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/ControllerExecutionDETestIT.java index d2f52dac4c..ae43971bf8 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/ControllerExecutionDETestIT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/ControllerExecutionDETestIT.java @@ -31,7 +31,7 @@ import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput; import org.onap.so.BaseIntegrationTest; import org.onap.so.GrpcNettyServer; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIVersion; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java index 06ad66e855..944b1351c1 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java @@ -42,7 +42,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; -import org.onap.so.client.aai.entities.AAIEdgeLabel; +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; import org.onap.so.client.exception.BBObjectNotFoundException; public class AssignVnfTest extends BaseTaskTest { diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtilsTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtilsTest.java index 5eafb982e6..5ef22cab6b 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtilsTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtilsTest.java @@ -33,7 +33,7 @@ import org.mockito.Mockito; import org.onap.aai.domain.yang.L3Network; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; -import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.springframework.beans.factory.annotation.Autowired; public class NetworkBBUtilsTest extends BaseTaskTest { diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java index ed55c56231..b4b7ad86b1 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java @@ -40,7 +40,7 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; -import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; public class UnassignNetworkBBTest extends BaseTaskTest { diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java index 609d2dabd8..d75e3eb273 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java @@ -45,9 +45,9 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.namingservice.NamingRequestObject; import org.onap.so.client.namingservice.NamingServiceConstants; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModuleTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModuleTest.java index 63f7d6cbfc..b1f28dab18 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModuleTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModuleTest.java @@ -23,11 +23,11 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.cloud.resource.beans.CloudInformation; import org.onap.so.cloud.resource.beans.NodeType; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java index c05fd879ac..d9fb7f676c 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java @@ -42,9 +42,9 @@ import org.onap.aai.domain.yang.Subnet; import org.onap.aai.domain.yang.Subnets; import org.onap.aai.domain.yang.VpnBinding; import org.onap.so.bpmn.BaseTaskTest; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index 4fdd97d95a..c1107a4df8 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -84,11 +84,11 @@ import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.orchestration.AAIEntityNotFoundException; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientIT.java new file mode 100644 index 0000000000..0e99f8a9be --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientIT.java @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.so.client.namingservice; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.junit.Assert.assertTrue; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.apache.http.HttpStatus; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.namingservice.model.Deleteelement; +import org.onap.namingservice.model.Element; +import org.onap.namingservice.model.NameGenDeleteRequest; +import org.onap.namingservice.model.NameGenRequest; +import org.onap.so.BaseIntegrationTest; +import org.onap.so.client.exception.BadResponseException; +import org.springframework.beans.factory.annotation.Autowired; +import com.fasterxml.jackson.core.JsonProcessingException; + +public class NamingClientIT extends BaseIntegrationTest { + @Autowired + NamingClient client; + @Autowired + NamingRequestObjectBuilder requestBuilder; + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Test + public void assignNameGenRequest() throws BadResponseException, IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/web/service/v1/genNetworkElementName")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("NamingClient/AssignResponse.json").withStatus(HttpStatus.SC_ACCEPTED))); + + NameGenRequest request = assignSetup(); + String response = client.postNameGenRequest(request); + assertTrue(response.equals("$vnf-name")); + } + + @Test + public void assignNameGenRequestError() throws BadResponseException, IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/web/service/v1/genNetworkElementName")).willReturn(aResponse() + .withHeader("Content-Type", "application/json").withBodyFile("NamingClient/ErrorResponse.json") + .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); + + thrown.expect(BadResponseException.class); + thrown.expectMessage("Error from Naming Service: External Key is required and must be unique"); + NameGenRequest request = assignSetup(); + client.postNameGenRequest(request); + } + + @Test + public void unassignNameGenRequest() throws BadResponseException, IOException { + wireMockServer.stubFor(delete(urlPathEqualTo("/web/service/v1/genNetworkElementName")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("NamingClient/UnassignResponse.json").withStatus(HttpStatus.SC_ACCEPTED))); + + String response = client.deleteNameGenRequest(unassignSetup()); + assertTrue(response.equals("")); + } + + @Test + public void unassignNameGenRequestError() throws BadResponseException, IOException { + wireMockServer.stubFor(delete(urlPathEqualTo("/web/service/v1/genNetworkElementName")).willReturn(aResponse() + .withHeader("Content-Type", "application/json").withBodyFile("NamingClient/ErrorResponse.json") + .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); + + thrown.expect(BadResponseException.class); + thrown.expectMessage("Error from Naming Service: External Key is required and must be unique"); + client.deleteNameGenRequest(unassignSetup()); + } + + public NameGenRequest assignSetup() throws JsonProcessingException { + NameGenRequest request = new NameGenRequest(); + List elements = new ArrayList<>(); + Element testElement = new Element(); + testElement = requestBuilder.elementMapper("SomeUniqueValue", "SDNC_Policy.Config_MS_1806SRIOV_VNATJson.4.xml", + "VNF", "nfNamingCode", "vnf_name"); + elements.add(testElement); + request = requestBuilder.nameGenRequestMapper(elements); + return request; + } + + public NameGenDeleteRequest unassignSetup() throws JsonProcessingException { + NameGenDeleteRequest request = new NameGenDeleteRequest(); + List deleteElements = new ArrayList<>(); + Deleteelement testElement = new Deleteelement(); + testElement = requestBuilder.deleteElementMapper("instanceGroupId"); + deleteElements.add(testElement); + request = requestBuilder.nameGenDeleteRequestMapper(deleteElements); + return request; + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java deleted file mode 100644 index 8a387a88a4..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientTest.java +++ /dev/null @@ -1,116 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.so.client.namingservice; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static org.junit.Assert.assertTrue; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import org.apache.http.HttpStatus; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.onap.namingservice.model.Deleteelement; -import org.onap.namingservice.model.Element; -import org.onap.namingservice.model.NameGenDeleteRequest; -import org.onap.namingservice.model.NameGenRequest; -import org.onap.so.BaseIntegrationTest; -import org.onap.so.client.exception.BadResponseException; -import org.springframework.beans.factory.annotation.Autowired; -import com.fasterxml.jackson.core.JsonProcessingException; - -public class NamingClientTest extends BaseIntegrationTest { - @Autowired - NamingClient client; - @Autowired - NamingRequestObjectBuilder requestBuilder; - @Rule - public ExpectedException thrown = ExpectedException.none(); - - @Test - public void assignNameGenRequest() throws BadResponseException, IOException { - wireMockServer.stubFor(post(urlPathEqualTo("/web/service/v1/genNetworkElementName")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("NamingClient/AssignResponse.json").withStatus(HttpStatus.SC_ACCEPTED))); - - NameGenRequest request = assignSetup(); - String response = client.postNameGenRequest(request); - assertTrue(response.equals("$vnf-name")); - } - - @Test - public void assignNameGenRequestError() throws BadResponseException, IOException { - wireMockServer.stubFor(post(urlPathEqualTo("/web/service/v1/genNetworkElementName")).willReturn(aResponse() - .withHeader("Content-Type", "application/json").withBodyFile("NamingClient/ErrorResponse.json") - .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); - - thrown.expect(BadResponseException.class); - thrown.expectMessage("Error from Naming Service: External Key is required and must be unique"); - NameGenRequest request = assignSetup(); - client.postNameGenRequest(request); - } - - @Test - public void unassignNameGenRequest() throws BadResponseException, IOException { - wireMockServer.stubFor(delete(urlPathEqualTo("/web/service/v1/genNetworkElementName")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("NamingClient/UnassignResponse.json").withStatus(HttpStatus.SC_ACCEPTED))); - - String response = client.deleteNameGenRequest(unassignSetup()); - assertTrue(response.equals("")); - } - - @Test - public void unassignNameGenRequestError() throws BadResponseException, IOException { - wireMockServer.stubFor(delete(urlPathEqualTo("/web/service/v1/genNetworkElementName")).willReturn(aResponse() - .withHeader("Content-Type", "application/json").withBodyFile("NamingClient/ErrorResponse.json") - .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); - - thrown.expect(BadResponseException.class); - thrown.expectMessage("Error from Naming Service: External Key is required and must be unique"); - client.deleteNameGenRequest(unassignSetup()); - } - - public NameGenRequest assignSetup() throws JsonProcessingException { - NameGenRequest request = new NameGenRequest(); - List elements = new ArrayList<>(); - Element testElement = new Element(); - testElement = requestBuilder.elementMapper("SomeUniqueValue", "SDNC_Policy.Config_MS_1806SRIOV_VNATJson.4.xml", - "VNF", "nfNamingCode", "vnf_name"); - elements.add(testElement); - request = requestBuilder.nameGenRequestMapper(elements); - return request; - } - - public NameGenDeleteRequest unassignSetup() throws JsonProcessingException { - NameGenDeleteRequest request = new NameGenDeleteRequest(); - List deleteElements = new ArrayList<>(); - Deleteelement testElement = new Deleteelement(); - testElement = requestBuilder.deleteElementMapper("instanceGroupId"); - deleteElements.add(testElement); - request = requestBuilder.nameGenDeleteRequestMapper(deleteElements); - return request; - } -} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java index 7c40995d48..2c7ab92438 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java @@ -36,9 +36,9 @@ import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java index 8b08afdb44..2bf177ef83 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java @@ -44,11 +44,11 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIEdgeLabel; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java index 0995af058e..a73cf81e75 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java @@ -41,13 +41,13 @@ import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIEdgeLabel; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; @RunWith(MockitoJUnitRunner.Silent.class) diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java index e744e7d0df..3bc4fc0503 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java @@ -55,15 +55,15 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIEdgeLabel; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java index 6d5e6db083..215af9a19a 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java @@ -38,8 +38,8 @@ import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java index d2a1f77922..9f9ac88c3c 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java @@ -46,11 +46,11 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java index 7bae50a0a9..3dbacd2679 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java @@ -44,11 +44,11 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java index b1bacb8add..7750c8ad90 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java @@ -50,17 +50,17 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.AAIRestClientImpl; -import org.onap.so.client.aai.AAIValidatorImpl; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.AAIRestClientImpl; +import org.onap.aaiclient.client.aai.AAIValidatorImpl; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; -import org.onap.so.client.graphinventory.entities.uri.Depth; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.OrchestrationStatus; @RunWith(MockitoJUnitRunner.Silent.class) diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java index 31a0e34a26..0eae6a3fdc 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java @@ -42,11 +42,11 @@ import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java index 2688b33e51..d920b1ac6e 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java @@ -37,8 +37,8 @@ import org.onap.aai.domain.yang.VpnBindings; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; public class AAIVpnBindingResourcesTest extends BaseTaskTest { diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java new file mode 100644 index 0000000000..1cd23614b5 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import java.net.URI; +import javax.ws.rs.NotFoundException; +import javax.ws.rs.core.UriBuilder; +import org.onap.so.client.RestClient; +import org.onap.aaiclient.client.graphinventory.GraphInventoryClient; +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AAIClient extends GraphInventoryClient { + + private static final String AAI_ROOT = "/aai"; + protected static Logger logger = LoggerFactory.getLogger(AAIClient.class); + protected AAIVersion version; + + protected AAIClient() { + super(AAIProperties.class); + } + + protected AAIClient(AAIVersion version) { + super(AAIProperties.class); + this.version = version; + } + + @Override + protected URI constructPath(URI uri) { + + return UriBuilder.fromUri(AAI_ROOT + "/" + this.getVersion().toString() + uri.toString()).build(); + } + + @Override + protected RestClient createClient(URI uri) { + try { + + return new AAIRestClient(getRestProperties(), constructPath(uri)); + } catch (GraphInventoryUriComputationException | NotFoundException e) { + logger.debug("failed to construct A&AI uri", e); + throw e; + } + } + + @Override + public AAIVersion getVersion() { + if (version == null) { + return this.getRestProperties().getDefaultVersion(); + } else { + return this.version; + } + } + + + @Override + public String getGraphDBName() { + return "A&AI"; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClientResponseExceptionMapper.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClientResponseExceptionMapper.java new file mode 100644 index 0000000000..24a4ba8510 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClientResponseExceptionMapper.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import java.io.IOException; +import java.util.Optional; +import javax.annotation.Priority; +import javax.ws.rs.ext.Provider; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.client.ResponseExceptionMapper; +import org.onap.aaiclient.client.aai.entities.AAIError; +import org.slf4j.MDC; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Provider +@Priority(Integer.MIN_VALUE) +public class AAIClientResponseExceptionMapper extends ResponseExceptionMapper { + + private final String requestId; + + public AAIClientResponseExceptionMapper() { + this.requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID); + } + + @Override + public Optional extractMessage(String entity) { + + String errorString = "Error calling A&AI. Request-Id=" + this.getRequestId() + " "; + try { + AAIError error = new ObjectMapper().readValue(entity, AAIError.class); + AAIErrorFormatter formatter = new AAIErrorFormatter(error); + return Optional.of(errorString + formatter.getMessage()); + } catch (IOException e) { + return Optional.of(errorString + entity); + } + } + + protected String getRequestId() { + return this.requestId; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperPatchProvider.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperPatchProvider.java new file mode 100644 index 0000000000..3e198a6375 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperPatchProvider.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperPatchProvider; + +public class AAICommonObjectMapperPatchProvider extends GraphInventoryCommonObjectMapperPatchProvider { + + + public AAICommonObjectMapperPatchProvider() { + super(); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperProvider.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperProvider.java new file mode 100644 index 0000000000..8cc7f7d1ee --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperProvider.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; + +public class AAICommonObjectMapperProvider extends GraphInventoryCommonObjectMapperProvider { + + public AAICommonObjectMapperProvider() { + super(); + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java new file mode 100644 index 0000000000..4c45a675b2 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.GraphInventoryQueryClient; +import org.onap.aaiclient.client.graphinventory.entities.DSLQuery; +import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryUri; + +public class AAIDSLQueryClient + extends GraphInventoryQueryClient { + + public AAIDSLQueryClient() { + super(new AAIClient()); + } + + public AAIDSLQueryClient(AAIVersion version) { + super(new AAIClient(version)); + } + + @Override + protected GraphInventoryUri getQueryUri() { + return AAIUriFactory.createResourceUri(AAIObjectType.DSL); + } + + + @Override + public AAIResultWrapper createWrapper(String json) { + return new AAIResultWrapper(json); + } + + @Override + public AAIObjectType createType(String name) { + return AAIObjectType.fromTypeName(name); + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIErrorFormatter.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIErrorFormatter.java new file mode 100644 index 0000000000..5282da8184 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIErrorFormatter.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import java.util.List; +import org.onap.aaiclient.client.aai.entities.AAIError; +import org.onap.aaiclient.client.aai.entities.ServiceException; + +public class AAIErrorFormatter { + + private final AAIError error; + + public AAIErrorFormatter(AAIError error) { + this.error = error; + } + + public String getMessage() { + if (error.getRequestError() != null && error.getRequestError().getServiceException() != null) { + ServiceException serviceException = error.getRequestError().getServiceException(); + return this.fillInTemplate(serviceException.getText(), serviceException.getVariables()); + } + + return "no parsable error message found"; + } + + protected String fillInTemplate(String text, List variables) { + for (int i = 0; i < variables.size(); i++) { + variables.set(i, this.format(variables.get(i), variables)); + } + + return format(text, variables); + } + + protected String format(String s, List variables) { + s = s.replaceAll("%(\\d(?!\\d))", "%$1\\$s"); + s = s.replaceAll("%(\\d{2})", "%%$1"); + return String.format(s, variables.toArray()); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAINamespaceConstants.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAINamespaceConstants.java new file mode 100644 index 0000000000..c098402076 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAINamespaceConstants.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +public class AAINamespaceConstants { + + public static final String CLOUD_INFRASTRUCTURE = "/cloud-infrastructure"; + public static final String NETWORK = "/network"; + public static final String BUSINESS = "/business"; + public static final String SERVICE_DESIGN_AND_CREATION = "/service-design-and-creation"; + public static final String EXTERNAL_SYSTEM = "/external-system"; + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectBase.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectBase.java new file mode 100644 index 0000000000..c1dbd29de0 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectBase.java @@ -0,0 +1,7 @@ +package org.onap.aaiclient.client.aai; + +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectBase; + +public interface AAIObjectBase extends GraphInventoryObjectBase { + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java new file mode 100644 index 0000000000..fcda3c8ad4 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java @@ -0,0 +1,117 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import java.io.Serializable; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectPlurals; +import org.onap.so.constants.Defaults; +import com.google.common.base.CaseFormat; + +public class AAIObjectPlurals implements AAIObjectBase, GraphInventoryObjectPlurals, Serializable { + + private static final long serialVersionUID = 5312713297525740746L; + + public static final AAIObjectPlurals CUSTOMER = + new AAIObjectPlurals(AAIObjectType.CUSTOMER, AAINamespaceConstants.BUSINESS, "/customers"); + public static final AAIObjectPlurals GENERIC_VNF = + new AAIObjectPlurals(AAIObjectType.GENERIC_VNF, AAINamespaceConstants.NETWORK, "/generic-vnfs"); + public static final AAIObjectPlurals PORT_GROUP = + new AAIObjectPlurals(AAIObjectType.PORT_GROUP, AAIObjectType.VCE.uriTemplate(), "/port-groups"); + public static final AAIObjectPlurals PSERVER = + new AAIObjectPlurals(AAIObjectType.PSERVER, AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers"); + public static final AAIObjectPlurals P_INTERFACE = + new AAIObjectPlurals(AAIObjectType.P_INTERFACE, AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces"); + public static final AAIObjectPlurals L3_NETWORK = + new AAIObjectPlurals(AAIObjectType.L3_NETWORK, AAINamespaceConstants.NETWORK, "/l3-networks"); + public static final AAIObjectPlurals NETWORK_POLICY = + new AAIObjectPlurals(AAIObjectType.NETWORK_POLICY, AAINamespaceConstants.NETWORK, "/network-policies"); + public static final AAIObjectPlurals VPN_BINDING = + new AAIObjectPlurals(AAIObjectType.VPN_BINDING, AAINamespaceConstants.NETWORK, "/vpn-bindings"); + public static final AAIObjectPlurals SERVICE_SUBSCRIPTION = new AAIObjectPlurals(AAIObjectType.SERVICE_SUBSCRIPTION, + AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions"); + public static final AAIObjectPlurals SERVICE_INSTANCE = new AAIObjectPlurals(AAIObjectType.SERVICE_INSTANCE, + AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances"); + public static final AAIObjectPlurals OWNING_ENTITY = + new AAIObjectPlurals(AAIObjectType.OWNING_ENTITY, AAINamespaceConstants.BUSINESS, "/owning-entities"); + public static final AAIObjectPlurals VOLUME_GROUP = new AAIObjectPlurals(AAIObjectType.VOLUME_GROUP, + AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups"); + public static final AAIObjectPlurals AVAILIBILITY_ZONE = new AAIObjectPlurals(AAIObjectType.AVAILIBILITY_ZONE, + AAIObjectType.CLOUD_REGION.uriTemplate(), "/availability-zones"); + public static final AAIObjectPlurals VF_MODULE = + new AAIObjectPlurals(AAIObjectType.VF_MODULE, AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules"); + public static final AAIObjectPlurals CONFIGURATION = + new AAIObjectPlurals(AAIObjectType.CONFIGURATION, AAINamespaceConstants.NETWORK, "/configurations"); + public static final AAIObjectPlurals DEFAULT_TENANT = + new AAIObjectPlurals(AAIObjectType.DEFAULT_TENANT, AAINamespaceConstants.CLOUD_INFRASTRUCTURE + + "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants"); + public static final AAIObjectPlurals NETWORK_TECHNOLOGY = new AAIObjectPlurals(AAIObjectType.NETWORK_TECHNOLOGY, + AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/network-technologies"); + public static final AAIObjectPlurals LOGICAL_LINK = + new AAIObjectPlurals(AAIObjectType.LOGICAL_LINK, AAINamespaceConstants.NETWORK, "/logical-links"); + public static final AAIObjectPlurals L_INTERFACE = + new AAIObjectPlurals(AAIObjectType.L_INTERFACE, AAIObjectType.VSERVER.uriTemplate(), "/l-interfaces"); + public static final AAIObjectPlurals SUB_L_INTERFACE = + new AAIObjectPlurals(AAIObjectType.L_INTERFACE, AAIObjectType.L_INTERFACE.uriTemplate(), "/l-interfaces"); + public static final AAIObjectPlurals INSTANCE_GROUP = + new AAIObjectPlurals(AAIObjectType.INSTANCE_GROUP, AAINamespaceConstants.NETWORK, "/instance-groups"); + public static final AAIObjectPlurals PNF = + new AAIObjectPlurals(AAIObjectType.PNF, AAINamespaceConstants.NETWORK, "/pnfs"); + + private final String uriTemplate; + private final String partialUri; + private final AAIObjectType type; + + protected AAIObjectPlurals(AAIObjectType type, String parentUri, String partialUri) { + this.uriTemplate = parentUri + partialUri; + this.partialUri = partialUri; + this.type = type; + } + + @Override + public String toString() { + return this.uriTemplate(); + } + + @Override + public String uriTemplate() { + return this.uriTemplate; + } + + @Override + public String partialUri() { + return this.partialUri; + } + + @Override + public AAIObjectType getType() { + return this.type; + } + + @Override + public String typeName() { + return this.getType().typeName(); + } + + @Override + public String typeName(CaseFormat format) { + return this.getType().typeName(format); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java new file mode 100644 index 0000000000..8045a220a3 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java @@ -0,0 +1,322 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import com.google.common.base.CaseFormat; +import org.onap.aai.annotations.Metadata; +import org.onap.aai.domain.yang.AggregateRoute; +import org.onap.aai.domain.yang.AllottedResource; +import org.onap.aai.domain.yang.AvailabilityZone; +import org.onap.aai.domain.yang.CloudRegion; +import org.onap.aai.domain.yang.Collection; +import org.onap.aai.domain.yang.CommunicationServiceProfile; +import org.onap.aai.domain.yang.Complex; +import org.onap.aai.domain.yang.Configuration; +import org.onap.aai.domain.yang.Connector; +import org.onap.aai.domain.yang.Customer; +import org.onap.aai.domain.yang.Device; +import org.onap.aai.domain.yang.EsrVnfm; +import org.onap.aai.domain.yang.ExtAaiNetwork; +import org.onap.aai.domain.yang.Flavor; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.Image; +import org.onap.aai.domain.yang.InstanceGroup; +import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.LInterface; +import org.onap.aai.domain.yang.LineOfBusiness; +import org.onap.aai.domain.yang.LogicalLink; +import org.onap.aai.domain.yang.ModelVer; +import org.onap.aai.domain.yang.NetworkPolicy; +import org.onap.aai.domain.yang.NetworkTechnology; +import org.onap.aai.domain.yang.OperationalEnvironment; +import org.onap.aai.domain.yang.OwningEntity; +import org.onap.aai.domain.yang.PInterface; +import org.onap.aai.domain.yang.PhysicalLink; +import org.onap.aai.domain.yang.Platform; +import org.onap.aai.domain.yang.Pnf; +import org.onap.aai.domain.yang.PortGroup; +import org.onap.aai.domain.yang.Project; +import org.onap.aai.domain.yang.Pserver; +import org.onap.aai.domain.yang.RouteTableReference; +import org.onap.aai.domain.yang.Service; +import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.ServiceProfile; +import org.onap.aai.domain.yang.ServiceSubscription; +import org.onap.aai.domain.yang.SliceProfile; +import org.onap.aai.domain.yang.SpPartner; +import org.onap.aai.domain.yang.SriovPf; +import org.onap.aai.domain.yang.Subnet; +import org.onap.aai.domain.yang.Tenant; +import org.onap.aai.domain.yang.TunnelXconnect; +import org.onap.aai.domain.yang.Vce; +import org.onap.aai.domain.yang.VfModule; +import org.onap.aai.domain.yang.VlanTag; +import org.onap.aai.domain.yang.Vnfc; +import org.onap.aai.domain.yang.VolumeGroup; +import org.onap.aai.domain.yang.VpnBinding; +import org.onap.aai.domain.yang.Vserver; +import org.onap.aai.domain.yang.Zone; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType; +import org.onap.so.constants.Defaults; +import org.reflections.Reflections; +import org.reflections.scanners.SubTypesScanner; +import org.reflections.util.ClasspathHelper; +import org.reflections.util.ConfigurationBuilder; +import java.io.Serializable; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.regex.Pattern; + +public class AAIObjectType implements AAIObjectBase, GraphInventoryObjectType, Serializable { + + private static final long serialVersionUID = -2877184776691514600L; + private static Map map = new HashMap<>(); + + public static final AAIObjectType DEFAULT_CLOUD_REGION = new AAIObjectType( + AAINamespaceConstants.CLOUD_INFRASTRUCTURE, + "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/{cloud-region-id}", "default-cloud-region"); + public static final AAIObjectType CUSTOMER = new AAIObjectType(AAINamespaceConstants.BUSINESS, Customer.class); + public static final AAIObjectType GENERIC_QUERY = new AAIObjectType("/search", "/generic-query", "generic-query"); + public static final AAIObjectType BULK_PROCESS = new AAIObjectType("/bulkprocess", "", "bulkprocess"); + public static final AAIObjectType SINGLE_TRANSACTION = + new AAIObjectType("/bulk/single-transaction", "", "single-transaction"); + public static final AAIObjectType GENERIC_VNF = new AAIObjectType(AAINamespaceConstants.NETWORK, GenericVnf.class); + public static final AAIObjectType GENERIC_VNFS = + new AAIObjectType(AAINamespaceConstants.NETWORK, "/generic-vnfs", "generic-vnfs"); + public static final AAIObjectType VF_MODULE = + new AAIObjectType(AAIObjectType.GENERIC_VNF.uriTemplate(), VfModule.class); + public static final AAIObjectType L3_NETWORK = new AAIObjectType(AAINamespaceConstants.NETWORK, L3Network.class); + public static final AAIObjectType NETWORK_POLICY = + new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkPolicy.class); + public static final AAIObjectType NODES_QUERY = new AAIObjectType("/search", "/nodes-query", "nodes-query"); + public static final AAIObjectType CUSTOM_QUERY = new AAIObjectType("/query", "", "query"); + public static final AAIObjectType ROUTE_TABLE_REFERENCE = + new AAIObjectType(AAINamespaceConstants.NETWORK, RouteTableReference.class); + public static final AAIObjectType DEFAULT_TENANT = + new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/" + + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants/tenant/{tenant-id}", "default-tenant"); + public static final AAIObjectType VCE = new AAIObjectType(AAINamespaceConstants.NETWORK, Vce.class); + public static final AAIObjectType PORT_GROUP = new AAIObjectType(AAIObjectType.VCE.uriTemplate(), PortGroup.class); + public static final AAIObjectType VPN_BINDING = new AAIObjectType(AAINamespaceConstants.NETWORK, VpnBinding.class); + public static final AAIObjectType CONFIGURATION = + new AAIObjectType(AAINamespaceConstants.NETWORK, Configuration.class); + public static final AAIObjectType PSERVER = + new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Pserver.class); + public static final AAIObjectType SERVICE_SUBSCRIPTION = + new AAIObjectType(AAIObjectType.CUSTOMER.uriTemplate(), ServiceSubscription.class); + + public static final AAIObjectType SERVICE_INSTANCE_METADATA = new AAIObjectType( + AAIObjectType.SERVICE_INSTANCE + "/metadata", org.onap.aai.domain.yang.v13.Metadata.class); + + public static final AAIObjectType SERVICE = new AAIObjectType( + AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/services/service/{service-id}", Service.class); + public static final AAIObjectType SERVICE_INSTANCE = + new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceInstance.class); + public static final AAIObjectType PROJECT = new AAIObjectType(AAINamespaceConstants.BUSINESS, Project.class); + public static final AAIObjectType LINE_OF_BUSINESS = + new AAIObjectType(AAINamespaceConstants.BUSINESS, LineOfBusiness.class); + public static final AAIObjectType PLATFORM = new AAIObjectType(AAINamespaceConstants.BUSINESS, Platform.class); + public static final AAIObjectType OWNING_ENTITY = + new AAIObjectType(AAINamespaceConstants.BUSINESS, OwningEntity.class); + public static final AAIObjectType ALLOTTED_RESOURCE = + new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), AllottedResource.class); + public static final AAIObjectType ALLOTTED_RESOURCE_ALL = + new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/allotted-resources", "allottedResources"); + public static final AAIObjectType PNF = new AAIObjectType(AAINamespaceConstants.NETWORK, Pnf.class); + public static final AAIObjectType OPERATIONAL_ENVIRONMENT = + new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, OperationalEnvironment.class); + public static final AAIObjectType CLOUD_REGION = + new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, CloudRegion.class); + public static final AAIObjectType TENANT = + new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Tenant.class); + public static final AAIObjectType VOLUME_GROUP = + new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), VolumeGroup.class); + public static final AAIObjectType VSERVER = new AAIObjectType(AAIObjectType.TENANT.uriTemplate(), Vserver.class); + public static final AAIObjectType MODEL_VER = new AAIObjectType( + AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", ModelVer.class); + public static final AAIObjectType TUNNEL_XCONNECT = + new AAIObjectType(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), TunnelXconnect.class); + public static final AAIObjectType P_INTERFACE = + new AAIObjectType(AAIObjectType.PSERVER.uriTemplate(), PInterface.class); + public static final AAIObjectType SRIOV_PF = + new AAIObjectType(AAIObjectType.P_INTERFACE.uriTemplate(), SriovPf.class); + public static final AAIObjectType LOGICAL_LINK = + new AAIObjectType(AAINamespaceConstants.NETWORK, LogicalLink.class); + public static final AAIObjectType PHYSICAL_LINK = + new AAIObjectType(AAINamespaceConstants.NETWORK, PhysicalLink.class); + public static final AAIObjectType INSTANCE_GROUP = + new AAIObjectType(AAINamespaceConstants.NETWORK, InstanceGroup.class); + public static final AAIObjectType COLLECTION = new AAIObjectType(AAINamespaceConstants.NETWORK, Collection.class); + public static final AAIObjectType VNFC = new AAIObjectType(AAINamespaceConstants.NETWORK, Vnfc.class); + public static final AAIObjectType VLAN_TAG = new AAIObjectType(AAINamespaceConstants.NETWORK, VlanTag.class); + public static final AAIObjectType COMPLEX = + new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Complex.class); + public static final AAIObjectType CONNECTOR = new AAIObjectType(AAINamespaceConstants.BUSINESS, Connector.class); + public static final AAIObjectType NETWORK_TECHNOLOGY = + new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, NetworkTechnology.class); + public static final AAIObjectType SUBNET = new AAIObjectType(AAIObjectType.L3_NETWORK.uriTemplate(), Subnet.class); + public static final AAIObjectType SP_PARTNER = new AAIObjectType(AAINamespaceConstants.BUSINESS, SpPartner.class); + public static final AAIObjectType DEVICE = new AAIObjectType(AAINamespaceConstants.NETWORK, Device.class); + public static final AAIObjectType EXT_AAI_NETWORK = + new AAIObjectType(AAINamespaceConstants.NETWORK, ExtAaiNetwork.class); + public static final AAIObjectType AGGREGATE_ROUTE = + new AAIObjectType(AAINamespaceConstants.NETWORK, AggregateRoute.class); + public static final AAIObjectType L_INTERFACE = + new AAIObjectType(AAIObjectType.VSERVER.uriTemplate(), LInterface.class); + public static final AAIObjectType SUB_L_INTERFACE = new AAIObjectType(AAIObjectType.L_INTERFACE.uriTemplate(), + "/l-interfaces/l-interface/{sub-interface-name}", "sub-l-interface"); + public static final AAIObjectType IMAGE = new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Image.class); + public static final AAIObjectType FLAVOR = + new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Flavor.class); + public static final AAIObjectType UNKNOWN = new AAIObjectType("", "", "unknown") { + + private static final long serialVersionUID = 9208984071038447607L; + + @Override + public boolean passThrough() { + return true; + } + }; + public static final AAIObjectType DSL = new AAIObjectType("/dsl", "", "dsl"); + public static final AAIObjectType VNFM = new AAIObjectType( + AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-vnfm-list/esr-vnfm/{vnfm-id}", EsrVnfm.class); + public static final AAIObjectType VNFM_LIST = + new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM, "/esr-vnfm-list", "vnfm-list"); + public static final AAIObjectType VNFM_ESR_SYSTEM_INFO_LIST = + new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-vnfm-list", + "/esr-vnfm/{vnfm-id}/esr-system-info-list", "vnfm-esr-system-info-list"); + public static final AAIObjectType CLOUD_ESR_SYSTEM_INFO_LIST = new AAIObjectType( + AAIObjectType.CLOUD_REGION.uriTemplate(), "/esr-system-info-list", "cloud-esr-system-info-list"); + public static final AAIObjectType ZONE = new AAIObjectType(AAINamespaceConstants.NETWORK, Zone.class); + public static final AAIObjectType AVAILIBILITY_ZONE = + new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), AvailabilityZone.class); + public static final AAIObjectType THIRDPARTY_SDNC_LIST = new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM, + "/esr-thirdparty-sdnc-list", "thirdparty-sdnc-list"); + public static final AAIObjectType THIRDPARTY_SDNC_SYSTEM_INFO_LIST = + new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-thirdparty-sdnc-list", + "/esr-thirdparty-sdnc/{sdnc-id}/esr-system-info-list", "thirdparty-sdnc-system-info-list"); + public static final AAIObjectType COMMUNICATION_SERVICE_PROFILE = + new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), CommunicationServiceProfile.class); + public static final AAIObjectType SERVICE_PROFILE = + new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceProfile.class); + public static final AAIObjectType SERVICE_PROFILE_ALL = + new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/service-profiles", "serviceProfiles"); + public static final AAIObjectType SLICE_PROFILE = + new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), SliceProfile.class); + public static final AAIObjectType SLICE_PROFILE_ALL = + new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/slice-profiles", "sliceProfiles"); + public static final AAIObjectType COMMUNICATION_PROFILE_ALL = new AAIObjectType( + AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/communication-service-profiles", "communicationProfiles"); + public static final AAIObjectType QUERY_ALLOTTED_RESOURCE = + new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "?depth=2", "service-Instance"); + + private final String uriTemplate; + private final String parentUri; + private final String partialUri; + private final Class aaiObjectClass; + private final String name; + + static { + /* Locate any AAIObjectTypes on the classpath and add them to our map */ + java.util.Collection packages = ClasspathHelper.forPackage(""); + Reflections r = + new Reflections(new ConfigurationBuilder().setUrls(packages).setScanners(new SubTypesScanner())); + + Set> resources = r.getSubTypesOf(AAIObjectType.class); + + for (Class customTypeClass : resources) { + AAIObjectType customType; + try { + customType = customTypeClass.newInstance(); + } catch (InstantiationException | IllegalAccessException e) { + } + } + } + + protected AAIObjectType() { + this.parentUri = null; + this.partialUri = null; + this.uriTemplate = null; + this.aaiObjectClass = null; + this.name = null; + } + + protected AAIObjectType(String parentUri, String partialUri, String name) { + this.parentUri = parentUri; + this.partialUri = partialUri; + this.uriTemplate = parentUri + partialUri; + this.aaiObjectClass = null; + this.name = name; + if (!AAIObjectType.map.containsKey(name)) { + AAIObjectType.map.put(name, this); + } + } + + protected AAIObjectType(String parentUri, Class aaiObjectClass) { + this.parentUri = parentUri; + this.partialUri = removeParentUri(aaiObjectClass, parentUri); + this.uriTemplate = parentUri + partialUri; + this.aaiObjectClass = aaiObjectClass; + this.name = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, aaiObjectClass.getSimpleName()); + if (!AAIObjectType.map.containsKey(name)) { + AAIObjectType.map.put(name, this); + } + } + + @Override + public String toString() { + return this.uriTemplate(); + } + + public static AAIObjectType fromTypeName(String name) { + if (map.containsKey(name)) { + return map.get(name); + } else { + return AAIObjectType.UNKNOWN; + } + } + + @Override + public String typeName() { + return this.typeName(CaseFormat.LOWER_HYPHEN); + } + + @Override + public String typeName(CaseFormat format) { + return CaseFormat.LOWER_HYPHEN.to(format, this.name.replace("default-", "")); + } + + @Override + public String uriTemplate() { + return this.uriTemplate; + } + + @Override + public String partialUri() { + return this.partialUri; + } + + protected String removeParentUri(Class aaiObjectClass, String parentUri) { + return aaiObjectClass.getAnnotation(Metadata.class).uriTemplate().replaceFirst(Pattern.quote(parentUri), ""); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIProperties.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIProperties.java new file mode 100644 index 0000000000..ac8a6e6e52 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIProperties.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import org.onap.so.client.RestProperties; + +public interface AAIProperties extends RestProperties { + + public AAIVersion getDefaultVersion(); + + public String getAuth(); + + public String getKey(); + + @Override + public default boolean mapNotFoundToEmpty() { + return true; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIQueryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIQueryClient.java new file mode 100644 index 0000000000..5e8b052146 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIQueryClient.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.CustomQuery; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.GraphInventoryQueryClient; +import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryUri; + +public class AAIQueryClient + extends GraphInventoryQueryClient { + + public AAIQueryClient() { + super(new AAIClient()); + } + + public AAIQueryClient(AAIVersion version) { + super(new AAIClient(version)); + } + + @Override + protected GraphInventoryUri getQueryUri() { + return AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY); + } + + @Override + protected GraphInventoryUri setupQueryParams(GraphInventoryUri uri) { + return super.setupQueryParams(uri); + } + + @Override + public AAIResultWrapper createWrapper(String json) { + return new AAIResultWrapper(json); + } + + @Override + public AAIObjectType createType(String name) { + return AAIObjectType.fromTypeName(name); + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIQueryObjectMapperProvider.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIQueryObjectMapperProvider.java new file mode 100644 index 0000000000..ed17937db8 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIQueryObjectMapperProvider.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import com.fasterxml.jackson.databind.AnnotationIntrospector; +import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; +import com.fasterxml.jackson.databind.type.TypeFactory; +import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector; + +public class AAIQueryObjectMapperProvider extends AAICommonObjectMapperProvider { + + public AAIQueryObjectMapperProvider() { + super(); + AnnotationIntrospector aiJaxb = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()); + AnnotationIntrospector aiJackson = new JacksonAnnotationIntrospector(); + // first Jaxb, second Jackson annotations + mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(aiJaxb, aiJackson)); + + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIResourcesClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIResourcesClient.java new file mode 100644 index 0000000000..e879a84dd7 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIResourcesClient.java @@ -0,0 +1,88 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import java.util.Optional; +import org.onap.aai.domain.yang.Relationship; +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.graphinventory.GraphInventoryResourcesClient; +import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryEdgeLabel; + +public class AAIResourcesClient extends + GraphInventoryResourcesClient, AAIResourceUri, AAIPluralResourceUri, AAIEdgeLabel, AAIResultWrapper, AAITransactionalClient, AAISingleTransactionClient> { + + private AAIClient aaiClient; + + public AAIResourcesClient() { + super(new AAIClient()); + aaiClient = (AAIClient) super.client; + } + + public AAIResourcesClient(AAIVersion version) { + super(new AAIClient(version)); + aaiClient = (AAIClient) super.client; + } + + public AAIResourcesClient(AAIClient client) { + super(client); + aaiClient = (AAIClient) super.client; + } + + @Override + public AAIResultWrapper createWrapper(String json) { + return new AAIResultWrapper(json); + } + + @Override + public AAIResultWrapper createWrapper(Object obj) { + return new AAIResultWrapper(obj); + } + + @Override + public AAITransactionalClient beginTransaction() { + return new AAITransactionalClient(this, aaiClient); + } + + @Override + public AAISingleTransactionClient beginSingleTransaction() { + return new AAISingleTransactionClient(this, aaiClient); + } + + @Override + protected Relationship buildRelationship(AAIResourceUri uri) { + return super.buildRelationship(uri, Optional.empty()); + } + + @Override + protected Relationship buildRelationship(AAIResourceUri uri, GraphInventoryEdgeLabel label) { + return super.buildRelationship(uri, Optional.of(label)); + } + + @Override + protected Relationship buildRelationship(AAIResourceUri uri, Optional label) { + return super.buildRelationship(uri, label); + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIResourcesObjectMapperProvider.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIResourcesObjectMapperProvider.java new file mode 100644 index 0000000000..6fc122896c --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIResourcesObjectMapperProvider.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +public class AAIResourcesObjectMapperProvider extends AAICommonObjectMapperProvider { + + public AAIResourcesObjectMapperProvider() { + super(); + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java new file mode 100644 index 0000000000..9a8a2a53c0 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import java.net.URI; +import java.util.Map; +import java.util.Optional; +import org.onap.so.client.ResponseExceptionMapper; +import org.onap.aaiclient.client.graphinventory.GraphInventoryPatchConverter; +import org.onap.aaiclient.client.graphinventory.GraphInventoryRestClient; +import org.onap.logging.filter.base.ONAPComponents; + +public class AAIRestClient extends GraphInventoryRestClient { + + private final AAIProperties aaiProperties; + + protected AAIRestClient(AAIProperties props, URI uri) { + super(props, uri); + this.aaiProperties = props; + } + + @Override + public ONAPComponents getTargetEntity() { + return ONAPComponents.AAI; + } + + @Override + protected void initializeHeaderMap(Map headerMap) { + headerMap.put("X-FromAppId", aaiProperties.getSystemName()); + headerMap.put("X-TransactionId", requestId); + String auth = aaiProperties.getAuth(); + String key = aaiProperties.getKey(); + + if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) { + addBasicAuthHeader(auth, key); + } + } + + @Override + protected Optional addResponseExceptionMapper() { + + return Optional.of(new AAIClientResponseExceptionMapper()); + } + + protected GraphInventoryPatchConverter getPatchConverter() { + return this.patchConverter; + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientI.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientI.java new file mode 100644 index 0000000000..ef6ca00a32 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientI.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.Pnf; +import org.onap.aai.domain.yang.Pserver; + +public interface AAIRestClientI { + + List getPhysicalServerByVnfId(String vnfId) throws IOException; + + void updateMaintenceFlagVnfId(String vnfId, boolean inMaint); + + GenericVnf getVnfByName(String vnfId); + + Optional getPnfByName(String pnfId); + + void createPnf(String pnfId, Pnf pnf); + + void updatePnf(String pnfId, Pnf pnf); +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java new file mode 100644 index 0000000000..886891a34e --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java @@ -0,0 +1,100 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.ws.rs.core.Response; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.Pnf; +import org.onap.aai.domain.yang.Pserver; +import org.onap.aaiclient.client.aai.entities.CustomQuery; +import org.onap.aaiclient.client.aai.entities.Results; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.Format; + +public class AAIRestClientImpl implements AAIRestClientI { + + private static final String PSERVER_VNF_QUERY = "pservers-fromVnf"; + + @Override + public List getPhysicalServerByVnfId(String vnfId) throws IOException { + List startNodes = new ArrayList<>(); + startNodes.add(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)); + String jsonInput = new AAIQueryClient().query(Format.RESOURCE, new CustomQuery(startNodes, PSERVER_VNF_QUERY)); + + return this.getListOfPservers(jsonInput); + + } + + protected List getListOfPservers(String jsonInput) throws IOException { + ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper(); + Results> resultsFromJson = + mapper.readValue(jsonInput, new TypeReference>>() {}); + List results = new ArrayList<>(); + for (Map m : resultsFromJson.getResult()) { + results.add(m.get("pserver")); + } + return results; + } + + @Override + public void updateMaintenceFlagVnfId(String vnfId, boolean inMaint) { + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setInMaint(inMaint); + new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId), genericVnf); + + } + + @Override + public GenericVnf getVnfByName(String vnfId) { + return new AAIResourcesClient() + .get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)).orElse(null); + } + + @Override + public Optional getPnfByName(String pnfId) { + Response response = + new AAIResourcesClient().getFullResponse(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId)); + if (response.getStatus() != 200) { + return Optional.empty(); + } else { + return Optional.of(response.readEntity(Pnf.class)); + } + } + + @Override + public void createPnf(String pnfId, Pnf pnf) { + new AAIResourcesClient().createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId), + Optional.of(pnf)); + } + + @Override + public void updatePnf(String pnfId, Pnf pnf) { + new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId), pnf); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAISingleTransactionClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAISingleTransactionClient.java new file mode 100644 index 0000000000..8df505e979 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAISingleTransactionClient.java @@ -0,0 +1,175 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import javax.ws.rs.core.GenericType; +import org.onap.so.client.RestClient; +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; +import org.onap.aaiclient.client.aai.entities.AAIError; +import org.onap.aaiclient.client.aai.entities.singletransaction.OperationBodyRequest; +import org.onap.aaiclient.client.aai.entities.singletransaction.OperationBodyResponse; +import org.onap.aaiclient.client.aai.entities.singletransaction.SingleTransactionRequest; +import org.onap.aaiclient.client.aai.entities.singletransaction.SingleTransactionResponse; +import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.GraphInventoryPatchConverter; +import org.onap.aaiclient.client.graphinventory.GraphInventoryTransactionClient; +import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.base.Joiner; + +public class AAISingleTransactionClient extends + GraphInventoryTransactionClient, AAIResourceUri, AAIEdgeLabel> { + + private final SingleTransactionRequest request; + private AAIResourcesClient resourcesClient; + private AAIClient aaiClient; + + protected AAISingleTransactionClient(AAIResourcesClient resourcesClient, AAIClient aaiClient) { + super(); + this.resourcesClient = resourcesClient; + this.aaiClient = aaiClient; + this.request = new SingleTransactionRequest(); + } + + /* + * (non-Javadoc) + * + * @see org.onap.aaiclient.client.aai.GraphInventoryTransactionClient#execute() + */ + @Override + public void execute() throws BulkProcessFailed { + try { + if (!this.request.getOperations().isEmpty()) { + RestClient client = + aaiClient.createClient(AAIUriFactory.createResourceUri(AAIObjectType.SINGLE_TRANSACTION)); + SingleTransactionResponse response = client.post(this.request, SingleTransactionResponse.class); + if (response != null) { + final Optional errorMessage = this.locateErrorMessages(response); + if (errorMessage.isPresent()) { + throw new BulkProcessFailed( + "One or more transactions failed in A&AI. Check logs for payloads.\nMessages:\n" + + errorMessage.get()); + } + } else { + throw new BulkProcessFailed( + "Transactions acccepted by A&AI, but there was no response. Unsure of result."); + } + } + } finally { + this.request.getOperations().clear(); + this.actionCount = 0; + } + } + + @Override + public void execute(boolean dryRun) throws BulkProcessFailed { + final ObjectMapper mapper = new ObjectMapper(); + if (dryRun) { + try { + if (logger.isDebugEnabled()) { + logger.debug("Would execute: {}", mapper.writeValueAsString(this.request)); + } + } catch (JsonProcessingException e) { + logger.debug("Could not format request to JSON", e); + } + } else { + this.execute(); + } + } + + protected Optional locateErrorMessages(SingleTransactionResponse response) { + final List errorMessages = new ArrayList<>(); + final ObjectMapper mapper = new ObjectMapper(); + + for (OperationBodyResponse body : response.getOperationResponses()) { + if (Optional.ofNullable(body.getResponseStatusCode()).orElse(400) > 300) { + AAIError error; + try { + error = mapper.readValue(mapper.writeValueAsString(body.getResponseBody()), AAIError.class); + } catch (IOException e) { + logger.error("could not parse error object from A&AI", e); + error = new AAIError(); + } + AAIErrorFormatter formatter = new AAIErrorFormatter(error); + String outputMessage = formatter.getMessage(); + errorMessages.add(outputMessage); + } + } + + if (!errorMessages.isEmpty()) { + return Optional.of(Joiner.on("\n").join(errorMessages)); + } else { + return Optional.empty(); + } + } + + protected SingleTransactionRequest getRequest() { + return this.request; + } + + @Override + protected void put(String uri, Object body) { + request.getOperations().add(new OperationBodyRequest().withAction("put").withUri(uri).withBody(body)); + } + + @Override + protected void delete(String uri) { + request.getOperations() + .add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(new Object())); + } + + @Override + protected void delete(String uri, Object obj) { + request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(obj)); + } + + @Override + protected void patch(String uri, Object body) { + request.getOperations().add(new OperationBodyRequest().withAction("patch").withUri(uri).withBody(body)); + } + + @Override + protected Optional get(GenericType genericType, AAIBaseResourceUri clone) { + return resourcesClient.get(genericType, clone); + } + + @Override + protected boolean exists(AAIBaseResourceUri uri) { + return resourcesClient.exists(uri); + } + + @Override + protected String getGraphDBName() { + return aaiClient.getGraphDBName(); + } + + @Override + protected GraphInventoryPatchConverter getPatchConverter() { + return this.patchConverter; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAITransactionalClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAITransactionalClient.java new file mode 100644 index 0000000000..66fa503487 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAITransactionalClient.java @@ -0,0 +1,228 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import org.onap.aai.domain.yang.Relationship; +import org.onap.so.client.RestClient; +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; +import org.onap.aaiclient.client.aai.entities.AAIError; +import org.onap.aaiclient.client.aai.entities.bulkprocess.OperationBody; +import org.onap.aaiclient.client.aai.entities.bulkprocess.Transaction; +import org.onap.aaiclient.client.aai.entities.bulkprocess.Transactions; +import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.GraphInventoryPatchConverter; +import org.onap.aaiclient.client.graphinventory.GraphInventoryTransactionClient; +import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed; +import org.onap.so.jsonpath.JsonPathUtil; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.base.Joiner; + +public class AAITransactionalClient extends + GraphInventoryTransactionClient, AAIResourceUri, AAIEdgeLabel> { + + private final Transactions transactions; + private Transaction currentTransaction; + + private AAIResourcesClient resourcesClient; + private AAIClient aaiClient; + + protected AAITransactionalClient(AAIResourcesClient resourcesClient, AAIClient aaiClient) { + super(); + this.resourcesClient = resourcesClient; + this.aaiClient = aaiClient; + this.transactions = new Transactions(); + startTransaction(); + } + + private void startTransaction() { + Transaction transaction = new Transaction(); + transactions.getTransactions().add(transaction); + currentTransaction = transaction; + } + + /* + * (non-Javadoc) + * + * @see org.onap.aaiclient.client.aai.GraphInventoryTransactionalClient#beginNewTransaction() + */ + public AAITransactionalClient beginNewTransaction() { + startTransaction(); + return this; + } + + /* + * (non-Javadoc) + * + * @see org.onap.aaiclient.client.aai.GraphInventoryTransactionalClient#execute() + */ + @Override + public void execute() throws BulkProcessFailed { + try { + if (!this.transactions.getTransactions().isEmpty()) { + RestClient client = aaiClient.createClient(AAIUriFactory.createResourceUri(AAIObjectType.BULK_PROCESS)); + Response response = client.put(this.transactions); + if (response.hasEntity()) { + final Optional errorMessage = this.locateErrorMessages(response.readEntity(String.class)); + if (errorMessage.isPresent()) { + throw new BulkProcessFailed( + "One or more transactions failed in A&AI. Check logs for payloads.\nMessages:\n" + + errorMessage.get()); + } + } else { + throw new BulkProcessFailed( + "Transactions acccepted by A&AI, but there was no response. Unsure of result."); + } + } + } finally { + this.transactions.getTransactions().clear(); + this.currentTransaction = null; + this.actionCount = 0; + } + } + + @Override + public void execute(boolean dryRun) throws BulkProcessFailed { + final ObjectMapper mapper = new ObjectMapper(); + if (dryRun) { + try { + if (logger.isDebugEnabled()) { + logger.debug("Would execute: {}", mapper.writeValueAsString(this.transactions)); + } + } catch (JsonProcessingException e) { + logger.debug("Could not format request to JSON", e); + } + } else { + this.execute(); + } + } + + protected Optional locateErrorMessages(String response) { + final List errorMessages = new ArrayList<>(); + final List results = JsonPathUtil.getInstance().locateResultList(response, "$..body"); + final ObjectMapper mapper = new ObjectMapper(); + if (!results.isEmpty()) { + List> parsed = new ArrayList<>(); + try { + for (String result : results) { + parsed.add(mapper.readValue(result, new TypeReference>() {})); + } + } catch (IOException e) { + logger.error("could not map json", e); + } + for (Map map : parsed) { + for (Entry entry : map.entrySet()) { + if (!entry.getKey().matches("2\\d\\d")) { + AAIError error; + try { + error = mapper.readValue(entry.getValue().toString(), AAIError.class); + } catch (IOException e) { + logger.error("could not parse error object from A&AI", e); + error = new AAIError(); + } + AAIErrorFormatter formatter = new AAIErrorFormatter(error); + String outputMessage = formatter.getMessage(); + logger.error("part of a bulk action failed in A&AI: " + entry.getValue()); + errorMessages.add(outputMessage); + } + } + } + } + + if (!errorMessages.isEmpty()) { + return Optional.of(Joiner.on("\n").join(errorMessages)); + } else { + return Optional.empty(); + } + } + + private Relationship buildRelationship(AAIResourceUri uri) { + return buildRelationship(uri, Optional.empty()); + } + + private Relationship buildRelationship(AAIResourceUri uri, AAIEdgeLabel label) { + return buildRelationship(uri, Optional.of(label)); + } + + private Relationship buildRelationship(AAIResourceUri uri, Optional label) { + final Relationship result = new Relationship(); + result.setRelatedLink(uri.build().toString()); + if (label.isPresent()) { + result.setRelationshipLabel(label.toString()); + } + return result; + } + + protected Transactions getTransactions() { + return this.transactions; + } + + @Override + protected void put(String uri, Object body) { + currentTransaction.getPut().add(new OperationBody().withUri(uri).withBody(body)); + } + + @Override + protected void delete(String uri) { + currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(null)); + } + + @Override + protected void delete(String uri, Object obj) { + currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(obj)); + } + + @Override + protected void patch(String uri, Object body) { + currentTransaction.getPatch().add(new OperationBody().withUri(uri).withBody(body)); + } + + @Override + protected Optional get(GenericType genericType, AAIBaseResourceUri clone) { + return resourcesClient.get(genericType, clone); + } + + @Override + protected boolean exists(AAIBaseResourceUri uri) { + return resourcesClient.exists(uri); + } + + @Override + protected String getGraphDBName() { + return aaiClient.getGraphDBName(); + } + + @Override + protected GraphInventoryPatchConverter getPatchConverter() { + return this.patchConverter; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIUpdator.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIUpdator.java new file mode 100644 index 0000000000..66f9a0e05f --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIUpdator.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +public interface AAIUpdator { + + void updateVnfToLocked(String vnfName) throws Exception; + + void updateVnfToUnLocked(String vnfName) throws Exception; + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIUpdatorImpl.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIUpdatorImpl.java new file mode 100644 index 0000000000..2bcb1a872a --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIUpdatorImpl.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import org.springframework.beans.factory.annotation.Autowired; + +public class AAIUpdatorImpl implements AAIUpdator { + + @Autowired + protected AAIRestClientI client; + + public AAIRestClientI getClient() { + return client; + } + + + public void setClient(AAIRestClientI client) { + this.client = client; + } + + @Override + public void updateVnfToLocked(String vnfId) throws Exception { + client.updateMaintenceFlagVnfId(vnfId, true); + } + + @Override + public void updateVnfToUnLocked(String vnfId) throws Exception { + client.updateMaintenceFlagVnfId(vnfId, false); + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIValidator.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIValidator.java new file mode 100644 index 0000000000..b84579ef83 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIValidator.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import java.io.IOException; + +public interface AAIValidator { + + boolean isPhysicalServerLocked(String hostName) throws IOException; + + boolean isVNFLocked(String vnfId); + + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIValidatorImpl.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIValidatorImpl.java new file mode 100644 index 0000000000..3861b034e8 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIValidatorImpl.java @@ -0,0 +1,71 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import java.io.IOException; +import java.util.List; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.Pserver; +import org.springframework.beans.factory.annotation.Autowired; + + +public class AAIValidatorImpl implements AAIValidator { + + + @Autowired + protected AAIRestClientI client; + + public AAIRestClientI getClient() { + return client; + } + + + public void setClient(AAIRestClientI client) { + this.client = client; + } + + @Override + public boolean isPhysicalServerLocked(String vnfId) throws IOException { + List pservers; + boolean isLocked = false; + pservers = client.getPhysicalServerByVnfId(vnfId); + if (pservers != null) { + for (Pserver pserver : pservers) { + if (pserver.isInMaint()) { + isLocked = true; + return isLocked; + } + } + } + return isLocked; + } + + @Override + public boolean isVNFLocked(String vnfId) { + boolean isLocked = false; + GenericVnf genericVnf = client.getVnfByName(vnfId); + if (genericVnf.isInMaint()) + isLocked = true; + + return isLocked; + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIVersion.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIVersion.java new file mode 100644 index 0000000000..0ddbb8fae5 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIVersion.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import org.onap.aaiclient.client.graphinventory.GraphInventoryVersion; + +public enum AAIVersion implements GraphInventoryVersion { + V10("V10"), + V11("V11"), + V12("V12"), + V13("v13"), + V14("v14"), + V15("v15"), + V16("v16"), + V17("v17"), + V18("v18"), + V19("v19"); + + public static final AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1]; + private final String value; + + private AAIVersion(String value) { + this.value = value; + } + + @Override + public String toString() { + return this.value; + } +} + + diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEdgeLabel.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEdgeLabel.java new file mode 100644 index 0000000000..fdef5773ef --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEdgeLabel.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities; + +import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryEdgeLabel; + +public enum AAIEdgeLabel implements GraphInventoryEdgeLabel { + + BELONGS_TO("org.onap.relationships.inventory.BelongsTo"), + USES("org.onap.relationships.inventory.Uses"), + COMPOSED_OF("org.onap.relationships.inventory.ComposedOf"); + + private final String label; + + private AAIEdgeLabel(String label) { + this.label = label; + } + + + @Override + public String toString() { + return this.label; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEntity.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEntity.java new file mode 100644 index 0000000000..bac3462dc3 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEntity.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities; + +public class AAIEntity { + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEntityObject.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEntityObject.java new file mode 100644 index 0000000000..92790e23be --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEntityObject.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities; + +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; + +public interface AAIEntityObject { + + public AAIResourceUri getUri(); + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIError.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIError.java new file mode 100644 index 0000000000..51c87d07dd --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIError.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"requestError"}) +public class AAIError { + + @JsonProperty("requestError") + private RequestError requestError; + + @JsonProperty("requestError") + public RequestError getRequestError() { + return requestError; + } + + @JsonProperty("requestError") + public void setRequestError(RequestError requestError) { + this.requestError = requestError; + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIResultWrapper.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIResultWrapper.java new file mode 100644 index 0000000000..baa95fbc28 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIResultWrapper.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities; + +import java.io.Serializable; +import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryResultWrapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AAIResultWrapper extends GraphInventoryResultWrapper implements Serializable { + + private static final long serialVersionUID = 5895841925807816737L; + private final static transient Logger logger = LoggerFactory.getLogger(AAIResultWrapper.class); + + public AAIResultWrapper(String json) { + super(json, logger); + } + + public AAIResultWrapper(Object aaiObject) { + super(aaiObject, logger); + } + + @Override + protected Relationships createRelationships(String json) { + return new Relationships(json); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Configuration.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Configuration.java new file mode 100644 index 0000000000..335558f9c1 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Configuration.java @@ -0,0 +1,153 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"configuration-id", "configuration-type", "configuration-sub-type", "model-invariant-id", + "model-version-id", "orchestration-status", "operational-status", "configuration-selflink", + "model-customization-id"}) +public class Configuration { + + @JsonProperty("configuration-id") + private String configurationId; + @JsonProperty("configuration-name") + private String configurationName; + @JsonProperty("configuration-type") + private String configurationType; + @JsonProperty("configuration-sub-type") + private String configurationSubType; + @JsonProperty("model-invariant-id") + private String modelInvariantId; + @JsonProperty("model-version-id") + private String modelVersionId; + @JsonProperty("orchestration-status") + private String orchestrationStatus; + @JsonProperty("operational-status") + private String operationalStatus; + @JsonProperty("configuration-selflink") + private String configurationSelflink; + @JsonProperty("model-customization-id") + private String modelCustomizationId; + + @JsonProperty("configuration-id") + public String getConfigurationId() { + return configurationId; + } + + @JsonProperty("configuration-id") + public void setConfigurationId(String configurationId) { + this.configurationId = configurationId; + } + + @JsonProperty("configuration-name") + public String getConfigurationName() { + return configurationName; + } + + @JsonProperty("configuration-name") + public void setConfigurationName(String configurationName) { + this.configurationName = configurationName; + } + + @JsonProperty("configuration-type") + public String getConfigurationType() { + return configurationType; + } + + @JsonProperty("configuration-type") + public void setConfigurationType(String configurationType) { + this.configurationType = configurationType; + } + + @JsonProperty("configuration-sub-type") + public String getConfigurationSubType() { + return configurationSubType; + } + + @JsonProperty("configuration-sub-type") + public void setConfigurationSubType(String configurationSubType) { + this.configurationSubType = configurationSubType; + } + + @JsonProperty("model-invariant-id") + public String getModelInvariantId() { + return modelInvariantId; + } + + @JsonProperty("model-invariant-id") + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + @JsonProperty("model-version-id") + public String getModelVersionId() { + return modelVersionId; + } + + @JsonProperty("model-version-id") + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + @JsonProperty("orchestration-status") + public String getOrchestrationStatus() { + return orchestrationStatus; + } + + @JsonProperty("orchestration-status") + public void setOrchestrationStatus(String orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + @JsonProperty("operational-status") + public String getOperationalStatus() { + return operationalStatus; + } + + @JsonProperty("operational-status") + public void setOperationalStatus(String operationalStatus) { + this.operationalStatus = operationalStatus; + } + + @JsonProperty("model-customization-id") + public String getModelCustomizationId() { + return modelCustomizationId; + } + + @JsonProperty("model-customization-id") + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } + + @JsonProperty("configuration-selflink") + public String getConfigurationSelflink() { + return configurationSelflink; + } + + @JsonProperty("configuration-selflink") + public void setConfigurationSelflink(String configurationSelflink) { + this.configurationSelflink = configurationSelflink; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/CustomQuery.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/CustomQuery.java new file mode 100644 index 0000000000..7363ba7796 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/CustomQuery.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import com.fasterxml.jackson.annotation.JsonInclude; + + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class CustomQuery { + + private List start; + private String query; + private String gremlin; + + public CustomQuery(List start) { + this.setStart(start); + } + + public CustomQuery(List start, String query) { + this.setStart(start); + this.query = "query/" + query; + } + + public CustomQuery(String gremlin) throws UnsupportedEncodingException { + this.gremlin = gremlin; + } + + public String getGremlin() { + return gremlin; + } + + public void setGremlin(String gremlin) { + this.gremlin = gremlin; + } + + public List getStart() { + return start; + } + + public void setStart(List start) { + this.start = this.mapUris(start); + } + + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + private List mapUris(List uris) { + final List result = new ArrayList<>(); + uris.stream().map(item -> item.build().toString()).forEach(result::add); + return result; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/QueryStep.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/QueryStep.java new file mode 100644 index 0000000000..cbca20f37b --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/QueryStep.java @@ -0,0 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.aaiclient.client.aai.entities; + +@FunctionalInterface +public interface QueryStep { + + + public String build(); +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Relationships.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Relationships.java new file mode 100644 index 0000000000..fb205310fc --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Relationships.java @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities; + +import java.util.List; +import javax.ws.rs.core.UriBuilder; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName; +import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryRelationships; + +public class Relationships extends GraphInventoryRelationships { + + public Relationships(String json) { + super(json); + } + + @Deprecated + /** + * Use getRelatedUris instead + * + * @return + */ + public List getRelatedAAIUris() { + return this.getRelatedUris(); + } + + @Deprecated + /** + * Use getRelatedUris instead + * + * @return + */ + public List getRelatedAAIUris(GraphInventoryObjectName type) { + return this.getRelatedUris(type); + } + + + protected AAIResultWrapper get(AAIResourceUri uri) { + return new AAIResourcesClient().get(uri); + + } + + @Override + protected AAIResourceUri createUri(AAIObjectType type, String relatedLink) { + + return AAIUriFactory.createResourceFromExistingURI(type, UriBuilder.fromPath(relatedLink).build()); + } + + @Override + protected AAIObjectType fromTypeName(String name) { + return AAIObjectType.fromTypeName(name); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/RequestError.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/RequestError.java new file mode 100644 index 0000000000..3caabf52f4 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/RequestError.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"serviceException"}) +public class RequestError { + + @JsonProperty("serviceException") + private ServiceException serviceException; + + @JsonProperty("serviceException") + public ServiceException getServiceException() { + return serviceException; + } + + @JsonProperty("serviceException") + public void setServiceException(ServiceException serviceException) { + this.serviceException = serviceException; + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Results.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Results.java new file mode 100644 index 0000000000..57312176c2 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Results.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities; + +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"results"}) +public class Results { + @JsonProperty("results") + protected List results; + + @JsonProperty("results") + public List getResult() { + if (results == null) { + results = new ArrayList<>(); + } + return this.results; + } + + @JsonProperty("results") + public void setResult(List results) { + this.results = results; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/ServiceException.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/ServiceException.java new file mode 100644 index 0000000000..81dbbed652 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/ServiceException.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities; + +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"messageId", "text", "variables"}) +public class ServiceException { + + @JsonProperty("messageId") + private String messageId; + @JsonProperty("text") + private String text; + @JsonProperty("variables") + private List variables = new ArrayList<>(); + + @JsonProperty("messageId") + public String getMessageId() { + return messageId; + } + + @JsonProperty("messageId") + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + @JsonProperty("text") + public String getText() { + return text; + } + + @JsonProperty("text") + public void setText(String text) { + this.text = text; + } + + @JsonProperty("variables") + public List getVariables() { + return variables; + } + + @JsonProperty("variables") + public void setVariables(List variables) { + this.variables = variables; + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/OperationBody.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/OperationBody.java new file mode 100644 index 0000000000..e886425696 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/OperationBody.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.bulkprocess; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"uri", "body"}) +public class OperationBody { + + @JsonProperty("uri") + private String uri; + @JsonProperty("body") + @JsonSerialize(using = OperationBodySerializer.class) + private Object body; + + @JsonProperty("uri") + public String getUri() { + return uri; + } + + @JsonProperty("uri") + public void setUri(String uri) { + this.uri = uri; + } + + public OperationBody withUri(String uri) { + this.uri = uri; + return this; + } + + @JsonProperty("body") + public Object getBody() { + return body; + } + + @JsonProperty("body") + public void setBody(Object body) { + this.body = body; + } + + public OperationBody withBody(Object body) { + this.body = body; + return this; + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/OperationBodySerializer.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/OperationBodySerializer.java new file mode 100644 index 0000000000..11cd6e1ea4 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/OperationBodySerializer.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.bulkprocess; + +import java.io.IOException; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +public class OperationBodySerializer extends StdSerializer { + + private static final long serialVersionUID = 5367385969270400106L; + + public OperationBodySerializer() { + this(null); + } + + public OperationBodySerializer(Class t) { + super(t); + } + + @Override + public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) + throws IOException, JsonProcessingException { + + if (value instanceof String) { + gen.writeRawValue((String) value); + } else { + gen.writeObject(value); + } + + } + +} + diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/Transaction.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/Transaction.java new file mode 100644 index 0000000000..2c32c1b0ca --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/Transaction.java @@ -0,0 +1,90 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.bulkprocess; + +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"patch", "patch", "delete"}) +public class Transaction { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("put") + private List put = new ArrayList<>(); + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("patch") + private List patch = new ArrayList<>(); + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("delete") + private List delete = new ArrayList<>(); + + @JsonProperty("put") + public List getPut() { + return put; + } + + @JsonProperty("put") + public void setPut(List put) { + this.put = put; + } + + public Transaction withPut(List put) { + this.put = put; + return this; + } + + @JsonProperty("patch") + public List getPatch() { + return patch; + } + + @JsonProperty("patch") + public void setPatch(List patch) { + this.patch = patch; + } + + public Transaction withPatch(List patch) { + this.patch = patch; + return this; + } + + @JsonProperty("delete") + public List getDelete() { + return delete; + } + + @JsonProperty("delete") + public void setDelete(List delete) { + this.delete = delete; + } + + public Transaction withDelete(List delete) { + this.delete = delete; + return this; + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/Transactions.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/Transactions.java new file mode 100644 index 0000000000..7d31085b71 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/Transactions.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.bulkprocess; + +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"transactions"}) +public class Transactions { + + @JsonProperty("transactions") + private List transactions = new ArrayList<>(); + + @JsonProperty("transactions") + public List getTransactions() { + return transactions; + } + + @JsonProperty("transactions") + public void setTransactions(List transactions) { + this.transactions = transactions; + } + + public Transactions withTransactions(List transactions) { + this.transactions = transactions; + return this; + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyRequest.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyRequest.java new file mode 100644 index 0000000000..25aff9fb4a --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyRequest.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.singletransaction; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"action", "uri", "body"}) +public class OperationBodyRequest { + + @JsonProperty("action") + private String action; + @JsonProperty("uri") + private String uri; + @JsonProperty("body") + @JsonSerialize(using = OperationBodyRequestSerializer.class) + private Object body; + + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public OperationBodyRequest withAction(String action) { + this.action = action; + return this; + } + + @JsonProperty("uri") + public String getUri() { + return uri; + } + + @JsonProperty("uri") + public void setUri(String uri) { + this.uri = uri; + } + + public OperationBodyRequest withUri(String uri) { + this.uri = uri; + return this; + } + + @JsonProperty("body") + public Object getBody() { + return body; + } + + @JsonProperty("body") + public void setBody(Object body) { + this.body = body; + } + + public OperationBodyRequest withBody(Object body) { + this.body = body; + return this; + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java new file mode 100644 index 0000000000..5a8a2b6f73 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.singletransaction; + +import java.io.IOException; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +public class OperationBodyRequestSerializer extends StdSerializer { + + private static final long serialVersionUID = 5367385969270400106L; + + public OperationBodyRequestSerializer() { + this(null); + } + + public OperationBodyRequestSerializer(Class t) { + super(t); + } + + @Override + public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) + throws IOException, JsonProcessingException { + + if (value instanceof String) { + gen.writeRawValue((String) value); + } else { + gen.writeObject(value); + } + + } + +} + diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyResponse.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyResponse.java new file mode 100644 index 0000000000..165806fdfa --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyResponse.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.singletransaction; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonPropertyOrder({"action", "uri", "response-status-code", "response-body"}) +public class OperationBodyResponse { + + @JsonProperty("action") + public String action; + @JsonProperty("uri") + public String uri; + @JsonProperty("response-status-code") + public Integer responseStatusCode; + @JsonProperty("response-body") + public Object responseBody; + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getUri() { + return uri; + } + + public void setUri(String uri) { + this.uri = uri; + } + + @JsonProperty("response-status-code") + public Integer getResponseStatusCode() { + return responseStatusCode; + } + + @JsonProperty("response-status-code") + public void setResponseStatusCode(Integer responseStatusCode) { + this.responseStatusCode = responseStatusCode; + } + + @JsonProperty("response-body") + public Object getResponseBody() { + return responseBody; + } + + @JsonProperty("response-body") + public void getResponseBody(Object responseBody) { + this.responseBody = responseBody; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/SingleTransactionRequest.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/SingleTransactionRequest.java new file mode 100644 index 0000000000..c279c18dd7 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/SingleTransactionRequest.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.singletransaction; + +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class SingleTransactionRequest { + + @JsonProperty("operations") + public List operations; + + public List getOperations() { + + if (operations == null) { + operations = new ArrayList<>(); + } + + return operations; + } + + public void setOperations(List operations) { + this.operations = operations; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/SingleTransactionResponse.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/SingleTransactionResponse.java new file mode 100644 index 0000000000..ac4eb2c82f --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/SingleTransactionResponse.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.singletransaction; + +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class SingleTransactionResponse { + + @JsonProperty("operation-responses") + public List operationResponses; + + @JsonProperty("operation-responses") + public List getOperationResponses() { + if (operationResponses == null) { + operationResponses = new ArrayList<>(); + } + return operationResponses; + } + + @JsonProperty("operation-responses") + public void setOperationResponses(List operationResponses) { + this.operationResponses = operationResponses; + } + + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIBaseResourceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIBaseResourceUri.java new file mode 100644 index 0000000000..e933ffd339 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIBaseResourceUri.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.uri; + +import org.onap.aaiclient.client.aai.AAIObjectBase; +import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryResourceUri; + +public interface AAIBaseResourceUri, OT extends AAIObjectBase> + extends AAIUri, GraphInventoryResourceUri { + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIPluralResourceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIPluralResourceUri.java new file mode 100644 index 0000000000..0d41e1df02 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIPluralResourceUri.java @@ -0,0 +1,9 @@ +package org.onap.aaiclient.client.aai.entities.uri; + +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri; + +public interface AAIPluralResourceUri extends AAIBaseResourceUri, + GraphInventoryPluralResourceUri { + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIResourceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIResourceUri.java new file mode 100644 index 0000000000..3d01258f71 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIResourceUri.java @@ -0,0 +1,10 @@ +package org.onap.aaiclient.client.aai.entities.uri; + +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventorySingleResourceUri; + +public interface AAIResourceUri extends AAIBaseResourceUri, + GraphInventorySingleResourceUri { + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimplePluralUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimplePluralUri.java new file mode 100644 index 0000000000..67ce0962dc --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimplePluralUri.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.uri; + +import javax.ws.rs.core.UriBuilder; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.graphinventory.entities.uri.SimplePluralUri; + +public class AAISimplePluralUri + extends SimplePluralUri + implements AAIPluralResourceUri { + + private static final long serialVersionUID = -6397024057188453229L; + + protected AAISimplePluralUri(AAIObjectPlurals type, UriBuilder builder, Object... values) { + super(type, builder, values); + } + + protected AAISimplePluralUri(AAIObjectPlurals type) { + super(type); + } + + protected AAISimplePluralUri(AAIObjectPlurals type, Object... values) { + super(type, values); + } + + protected AAISimplePluralUri(AAIObjectPlurals type, AAIResourceUri uri) { + super(type, uri); + } + + protected AAISimplePluralUri(AAIResourceUri parentUri, AAIObjectPlurals childType) { + super(parentUri, childType); + } + + protected AAISimplePluralUri(AAISimplePluralUri copy) { + super(copy); + } + + @Override + public AAISimplePluralUri clone() { + return new AAISimplePluralUri(this); + } + + @Override + public AAIObjectPlurals getObjectType() { + return this.pluralType; + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUri.java new file mode 100644 index 0000000000..40184b028b --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUri.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.uri; + +import java.net.URI; +import javax.ws.rs.core.UriBuilder; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.graphinventory.entities.uri.SimpleUri; + +public class AAISimpleUri extends SimpleUri + implements AAIResourceUri { + + private static final long serialVersionUID = -6397024057188453229L; + + protected AAISimpleUri(AAIObjectType type, Object... values) { + super(type, values); + + } + + protected AAISimpleUri(AAIObjectType type, URI uri) { + super(type, uri); + } + + protected AAISimpleUri(AAIObjectType type, UriBuilder builder, Object... values) { + super(type, builder, values); + } + + protected AAISimpleUri(AAIResourceUri parentUri, AAIObjectType childType, Object... childValues) { + super(parentUri, childType, childValues); + } + + // copy constructor + protected AAISimpleUri(AAISimpleUri copy) { + super(copy); + } + + @Override + public AAISimpleUri clone() { + return new AAISimpleUri(this); + } + + @Override + public AAISimpleUri relatedTo(AAIObjectType type, String... values) { + this.internalURI = internalURI.path(relatedTo); + return new AAISimpleUri(this, type, values); + } + + @Override + public AAISimplePluralUri relatedTo(AAIObjectPlurals plural) { + this.internalURI.path(relatedTo); + return new AAISimplePluralUri(this, plural); + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUri.java new file mode 100644 index 0000000000..662a1ab37b --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUri.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.uri; + +import java.util.regex.Pattern; +import org.onap.aaiclient.client.aai.AAIObjectBase; +import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryUri; + +public interface AAIUri, OP extends AAIObjectBase> extends GraphInventoryUri { + + public default Pattern getPrefixPattern() { + return Pattern.compile("/aai/v\\d+"); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java new file mode 100644 index 0000000000..31b55958d6 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java @@ -0,0 +1,114 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.uri; + +import java.net.URI; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; + + +public class AAIUriFactory { + + /** + * values are filled into the URI template specified in {@link AAIObjectType} in order
+ * There are two special lookups performed on certain types when a single value is specified:
+ * Service Instance and AllottedResources
+ * These can be retrieved without all their required keys but an HTTP call is required to do so + * + * @param type + * @param values + * @return + */ + public static AAIResourceUri createResourceUri(AAIObjectType type, Object... values) { + if (AAIObjectType.SERVICE_INSTANCE.equals(type)) { + return new ServiceInstanceUri(values); + } else if (AAIObjectType.ALLOTTED_RESOURCE.equals(type)) { + return new AllottedResourceLookupUri(values); + } else { + return new AAISimpleUri(type, values); + } + } + + public static NodesSingleUri createNodesUri(AAIObjectType type, Object... values) { + return new NodesSingleUri(type, values); + + } + + public static NodesPluralUri createNodesUri(AAIObjectPlurals type) { + return new NodesPluralUri(type); + + } + + /** + * This method should only be used to wrap a URI retrieved from A&AI contained within an object response + * + * @param type + * @param uri + * @return + */ + public static AAISimpleUri createResourceFromExistingURI(AAIObjectType type, URI uri) { + return new AAISimpleUri(type, uri); + } + + + /** + * creates an AAIResourceUri from a parentUri + * + * @param parentUri + * @param childType + * @param childValues + * @return + */ + public static AAISimpleUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectType childType, + Object... childValues) { + + return new AAISimpleUri(parentUri, childType, childValues); + } + + public static AAISimplePluralUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectPlurals childType) { + + return new AAISimplePluralUri(parentUri, childType); + } + + /** + * Creates a uri for a plural type e.g. /cloud-infrastructure/pservers + * + * @param type + * @return + */ + public static AAISimplePluralUri createResourceUri(AAIObjectPlurals type) { + + return new AAISimplePluralUri(type); + + } + + /** + * Creates a uri for a plural type with values e.g. /cloud-infrastructure/pservers + * + * @param type + * @return + */ + public static AAISimplePluralUri createResourceUri(AAIObjectPlurals type, Object... values) { + + return new AAISimplePluralUri(type, values); + + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUri.java new file mode 100644 index 0000000000..7f51835580 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUri.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.uri; + +import java.net.URI; +import java.util.Optional; +import javax.ws.rs.core.UriBuilder; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; + +public class AllottedResourceLookupUri extends HttpLookupUri { + + private static final long serialVersionUID = -9212594383876793188L; + + protected AllottedResourceLookupUri(Object... values) { + super(AAIObjectType.ALLOTTED_RESOURCE, values); + } + + protected AllottedResourceLookupUri(UriBuilder builder, Optional cachedValue, Object... values) { + super(AAIObjectType.ALLOTTED_RESOURCE, builder, cachedValue, values); + } + + @Override + public AllottedResourceLookupUri clone() { + return new AllottedResourceLookupUri(this.internalURI.clone(), this.getCachedValue(), values); + } + + public AAIResourcesClient getResourcesClient() { + return new AAIResourcesClient(); + } + + @Override + public URI buildNoNetwork() { + return super.build(new String[] {"NONE", "NONE", "NONE", (String) this.values[0]}); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/HttpLookupUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/HttpLookupUri.java new file mode 100644 index 0000000000..c39eb50dc2 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/HttpLookupUri.java @@ -0,0 +1,174 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.uri; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.net.URI; +import java.util.Map; +import java.util.Optional; +import javax.ws.rs.BadRequestException; +import javax.ws.rs.NotFoundException; +import javax.ws.rs.core.UriBuilder; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.Results; +import org.onap.aaiclient.client.graphinventory.Format; +import org.onap.aaiclient.client.graphinventory.entities.Pathed; +import org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri; +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryPayloadException; +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException; +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriNotFoundException; +import org.onap.aaiclient.client.graphinventory.exceptions.IncorrectNumberOfUriKeys; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri { + + private transient Optional cachedValue = Optional.empty(); + private final AAIObjectType aaiType; + + protected HttpLookupUri(AAIObjectType type, Object... values) { + super(type, values); + this.aaiType = type; + } + + protected HttpLookupUri(AAIObjectType type, UriBuilder builder, Optional cachedValue, Object... values) { + super(type, builder, values); + this.cachedValue = cachedValue; + this.aaiType = type; + } + + protected String getObjectById(Object id) + throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException { + if (!this.getCachedValue().isPresent()) { + AAIResourceUri serviceInstanceUri = AAIUriFactory.createNodesUri(aaiType, id).format(Format.PATHED); + String resultJson; + try { + resultJson = this.getResourcesClient().get(serviceInstanceUri, NotFoundException.class).getJson(); + } catch (BadRequestException e) { + throw new GraphInventoryUriNotFoundException( + aaiType.typeName() + " " + id + " not found at: " + serviceInstanceUri.build()); + + } + try { + cachedValue = extractRelatedLink(resultJson); + if (!cachedValue.isPresent()) { + throw new GraphInventoryUriNotFoundException( + aaiType.typeName() + " " + id + " not found at: " + serviceInstanceUri.build()); + } + } catch (IOException e) { + throw new GraphInventoryPayloadException("could not map payload: " + resultJson, e); + } + } + return cachedValue.get(); + } + + protected Optional extractRelatedLink(String jsonString) throws IOException { + Optional result; + ObjectMapper mapper = new ObjectMapper(); + + Results results = mapper.readValue(jsonString, new TypeReference>() {}); + if (results.getResult().size() == 1) { + String uriString = results.getResult().get(0).getResourceLink(); + URI uri = UriBuilder.fromUri(uriString).build(); + String rawPath = uri.getRawPath(); + result = Optional.of(rawPath.replaceAll("/aai/v\\d+", "")); + } else if (results.getResult().isEmpty()) { + result = Optional.empty(); + } else { + throw new IllegalStateException("more than one result returned"); + } + + return result; + } + + protected Optional getCachedValue() { + return this.cachedValue; + } + + @Override + public URI build() { + try { + if (this.values.length == 1) { + String uri = getObjectById(this.values[0]); + Map map = super.getURIKeys(uri); + this.values = map.values().toArray(values); + return super.build(values); + } + } catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) { + throw new GraphInventoryUriComputationException(e); + } + return super.build(); + } + + @Override + public URI locateAndBuild() { + try { + if (this.values.length == 1) { + String uri = getObjectById(this.values[0]); + Map map = super.getURIKeys(uri); + this.values = map.values().toArray(values); + return super.build(values); + } + } catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) { + throw new GraphInventoryUriComputationException(e); + } + return super.build(); + } + + @Override + public abstract HttpLookupUri clone(); + + @Override + public void validateValuesSize(String template, Object... values) { + try { + super.validateValuesSize(template, values); + } catch (IncorrectNumberOfUriKeys e) { + if (values.length == 1) { + // Special case where we perform an http look up + } else { + throw e; + } + } + } + + public AAIResourcesClient getResourcesClient() { + return new AAIResourcesClient(); + } + + private void writeObject(ObjectOutputStream oos) throws IOException { + + oos.writeUTF(this.cachedValue.orElse("")); + } + + private void readObject(ObjectInputStream ois) throws IOException { + + String value = ois.readUTF(); + if ("".equals(value)) { + this.cachedValue = Optional.empty(); + } else { + this.cachedValue = Optional.ofNullable(value); + } + + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesPluralUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesPluralUri.java new file mode 100644 index 0000000000..80032fe9fd --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesPluralUri.java @@ -0,0 +1,19 @@ +package org.onap.aaiclient.client.aai.entities.uri; + +import javax.ws.rs.core.UriBuilder; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectBase; + +public class NodesPluralUri extends AAISimplePluralUri implements NodesUri { + + private static final long serialVersionUID = -6743170679667245998L; + + protected NodesPluralUri(AAIObjectPlurals type) { + super(type); + } + + @Override + public String getTemplate(GraphInventoryObjectBase type) { + return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate(); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesSingleUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesSingleUri.java new file mode 100644 index 0000000000..8ec4df5848 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesSingleUri.java @@ -0,0 +1,21 @@ +package org.onap.aaiclient.client.aai.entities.uri; + +import javax.ws.rs.core.UriBuilder; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectBase; + +public class NodesSingleUri extends AAISimpleUri implements NodesUri { + + private static final long serialVersionUID = 2721165364903444248L; + + protected NodesSingleUri(AAIObjectType type, Object... values) { + super(type, values); + } + + + @Override + public String getTemplate(GraphInventoryObjectBase type) { + return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate(); + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesUri.java new file mode 100644 index 0000000000..03f1a62462 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesUri.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.uri; + +public interface NodesUri { + + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUri.java new file mode 100644 index 0000000000..96eaac5815 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUri.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.uri; + +import java.net.URI; +import java.util.Optional; +import javax.ws.rs.core.UriBuilder; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; + +public class ServiceInstanceUri extends HttpLookupUri { + + private static final long serialVersionUID = 2248914170527514548L; + + protected ServiceInstanceUri(Object... values) { + super(AAIObjectType.SERVICE_INSTANCE, values); + } + + protected ServiceInstanceUri(UriBuilder builder, Optional cachedValue, Object... values) { + super(AAIObjectType.SERVICE_INSTANCE, builder, cachedValue, values); + } + + @Override + public ServiceInstanceUri clone() { + return new ServiceInstanceUri(this.internalURI.clone(), this.getCachedValue(), values); + } + + public AAIResourcesClient getResourcesClient() { + return new AAIResourcesClient(); + } + + @Override + public URI buildNoNetwork() { + return super.build(new String[] {"NONE", "NONE", (String) this.values[0]}); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/EmptyStringToNullSerializer.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/EmptyStringToNullSerializer.java new file mode 100644 index 0000000000..27309cb461 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/EmptyStringToNullSerializer.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory; + +import java.io.IOException; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +public class EmptyStringToNullSerializer extends StdSerializer { + + private static final long serialVersionUID = 5367385969270400106L; + + public EmptyStringToNullSerializer() { + this(null); + } + + public EmptyStringToNullSerializer(Class t) { + super(t); + } + + @Override + public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) + throws IOException, JsonProcessingException { + + if ("".equals(value)) { + gen.writeNull(); + } else { + gen.writeString(value); + } + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/Format.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/Format.java new file mode 100644 index 0000000000..37f7893f26 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/Format.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory; + +public enum Format { + + RESOURCE("resource"), + RESOURCE_AND_URL("resource_and_url"), + SIMPLE("simple"), + RAW("raw"), + CONSOLE("console"), + PATHED("pathed"), + GRAPHSON("graphson"), + ID("id"), + COUNT("count"); + + private final String name; + + private Format(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryClient.java new file mode 100644 index 0000000000..a2bb8bc141 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryClient.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory; + +import java.net.URI; +import org.onap.so.client.RestClient; +import org.onap.so.client.RestProperties; +import org.onap.so.client.RestPropertiesLoader; +import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryUri; +import org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri; + +public abstract class GraphInventoryClient { + + private RestProperties props; + + protected GraphInventoryClient(Class propertiesClass) { + + RestProperties props = RestPropertiesLoader.getInstance().getNewImpl(propertiesClass); + this.props = props; + } + + protected abstract URI constructPath(URI uri); + + protected abstract RestClient createClient(URI uri); + + public RestClient createClient(GraphInventoryUri uri) { + final URI result; + if (uri instanceof HttpAwareUri) { + result = ((HttpAwareUri) uri).locateAndBuild(); + } else { + result = uri.build(); + } + + return createClient(result); + + } + + + public T getRestProperties() { + if (props == null) { + throw new IllegalStateException("No RestProperty implementation found on classpath"); + } + return (T) props; + } + + public abstract GraphInventoryVersion getVersion(); + + public abstract String getGraphDBName(); +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryCommonObjectMapperPatchProvider.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryCommonObjectMapperPatchProvider.java new file mode 100644 index 0000000000..c1b70dc687 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryCommonObjectMapperPatchProvider.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory; + +import com.fasterxml.jackson.databind.module.SimpleModule; + +public class GraphInventoryCommonObjectMapperPatchProvider extends GraphInventoryCommonObjectMapperProvider { + + + public GraphInventoryCommonObjectMapperPatchProvider() { + super(); + EmptyStringToNullSerializer sp = new EmptyStringToNullSerializer(); + SimpleModule emptyStringModule = new SimpleModule(); + emptyStringModule.addSerializer(String.class, sp); + mapper.registerModule(emptyStringModule); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java new file mode 100644 index 0000000000..ba12bb8906 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory; + +import org.onap.so.client.policy.CommonObjectMapperProvider; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.AnnotationIntrospector; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; +import com.fasterxml.jackson.databind.type.TypeFactory; +import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector; + +public class GraphInventoryCommonObjectMapperProvider extends CommonObjectMapperProvider { + + public GraphInventoryCommonObjectMapperProvider() { + mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); + mapper.enable(MapperFeature.USE_ANNOTATIONS); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + AnnotationIntrospector aiJaxb = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()); + AnnotationIntrospector aiJackson = new JacksonAnnotationIntrospector(); + // first Jaxb, second Jackson annotations + mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(aiJaxb, aiJackson)); + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectBase.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectBase.java new file mode 100644 index 0000000000..959126bb91 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectBase.java @@ -0,0 +1,9 @@ +package org.onap.aaiclient.client.graphinventory; + +public interface GraphInventoryObjectBase + extends GraphInventoryObjectName, GraphInventoryObjectUriTemplate, GraphInventoryObjectUriPartial { + + public default boolean passThrough() { + return false; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectName.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectName.java new file mode 100644 index 0000000000..c287ab6984 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectName.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory; + +import com.google.common.base.CaseFormat; + +public interface GraphInventoryObjectName { + + public String typeName(); + + public String typeName(CaseFormat format); +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectPlurals.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectPlurals.java new file mode 100644 index 0000000000..3eb71b21c2 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectPlurals.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory; + +public interface GraphInventoryObjectPlurals extends GraphInventoryObjectBase { + + public GraphInventoryObjectType getType(); + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectType.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectType.java new file mode 100644 index 0000000000..fcc21683c1 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectType.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory; + +public interface GraphInventoryObjectType extends GraphInventoryObjectBase { + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectUriPartial.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectUriPartial.java new file mode 100644 index 0000000000..d9d49cebd7 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectUriPartial.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory; + +public interface GraphInventoryObjectUriPartial { + + public String partialUri(); +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectUriTemplate.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectUriTemplate.java new file mode 100644 index 0000000000..7c100a710b --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryObjectUriTemplate.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory; + +public interface GraphInventoryObjectUriTemplate { + + public String uriTemplate(); +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryPatchConverter.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryPatchConverter.java new file mode 100644 index 0000000000..e626ec5492 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryPatchConverter.java @@ -0,0 +1,83 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory; + +import java.util.List; +import java.util.Map; +import java.util.regex.Pattern; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperPatchProvider; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException; +import org.onap.so.jsonpath.JsonPathUtil; +import com.fasterxml.jackson.core.JsonProcessingException; + +public class GraphInventoryPatchConverter { + + private static final AAICommonObjectMapperProvider standardProvider = new AAICommonObjectMapperProvider(); + private static final AAICommonObjectMapperPatchProvider patchProvider = new AAICommonObjectMapperPatchProvider(); + private static final Pattern LOCATE_COMPLEX_OBJECT = + Pattern.compile("^((?!relationship-list).)+?\\['[^\\[\\]]+?'\\]$"); + + + public String convertPatchFormat(Object obj) { + return validatePatchObject(marshallObjectToPatchFormat(obj)); + } + + public String validatePatchObject(String payload) { + if (hasComplexObject(payload)) { + throw new GraphInventoryPatchDepthExceededException(payload); + } + + return payload; + } + + /** + * validates client side that json does not include any complex objects relationship-list is omitted from this + * validation + */ + protected boolean hasComplexObject(String json) { + if (json.isEmpty()) { + return false; + } + String complex = "$.*.*"; + String array = "$.*.*.*"; + List result = JsonPathUtil.getInstance().getPathList(json, complex); + List result2 = JsonPathUtil.getInstance().getPathList(json, array); + + result.addAll(result2); + return result.stream().anyMatch(item -> LOCATE_COMPLEX_OBJECT.matcher(item).find()); + } + + protected String marshallObjectToPatchFormat(Object obj) { + Object value = obj; + try { + if (!(obj instanceof Map || obj instanceof String)) { + value = patchProvider.getMapper().writeValueAsString(obj); + } else if (obj instanceof Map) { + value = standardProvider.getMapper().writeValueAsString(obj); + } + } catch (JsonProcessingException e) { + value = "{}"; + } + + return (String) value; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java new file mode 100644 index 0000000000..8aa03e2920 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java @@ -0,0 +1,141 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.stream.Collectors; +import javax.ws.rs.core.GenericType; +import org.onap.aaiclient.client.aai.entities.Results; +import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryResultWrapper; +import org.onap.aaiclient.client.graphinventory.entities.Pathed; +import org.onap.aaiclient.client.graphinventory.entities.ResourceAndUrl; +import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryUri; +import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +public abstract class GraphInventoryQueryClient, Type extends GraphInventoryObjectType> { + + private Optional depth = Optional.empty(); + private boolean nodesOnly = false; + private Optional subgraph = Optional.empty(); + private GraphInventoryClient client; + private GraphInventoryCommonObjectMapperProvider mapperProvider = new GraphInventoryCommonObjectMapperProvider(); + + public GraphInventoryQueryClient(GraphInventoryClient client) { + this.client = client; + } + + protected abstract GraphInventoryUri getQueryUri(); + + public String query(Format format, I query) { + return client.createClient(setupQueryParams(getQueryUri().queryParam("format", format.toString()))).put(query, + String.class); + } + + protected List querySingleType(Format format, I query, Class clazz) { + return client.createClient(setupQueryParams(getQueryUri().queryParam("format", format.toString()))) + .put(query, new GenericType>() {}).getResult().stream().map(item -> { + try { + return mapperProvider.getMapper().readValue(mapperProvider.getMapper().writeValueAsString(item), + clazz); + } catch (IOException e) { + throw new IllegalArgumentException("could not map values from json", e); + } + }).collect(Collectors.toList()); + } + + public List queryPathed(I query) { + return querySingleType(Format.PATHED, query, Pathed.class); + } + + public List queryId(I query) { + return querySingleType(Format.ID, query, Id.class); + } + + public List querySingleResource(I query, Class clazz) { + try { + return getResourceAndUrl(query).stream().map(item -> item.getWrapper().asBean(clazz).get()) + .collect(Collectors.toList()); + } catch (IOException e) { + throw new IllegalArgumentException("could not map values from json", e); + } + } + + public List> getResourceAndUrl(I query) throws IOException { + List> result = new ArrayList<>(); + ObjectMapper mapper = mapperProvider.getMapper(); + Results> resultsFromJson = mapper.readValue(query(Format.RESOURCE_AND_URL, query), + new TypeReference>>() {}); + for (Map m : resultsFromJson.getResult()) { + for (Entry entrySet : m.entrySet()) { + if (!entrySet.getKey().equals("url")) { + String url = (String) m.get("url"); + String stringJson = mapper.writeValueAsString(entrySet.getValue()); + result.add( + new ResourceAndUrl(url, createType(entrySet.getKey()), createWrapper(stringJson))); + } + } + } + + return result; + } + + public abstract Wrapper createWrapper(String json); + + public abstract Type createType(String name); + + public S depth(String depth) { + this.depth = Optional.of(depth); + return (S) this; + } + + public S nodesOnly() { + this.nodesOnly = true; + return (S) this; + } + + public S subgraph(GraphInventorySubgraphType type) { + + subgraph = Optional.of(type); + + return (S) this; + } + + protected GraphInventoryUri setupQueryParams(GraphInventoryUri uri) { + GraphInventoryUri clone = uri.clone(); + if (this.depth.isPresent()) { + clone.queryParam("depth", depth.get()); + } + if (this.nodesOnly) { + clone.queryParam("nodesOnly", ""); + } + if (this.subgraph.isPresent()) { + clone.queryParam("subgraph", this.subgraph.get().toString()); + } + return clone; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryResourcesClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryResourcesClient.java new file mode 100644 index 0000000000..c564c5d5cb --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryResourcesClient.java @@ -0,0 +1,418 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.aaiclient.client.graphinventory; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.ws.rs.NotFoundException; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import org.onap.aai.domain.yang.Relationship; +import org.onap.so.client.RestClient; +import org.onap.so.client.RestProperties; +import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryEdgeLabel; +import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryResultWrapper; +import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri; +import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryResourceUri; +import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventorySingleResourceUri; +import org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri; +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryMultipleItemsException; + +public abstract class GraphInventoryResourcesClient, SingleUri extends GraphInventorySingleResourceUri, PluralUri extends GraphInventoryPluralResourceUri, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> { + + protected GraphInventoryClient client; + + protected GraphInventoryResourcesClient(GraphInventoryClient client) { + this.client = client; + } + + /** + * creates a new object in GraphInventory + * + * @param obj - can be any object which will marshal into a valid GraphInventory payload + * @param uri + * @return + */ + public void create(SingleUri uri, Object obj) { + RestClient giRC = client.createClient(uri); + giRC.put(obj); + } + + /** + * creates a new object in GraphInventory with no payload body + * + * @param uri + * @return + */ + public void createEmpty(SingleUri uri) { + RestClient giRC = client.createClient(uri); + giRC.put(""); + } + + /** + * returns false if the object does not exist in GraphInventory + * + * @param uri + * @return + */ + public boolean exists(Uri uri) { + GraphInventoryResourceUri forceMinimal = (Uri) uri.clone(); + forceMinimal.format(Format.COUNT); + forceMinimal.limit(1); + try { + RestClient giRC = client.createClient(forceMinimal); + + return giRC.get().getStatus() == Status.OK.getStatusCode(); + } catch (NotFoundException e) { + return false; + } + } + + /** + * Adds a relationship between two objects in GraphInventory + * + * @param uriA + * @param uriB + * @return + */ + public void connect(SingleUri uriA, SingleUri uriB) { + GraphInventorySingleResourceUri uriAClone = (SingleUri) uriA.clone(); + RestClient giRC = client.createClient(uriAClone.relationshipAPI()); + giRC.put(this.buildRelationship(uriB)); + } + + /** + * Adds a relationship between two objects in GraphInventory with a given edge label + * + * @param uriA + * @param uriB + * @param edge label + * @return + */ + public void connect(SingleUri uriA, SingleUri uriB, EdgeLabel label) { + GraphInventorySingleResourceUri uriAClone = (SingleUri) uriA.clone(); + RestClient giRC = client.createClient(uriAClone.relationshipAPI()); + giRC.put(this.buildRelationship(uriB, label)); + } + + /** + * Removes relationship from two objects in GraphInventory + * + * @param uriA + * @param uriB + * @return + */ + public void disconnect(SingleUri uriA, SingleUri uriB) { + GraphInventorySingleResourceUri uriAClone = (SingleUri) uriA.clone(); + RestClient giRC = client.createClient(uriAClone.relationshipAPI()); + giRC.delete(this.buildRelationship(uriB)); + } + + /** + * Deletes object from GraphInventory. Automatically handles resource-version. + * + * @param uri + * @return + */ + public void delete(SingleUri uri) { + GraphInventorySingleResourceUri clone = (SingleUri) uri.clone(); + RestClient giRC = client.createClient(clone); + Map result = giRC.get(new GenericType>() {}).orElseThrow( + () -> new NotFoundException(clone.build() + " does not exist in " + client.getGraphDBName())); + String resourceVersion = (String) result.get("resource-version"); + giRC = client.createClient(clone.resourceVersion(resourceVersion)); + giRC.delete(); + } + + /** + * @param obj - can be any object which will marshal into a valid GraphInventory payload + * @param uri + * @return + */ + public void update(SingleUri uri, Object obj) { + RestClient giRC = client.createClient(uri); + giRC.patch(obj); + } + + /** + * Retrieves an object from GraphInventory and unmarshalls it into the Class specified + * + * @param clazz + * @param uri + * @return + */ + public Optional get(Class clazz, Uri uri) { + try { + return client.createClient(uri).get(clazz); + } catch (NotFoundException e) { + if (this.getRestProperties().mapNotFoundToEmpty()) { + return Optional.empty(); + } else { + throw e; + } + } + } + + /** + * Retrieves an object from GraphInventory and returns complete response + * + * @param uri + * @return + */ + public Response getFullResponse(Uri uri) { + try { + return client.createClient(uri).get(); + } catch (NotFoundException e) { + if (this.getRestProperties().mapNotFoundToEmpty()) { + return e.getResponse(); + } else { + throw e; + } + } + } + + /** + * Retrieves an object from GraphInventory and automatically unmarshalls it into a Map or List + * + * @param resultClass + * @param uri + * @return + */ + public Optional get(GenericType resultClass, Uri uri) { + try { + return client.createClient(uri).get(resultClass); + } catch (NotFoundException e) { + if (this.getRestProperties().mapNotFoundToEmpty()) { + return Optional.empty(); + } else { + throw e; + } + } + } + + public Optional getOne(Class pluralClass, Class resultClass, PluralUri uri) { + Optional> result = unwrapPlural(pluralClass, resultClass, uri); + + if (result.isPresent()) { + if (result.get().size() == 1) { + return Optional.of(result.get().get(0)); + } else { + throw new GraphInventoryMultipleItemsException(result.get().size(), uri); + } + } + + return Optional.empty(); + } + + public Optional getFirst(Class pluralClass, Class resultClass, PluralUri uri) { + Optional> result = unwrapPlural(pluralClass, resultClass, uri); + + if (result.isPresent() && !result.get().isEmpty()) { + return Optional.of(result.get().get(0)); + } + + return Optional.empty(); + } + + public Optional getFirstWrapper(Class pluralClass, Class resultClass, PluralUri uri) { + + Optional result = getFirst(pluralClass, resultClass, uri); + if (result.isPresent()) { + return Optional.of(this.createWrapper(result.get())); + } else { + return Optional.empty(); + } + } + + public Optional getOneWrapper(Class pluralClass, Class resultClass, PluralUri uri) { + + Optional result = getOne(pluralClass, resultClass, uri); + if (result.isPresent()) { + return Optional.of(this.createWrapper(result.get())); + } else { + return Optional.empty(); + } + } + + protected Optional> unwrapPlural(Class pluralClass, Class resultClass, PluralUri uri) { + try { + PluralUri clone = (PluralUri) uri.clone().limit(1); + Optional obj = client.createClient(clone).get(pluralClass); + if (obj.isPresent()) { + Optional listMethod = Arrays.stream(obj.get().getClass().getMethods()).filter(method -> { + + Type returnType = method.getGenericReturnType(); + if (returnType instanceof ParameterizedType) { + Type[] types = ((ParameterizedType) returnType).getActualTypeArguments(); + if (types != null && types[0] instanceof Class) { + Class listClass = (Class) types[0]; + return resultClass.equals(listClass); + } + } + + return false; + }).findFirst(); + if (listMethod.isPresent()) { + try { + return Optional.of((List) listMethod.get().invoke(obj.get())); + + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + } + return Optional.empty(); + + } catch (NotFoundException e) { + if (this.getRestProperties().mapNotFoundToEmpty()) { + return Optional.empty(); + } else { + throw e; + } + } + } + + /** + * Retrieves an object from GraphInventory wrapped in a helper class which offer additional features + * + * @param uri + * @return + */ + public Wrapper get(Uri uri) { + String json; + try { + json = client.createClient(uri).get(String.class).orElse(null); + } catch (NotFoundException e) { + if (this.getRestProperties().mapNotFoundToEmpty()) { + json = null; + } else { + throw e; + } + } + return this.createWrapper(json); + } + + /** + * Retrieves an object from GraphInventory wrapped in a helper class which offer additional features If the object + * cannot be found in GraphInventory the method will throw the runtime exception included as an argument + * + * @param uri + * @return + */ + public Wrapper get(Uri uri, Class c) { + String json; + try { + json = client.createClient(uri).get(String.class).orElseThrow(() -> createException(c, + uri.build() + " not found in " + client.getGraphDBName(), Optional.empty())); + } catch (NotFoundException e) { + throw createException(c, "could not construct uri for use with " + client.getGraphDBName(), Optional.of(e)); + } + + return this.createWrapper(json); + } + + private RuntimeException createException(Class c, String message, + Optional t) { + RuntimeException e; + try { + if (t.isPresent()) { + e = c.getConstructor(String.class, Throwable.class).newInstance(message, t.get()); + } else { + e = c.getConstructor(String.class).newInstance(message); + } + } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException + | NoSuchMethodException | SecurityException e1) { + throw new IllegalArgumentException("could not create instance for " + c.getName()); + } + + return e; + } + + /** + * Will automatically create the object if it does not exist + * + * @param obj - Optional object which serializes to a valid GraphInventory payload + * @param uri + * @return + */ + public Self createIfNotExists(SingleUri uri, Optional obj) { + if (!this.exists((Uri) uri)) { + if (obj.isPresent()) { + this.create(uri, obj.get()); + } else { + this.createEmpty(uri); + } + + } + return (Self) this; + } + + protected Relationship buildRelationship(SingleUri uri) { + return buildRelationship(uri, Optional.empty()); + } + + protected Relationship buildRelationship(SingleUri uri, GraphInventoryEdgeLabel label) { + return buildRelationship(uri, Optional.of(label)); + } + + protected Relationship buildRelationship(SingleUri uri, Optional label) { + final Relationship result = new Relationship(); + if (uri instanceof HttpAwareUri) { + result.setRelatedLink(((HttpAwareUri) uri).locateAndBuild().toString()); + } else { + result.setRelatedLink(uri.build().toString()); + } + if (label.isPresent()) { + result.setRelationshipLabel(label.get().toString()); + } + return result; + } + + public abstract Wrapper createWrapper(String json); + + public abstract Wrapper createWrapper(Object json); + + /** + * Starts a transaction which encloses multiple GraphInventory mutations + * + * @return + */ + public abstract TransactionalClient beginTransaction(); + + /** + * Starts a transaction groups multiple GraphInventory mutations + * + * @return + */ + public abstract SingleTransactionClient beginSingleTransaction(); + + public T getRestProperties() { + return client.getRestProperties(); + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryRestClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryRestClient.java new file mode 100644 index 0000000000..c2422085aa --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryRestClient.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory; + +import java.net.URI; +import java.util.Map; +import java.util.Optional; +import javax.ws.rs.core.Response; +import org.onap.logging.filter.base.ONAPComponentsList; +import org.onap.so.client.ResponseExceptionMapper; +import org.onap.so.client.RestClientSSL; +import org.onap.so.client.RestProperties; +import org.onap.so.client.policy.CommonObjectMapperProvider; + +public abstract class GraphInventoryRestClient extends RestClientSSL { + + protected static final GraphInventoryCommonObjectMapperProvider standardProvider = + new GraphInventoryCommonObjectMapperProvider(); + + protected final GraphInventoryPatchConverter patchConverter = new GraphInventoryPatchConverter(); + + protected GraphInventoryRestClient(RestProperties props, URI uri) { + super(props, Optional.of(uri)); + } + + @Override + public abstract ONAPComponentsList getTargetEntity(); + + @Override + protected abstract void initializeHeaderMap(Map headerMap); + + @Override + protected abstract Optional addResponseExceptionMapper(); + + @Override + protected CommonObjectMapperProvider getCommonObjectMapperProvider() { + return standardProvider; + } + + @Override + public Response patch(Object obj) { + return super.patch(convertToPatchFormat(obj)); + } + + @Override + public T patch(Object obj, Class resultClass) { + return super.patch(convertToPatchFormat(obj), resultClass); + } + + protected GraphInventoryPatchConverter getPatchConverter() { + return this.patchConverter; + } + + protected String convertToPatchFormat(Object obj) { + return getPatchConverter().convertPatchFormat(obj); + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventorySubgraphType.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventorySubgraphType.java new file mode 100644 index 0000000000..8566b63ef9 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventorySubgraphType.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory; + + +public enum GraphInventorySubgraphType { + STAR("star"), PRUNE("prune"); + + private final String name; + + private GraphInventorySubgraphType(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryTransactionClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryTransactionClient.java new file mode 100644 index 0000000000..7f7822b900 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryTransactionClient.java @@ -0,0 +1,256 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.ws.rs.NotFoundException; +import javax.ws.rs.core.GenericType; +import org.onap.aai.domain.yang.Relationship; +import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryEdgeLabel; +import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryResourceUri; +import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventorySingleResourceUri; +import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public abstract class GraphInventoryTransactionClient, SingleUri extends GraphInventorySingleResourceUri, EdgeLabel extends GraphInventoryEdgeLabel> { + + protected static Logger logger = LoggerFactory.getLogger(GraphInventoryTransactionClient.class); + + protected int actionCount = 0; + + protected final GraphInventoryPatchConverter patchConverter = new GraphInventoryPatchConverter(); + + protected GraphInventoryTransactionClient() {} + + /** + * creates a new object in A&AI + * + * @param obj - can be any object which will marshal into a valid A&AI payload + * @param uri + * @return + */ + public Self create(SingleUri uri, Object obj) { + this.put(uri.build().toString(), obj); + incrementActionAmount(); + return (Self) this; + } + + /** + * creates a new object in A&AI with no payload body + * + * @param uri + * @return + */ + public Self createEmpty(SingleUri uri) { + this.put(uri.build().toString(), new HashMap()); + incrementActionAmount(); + return (Self) this; + } + + /** + * Will automatically create the object if it does not exist + * + * @param obj - Optional object which serializes to a valid GraphInventory payload + * @param uri + * @return + */ + public Self createIfNotExists(SingleUri uri, Optional obj) { + if (!this.exists((Uri) uri)) { + if (obj.isPresent()) { + this.create(uri, obj.get()); + } else { + this.createEmpty(uri); + } + + } + return (Self) this; + } + + /** + * Adds a relationship between two objects in A&AI + * + * @param uriA + * @param uriB + * @return + */ + public Self connect(SingleUri uriA, SingleUri uriB) { + GraphInventorySingleResourceUri uriAClone = uriA.clone(); + this.put(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB)); + incrementActionAmount(); + return (Self) this; + } + + /** + * relationship between multiple objects in A&AI - connects A to all objects specified in list + * + * @param uriA + * @param uris + * @return + */ + public Self connect(SingleUri uriA, List uris) { + for (SingleUri uri : uris) { + this.connect(uriA, uri); + } + return (Self) this; + } + + /** + * relationship between multiple objects in A&AI - connects A to all objects specified in list + * + * @param uriA + * @param uris + * @return + */ + public Self connect(SingleUri uriA, SingleUri uriB, EdgeLabel label) { + GraphInventorySingleResourceUri uriAClone = uriA.clone(); + this.put(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB, label)); + return (Self) this; + } + + /** + * relationship between multiple objects in A&AI - connects A to all objects specified in list + * + * @param uriA + * @param uris + * @return + */ + public Self connect(SingleUri uriA, List uris, EdgeLabel label) { + for (SingleUri uri : uris) { + this.connect(uriA, uri, label); + } + return (Self) this; + } + + /** + * Removes relationship from two objects in A&AI + * + * @param uriA + * @param uriB + * @return + */ + public Self disconnect(SingleUri uriA, SingleUri uriB) { + GraphInventorySingleResourceUri uriAClone = uriA.clone(); + this.delete(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB)); + incrementActionAmount(); + return (Self) this; + } + + /** + * Removes relationship from multiple objects - disconnects A from all objects specified in list + * + * @param uriA + * @param uris + * @return + */ + public Self disconnect(SingleUri uriA, List uris) { + for (SingleUri uri : uris) { + this.disconnect(uriA, uri); + } + return (Self) this; + } + + /** + * Deletes object from A&AI. Automatically handles resource-version. + * + * @param uri + * @return + */ + public Self delete(SingleUri uri) { + Map result = this.get(new GenericType>() {}, (Uri) uri) + .orElseThrow(() -> new NotFoundException(uri.build() + " does not exist in " + this.getGraphDBName())); + String resourceVersion = (String) result.get("resource-version"); + this.delete(uri.resourceVersion(resourceVersion).build().toString()); + incrementActionAmount(); + return (Self) this; + } + + protected abstract Optional get(GenericType genericType, Uri clone); + + protected abstract boolean exists(Uri uri); + + protected abstract String getGraphDBName(); + + protected abstract void put(String uri, Object body); + + protected abstract void delete(String uri); + + protected abstract void delete(String uri, Object obj); + + protected abstract void patch(String uri, Object body); + + /** + * @param obj - can be any object which will marshal into a valid A&AI payload + * @param uri + * @return + */ + public Self update(Uri uri, Object obj) { + + final String payload = getPatchConverter().convertPatchFormat(obj); + this.patch(uri.build().toString(), payload); + incrementActionAmount(); + return (Self) this; + } + + private void incrementActionAmount() { + actionCount++; + } + + /** + * Executes all created transactions in A&AI + * + * @throws BulkProcessFailed + */ + public abstract void execute() throws BulkProcessFailed; + + + /** + * Executes all created transactions in A&AI, with optional dry run flag + * + * @throws BulkProcessFailed + */ + public abstract void execute(boolean dryrun) throws BulkProcessFailed; + + private Relationship buildRelationship(SingleUri uri) { + return buildRelationship(uri, Optional.empty()); + } + + private Relationship buildRelationship(SingleUri uri, EdgeLabel label) { + return buildRelationship(uri, Optional.of(label)); + } + + private Relationship buildRelationship(SingleUri uri, Optional label) { + final Relationship result = new Relationship(); + result.setRelatedLink(uri.build().toString()); + if (label.isPresent()) { + result.setRelationshipLabel(label.toString()); + } + return result; + } + + protected GraphInventoryPatchConverter getPatchConverter() { + return this.patchConverter; + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryVersion.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryVersion.java new file mode 100644 index 0000000000..d7fba87397 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryVersion.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory; + +public interface GraphInventoryVersion { + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/TransactionBuilder.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/TransactionBuilder.java new file mode 100644 index 0000000000..6a0837890e --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/TransactionBuilder.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.aaiclient.client.graphinventory; + +public interface TransactionBuilder { + + + void put(String uri, Object body); + + void delete(String uri, Object body); + + void patch(String uri, Object body); + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeBase.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeBase.java new file mode 100644 index 0000000000..c071e24391 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeBase.java @@ -0,0 +1,88 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.aaiclient.client.graphinventory.entities; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.onap.aaiclient.client.aai.entities.QueryStep; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName; + +public abstract class DSLNodeBase> implements QueryStep { + + protected final String nodeName; + protected final List nodeKeys; + protected final StringBuilder query; + protected boolean output = false; + + public DSLNodeBase() { + this.nodeName = ""; + this.nodeKeys = new ArrayList<>(); + this.query = new StringBuilder(); + + } + + public DSLNodeBase(GraphInventoryObjectName name) { + this.nodeName = name.typeName(); + this.nodeKeys = new ArrayList<>(); + this.query = new StringBuilder(); + query.append(nodeName); + } + + public DSLNodeBase(GraphInventoryObjectName name, DSLNodeKey... key) { + this.nodeName = name.typeName(); + this.nodeKeys = Arrays.asList(key); + this.query = new StringBuilder(); + query.append(nodeName); + } + + public DSLNodeBase(DSLNodeBase copy) { + this.nodeName = copy.nodeName; + this.nodeKeys = copy.nodeKeys; + this.query = new StringBuilder(copy.query); + this.output = copy.output; + } + + public DSLOutputNode output() { + this.output = true; + + return new DSLOutputNode(this); + } + + public T and(DSLNodeKey... key) { + this.nodeKeys.addAll(Arrays.asList(key)); + + return (T) this; + } + + @Override + public String build() { + StringBuilder result = new StringBuilder(query); + if (output) { + result.append("*"); + } + for (DSLNodeKey key : nodeKeys) { + result.append(key.build()); + } + + return result.toString(); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeKey.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeKey.java new file mode 100644 index 0000000000..f7a9fddba0 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeKey.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.aaiclient.client.graphinventory.entities; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.onap.aaiclient.client.aai.entities.QueryStep; +import com.google.common.base.Joiner; + + +public class DSLNodeKey implements QueryStep { + + private boolean not = false; + private final StringBuilder query = new StringBuilder(); + private final String keyName; + private final List values; + + public DSLNodeKey(String keyName, Object... value) { + + this.keyName = keyName; + this.values = Arrays.asList(value); + } + + public DSLNodeKey not() { + + this.not = true; + return this; + } + + @Override + public String build() { + StringBuilder result = new StringBuilder(query); + + if (not) { + result.append(" !"); + } + result.append("('").append(keyName).append("', "); + List temp = new ArrayList<>(); + for (Object item : values) { + if ("null".equals(item)) { + temp.add(String.format("' %s '", item)); + } else if ("".equals(item)) { + temp.add("' '"); + } else { + if (item instanceof String) { + temp.add(String.format("'%s'", item)); + } else { + temp.add(item); + } + } + } + result.append(Joiner.on(", ").join(temp)).append(")"); + + return result.toString(); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLOutputNode.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLOutputNode.java new file mode 100644 index 0000000000..2e329b7841 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLOutputNode.java @@ -0,0 +1,8 @@ +package org.onap.aaiclient.client.graphinventory.entities; + +public class DSLOutputNode extends DSLNodeBase implements Output { + + public DSLOutputNode(DSLNodeBase copy) { + super(copy); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQuery.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQuery.java new file mode 100644 index 0000000000..6d421913e3 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQuery.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.aaiclient.client.graphinventory.entities; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class DSLQuery { + + private String dsl; + + public DSLQuery() { + + } + + public DSLQuery(DSLTraversal dsl) { + this.dsl = dsl.get(); + } + + public String getDsl() { + return dsl; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java new file mode 100644 index 0000000000..762203258a --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java @@ -0,0 +1,158 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.aaiclient.client.graphinventory.entities; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import org.onap.aaiclient.client.aai.entities.QueryStep; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName; +import com.google.common.base.Joiner; + +public class DSLQueryBuilder { + + private List steps = new ArrayList<>(); + private String suffix = ""; + + protected DSLQueryBuilder() { + + } + + protected DSLQueryBuilder(QueryStep node) { + steps.add(node); + } + + public DSLQueryBuilder> node(DSLNodeBase node) { + steps.add(node); + + return (DSLQueryBuilder>) this; + } + + public DSLQueryBuilder output() { + Object obj = steps.get(steps.size() - 1); + if (obj instanceof DSLNodeBase) { + ((DSLNodeBase) steps.get(steps.size() - 1)).output(); + } else if (obj.getClass().getName().contains("$$Lambda$")) { + // process lambda expressions + for (Field f : obj.getClass().getDeclaredFields()) { + f.setAccessible(true); + Object o; + try { + o = f.get(obj); + if (o instanceof DSLQueryBuilder && ((DSLQueryBuilder) o).steps.get(0) instanceof DSLNodeBase) { + ((DSLNodeBase) ((DSLQueryBuilder) o).steps.get(0)).output(); + } + } catch (IllegalArgumentException | IllegalAccessException e) { + } + f.setAccessible(false); + break; + } + } + return (DSLQueryBuilder) this; + } + + @SafeVarargs + public final DSLQueryBuilder union(final DSLQueryBuilder... union) { + + List> unions = Arrays.asList(union); + steps.add(() -> { + StringBuilder query = new StringBuilder(); + + query.append("> [ ") + .append(Joiner.on(", ") + .join(unions.stream().map(item -> item.compile()).collect(Collectors.toList()))) + .append(" ]"); + return query.toString(); + }); + + return (DSLQueryBuilder) this; + } + + public DSLQueryBuilder where(DSLQueryBuilder where) { + + steps.add(() -> { + StringBuilder query = new StringBuilder(); + query.append(where.compile()).append(")"); + String result = query.toString(); + if (!result.startsWith(">")) { + result = "> " + result; + } + return "(" + result; + }); + return this; + } + + public DSLQueryBuilder to(DSLQueryBuilder to) { + steps.add(() -> { + StringBuilder query = new StringBuilder(); + + query.append("> ").append(to.compile()); + return query.toString(); + }); + return (DSLQueryBuilder) this; + } + + public DSLQueryBuilder to(GraphInventoryObjectName name) { + return (DSLQueryBuilder) to(__.node(name)); + } + + public DSLQueryBuilder to(GraphInventoryObjectName name, DSLNodeKey... key) { + return (DSLQueryBuilder) to(__.node(name, key)); + } + + public DSLQueryBuilder limit(int limit) { + suffix = " LIMIT " + limit; + return this; + } + + public DSLTraversal build() { + return new DSLTraversal<>(compile()); + } + + @Override + public String toString() { + return build().get(); + } + + @Override + public boolean equals(Object o) { + if (o != null) { + return o.toString().equals(toString()); + } + return false; + } + + @Override + public int hashCode() { + + return compile().hashCode(); + } + + private String compile() { + return String.join(" ", steps.stream().map(item -> item.build()).collect(Collectors.toList())) + suffix; + } + + protected QueryStep getFirst() { + return steps.get(0); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLStartNode.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLStartNode.java new file mode 100644 index 0000000000..8abe918a9a --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLStartNode.java @@ -0,0 +1,19 @@ +package org.onap.aaiclient.client.graphinventory.entities; + +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName; + +public class DSLStartNode extends DSLNodeBase implements Start { + + + public DSLStartNode() { + super(); + } + + public DSLStartNode(GraphInventoryObjectName name) { + super(name); + } + + public DSLStartNode(GraphInventoryObjectName name, DSLNodeKey... key) { + super(name, key); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLTraversal.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLTraversal.java new file mode 100644 index 0000000000..3befbb7220 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLTraversal.java @@ -0,0 +1,33 @@ +package org.onap.aaiclient.client.graphinventory.entities; + +public class DSLTraversal { + + private final String traversal; + + protected DSLTraversal(String traversal) { + this.traversal = traversal; + } + + public String get() { + return traversal; + } + + @Override + public String toString() { + return traversal; + } + + @Override + public int hashCode() { + return traversal.hashCode(); + } + + @Override + public boolean equals(Object o) { + if (o != null) { + return this.toString().equals(o); + } + return false; + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryEdgeLabel.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryEdgeLabel.java new file mode 100644 index 0000000000..e0e4a5ded5 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryEdgeLabel.java @@ -0,0 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory.entities; + +public interface GraphInventoryEdgeLabel { + + + @Override + public String toString(); +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java new file mode 100644 index 0000000000..7d960877b0 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java @@ -0,0 +1,133 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory.entities; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Predicate; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType; +import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventorySingleResourceUri; +import org.onap.so.jsonpath.JsonPathUtil; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +public abstract class GraphInventoryRelationships, Uri extends GraphInventorySingleResourceUri, Type extends GraphInventoryObjectType> { + + protected final ObjectMapper mapper; + protected Map map; + protected final String jsonBody; + + public GraphInventoryRelationships(String json) { + this.jsonBody = json; + this.mapper = new GraphInventoryCommonObjectMapperProvider().getMapper(); + try { + this.map = mapper.readValue(json, new TypeReference>() {}); + } catch (IOException e) { + this.map = new HashMap<>(); + } + } + + public List getByType(GraphInventoryObjectName type) { + + return this.getAll(Optional.of(type)); + } + + public List getAll() { + + return this.getAll(Optional.empty()); + } + + + public List getRelatedLinks() { + return this.getRelatedLinks(Optional.empty()); + } + + public List getRelatedLinks(GraphInventoryObjectName type) { + return this.getRelatedLinks(Optional.of(type)); + } + + public List getRelatedUris() { + return this.getRelatedUris(x -> true); + } + + public List getRelatedUris(GraphInventoryObjectName type) { + return this.getRelatedUris(x -> type.typeName().equals(x)); + } + + protected List getRelatedUris(Predicate p) { + List result = new ArrayList<>(); + if (map.containsKey("relationship")) { + List> relationships = (List>) map.get("relationship"); + for (Map relationship : relationships) { + final String relatedTo = (String) relationship.get("related-to"); + if (p.test(relatedTo)) { + Type type; + type = fromTypeName(relatedTo); + final String relatedLink = (String) relationship.get("related-link"); + + result.add(createUri(type, relatedLink)); + } + } + } + return result; + } + + + + protected List getAll(final Optional type) { + List relatedLinks; + if (type.isPresent()) { + relatedLinks = this.getRelatedUris(type.get()); + } else { + relatedLinks = this.getRelatedUris(); + } + ArrayList result = new ArrayList<>(); + for (Uri link : relatedLinks) { + result.add(this.get(link)); + } + return result; + } + + protected abstract Wrapper get(Uri uri); + + protected abstract Uri createUri(Type type, String relatedLink); + + protected abstract Type fromTypeName(String name); + + protected List getRelatedLinks(Optional type) { + String matcher = ""; + if (type.isPresent()) { + matcher = "[?(@.related-to=='" + type.get().typeName() + "')]"; + } + return JsonPathUtil.getInstance().locateResultList(this.jsonBody, + String.format("$.relationship%s.related-link", matcher)); + } + + public String getJson() { + return this.jsonBody; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryResultWrapper.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryResultWrapper.java new file mode 100644 index 0000000000..9e6572388b --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryResultWrapper.java @@ -0,0 +1,125 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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.aaiclient.client.graphinventory.entities; + +import java.io.IOException; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.so.jsonpath.JsonPathUtil; +import org.slf4j.Logger; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +public abstract class GraphInventoryResultWrapper> + implements Serializable { + + private static final long serialVersionUID = 5895841925807816727L; + protected final String jsonBody; + protected final ObjectMapper mapper; + private final transient Logger logger; + + protected GraphInventoryResultWrapper(String json, Logger logger) { + this.jsonBody = json; + this.mapper = new GraphInventoryCommonObjectMapperProvider().getMapper(); + this.logger = logger; + } + + protected GraphInventoryResultWrapper(Object aaiObject, Logger logger) { + this.mapper = new GraphInventoryCommonObjectMapperProvider().getMapper(); + this.jsonBody = mapObjectToString(aaiObject); + this.logger = logger; + } + + protected String mapObjectToString(Object aaiObject) { + try { + return mapper.writeValueAsString(aaiObject); + } catch (JsonProcessingException e) { + logger.warn("could not parse object into json - defaulting to empty object"); + return "{}"; + } + } + + public Optional getRelationships() { + final String path = "$.relationship-list"; + if (isEmpty()) { + return Optional.empty(); + } + Optional result = JsonPathUtil.getInstance().locateResult(jsonBody, path); + if (result.isPresent()) { + return Optional.of(createRelationships(result.get())); + } else { + return Optional.empty(); + } + } + + protected abstract R createRelationships(String json); + + public String getJson() { + if (jsonBody == null) { + return "{}"; + } else { + return jsonBody; + } + } + + public Map asMap() { + + return asBean(new TypeReference>() {}).orElse(new HashMap<>()); + } + + public Optional asBean(Class clazz) { + if (isEmpty()) { + return Optional.empty(); + } + try { + return Optional.of(mapper.readValue(this.jsonBody, clazz)); + } catch (IOException e) { + return Optional.empty(); + } + } + + public Optional asBean(TypeReference reference) { + if (isEmpty()) { + return Optional.empty(); + } + try { + return Optional.of(mapper.readValue(this.jsonBody, reference)); + } catch (IOException e) { + return Optional.empty(); + } + } + + public boolean isEmpty() { + return jsonBody == null; + } + + @Override + public String toString() { + return this.getJson(); + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Id.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Id.java new file mode 100644 index 0000000000..6eaaadd7fa --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Id.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.aaiclient.client.graphinventory.entities; + +public class Id extends Resource { + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Node.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Node.java new file mode 100644 index 0000000000..c893f66df0 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Node.java @@ -0,0 +1,5 @@ +package org.onap.aaiclient.client.graphinventory.entities; + +public interface Node extends Output { + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Output.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Output.java new file mode 100644 index 0000000000..c8b98aa693 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Output.java @@ -0,0 +1,7 @@ +package org.onap.aaiclient.client.graphinventory.entities; + +import org.onap.aaiclient.client.aai.entities.QueryStep; + +public interface Output extends QueryStep { + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Pathed.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Pathed.java new file mode 100644 index 0000000000..874dbc183b --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Pathed.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.aaiclient.client.graphinventory.entities; + +public class Pathed extends Resource { + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Resource.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Resource.java new file mode 100644 index 0000000000..b1e6104702 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Resource.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.aaiclient.client.graphinventory.entities; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"resource-type", "resource-link"}) +public class Resource { + + @JsonProperty("resource-type") + private String resourceType; + @JsonProperty("resource-link") + private String resourceLink; + + @JsonProperty("resource-type") + public String getResourceType() { + return resourceType; + } + + @JsonProperty("resource-type") + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + @JsonProperty("resource-link") + public String getResourceLink() { + return resourceLink; + } + + @JsonProperty("resource-link") + public void setResourceLink(String resourceLink) { + this.resourceLink = resourceLink; + } + +} + diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/ResourceAndUrl.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/ResourceAndUrl.java new file mode 100644 index 0000000000..fa41ce4c0e --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/ResourceAndUrl.java @@ -0,0 +1,61 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.aaiclient.client.graphinventory.entities; + +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType; + +public class ResourceAndUrl { + + private String url; + private GraphInventoryObjectType type; + private Wrapper wrapper; + + public ResourceAndUrl(String url, GraphInventoryObjectType type, Wrapper wrapper) { + this.url = url; + this.type = type; + this.wrapper = wrapper; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public Wrapper getWrapper() { + return wrapper; + } + + public void setWrapper(Wrapper wrapper) { + this.wrapper = wrapper; + } + + public GraphInventoryObjectType getType() { + return type; + } + + public void setType(GraphInventoryObjectType type) { + this.type = type; + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Start.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Start.java new file mode 100644 index 0000000000..8282beef23 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/Start.java @@ -0,0 +1,7 @@ +package org.onap.aaiclient.client.graphinventory.entities; + +import org.onap.aaiclient.client.aai.entities.QueryStep; + +public interface Start extends QueryStep { + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/TraversalBuilder.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/TraversalBuilder.java new file mode 100644 index 0000000000..14e9715074 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/TraversalBuilder.java @@ -0,0 +1,17 @@ +package org.onap.aaiclient.client.graphinventory.entities; + +public class TraversalBuilder { + + + private TraversalBuilder() { + + } + + public static DSLQueryBuilder fragment(Start node) { + return new DSLQueryBuilder<>(node); + } + + public static DSLQueryBuilder traversal(Output node) { + return new DSLQueryBuilder<>(node); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/__.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/__.java new file mode 100644 index 0000000000..6f7bcdc2c9 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/__.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.aaiclient.client.graphinventory.entities; + +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName; + +public class __ { + + protected __() { + + } + + public static DSLQueryBuilder identity() { + return new DSLQueryBuilder<>(); + } + + public static DSLQueryBuilder start(Start node) { + return new DSLQueryBuilder<>(node); + } + + public static DSLQueryBuilder node(GraphInventoryObjectName name) { + + return __.start(new DSLStartNode(name)); + } + + public static DSLQueryBuilder node(GraphInventoryObjectName name, DSLNodeKey... key) { + return __.start(new DSLStartNode(name, key)); + } + + public static DSLNodeKey key(String keyName, Object... value) { + return new DSLNodeKey(keyName, value); + } + + @SafeVarargs + public static final DSLQueryBuilder union(final DSLQueryBuilder... traversal) { + + return __.identity().union(traversal); + } + + public static DSLQueryBuilder where(DSLQueryBuilder traversal) { + + return __.identity().where(traversal); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/Depth.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/Depth.java new file mode 100644 index 0000000000..9f2ef42b50 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/Depth.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory.entities.uri; + +public enum Depth { + ZERO("0"), ONE("1"), TWO("2"), THREE("3"), FOUR("4"), FIVE("5"), SIX("6"), ALL("all"); + + private final String depth; + + private Depth(String s) { + + this.depth = s; + } + + + @Override + public String toString() { + return this.depth; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java new file mode 100644 index 0000000000..8326c7b9df --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java @@ -0,0 +1,8 @@ +package org.onap.aaiclient.client.graphinventory.entities.uri; + +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectBase; + +public interface GraphInventoryPluralResourceUri, OT extends GraphInventoryObjectBase> + extends GraphInventoryResourceUri { + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventoryResourceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventoryResourceUri.java new file mode 100644 index 0000000000..d70b2d74f1 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventoryResourceUri.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory.entities.uri; + +import org.onap.aaiclient.client.graphinventory.Format; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectBase; + +public interface GraphInventoryResourceUri, OT extends GraphInventoryObjectBase> + extends GraphInventoryUri { + + public T format(Format format); + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java new file mode 100644 index 0000000000..ac0e4a0c94 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java @@ -0,0 +1,16 @@ +package org.onap.aaiclient.client.graphinventory.entities.uri; + +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectPlurals; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType; + +public interface GraphInventorySingleResourceUri, P extends GraphInventoryPluralResourceUri, SingleObject extends GraphInventoryObjectType, PluralObject extends GraphInventoryObjectPlurals> + extends GraphInventoryResourceUri { + + public T resourceVersion(String version); + + public T relationshipAPI(); + + public P relatedTo(PluralObject plural); + + public T relatedTo(SingleObject type, String... values); +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventoryUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventoryUri.java new file mode 100644 index 0000000000..414bf3b071 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventoryUri.java @@ -0,0 +1,81 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory.entities.uri; + +import java.io.Serializable; +import java.net.URI; +import java.util.Map; +import java.util.regex.Pattern; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectBase; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType; + +public interface GraphInventoryUri, OT extends GraphInventoryObjectBase> + extends Serializable { + + public URI build(); + + /** + * By default GraphInventory enforces a depth of 1. Some objects can be told to retrieve objects nested beneath them + * by increasing this number. + * + * You can use 0 to restrict the returned information to only the object you requested You can use all to retrieve + * all nested objects (this should only be used if you really need a massive amount of information and are caching + * the retrieval) + * + * @param depth + * @return + */ + public T depth(Depth depth); + + /** + * Makes client only return object fields, no relationships + * + * @return + */ + public T nodesOnly(boolean nodesOnly); + + public T queryParam(String name, String... values); + + public T replaceQueryParam(String name, String... values); + + public T resultIndex(int index); + + public T resultSize(int size); + + public T limit(int size); + + public T clone(); + + /** + * returns all key values of the URI as a map. Key names can be found in {@link GraphInventoryObjectType} + * + * @return + */ + public Map getURIKeys(); + + public OT getObjectType(); + + public boolean equals(Object o); + + public int hashCode(); + + public Pattern getPrefixPattern(); +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/HttpAwareUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/HttpAwareUri.java new file mode 100644 index 0000000000..ab46f24464 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/HttpAwareUri.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory.entities.uri; + +import java.net.URI; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; + +public interface HttpAwareUri extends AAIResourceUri { + + + public URI buildNoNetwork(); + + public URI locateAndBuild(); +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleBaseUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleBaseUri.java new file mode 100644 index 0000000000..b668f465e9 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleBaseUri.java @@ -0,0 +1,237 @@ +package org.onap.aaiclient.client.graphinventory.entities.uri; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import javax.ws.rs.core.UriBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import org.onap.aaiclient.client.graphinventory.Format; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectBase; +import org.onap.aaiclient.client.graphinventory.entities.uri.parsers.UriParser; +import org.onap.aaiclient.client.graphinventory.entities.uri.parsers.UriParserSpringImpl; +import org.onap.aaiclient.client.graphinventory.exceptions.IncorrectNumberOfUriKeys; +import org.springframework.web.util.UriUtils; + +public abstract class SimpleBaseUri, Parent extends GraphInventorySingleResourceUri, S extends GraphInventoryObjectBase> + implements GraphInventoryResourceUri { + + private static final long serialVersionUID = -1011069933894179423L; + protected transient UriBuilder internalURI; + protected static final String relationshipAPI = "/relationship-list/relationship"; + protected static final String relatedTo = "/related-to"; + protected Object[] values; + protected final S type; + protected final Parent parentUri; + protected final Map> queryParams = new HashMap<>(); + + protected SimpleBaseUri(S type, Object... values) { + this.type = type; + this.internalURI = UriBuilder.fromPath(this.getTemplate(type)); + this.values = values; + this.parentUri = null; + validateValuesSize(this.getTemplate(type), values); + } + + protected SimpleBaseUri(S type, URI uri) { + if (!type.passThrough()) { + this.type = type; + this.internalURI = UriBuilder.fromPath(this.getTemplate(type)); + this.values = + this.getURIKeys(uri.getRawPath().replaceAll(getPrefixPattern().toString(), "")).values().toArray(); + this.parentUri = null; + } else { + this.type = type; + this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll(getPrefixPattern().toString(), "")); + this.values = new Object[0]; + this.parentUri = null; + } + + } + + protected SimpleBaseUri(S type, UriBuilder builder, Object... values) { + this.internalURI = builder; + this.values = values; + this.type = type; + this.parentUri = null; + + } + + protected SimpleBaseUri(Parent parentUri, S childType, Object... childValues) { + this.type = childType; + this.internalURI = UriBuilder.fromUri(type.partialUri()); + this.values = childValues; + this.parentUri = parentUri; + + validateValuesSize(childType.partialUri(), values); + } + + protected SimpleBaseUri(SimpleBaseUri copy) { + this.type = copy.type; + this.internalURI = copy.internalURI.clone(); + this.values = copy.values.clone(); + if (copy.parentUri != null) { + this.parentUri = (Parent) copy.parentUri.clone(); + } else { + this.parentUri = null; + } + } + + protected void setInternalURI(UriBuilder builder) { + this.internalURI = builder; + } + + @Override + public T queryParam(String name, String... values) { + this.internalURI = internalURI.queryParam(name, values); + if (queryParams.containsKey(name)) { + queryParams.get(name).addAll(Arrays.asList(values)); + } else { + queryParams.put(name, Stream.of(values).collect(Collectors.toSet())); + } + return (T) this; + } + + @Override + public T replaceQueryParam(String name, String... values) { + this.internalURI = internalURI.replaceQueryParam(name, values); + queryParams.put(name, Stream.of(values).collect(Collectors.toSet())); + return (T) this; + } + + @Override + public T resultIndex(int index) { + this.internalURI = internalURI.replaceQueryParam("resultIndex", index); + return (T) this; + } + + @Override + public T resultSize(int size) { + this.internalURI = internalURI.replaceQueryParam("resultSize", size); + return (T) this; + } + + @Override + public T limit(int size) { + this.resultIndex(0).resultSize(size); + return (T) this; + } + + @Override + public URI build() { + return build(this.values); + } + + protected URI build(Object... values) { + + // This is a workaround because resteasy does not encode URIs correctly + final String[] encoded = new String[values.length]; + for (int i = 0; i < values.length; i++) { + encoded[i] = UriUtils.encode(values[i].toString(), StandardCharsets.UTF_8.toString()); + } + if (this.parentUri != null) { + return UriBuilder + .fromUri(this.parentUri.build().toString() + internalURI.buildFromEncoded(encoded).toString()) + .build(); + } else { + return internalURI.buildFromEncoded(encoded); + } + } + + @Override + public Map getURIKeys() { + return this.getURIKeys(this.build().toString()); + } + + protected Map getURIKeys(String uri) { + UriParser parser; + if (!("".equals(this.getTemplate(type)))) { + parser = new UriParserSpringImpl(this.getTemplate(type)); + } else { + return new HashMap<>(); + } + + + return parser.parse(uri); + } + + @Override + public abstract T clone(); + + @Override + public S getObjectType() { + return this.type; + } + + @Override + public boolean equals(Object o) { + if (o != null) { + return this.toString().equals(o.toString()); + } + return false; + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(this.toString()).toHashCode(); + } + + + @Override + public T depth(Depth depth) { + this.internalURI.replaceQueryParam("depth", depth.toString()); + return (T) this; + } + + @Override + public T nodesOnly(boolean nodesOnly) { + if (nodesOnly) { + this.internalURI.replaceQueryParam("nodes-only", ""); + } + return (T) this; + } + + @Override + public T format(Format format) { + this.internalURI.replaceQueryParam("format", format); + return (T) this; + } + + public void validateValuesSize(String template, Object... values) { + UriParser parser = new UriParserSpringImpl(template); + Set variables = parser.getVariables(); + if (variables.size() != values.length) { + throw new IncorrectNumberOfUriKeys(String.format("Expected %s variables: %s", variables.size(), variables)); + } + } + + protected String getTemplate(GraphInventoryObjectBase type) { + return type.uriTemplate(); + } + + private void writeObject(ObjectOutputStream oos) throws IOException { + oos.defaultWriteObject(); + oos.writeUTF(this.internalURI.toTemplate()); + } + + private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { + ois.defaultReadObject(); + String uri = ois.readUTF(); + this.setInternalURI(UriBuilder.fromUri(uri)); + } + + @Override + public String toString() { + return new ToStringBuilder(null, ToStringStyle.NO_CLASS_NAME_STYLE).append("type", type) + .append("parentUri", parentUri).append("values", values).append("queryParams", queryParams).toString(); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimplePluralUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimplePluralUri.java new file mode 100644 index 0000000000..d76661526c --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimplePluralUri.java @@ -0,0 +1,77 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory.entities.uri; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import javax.ws.rs.core.UriBuilder; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectPlurals; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType; + +public abstract class SimplePluralUri, Parent extends GraphInventorySingleResourceUri, PT extends GraphInventoryObjectPlurals, OT extends GraphInventoryObjectType> + extends SimpleBaseUri implements GraphInventoryPluralResourceUri, Serializable { + + private static final long serialVersionUID = -337701171277616439L; + + protected final PT pluralType; + + protected SimplePluralUri(PT type, UriBuilder builder, Object... values) { + super(type, builder, values); + this.pluralType = type; + } + + protected SimplePluralUri(PT type) { + super(type, new Object[0]); + this.pluralType = type; + } + + protected SimplePluralUri(PT type, Object... values) { + super(type, values); + this.pluralType = type; + } + + protected SimplePluralUri(Parent parentUri, PT childType) { + super(parentUri, childType, new Object[0]); + this.pluralType = childType; + } + + public SimplePluralUri(SimplePluralUri copy) { + super(copy); + this.pluralType = copy.pluralType; + } + + protected void setInternalURI(UriBuilder builder) { + this.internalURI = builder; + } + + private void writeObject(ObjectOutputStream oos) throws IOException { + oos.defaultWriteObject(); + oos.writeUTF(this.internalURI.toTemplate()); + } + + private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { + ois.defaultReadObject(); + String uri = ois.readUTF(); + this.setInternalURI(UriBuilder.fromUri(uri)); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleUri.java new file mode 100644 index 0000000000..e6a162bfda --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleUri.java @@ -0,0 +1,83 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory.entities.uri; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.net.URI; +import javax.ws.rs.core.UriBuilder; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectPlurals; +import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType; + +public abstract class SimpleUri, PT extends GraphInventoryPluralResourceUri, S extends GraphInventoryObjectType, P extends GraphInventoryObjectPlurals> + extends SimpleBaseUri implements GraphInventorySingleResourceUri { + + private static final long serialVersionUID = -337701171277616439L; + protected static final String relationshipAPI = "/relationship-list/relationship"; + protected static final String relatedTo = "/related-to"; + + protected SimpleUri(S type, Object... values) { + super(type, values); + } + + protected SimpleUri(S type, URI uri) { + super(type, uri); + + } + + protected SimpleUri(S type, UriBuilder builder, Object... values) { + super(type, builder, values); + + } + + protected SimpleUri(T parentUri, S childType, Object... childValues) { + super(parentUri, childType, childValues); + } + + protected SimpleUri(SimpleBaseUri copy) { + super(copy); + } + + @Override + public T resourceVersion(String version) { + this.internalURI = internalURI.replaceQueryParam("resource-version", version); + return (T) this; + } + + @Override + public T relationshipAPI() { + this.internalURI = internalURI.path(relationshipAPI); + return (T) this; + } + + private void writeObject(ObjectOutputStream oos) throws IOException { + oos.defaultWriteObject(); + oos.writeUTF(this.internalURI.toTemplate()); + } + + private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { + ois.defaultReadObject(); + String uri = ois.readUTF(); + this.setInternalURI(UriBuilder.fromUri(uri)); + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/parsers/UriParser.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/parsers/UriParser.java new file mode 100644 index 0000000000..24a20240e0 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/parsers/UriParser.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory.entities.uri.parsers; + +import java.util.Map; +import java.util.Set; + +public interface UriParser { + public Set getVariables(); + + public Map parse(final String uri); +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java new file mode 100644 index 0000000000..db13ef742a --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory.entities.uri.parsers; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import org.springframework.web.util.UriTemplate; +import org.springframework.web.util.UriUtils; + +public class UriParserSpringImpl implements UriParser { + + private final UriTemplate uriTemplate; + + public UriParserSpringImpl(final String template) { + this.uriTemplate = new UriTemplate(template); + } + + @Override + public Map parse(final String uri) { + final boolean match = this.uriTemplate.matches(uri); + if (!match) { + return new LinkedHashMap<>(); + } + return Collections.unmodifiableMap(decodeParams(this.uriTemplate.match(uri))); + } + + @Override + public Set getVariables() { + return Collections.unmodifiableSet(new LinkedHashSet(this.uriTemplate.getVariableNames())); + } + + protected Map decodeParams(Map map) { + final Map result = new LinkedHashMap<>(); + + for (Entry entry : map.entrySet()) { + result.put(entry.getKey(), UriUtils.decode(entry.getValue(), "UTF-8")); + } + + return result; + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/BulkProcessFailed.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/BulkProcessFailed.java new file mode 100644 index 0000000000..131d466608 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/BulkProcessFailed.java @@ -0,0 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory.exceptions; + +public class BulkProcessFailed extends Exception { + + public BulkProcessFailed(String message) { + super(message); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java new file mode 100644 index 0000000000..257f1331af --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java @@ -0,0 +1,13 @@ +package org.onap.aaiclient.client.graphinventory.exceptions; + +import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri; + +public class GraphInventoryMultipleItemsException extends RuntimeException { + + private static final long serialVersionUID = -1596266941681036917L; + + public GraphInventoryMultipleItemsException(int size, GraphInventoryPluralResourceUri uri) { + super(String.format("Found %s objects at %s when we only expected to find one.", size, uri.build())); + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java new file mode 100644 index 0000000000..615f4df8cb --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory.exceptions; + +public class GraphInventoryPatchDepthExceededException extends RuntimeException { + + private static final long serialVersionUID = -3740429832086738907L; + + + public GraphInventoryPatchDepthExceededException(String payload) { + super("Object exceeds allowed depth for update action: " + payload); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryPayloadException.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryPayloadException.java new file mode 100644 index 0000000000..2b42fb09e7 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryPayloadException.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory.exceptions; + +public class GraphInventoryPayloadException extends Exception { + + private static final long serialVersionUID = -5712783905947711065L; + + public GraphInventoryPayloadException(Throwable t) { + super(t); + } + + public GraphInventoryPayloadException(String s, Throwable t) { + super(s, t); + } + + public GraphInventoryPayloadException(String s) { + super(s); + } + + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryUriComputationException.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryUriComputationException.java new file mode 100644 index 0000000000..834c0d4c0e --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryUriComputationException.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory.exceptions; + +public class GraphInventoryUriComputationException extends RuntimeException { + + private static final long serialVersionUID = 5187931752227522034L; + + public GraphInventoryUriComputationException(String s) { + super(s); + } + + public GraphInventoryUriComputationException(Throwable t) { + super(t); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.java new file mode 100644 index 0000000000..f9965f3920 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory.exceptions; + +public class GraphInventoryUriNotFoundException extends Exception { + private static final long serialVersionUID = 2789643165122257833L; + + public GraphInventoryUriNotFoundException(String message) { + super(message); + } +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/IncorrectNumberOfUriKeys.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/IncorrectNumberOfUriKeys.java new file mode 100644 index 0000000000..d46ffae164 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/exceptions/IncorrectNumberOfUriKeys.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.aaiclient.client.graphinventory.exceptions; + +public class IncorrectNumberOfUriKeys extends RuntimeException { + + private static final long serialVersionUID = 2189285428827817518L; + + public IncorrectNumberOfUriKeys(String message) { + super(message); + } + +} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIClient.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIClient.java deleted file mode 100644 index d376d85a83..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIClient.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import java.net.URI; -import javax.ws.rs.NotFoundException; -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.RestClient; -import org.onap.so.client.graphinventory.GraphInventoryClient; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AAIClient extends GraphInventoryClient { - - private static final String AAI_ROOT = "/aai"; - protected static Logger logger = LoggerFactory.getLogger(AAIClient.class); - protected AAIVersion version; - - protected AAIClient() { - super(AAIProperties.class); - } - - protected AAIClient(AAIVersion version) { - super(AAIProperties.class); - this.version = version; - } - - @Override - protected URI constructPath(URI uri) { - - return UriBuilder.fromUri(AAI_ROOT + "/" + this.getVersion().toString() + uri.toString()).build(); - } - - @Override - protected RestClient createClient(URI uri) { - try { - - return new AAIRestClient(getRestProperties(), constructPath(uri)); - } catch (GraphInventoryUriComputationException | NotFoundException e) { - logger.debug("failed to construct A&AI uri", e); - throw e; - } - } - - @Override - public AAIVersion getVersion() { - if (version == null) { - return this.getRestProperties().getDefaultVersion(); - } else { - return this.version; - } - } - - - @Override - public String getGraphDBName() { - return "A&AI"; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java deleted file mode 100644 index 66ea8f950e..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import java.io.IOException; -import java.util.Optional; -import javax.annotation.Priority; -import javax.ws.rs.ext.Provider; -import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.onap.so.client.ResponseExceptionMapper; -import org.onap.so.client.aai.entities.AAIError; -import org.slf4j.MDC; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Provider -@Priority(Integer.MIN_VALUE) -public class AAIClientResponseExceptionMapper extends ResponseExceptionMapper { - - private final String requestId; - - public AAIClientResponseExceptionMapper() { - this.requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID); - } - - @Override - public Optional extractMessage(String entity) { - - String errorString = "Error calling A&AI. Request-Id=" + this.getRequestId() + " "; - try { - AAIError error = new ObjectMapper().readValue(entity, AAIError.class); - AAIErrorFormatter formatter = new AAIErrorFormatter(error); - return Optional.of(errorString + formatter.getMessage()); - } catch (IOException e) { - return Optional.of(errorString + entity); - } - } - - protected String getRequestId() { - return this.requestId; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java deleted file mode 100644 index bb2b2eca19..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperPatchProvider; - -public class AAICommonObjectMapperPatchProvider extends GraphInventoryCommonObjectMapperPatchProvider { - - - public AAICommonObjectMapperPatchProvider() { - super(); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java deleted file mode 100644 index b75f40eb39..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; - -public class AAICommonObjectMapperProvider extends GraphInventoryCommonObjectMapperProvider { - - public AAICommonObjectMapperProvider() { - super(); - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java deleted file mode 100644 index 1747d97633..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.GraphInventoryQueryClient; -import org.onap.so.client.graphinventory.entities.DSLQuery; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri; - -public class AAIDSLQueryClient - extends GraphInventoryQueryClient { - - public AAIDSLQueryClient() { - super(new AAIClient()); - } - - public AAIDSLQueryClient(AAIVersion version) { - super(new AAIClient(version)); - } - - @Override - protected GraphInventoryUri getQueryUri() { - return AAIUriFactory.createResourceUri(AAIObjectType.DSL); - } - - - @Override - public AAIResultWrapper createWrapper(String json) { - return new AAIResultWrapper(json); - } - - @Override - public AAIObjectType createType(String name) { - return AAIObjectType.fromTypeName(name); - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java deleted file mode 100644 index e255b297ed..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import java.util.List; -import org.onap.so.client.aai.entities.AAIError; -import org.onap.so.client.aai.entities.ServiceException; - -public class AAIErrorFormatter { - - private final AAIError error; - - public AAIErrorFormatter(AAIError error) { - this.error = error; - } - - public String getMessage() { - if (error.getRequestError() != null && error.getRequestError().getServiceException() != null) { - ServiceException serviceException = error.getRequestError().getServiceException(); - return this.fillInTemplate(serviceException.getText(), serviceException.getVariables()); - } - - return "no parsable error message found"; - } - - protected String fillInTemplate(String text, List variables) { - for (int i = 0; i < variables.size(); i++) { - variables.set(i, this.format(variables.get(i), variables)); - } - - return format(text, variables); - } - - protected String format(String s, List variables) { - s = s.replaceAll("%(\\d(?!\\d))", "%$1\\$s"); - s = s.replaceAll("%(\\d{2})", "%%$1"); - return String.format(s, variables.toArray()); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAINamespaceConstants.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAINamespaceConstants.java deleted file mode 100644 index 1225bb3fd5..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAINamespaceConstants.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -public class AAINamespaceConstants { - - public static final String CLOUD_INFRASTRUCTURE = "/cloud-infrastructure"; - public static final String NETWORK = "/network"; - public static final String BUSINESS = "/business"; - public static final String SERVICE_DESIGN_AND_CREATION = "/service-design-and-creation"; - public static final String EXTERNAL_SYSTEM = "/external-system"; - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIObjectBase.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIObjectBase.java deleted file mode 100644 index dab3cda32b..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIObjectBase.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.onap.so.client.aai; - -import org.onap.so.client.graphinventory.GraphInventoryObjectBase; - -public interface AAIObjectBase extends GraphInventoryObjectBase { - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java deleted file mode 100644 index d14a4bedc3..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java +++ /dev/null @@ -1,117 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import java.io.Serializable; -import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals; -import org.onap.so.constants.Defaults; -import com.google.common.base.CaseFormat; - -public class AAIObjectPlurals implements AAIObjectBase, GraphInventoryObjectPlurals, Serializable { - - private static final long serialVersionUID = 5312713297525740746L; - - public static final AAIObjectPlurals CUSTOMER = - new AAIObjectPlurals(AAIObjectType.CUSTOMER, AAINamespaceConstants.BUSINESS, "/customers"); - public static final AAIObjectPlurals GENERIC_VNF = - new AAIObjectPlurals(AAIObjectType.GENERIC_VNF, AAINamespaceConstants.NETWORK, "/generic-vnfs"); - public static final AAIObjectPlurals PORT_GROUP = - new AAIObjectPlurals(AAIObjectType.PORT_GROUP, AAIObjectType.VCE.uriTemplate(), "/port-groups"); - public static final AAIObjectPlurals PSERVER = - new AAIObjectPlurals(AAIObjectType.PSERVER, AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers"); - public static final AAIObjectPlurals P_INTERFACE = - new AAIObjectPlurals(AAIObjectType.P_INTERFACE, AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces"); - public static final AAIObjectPlurals L3_NETWORK = - new AAIObjectPlurals(AAIObjectType.L3_NETWORK, AAINamespaceConstants.NETWORK, "/l3-networks"); - public static final AAIObjectPlurals NETWORK_POLICY = - new AAIObjectPlurals(AAIObjectType.NETWORK_POLICY, AAINamespaceConstants.NETWORK, "/network-policies"); - public static final AAIObjectPlurals VPN_BINDING = - new AAIObjectPlurals(AAIObjectType.VPN_BINDING, AAINamespaceConstants.NETWORK, "/vpn-bindings"); - public static final AAIObjectPlurals SERVICE_SUBSCRIPTION = new AAIObjectPlurals(AAIObjectType.SERVICE_SUBSCRIPTION, - AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions"); - public static final AAIObjectPlurals SERVICE_INSTANCE = new AAIObjectPlurals(AAIObjectType.SERVICE_INSTANCE, - AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances"); - public static final AAIObjectPlurals OWNING_ENTITY = - new AAIObjectPlurals(AAIObjectType.OWNING_ENTITY, AAINamespaceConstants.BUSINESS, "/owning-entities"); - public static final AAIObjectPlurals VOLUME_GROUP = new AAIObjectPlurals(AAIObjectType.VOLUME_GROUP, - AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups"); - public static final AAIObjectPlurals AVAILIBILITY_ZONE = new AAIObjectPlurals(AAIObjectType.AVAILIBILITY_ZONE, - AAIObjectType.CLOUD_REGION.uriTemplate(), "/availability-zones"); - public static final AAIObjectPlurals VF_MODULE = - new AAIObjectPlurals(AAIObjectType.VF_MODULE, AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules"); - public static final AAIObjectPlurals CONFIGURATION = - new AAIObjectPlurals(AAIObjectType.CONFIGURATION, AAINamespaceConstants.NETWORK, "/configurations"); - public static final AAIObjectPlurals DEFAULT_TENANT = - new AAIObjectPlurals(AAIObjectType.DEFAULT_TENANT, AAINamespaceConstants.CLOUD_INFRASTRUCTURE - + "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants"); - public static final AAIObjectPlurals NETWORK_TECHNOLOGY = new AAIObjectPlurals(AAIObjectType.NETWORK_TECHNOLOGY, - AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/network-technologies"); - public static final AAIObjectPlurals LOGICAL_LINK = - new AAIObjectPlurals(AAIObjectType.LOGICAL_LINK, AAINamespaceConstants.NETWORK, "/logical-links"); - public static final AAIObjectPlurals L_INTERFACE = - new AAIObjectPlurals(AAIObjectType.L_INTERFACE, AAIObjectType.VSERVER.uriTemplate(), "/l-interfaces"); - public static final AAIObjectPlurals SUB_L_INTERFACE = - new AAIObjectPlurals(AAIObjectType.L_INTERFACE, AAIObjectType.L_INTERFACE.uriTemplate(), "/l-interfaces"); - public static final AAIObjectPlurals INSTANCE_GROUP = - new AAIObjectPlurals(AAIObjectType.INSTANCE_GROUP, AAINamespaceConstants.NETWORK, "/instance-groups"); - public static final AAIObjectPlurals PNF = - new AAIObjectPlurals(AAIObjectType.PNF, AAINamespaceConstants.NETWORK, "/pnfs"); - - private final String uriTemplate; - private final String partialUri; - private final AAIObjectType type; - - protected AAIObjectPlurals(AAIObjectType type, String parentUri, String partialUri) { - this.uriTemplate = parentUri + partialUri; - this.partialUri = partialUri; - this.type = type; - } - - @Override - public String toString() { - return this.uriTemplate(); - } - - @Override - public String uriTemplate() { - return this.uriTemplate; - } - - @Override - public String partialUri() { - return this.partialUri; - } - - @Override - public AAIObjectType getType() { - return this.type; - } - - @Override - public String typeName() { - return this.getType().typeName(); - } - - @Override - public String typeName(CaseFormat format) { - return this.getType().typeName(format); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIObjectType.java deleted file mode 100644 index c9b69cd9e4..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIObjectType.java +++ /dev/null @@ -1,322 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import com.google.common.base.CaseFormat; -import org.onap.aai.annotations.Metadata; -import org.onap.aai.domain.yang.AggregateRoute; -import org.onap.aai.domain.yang.AllottedResource; -import org.onap.aai.domain.yang.AvailabilityZone; -import org.onap.aai.domain.yang.CloudRegion; -import org.onap.aai.domain.yang.Collection; -import org.onap.aai.domain.yang.CommunicationServiceProfile; -import org.onap.aai.domain.yang.Complex; -import org.onap.aai.domain.yang.Configuration; -import org.onap.aai.domain.yang.Connector; -import org.onap.aai.domain.yang.Customer; -import org.onap.aai.domain.yang.Device; -import org.onap.aai.domain.yang.EsrVnfm; -import org.onap.aai.domain.yang.ExtAaiNetwork; -import org.onap.aai.domain.yang.Flavor; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.Image; -import org.onap.aai.domain.yang.InstanceGroup; -import org.onap.aai.domain.yang.L3Network; -import org.onap.aai.domain.yang.LInterface; -import org.onap.aai.domain.yang.LineOfBusiness; -import org.onap.aai.domain.yang.LogicalLink; -import org.onap.aai.domain.yang.ModelVer; -import org.onap.aai.domain.yang.NetworkPolicy; -import org.onap.aai.domain.yang.NetworkTechnology; -import org.onap.aai.domain.yang.OperationalEnvironment; -import org.onap.aai.domain.yang.OwningEntity; -import org.onap.aai.domain.yang.PInterface; -import org.onap.aai.domain.yang.PhysicalLink; -import org.onap.aai.domain.yang.Platform; -import org.onap.aai.domain.yang.Pnf; -import org.onap.aai.domain.yang.PortGroup; -import org.onap.aai.domain.yang.Project; -import org.onap.aai.domain.yang.Pserver; -import org.onap.aai.domain.yang.RouteTableReference; -import org.onap.aai.domain.yang.Service; -import org.onap.aai.domain.yang.ServiceInstance; -import org.onap.aai.domain.yang.ServiceProfile; -import org.onap.aai.domain.yang.ServiceSubscription; -import org.onap.aai.domain.yang.SliceProfile; -import org.onap.aai.domain.yang.SpPartner; -import org.onap.aai.domain.yang.SriovPf; -import org.onap.aai.domain.yang.Subnet; -import org.onap.aai.domain.yang.Tenant; -import org.onap.aai.domain.yang.TunnelXconnect; -import org.onap.aai.domain.yang.Vce; -import org.onap.aai.domain.yang.VfModule; -import org.onap.aai.domain.yang.VlanTag; -import org.onap.aai.domain.yang.Vnfc; -import org.onap.aai.domain.yang.VolumeGroup; -import org.onap.aai.domain.yang.VpnBinding; -import org.onap.aai.domain.yang.Vserver; -import org.onap.aai.domain.yang.Zone; -import org.onap.so.client.graphinventory.GraphInventoryObjectType; -import org.onap.so.constants.Defaults; -import org.reflections.Reflections; -import org.reflections.scanners.SubTypesScanner; -import org.reflections.util.ClasspathHelper; -import org.reflections.util.ConfigurationBuilder; -import java.io.Serializable; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.regex.Pattern; - -public class AAIObjectType implements AAIObjectBase, GraphInventoryObjectType, Serializable { - - private static final long serialVersionUID = -2877184776691514600L; - private static Map map = new HashMap<>(); - - public static final AAIObjectType DEFAULT_CLOUD_REGION = new AAIObjectType( - AAINamespaceConstants.CLOUD_INFRASTRUCTURE, - "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/{cloud-region-id}", "default-cloud-region"); - public static final AAIObjectType CUSTOMER = new AAIObjectType(AAINamespaceConstants.BUSINESS, Customer.class); - public static final AAIObjectType GENERIC_QUERY = new AAIObjectType("/search", "/generic-query", "generic-query"); - public static final AAIObjectType BULK_PROCESS = new AAIObjectType("/bulkprocess", "", "bulkprocess"); - public static final AAIObjectType SINGLE_TRANSACTION = - new AAIObjectType("/bulk/single-transaction", "", "single-transaction"); - public static final AAIObjectType GENERIC_VNF = new AAIObjectType(AAINamespaceConstants.NETWORK, GenericVnf.class); - public static final AAIObjectType GENERIC_VNFS = - new AAIObjectType(AAINamespaceConstants.NETWORK, "/generic-vnfs", "generic-vnfs"); - public static final AAIObjectType VF_MODULE = - new AAIObjectType(AAIObjectType.GENERIC_VNF.uriTemplate(), VfModule.class); - public static final AAIObjectType L3_NETWORK = new AAIObjectType(AAINamespaceConstants.NETWORK, L3Network.class); - public static final AAIObjectType NETWORK_POLICY = - new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkPolicy.class); - public static final AAIObjectType NODES_QUERY = new AAIObjectType("/search", "/nodes-query", "nodes-query"); - public static final AAIObjectType CUSTOM_QUERY = new AAIObjectType("/query", "", "query"); - public static final AAIObjectType ROUTE_TABLE_REFERENCE = - new AAIObjectType(AAINamespaceConstants.NETWORK, RouteTableReference.class); - public static final AAIObjectType DEFAULT_TENANT = - new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/" - + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants/tenant/{tenant-id}", "default-tenant"); - public static final AAIObjectType VCE = new AAIObjectType(AAINamespaceConstants.NETWORK, Vce.class); - public static final AAIObjectType PORT_GROUP = new AAIObjectType(AAIObjectType.VCE.uriTemplate(), PortGroup.class); - public static final AAIObjectType VPN_BINDING = new AAIObjectType(AAINamespaceConstants.NETWORK, VpnBinding.class); - public static final AAIObjectType CONFIGURATION = - new AAIObjectType(AAINamespaceConstants.NETWORK, Configuration.class); - public static final AAIObjectType PSERVER = - new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Pserver.class); - public static final AAIObjectType SERVICE_SUBSCRIPTION = - new AAIObjectType(AAIObjectType.CUSTOMER.uriTemplate(), ServiceSubscription.class); - - public static final AAIObjectType SERVICE_INSTANCE_METADATA = new AAIObjectType( - AAIObjectType.SERVICE_INSTANCE + "/metadata", org.onap.aai.domain.yang.v13.Metadata.class); - - public static final AAIObjectType SERVICE = new AAIObjectType( - AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/services/service/{service-id}", Service.class); - public static final AAIObjectType SERVICE_INSTANCE = - new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceInstance.class); - public static final AAIObjectType PROJECT = new AAIObjectType(AAINamespaceConstants.BUSINESS, Project.class); - public static final AAIObjectType LINE_OF_BUSINESS = - new AAIObjectType(AAINamespaceConstants.BUSINESS, LineOfBusiness.class); - public static final AAIObjectType PLATFORM = new AAIObjectType(AAINamespaceConstants.BUSINESS, Platform.class); - public static final AAIObjectType OWNING_ENTITY = - new AAIObjectType(AAINamespaceConstants.BUSINESS, OwningEntity.class); - public static final AAIObjectType ALLOTTED_RESOURCE = - new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), AllottedResource.class); - public static final AAIObjectType ALLOTTED_RESOURCE_ALL = - new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/allotted-resources", "allottedResources"); - public static final AAIObjectType PNF = new AAIObjectType(AAINamespaceConstants.NETWORK, Pnf.class); - public static final AAIObjectType OPERATIONAL_ENVIRONMENT = - new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, OperationalEnvironment.class); - public static final AAIObjectType CLOUD_REGION = - new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, CloudRegion.class); - public static final AAIObjectType TENANT = - new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Tenant.class); - public static final AAIObjectType VOLUME_GROUP = - new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), VolumeGroup.class); - public static final AAIObjectType VSERVER = new AAIObjectType(AAIObjectType.TENANT.uriTemplate(), Vserver.class); - public static final AAIObjectType MODEL_VER = new AAIObjectType( - AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", ModelVer.class); - public static final AAIObjectType TUNNEL_XCONNECT = - new AAIObjectType(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), TunnelXconnect.class); - public static final AAIObjectType P_INTERFACE = - new AAIObjectType(AAIObjectType.PSERVER.uriTemplate(), PInterface.class); - public static final AAIObjectType SRIOV_PF = - new AAIObjectType(AAIObjectType.P_INTERFACE.uriTemplate(), SriovPf.class); - public static final AAIObjectType LOGICAL_LINK = - new AAIObjectType(AAINamespaceConstants.NETWORK, LogicalLink.class); - public static final AAIObjectType PHYSICAL_LINK = - new AAIObjectType(AAINamespaceConstants.NETWORK, PhysicalLink.class); - public static final AAIObjectType INSTANCE_GROUP = - new AAIObjectType(AAINamespaceConstants.NETWORK, InstanceGroup.class); - public static final AAIObjectType COLLECTION = new AAIObjectType(AAINamespaceConstants.NETWORK, Collection.class); - public static final AAIObjectType VNFC = new AAIObjectType(AAINamespaceConstants.NETWORK, Vnfc.class); - public static final AAIObjectType VLAN_TAG = new AAIObjectType(AAINamespaceConstants.NETWORK, VlanTag.class); - public static final AAIObjectType COMPLEX = - new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Complex.class); - public static final AAIObjectType CONNECTOR = new AAIObjectType(AAINamespaceConstants.BUSINESS, Connector.class); - public static final AAIObjectType NETWORK_TECHNOLOGY = - new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, NetworkTechnology.class); - public static final AAIObjectType SUBNET = new AAIObjectType(AAIObjectType.L3_NETWORK.uriTemplate(), Subnet.class); - public static final AAIObjectType SP_PARTNER = new AAIObjectType(AAINamespaceConstants.BUSINESS, SpPartner.class); - public static final AAIObjectType DEVICE = new AAIObjectType(AAINamespaceConstants.NETWORK, Device.class); - public static final AAIObjectType EXT_AAI_NETWORK = - new AAIObjectType(AAINamespaceConstants.NETWORK, ExtAaiNetwork.class); - public static final AAIObjectType AGGREGATE_ROUTE = - new AAIObjectType(AAINamespaceConstants.NETWORK, AggregateRoute.class); - public static final AAIObjectType L_INTERFACE = - new AAIObjectType(AAIObjectType.VSERVER.uriTemplate(), LInterface.class); - public static final AAIObjectType SUB_L_INTERFACE = new AAIObjectType(AAIObjectType.L_INTERFACE.uriTemplate(), - "/l-interfaces/l-interface/{sub-interface-name}", "sub-l-interface"); - public static final AAIObjectType IMAGE = new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Image.class); - public static final AAIObjectType FLAVOR = - new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Flavor.class); - public static final AAIObjectType UNKNOWN = new AAIObjectType("", "", "unknown") { - - private static final long serialVersionUID = 9208984071038447607L; - - @Override - public boolean passThrough() { - return true; - } - }; - public static final AAIObjectType DSL = new AAIObjectType("/dsl", "", "dsl"); - public static final AAIObjectType VNFM = new AAIObjectType( - AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-vnfm-list/esr-vnfm/{vnfm-id}", EsrVnfm.class); - public static final AAIObjectType VNFM_LIST = - new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM, "/esr-vnfm-list", "vnfm-list"); - public static final AAIObjectType VNFM_ESR_SYSTEM_INFO_LIST = - new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-vnfm-list", - "/esr-vnfm/{vnfm-id}/esr-system-info-list", "vnfm-esr-system-info-list"); - public static final AAIObjectType CLOUD_ESR_SYSTEM_INFO_LIST = new AAIObjectType( - AAIObjectType.CLOUD_REGION.uriTemplate(), "/esr-system-info-list", "cloud-esr-system-info-list"); - public static final AAIObjectType ZONE = new AAIObjectType(AAINamespaceConstants.NETWORK, Zone.class); - public static final AAIObjectType AVAILIBILITY_ZONE = - new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), AvailabilityZone.class); - public static final AAIObjectType THIRDPARTY_SDNC_LIST = new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM, - "/esr-thirdparty-sdnc-list", "thirdparty-sdnc-list"); - public static final AAIObjectType THIRDPARTY_SDNC_SYSTEM_INFO_LIST = - new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-thirdparty-sdnc-list", - "/esr-thirdparty-sdnc/{sdnc-id}/esr-system-info-list", "thirdparty-sdnc-system-info-list"); - public static final AAIObjectType COMMUNICATION_SERVICE_PROFILE = - new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), CommunicationServiceProfile.class); - public static final AAIObjectType SERVICE_PROFILE = - new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceProfile.class); - public static final AAIObjectType SERVICE_PROFILE_ALL = - new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/service-profiles", "serviceProfiles"); - public static final AAIObjectType SLICE_PROFILE = - new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), SliceProfile.class); - public static final AAIObjectType SLICE_PROFILE_ALL = - new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/slice-profiles", "sliceProfiles"); - public static final AAIObjectType COMMUNICATION_PROFILE_ALL = new AAIObjectType( - AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/communication-service-profiles", "communicationProfiles"); - public static final AAIObjectType QUERY_ALLOTTED_RESOURCE = - new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "?depth=2", "service-Instance"); - - private final String uriTemplate; - private final String parentUri; - private final String partialUri; - private final Class aaiObjectClass; - private final String name; - - static { - /* Locate any AAIObjectTypes on the classpath and add them to our map */ - java.util.Collection packages = ClasspathHelper.forPackage(""); - Reflections r = - new Reflections(new ConfigurationBuilder().setUrls(packages).setScanners(new SubTypesScanner())); - - Set> resources = r.getSubTypesOf(AAIObjectType.class); - - for (Class customTypeClass : resources) { - AAIObjectType customType; - try { - customType = customTypeClass.newInstance(); - } catch (InstantiationException | IllegalAccessException e) { - } - } - } - - protected AAIObjectType() { - this.parentUri = null; - this.partialUri = null; - this.uriTemplate = null; - this.aaiObjectClass = null; - this.name = null; - } - - protected AAIObjectType(String parentUri, String partialUri, String name) { - this.parentUri = parentUri; - this.partialUri = partialUri; - this.uriTemplate = parentUri + partialUri; - this.aaiObjectClass = null; - this.name = name; - if (!AAIObjectType.map.containsKey(name)) { - AAIObjectType.map.put(name, this); - } - } - - protected AAIObjectType(String parentUri, Class aaiObjectClass) { - this.parentUri = parentUri; - this.partialUri = removeParentUri(aaiObjectClass, parentUri); - this.uriTemplate = parentUri + partialUri; - this.aaiObjectClass = aaiObjectClass; - this.name = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, aaiObjectClass.getSimpleName()); - if (!AAIObjectType.map.containsKey(name)) { - AAIObjectType.map.put(name, this); - } - } - - @Override - public String toString() { - return this.uriTemplate(); - } - - public static AAIObjectType fromTypeName(String name) { - if (map.containsKey(name)) { - return map.get(name); - } else { - return AAIObjectType.UNKNOWN; - } - } - - @Override - public String typeName() { - return this.typeName(CaseFormat.LOWER_HYPHEN); - } - - @Override - public String typeName(CaseFormat format) { - return CaseFormat.LOWER_HYPHEN.to(format, this.name.replace("default-", "")); - } - - @Override - public String uriTemplate() { - return this.uriTemplate; - } - - @Override - public String partialUri() { - return this.partialUri; - } - - protected String removeParentUri(Class aaiObjectClass, String parentUri) { - return aaiObjectClass.getAnnotation(Metadata.class).uriTemplate().replaceFirst(Pattern.quote(parentUri), ""); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIProperties.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIProperties.java deleted file mode 100644 index 6505818758..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIProperties.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import org.onap.so.client.RestProperties; - -public interface AAIProperties extends RestProperties { - - public AAIVersion getDefaultVersion(); - - public String getAuth(); - - public String getKey(); - - @Override - public default boolean mapNotFoundToEmpty() { - return true; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIQueryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIQueryClient.java deleted file mode 100644 index 634a65831f..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIQueryClient.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.CustomQuery; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.GraphInventoryQueryClient; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri; - -public class AAIQueryClient - extends GraphInventoryQueryClient { - - public AAIQueryClient() { - super(new AAIClient()); - } - - public AAIQueryClient(AAIVersion version) { - super(new AAIClient(version)); - } - - @Override - protected GraphInventoryUri getQueryUri() { - return AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY); - } - - @Override - protected GraphInventoryUri setupQueryParams(GraphInventoryUri uri) { - return super.setupQueryParams(uri); - } - - @Override - public AAIResultWrapper createWrapper(String json) { - return new AAIResultWrapper(json); - } - - @Override - public AAIObjectType createType(String name) { - return AAIObjectType.fromTypeName(name); - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIQueryObjectMapperProvider.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIQueryObjectMapperProvider.java deleted file mode 100644 index 8f16d815b6..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIQueryObjectMapperProvider.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import com.fasterxml.jackson.databind.AnnotationIntrospector; -import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; -import com.fasterxml.jackson.databind.type.TypeFactory; -import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector; - -public class AAIQueryObjectMapperProvider extends AAICommonObjectMapperProvider { - - public AAIQueryObjectMapperProvider() { - super(); - AnnotationIntrospector aiJaxb = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()); - AnnotationIntrospector aiJackson = new JacksonAnnotationIntrospector(); - // first Jaxb, second Jackson annotations - mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(aiJaxb, aiJackson)); - - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java deleted file mode 100644 index 8e334de396..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import java.util.Optional; -import org.onap.aai.domain.yang.Relationship; -import org.onap.so.client.aai.entities.AAIEdgeLabel; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.graphinventory.GraphInventoryResourcesClient; -import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel; - -public class AAIResourcesClient extends - GraphInventoryResourcesClient, AAIResourceUri, AAIPluralResourceUri, AAIEdgeLabel, AAIResultWrapper, AAITransactionalClient, AAISingleTransactionClient> { - - private AAIClient aaiClient; - - public AAIResourcesClient() { - super(new AAIClient()); - aaiClient = (AAIClient) super.client; - } - - public AAIResourcesClient(AAIVersion version) { - super(new AAIClient(version)); - aaiClient = (AAIClient) super.client; - } - - public AAIResourcesClient(AAIClient client) { - super(client); - aaiClient = (AAIClient) super.client; - } - - @Override - public AAIResultWrapper createWrapper(String json) { - return new AAIResultWrapper(json); - } - - @Override - public AAIResultWrapper createWrapper(Object obj) { - return new AAIResultWrapper(obj); - } - - @Override - public AAITransactionalClient beginTransaction() { - return new AAITransactionalClient(this, aaiClient); - } - - @Override - public AAISingleTransactionClient beginSingleTransaction() { - return new AAISingleTransactionClient(this, aaiClient); - } - - @Override - protected Relationship buildRelationship(AAIResourceUri uri) { - return super.buildRelationship(uri, Optional.empty()); - } - - @Override - protected Relationship buildRelationship(AAIResourceUri uri, GraphInventoryEdgeLabel label) { - return super.buildRelationship(uri, Optional.of(label)); - } - - @Override - protected Relationship buildRelationship(AAIResourceUri uri, Optional label) { - return super.buildRelationship(uri, label); - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIResourcesObjectMapperProvider.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIResourcesObjectMapperProvider.java deleted file mode 100644 index 875571d71e..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIResourcesObjectMapperProvider.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -public class AAIResourcesObjectMapperProvider extends AAICommonObjectMapperProvider { - - public AAIResourcesObjectMapperProvider() { - super(); - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIRestClient.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIRestClient.java deleted file mode 100644 index 610ff728e9..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIRestClient.java +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import java.net.URI; -import java.util.Map; -import java.util.Optional; -import org.onap.so.client.ResponseExceptionMapper; -import org.onap.so.client.graphinventory.GraphInventoryPatchConverter; -import org.onap.so.client.graphinventory.GraphInventoryRestClient; -import org.onap.logging.filter.base.ONAPComponents; - -public class AAIRestClient extends GraphInventoryRestClient { - - private final AAIProperties aaiProperties; - - protected AAIRestClient(AAIProperties props, URI uri) { - super(props, uri); - this.aaiProperties = props; - } - - @Override - public ONAPComponents getTargetEntity() { - return ONAPComponents.AAI; - } - - @Override - protected void initializeHeaderMap(Map headerMap) { - headerMap.put("X-FromAppId", aaiProperties.getSystemName()); - headerMap.put("X-TransactionId", requestId); - String auth = aaiProperties.getAuth(); - String key = aaiProperties.getKey(); - - if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) { - addBasicAuthHeader(auth, key); - } - } - - @Override - protected Optional addResponseExceptionMapper() { - - return Optional.of(new AAIClientResponseExceptionMapper()); - } - - protected GraphInventoryPatchConverter getPatchConverter() { - return this.patchConverter; - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIRestClientI.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIRestClientI.java deleted file mode 100644 index 2698bc347f..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIRestClientI.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import java.io.IOException; -import java.util.List; -import java.util.Optional; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.Pnf; -import org.onap.aai.domain.yang.Pserver; - -public interface AAIRestClientI { - - List getPhysicalServerByVnfId(String vnfId) throws IOException; - - void updateMaintenceFlagVnfId(String vnfId, boolean inMaint); - - GenericVnf getVnfByName(String vnfId); - - Optional getPnfByName(String pnfId); - - void createPnf(String pnfId, Pnf pnf); - - void updatePnf(String pnfId, Pnf pnf); -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java deleted file mode 100644 index f2f96ca905..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java +++ /dev/null @@ -1,100 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.ws.rs.core.Response; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.Pnf; -import org.onap.aai.domain.yang.Pserver; -import org.onap.so.client.aai.entities.CustomQuery; -import org.onap.so.client.aai.entities.Results; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.Format; - -public class AAIRestClientImpl implements AAIRestClientI { - - private static final String PSERVER_VNF_QUERY = "pservers-fromVnf"; - - @Override - public List getPhysicalServerByVnfId(String vnfId) throws IOException { - List startNodes = new ArrayList<>(); - startNodes.add(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)); - String jsonInput = new AAIQueryClient().query(Format.RESOURCE, new CustomQuery(startNodes, PSERVER_VNF_QUERY)); - - return this.getListOfPservers(jsonInput); - - } - - protected List getListOfPservers(String jsonInput) throws IOException { - ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper(); - Results> resultsFromJson = - mapper.readValue(jsonInput, new TypeReference>>() {}); - List results = new ArrayList<>(); - for (Map m : resultsFromJson.getResult()) { - results.add(m.get("pserver")); - } - return results; - } - - @Override - public void updateMaintenceFlagVnfId(String vnfId, boolean inMaint) { - GenericVnf genericVnf = new GenericVnf(); - genericVnf.setInMaint(inMaint); - new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId), genericVnf); - - } - - @Override - public GenericVnf getVnfByName(String vnfId) { - return new AAIResourcesClient() - .get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)).orElse(null); - } - - @Override - public Optional getPnfByName(String pnfId) { - Response response = - new AAIResourcesClient().getFullResponse(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId)); - if (response.getStatus() != 200) { - return Optional.empty(); - } else { - return Optional.of(response.readEntity(Pnf.class)); - } - } - - @Override - public void createPnf(String pnfId, Pnf pnf) { - new AAIResourcesClient().createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId), - Optional.of(pnf)); - } - - @Override - public void updatePnf(String pnfId, Pnf pnf) { - new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId), pnf); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java deleted file mode 100644 index 687ff09c5a..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java +++ /dev/null @@ -1,175 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import javax.ws.rs.core.GenericType; -import org.onap.so.client.RestClient; -import org.onap.so.client.aai.entities.AAIEdgeLabel; -import org.onap.so.client.aai.entities.AAIError; -import org.onap.so.client.aai.entities.singletransaction.OperationBodyRequest; -import org.onap.so.client.aai.entities.singletransaction.OperationBodyResponse; -import org.onap.so.client.aai.entities.singletransaction.SingleTransactionRequest; -import org.onap.so.client.aai.entities.singletransaction.SingleTransactionResponse; -import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.GraphInventoryPatchConverter; -import org.onap.so.client.graphinventory.GraphInventoryTransactionClient; -import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.base.Joiner; - -public class AAISingleTransactionClient extends - GraphInventoryTransactionClient, AAIResourceUri, AAIEdgeLabel> { - - private final SingleTransactionRequest request; - private AAIResourcesClient resourcesClient; - private AAIClient aaiClient; - - protected AAISingleTransactionClient(AAIResourcesClient resourcesClient, AAIClient aaiClient) { - super(); - this.resourcesClient = resourcesClient; - this.aaiClient = aaiClient; - this.request = new SingleTransactionRequest(); - } - - /* - * (non-Javadoc) - * - * @see org.onap.so.client.aai.GraphInventoryTransactionClient#execute() - */ - @Override - public void execute() throws BulkProcessFailed { - try { - if (!this.request.getOperations().isEmpty()) { - RestClient client = - aaiClient.createClient(AAIUriFactory.createResourceUri(AAIObjectType.SINGLE_TRANSACTION)); - SingleTransactionResponse response = client.post(this.request, SingleTransactionResponse.class); - if (response != null) { - final Optional errorMessage = this.locateErrorMessages(response); - if (errorMessage.isPresent()) { - throw new BulkProcessFailed( - "One or more transactions failed in A&AI. Check logs for payloads.\nMessages:\n" - + errorMessage.get()); - } - } else { - throw new BulkProcessFailed( - "Transactions acccepted by A&AI, but there was no response. Unsure of result."); - } - } - } finally { - this.request.getOperations().clear(); - this.actionCount = 0; - } - } - - @Override - public void execute(boolean dryRun) throws BulkProcessFailed { - final ObjectMapper mapper = new ObjectMapper(); - if (dryRun) { - try { - if (logger.isDebugEnabled()) { - logger.debug("Would execute: {}", mapper.writeValueAsString(this.request)); - } - } catch (JsonProcessingException e) { - logger.debug("Could not format request to JSON", e); - } - } else { - this.execute(); - } - } - - protected Optional locateErrorMessages(SingleTransactionResponse response) { - final List errorMessages = new ArrayList<>(); - final ObjectMapper mapper = new ObjectMapper(); - - for (OperationBodyResponse body : response.getOperationResponses()) { - if (Optional.ofNullable(body.getResponseStatusCode()).orElse(400) > 300) { - AAIError error; - try { - error = mapper.readValue(mapper.writeValueAsString(body.getResponseBody()), AAIError.class); - } catch (IOException e) { - logger.error("could not parse error object from A&AI", e); - error = new AAIError(); - } - AAIErrorFormatter formatter = new AAIErrorFormatter(error); - String outputMessage = formatter.getMessage(); - errorMessages.add(outputMessage); - } - } - - if (!errorMessages.isEmpty()) { - return Optional.of(Joiner.on("\n").join(errorMessages)); - } else { - return Optional.empty(); - } - } - - protected SingleTransactionRequest getRequest() { - return this.request; - } - - @Override - protected void put(String uri, Object body) { - request.getOperations().add(new OperationBodyRequest().withAction("put").withUri(uri).withBody(body)); - } - - @Override - protected void delete(String uri) { - request.getOperations() - .add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(new Object())); - } - - @Override - protected void delete(String uri, Object obj) { - request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(obj)); - } - - @Override - protected void patch(String uri, Object body) { - request.getOperations().add(new OperationBodyRequest().withAction("patch").withUri(uri).withBody(body)); - } - - @Override - protected Optional get(GenericType genericType, AAIBaseResourceUri clone) { - return resourcesClient.get(genericType, clone); - } - - @Override - protected boolean exists(AAIBaseResourceUri uri) { - return resourcesClient.exists(uri); - } - - @Override - protected String getGraphDBName() { - return aaiClient.getGraphDBName(); - } - - @Override - protected GraphInventoryPatchConverter getPatchConverter() { - return this.patchConverter; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java deleted file mode 100644 index a8cd8bae39..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java +++ /dev/null @@ -1,228 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.Response; -import org.onap.aai.domain.yang.Relationship; -import org.onap.so.client.RestClient; -import org.onap.so.client.aai.entities.AAIEdgeLabel; -import org.onap.so.client.aai.entities.AAIError; -import org.onap.so.client.aai.entities.bulkprocess.OperationBody; -import org.onap.so.client.aai.entities.bulkprocess.Transaction; -import org.onap.so.client.aai.entities.bulkprocess.Transactions; -import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.GraphInventoryPatchConverter; -import org.onap.so.client.graphinventory.GraphInventoryTransactionClient; -import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed; -import org.onap.so.jsonpath.JsonPathUtil; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.base.Joiner; - -public class AAITransactionalClient extends - GraphInventoryTransactionClient, AAIResourceUri, AAIEdgeLabel> { - - private final Transactions transactions; - private Transaction currentTransaction; - - private AAIResourcesClient resourcesClient; - private AAIClient aaiClient; - - protected AAITransactionalClient(AAIResourcesClient resourcesClient, AAIClient aaiClient) { - super(); - this.resourcesClient = resourcesClient; - this.aaiClient = aaiClient; - this.transactions = new Transactions(); - startTransaction(); - } - - private void startTransaction() { - Transaction transaction = new Transaction(); - transactions.getTransactions().add(transaction); - currentTransaction = transaction; - } - - /* - * (non-Javadoc) - * - * @see org.onap.so.client.aai.GraphInventoryTransactionalClient#beginNewTransaction() - */ - public AAITransactionalClient beginNewTransaction() { - startTransaction(); - return this; - } - - /* - * (non-Javadoc) - * - * @see org.onap.so.client.aai.GraphInventoryTransactionalClient#execute() - */ - @Override - public void execute() throws BulkProcessFailed { - try { - if (!this.transactions.getTransactions().isEmpty()) { - RestClient client = aaiClient.createClient(AAIUriFactory.createResourceUri(AAIObjectType.BULK_PROCESS)); - Response response = client.put(this.transactions); - if (response.hasEntity()) { - final Optional errorMessage = this.locateErrorMessages(response.readEntity(String.class)); - if (errorMessage.isPresent()) { - throw new BulkProcessFailed( - "One or more transactions failed in A&AI. Check logs for payloads.\nMessages:\n" - + errorMessage.get()); - } - } else { - throw new BulkProcessFailed( - "Transactions acccepted by A&AI, but there was no response. Unsure of result."); - } - } - } finally { - this.transactions.getTransactions().clear(); - this.currentTransaction = null; - this.actionCount = 0; - } - } - - @Override - public void execute(boolean dryRun) throws BulkProcessFailed { - final ObjectMapper mapper = new ObjectMapper(); - if (dryRun) { - try { - if (logger.isDebugEnabled()) { - logger.debug("Would execute: {}", mapper.writeValueAsString(this.transactions)); - } - } catch (JsonProcessingException e) { - logger.debug("Could not format request to JSON", e); - } - } else { - this.execute(); - } - } - - protected Optional locateErrorMessages(String response) { - final List errorMessages = new ArrayList<>(); - final List results = JsonPathUtil.getInstance().locateResultList(response, "$..body"); - final ObjectMapper mapper = new ObjectMapper(); - if (!results.isEmpty()) { - List> parsed = new ArrayList<>(); - try { - for (String result : results) { - parsed.add(mapper.readValue(result, new TypeReference>() {})); - } - } catch (IOException e) { - logger.error("could not map json", e); - } - for (Map map : parsed) { - for (Entry entry : map.entrySet()) { - if (!entry.getKey().matches("2\\d\\d")) { - AAIError error; - try { - error = mapper.readValue(entry.getValue().toString(), AAIError.class); - } catch (IOException e) { - logger.error("could not parse error object from A&AI", e); - error = new AAIError(); - } - AAIErrorFormatter formatter = new AAIErrorFormatter(error); - String outputMessage = formatter.getMessage(); - logger.error("part of a bulk action failed in A&AI: " + entry.getValue()); - errorMessages.add(outputMessage); - } - } - } - } - - if (!errorMessages.isEmpty()) { - return Optional.of(Joiner.on("\n").join(errorMessages)); - } else { - return Optional.empty(); - } - } - - private Relationship buildRelationship(AAIResourceUri uri) { - return buildRelationship(uri, Optional.empty()); - } - - private Relationship buildRelationship(AAIResourceUri uri, AAIEdgeLabel label) { - return buildRelationship(uri, Optional.of(label)); - } - - private Relationship buildRelationship(AAIResourceUri uri, Optional label) { - final Relationship result = new Relationship(); - result.setRelatedLink(uri.build().toString()); - if (label.isPresent()) { - result.setRelationshipLabel(label.toString()); - } - return result; - } - - protected Transactions getTransactions() { - return this.transactions; - } - - @Override - protected void put(String uri, Object body) { - currentTransaction.getPut().add(new OperationBody().withUri(uri).withBody(body)); - } - - @Override - protected void delete(String uri) { - currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(null)); - } - - @Override - protected void delete(String uri, Object obj) { - currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(obj)); - } - - @Override - protected void patch(String uri, Object body) { - currentTransaction.getPatch().add(new OperationBody().withUri(uri).withBody(body)); - } - - @Override - protected Optional get(GenericType genericType, AAIBaseResourceUri clone) { - return resourcesClient.get(genericType, clone); - } - - @Override - protected boolean exists(AAIBaseResourceUri uri) { - return resourcesClient.exists(uri); - } - - @Override - protected String getGraphDBName() { - return aaiClient.getGraphDBName(); - } - - @Override - protected GraphInventoryPatchConverter getPatchConverter() { - return this.patchConverter; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIUpdator.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIUpdator.java deleted file mode 100644 index e8a2bc6c9c..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIUpdator.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -public interface AAIUpdator { - - void updateVnfToLocked(String vnfName) throws Exception; - - void updateVnfToUnLocked(String vnfName) throws Exception; - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java deleted file mode 100644 index b2223be688..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import org.springframework.beans.factory.annotation.Autowired; - -public class AAIUpdatorImpl implements AAIUpdator { - - @Autowired - protected AAIRestClientI client; - - public AAIRestClientI getClient() { - return client; - } - - - public void setClient(AAIRestClientI client) { - this.client = client; - } - - @Override - public void updateVnfToLocked(String vnfId) throws Exception { - client.updateMaintenceFlagVnfId(vnfId, true); - } - - @Override - public void updateVnfToUnLocked(String vnfId) throws Exception { - client.updateMaintenceFlagVnfId(vnfId, false); - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIValidator.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIValidator.java deleted file mode 100644 index f191311b2a..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIValidator.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import java.io.IOException; - -public interface AAIValidator { - - boolean isPhysicalServerLocked(String hostName) throws IOException; - - boolean isVNFLocked(String vnfId); - - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java deleted file mode 100644 index 96844ff1cb..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import java.io.IOException; -import java.util.List; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.Pserver; -import org.springframework.beans.factory.annotation.Autowired; - - -public class AAIValidatorImpl implements AAIValidator { - - - @Autowired - protected AAIRestClientI client; - - public AAIRestClientI getClient() { - return client; - } - - - public void setClient(AAIRestClientI client) { - this.client = client; - } - - @Override - public boolean isPhysicalServerLocked(String vnfId) throws IOException { - List pservers; - boolean isLocked = false; - pservers = client.getPhysicalServerByVnfId(vnfId); - if (pservers != null) { - for (Pserver pserver : pservers) { - if (pserver.isInMaint()) { - isLocked = true; - return isLocked; - } - } - } - return isLocked; - } - - @Override - public boolean isVNFLocked(String vnfId) { - boolean isLocked = false; - GenericVnf genericVnf = client.getVnfByName(vnfId); - if (genericVnf.isInMaint()) - isLocked = true; - - return isLocked; - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIVersion.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIVersion.java deleted file mode 100644 index 42887884db..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/AAIVersion.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import org.onap.so.client.graphinventory.GraphInventoryVersion; - -public enum AAIVersion implements GraphInventoryVersion { - V10("V10"), - V11("V11"), - V12("V12"), - V13("v13"), - V14("v14"), - V15("v15"), - V16("v16"), - V17("v17"), - V18("v18"), - V19("v19"); - - public static final AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1]; - private final String value; - - private AAIVersion(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } -} - - diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java deleted file mode 100644 index 456f14e5ee..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities; - -import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel; - -public enum AAIEdgeLabel implements GraphInventoryEdgeLabel { - - BELONGS_TO("org.onap.relationships.inventory.BelongsTo"), - USES("org.onap.relationships.inventory.Uses"), - COMPOSED_OF("org.onap.relationships.inventory.ComposedOf"); - - private final String label; - - private AAIEdgeLabel(String label) { - this.label = label; - } - - - @Override - public String toString() { - return this.label; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIEntity.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIEntity.java deleted file mode 100644 index ee3ffd9bbf..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIEntity.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities; - -public class AAIEntity { - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIEntityObject.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIEntityObject.java deleted file mode 100644 index 5989a6579d..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIEntityObject.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities; - -import org.onap.so.client.aai.entities.uri.AAIResourceUri; - -public interface AAIEntityObject { - - public AAIResourceUri getUri(); - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIError.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIError.java deleted file mode 100644 index 10828acd96..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIError.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"requestError"}) -public class AAIError { - - @JsonProperty("requestError") - private RequestError requestError; - - @JsonProperty("requestError") - public RequestError getRequestError() { - return requestError; - } - - @JsonProperty("requestError") - public void setRequestError(RequestError requestError) { - this.requestError = requestError; - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java deleted file mode 100644 index ab3284dd8f..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities; - -import java.io.Serializable; -import org.onap.so.client.graphinventory.entities.GraphInventoryResultWrapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AAIResultWrapper extends GraphInventoryResultWrapper implements Serializable { - - private static final long serialVersionUID = 5895841925807816737L; - private final static transient Logger logger = LoggerFactory.getLogger(AAIResultWrapper.class); - - public AAIResultWrapper(String json) { - super(json, logger); - } - - public AAIResultWrapper(Object aaiObject) { - super(aaiObject, logger); - } - - @Override - protected Relationships createRelationships(String json) { - return new Relationships(json); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/Configuration.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/Configuration.java deleted file mode 100644 index 81c07b2cf4..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/Configuration.java +++ /dev/null @@ -1,153 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"configuration-id", "configuration-type", "configuration-sub-type", "model-invariant-id", - "model-version-id", "orchestration-status", "operational-status", "configuration-selflink", - "model-customization-id"}) -public class Configuration { - - @JsonProperty("configuration-id") - private String configurationId; - @JsonProperty("configuration-name") - private String configurationName; - @JsonProperty("configuration-type") - private String configurationType; - @JsonProperty("configuration-sub-type") - private String configurationSubType; - @JsonProperty("model-invariant-id") - private String modelInvariantId; - @JsonProperty("model-version-id") - private String modelVersionId; - @JsonProperty("orchestration-status") - private String orchestrationStatus; - @JsonProperty("operational-status") - private String operationalStatus; - @JsonProperty("configuration-selflink") - private String configurationSelflink; - @JsonProperty("model-customization-id") - private String modelCustomizationId; - - @JsonProperty("configuration-id") - public String getConfigurationId() { - return configurationId; - } - - @JsonProperty("configuration-id") - public void setConfigurationId(String configurationId) { - this.configurationId = configurationId; - } - - @JsonProperty("configuration-name") - public String getConfigurationName() { - return configurationName; - } - - @JsonProperty("configuration-name") - public void setConfigurationName(String configurationName) { - this.configurationName = configurationName; - } - - @JsonProperty("configuration-type") - public String getConfigurationType() { - return configurationType; - } - - @JsonProperty("configuration-type") - public void setConfigurationType(String configurationType) { - this.configurationType = configurationType; - } - - @JsonProperty("configuration-sub-type") - public String getConfigurationSubType() { - return configurationSubType; - } - - @JsonProperty("configuration-sub-type") - public void setConfigurationSubType(String configurationSubType) { - this.configurationSubType = configurationSubType; - } - - @JsonProperty("model-invariant-id") - public String getModelInvariantId() { - return modelInvariantId; - } - - @JsonProperty("model-invariant-id") - public void setModelInvariantId(String modelInvariantId) { - this.modelInvariantId = modelInvariantId; - } - - @JsonProperty("model-version-id") - public String getModelVersionId() { - return modelVersionId; - } - - @JsonProperty("model-version-id") - public void setModelVersionId(String modelVersionId) { - this.modelVersionId = modelVersionId; - } - - @JsonProperty("orchestration-status") - public String getOrchestrationStatus() { - return orchestrationStatus; - } - - @JsonProperty("orchestration-status") - public void setOrchestrationStatus(String orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - - @JsonProperty("operational-status") - public String getOperationalStatus() { - return operationalStatus; - } - - @JsonProperty("operational-status") - public void setOperationalStatus(String operationalStatus) { - this.operationalStatus = operationalStatus; - } - - @JsonProperty("model-customization-id") - public String getModelCustomizationId() { - return modelCustomizationId; - } - - @JsonProperty("model-customization-id") - public void setModelCustomizationId(String modelCustomizationId) { - this.modelCustomizationId = modelCustomizationId; - } - - @JsonProperty("configuration-selflink") - public String getConfigurationSelflink() { - return configurationSelflink; - } - - @JsonProperty("configuration-selflink") - public void setConfigurationSelflink(String configurationSelflink) { - this.configurationSelflink = configurationSelflink; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java deleted file mode 100644 index 3433e36151..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities; - -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.List; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import com.fasterxml.jackson.annotation.JsonInclude; - - -@JsonInclude(JsonInclude.Include.NON_NULL) -public class CustomQuery { - - private List start; - private String query; - private String gremlin; - - public CustomQuery(List start) { - this.setStart(start); - } - - public CustomQuery(List start, String query) { - this.setStart(start); - this.query = "query/" + query; - } - - public CustomQuery(String gremlin) throws UnsupportedEncodingException { - this.gremlin = gremlin; - } - - public String getGremlin() { - return gremlin; - } - - public void setGremlin(String gremlin) { - this.gremlin = gremlin; - } - - public List getStart() { - return start; - } - - public void setStart(List start) { - this.start = this.mapUris(start); - } - - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - - private List mapUris(List uris) { - final List result = new ArrayList<>(); - uris.stream().map(item -> item.build().toString()).forEach(result::add); - return result; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/QueryStep.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/QueryStep.java deleted file mode 100644 index c662b4e465..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/QueryStep.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.so.client.aai.entities; - -@FunctionalInterface -public interface QueryStep { - - - public String build(); -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/Relationships.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/Relationships.java deleted file mode 100644 index 91f2ee121e..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/Relationships.java +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities; - -import java.util.List; -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.GraphInventoryObjectName; -import org.onap.so.client.graphinventory.entities.GraphInventoryRelationships; - -public class Relationships extends GraphInventoryRelationships { - - public Relationships(String json) { - super(json); - } - - @Deprecated - /** - * Use getRelatedUris instead - * - * @return - */ - public List getRelatedAAIUris() { - return this.getRelatedUris(); - } - - @Deprecated - /** - * Use getRelatedUris instead - * - * @return - */ - public List getRelatedAAIUris(GraphInventoryObjectName type) { - return this.getRelatedUris(type); - } - - - protected AAIResultWrapper get(AAIResourceUri uri) { - return new AAIResourcesClient().get(uri); - - } - - @Override - protected AAIResourceUri createUri(AAIObjectType type, String relatedLink) { - - return AAIUriFactory.createResourceFromExistingURI(type, UriBuilder.fromPath(relatedLink).build()); - } - - @Override - protected AAIObjectType fromTypeName(String name) { - return AAIObjectType.fromTypeName(name); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/RequestError.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/RequestError.java deleted file mode 100644 index 1a9001df11..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/RequestError.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"serviceException"}) -public class RequestError { - - @JsonProperty("serviceException") - private ServiceException serviceException; - - @JsonProperty("serviceException") - public ServiceException getServiceException() { - return serviceException; - } - - @JsonProperty("serviceException") - public void setServiceException(ServiceException serviceException) { - this.serviceException = serviceException; - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/Results.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/Results.java deleted file mode 100644 index a62c6adec1..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/Results.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities; - -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - - - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"results"}) -public class Results { - @JsonProperty("results") - protected List results; - - @JsonProperty("results") - public List getResult() { - if (results == null) { - results = new ArrayList<>(); - } - return this.results; - } - - @JsonProperty("results") - public void setResult(List results) { - this.results = results; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/ServiceException.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/ServiceException.java deleted file mode 100644 index de08dd9a81..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/ServiceException.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities; - -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"messageId", "text", "variables"}) -public class ServiceException { - - @JsonProperty("messageId") - private String messageId; - @JsonProperty("text") - private String text; - @JsonProperty("variables") - private List variables = new ArrayList<>(); - - @JsonProperty("messageId") - public String getMessageId() { - return messageId; - } - - @JsonProperty("messageId") - public void setMessageId(String messageId) { - this.messageId = messageId; - } - - @JsonProperty("text") - public String getText() { - return text; - } - - @JsonProperty("text") - public void setText(String text) { - this.text = text; - } - - @JsonProperty("variables") - public List getVariables() { - return variables; - } - - @JsonProperty("variables") - public void setVariables(List variables) { - this.variables = variables; - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java deleted file mode 100644 index 45f2c965f9..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.bulkprocess; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"uri", "body"}) -public class OperationBody { - - @JsonProperty("uri") - private String uri; - @JsonProperty("body") - @JsonSerialize(using = OperationBodySerializer.class) - private Object body; - - @JsonProperty("uri") - public String getUri() { - return uri; - } - - @JsonProperty("uri") - public void setUri(String uri) { - this.uri = uri; - } - - public OperationBody withUri(String uri) { - this.uri = uri; - return this; - } - - @JsonProperty("body") - public Object getBody() { - return body; - } - - @JsonProperty("body") - public void setBody(Object body) { - this.body = body; - } - - public OperationBody withBody(Object body) { - this.body = body; - return this; - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBodySerializer.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBodySerializer.java deleted file mode 100644 index 7181e96aa4..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBodySerializer.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.bulkprocess; - -import java.io.IOException; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; - -public class OperationBodySerializer extends StdSerializer { - - private static final long serialVersionUID = 5367385969270400106L; - - public OperationBodySerializer() { - this(null); - } - - public OperationBodySerializer(Class t) { - super(t); - } - - @Override - public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) - throws IOException, JsonProcessingException { - - if (value instanceof String) { - gen.writeRawValue((String) value); - } else { - gen.writeObject(value); - } - - } - -} - diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transaction.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transaction.java deleted file mode 100644 index 3b4351d768..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transaction.java +++ /dev/null @@ -1,90 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.bulkprocess; - -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"patch", "patch", "delete"}) -public class Transaction { - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("put") - private List put = new ArrayList<>(); - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("patch") - private List patch = new ArrayList<>(); - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("delete") - private List delete = new ArrayList<>(); - - @JsonProperty("put") - public List getPut() { - return put; - } - - @JsonProperty("put") - public void setPut(List put) { - this.put = put; - } - - public Transaction withPut(List put) { - this.put = put; - return this; - } - - @JsonProperty("patch") - public List getPatch() { - return patch; - } - - @JsonProperty("patch") - public void setPatch(List patch) { - this.patch = patch; - } - - public Transaction withPatch(List patch) { - this.patch = patch; - return this; - } - - @JsonProperty("delete") - public List getDelete() { - return delete; - } - - @JsonProperty("delete") - public void setDelete(List delete) { - this.delete = delete; - } - - public Transaction withDelete(List delete) { - this.delete = delete; - return this; - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transactions.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transactions.java deleted file mode 100644 index 69e8a18a3e..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transactions.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.bulkprocess; - -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"transactions"}) -public class Transactions { - - @JsonProperty("transactions") - private List transactions = new ArrayList<>(); - - @JsonProperty("transactions") - public List getTransactions() { - return transactions; - } - - @JsonProperty("transactions") - public void setTransactions(List transactions) { - this.transactions = transactions; - } - - public Transactions withTransactions(List transactions) { - this.transactions = transactions; - return this; - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java deleted file mode 100644 index b2d67af156..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.singletransaction; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"action", "uri", "body"}) -public class OperationBodyRequest { - - @JsonProperty("action") - private String action; - @JsonProperty("uri") - private String uri; - @JsonProperty("body") - @JsonSerialize(using = OperationBodyRequestSerializer.class) - private Object body; - - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - - public OperationBodyRequest withAction(String action) { - this.action = action; - return this; - } - - @JsonProperty("uri") - public String getUri() { - return uri; - } - - @JsonProperty("uri") - public void setUri(String uri) { - this.uri = uri; - } - - public OperationBodyRequest withUri(String uri) { - this.uri = uri; - return this; - } - - @JsonProperty("body") - public Object getBody() { - return body; - } - - @JsonProperty("body") - public void setBody(Object body) { - this.body = body; - } - - public OperationBodyRequest withBody(Object body) { - this.body = body; - return this; - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java deleted file mode 100644 index addc3f1364..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.singletransaction; - -import java.io.IOException; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; - -public class OperationBodyRequestSerializer extends StdSerializer { - - private static final long serialVersionUID = 5367385969270400106L; - - public OperationBodyRequestSerializer() { - this(null); - } - - public OperationBodyRequestSerializer(Class t) { - super(t); - } - - @Override - public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) - throws IOException, JsonProcessingException { - - if (value instanceof String) { - gen.writeRawValue((String) value); - } else { - gen.writeObject(value); - } - - } - -} - diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyResponse.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyResponse.java deleted file mode 100644 index c5b11fe1f7..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyResponse.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.singletransaction; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonPropertyOrder({"action", "uri", "response-status-code", "response-body"}) -public class OperationBodyResponse { - - @JsonProperty("action") - public String action; - @JsonProperty("uri") - public String uri; - @JsonProperty("response-status-code") - public Integer responseStatusCode; - @JsonProperty("response-body") - public Object responseBody; - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JsonProperty("response-status-code") - public Integer getResponseStatusCode() { - return responseStatusCode; - } - - @JsonProperty("response-status-code") - public void setResponseStatusCode(Integer responseStatusCode) { - this.responseStatusCode = responseStatusCode; - } - - @JsonProperty("response-body") - public Object getResponseBody() { - return responseBody; - } - - @JsonProperty("response-body") - public void getResponseBody(Object responseBody) { - this.responseBody = responseBody; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionRequest.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionRequest.java deleted file mode 100644 index af32ca9498..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionRequest.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.singletransaction; - -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class SingleTransactionRequest { - - @JsonProperty("operations") - public List operations; - - public List getOperations() { - - if (operations == null) { - operations = new ArrayList<>(); - } - - return operations; - } - - public void setOperations(List operations) { - this.operations = operations; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionResponse.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionResponse.java deleted file mode 100644 index 525956c5a9..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/singletransaction/SingleTransactionResponse.java +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.singletransaction; - -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class SingleTransactionResponse { - - @JsonProperty("operation-responses") - public List operationResponses; - - @JsonProperty("operation-responses") - public List getOperationResponses() { - if (operationResponses == null) { - operationResponses = new ArrayList<>(); - } - return operationResponses; - } - - @JsonProperty("operation-responses") - public void setOperationResponses(List operationResponses) { - this.operationResponses = operationResponses; - } - - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIBaseResourceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIBaseResourceUri.java deleted file mode 100644 index 67f858a2bf..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIBaseResourceUri.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.uri; - -import org.onap.so.client.aai.AAIObjectBase; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri; - -public interface AAIBaseResourceUri, OT extends AAIObjectBase> - extends AAIUri, GraphInventoryResourceUri { - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIPluralResourceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIPluralResourceUri.java deleted file mode 100644 index 2cec021c95..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIPluralResourceUri.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.onap.so.client.aai.entities.uri; - -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri; - -public interface AAIPluralResourceUri extends AAIBaseResourceUri, - GraphInventoryPluralResourceUri { - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java deleted file mode 100644 index e93d52889a..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.onap.so.client.aai.entities.uri; - -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.entities.uri.GraphInventorySingleResourceUri; - -public interface AAIResourceUri extends AAIBaseResourceUri, - GraphInventorySingleResourceUri { - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAISimplePluralUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAISimplePluralUri.java deleted file mode 100644 index 9ab45a8aa9..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAISimplePluralUri.java +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.uri; - -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.entities.uri.SimplePluralUri; - -public class AAISimplePluralUri - extends SimplePluralUri - implements AAIPluralResourceUri { - - private static final long serialVersionUID = -6397024057188453229L; - - protected AAISimplePluralUri(AAIObjectPlurals type, UriBuilder builder, Object... values) { - super(type, builder, values); - } - - protected AAISimplePluralUri(AAIObjectPlurals type) { - super(type); - } - - protected AAISimplePluralUri(AAIObjectPlurals type, Object... values) { - super(type, values); - } - - protected AAISimplePluralUri(AAIObjectPlurals type, AAIResourceUri uri) { - super(type, uri); - } - - protected AAISimplePluralUri(AAIResourceUri parentUri, AAIObjectPlurals childType) { - super(parentUri, childType); - } - - protected AAISimplePluralUri(AAISimplePluralUri copy) { - super(copy); - } - - @Override - public AAISimplePluralUri clone() { - return new AAISimplePluralUri(this); - } - - @Override - public AAIObjectPlurals getObjectType() { - return this.pluralType; - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java deleted file mode 100644 index 49dab59fc1..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.uri; - -import java.net.URI; -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.entities.uri.SimpleUri; - -public class AAISimpleUri extends SimpleUri - implements AAIResourceUri { - - private static final long serialVersionUID = -6397024057188453229L; - - protected AAISimpleUri(AAIObjectType type, Object... values) { - super(type, values); - - } - - protected AAISimpleUri(AAIObjectType type, URI uri) { - super(type, uri); - } - - protected AAISimpleUri(AAIObjectType type, UriBuilder builder, Object... values) { - super(type, builder, values); - } - - protected AAISimpleUri(AAIResourceUri parentUri, AAIObjectType childType, Object... childValues) { - super(parentUri, childType, childValues); - } - - // copy constructor - protected AAISimpleUri(AAISimpleUri copy) { - super(copy); - } - - @Override - public AAISimpleUri clone() { - return new AAISimpleUri(this); - } - - @Override - public AAISimpleUri relatedTo(AAIObjectType type, String... values) { - this.internalURI = internalURI.path(relatedTo); - return new AAISimpleUri(this, type, values); - } - - @Override - public AAISimplePluralUri relatedTo(AAIObjectPlurals plural) { - this.internalURI.path(relatedTo); - return new AAISimplePluralUri(this, plural); - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java deleted file mode 100644 index 8101643b78..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.uri; - -import java.util.regex.Pattern; -import org.onap.so.client.aai.AAIObjectBase; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri; - -public interface AAIUri, OP extends AAIObjectBase> extends GraphInventoryUri { - - public default Pattern getPrefixPattern() { - return Pattern.compile("/aai/v\\d+"); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java deleted file mode 100644 index bdd3921851..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java +++ /dev/null @@ -1,114 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.uri; - -import java.net.URI; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; - - -public class AAIUriFactory { - - /** - * values are filled into the URI template specified in {@link AAIObjectType} in order
- * There are two special lookups performed on certain types when a single value is specified:
- * Service Instance and AllottedResources
- * These can be retrieved without all their required keys but an HTTP call is required to do so - * - * @param type - * @param values - * @return - */ - public static AAIResourceUri createResourceUri(AAIObjectType type, Object... values) { - if (AAIObjectType.SERVICE_INSTANCE.equals(type)) { - return new ServiceInstanceUri(values); - } else if (AAIObjectType.ALLOTTED_RESOURCE.equals(type)) { - return new AllottedResourceLookupUri(values); - } else { - return new AAISimpleUri(type, values); - } - } - - public static NodesSingleUri createNodesUri(AAIObjectType type, Object... values) { - return new NodesSingleUri(type, values); - - } - - public static NodesPluralUri createNodesUri(AAIObjectPlurals type) { - return new NodesPluralUri(type); - - } - - /** - * This method should only be used to wrap a URI retrieved from A&AI contained within an object response - * - * @param type - * @param uri - * @return - */ - public static AAISimpleUri createResourceFromExistingURI(AAIObjectType type, URI uri) { - return new AAISimpleUri(type, uri); - } - - - /** - * creates an AAIResourceUri from a parentUri - * - * @param parentUri - * @param childType - * @param childValues - * @return - */ - public static AAISimpleUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectType childType, - Object... childValues) { - - return new AAISimpleUri(parentUri, childType, childValues); - } - - public static AAISimplePluralUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectPlurals childType) { - - return new AAISimplePluralUri(parentUri, childType); - } - - /** - * Creates a uri for a plural type e.g. /cloud-infrastructure/pservers - * - * @param type - * @return - */ - public static AAISimplePluralUri createResourceUri(AAIObjectPlurals type) { - - return new AAISimplePluralUri(type); - - } - - /** - * Creates a uri for a plural type with values e.g. /cloud-infrastructure/pservers - * - * @param type - * @return - */ - public static AAISimplePluralUri createResourceUri(AAIObjectPlurals type, Object... values) { - - return new AAISimplePluralUri(type, values); - - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java deleted file mode 100644 index 30e60cdff2..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.uri; - -import java.net.URI; -import java.util.Optional; -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; - -public class AllottedResourceLookupUri extends HttpLookupUri { - - private static final long serialVersionUID = -9212594383876793188L; - - protected AllottedResourceLookupUri(Object... values) { - super(AAIObjectType.ALLOTTED_RESOURCE, values); - } - - protected AllottedResourceLookupUri(UriBuilder builder, Optional cachedValue, Object... values) { - super(AAIObjectType.ALLOTTED_RESOURCE, builder, cachedValue, values); - } - - @Override - public AllottedResourceLookupUri clone() { - return new AllottedResourceLookupUri(this.internalURI.clone(), this.getCachedValue(), values); - } - - public AAIResourcesClient getResourcesClient() { - return new AAIResourcesClient(); - } - - @Override - public URI buildNoNetwork() { - return super.build(new String[] {"NONE", "NONE", "NONE", (String) this.values[0]}); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java deleted file mode 100644 index a0f1962706..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java +++ /dev/null @@ -1,174 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.uri; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.net.URI; -import java.util.Map; -import java.util.Optional; -import javax.ws.rs.BadRequestException; -import javax.ws.rs.NotFoundException; -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.Results; -import org.onap.so.client.graphinventory.Format; -import org.onap.so.client.graphinventory.entities.Pathed; -import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriNotFoundException; -import org.onap.so.client.graphinventory.exceptions.IncorrectNumberOfUriKeys; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; - -public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri { - - private transient Optional cachedValue = Optional.empty(); - private final AAIObjectType aaiType; - - protected HttpLookupUri(AAIObjectType type, Object... values) { - super(type, values); - this.aaiType = type; - } - - protected HttpLookupUri(AAIObjectType type, UriBuilder builder, Optional cachedValue, Object... values) { - super(type, builder, values); - this.cachedValue = cachedValue; - this.aaiType = type; - } - - protected String getObjectById(Object id) - throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException { - if (!this.getCachedValue().isPresent()) { - AAIResourceUri serviceInstanceUri = AAIUriFactory.createNodesUri(aaiType, id).format(Format.PATHED); - String resultJson; - try { - resultJson = this.getResourcesClient().get(serviceInstanceUri, NotFoundException.class).getJson(); - } catch (BadRequestException e) { - throw new GraphInventoryUriNotFoundException( - aaiType.typeName() + " " + id + " not found at: " + serviceInstanceUri.build()); - - } - try { - cachedValue = extractRelatedLink(resultJson); - if (!cachedValue.isPresent()) { - throw new GraphInventoryUriNotFoundException( - aaiType.typeName() + " " + id + " not found at: " + serviceInstanceUri.build()); - } - } catch (IOException e) { - throw new GraphInventoryPayloadException("could not map payload: " + resultJson, e); - } - } - return cachedValue.get(); - } - - protected Optional extractRelatedLink(String jsonString) throws IOException { - Optional result; - ObjectMapper mapper = new ObjectMapper(); - - Results results = mapper.readValue(jsonString, new TypeReference>() {}); - if (results.getResult().size() == 1) { - String uriString = results.getResult().get(0).getResourceLink(); - URI uri = UriBuilder.fromUri(uriString).build(); - String rawPath = uri.getRawPath(); - result = Optional.of(rawPath.replaceAll("/aai/v\\d+", "")); - } else if (results.getResult().isEmpty()) { - result = Optional.empty(); - } else { - throw new IllegalStateException("more than one result returned"); - } - - return result; - } - - protected Optional getCachedValue() { - return this.cachedValue; - } - - @Override - public URI build() { - try { - if (this.values.length == 1) { - String uri = getObjectById(this.values[0]); - Map map = super.getURIKeys(uri); - this.values = map.values().toArray(values); - return super.build(values); - } - } catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) { - throw new GraphInventoryUriComputationException(e); - } - return super.build(); - } - - @Override - public URI locateAndBuild() { - try { - if (this.values.length == 1) { - String uri = getObjectById(this.values[0]); - Map map = super.getURIKeys(uri); - this.values = map.values().toArray(values); - return super.build(values); - } - } catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) { - throw new GraphInventoryUriComputationException(e); - } - return super.build(); - } - - @Override - public abstract HttpLookupUri clone(); - - @Override - public void validateValuesSize(String template, Object... values) { - try { - super.validateValuesSize(template, values); - } catch (IncorrectNumberOfUriKeys e) { - if (values.length == 1) { - // Special case where we perform an http look up - } else { - throw e; - } - } - } - - public AAIResourcesClient getResourcesClient() { - return new AAIResourcesClient(); - } - - private void writeObject(ObjectOutputStream oos) throws IOException { - - oos.writeUTF(this.cachedValue.orElse("")); - } - - private void readObject(ObjectInputStream ois) throws IOException { - - String value = ois.readUTF(); - if ("".equals(value)) { - this.cachedValue = Optional.empty(); - } else { - this.cachedValue = Optional.ofNullable(value); - } - - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/NodesPluralUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/NodesPluralUri.java deleted file mode 100644 index 8545fc96fb..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/NodesPluralUri.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.onap.so.client.aai.entities.uri; - -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.graphinventory.GraphInventoryObjectBase; - -public class NodesPluralUri extends AAISimplePluralUri implements NodesUri { - - private static final long serialVersionUID = -6743170679667245998L; - - protected NodesPluralUri(AAIObjectPlurals type) { - super(type); - } - - @Override - public String getTemplate(GraphInventoryObjectBase type) { - return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate(); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/NodesSingleUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/NodesSingleUri.java deleted file mode 100644 index 7274b1f3b9..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/NodesSingleUri.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.onap.so.client.aai.entities.uri; - -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.GraphInventoryObjectBase; - -public class NodesSingleUri extends AAISimpleUri implements NodesUri { - - private static final long serialVersionUID = 2721165364903444248L; - - protected NodesSingleUri(AAIObjectType type, Object... values) { - super(type, values); - } - - - @Override - public String getTemplate(GraphInventoryObjectBase type) { - return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate(); - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java deleted file mode 100644 index 6e5fa77f76..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.uri; - -public interface NodesUri { - - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java deleted file mode 100644 index 0b62d05c67..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.uri; - -import java.net.URI; -import java.util.Optional; -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; - -public class ServiceInstanceUri extends HttpLookupUri { - - private static final long serialVersionUID = 2248914170527514548L; - - protected ServiceInstanceUri(Object... values) { - super(AAIObjectType.SERVICE_INSTANCE, values); - } - - protected ServiceInstanceUri(UriBuilder builder, Optional cachedValue, Object... values) { - super(AAIObjectType.SERVICE_INSTANCE, builder, cachedValue, values); - } - - @Override - public ServiceInstanceUri clone() { - return new ServiceInstanceUri(this.internalURI.clone(), this.getCachedValue(), values); - } - - public AAIResourcesClient getResourcesClient() { - return new AAIResourcesClient(); - } - - @Override - public URI buildNoNetwork() { - return super.build(new String[] {"NONE", "NONE", (String) this.values[0]}); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/EmptyStringToNullSerializer.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/EmptyStringToNullSerializer.java deleted file mode 100644 index c483bd2caf..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/EmptyStringToNullSerializer.java +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory; - -import java.io.IOException; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; - -public class EmptyStringToNullSerializer extends StdSerializer { - - private static final long serialVersionUID = 5367385969270400106L; - - public EmptyStringToNullSerializer() { - this(null); - } - - public EmptyStringToNullSerializer(Class t) { - super(t); - } - - @Override - public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) - throws IOException, JsonProcessingException { - - if ("".equals(value)) { - gen.writeNull(); - } else { - gen.writeString(value); - } - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/Format.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/Format.java deleted file mode 100644 index 078b35aaf4..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/Format.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory; - -public enum Format { - - RESOURCE("resource"), - RESOURCE_AND_URL("resource_and_url"), - SIMPLE("simple"), - RAW("raw"), - CONSOLE("console"), - PATHED("pathed"), - GRAPHSON("graphson"), - ID("id"), - COUNT("count"); - - private final String name; - - private Format(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java deleted file mode 100644 index 09efb5a48d..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory; - -import java.net.URI; -import org.onap.so.client.RestClient; -import org.onap.so.client.RestProperties; -import org.onap.so.client.RestPropertiesLoader; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri; -import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri; - -public abstract class GraphInventoryClient { - - private RestProperties props; - - protected GraphInventoryClient(Class propertiesClass) { - - RestProperties props = RestPropertiesLoader.getInstance().getNewImpl(propertiesClass); - this.props = props; - } - - protected abstract URI constructPath(URI uri); - - protected abstract RestClient createClient(URI uri); - - public RestClient createClient(GraphInventoryUri uri) { - final URI result; - if (uri instanceof HttpAwareUri) { - result = ((HttpAwareUri) uri).locateAndBuild(); - } else { - result = uri.build(); - } - - return createClient(result); - - } - - - public T getRestProperties() { - if (props == null) { - throw new IllegalStateException("No RestProperty implementation found on classpath"); - } - return (T) props; - } - - public abstract GraphInventoryVersion getVersion(); - - public abstract String getGraphDBName(); -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperPatchProvider.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperPatchProvider.java deleted file mode 100644 index 2facdaa64e..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperPatchProvider.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory; - -import com.fasterxml.jackson.databind.module.SimpleModule; - -public class GraphInventoryCommonObjectMapperPatchProvider extends GraphInventoryCommonObjectMapperProvider { - - - public GraphInventoryCommonObjectMapperPatchProvider() { - super(); - EmptyStringToNullSerializer sp = new EmptyStringToNullSerializer(); - SimpleModule emptyStringModule = new SimpleModule(); - emptyStringModule.addSerializer(String.class, sp); - mapper.registerModule(emptyStringModule); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java deleted file mode 100644 index a4f9496d17..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory; - -import org.onap.so.client.policy.CommonObjectMapperProvider; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.databind.AnnotationIntrospector; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; -import com.fasterxml.jackson.databind.type.TypeFactory; -import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector; - -public class GraphInventoryCommonObjectMapperProvider extends CommonObjectMapperProvider { - - public GraphInventoryCommonObjectMapperProvider() { - mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_NULL); - mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); - mapper.enable(MapperFeature.USE_ANNOTATIONS); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); - mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - AnnotationIntrospector aiJaxb = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()); - AnnotationIntrospector aiJackson = new JacksonAnnotationIntrospector(); - // first Jaxb, second Jackson annotations - mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(aiJaxb, aiJackson)); - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectBase.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectBase.java deleted file mode 100644 index 72de833884..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectBase.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.onap.so.client.graphinventory; - -public interface GraphInventoryObjectBase - extends GraphInventoryObjectName, GraphInventoryObjectUriTemplate, GraphInventoryObjectUriPartial { - - public default boolean passThrough() { - return false; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectName.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectName.java deleted file mode 100644 index bb547e30e8..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectName.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory; - -import com.google.common.base.CaseFormat; - -public interface GraphInventoryObjectName { - - public String typeName(); - - public String typeName(CaseFormat format); -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java deleted file mode 100644 index 84604a76cf..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory; - -public interface GraphInventoryObjectPlurals extends GraphInventoryObjectBase { - - public GraphInventoryObjectType getType(); - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java deleted file mode 100644 index d09a83a644..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory; - -public interface GraphInventoryObjectType extends GraphInventoryObjectBase { - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriPartial.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriPartial.java deleted file mode 100644 index 0207595f7f..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriPartial.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory; - -public interface GraphInventoryObjectUriPartial { - - public String partialUri(); -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriTemplate.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriTemplate.java deleted file mode 100644 index bcc26535ff..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriTemplate.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory; - -public interface GraphInventoryObjectUriTemplate { - - public String uriTemplate(); -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverter.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverter.java deleted file mode 100644 index d1bc6bc61e..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverter.java +++ /dev/null @@ -1,83 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory; - -import java.util.List; -import java.util.Map; -import java.util.regex.Pattern; -import org.onap.so.client.aai.AAICommonObjectMapperPatchProvider; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException; -import org.onap.so.jsonpath.JsonPathUtil; -import com.fasterxml.jackson.core.JsonProcessingException; - -public class GraphInventoryPatchConverter { - - private static final AAICommonObjectMapperProvider standardProvider = new AAICommonObjectMapperProvider(); - private static final AAICommonObjectMapperPatchProvider patchProvider = new AAICommonObjectMapperPatchProvider(); - private static final Pattern LOCATE_COMPLEX_OBJECT = - Pattern.compile("^((?!relationship-list).)+?\\['[^\\[\\]]+?'\\]$"); - - - public String convertPatchFormat(Object obj) { - return validatePatchObject(marshallObjectToPatchFormat(obj)); - } - - public String validatePatchObject(String payload) { - if (hasComplexObject(payload)) { - throw new GraphInventoryPatchDepthExceededException(payload); - } - - return payload; - } - - /** - * validates client side that json does not include any complex objects relationship-list is omitted from this - * validation - */ - protected boolean hasComplexObject(String json) { - if (json.isEmpty()) { - return false; - } - String complex = "$.*.*"; - String array = "$.*.*.*"; - List result = JsonPathUtil.getInstance().getPathList(json, complex); - List result2 = JsonPathUtil.getInstance().getPathList(json, array); - - result.addAll(result2); - return result.stream().anyMatch(item -> LOCATE_COMPLEX_OBJECT.matcher(item).find()); - } - - protected String marshallObjectToPatchFormat(Object obj) { - Object value = obj; - try { - if (!(obj instanceof Map || obj instanceof String)) { - value = patchProvider.getMapper().writeValueAsString(obj); - } else if (obj instanceof Map) { - value = standardProvider.getMapper().writeValueAsString(obj); - } - } catch (JsonProcessingException e) { - value = "{}"; - } - - return (String) value; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java deleted file mode 100644 index 3ff564fcb2..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java +++ /dev/null @@ -1,141 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.stream.Collectors; -import javax.ws.rs.core.GenericType; -import org.onap.so.client.aai.entities.Results; -import org.onap.so.client.graphinventory.entities.GraphInventoryResultWrapper; -import org.onap.so.client.graphinventory.entities.Pathed; -import org.onap.so.client.graphinventory.entities.ResourceAndUrl; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri; -import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; - -public abstract class GraphInventoryQueryClient, Type extends GraphInventoryObjectType> { - - private Optional depth = Optional.empty(); - private boolean nodesOnly = false; - private Optional subgraph = Optional.empty(); - private GraphInventoryClient client; - private GraphInventoryCommonObjectMapperProvider mapperProvider = new GraphInventoryCommonObjectMapperProvider(); - - public GraphInventoryQueryClient(GraphInventoryClient client) { - this.client = client; - } - - protected abstract GraphInventoryUri getQueryUri(); - - public String query(Format format, I query) { - return client.createClient(setupQueryParams(getQueryUri().queryParam("format", format.toString()))).put(query, - String.class); - } - - protected List querySingleType(Format format, I query, Class clazz) { - return client.createClient(setupQueryParams(getQueryUri().queryParam("format", format.toString()))) - .put(query, new GenericType>() {}).getResult().stream().map(item -> { - try { - return mapperProvider.getMapper().readValue(mapperProvider.getMapper().writeValueAsString(item), - clazz); - } catch (IOException e) { - throw new IllegalArgumentException("could not map values from json", e); - } - }).collect(Collectors.toList()); - } - - public List queryPathed(I query) { - return querySingleType(Format.PATHED, query, Pathed.class); - } - - public List queryId(I query) { - return querySingleType(Format.ID, query, Id.class); - } - - public List querySingleResource(I query, Class clazz) { - try { - return getResourceAndUrl(query).stream().map(item -> item.getWrapper().asBean(clazz).get()) - .collect(Collectors.toList()); - } catch (IOException e) { - throw new IllegalArgumentException("could not map values from json", e); - } - } - - public List> getResourceAndUrl(I query) throws IOException { - List> result = new ArrayList<>(); - ObjectMapper mapper = mapperProvider.getMapper(); - Results> resultsFromJson = mapper.readValue(query(Format.RESOURCE_AND_URL, query), - new TypeReference>>() {}); - for (Map m : resultsFromJson.getResult()) { - for (Entry entrySet : m.entrySet()) { - if (!entrySet.getKey().equals("url")) { - String url = (String) m.get("url"); - String stringJson = mapper.writeValueAsString(entrySet.getValue()); - result.add( - new ResourceAndUrl(url, createType(entrySet.getKey()), createWrapper(stringJson))); - } - } - } - - return result; - } - - public abstract Wrapper createWrapper(String json); - - public abstract Type createType(String name); - - public S depth(String depth) { - this.depth = Optional.of(depth); - return (S) this; - } - - public S nodesOnly() { - this.nodesOnly = true; - return (S) this; - } - - public S subgraph(GraphInventorySubgraphType type) { - - subgraph = Optional.of(type); - - return (S) this; - } - - protected GraphInventoryUri setupQueryParams(GraphInventoryUri uri) { - GraphInventoryUri clone = uri.clone(); - if (this.depth.isPresent()) { - clone.queryParam("depth", depth.get()); - } - if (this.nodesOnly) { - clone.queryParam("nodesOnly", ""); - } - if (this.subgraph.isPresent()) { - clone.queryParam("subgraph", this.subgraph.get().toString()); - } - return clone; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java deleted file mode 100644 index f446e5ac4c..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java +++ /dev/null @@ -1,418 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.so.client.graphinventory; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.ws.rs.NotFoundException; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; -import org.onap.aai.domain.yang.Relationship; -import org.onap.so.client.RestClient; -import org.onap.so.client.RestProperties; -import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel; -import org.onap.so.client.graphinventory.entities.GraphInventoryResultWrapper; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri; -import org.onap.so.client.graphinventory.entities.uri.GraphInventorySingleResourceUri; -import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryMultipleItemsException; - -public abstract class GraphInventoryResourcesClient, SingleUri extends GraphInventorySingleResourceUri, PluralUri extends GraphInventoryPluralResourceUri, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> { - - protected GraphInventoryClient client; - - protected GraphInventoryResourcesClient(GraphInventoryClient client) { - this.client = client; - } - - /** - * creates a new object in GraphInventory - * - * @param obj - can be any object which will marshal into a valid GraphInventory payload - * @param uri - * @return - */ - public void create(SingleUri uri, Object obj) { - RestClient giRC = client.createClient(uri); - giRC.put(obj); - } - - /** - * creates a new object in GraphInventory with no payload body - * - * @param uri - * @return - */ - public void createEmpty(SingleUri uri) { - RestClient giRC = client.createClient(uri); - giRC.put(""); - } - - /** - * returns false if the object does not exist in GraphInventory - * - * @param uri - * @return - */ - public boolean exists(Uri uri) { - GraphInventoryResourceUri forceMinimal = (Uri) uri.clone(); - forceMinimal.format(Format.COUNT); - forceMinimal.limit(1); - try { - RestClient giRC = client.createClient(forceMinimal); - - return giRC.get().getStatus() == Status.OK.getStatusCode(); - } catch (NotFoundException e) { - return false; - } - } - - /** - * Adds a relationship between two objects in GraphInventory - * - * @param uriA - * @param uriB - * @return - */ - public void connect(SingleUri uriA, SingleUri uriB) { - GraphInventorySingleResourceUri uriAClone = (SingleUri) uriA.clone(); - RestClient giRC = client.createClient(uriAClone.relationshipAPI()); - giRC.put(this.buildRelationship(uriB)); - } - - /** - * Adds a relationship between two objects in GraphInventory with a given edge label - * - * @param uriA - * @param uriB - * @param edge label - * @return - */ - public void connect(SingleUri uriA, SingleUri uriB, EdgeLabel label) { - GraphInventorySingleResourceUri uriAClone = (SingleUri) uriA.clone(); - RestClient giRC = client.createClient(uriAClone.relationshipAPI()); - giRC.put(this.buildRelationship(uriB, label)); - } - - /** - * Removes relationship from two objects in GraphInventory - * - * @param uriA - * @param uriB - * @return - */ - public void disconnect(SingleUri uriA, SingleUri uriB) { - GraphInventorySingleResourceUri uriAClone = (SingleUri) uriA.clone(); - RestClient giRC = client.createClient(uriAClone.relationshipAPI()); - giRC.delete(this.buildRelationship(uriB)); - } - - /** - * Deletes object from GraphInventory. Automatically handles resource-version. - * - * @param uri - * @return - */ - public void delete(SingleUri uri) { - GraphInventorySingleResourceUri clone = (SingleUri) uri.clone(); - RestClient giRC = client.createClient(clone); - Map result = giRC.get(new GenericType>() {}).orElseThrow( - () -> new NotFoundException(clone.build() + " does not exist in " + client.getGraphDBName())); - String resourceVersion = (String) result.get("resource-version"); - giRC = client.createClient(clone.resourceVersion(resourceVersion)); - giRC.delete(); - } - - /** - * @param obj - can be any object which will marshal into a valid GraphInventory payload - * @param uri - * @return - */ - public void update(SingleUri uri, Object obj) { - RestClient giRC = client.createClient(uri); - giRC.patch(obj); - } - - /** - * Retrieves an object from GraphInventory and unmarshalls it into the Class specified - * - * @param clazz - * @param uri - * @return - */ - public Optional get(Class clazz, Uri uri) { - try { - return client.createClient(uri).get(clazz); - } catch (NotFoundException e) { - if (this.getRestProperties().mapNotFoundToEmpty()) { - return Optional.empty(); - } else { - throw e; - } - } - } - - /** - * Retrieves an object from GraphInventory and returns complete response - * - * @param uri - * @return - */ - public Response getFullResponse(Uri uri) { - try { - return client.createClient(uri).get(); - } catch (NotFoundException e) { - if (this.getRestProperties().mapNotFoundToEmpty()) { - return e.getResponse(); - } else { - throw e; - } - } - } - - /** - * Retrieves an object from GraphInventory and automatically unmarshalls it into a Map or List - * - * @param resultClass - * @param uri - * @return - */ - public Optional get(GenericType resultClass, Uri uri) { - try { - return client.createClient(uri).get(resultClass); - } catch (NotFoundException e) { - if (this.getRestProperties().mapNotFoundToEmpty()) { - return Optional.empty(); - } else { - throw e; - } - } - } - - public Optional getOne(Class pluralClass, Class resultClass, PluralUri uri) { - Optional> result = unwrapPlural(pluralClass, resultClass, uri); - - if (result.isPresent()) { - if (result.get().size() == 1) { - return Optional.of(result.get().get(0)); - } else { - throw new GraphInventoryMultipleItemsException(result.get().size(), uri); - } - } - - return Optional.empty(); - } - - public Optional getFirst(Class pluralClass, Class resultClass, PluralUri uri) { - Optional> result = unwrapPlural(pluralClass, resultClass, uri); - - if (result.isPresent() && !result.get().isEmpty()) { - return Optional.of(result.get().get(0)); - } - - return Optional.empty(); - } - - public Optional getFirstWrapper(Class pluralClass, Class resultClass, PluralUri uri) { - - Optional result = getFirst(pluralClass, resultClass, uri); - if (result.isPresent()) { - return Optional.of(this.createWrapper(result.get())); - } else { - return Optional.empty(); - } - } - - public Optional getOneWrapper(Class pluralClass, Class resultClass, PluralUri uri) { - - Optional result = getOne(pluralClass, resultClass, uri); - if (result.isPresent()) { - return Optional.of(this.createWrapper(result.get())); - } else { - return Optional.empty(); - } - } - - protected Optional> unwrapPlural(Class pluralClass, Class resultClass, PluralUri uri) { - try { - PluralUri clone = (PluralUri) uri.clone().limit(1); - Optional obj = client.createClient(clone).get(pluralClass); - if (obj.isPresent()) { - Optional listMethod = Arrays.stream(obj.get().getClass().getMethods()).filter(method -> { - - Type returnType = method.getGenericReturnType(); - if (returnType instanceof ParameterizedType) { - Type[] types = ((ParameterizedType) returnType).getActualTypeArguments(); - if (types != null && types[0] instanceof Class) { - Class listClass = (Class) types[0]; - return resultClass.equals(listClass); - } - } - - return false; - }).findFirst(); - if (listMethod.isPresent()) { - try { - return Optional.of((List) listMethod.get().invoke(obj.get())); - - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - throw new RuntimeException(e); - } - } - } - return Optional.empty(); - - } catch (NotFoundException e) { - if (this.getRestProperties().mapNotFoundToEmpty()) { - return Optional.empty(); - } else { - throw e; - } - } - } - - /** - * Retrieves an object from GraphInventory wrapped in a helper class which offer additional features - * - * @param uri - * @return - */ - public Wrapper get(Uri uri) { - String json; - try { - json = client.createClient(uri).get(String.class).orElse(null); - } catch (NotFoundException e) { - if (this.getRestProperties().mapNotFoundToEmpty()) { - json = null; - } else { - throw e; - } - } - return this.createWrapper(json); - } - - /** - * Retrieves an object from GraphInventory wrapped in a helper class which offer additional features If the object - * cannot be found in GraphInventory the method will throw the runtime exception included as an argument - * - * @param uri - * @return - */ - public Wrapper get(Uri uri, Class c) { - String json; - try { - json = client.createClient(uri).get(String.class).orElseThrow(() -> createException(c, - uri.build() + " not found in " + client.getGraphDBName(), Optional.empty())); - } catch (NotFoundException e) { - throw createException(c, "could not construct uri for use with " + client.getGraphDBName(), Optional.of(e)); - } - - return this.createWrapper(json); - } - - private RuntimeException createException(Class c, String message, - Optional t) { - RuntimeException e; - try { - if (t.isPresent()) { - e = c.getConstructor(String.class, Throwable.class).newInstance(message, t.get()); - } else { - e = c.getConstructor(String.class).newInstance(message); - } - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException - | NoSuchMethodException | SecurityException e1) { - throw new IllegalArgumentException("could not create instance for " + c.getName()); - } - - return e; - } - - /** - * Will automatically create the object if it does not exist - * - * @param obj - Optional object which serializes to a valid GraphInventory payload - * @param uri - * @return - */ - public Self createIfNotExists(SingleUri uri, Optional obj) { - if (!this.exists((Uri) uri)) { - if (obj.isPresent()) { - this.create(uri, obj.get()); - } else { - this.createEmpty(uri); - } - - } - return (Self) this; - } - - protected Relationship buildRelationship(SingleUri uri) { - return buildRelationship(uri, Optional.empty()); - } - - protected Relationship buildRelationship(SingleUri uri, GraphInventoryEdgeLabel label) { - return buildRelationship(uri, Optional.of(label)); - } - - protected Relationship buildRelationship(SingleUri uri, Optional label) { - final Relationship result = new Relationship(); - if (uri instanceof HttpAwareUri) { - result.setRelatedLink(((HttpAwareUri) uri).locateAndBuild().toString()); - } else { - result.setRelatedLink(uri.build().toString()); - } - if (label.isPresent()) { - result.setRelationshipLabel(label.get().toString()); - } - return result; - } - - public abstract Wrapper createWrapper(String json); - - public abstract Wrapper createWrapper(Object json); - - /** - * Starts a transaction which encloses multiple GraphInventory mutations - * - * @return - */ - public abstract TransactionalClient beginTransaction(); - - /** - * Starts a transaction groups multiple GraphInventory mutations - * - * @return - */ - public abstract SingleTransactionClient beginSingleTransaction(); - - public T getRestProperties() { - return client.getRestProperties(); - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java deleted file mode 100644 index ea30deb791..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory; - -import java.net.URI; -import java.util.Map; -import java.util.Optional; -import javax.ws.rs.core.Response; -import org.onap.logging.filter.base.ONAPComponentsList; -import org.onap.so.client.ResponseExceptionMapper; -import org.onap.so.client.RestClientSSL; -import org.onap.so.client.RestProperties; -import org.onap.so.client.policy.CommonObjectMapperProvider; - -public abstract class GraphInventoryRestClient extends RestClientSSL { - - protected static final GraphInventoryCommonObjectMapperProvider standardProvider = - new GraphInventoryCommonObjectMapperProvider(); - - protected final GraphInventoryPatchConverter patchConverter = new GraphInventoryPatchConverter(); - - protected GraphInventoryRestClient(RestProperties props, URI uri) { - super(props, Optional.of(uri)); - } - - @Override - public abstract ONAPComponentsList getTargetEntity(); - - @Override - protected abstract void initializeHeaderMap(Map headerMap); - - @Override - protected abstract Optional addResponseExceptionMapper(); - - @Override - protected CommonObjectMapperProvider getCommonObjectMapperProvider() { - return standardProvider; - } - - @Override - public Response patch(Object obj) { - return super.patch(convertToPatchFormat(obj)); - } - - @Override - public T patch(Object obj, Class resultClass) { - return super.patch(convertToPatchFormat(obj), resultClass); - } - - protected GraphInventoryPatchConverter getPatchConverter() { - return this.patchConverter; - } - - protected String convertToPatchFormat(Object obj) { - return getPatchConverter().convertPatchFormat(obj); - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventorySubgraphType.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventorySubgraphType.java deleted file mode 100644 index d30f481ac8..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventorySubgraphType.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory; - - -public enum GraphInventorySubgraphType { - STAR("star"), PRUNE("prune"); - - private final String name; - - private GraphInventorySubgraphType(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java deleted file mode 100644 index 8ee5ca4e80..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java +++ /dev/null @@ -1,256 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.ws.rs.NotFoundException; -import javax.ws.rs.core.GenericType; -import org.onap.aai.domain.yang.Relationship; -import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri; -import org.onap.so.client.graphinventory.entities.uri.GraphInventorySingleResourceUri; -import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public abstract class GraphInventoryTransactionClient, SingleUri extends GraphInventorySingleResourceUri, EdgeLabel extends GraphInventoryEdgeLabel> { - - protected static Logger logger = LoggerFactory.getLogger(GraphInventoryTransactionClient.class); - - protected int actionCount = 0; - - protected final GraphInventoryPatchConverter patchConverter = new GraphInventoryPatchConverter(); - - protected GraphInventoryTransactionClient() {} - - /** - * creates a new object in A&AI - * - * @param obj - can be any object which will marshal into a valid A&AI payload - * @param uri - * @return - */ - public Self create(SingleUri uri, Object obj) { - this.put(uri.build().toString(), obj); - incrementActionAmount(); - return (Self) this; - } - - /** - * creates a new object in A&AI with no payload body - * - * @param uri - * @return - */ - public Self createEmpty(SingleUri uri) { - this.put(uri.build().toString(), new HashMap()); - incrementActionAmount(); - return (Self) this; - } - - /** - * Will automatically create the object if it does not exist - * - * @param obj - Optional object which serializes to a valid GraphInventory payload - * @param uri - * @return - */ - public Self createIfNotExists(SingleUri uri, Optional obj) { - if (!this.exists((Uri) uri)) { - if (obj.isPresent()) { - this.create(uri, obj.get()); - } else { - this.createEmpty(uri); - } - - } - return (Self) this; - } - - /** - * Adds a relationship between two objects in A&AI - * - * @param uriA - * @param uriB - * @return - */ - public Self connect(SingleUri uriA, SingleUri uriB) { - GraphInventorySingleResourceUri uriAClone = uriA.clone(); - this.put(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB)); - incrementActionAmount(); - return (Self) this; - } - - /** - * relationship between multiple objects in A&AI - connects A to all objects specified in list - * - * @param uriA - * @param uris - * @return - */ - public Self connect(SingleUri uriA, List uris) { - for (SingleUri uri : uris) { - this.connect(uriA, uri); - } - return (Self) this; - } - - /** - * relationship between multiple objects in A&AI - connects A to all objects specified in list - * - * @param uriA - * @param uris - * @return - */ - public Self connect(SingleUri uriA, SingleUri uriB, EdgeLabel label) { - GraphInventorySingleResourceUri uriAClone = uriA.clone(); - this.put(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB, label)); - return (Self) this; - } - - /** - * relationship between multiple objects in A&AI - connects A to all objects specified in list - * - * @param uriA - * @param uris - * @return - */ - public Self connect(SingleUri uriA, List uris, EdgeLabel label) { - for (SingleUri uri : uris) { - this.connect(uriA, uri, label); - } - return (Self) this; - } - - /** - * Removes relationship from two objects in A&AI - * - * @param uriA - * @param uriB - * @return - */ - public Self disconnect(SingleUri uriA, SingleUri uriB) { - GraphInventorySingleResourceUri uriAClone = uriA.clone(); - this.delete(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB)); - incrementActionAmount(); - return (Self) this; - } - - /** - * Removes relationship from multiple objects - disconnects A from all objects specified in list - * - * @param uriA - * @param uris - * @return - */ - public Self disconnect(SingleUri uriA, List uris) { - for (SingleUri uri : uris) { - this.disconnect(uriA, uri); - } - return (Self) this; - } - - /** - * Deletes object from A&AI. Automatically handles resource-version. - * - * @param uri - * @return - */ - public Self delete(SingleUri uri) { - Map result = this.get(new GenericType>() {}, (Uri) uri) - .orElseThrow(() -> new NotFoundException(uri.build() + " does not exist in " + this.getGraphDBName())); - String resourceVersion = (String) result.get("resource-version"); - this.delete(uri.resourceVersion(resourceVersion).build().toString()); - incrementActionAmount(); - return (Self) this; - } - - protected abstract Optional get(GenericType genericType, Uri clone); - - protected abstract boolean exists(Uri uri); - - protected abstract String getGraphDBName(); - - protected abstract void put(String uri, Object body); - - protected abstract void delete(String uri); - - protected abstract void delete(String uri, Object obj); - - protected abstract void patch(String uri, Object body); - - /** - * @param obj - can be any object which will marshal into a valid A&AI payload - * @param uri - * @return - */ - public Self update(Uri uri, Object obj) { - - final String payload = getPatchConverter().convertPatchFormat(obj); - this.patch(uri.build().toString(), payload); - incrementActionAmount(); - return (Self) this; - } - - private void incrementActionAmount() { - actionCount++; - } - - /** - * Executes all created transactions in A&AI - * - * @throws BulkProcessFailed - */ - public abstract void execute() throws BulkProcessFailed; - - - /** - * Executes all created transactions in A&AI, with optional dry run flag - * - * @throws BulkProcessFailed - */ - public abstract void execute(boolean dryrun) throws BulkProcessFailed; - - private Relationship buildRelationship(SingleUri uri) { - return buildRelationship(uri, Optional.empty()); - } - - private Relationship buildRelationship(SingleUri uri, EdgeLabel label) { - return buildRelationship(uri, Optional.of(label)); - } - - private Relationship buildRelationship(SingleUri uri, Optional label) { - final Relationship result = new Relationship(); - result.setRelatedLink(uri.build().toString()); - if (label.isPresent()) { - result.setRelationshipLabel(label.toString()); - } - return result; - } - - protected GraphInventoryPatchConverter getPatchConverter() { - return this.patchConverter; - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryVersion.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryVersion.java deleted file mode 100644 index 3b7dba70f8..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/GraphInventoryVersion.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory; - -public interface GraphInventoryVersion { - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java deleted file mode 100644 index 3c69f70b11..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.so.client.graphinventory; - -public interface TransactionBuilder { - - - void put(String uri, Object body); - - void delete(String uri, Object body); - - void patch(String uri, Object body); - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeBase.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeBase.java deleted file mode 100644 index 5802e9c4e8..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeBase.java +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.so.client.graphinventory.entities; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.onap.so.client.aai.entities.QueryStep; -import org.onap.so.client.graphinventory.GraphInventoryObjectName; - -public abstract class DSLNodeBase> implements QueryStep { - - protected final String nodeName; - protected final List nodeKeys; - protected final StringBuilder query; - protected boolean output = false; - - public DSLNodeBase() { - this.nodeName = ""; - this.nodeKeys = new ArrayList<>(); - this.query = new StringBuilder(); - - } - - public DSLNodeBase(GraphInventoryObjectName name) { - this.nodeName = name.typeName(); - this.nodeKeys = new ArrayList<>(); - this.query = new StringBuilder(); - query.append(nodeName); - } - - public DSLNodeBase(GraphInventoryObjectName name, DSLNodeKey... key) { - this.nodeName = name.typeName(); - this.nodeKeys = Arrays.asList(key); - this.query = new StringBuilder(); - query.append(nodeName); - } - - public DSLNodeBase(DSLNodeBase copy) { - this.nodeName = copy.nodeName; - this.nodeKeys = copy.nodeKeys; - this.query = new StringBuilder(copy.query); - this.output = copy.output; - } - - public DSLOutputNode output() { - this.output = true; - - return new DSLOutputNode(this); - } - - public T and(DSLNodeKey... key) { - this.nodeKeys.addAll(Arrays.asList(key)); - - return (T) this; - } - - @Override - public String build() { - StringBuilder result = new StringBuilder(query); - if (output) { - result.append("*"); - } - for (DSLNodeKey key : nodeKeys) { - result.append(key.build()); - } - - return result.toString(); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java deleted file mode 100644 index e301edb0fd..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.so.client.graphinventory.entities; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.onap.so.client.aai.entities.QueryStep; -import com.google.common.base.Joiner; - - -public class DSLNodeKey implements QueryStep { - - private boolean not = false; - private final StringBuilder query = new StringBuilder(); - private final String keyName; - private final List values; - - public DSLNodeKey(String keyName, Object... value) { - - this.keyName = keyName; - this.values = Arrays.asList(value); - } - - public DSLNodeKey not() { - - this.not = true; - return this; - } - - @Override - public String build() { - StringBuilder result = new StringBuilder(query); - - if (not) { - result.append(" !"); - } - result.append("('").append(keyName).append("', "); - List temp = new ArrayList<>(); - for (Object item : values) { - if ("null".equals(item)) { - temp.add(String.format("' %s '", item)); - } else if ("".equals(item)) { - temp.add("' '"); - } else { - if (item instanceof String) { - temp.add(String.format("'%s'", item)); - } else { - temp.add(item); - } - } - } - result.append(Joiner.on(", ").join(temp)).append(")"); - - return result.toString(); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLOutputNode.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLOutputNode.java deleted file mode 100644 index d799795650..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLOutputNode.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.onap.so.client.graphinventory.entities; - -public class DSLOutputNode extends DSLNodeBase implements Output { - - public DSLOutputNode(DSLNodeBase copy) { - super(copy); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java deleted file mode 100644 index 1fa79a714c..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.so.client.graphinventory.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; - -@JsonInclude(JsonInclude.Include.NON_NULL) -public class DSLQuery { - - private String dsl; - - public DSLQuery() { - - } - - public DSLQuery(DSLTraversal dsl) { - this.dsl = dsl.get(); - } - - public String getDsl() { - return dsl; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java deleted file mode 100644 index 7ff6e2ed22..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java +++ /dev/null @@ -1,158 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.so.client.graphinventory.entities; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; -import org.onap.so.client.aai.entities.QueryStep; -import org.onap.so.client.graphinventory.GraphInventoryObjectName; -import com.google.common.base.Joiner; - -public class DSLQueryBuilder { - - private List steps = new ArrayList<>(); - private String suffix = ""; - - protected DSLQueryBuilder() { - - } - - protected DSLQueryBuilder(QueryStep node) { - steps.add(node); - } - - public DSLQueryBuilder> node(DSLNodeBase node) { - steps.add(node); - - return (DSLQueryBuilder>) this; - } - - public DSLQueryBuilder output() { - Object obj = steps.get(steps.size() - 1); - if (obj instanceof DSLNodeBase) { - ((DSLNodeBase) steps.get(steps.size() - 1)).output(); - } else if (obj.getClass().getName().contains("$$Lambda$")) { - // process lambda expressions - for (Field f : obj.getClass().getDeclaredFields()) { - f.setAccessible(true); - Object o; - try { - o = f.get(obj); - if (o instanceof DSLQueryBuilder && ((DSLQueryBuilder) o).steps.get(0) instanceof DSLNodeBase) { - ((DSLNodeBase) ((DSLQueryBuilder) o).steps.get(0)).output(); - } - } catch (IllegalArgumentException | IllegalAccessException e) { - } - f.setAccessible(false); - break; - } - } - return (DSLQueryBuilder) this; - } - - @SafeVarargs - public final DSLQueryBuilder union(final DSLQueryBuilder... union) { - - List> unions = Arrays.asList(union); - steps.add(() -> { - StringBuilder query = new StringBuilder(); - - query.append("> [ ") - .append(Joiner.on(", ") - .join(unions.stream().map(item -> item.compile()).collect(Collectors.toList()))) - .append(" ]"); - return query.toString(); - }); - - return (DSLQueryBuilder) this; - } - - public DSLQueryBuilder where(DSLQueryBuilder where) { - - steps.add(() -> { - StringBuilder query = new StringBuilder(); - query.append(where.compile()).append(")"); - String result = query.toString(); - if (!result.startsWith(">")) { - result = "> " + result; - } - return "(" + result; - }); - return this; - } - - public DSLQueryBuilder to(DSLQueryBuilder to) { - steps.add(() -> { - StringBuilder query = new StringBuilder(); - - query.append("> ").append(to.compile()); - return query.toString(); - }); - return (DSLQueryBuilder) this; - } - - public DSLQueryBuilder to(GraphInventoryObjectName name) { - return (DSLQueryBuilder) to(__.node(name)); - } - - public DSLQueryBuilder to(GraphInventoryObjectName name, DSLNodeKey... key) { - return (DSLQueryBuilder) to(__.node(name, key)); - } - - public DSLQueryBuilder limit(int limit) { - suffix = " LIMIT " + limit; - return this; - } - - public DSLTraversal build() { - return new DSLTraversal<>(compile()); - } - - @Override - public String toString() { - return build().get(); - } - - @Override - public boolean equals(Object o) { - if (o != null) { - return o.toString().equals(toString()); - } - return false; - } - - @Override - public int hashCode() { - - return compile().hashCode(); - } - - private String compile() { - return String.join(" ", steps.stream().map(item -> item.build()).collect(Collectors.toList())) + suffix; - } - - protected QueryStep getFirst() { - return steps.get(0); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLStartNode.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLStartNode.java deleted file mode 100644 index fb0772726f..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLStartNode.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.onap.so.client.graphinventory.entities; - -import org.onap.so.client.graphinventory.GraphInventoryObjectName; - -public class DSLStartNode extends DSLNodeBase implements Start { - - - public DSLStartNode() { - super(); - } - - public DSLStartNode(GraphInventoryObjectName name) { - super(name); - } - - public DSLStartNode(GraphInventoryObjectName name, DSLNodeKey... key) { - super(name, key); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLTraversal.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLTraversal.java deleted file mode 100644 index 40f80463b2..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/DSLTraversal.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.onap.so.client.graphinventory.entities; - -public class DSLTraversal { - - private final String traversal; - - protected DSLTraversal(String traversal) { - this.traversal = traversal; - } - - public String get() { - return traversal; - } - - @Override - public String toString() { - return traversal; - } - - @Override - public int hashCode() { - return traversal.hashCode(); - } - - @Override - public boolean equals(Object o) { - if (o != null) { - return this.toString().equals(o); - } - return false; - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java deleted file mode 100644 index e3542e863a..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory.entities; - -public interface GraphInventoryEdgeLabel { - - - @Override - public String toString(); -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java deleted file mode 100644 index 6e7b9c9f08..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java +++ /dev/null @@ -1,133 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory.entities; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.function.Predicate; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; -import org.onap.so.client.graphinventory.GraphInventoryObjectName; -import org.onap.so.client.graphinventory.GraphInventoryObjectType; -import org.onap.so.client.graphinventory.entities.uri.GraphInventorySingleResourceUri; -import org.onap.so.jsonpath.JsonPathUtil; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; - -public abstract class GraphInventoryRelationships, Uri extends GraphInventorySingleResourceUri, Type extends GraphInventoryObjectType> { - - protected final ObjectMapper mapper; - protected Map map; - protected final String jsonBody; - - public GraphInventoryRelationships(String json) { - this.jsonBody = json; - this.mapper = new GraphInventoryCommonObjectMapperProvider().getMapper(); - try { - this.map = mapper.readValue(json, new TypeReference>() {}); - } catch (IOException e) { - this.map = new HashMap<>(); - } - } - - public List getByType(GraphInventoryObjectName type) { - - return this.getAll(Optional.of(type)); - } - - public List getAll() { - - return this.getAll(Optional.empty()); - } - - - public List getRelatedLinks() { - return this.getRelatedLinks(Optional.empty()); - } - - public List getRelatedLinks(GraphInventoryObjectName type) { - return this.getRelatedLinks(Optional.of(type)); - } - - public List getRelatedUris() { - return this.getRelatedUris(x -> true); - } - - public List getRelatedUris(GraphInventoryObjectName type) { - return this.getRelatedUris(x -> type.typeName().equals(x)); - } - - protected List getRelatedUris(Predicate p) { - List result = new ArrayList<>(); - if (map.containsKey("relationship")) { - List> relationships = (List>) map.get("relationship"); - for (Map relationship : relationships) { - final String relatedTo = (String) relationship.get("related-to"); - if (p.test(relatedTo)) { - Type type; - type = fromTypeName(relatedTo); - final String relatedLink = (String) relationship.get("related-link"); - - result.add(createUri(type, relatedLink)); - } - } - } - return result; - } - - - - protected List getAll(final Optional type) { - List relatedLinks; - if (type.isPresent()) { - relatedLinks = this.getRelatedUris(type.get()); - } else { - relatedLinks = this.getRelatedUris(); - } - ArrayList result = new ArrayList<>(); - for (Uri link : relatedLinks) { - result.add(this.get(link)); - } - return result; - } - - protected abstract Wrapper get(Uri uri); - - protected abstract Uri createUri(Type type, String relatedLink); - - protected abstract Type fromTypeName(String name); - - protected List getRelatedLinks(Optional type) { - String matcher = ""; - if (type.isPresent()) { - matcher = "[?(@.related-to=='" + type.get().typeName() + "')]"; - } - return JsonPathUtil.getInstance().locateResultList(this.jsonBody, - String.format("$.relationship%s.related-link", matcher)); - } - - public String getJson() { - return this.jsonBody; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java deleted file mode 100644 index 6a571038ee..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java +++ /dev/null @@ -1,125 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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.so.client.graphinventory.entities; - -import java.io.IOException; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; -import org.onap.so.jsonpath.JsonPathUtil; -import org.slf4j.Logger; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; - -public abstract class GraphInventoryResultWrapper> - implements Serializable { - - private static final long serialVersionUID = 5895841925807816727L; - protected final String jsonBody; - protected final ObjectMapper mapper; - private final transient Logger logger; - - protected GraphInventoryResultWrapper(String json, Logger logger) { - this.jsonBody = json; - this.mapper = new GraphInventoryCommonObjectMapperProvider().getMapper(); - this.logger = logger; - } - - protected GraphInventoryResultWrapper(Object aaiObject, Logger logger) { - this.mapper = new GraphInventoryCommonObjectMapperProvider().getMapper(); - this.jsonBody = mapObjectToString(aaiObject); - this.logger = logger; - } - - protected String mapObjectToString(Object aaiObject) { - try { - return mapper.writeValueAsString(aaiObject); - } catch (JsonProcessingException e) { - logger.warn("could not parse object into json - defaulting to empty object"); - return "{}"; - } - } - - public Optional getRelationships() { - final String path = "$.relationship-list"; - if (isEmpty()) { - return Optional.empty(); - } - Optional result = JsonPathUtil.getInstance().locateResult(jsonBody, path); - if (result.isPresent()) { - return Optional.of(createRelationships(result.get())); - } else { - return Optional.empty(); - } - } - - protected abstract R createRelationships(String json); - - public String getJson() { - if (jsonBody == null) { - return "{}"; - } else { - return jsonBody; - } - } - - public Map asMap() { - - return asBean(new TypeReference>() {}).orElse(new HashMap<>()); - } - - public Optional asBean(Class clazz) { - if (isEmpty()) { - return Optional.empty(); - } - try { - return Optional.of(mapper.readValue(this.jsonBody, clazz)); - } catch (IOException e) { - return Optional.empty(); - } - } - - public Optional asBean(TypeReference reference) { - if (isEmpty()) { - return Optional.empty(); - } - try { - return Optional.of(mapper.readValue(this.jsonBody, reference)); - } catch (IOException e) { - return Optional.empty(); - } - } - - public boolean isEmpty() { - return jsonBody == null; - } - - @Override - public String toString() { - return this.getJson(); - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Id.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Id.java deleted file mode 100644 index 2951bc8d45..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Id.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.so.client.graphinventory.entities; - -public class Id extends Resource { - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Node.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Node.java deleted file mode 100644 index cdaae7d91f..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Node.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.onap.so.client.graphinventory.entities; - -public interface Node extends Output { - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Output.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Output.java deleted file mode 100644 index 06b8b65984..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Output.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.onap.so.client.graphinventory.entities; - -import org.onap.so.client.aai.entities.QueryStep; - -public interface Output extends QueryStep { - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java deleted file mode 100644 index b848f1c597..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.so.client.graphinventory.entities; - -public class Pathed extends Resource { - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java deleted file mode 100644 index 1e7169d092..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.so.client.graphinventory.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"resource-type", "resource-link"}) -public class Resource { - - @JsonProperty("resource-type") - private String resourceType; - @JsonProperty("resource-link") - private String resourceLink; - - @JsonProperty("resource-type") - public String getResourceType() { - return resourceType; - } - - @JsonProperty("resource-type") - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - @JsonProperty("resource-link") - public String getResourceLink() { - return resourceLink; - } - - @JsonProperty("resource-link") - public void setResourceLink(String resourceLink) { - this.resourceLink = resourceLink; - } - -} - diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java deleted file mode 100644 index 326bd06dfb..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.so.client.graphinventory.entities; - -import org.onap.so.client.graphinventory.GraphInventoryObjectType; - -public class ResourceAndUrl { - - private String url; - private GraphInventoryObjectType type; - private Wrapper wrapper; - - public ResourceAndUrl(String url, GraphInventoryObjectType type, Wrapper wrapper) { - this.url = url; - this.type = type; - this.wrapper = wrapper; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public Wrapper getWrapper() { - return wrapper; - } - - public void setWrapper(Wrapper wrapper) { - this.wrapper = wrapper; - } - - public GraphInventoryObjectType getType() { - return type; - } - - public void setType(GraphInventoryObjectType type) { - this.type = type; - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Start.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Start.java deleted file mode 100644 index c649e36eca..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/Start.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.onap.so.client.graphinventory.entities; - -import org.onap.so.client.aai.entities.QueryStep; - -public interface Start extends QueryStep { - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/TraversalBuilder.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/TraversalBuilder.java deleted file mode 100644 index 0af29f78e6..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/TraversalBuilder.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.onap.so.client.graphinventory.entities; - -public class TraversalBuilder { - - - private TraversalBuilder() { - - } - - public static DSLQueryBuilder fragment(Start node) { - return new DSLQueryBuilder<>(node); - } - - public static DSLQueryBuilder traversal(Output node) { - return new DSLQueryBuilder<>(node); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/__.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/__.java deleted file mode 100644 index ca0bd9e00d..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/__.java +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.so.client.graphinventory.entities; - -import org.onap.so.client.graphinventory.GraphInventoryObjectName; - -public class __ { - - protected __() { - - } - - public static DSLQueryBuilder identity() { - return new DSLQueryBuilder<>(); - } - - public static DSLQueryBuilder start(Start node) { - return new DSLQueryBuilder<>(node); - } - - public static DSLQueryBuilder node(GraphInventoryObjectName name) { - - return __.start(new DSLStartNode(name)); - } - - public static DSLQueryBuilder node(GraphInventoryObjectName name, DSLNodeKey... key) { - return __.start(new DSLStartNode(name, key)); - } - - public static DSLNodeKey key(String keyName, Object... value) { - return new DSLNodeKey(keyName, value); - } - - @SafeVarargs - public static final DSLQueryBuilder union(final DSLQueryBuilder... traversal) { - - return __.identity().union(traversal); - } - - public static DSLQueryBuilder where(DSLQueryBuilder traversal) { - - return __.identity().where(traversal); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/Depth.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/Depth.java deleted file mode 100644 index d91f36c0c7..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/Depth.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory.entities.uri; - -public enum Depth { - ZERO("0"), ONE("1"), TWO("2"), THREE("3"), FOUR("4"), FIVE("5"), SIX("6"), ALL("all"); - - private final String depth; - - private Depth(String s) { - - this.depth = s; - } - - - @Override - public String toString() { - return this.depth; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java deleted file mode 100644 index aa09702be8..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.onap.so.client.graphinventory.entities.uri; - -import org.onap.so.client.graphinventory.GraphInventoryObjectBase; - -public interface GraphInventoryPluralResourceUri, OT extends GraphInventoryObjectBase> - extends GraphInventoryResourceUri { - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java deleted file mode 100644 index 64933863d5..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory.entities.uri; - -import org.onap.so.client.graphinventory.Format; -import org.onap.so.client.graphinventory.GraphInventoryObjectBase; - -public interface GraphInventoryResourceUri, OT extends GraphInventoryObjectBase> - extends GraphInventoryUri { - - public T format(Format format); - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java deleted file mode 100644 index e45ff14a5e..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.onap.so.client.graphinventory.entities.uri; - -import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals; -import org.onap.so.client.graphinventory.GraphInventoryObjectType; - -public interface GraphInventorySingleResourceUri, P extends GraphInventoryPluralResourceUri, SingleObject extends GraphInventoryObjectType, PluralObject extends GraphInventoryObjectPlurals> - extends GraphInventoryResourceUri { - - public T resourceVersion(String version); - - public T relationshipAPI(); - - public P relatedTo(PluralObject plural); - - public T relatedTo(SingleObject type, String... values); -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java deleted file mode 100644 index e3fda2fa23..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory.entities.uri; - -import java.io.Serializable; -import java.net.URI; -import java.util.Map; -import java.util.regex.Pattern; -import org.onap.so.client.graphinventory.GraphInventoryObjectBase; -import org.onap.so.client.graphinventory.GraphInventoryObjectType; - -public interface GraphInventoryUri, OT extends GraphInventoryObjectBase> - extends Serializable { - - public URI build(); - - /** - * By default GraphInventory enforces a depth of 1. Some objects can be told to retrieve objects nested beneath them - * by increasing this number. - * - * You can use 0 to restrict the returned information to only the object you requested You can use all to retrieve - * all nested objects (this should only be used if you really need a massive amount of information and are caching - * the retrieval) - * - * @param depth - * @return - */ - public T depth(Depth depth); - - /** - * Makes client only return object fields, no relationships - * - * @return - */ - public T nodesOnly(boolean nodesOnly); - - public T queryParam(String name, String... values); - - public T replaceQueryParam(String name, String... values); - - public T resultIndex(int index); - - public T resultSize(int size); - - public T limit(int size); - - public T clone(); - - /** - * returns all key values of the URI as a map. Key names can be found in {@link GraphInventoryObjectType} - * - * @return - */ - public Map getURIKeys(); - - public OT getObjectType(); - - public boolean equals(Object o); - - public int hashCode(); - - public Pattern getPrefixPattern(); -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java deleted file mode 100644 index 1ee3d57b6c..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory.entities.uri; - -import java.net.URI; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; - -public interface HttpAwareUri extends AAIResourceUri { - - - public URI buildNoNetwork(); - - public URI locateAndBuild(); -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleBaseUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleBaseUri.java deleted file mode 100644 index fc1a008466..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleBaseUri.java +++ /dev/null @@ -1,237 +0,0 @@ -package org.onap.so.client.graphinventory.entities.uri; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.net.URI; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import javax.ws.rs.core.UriBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import org.onap.so.client.graphinventory.Format; -import org.onap.so.client.graphinventory.GraphInventoryObjectBase; -import org.onap.so.client.graphinventory.entities.uri.parsers.UriParser; -import org.onap.so.client.graphinventory.entities.uri.parsers.UriParserSpringImpl; -import org.onap.so.client.graphinventory.exceptions.IncorrectNumberOfUriKeys; -import org.springframework.web.util.UriUtils; - -public abstract class SimpleBaseUri, Parent extends GraphInventorySingleResourceUri, S extends GraphInventoryObjectBase> - implements GraphInventoryResourceUri { - - private static final long serialVersionUID = -1011069933894179423L; - protected transient UriBuilder internalURI; - protected static final String relationshipAPI = "/relationship-list/relationship"; - protected static final String relatedTo = "/related-to"; - protected Object[] values; - protected final S type; - protected final Parent parentUri; - protected final Map> queryParams = new HashMap<>(); - - protected SimpleBaseUri(S type, Object... values) { - this.type = type; - this.internalURI = UriBuilder.fromPath(this.getTemplate(type)); - this.values = values; - this.parentUri = null; - validateValuesSize(this.getTemplate(type), values); - } - - protected SimpleBaseUri(S type, URI uri) { - if (!type.passThrough()) { - this.type = type; - this.internalURI = UriBuilder.fromPath(this.getTemplate(type)); - this.values = - this.getURIKeys(uri.getRawPath().replaceAll(getPrefixPattern().toString(), "")).values().toArray(); - this.parentUri = null; - } else { - this.type = type; - this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll(getPrefixPattern().toString(), "")); - this.values = new Object[0]; - this.parentUri = null; - } - - } - - protected SimpleBaseUri(S type, UriBuilder builder, Object... values) { - this.internalURI = builder; - this.values = values; - this.type = type; - this.parentUri = null; - - } - - protected SimpleBaseUri(Parent parentUri, S childType, Object... childValues) { - this.type = childType; - this.internalURI = UriBuilder.fromUri(type.partialUri()); - this.values = childValues; - this.parentUri = parentUri; - - validateValuesSize(childType.partialUri(), values); - } - - protected SimpleBaseUri(SimpleBaseUri copy) { - this.type = copy.type; - this.internalURI = copy.internalURI.clone(); - this.values = copy.values.clone(); - if (copy.parentUri != null) { - this.parentUri = (Parent) copy.parentUri.clone(); - } else { - this.parentUri = null; - } - } - - protected void setInternalURI(UriBuilder builder) { - this.internalURI = builder; - } - - @Override - public T queryParam(String name, String... values) { - this.internalURI = internalURI.queryParam(name, values); - if (queryParams.containsKey(name)) { - queryParams.get(name).addAll(Arrays.asList(values)); - } else { - queryParams.put(name, Stream.of(values).collect(Collectors.toSet())); - } - return (T) this; - } - - @Override - public T replaceQueryParam(String name, String... values) { - this.internalURI = internalURI.replaceQueryParam(name, values); - queryParams.put(name, Stream.of(values).collect(Collectors.toSet())); - return (T) this; - } - - @Override - public T resultIndex(int index) { - this.internalURI = internalURI.replaceQueryParam("resultIndex", index); - return (T) this; - } - - @Override - public T resultSize(int size) { - this.internalURI = internalURI.replaceQueryParam("resultSize", size); - return (T) this; - } - - @Override - public T limit(int size) { - this.resultIndex(0).resultSize(size); - return (T) this; - } - - @Override - public URI build() { - return build(this.values); - } - - protected URI build(Object... values) { - - // This is a workaround because resteasy does not encode URIs correctly - final String[] encoded = new String[values.length]; - for (int i = 0; i < values.length; i++) { - encoded[i] = UriUtils.encode(values[i].toString(), StandardCharsets.UTF_8.toString()); - } - if (this.parentUri != null) { - return UriBuilder - .fromUri(this.parentUri.build().toString() + internalURI.buildFromEncoded(encoded).toString()) - .build(); - } else { - return internalURI.buildFromEncoded(encoded); - } - } - - @Override - public Map getURIKeys() { - return this.getURIKeys(this.build().toString()); - } - - protected Map getURIKeys(String uri) { - UriParser parser; - if (!("".equals(this.getTemplate(type)))) { - parser = new UriParserSpringImpl(this.getTemplate(type)); - } else { - return new HashMap<>(); - } - - - return parser.parse(uri); - } - - @Override - public abstract T clone(); - - @Override - public S getObjectType() { - return this.type; - } - - @Override - public boolean equals(Object o) { - if (o != null) { - return this.toString().equals(o.toString()); - } - return false; - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(this.toString()).toHashCode(); - } - - - @Override - public T depth(Depth depth) { - this.internalURI.replaceQueryParam("depth", depth.toString()); - return (T) this; - } - - @Override - public T nodesOnly(boolean nodesOnly) { - if (nodesOnly) { - this.internalURI.replaceQueryParam("nodes-only", ""); - } - return (T) this; - } - - @Override - public T format(Format format) { - this.internalURI.replaceQueryParam("format", format); - return (T) this; - } - - public void validateValuesSize(String template, Object... values) { - UriParser parser = new UriParserSpringImpl(template); - Set variables = parser.getVariables(); - if (variables.size() != values.length) { - throw new IncorrectNumberOfUriKeys(String.format("Expected %s variables: %s", variables.size(), variables)); - } - } - - protected String getTemplate(GraphInventoryObjectBase type) { - return type.uriTemplate(); - } - - private void writeObject(ObjectOutputStream oos) throws IOException { - oos.defaultWriteObject(); - oos.writeUTF(this.internalURI.toTemplate()); - } - - private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { - ois.defaultReadObject(); - String uri = ois.readUTF(); - this.setInternalURI(UriBuilder.fromUri(uri)); - } - - @Override - public String toString() { - return new ToStringBuilder(null, ToStringStyle.NO_CLASS_NAME_STYLE).append("type", type) - .append("parentUri", parentUri).append("values", values).append("queryParams", queryParams).toString(); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimplePluralUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimplePluralUri.java deleted file mode 100644 index c0b6d573c1..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimplePluralUri.java +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory.entities.uri; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals; -import org.onap.so.client.graphinventory.GraphInventoryObjectType; - -public abstract class SimplePluralUri, Parent extends GraphInventorySingleResourceUri, PT extends GraphInventoryObjectPlurals, OT extends GraphInventoryObjectType> - extends SimpleBaseUri implements GraphInventoryPluralResourceUri, Serializable { - - private static final long serialVersionUID = -337701171277616439L; - - protected final PT pluralType; - - protected SimplePluralUri(PT type, UriBuilder builder, Object... values) { - super(type, builder, values); - this.pluralType = type; - } - - protected SimplePluralUri(PT type) { - super(type, new Object[0]); - this.pluralType = type; - } - - protected SimplePluralUri(PT type, Object... values) { - super(type, values); - this.pluralType = type; - } - - protected SimplePluralUri(Parent parentUri, PT childType) { - super(parentUri, childType, new Object[0]); - this.pluralType = childType; - } - - public SimplePluralUri(SimplePluralUri copy) { - super(copy); - this.pluralType = copy.pluralType; - } - - protected void setInternalURI(UriBuilder builder) { - this.internalURI = builder; - } - - private void writeObject(ObjectOutputStream oos) throws IOException { - oos.defaultWriteObject(); - oos.writeUTF(this.internalURI.toTemplate()); - } - - private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { - ois.defaultReadObject(); - String uri = ois.readUTF(); - this.setInternalURI(UriBuilder.fromUri(uri)); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java deleted file mode 100644 index aff7392efe..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java +++ /dev/null @@ -1,83 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory.entities.uri; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.net.URI; -import javax.ws.rs.core.UriBuilder; -import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals; -import org.onap.so.client.graphinventory.GraphInventoryObjectType; - -public abstract class SimpleUri, PT extends GraphInventoryPluralResourceUri, S extends GraphInventoryObjectType, P extends GraphInventoryObjectPlurals> - extends SimpleBaseUri implements GraphInventorySingleResourceUri { - - private static final long serialVersionUID = -337701171277616439L; - protected static final String relationshipAPI = "/relationship-list/relationship"; - protected static final String relatedTo = "/related-to"; - - protected SimpleUri(S type, Object... values) { - super(type, values); - } - - protected SimpleUri(S type, URI uri) { - super(type, uri); - - } - - protected SimpleUri(S type, UriBuilder builder, Object... values) { - super(type, builder, values); - - } - - protected SimpleUri(T parentUri, S childType, Object... childValues) { - super(parentUri, childType, childValues); - } - - protected SimpleUri(SimpleBaseUri copy) { - super(copy); - } - - @Override - public T resourceVersion(String version) { - this.internalURI = internalURI.replaceQueryParam("resource-version", version); - return (T) this; - } - - @Override - public T relationshipAPI() { - this.internalURI = internalURI.path(relationshipAPI); - return (T) this; - } - - private void writeObject(ObjectOutputStream oos) throws IOException { - oos.defaultWriteObject(); - oos.writeUTF(this.internalURI.toTemplate()); - } - - private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { - ois.defaultReadObject(); - String uri = ois.readUTF(); - this.setInternalURI(UriBuilder.fromUri(uri)); - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParser.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParser.java deleted file mode 100644 index 00000268a7..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParser.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory.entities.uri.parsers; - -import java.util.Map; -import java.util.Set; - -public interface UriParser { - public Set getVariables(); - - public Map parse(final String uri); -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java deleted file mode 100644 index 71afdb83d9..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory.entities.uri.parsers; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import org.springframework.web.util.UriTemplate; -import org.springframework.web.util.UriUtils; - -public class UriParserSpringImpl implements UriParser { - - private final UriTemplate uriTemplate; - - public UriParserSpringImpl(final String template) { - this.uriTemplate = new UriTemplate(template); - } - - @Override - public Map parse(final String uri) { - final boolean match = this.uriTemplate.matches(uri); - if (!match) { - return new LinkedHashMap<>(); - } - return Collections.unmodifiableMap(decodeParams(this.uriTemplate.match(uri))); - } - - @Override - public Set getVariables() { - return Collections.unmodifiableSet(new LinkedHashSet(this.uriTemplate.getVariableNames())); - } - - protected Map decodeParams(Map map) { - final Map result = new LinkedHashMap<>(); - - for (Entry entry : map.entrySet()) { - result.put(entry.getKey(), UriUtils.decode(entry.getValue(), "UTF-8")); - } - - return result; - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/BulkProcessFailed.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/BulkProcessFailed.java deleted file mode 100644 index d69e83435b..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/BulkProcessFailed.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory.exceptions; - -public class BulkProcessFailed extends Exception { - - public BulkProcessFailed(String message) { - super(message); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java deleted file mode 100644 index d3c17ce9e9..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.onap.so.client.graphinventory.exceptions; - -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri; - -public class GraphInventoryMultipleItemsException extends RuntimeException { - - private static final long serialVersionUID = -1596266941681036917L; - - public GraphInventoryMultipleItemsException(int size, GraphInventoryPluralResourceUri uri) { - super(String.format("Found %s objects at %s when we only expected to find one.", size, uri.build())); - } - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java deleted file mode 100644 index fe5f159291..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory.exceptions; - -public class GraphInventoryPatchDepthExceededException extends RuntimeException { - - private static final long serialVersionUID = -3740429832086738907L; - - - public GraphInventoryPatchDepthExceededException(String payload) { - super("Object exceeds allowed depth for update action: " + payload); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadException.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadException.java deleted file mode 100644 index 45ebf9ee46..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadException.java +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory.exceptions; - -public class GraphInventoryPayloadException extends Exception { - - private static final long serialVersionUID = -5712783905947711065L; - - public GraphInventoryPayloadException(Throwable t) { - super(t); - } - - public GraphInventoryPayloadException(String s, Throwable t) { - super(s, t); - } - - public GraphInventoryPayloadException(String s) { - super(s); - } - - -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriComputationException.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriComputationException.java deleted file mode 100644 index 380bce7165..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriComputationException.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory.exceptions; - -public class GraphInventoryUriComputationException extends RuntimeException { - - private static final long serialVersionUID = 5187931752227522034L; - - public GraphInventoryUriComputationException(String s) { - super(s); - } - - public GraphInventoryUriComputationException(Throwable t) { - super(t); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.java deleted file mode 100644 index 6637c89402..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory.exceptions; - -public class GraphInventoryUriNotFoundException extends Exception { - private static final long serialVersionUID = 2789643165122257833L; - - public GraphInventoryUriNotFoundException(String message) { - super(message); - } -} diff --git a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/IncorrectNumberOfUriKeys.java b/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/IncorrectNumberOfUriKeys.java deleted file mode 100644 index ede8e481b2..0000000000 --- a/graph-inventory/aai-client/src/main/java/org/onap/so/client/graphinventory/exceptions/IncorrectNumberOfUriKeys.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.so.client.graphinventory.exceptions; - -public class IncorrectNumberOfUriKeys extends RuntimeException { - - private static final long serialVersionUID = 2189285428827817518L; - - public IncorrectNumberOfUriKeys(String message) { - super(message); - } - -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIClientResponseExceptionMapperTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIClientResponseExceptionMapperTest.java new file mode 100644 index 0000000000..5ed582fc37 --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIClientResponseExceptionMapperTest.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import static org.junit.Assert.assertEquals; +import java.util.Arrays; +import java.util.List; +import org.junit.Before; +import org.junit.Test; +import org.onap.aaiclient.client.aai.entities.AAIError; +import org.onap.aaiclient.client.aai.entities.RequestError; +import org.onap.aaiclient.client.aai.entities.ServiceException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class AAIClientResponseExceptionMapperTest { + + AAIClientResponseExceptionMapper mapper; + String errorMsg; + + @Before + public void before() { + mapper = new AAIClientResponseExceptionMapper(); + errorMsg = "Error calling A&AI. Request-Id=" + mapper.getRequestId() + " "; + } + + @Test + public void testExtractMessageWithEntity() throws JsonProcessingException { + ServiceException svcException = new ServiceException(); + svcException.setText("test %1 message - %2"); + svcException.setVariables(Arrays.asList("error", "service exception %1 test")); + + RequestError requestError = new RequestError(); + requestError.setServiceException(svcException); + + AAIError error = new AAIError(); + error.setRequestError(requestError); + + ObjectMapper objMapper = new ObjectMapper(); + String strRequestError = objMapper.writeValueAsString(error); + + assertEquals(errorMsg + "test error message - service exception error test", + mapper.extractMessage(strRequestError).get()); + } + + @Test + public void testExtractMessageWithoutEntity() { + assertEquals(errorMsg, mapper.extractMessage("").get()); + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIErrorFormatterTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIErrorFormatterTest.java new file mode 100644 index 0000000000..e64885772c --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIErrorFormatterTest.java @@ -0,0 +1,104 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.onap.aaiclient.client.aai.entities.AAIError; +import org.onap.aaiclient.client.aai.entities.RequestError; +import org.onap.aaiclient.client.aai.entities.ServiceException; + +public class AAIErrorFormatterTest { + + @Mock + private AAIError errorObj; + + @Before + public void init() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testFillInTemplateWithReplace() { + String error = "Error %1 on %2"; + List list = Arrays.asList("PUT", "hello %1"); + AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj); + String result = formatter.fillInTemplate(error, list); + assertEquals("equal", "Error PUT on hello PUT", result); + + } + + @Test + public void testFillInTemplateWithoutReplace() { + String error = "Error"; + List list = new ArrayList<>(); + AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj); + String result = formatter.fillInTemplate(error, list); + assertEquals("equal", "Error", result); + } + + @Test + public void testGetMessage() { + ServiceException svcException = new ServiceException(); + svcException.setText("test %1 message - %2"); + svcException.setVariables(Arrays.asList("error", "service exception %1 test")); + + RequestError requestError = new RequestError(); + requestError.setServiceException(svcException); + + doReturn(requestError).when(errorObj).getRequestError(); + + AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj); + String result = formatter.getMessage(); + assertEquals("equal", "test error message - service exception error test", result); + } + + @Test + public void errorMessageOnPercentEncodedTest() { + ServiceException svcException = new ServiceException(); + svcException.setText("test my%20Test %1 message - %2"); + svcException.setVariables(Arrays.asList("error", "service exception %1 test")); + + RequestError requestError = new RequestError(); + requestError.setServiceException(svcException); + + doReturn(requestError).when(errorObj).getRequestError(); + + AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj); + String result = formatter.getMessage(); + assertEquals("equal", "test my%20Test error message - service exception error test", result); + } + + @Test + public void testGetMessageNoParsable() { + errorObj.setRequestError(null); + AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj); + String result = formatter.getMessage(); + assertEquals("equal", "no parsable error message found", result); + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIObjectTypeTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIObjectTypeTest.java new file mode 100644 index 0000000000..829ef1d646 --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIObjectTypeTest.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; + +public class AAIObjectTypeTest { + + + @Test + public void fromTypeNameTest() throws IllegalArgumentException, IllegalAccessException, InstantiationException { + AAIObjectType type = AAIObjectType.fromTypeName("allotted-resource"); + assertEquals("allotted-resource", type.typeName()); + + } + + @Test + public void customTypeTest() throws IllegalArgumentException, IllegalAccessException, InstantiationException { + AAIObjectType type = AAIObjectType.fromTypeName("my-custom-name"); + assertEquals("my-custom-name", type.typeName()); + + } + + @Test + public void verifyDefaultCase() { + assertEquals("default removed for tenant", "tenant", AAIObjectType.DEFAULT_TENANT.typeName()); + assertEquals("default removed for cloud-region", "cloud-region", AAIObjectType.DEFAULT_CLOUD_REGION.typeName()); + } + + @Test + public void verifyRegularCase() { + assertEquals("default removed for tenant", "allotted-resource", AAIObjectType.ALLOTTED_RESOURCE.typeName()); + } + + @Test + public void instanceGroupObjectTypeTest() { + final String id = "test1"; + AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, id); + assertEquals("/network/instance-groups/instance-group/test1", aaiUri.build().toString()); + } + + @Test + public void collectionObjectTypeTest() { + final String id = "test1"; + AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, id); + assertEquals("/network/collections/collection/test1", aaiUri.build().toString()); + } + + @Test + public void genericVnfTest() { + AAIObjectType type = AAIObjectType.GENERIC_VNF; + assertEquals("/network/generic-vnfs/generic-vnf/{vnf-id}", type.uriTemplate()); + assertEquals("/generic-vnfs/generic-vnf/{vnf-id}", type.partialUri()); + } + + @Test + public void pInterfaceTest() { + AAIObjectType type = AAIObjectType.P_INTERFACE; + assertEquals("/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}", + type.uriTemplate()); + assertEquals("/p-interfaces/p-interface/{interface-name}", type.partialUri()); + } + + @Test + public void networkPolicyObjectTypeTest() { + final String id = "test1"; + AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, id); + assertEquals("/network/network-policies/network-policy/test1", aaiUri.build().toString()); + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIPServerTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIPServerTest.java new file mode 100644 index 0000000000..ba51db7218 --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIPServerTest.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import static org.junit.Assert.assertEquals; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.List; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.aai.domain.yang.Pserver; + +public class AAIPServerTest { + + @Test + public void pserverTest() throws IOException { + AAIRestClientImpl client = new AAIRestClientImpl(); + String json = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/aai/pserver.json"))); + List list = client.getListOfPservers(json); + + assertEquals("", list.get(0).getHostname(), "test"); + assertEquals("", list.size(), 2); + } + + @Test + @Ignore // IGNORED FOR 1710 MERGE TO ONAP + public void pserverActualTest() throws IOException { + AAIRestClientImpl client = new AAIRestClientImpl(); + List list = client.getPhysicalServerByVnfId("d946afed-8ebe-4c5d-9665-54fcc043b8e7"); + assertEquals("", list.size(), 0); + } + +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIQueryClientTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIQueryClientTest.java new file mode 100644 index 0000000000..15fe03e93f --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIQueryClientTest.java @@ -0,0 +1,150 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.aai.domain.yang.Complex; +import org.onap.so.client.RestClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.CustomQuery; +import org.onap.aaiclient.client.aai.entities.Results; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.Format; +import org.onap.aaiclient.client.graphinventory.GraphInventoryClient; +import org.onap.aaiclient.client.graphinventory.GraphInventorySubgraphType; +import org.onap.aaiclient.client.graphinventory.entities.Pathed; +import org.onap.aaiclient.client.graphinventory.entities.ResourceAndUrl; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + + +@RunWith(MockitoJUnitRunner.class) +public class AAIQueryClientTest { + + @Mock + private RestClient restClient; + + @Mock + private GraphInventoryClient client; + + @InjectMocks + @Spy + private AAIQueryClient aaiQueryClient = new AAIQueryClient(); + + private String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/query/"; + + private ObjectMapper mapper = new ObjectMapper(); + + @Test + public void testQuery() { + List uris = Arrays.asList(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY)); + + Format format = Format.SIMPLE; + CustomQuery query = new CustomQuery(uris); + + doReturn(restClient).when(client).createClient(isA(AAIResourceUri.class)); + aaiQueryClient.query(format, query); + verify(client, times(1)) + .createClient(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY).format(format)); + verify(restClient, times(1)).put(query, String.class); + } + + @Test + public void testCreateClient() { + String depth = "testDepth"; + GraphInventorySubgraphType subgraph = GraphInventorySubgraphType.STAR; + + aaiQueryClient.depth(depth); + aaiQueryClient.nodesOnly(); + aaiQueryClient.subgraph(subgraph); + + AAIResourceUri aaiUri = spy(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY)); + doReturn(aaiUri).when(aaiUri).clone(); + aaiQueryClient.setupQueryParams(aaiUri); + + verify(aaiUri, times(1)).queryParam("depth", depth); + verify(aaiUri, times(1)).queryParam("nodesOnly", ""); + verify(aaiUri, times(1)).queryParam("subgraph", subgraph.toString()); + } + + @Test + public void querySingleResourceTest() throws IOException { + doReturn(getJson("single-query-result.json")).when(aaiQueryClient).query(eq(Format.RESOURCE_AND_URL), + any(CustomQuery.class)); + List result = aaiQueryClient.querySingleResource( + new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test"))), + Complex.class); + assertEquals(2, result.size()); + assertEquals("complex-id-15100-jc689q2", result.get(1).getPhysicalLocationId()); + } + + @Test + public void getResourceAndUrlTest() throws IOException { + doReturn(getJson("single-query-result.json")).when(aaiQueryClient).query(eq(Format.RESOURCE_AND_URL), + any(CustomQuery.class)); + List> result = aaiQueryClient.getResourceAndUrl( + new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test")))); + assertEquals(2, result.size()); + + assertEquals(1, + result.get(1).getWrapper().getRelationships().get().getRelatedUris(AAIObjectType.PSERVER).size()); + } + + @Test + public void querySingleTypeTest() throws IOException { + when(client.createClient(isA(AAIResourceUri.class))).thenReturn(restClient); + when(restClient.put(any(Object.class), any(GenericType.class))).thenReturn( + mapper.readValue(getJson("pathed-result.json"), new TypeReference>>() {})); + + + List results = aaiQueryClient.queryPathed( + new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test")))); + + assertEquals(2, results.size()); + assertEquals("service-instance", results.get(1).getResourceType()); + } + + private String getJson(String filename) throws IOException { + return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename))); + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIResourcesClientTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIResourcesClientTest.java new file mode 100644 index 0000000000..4cb79ef9ad --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIResourcesClientTest.java @@ -0,0 +1,308 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.hamcrest.CoreMatchers.containsString; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import java.util.Optional; +import javax.ws.rs.BadRequestException; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.GenericVnfs; +import org.onap.aai.domain.yang.Relationship; +import org.onap.so.client.RestClient; +import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.defaultproperties.DefaultAAIPropertiesImpl; +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryMultipleItemsException; +import com.github.tomakehurst.wiremock.admin.NotFoundException; +import com.github.tomakehurst.wiremock.junit.WireMockRule; + +@RunWith(MockitoJUnitRunner.class) +public class AAIResourcesClientTest { + + + @Rule + public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort()); + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + + @Spy + public AAIClient client; + + @InjectMocks + public AAIResourcesClient aaiClient = new AAIResourcesClient(); + + private String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/query/"; + + @Before + public void beforeTest() { + doReturn(new DefaultAAIPropertiesImpl(wireMockRule.port())).when(client).getRestProperties(); + } + + @Test + public void verifyNotExists() { + AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test"); + wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())) + .willReturn(aResponse().withHeader("Content-Type", "text/plain").withBody("hello").withStatus(404))); + AAIResourcesClient client = aaiClient; + boolean result = client.exists(path); + assertEquals("path not found", false, result); + } + + @Test + public void verifyDelete() { + AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2"); + wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("aai/resources/mockObject.json").withStatus(200))); + wireMockRule.stubFor(delete(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())) + .withQueryParam("resource-version", equalTo("1234")).willReturn(aResponse().withStatus(204))); + AAIResourcesClient client = aaiClient; + client.delete(path); + } + + @Test + public void verifyBasicAuth() { + AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3"); + wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString())) + .withHeader("Authorization", equalTo("Basic dGVzdDp0ZXN0")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("aai/resources/mockObject.json").withStatus(200))); + AAIResourcesClient client = aaiClient; + client.get(path); + } + + @Test + public void verifyConnect() { + AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2"); + AAIResourceUri path2 = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3"); + wireMockRule.stubFor( + put(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build() + "/relationship-list/relationship")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(200))); + + AAIResourceUri pathClone = path.clone(); + AAIResourcesClient client = aaiClient; + client.connect(path, path2); + assertEquals("uri not modified", pathClone.build().toString(), path.build().toString()); + } + + @Test + public void verifyDisconnect() { + AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2"); + AAIResourceUri path2 = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3"); + + wireMockRule.stubFor( + delete(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build() + "/relationship-list/relationship")) + .willReturn(aResponse().withStatus(204))); + + AAIResourceUri pathClone = path.clone(); + AAIResourcesClient client = aaiClient; + client.disconnect(path, path2); + assertEquals("uri not modified", pathClone.build().toString(), path.build().toString()); + } + + @Test + public void verifyPatch() { + AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2"); + + wireMockRule.stubFor(post(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())) + .willReturn(aResponse().withStatus(200))); + + AAIResourcesClient client = aaiClient; + + client.update(path, "{}"); + } + + @Test + public void verifyNotExistsGet() { + AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test"); + wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())) + .willReturn(aResponse().withHeader("Content-Type", "text/plain").withBody("hello").withStatus(404))); + AAIResourcesClient client = aaiClient; + AAIResultWrapper result = client.get(path); + assertEquals("is empty", true, result.isEmpty()); + } + + @Test + public void verifyNotExistsGetException() { + AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test"); + wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())) + .willReturn(aResponse().withHeader("Content-Type", "text/plain").withBody("hello").withStatus(404))); + AAIResourcesClient client = aaiClient; + thrown.expect(NotFoundException.class); + thrown.expectMessage(containsString(path.build() + " not found in A&AI")); + AAIResultWrapper result = client.get(path, NotFoundException.class); + } + + @Test + public void verifyFailedCallException() { + AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test"); + wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())).willReturn(aResponse() + .withHeader("Content-Type", "text/plain").withBodyFile("aai/error-message.json").withStatus(400))); + AAIResourcesClient client = aaiClient; + + thrown.expect(BadRequestException.class); + thrown.expectMessage(containsString( + "Invalid input performing PUT on url (msg=Precondition Required:resource-version not passed for update of url")); + AAIResultWrapper result = client.get(path); + } + + @Test + public void buildRelationshipTest() { + AAIResourcesClient client = aaiClient; + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test"); + Relationship relationship = new Relationship(); + relationship.setRelatedLink(uri.build().toString()); + Relationship actual = client.buildRelationship(uri); + assertThat("expect equal no label", actual, sameBeanAs(relationship)); + + relationship.setRelationshipLabel(AAIEdgeLabel.USES.toString()); + actual = client.buildRelationship(uri, AAIEdgeLabel.USES); + assertThat("expect equal has label", actual, sameBeanAs(relationship)); + + } + + @Test + public void testGetOne() { + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("my-vnf-id"); + GenericVnfs vnfs = new GenericVnfs(); + vnfs.getGenericVnf().add(vnf); + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF); + RestClient restClientMock = mock(RestClient.class); + doReturn(restClientMock).when(client).createClient(uri); + when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs)); + + Optional result = aaiClient.getOne(GenericVnfs.class, GenericVnf.class, uri); + + assertEquals("my-vnf-id", result.get().getVnfId()); + } + + @Test + public void testGetOneMultipleResults() { + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("my-vnf-id"); + GenericVnf vnf2 = new GenericVnf(); + vnf.setVnfId("my-vnf-id2"); + GenericVnfs vnfs = new GenericVnfs(); + vnfs.getGenericVnf().add(vnf); + vnfs.getGenericVnf().add(vnf2); + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF); + RestClient restClientMock = mock(RestClient.class); + doReturn(restClientMock).when(client).createClient(uri); + when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs)); + + thrown.expect(GraphInventoryMultipleItemsException.class); + aaiClient.getOne(GenericVnfs.class, GenericVnf.class, uri); + } + + @Test + public void testGetFirstMultipleResults() { + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("my-vnf-id"); + GenericVnf vnf2 = new GenericVnf(); + vnf2.setVnfId("my-vnf-id2"); + GenericVnfs vnfs = new GenericVnfs(); + vnfs.getGenericVnf().add(vnf); + vnfs.getGenericVnf().add(vnf2); + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF); + RestClient restClientMock = mock(RestClient.class); + doReturn(restClientMock).when(client).createClient(uri); + when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs)); + + Optional result = aaiClient.getFirst(GenericVnfs.class, GenericVnf.class, uri); + + assertEquals("my-vnf-id", result.get().getVnfId()); + } + + @Test + public void testGetOneNoResults() { + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("my-vnf-id"); + GenericVnfs vnfs = new GenericVnfs(); + vnfs.getGenericVnf().add(vnf); + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF); + RestClient restClientMock = mock(RestClient.class); + doReturn(restClientMock).when(client).createClient(uri); + when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.empty()); + + Optional result = aaiClient.getOne(GenericVnfs.class, GenericVnf.class, uri); + + assertFalse(result.isPresent()); + } + + @Test + public void testGetFirstNoResults() { + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("my-vnf-id"); + GenericVnfs vnfs = new GenericVnfs(); + vnfs.getGenericVnf().add(vnf); + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF); + RestClient restClientMock = mock(RestClient.class); + doReturn(restClientMock).when(client).createClient(uri); + when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.empty()); + + Optional result = aaiClient.getFirst(GenericVnfs.class, GenericVnf.class, uri); + + assertFalse(result.isPresent()); + } + + @Test + public void testGetFirstWrongPluralClass() { + GenericVnf vnf = new GenericVnf(); + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF); + RestClient restClientMock = mock(RestClient.class); + doReturn(restClientMock).when(client).createClient(uri); + when(restClientMock.get(GenericVnf.class)).thenReturn(Optional.of(vnf)); + + Optional result = aaiClient.getFirst(GenericVnf.class, GenericVnf.class, uri); + + assertFalse(result.isPresent()); + } + +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java new file mode 100644 index 0000000000..9e0825bbb5 --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java @@ -0,0 +1,121 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; +import java.util.List; +import java.util.Optional; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.entities.uri.ServiceInstanceUri; +import org.onap.aaiclient.client.defaultproperties.DefaultAAIPropertiesImpl; +import com.github.tomakehurst.wiremock.junit.WireMockRule; + +@RunWith(MockitoJUnitRunner.class) +public class AAIResourcesClientWithServiceInstanceUriTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort()); + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Spy + public AAIClient client; + + @InjectMocks + public AAIResourcesClient aaiClient = new AAIResourcesClient(); + + private ServiceInstanceUri uri; + + @Before + public void setUp() { + doReturn(new DefaultAAIPropertiesImpl(wireMockRule.port())).when(client).getRestProperties(); + wireMockRule.stubFor(get(urlMatching("/aai/v[0-9]+/nodes.*")).willReturn( + aResponse().withStatus(404).withHeader("Content-Type", "application/json").withHeader("Mock", "true"))); + + uri = spy((ServiceInstanceUri) AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "id")); + doReturn(aaiClient).when(uri).getResourcesClient(); + } + + @Test + public void getWithClass() { + AAIResourcesClient client = aaiClient; + Optional result = client.get(String.class, uri); + + assertThat(result.isPresent(), equalTo(false)); + } + + @Test + public void getFullResponse() { + AAIResourcesClient client = aaiClient; + Response result = client.getFullResponse(uri); + assertThat(result.getStatus(), equalTo(Status.NOT_FOUND.getStatusCode())); + } + + @Test + public void getWithGenericType() { + AAIResourcesClient client = aaiClient; + Optional> result = client.get(new GenericType>() {}, uri); + assertThat(result.isPresent(), equalTo(false)); + } + + @Test + public void getAAIWrapper() { + AAIResourcesClient client = aaiClient; + AAIResultWrapper result = client.get(uri); + assertThat(result.isEmpty(), equalTo(true)); + } + + @Test + public void getWithException() { + AAIResourcesClient client = aaiClient; + this.thrown.expect(IllegalArgumentException.class); + AAIResultWrapper result = client.get(uri, IllegalArgumentException.class); + } + + @Test + public void existsTest() { + AAIResourcesClient client = aaiClient; + doReturn(uri).when(uri).clone(); + boolean result = client.exists(uri); + assertThat(result, equalTo(false)); + } + +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIRestClientTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIRestClientTest.java new file mode 100644 index 0000000000..86738beabb --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIRestClientTest.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import static org.hamcrest.CoreMatchers.containsString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import java.net.URI; +import java.net.URISyntaxException; +import javax.ws.rs.core.Response; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.so.client.RestClientSSL; +import org.onap.aaiclient.client.graphinventory.GraphInventoryPatchConverter; +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException; +import com.fasterxml.jackson.databind.ObjectMapper; + +@RunWith(MockitoJUnitRunner.class) +public class AAIRestClientTest { + + @Mock + private AAIProperties props; + + private ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper(); + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Test + public void failPatchOnComplexObject() throws URISyntaxException { + AAIRestClient client = new AAIRestClient(props, new URI("")); + this.thrown.expect(GraphInventoryPatchDepthExceededException.class); + this.thrown.expectMessage(containsString("Object exceeds allowed depth for update action")); + client.patch( + "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"relationship-list\" : [{\"key\" : \"value\"}], \"nested\" : { \"key\" : \"value\" }}"); + } + + @Test + public void verifyPatchValidation() throws URISyntaxException { + AAIRestClient client = new AAIRestClient(props, new URI("")); + AAIRestClient spy = spy(client); + GraphInventoryPatchConverter patchValidatorMock = mock(GraphInventoryPatchConverter.class); + doReturn(patchValidatorMock).when(spy).getPatchConverter(); + String payload = "{}"; + doReturn(Response.ok().build()).when(spy).method(eq("PATCH"), any()); + spy.patch(payload); + verify(patchValidatorMock, times(1)).convertPatchFormat(eq((Object) payload)); + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAISingleTransactionClientTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAISingleTransactionClientTest.java new file mode 100644 index 0000000000..0820397fd6 --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAISingleTransactionClientTest.java @@ -0,0 +1,140 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.Matchers.greaterThan; +import static org.junit.Assert.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import javax.ws.rs.core.GenericType; +import org.json.JSONException; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.aai.domain.yang.Pserver; +import org.onap.aai.domain.yang.v9.Complex; +import org.onap.aaiclient.client.aai.entities.singletransaction.SingleTransactionRequest; +import org.onap.aaiclient.client.aai.entities.singletransaction.SingleTransactionResponse; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.GraphInventoryPatchConverter; +import org.skyscreamer.jsonassert.JSONAssert; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +@RunWith(MockitoJUnitRunner.class) +public class AAISingleTransactionClientTest { + + private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/singletransaction/"; + AAIResourceUri uriA = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "pserver-hostname"); + AAIResourceUri uriB = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, "my-complex"); + AAIResourceUri uriC = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, "my-complex2"); + + ObjectMapper mapper; + + public AAIClient client = new AAIClient(); + + @Spy + public AAIResourcesClient aaiClient = new AAIResourcesClient(); + + @Before + public void before() throws JsonParseException, JsonMappingException, IOException { + mapper = new AAICommonObjectMapperProvider().getMapper(); + mapper.enable(SerializationFeature.INDENT_OUTPUT); + } + + @Test + public void testRequest() throws JSONException, IOException { + Pserver pserver = new Pserver(); + pserver.setHostname("pserver-hostname"); + pserver.setFqdn("pserver-bulk-process-single-transactions-multiple-actions-1-fqdn"); + Pserver pserver2 = new Pserver(); + pserver2.setFqdn("patched-fqdn"); + Complex complex = new Complex(); + complex.setCity("my-city"); + Map map = new HashMap<>(); + map.put("resource-version", "1234"); + doReturn(Optional.of(map)).when(aaiClient).get(any(GenericType.class), eq(uriC)); + AAISingleTransactionClient singleTransaction = aaiClient.beginSingleTransaction().create(uriA, pserver) + .update(uriA, pserver2).create(uriB, complex).delete(uriC); + + SingleTransactionRequest actual = singleTransaction.getRequest(); + + SingleTransactionRequest expected = + mapper.readValue(this.getJson("sample-request.json"), SingleTransactionRequest.class); + + JSONAssert.assertEquals(mapper.writeValueAsString(expected), mapper.writeValueAsString(actual), false); + } + + @Test + public void testFailure() throws IOException { + AAISingleTransactionClient singleTransaction = aaiClient.beginSingleTransaction(); + SingleTransactionResponse expected = + mapper.readValue(this.getJson("sample-response-failure.json"), SingleTransactionResponse.class); + Optional errorMessage = singleTransaction.locateErrorMessages(expected); + + assertThat(expected.getOperationResponses().size(), greaterThan(0)); + assertThat(errorMessage.isPresent(), equalTo(true)); + + } + + @Test + public void testSuccessResponse() throws IOException { + AAISingleTransactionClient singleTransaction = aaiClient.beginSingleTransaction(); + SingleTransactionResponse expected = + mapper.readValue(this.getJson("sample-response.json"), SingleTransactionResponse.class); + Optional errorMessage = singleTransaction.locateErrorMessages(expected); + + assertThat(expected.getOperationResponses().size(), greaterThan(0)); + assertThat(errorMessage.isPresent(), equalTo(false)); + + } + + @Test + public void confirmPatchFormat() { + AAISingleTransactionClient singleTransaction = spy(new AAISingleTransactionClient(aaiClient, client)); + GraphInventoryPatchConverter mock = mock(GraphInventoryPatchConverter.class); + doReturn(mock).when(singleTransaction).getPatchConverter(); + singleTransaction.update(uriA, "{}"); + verify(mock, times(1)).convertPatchFormat(any()); + } + + private String getJson(String filename) throws IOException { + return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename))); + } + +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAITransactionalClientTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAITransactionalClientTest.java new file mode 100644 index 0000000000..bf2417141f --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAITransactionalClientTest.java @@ -0,0 +1,174 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.ws.rs.core.GenericType; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.aai.domain.yang.Relationship; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.GraphInventoryPatchConverter; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +@RunWith(MockitoJUnitRunner.class) +public class AAITransactionalClientTest { + + private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/bulkprocess/"; + AAIResourceUri uriA = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1"); + AAIResourceUri uriB = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test2"); + AAIResourceUri uriC = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3"); + AAIResourceUri uriD = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test4"); + AAIResourceUri uriE = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test5"); + AAIResourceUri uriF = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test6"); + AAIResourceUri uriG = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test7"); + + ObjectMapper mapper; + + public AAIClient client = new AAIClient(); + + @Spy + public AAIResourcesClient aaiClient = new AAIResourcesClient(); + + @Before + public void before() throws JsonParseException, JsonMappingException, IOException { + mapper = new AAICommonObjectMapperProvider().getMapper(); + mapper.enable(SerializationFeature.INDENT_OUTPUT); + } + + @Test + public void testCreate() throws IOException { + final Relationship body = new Relationship(); + body.setRelatedLink(uriB.build().toString()); + + AAITransactionalClient transactions = aaiClient.beginTransaction().create(uriA.clone().relationshipAPI(), body); + + String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions()); + Map actual = + mapper.readValue(serializedTransactions, new TypeReference>() {}); + Map expected = + mapper.readValue(getJson("test-request-small.json"), new TypeReference>() {}); + + assertEquals(actual, expected); + } + + @Test + public void testConnect() throws IOException { + List uris = new ArrayList<>(); + uris.add(uriB); + + Map map = new HashMap<>(); + map.put("resource-version", "1234"); + doReturn(Optional.of(map)).when(aaiClient).get(any(GenericType.class), eq(uriG)); + AAIResourceUri uriAClone = uriA.clone(); + AAITransactionalClient transactions = aaiClient.beginTransaction().connect(uriA, uris).connect(uriC, uriD) + .beginNewTransaction().connect(uriE, uriF).beginNewTransaction().delete(uriG); + + String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions()); + Map actual = + mapper.readValue(serializedTransactions, new TypeReference>() {}); + Map expected = + mapper.readValue(getJson("test-request.json"), new TypeReference>() {}); + + assertEquals(actual, expected); + assertEquals("uri not manipulated", uriAClone.build().toString(), uriA.build().toString()); + } + + @Test + public void testDisconnect() throws IOException { + List uris = new ArrayList<>(); + uris.add(uriB); + + AAITransactionalClient transactions = aaiClient.beginTransaction().disconnect(uriA, uris); + + String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions()); + Map actual = + mapper.readValue(serializedTransactions, new TypeReference>() {}); + Map expected = mapper.readValue(getJson("test-request-small.json").replace("put", "delete"), + new TypeReference>() {}); + + assertEquals(actual, expected); + } + + @Test + public void testUpdate() throws IOException { + final Relationship body = new Relationship(); + body.setRelatedLink(uriB.build().toString()); + + AAIResourceUri uriAClone = uriA.clone().relationshipAPI(); + AAITransactionalClient transactions = aaiClient.beginTransaction().update(uriAClone, body); + + String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions()); + Map actual = + mapper.readValue(serializedTransactions, new TypeReference>() {}); + Map expected = mapper.readValue(getJson("test-request-small.json").replace("put", "patch"), + new TypeReference>() {}); + + assertEquals(actual, expected); + } + + @Test + public void verifyResponse() throws IOException { + AAITransactionalClient transactions = aaiClient.beginTransaction(); + + assertEquals("success status", Optional.empty(), + transactions.locateErrorMessages(getJson("response-success.json"))); + assertEquals(transactions.locateErrorMessages(getJson("response-failure.json")).get(), + "another error message\nmy great error"); + } + + @Test + public void confirmPatchFormat() { + AAITransactionalClient transactionClient = spy(new AAITransactionalClient(aaiClient, client)); + GraphInventoryPatchConverter mock = mock(GraphInventoryPatchConverter.class); + doReturn(mock).when(transactionClient).getPatchConverter(); + transactionClient.update(uriA, "{}"); + verify(mock, times(1)).convertPatchFormat(any()); + } + + private String getJson(String filename) throws IOException { + return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename))); + } + +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIURITest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIURITest.java new file mode 100644 index 0000000000..f2bd188ab3 --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIURITest.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import static org.junit.Assert.assertEquals; +import javax.ws.rs.core.UriBuilder; +import org.junit.Test; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; + +public class AAIURITest { + + + + @Test + public void verifyTemplateReplacement() { + final String id = "test1"; + AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, id); + String manualReplace = AAIObjectType.CONFIGURATION.toString().replaceAll("\\{configuration-id\\}", id); + assertEquals("uri template replaced", aaiUri.build(), UriBuilder.fromPath(manualReplace).build()); + + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIUpdatorImplTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIUpdatorImplTest.java new file mode 100644 index 0000000000..fd1e60fbdb --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIUpdatorImplTest.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.aaiclient.client.aai; + +import org.junit.Test; + +public class AAIUpdatorImplTest { + + AAIUpdatorImpl test = new AAIUpdatorImpl(); + + protected AAIRestClientI client; + + @Test + public void getClientTest() throws Exception { + test.getClient(); + } + + @Test + public void setClientTest() throws Exception { + test.setClient(client); + } + + + @Test(expected = NullPointerException.class) + public void updateVnfToLockedTest() throws Exception { + test.updateVnfToLocked("vnfId"); + } + + + @Test(expected = NullPointerException.class) + public void updateVnfToUnLockedTest() throws Exception { + test.updateVnfToUnLocked("vnfId"); + } + +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIUpdatorTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIUpdatorTest.java new file mode 100644 index 0000000000..323ad67bae --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIUpdatorTest.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import static org.mockito.ArgumentMatchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class AAIUpdatorTest { + + @Mock + protected AAIRestClientI client; + String vnfName = "testVnf"; + AAIUpdatorImpl updator; + + @Before + public void init() { + updator = new AAIUpdatorImpl(); + updator.setClient(client); + } + + @Test + public void testUpdateVnfToLocked() throws Exception { + doNothing().when(client).updateMaintenceFlagVnfId(isA(String.class), isA(Boolean.class)); + updator.updateVnfToLocked(vnfName); + verify(client, times(1)).updateMaintenceFlagVnfId(vnfName, true); + } + + @Test + public void testUpdateVnfToUnLocked() throws Exception { + doNothing().when(client).updateMaintenceFlagVnfId(isA(String.class), isA(Boolean.class)); + updator.updateVnfToUnLocked(vnfName); + verify(client, times(1)).updateMaintenceFlagVnfId(vnfName, false); + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIValidatorTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIValidatorTest.java new file mode 100644 index 0000000000..ec3ab1e6c3 --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIValidatorTest.java @@ -0,0 +1,113 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.Pserver; + +@RunWith(MockitoJUnitRunner.class) +public class AAIValidatorTest { + + @Mock + protected AAIRestClientI client; + String vnfName = "testVnf"; + String uuid = "UUID"; + AAIValidatorImpl validator; + + @Before + public void init() { + validator = new AAIValidatorImpl(); + validator.setClient(client); + } + + public List getPserversLocked() { + Pserver pserver1 = new Pserver(); + pserver1.setInMaint(true); + Pserver pserver2 = new Pserver(); + pserver2.setInMaint(false); + List pservers = new ArrayList(); + pservers.add(pserver1); + pservers.add(pserver2); + return pservers; + } + + public List getPserversNotLocked() { + Pserver pserver1 = new Pserver(); + pserver1.setInMaint(false); + Pserver pserver2 = new Pserver(); + pserver2.setInMaint(false); + List pservers = new ArrayList(); + pservers.add(pserver1); + pservers.add(pserver2); + return pservers; + } + + public GenericVnf createGenericVnfs(boolean locked) { + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setInMaint(locked); + return genericVnf; + } + + @Test + public void test_IsPhysicalServerLocked_True() throws IOException { + when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(getPserversLocked()); + boolean locked = validator.isPhysicalServerLocked(vnfName); + assertEquals(true, locked); + } + + @Test + public void test_IsPhysicalServerLocked_False() throws IOException { + when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(getPserversNotLocked()); + boolean locked = validator.isPhysicalServerLocked(vnfName); + assertEquals(false, locked); + } + + @Test + public void test_IsPhysicalServerLocked_NoServers_False() throws IOException { + when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(null); + boolean locked = validator.isPhysicalServerLocked(vnfName); + assertEquals(false, locked); + } + + @Test + public void test_IsVNFLocked_False() { + when(client.getVnfByName(vnfName)).thenReturn(createGenericVnfs(false)); + boolean locked = validator.isVNFLocked(vnfName); + assertEquals(false, locked); + } + + @Test + public void test_IsVNFLocked_True() { + when(client.getVnfByName(vnfName)).thenReturn(createGenericVnfs(true)); + boolean locked = validator.isVNFLocked(vnfName); + assertEquals(true, locked); + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/DSLQueryBuilderTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/DSLQueryBuilderTest.java new file mode 100644 index 0000000000..965770c796 --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/DSLQueryBuilderTest.java @@ -0,0 +1,149 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.aaiclient.client.aai; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.junit.Test; +import org.onap.aaiclient.client.graphinventory.entities.DSLNodeKey; +import org.onap.aaiclient.client.graphinventory.entities.DSLQueryBuilder; +import org.onap.aaiclient.client.graphinventory.entities.DSLStartNode; +import org.onap.aaiclient.client.graphinventory.entities.Output; +import org.onap.aaiclient.client.graphinventory.entities.Start; +import org.onap.aaiclient.client.graphinventory.entities.TraversalBuilder; +import org.onap.aaiclient.client.graphinventory.entities.__; + +public class DSLQueryBuilderTest { + + @Test + public void whereTest() { + DSLQueryBuilder builder = TraversalBuilder.fragment(new DSLStartNode(AAIObjectType.CLOUD_REGION, + __.key("cloud-owner", "att-nc"), __.key("cloud-region-id", "test"))); + + builder.to(__.node(AAIObjectType.VLAN_TAG)) + .where(__.node(AAIObjectType.OWNING_ENTITY, __.key("owning-entity-name", "name"))) + .to(__.node(AAIObjectType.VLAN_TAG, __.key("vlan-id-outer", "108")).output()); + + assertEquals("cloud-region('cloud-owner', 'att-nc')('cloud-region-id', 'test') > " + + "vlan-tag (> owning-entity('owning-entity-name', 'name')) > " + "vlan-tag*('vlan-id-outer', '108')", + builder.build().get()); + } + + @Test + public void unionTest() { + DSLQueryBuilder builder = TraversalBuilder + .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output()); + + builder.union(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()), + __.node(AAIObjectType.VSERVER) + .to(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()))); + + assertEquals( + "generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, " + "vserver > pserver* > complex* ]", + builder.build().get()); + } + + @Test + public void whereUnionTest() { + DSLQueryBuilder builder = TraversalBuilder + .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output()); + + builder.where(__.union(__.node(AAIObjectType.PSERVER, __.key("hostname", "hostname1")), + __.node(AAIObjectType.VSERVER).to(__.node(AAIObjectType.PSERVER, __.key("hostname", "hostname1"))))); + + assertEquals("generic-vnf*('vnf-id', 'vnfId') (> [ pserver('hostname', 'hostname1'), " + + "vserver > pserver('hostname', 'hostname1') ])", builder.build().get()); + } + + @Test + public void notNullTest() { + DSLQueryBuilder builder = TraversalBuilder.traversal( + new DSLStartNode(AAIObjectType.CLOUD_REGION, __.key("cloud-owner", "", "null").not()).output()); + + assertEquals("cloud-region* !('cloud-owner', ' ', ' null ')", builder.build().get()); + } + + @Test + public void shortCutToTest() { + DSLQueryBuilder builder = TraversalBuilder + .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output()); + + builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id")); + assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')", + builder.build().get()); + } + + @Test + public void limitTest() { + DSLQueryBuilder builder = TraversalBuilder + .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output()); + + builder.to(AAIObjectType.P_INTERFACE).limit(2).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id")); + assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id') LIMIT 2", + builder.build().get()); + } + + @Test + public void equalsTest() { + DSLQueryBuilder builder = TraversalBuilder + .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output()); + + builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id")); + assertTrue( + builder.equals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')")); + assertTrue(builder.equals(builder)); + } + + @Test + public void mixedTypeTest() { + DSLQueryBuilder builder = TraversalBuilder.fragment(new DSLStartNode(AAIObjectType.CLOUD_REGION, + __.key("cloud-owner", "owner"), __.key("cloud-region-id", "id"))); + builder.to(__.node(AAIObjectType.VLAN_TAG, __.key("vlan-id-outer", 167), __.key("my-boolean", true)).output()); + assertTrue(builder.equals( + "cloud-region('cloud-owner', 'owner')('cloud-region-id', 'id') > vlan-tag*('vlan-id-outer', 167)('my-boolean', true)")); + } + + @Test + public void outputOnNodeLambdasTest() { + DSLQueryBuilder builder = TraversalBuilder + .fragment(new DSLStartNode(AAIObjectType.L_INTERFACE, new DSLNodeKey("interface-id", "myId"))); + + builder.to(AAIObjectType.VSERVER, __.key("vserver-name", "myName")).output().to(AAIObjectType.P_INTERFACE) + .output(); + assertEquals("l-interface('interface-id', 'myId') > vserver*('vserver-name', 'myName') > p-interface*", + builder.build().get()); + } + + @Test + public void skipOutputOnUnionTest() { + DSLQueryBuilder builder = TraversalBuilder + .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output()); + + builder.union(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()), + __.node(AAIObjectType.VSERVER) + .to(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()))) + .output(); + + assertEquals( + "generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, " + "vserver > pserver* > complex* ]", + builder.build().get()); + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/AAIResultWrapperTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/AAIResultWrapperTest.java new file mode 100644 index 0000000000..adc2e7284e --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/AAIResultWrapperTest.java @@ -0,0 +1,110 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities; + +import static org.junit.Assert.assertEquals; +import java.io.IOException; +import java.io.Serializable; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.springframework.util.SerializationUtils; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +@RunWith(MockitoJUnitRunner.class) +public class AAIResultWrapperTest { + String json; + @Rule + public ExpectedException thrown = ExpectedException.none(); + + AAIResultWrapper aaiResultWrapper; + AAIResultWrapper aaiResultWrapperEmpty; + + @Before + public void init() throws IOException { + final String RESOURCE_PATH = "src/test/resources/__files/aai/resources/"; + json = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "e2e-complex.json"))); + + aaiResultWrapper = new AAIResultWrapper(json); + aaiResultWrapperEmpty = new AAIResultWrapper("{}"); + } + + @Test + public void testAAIResultWrapperIsSerializable() throws IOException { + AAIResultWrapper original = new AAIResultWrapper(""); + byte[] serialized = SerializationUtils.serialize(original); + AAIResultWrapper deserialized = (AAIResultWrapper) SerializationUtils.deserialize(serialized); + assertEquals(deserialized.getJson(), original.getJson()); + } + + @Test + public void testGetRelationshipsEmpty() { + Optional relationships = aaiResultWrapperEmpty.getRelationships(); + assertEquals("Compare relationships", Optional.empty(), relationships); + } + + @Test + public void testAsMap() throws JsonParseException, JsonMappingException, IOException { + ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper(); + Map expected = mapper.readValue(json, new TypeReference>() {}); + + Map actual = aaiResultWrapper.asMap(); + assertEquals(expected, actual); + } + + @Test + public void testAsMapEmpty() { + Map actual = aaiResultWrapperEmpty.asMap(); + assertEquals(new HashMap<>(), actual); + } + + @Test + public void nullCases() { + + AAIResultWrapper wrapper = new AAIResultWrapper(null); + + assertEquals(Optional.empty(), wrapper.getRelationships()); + assertEquals("{}", wrapper.getJson()); + assertEquals(Optional.empty(), wrapper.asBean(GenericVnf.class)); + assertEquals(true, wrapper.asMap().isEmpty()); + assertEquals("{}", wrapper.toString()); + + } + + @Test + public void objectConstructor() { + AAIResultWrapper wrapper = new AAIResultWrapper(new GenericVnf()); + assertEquals("{}", wrapper.getJson()); + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/RelationshipsTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/RelationshipsTest.java new file mode 100644 index 0000000000..10162f83ee --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/RelationshipsTest.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities; + +import static org.junit.Assert.assertTrue; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.List; +import org.junit.Test; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; + +public class RelationshipsTest { + + private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/resources/"; + + @Test + public void run() throws IOException { + final String content = new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "e2e-complex.json"))); + + AAIResultWrapper wrapper = new AAIResultWrapper(content); + Relationships relationships = wrapper.getRelationships().get(); + + List test = relationships.getRelatedUris(AAIObjectType.VCE); + List uris = Arrays.asList( + AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a9fec18e-1ea3-40e4-a6c0-a89b3de07053"), + AAIUriFactory.createResourceUri(AAIObjectType.VCE, "8ae1e5f8-61f1-4c71-913a-b40cc4593cb9"), + AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a2935fa9-b743-49f4-9813-a127f13c4e93"), + AAIUriFactory.createResourceUri(AAIObjectType.VCE, "c7fe7698-8063-4e26-8bd3-ca3edde0b0d4")); + + assertTrue(uris.containsAll(test) && test.containsAll(uris)); + + } + +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java new file mode 100644 index 0000000000..3823392b01 --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.uri; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; +import org.onap.aaiclient.client.aai.AAIObjectType; + +public class AAISimpleUriFromParentUriTest { + + + @Test + public void appendChildren() { + + AAIResourceUri parentUri = + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "key1", "key2", "key3"); + + AAIResourceUri uri = new AAISimpleUri(parentUri, AAIObjectType.ALLOTTED_RESOURCE, "key4"); + + assertEquals("path appended", + "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4", + uri.build().toString()); + + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriFromUriTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriFromUriTest.java new file mode 100644 index 0000000000..9030789cfd --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriFromUriTest.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.uri; + +import static org.junit.Assert.assertEquals; +import javax.ws.rs.core.UriBuilder; +import org.junit.Test; +import org.onap.aaiclient.client.aai.AAIObjectType; + +public class AAISimpleUriFromUriTest { + + + + @Test + public void removeHost() { + + AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN, + UriBuilder + .fromUri("https://localhost:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053") + .build()); + + assertEquals("root and version removed", "/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", + uri.build().toString()); + + } + + @Test + public void noChange() { + + AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN, + UriBuilder.fromUri("/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053").build()); + + assertEquals("no change", "/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", uri.build().toString()); + + } + + @Test + public void encodingPreserved() { + + AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN, + UriBuilder.fromUri("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053").build()); + + assertEquals("encoding preserved", "/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053", + uri.build().toString()); + + } + + @Test + public void beforeBuildEquality() { + + AAIResourceUri uri = new AAISimpleUri(AAIObjectType.VCE, + UriBuilder.fromUri("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053").build()); + + AAIResourceUri uri2 = new AAISimpleUri(AAIObjectType.VCE, "a9f ec18e-1ea3-40e4-a6c0-a89b3de07053"); + assertEquals("are equal", uri2, uri); + + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriTest.java new file mode 100644 index 0000000000..3b11c01436 --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriTest.java @@ -0,0 +1,133 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.uri; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.Map; +import org.junit.Test; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; + +public class AAISimpleUriTest { + + + + @Test + public void relatedToTestPlural() { + AAIPluralResourceUri uri = + AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1").relatedTo(AAIObjectPlurals.PSERVER); + String uriOutput = uri.build().toString(); + assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers", uriOutput); + } + + @Test + public void relatedToTestSingular() { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1") + .relatedTo(AAIObjectType.PSERVER, "test2"); + String uriOutput = uri.build().toString(); + assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers/pserver/test2", uriOutput); + } + + @Test + public void cloneTestSingular() { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1"); + AAIResourceUri cloned = uri.clone(); + assertEquals("/network/generic-vnfs/generic-vnf/test1", cloned.build().toString()); + + cloned.limit(2); + + assertNotEquals(uri.build().toString(), cloned.build().toString()); + } + + @Test + public void cloneTestPlural() { + AAISimplePluralUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF); + AAISimplePluralUri cloned = uri.clone(); + assertEquals("/network/generic-vnfs", cloned.build().toString()); + } + + @Test + public void cloneTestWithRelatedTo() { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1") + .relatedTo(AAIObjectType.PSERVER, "test2"); + String uriOutput = uri.clone().build().toString(); + assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers/pserver/test2", uriOutput); + } + + @Test + public void cloneTestPluralWithRelatedTo() { + AAIPluralResourceUri uri = + AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1").relatedTo(AAIObjectPlurals.PSERVER); + String uriOutput = uri.clone().build().toString(); + assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers", uriOutput); + } + + @Test + public void getKeysTest() { + AAIResourceUri uri = + AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, "cloud1", "cloud2", "tenant1", "vserver1"); + Map keys = uri.getURIKeys(); + System.out.println(keys); + System.out.println(uri.build()); + assertEquals("vserver1", keys.get("vserver-id")); + } + + @Test + public void getEncodedKeyTest() { + AAIResourceUri uri = + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "test1", "my value", "test3"); + Map keys = uri.getURIKeys(); + + assertEquals("my value", keys.get("service-type")); + } + + @Test + public void serializeTest() throws IOException, ClassNotFoundException { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1"); + + uri.depth(Depth.ONE); + uri.limit(1); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + ObjectOutputStream objectOutputStream = new ObjectOutputStream(bos); + objectOutputStream.writeObject(uri); + objectOutputStream.flush(); + objectOutputStream.close(); + + ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); + + ObjectInputStream objectInputStream = new ObjectInputStream(bis); + AAIResourceUri e2 = (AAIResourceUri) objectInputStream.readObject(); + objectInputStream.close(); + + uri.queryParam("test", "value"); + e2.queryParam("test", "value"); + + assertEquals(e2.build().toString(), uri.build().toString()); + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactoryTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactoryTest.java new file mode 100644 index 0000000000..ec40b1b477 --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactoryTest.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.uri; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; + +public class AAIUriFactoryTest { + + @Test + public void testCreateResourceUri() { + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)"); + + String expected = "/network/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29"; + assertEquals(expected, uri.build().toString()); + } + + @Test + public void testCreateNodesUri() { + + AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)"); + + String expected = "/nodes/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29"; + assertEquals(expected, uri.build().toString()); + } + + @Test + public void testCreateResourceFromExistingURI() { + + AAIResourceUri uri = new AAISimpleUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)"); + AAIResourceUri uri2 = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.GENERIC_VNF, uri.build()); + + String expected = "/network/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29"; + assertEquals(expected, uri2.build().toString()); + } + + @Test + public void testCreateResourceURIForPluralsWithValues() { + + AAIPluralResourceUri uri = + AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, "customerId", "serviceType"); + + String expected = + "/business/customers/customer/customerId/service-subscriptions/service-subscription/serviceType/service-instances"; + assertEquals(expected, uri.build().toString()); + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUriTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUriTest.java new file mode 100644 index 0000000000..e6add8cbc1 --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUriTest.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.uri; + +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import javax.ws.rs.core.UriBuilder; +import org.junit.Test; +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryPayloadException; +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriNotFoundException; + +public class AllottedResourceLookupUriTest { + + @Test + public void oneKey() + throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException { + + AllottedResourceLookupUri instance = new AllottedResourceLookupUri("key1"); + AllottedResourceLookupUri spy = spy(instance); + doReturn( + "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4") + .when(spy).getObjectById(any(Object.class)); + + final URI result = spy.locateAndBuild(); + final URI expected = UriBuilder.fromPath( + "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4") + .build(); + assertEquals("result is equal", expected, result); + + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java new file mode 100644 index 0000000000..2cbf5bb090 --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.aaiclient.client.aai.entities.uri; + +import static org.hamcrest.CoreMatchers.equalTo; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.graphinventory.exceptions.IncorrectNumberOfUriKeys; + +public class IncorrectNumberOfUriKeysTest { + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Test + public void verifyIncorrectNumberOfKeysSingle() { + + thrown.expect(IncorrectNumberOfUriKeys.class); + thrown.expectMessage(equalTo("Expected 3 variables: [cloud-owner, cloud-region-id, volume-group-id]")); + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, "volume-group-id"); + + } + + @Test + public void verifyIncorrectNumberOfKeysPlural() { + + thrown.expect(IncorrectNumberOfUriKeys.class); + AAISimplePluralUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, "my-cloud-owner"); + + } + + @Test + public void verifyIncorrectNumberOfKeysFromParent() { + + thrown.expect(IncorrectNumberOfUriKeys.class); + AAIResourceUri parentUri = + AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, "my-cloud-owner", "my-cloud-region-id"); + AAIResourceUri uri = AAIUriFactory.createResourceFromParentURI(parentUri, AAIObjectType.VOLUME_GROUP); + } + + @Test + public void verifyIncorrectNumberOfKeysHttpAware() { + + thrown.expect(IncorrectNumberOfUriKeys.class); + AAIResourceUri uri = + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "customer-id", "subscription-id"); + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUriTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUriTest.java new file mode 100644 index 0000000000..514a349095 --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUriTest.java @@ -0,0 +1,301 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.aai.entities.uri; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.collection.IsIterableContainingInOrder.contains; +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Optional; +import javax.ws.rs.NotFoundException; +import javax.ws.rs.core.UriBuilder; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.mockito.ArgumentMatchers; +import org.mockito.InjectMocks; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.aaiclient.client.aai.AAIClient; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.defaultproperties.DefaultAAIPropertiesImpl; +import org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri; +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryPayloadException; +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException; +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriNotFoundException; +import com.github.tomakehurst.wiremock.junit.WireMockRule; + +@RunWith(MockitoJUnitRunner.class) +public class ServiceInstanceUriTest { + + private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/resources/"; + + @Rule + public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort()); + + @Rule + public final ExpectedException exception = ExpectedException.none(); + + @Spy + public AAIClient client; + + @InjectMocks + public AAIResourcesClient aaiClient = new AAIResourcesClient(); + + @Before + public void beforeTest() { + doReturn(new DefaultAAIPropertiesImpl(wireMockRule.port())).when(client).getRestProperties(); + } + + @Test + public void found() throws IOException { + final String content = new String( + Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "service-instance-pathed-query.json"))); + + ServiceInstanceUri instance = new ServiceInstanceUri("key3"); + final Optional result = instance.extractRelatedLink(content); + final String expected = + "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"; + assertEquals("result is equal", expected, result.get()); + + } + + @Test + public void oneKey() + throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException { + + ServiceInstanceUri instance = new ServiceInstanceUri("key1"); + ServiceInstanceUri spy = spy(instance); + doReturn( + "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3") + .when(spy).getObjectById(any(Object.class)); + + final URI result = spy.locateAndBuild(); + final URI expected = UriBuilder.fromPath( + "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3") + .build(); + assertEquals("result is equal", expected, result); + + } + + @Test + public void oneKeyQueryParams() + throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException { + + ServiceInstanceUri instance = new ServiceInstanceUri("key1"); + ServiceInstanceUri spy = spy(instance); + doReturn( + "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3") + .when(spy).getObjectById(any(Object.class)); + + final URI result = ((HttpAwareUri) spy.resourceVersion("1234")).locateAndBuild(); + final URI expected = UriBuilder.fromUri( + "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234") + .build(); + assertEquals("result is equal", expected, result); + + } + + @Test + public void oneKeyEncoded() + throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException { + + ServiceInstanceUri instance = new ServiceInstanceUri("key1"); + ServiceInstanceUri spy = spy(instance); + doReturn( + "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space") + .when(spy).getObjectById(any(Object.class)); + + final URI result = spy.locateAndBuild(); + final URI expected = UriBuilder.fromUri( + "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space") + .build(); + assertEquals("result is equal", expected, result); + + } + + @Test + public void oneKeyGetKeys() + throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException { + + ServiceInstanceUri instance = new ServiceInstanceUri("key1"); + ServiceInstanceUri spy = spy(instance); + doReturn( + "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%28space") + .when(spy).getObjectById(any(Object.class)); + + assertThat(spy.getURIKeys().values(), contains("key1", "key2", "key3(space")); + + } + + @Test + public void oneKeyClone() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException { + ServiceInstanceUri instance = new ServiceInstanceUri("key1"); + ServiceInstanceUri spy = spy(instance); + String uri = + "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"; + doReturn(Optional.of(uri)).when(spy).getCachedValue(); + final URI result = ((HttpAwareUri) spy.resourceVersion("1234").clone()).locateAndBuild(); + final URI expected = UriBuilder.fromUri( + "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234") + .build(); + assertEquals("result is equal", expected, result); + } + + @Test + public void threeKey() throws IOException { + + ServiceInstanceUri instance = new ServiceInstanceUri("key1", "key2", "key3"); + final URI result = instance.build(); + final URI expected = UriBuilder.fromPath( + "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3") + .build(); + assertEquals("result is equal", expected, result); + + } + + @Test + public void notfound() throws IOException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException { + final String content = + new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "empty-query-result.json"))); + + ServiceInstanceUri instance = new ServiceInstanceUri("key3"); + ServiceInstanceUri spy = spy(instance); + AAIResourcesClient mockResourcesClient = mock(AAIResourcesClient.class); + AAIResultWrapper wrapper = mock(AAIResultWrapper.class); + when(mockResourcesClient.get(ArgumentMatchers.any(AAIResourceUri.class), + ArgumentMatchers.>any())).thenReturn(wrapper); + when(wrapper.getJson()).thenReturn(content); + when(spy.getResourcesClient()).thenReturn(mockResourcesClient); + exception.expect(GraphInventoryUriComputationException.class); + spy.locateAndBuild(); + + } + + @Test + public void cloneTest() { + ServiceInstanceUri instance = new ServiceInstanceUri("key1", "key2", "key3"); + final URI result = instance.build(); + final URI result2 = instance.clone().queryParam("something", "new").build(); + assertEquals("uris are not equal", false, result.toString().equals(result2.toString())); + + } + + @Test + public void noVertexFound() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException { + ServiceInstanceUri instance = new ServiceInstanceUri("key3"); + ServiceInstanceUri spy = spy(instance); + AAIResourcesClient client = aaiClient; + doReturn(client).when(spy).getResourcesClient(); + wireMockRule + .stubFor(get(urlPathMatching("/aai/v[0-9]+/nodes/service-instances/service-instance/key3")).willReturn( + aResponse().withStatus(404).withHeader("Content-Type", "application/json").withBodyFile(""))); + exception.expect(NotFoundException.class); + spy.locateAndBuild(); + } + + @Test + public void serializeTest() throws IOException, ClassNotFoundException, GraphInventoryUriNotFoundException, + GraphInventoryPayloadException { + ServiceInstanceUri instance = new ServiceInstanceUri("key3"); + final String content = new String( + Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "service-instance-pathed-query.json"))); + + ServiceInstanceUri spy = spy(instance); + AAIResourcesClient mockResourcesClient = mock(AAIResourcesClient.class); + AAIResultWrapper wrapper = mock(AAIResultWrapper.class); + when(mockResourcesClient.get(ArgumentMatchers.any(AAIResourceUri.class), + ArgumentMatchers.>any())).thenReturn(wrapper); + when(wrapper.getJson()).thenReturn(content); + when(spy.getResourcesClient()).thenReturn(mockResourcesClient); + spy.locateAndBuild(); + instance = spy.clone(); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + ObjectOutputStream objectOutputStream = new ObjectOutputStream(bos); + objectOutputStream.writeObject(instance); + objectOutputStream.flush(); + objectOutputStream.close(); + + ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); + + ObjectInputStream objectInputStream = new ObjectInputStream(bis); + ServiceInstanceUri e2 = (ServiceInstanceUri) objectInputStream.readObject(); + objectInputStream.close(); + + ServiceInstanceUri spy2 = spy(e2); + + assertEquals(spy2.build().toString(), instance.build().toString()); + + // use the cached value do not call out to external system + verify(spy2, times(0)).getResourcesClient(); + } + + @Test + public void relatedToTest() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException { + ServiceInstanceUri instance = new ServiceInstanceUri("key1"); + ServiceInstanceUri spy = spy(instance); + doReturn( + "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3") + .when(spy).getObjectById(any(Object.class)); + + final URI result = spy.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "my-vnf-name").build(); + final URI expected = UriBuilder.fromUri( + "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/related-to/generic-vnfs?vnf-name=my-vnf-name") + .build(); + assertEquals("result is equal", expected, result); + } + + @Test + public void relatedToEqualityTestBeforeBuildTest() + throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException { + ServiceInstanceUri instance = new ServiceInstanceUri("key1"); + ServiceInstanceUri spy = spy(instance); + + final AAIPluralResourceUri result = + spy.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "my-vnf-name"); + + assertEquals("result is equal", result, result); + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/objects/CustomAAIObjectType.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/objects/CustomAAIObjectType.java new file mode 100644 index 0000000000..869565084f --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/objects/CustomAAIObjectType.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.aaiclient.client.aai.objects; + +import org.onap.aaiclient.client.aai.AAINamespaceConstants; +import org.onap.aaiclient.client.aai.AAIObjectType; + +public class CustomAAIObjectType extends AAIObjectType { + + private static final long serialVersionUID = 1919729212831978098L; + + public static final AAIObjectType CUSTOM = + new CustomAAIObjectType(AAINamespaceConstants.NETWORK, "my-url", "my-custom-name"); + + /* Default constructor automatically called by AAIObjectType */ + public CustomAAIObjectType() { + super(); + } + + protected CustomAAIObjectType(String parent, String uri, String name) { + super(parent, uri, name); + } + +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/defaultproperties/DefaultAAIPropertiesImpl.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/defaultproperties/DefaultAAIPropertiesImpl.java new file mode 100644 index 0000000000..2971f8a5a3 --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/defaultproperties/DefaultAAIPropertiesImpl.java @@ -0,0 +1,95 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.defaultproperties; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import org.onap.aaiclient.client.aai.AAIProperties; +import org.onap.aaiclient.client.aai.AAIVersion; + +public class DefaultAAIPropertiesImpl implements AAIProperties { + + + final Map props; + + public DefaultAAIPropertiesImpl() { + File initialFile = new File("src/test/resources/aai.properties"); + Map temp; + try (InputStream targetStream = new FileInputStream(initialFile)) { + Properties properties = new Properties(); + properties.load(targetStream); + temp = properties; + } catch (IOException e) { + temp = new HashMap<>(); + } + this.props = temp; + + } + + public DefaultAAIPropertiesImpl(int port) { + File initialFile = new File("src/test/resources/aai.properties"); + Map temp; + try (InputStream targetStream = new FileInputStream(initialFile)) { + Properties properties = new Properties(); + properties.load(targetStream); + temp = properties; + } catch (IOException e) { + temp = new HashMap<>(); + } + this.props = temp; + this.props.put("aai.endpoint", this.props.get("aai.endpoint").toString().replaceFirst(":\\d+", ":" + port)); + + } + + @Override + public URL getEndpoint() throws MalformedURLException { + return new URL(props.get("aai.endpoint").toString()); + } + + @Override + public String getSystemName() { + return "MSO"; + } + + @Override + public AAIVersion getDefaultVersion() { + return AAIVersion.LATEST; + } + + @Override + public String getAuth() { + Object value = props.get("aai.auth"); + return value == null ? null : value.toString(); + } + + @Override + public String getKey() { + Object value = props.get("mso.msoKey"); + return value == null ? null : value.toString(); + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/graphinventory/GraphInventoryPatchConverterTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/graphinventory/GraphInventoryPatchConverterTest.java new file mode 100644 index 0000000000..e48af9ec77 --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/graphinventory/GraphInventoryPatchConverterTest.java @@ -0,0 +1,118 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.HashMap; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.graphinventory.GraphInventoryPatchConverter; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + + +@RunWith(MockitoJUnitRunner.class) +public class GraphInventoryPatchConverterTest { + + private ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper(); + + @Test + public void convertObjectToPatchFormatTest() + throws URISyntaxException, JsonParseException, JsonMappingException, IOException { + GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter(); + GenericVnf vnf = new GenericVnf(); + vnf.setIpv4Loopback0Address(""); + String result = validator.marshallObjectToPatchFormat(vnf); + GenericVnf resultObj = mapper.readValue(result.toString(), GenericVnf.class); + assertTrue("expect object to become a String to prevent double marshalling", result instanceof String); + assertNull("expect null because of custom mapper", resultObj.getIpv4Loopback0Address()); + + } + + @Test + public void convertStringToPatchFormatTest() + throws URISyntaxException, JsonParseException, JsonMappingException, IOException { + GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter(); + String payload = "{\"ipv4-loopback0-address\":\"\"}"; + String result = validator.marshallObjectToPatchFormat(payload); + + assertEquals("expect no change", payload, result); + } + + @Test + public void convertStringToPatchFormatNull_Test() + throws URISyntaxException, JsonParseException, JsonMappingException, IOException { + GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter(); + String payload = "{\"ipv4-loopback0-address\": null}"; + String result = validator.marshallObjectToPatchFormat(payload); + System.out.println(result); + assertEquals("expect no change", payload, result); + } + + @Test + public void convertMapToPatchFormatTest() + throws URISyntaxException, JsonParseException, JsonMappingException, IOException { + GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter(); + HashMap map = new HashMap<>(); + map.put("ipv4-loopback0-address", ""); + map.put("ipv4-loopback1-address", "192.168.1.1"); + String result = validator.marshallObjectToPatchFormat(map); + + assertEquals("expect string", "{\"ipv4-loopback1-address\":\"192.168.1.1\"}", result); + } + + @Test + public void hasComplexObjectTest() { + GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter(); + String hasNesting = "{ \"hello\" : \"world\", \"nested\" : { \"key\" : \"value\" } }"; + String noNesting = "{ \"hello\" : \"world\" }"; + String arrayCase = + "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"nestedComplex\" : [{\"key\" : \"value\"}]}"; + String empty = "{}"; + String arrayCaseSimpleOnly = "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"]}"; + String relationshipListCaseNesting = + "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"relationship-list\" : [{\"key\" : \"value\"}], \"nested\" : { \"key\" : \"value\" }}"; + String relationshipListCase = + "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"relationship-list\" : [{\"key\" : \"value\"}]}"; + String nothing = ""; + + assertTrue("expect has nesting", validator.hasComplexObject(hasNesting)); + assertFalse("expect no nesting", validator.hasComplexObject(noNesting)); + assertTrue("expect has nesting", validator.hasComplexObject(arrayCase)); + assertFalse("expect no nesting", validator.hasComplexObject(empty)); + assertFalse("expect no nesting", validator.hasComplexObject(arrayCaseSimpleOnly)); + assertFalse("expect no nesting", validator.hasComplexObject(relationshipListCase)); + assertTrue("expect has nesting", validator.hasComplexObject(relationshipListCaseNesting)); + assertFalse("expect no nesting", validator.hasComplexObject(nothing)); + } + +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/graphinventory/entities/uri/parsers/UriParserSpringImplTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/graphinventory/entities/uri/parsers/UriParserSpringImplTest.java new file mode 100644 index 0000000000..270aca072c --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/graphinventory/entities/uri/parsers/UriParserSpringImplTest.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.aaiclient.client.graphinventory.entities.uri.parsers; + +import static org.junit.Assert.assertEquals; +import java.util.Map; +import org.junit.Test; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.graphinventory.entities.uri.parsers.UriParser; +import org.onap.aaiclient.client.graphinventory.entities.uri.parsers.UriParserSpringImpl; + +public class UriParserSpringImplTest { + + + + @Test + public void reverseTemplate() { + final UriParser parser = new UriParserSpringImpl(AAIObjectType.SERVICE_INSTANCE.toString()); + final String uri = + "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"; + + Map result = parser.parse(uri); + + assertEquals("found customer-id", "key1", result.get("global-customer-id")); + assertEquals("found service-type", "key2", result.get("service-type")); + assertEquals("found service-instance-id", "key3", result.get("service-instance-id")); + + } +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryPayloadExceptionTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryPayloadExceptionTest.java new file mode 100644 index 0000000000..6421136fe2 --- /dev/null +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/graphinventory/exceptions/GraphInventoryPayloadExceptionTest.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.aaiclient.client.graphinventory.exceptions; + +import org.junit.Test; +import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryPayloadException; + +public class GraphInventoryPayloadExceptionTest { + + Throwable t = new Throwable(); + + @Test + public void callConstructorTest() throws Exception { + + GraphInventoryPayloadException test1 = new GraphInventoryPayloadException("testing"); + + GraphInventoryPayloadException test2 = new GraphInventoryPayloadException("testing", t); + + GraphInventoryPayloadException test3 = new GraphInventoryPayloadException(t); + } + +} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIClientResponseExceptionMapperTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIClientResponseExceptionMapperTest.java deleted file mode 100644 index 7af36b0bdd..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIClientResponseExceptionMapperTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import static org.junit.Assert.assertEquals; -import java.util.Arrays; -import java.util.List; -import org.junit.Before; -import org.junit.Test; -import org.onap.so.client.aai.entities.AAIError; -import org.onap.so.client.aai.entities.RequestError; -import org.onap.so.client.aai.entities.ServiceException; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class AAIClientResponseExceptionMapperTest { - - AAIClientResponseExceptionMapper mapper; - String errorMsg; - - @Before - public void before() { - mapper = new AAIClientResponseExceptionMapper(); - errorMsg = "Error calling A&AI. Request-Id=" + mapper.getRequestId() + " "; - } - - @Test - public void testExtractMessageWithEntity() throws JsonProcessingException { - ServiceException svcException = new ServiceException(); - svcException.setText("test %1 message - %2"); - svcException.setVariables(Arrays.asList("error", "service exception %1 test")); - - RequestError requestError = new RequestError(); - requestError.setServiceException(svcException); - - AAIError error = new AAIError(); - error.setRequestError(requestError); - - ObjectMapper objMapper = new ObjectMapper(); - String strRequestError = objMapper.writeValueAsString(error); - - assertEquals(errorMsg + "test error message - service exception error test", - mapper.extractMessage(strRequestError).get()); - } - - @Test - public void testExtractMessageWithoutEntity() { - assertEquals(errorMsg, mapper.extractMessage("").get()); - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java deleted file mode 100644 index 3587c71de0..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.doReturn; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.onap.so.client.aai.entities.AAIError; -import org.onap.so.client.aai.entities.RequestError; -import org.onap.so.client.aai.entities.ServiceException; - -public class AAIErrorFormatterTest { - - @Mock - private AAIError errorObj; - - @Before - public void init() { - MockitoAnnotations.initMocks(this); - } - - @Test - public void testFillInTemplateWithReplace() { - String error = "Error %1 on %2"; - List list = Arrays.asList("PUT", "hello %1"); - AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj); - String result = formatter.fillInTemplate(error, list); - assertEquals("equal", "Error PUT on hello PUT", result); - - } - - @Test - public void testFillInTemplateWithoutReplace() { - String error = "Error"; - List list = new ArrayList<>(); - AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj); - String result = formatter.fillInTemplate(error, list); - assertEquals("equal", "Error", result); - } - - @Test - public void testGetMessage() { - ServiceException svcException = new ServiceException(); - svcException.setText("test %1 message - %2"); - svcException.setVariables(Arrays.asList("error", "service exception %1 test")); - - RequestError requestError = new RequestError(); - requestError.setServiceException(svcException); - - doReturn(requestError).when(errorObj).getRequestError(); - - AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj); - String result = formatter.getMessage(); - assertEquals("equal", "test error message - service exception error test", result); - } - - @Test - public void errorMessageOnPercentEncodedTest() { - ServiceException svcException = new ServiceException(); - svcException.setText("test my%20Test %1 message - %2"); - svcException.setVariables(Arrays.asList("error", "service exception %1 test")); - - RequestError requestError = new RequestError(); - requestError.setServiceException(svcException); - - doReturn(requestError).when(errorObj).getRequestError(); - - AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj); - String result = formatter.getMessage(); - assertEquals("equal", "test my%20Test error message - service exception error test", result); - } - - @Test - public void testGetMessageNoParsable() { - errorObj.setRequestError(null); - AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj); - String result = formatter.getMessage(); - assertEquals("equal", "no parsable error message found", result); - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java deleted file mode 100644 index 20a6678386..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import static org.junit.Assert.assertEquals; -import org.junit.Test; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; - -public class AAIObjectTypeTest { - - - @Test - public void fromTypeNameTest() throws IllegalArgumentException, IllegalAccessException, InstantiationException { - AAIObjectType type = AAIObjectType.fromTypeName("allotted-resource"); - assertEquals("allotted-resource", type.typeName()); - - } - - @Test - public void customTypeTest() throws IllegalArgumentException, IllegalAccessException, InstantiationException { - AAIObjectType type = AAIObjectType.fromTypeName("my-custom-name"); - assertEquals("my-custom-name", type.typeName()); - - } - - @Test - public void verifyDefaultCase() { - assertEquals("default removed for tenant", "tenant", AAIObjectType.DEFAULT_TENANT.typeName()); - assertEquals("default removed for cloud-region", "cloud-region", AAIObjectType.DEFAULT_CLOUD_REGION.typeName()); - } - - @Test - public void verifyRegularCase() { - assertEquals("default removed for tenant", "allotted-resource", AAIObjectType.ALLOTTED_RESOURCE.typeName()); - } - - @Test - public void instanceGroupObjectTypeTest() { - final String id = "test1"; - AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, id); - assertEquals("/network/instance-groups/instance-group/test1", aaiUri.build().toString()); - } - - @Test - public void collectionObjectTypeTest() { - final String id = "test1"; - AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, id); - assertEquals("/network/collections/collection/test1", aaiUri.build().toString()); - } - - @Test - public void genericVnfTest() { - AAIObjectType type = AAIObjectType.GENERIC_VNF; - assertEquals("/network/generic-vnfs/generic-vnf/{vnf-id}", type.uriTemplate()); - assertEquals("/generic-vnfs/generic-vnf/{vnf-id}", type.partialUri()); - } - - @Test - public void pInterfaceTest() { - AAIObjectType type = AAIObjectType.P_INTERFACE; - assertEquals("/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}", - type.uriTemplate()); - assertEquals("/p-interfaces/p-interface/{interface-name}", type.partialUri()); - } - - @Test - public void networkPolicyObjectTypeTest() { - final String id = "test1"; - AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, id); - assertEquals("/network/network-policies/network-policy/test1", aaiUri.build().toString()); - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIPServerTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIPServerTest.java deleted file mode 100644 index 4b3b7e9881..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIPServerTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import static org.junit.Assert.assertEquals; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.List; -import org.junit.Ignore; -import org.junit.Test; -import org.onap.aai.domain.yang.Pserver; - -public class AAIPServerTest { - - @Test - public void pserverTest() throws IOException { - AAIRestClientImpl client = new AAIRestClientImpl(); - String json = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/aai/pserver.json"))); - List list = client.getListOfPservers(json); - - assertEquals("", list.get(0).getHostname(), "test"); - assertEquals("", list.size(), 2); - } - - @Test - @Ignore // IGNORED FOR 1710 MERGE TO ONAP - public void pserverActualTest() throws IOException { - AAIRestClientImpl client = new AAIRestClientImpl(); - List list = client.getPhysicalServerByVnfId("d946afed-8ebe-4c5d-9665-54fcc043b8e7"); - assertEquals("", list.size(), 0); - } - -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java deleted file mode 100644 index c70f16eb83..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java +++ /dev/null @@ -1,150 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isA; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import javax.ws.rs.core.GenericType; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; -import org.onap.aai.domain.yang.Complex; -import org.onap.so.client.RestClient; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.CustomQuery; -import org.onap.so.client.aai.entities.Results; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.Format; -import org.onap.so.client.graphinventory.GraphInventoryClient; -import org.onap.so.client.graphinventory.GraphInventorySubgraphType; -import org.onap.so.client.graphinventory.entities.Pathed; -import org.onap.so.client.graphinventory.entities.ResourceAndUrl; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; - - -@RunWith(MockitoJUnitRunner.class) -public class AAIQueryClientTest { - - @Mock - private RestClient restClient; - - @Mock - private GraphInventoryClient client; - - @InjectMocks - @Spy - private AAIQueryClient aaiQueryClient = new AAIQueryClient(); - - private String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/query/"; - - private ObjectMapper mapper = new ObjectMapper(); - - @Test - public void testQuery() { - List uris = Arrays.asList(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY)); - - Format format = Format.SIMPLE; - CustomQuery query = new CustomQuery(uris); - - doReturn(restClient).when(client).createClient(isA(AAIResourceUri.class)); - aaiQueryClient.query(format, query); - verify(client, times(1)) - .createClient(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY).format(format)); - verify(restClient, times(1)).put(query, String.class); - } - - @Test - public void testCreateClient() { - String depth = "testDepth"; - GraphInventorySubgraphType subgraph = GraphInventorySubgraphType.STAR; - - aaiQueryClient.depth(depth); - aaiQueryClient.nodesOnly(); - aaiQueryClient.subgraph(subgraph); - - AAIResourceUri aaiUri = spy(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY)); - doReturn(aaiUri).when(aaiUri).clone(); - aaiQueryClient.setupQueryParams(aaiUri); - - verify(aaiUri, times(1)).queryParam("depth", depth); - verify(aaiUri, times(1)).queryParam("nodesOnly", ""); - verify(aaiUri, times(1)).queryParam("subgraph", subgraph.toString()); - } - - @Test - public void querySingleResourceTest() throws IOException { - doReturn(getJson("single-query-result.json")).when(aaiQueryClient).query(eq(Format.RESOURCE_AND_URL), - any(CustomQuery.class)); - List result = aaiQueryClient.querySingleResource( - new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test"))), - Complex.class); - assertEquals(2, result.size()); - assertEquals("complex-id-15100-jc689q2", result.get(1).getPhysicalLocationId()); - } - - @Test - public void getResourceAndUrlTest() throws IOException { - doReturn(getJson("single-query-result.json")).when(aaiQueryClient).query(eq(Format.RESOURCE_AND_URL), - any(CustomQuery.class)); - List> result = aaiQueryClient.getResourceAndUrl( - new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test")))); - assertEquals(2, result.size()); - - assertEquals(1, - result.get(1).getWrapper().getRelationships().get().getRelatedUris(AAIObjectType.PSERVER).size()); - } - - @Test - public void querySingleTypeTest() throws IOException { - when(client.createClient(isA(AAIResourceUri.class))).thenReturn(restClient); - when(restClient.put(any(Object.class), any(GenericType.class))).thenReturn( - mapper.readValue(getJson("pathed-result.json"), new TypeReference>>() {})); - - - List results = aaiQueryClient.queryPathed( - new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test")))); - - assertEquals(2, results.size()); - assertEquals("service-instance", results.get(1).getResourceType()); - } - - private String getJson(String filename) throws IOException { - return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename))); - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java deleted file mode 100644 index a7fd6e904e..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java +++ /dev/null @@ -1,308 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; -import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; -import static org.hamcrest.CoreMatchers.containsString; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import java.util.Optional; -import javax.ws.rs.BadRequestException; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.GenericVnfs; -import org.onap.aai.domain.yang.Relationship; -import org.onap.so.client.RestClient; -import org.onap.so.client.aai.entities.AAIEdgeLabel; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryMultipleItemsException; -import com.github.tomakehurst.wiremock.admin.NotFoundException; -import com.github.tomakehurst.wiremock.junit.WireMockRule; - -@RunWith(MockitoJUnitRunner.class) -public class AAIResourcesClientTest { - - - @Rule - public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort()); - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - - @Spy - public AAIClient client; - - @InjectMocks - public AAIResourcesClient aaiClient = new AAIResourcesClient(); - - private String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/query/"; - - @Before - public void beforeTest() { - doReturn(new DefaultAAIPropertiesImpl(wireMockRule.port())).when(client).getRestProperties(); - } - - @Test - public void verifyNotExists() { - AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test"); - wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())) - .willReturn(aResponse().withHeader("Content-Type", "text/plain").withBody("hello").withStatus(404))); - AAIResourcesClient client = aaiClient; - boolean result = client.exists(path); - assertEquals("path not found", false, result); - } - - @Test - public void verifyDelete() { - AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2"); - wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("aai/resources/mockObject.json").withStatus(200))); - wireMockRule.stubFor(delete(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())) - .withQueryParam("resource-version", equalTo("1234")).willReturn(aResponse().withStatus(204))); - AAIResourcesClient client = aaiClient; - client.delete(path); - } - - @Test - public void verifyBasicAuth() { - AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3"); - wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString())) - .withHeader("Authorization", equalTo("Basic dGVzdDp0ZXN0")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("aai/resources/mockObject.json").withStatus(200))); - AAIResourcesClient client = aaiClient; - client.get(path); - } - - @Test - public void verifyConnect() { - AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2"); - AAIResourceUri path2 = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3"); - wireMockRule.stubFor( - put(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build() + "/relationship-list/relationship")) - .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(200))); - - AAIResourceUri pathClone = path.clone(); - AAIResourcesClient client = aaiClient; - client.connect(path, path2); - assertEquals("uri not modified", pathClone.build().toString(), path.build().toString()); - } - - @Test - public void verifyDisconnect() { - AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2"); - AAIResourceUri path2 = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3"); - - wireMockRule.stubFor( - delete(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build() + "/relationship-list/relationship")) - .willReturn(aResponse().withStatus(204))); - - AAIResourceUri pathClone = path.clone(); - AAIResourcesClient client = aaiClient; - client.disconnect(path, path2); - assertEquals("uri not modified", pathClone.build().toString(), path.build().toString()); - } - - @Test - public void verifyPatch() { - AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2"); - - wireMockRule.stubFor(post(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())) - .willReturn(aResponse().withStatus(200))); - - AAIResourcesClient client = aaiClient; - - client.update(path, "{}"); - } - - @Test - public void verifyNotExistsGet() { - AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test"); - wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())) - .willReturn(aResponse().withHeader("Content-Type", "text/plain").withBody("hello").withStatus(404))); - AAIResourcesClient client = aaiClient; - AAIResultWrapper result = client.get(path); - assertEquals("is empty", true, result.isEmpty()); - } - - @Test - public void verifyNotExistsGetException() { - AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test"); - wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())) - .willReturn(aResponse().withHeader("Content-Type", "text/plain").withBody("hello").withStatus(404))); - AAIResourcesClient client = aaiClient; - thrown.expect(NotFoundException.class); - thrown.expectMessage(containsString(path.build() + " not found in A&AI")); - AAIResultWrapper result = client.get(path, NotFoundException.class); - } - - @Test - public void verifyFailedCallException() { - AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test"); - wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())).willReturn(aResponse() - .withHeader("Content-Type", "text/plain").withBodyFile("aai/error-message.json").withStatus(400))); - AAIResourcesClient client = aaiClient; - - thrown.expect(BadRequestException.class); - thrown.expectMessage(containsString( - "Invalid input performing PUT on url (msg=Precondition Required:resource-version not passed for update of url")); - AAIResultWrapper result = client.get(path); - } - - @Test - public void buildRelationshipTest() { - AAIResourcesClient client = aaiClient; - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test"); - Relationship relationship = new Relationship(); - relationship.setRelatedLink(uri.build().toString()); - Relationship actual = client.buildRelationship(uri); - assertThat("expect equal no label", actual, sameBeanAs(relationship)); - - relationship.setRelationshipLabel(AAIEdgeLabel.USES.toString()); - actual = client.buildRelationship(uri, AAIEdgeLabel.USES); - assertThat("expect equal has label", actual, sameBeanAs(relationship)); - - } - - @Test - public void testGetOne() { - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("my-vnf-id"); - GenericVnfs vnfs = new GenericVnfs(); - vnfs.getGenericVnf().add(vnf); - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF); - RestClient restClientMock = mock(RestClient.class); - doReturn(restClientMock).when(client).createClient(uri); - when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs)); - - Optional result = aaiClient.getOne(GenericVnfs.class, GenericVnf.class, uri); - - assertEquals("my-vnf-id", result.get().getVnfId()); - } - - @Test - public void testGetOneMultipleResults() { - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("my-vnf-id"); - GenericVnf vnf2 = new GenericVnf(); - vnf.setVnfId("my-vnf-id2"); - GenericVnfs vnfs = new GenericVnfs(); - vnfs.getGenericVnf().add(vnf); - vnfs.getGenericVnf().add(vnf2); - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF); - RestClient restClientMock = mock(RestClient.class); - doReturn(restClientMock).when(client).createClient(uri); - when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs)); - - thrown.expect(GraphInventoryMultipleItemsException.class); - aaiClient.getOne(GenericVnfs.class, GenericVnf.class, uri); - } - - @Test - public void testGetFirstMultipleResults() { - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("my-vnf-id"); - GenericVnf vnf2 = new GenericVnf(); - vnf2.setVnfId("my-vnf-id2"); - GenericVnfs vnfs = new GenericVnfs(); - vnfs.getGenericVnf().add(vnf); - vnfs.getGenericVnf().add(vnf2); - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF); - RestClient restClientMock = mock(RestClient.class); - doReturn(restClientMock).when(client).createClient(uri); - when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs)); - - Optional result = aaiClient.getFirst(GenericVnfs.class, GenericVnf.class, uri); - - assertEquals("my-vnf-id", result.get().getVnfId()); - } - - @Test - public void testGetOneNoResults() { - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("my-vnf-id"); - GenericVnfs vnfs = new GenericVnfs(); - vnfs.getGenericVnf().add(vnf); - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF); - RestClient restClientMock = mock(RestClient.class); - doReturn(restClientMock).when(client).createClient(uri); - when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.empty()); - - Optional result = aaiClient.getOne(GenericVnfs.class, GenericVnf.class, uri); - - assertFalse(result.isPresent()); - } - - @Test - public void testGetFirstNoResults() { - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("my-vnf-id"); - GenericVnfs vnfs = new GenericVnfs(); - vnfs.getGenericVnf().add(vnf); - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF); - RestClient restClientMock = mock(RestClient.class); - doReturn(restClientMock).when(client).createClient(uri); - when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.empty()); - - Optional result = aaiClient.getFirst(GenericVnfs.class, GenericVnf.class, uri); - - assertFalse(result.isPresent()); - } - - @Test - public void testGetFirstWrongPluralClass() { - GenericVnf vnf = new GenericVnf(); - AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF); - RestClient restClientMock = mock(RestClient.class); - doReturn(restClientMock).when(client).createClient(uri); - when(restClientMock.get(GenericVnf.class)).thenReturn(Optional.of(vnf)); - - Optional result = aaiClient.getFirst(GenericVnf.class, GenericVnf.class, uri); - - assertFalse(result.isPresent()); - } - -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java deleted file mode 100644 index 55da6e7d52..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.spy; -import java.util.List; -import java.util.Optional; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.aai.entities.uri.ServiceInstanceUri; -import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl; -import com.github.tomakehurst.wiremock.junit.WireMockRule; - -@RunWith(MockitoJUnitRunner.class) -public class AAIResourcesClientWithServiceInstanceUriTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort()); - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - @Spy - public AAIClient client; - - @InjectMocks - public AAIResourcesClient aaiClient = new AAIResourcesClient(); - - private ServiceInstanceUri uri; - - @Before - public void setUp() { - doReturn(new DefaultAAIPropertiesImpl(wireMockRule.port())).when(client).getRestProperties(); - wireMockRule.stubFor(get(urlMatching("/aai/v[0-9]+/nodes.*")).willReturn( - aResponse().withStatus(404).withHeader("Content-Type", "application/json").withHeader("Mock", "true"))); - - uri = spy((ServiceInstanceUri) AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "id")); - doReturn(aaiClient).when(uri).getResourcesClient(); - } - - @Test - public void getWithClass() { - AAIResourcesClient client = aaiClient; - Optional result = client.get(String.class, uri); - - assertThat(result.isPresent(), equalTo(false)); - } - - @Test - public void getFullResponse() { - AAIResourcesClient client = aaiClient; - Response result = client.getFullResponse(uri); - assertThat(result.getStatus(), equalTo(Status.NOT_FOUND.getStatusCode())); - } - - @Test - public void getWithGenericType() { - AAIResourcesClient client = aaiClient; - Optional> result = client.get(new GenericType>() {}, uri); - assertThat(result.isPresent(), equalTo(false)); - } - - @Test - public void getAAIWrapper() { - AAIResourcesClient client = aaiClient; - AAIResultWrapper result = client.get(uri); - assertThat(result.isEmpty(), equalTo(true)); - } - - @Test - public void getWithException() { - AAIResourcesClient client = aaiClient; - this.thrown.expect(IllegalArgumentException.class); - AAIResultWrapper result = client.get(uri, IllegalArgumentException.class); - } - - @Test - public void existsTest() { - AAIResourcesClient client = aaiClient; - doReturn(uri).when(uri).clone(); - boolean result = client.exists(uri); - assertThat(result, equalTo(false)); - } - -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java deleted file mode 100644 index 2f551fecc4..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import static org.hamcrest.CoreMatchers.containsString; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import java.net.URI; -import java.net.URISyntaxException; -import javax.ws.rs.core.Response; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.client.RestClientSSL; -import org.onap.so.client.graphinventory.GraphInventoryPatchConverter; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@RunWith(MockitoJUnitRunner.class) -public class AAIRestClientTest { - - @Mock - private AAIProperties props; - - private ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper(); - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - @Test - public void failPatchOnComplexObject() throws URISyntaxException { - AAIRestClient client = new AAIRestClient(props, new URI("")); - this.thrown.expect(GraphInventoryPatchDepthExceededException.class); - this.thrown.expectMessage(containsString("Object exceeds allowed depth for update action")); - client.patch( - "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"relationship-list\" : [{\"key\" : \"value\"}], \"nested\" : { \"key\" : \"value\" }}"); - } - - @Test - public void verifyPatchValidation() throws URISyntaxException { - AAIRestClient client = new AAIRestClient(props, new URI("")); - AAIRestClient spy = spy(client); - GraphInventoryPatchConverter patchValidatorMock = mock(GraphInventoryPatchConverter.class); - doReturn(patchValidatorMock).when(spy).getPatchConverter(); - String payload = "{}"; - doReturn(Response.ok().build()).when(spy).method(eq("PATCH"), any()); - spy.patch(payload); - verify(patchValidatorMock, times(1)).convertPatchFormat(eq((Object) payload)); - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java deleted file mode 100644 index b07d893adb..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java +++ /dev/null @@ -1,140 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.Matchers.greaterThan; -import static org.junit.Assert.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import javax.ws.rs.core.GenericType; -import org.json.JSONException; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; -import org.onap.aai.domain.yang.Pserver; -import org.onap.aai.domain.yang.v9.Complex; -import org.onap.so.client.aai.entities.singletransaction.SingleTransactionRequest; -import org.onap.so.client.aai.entities.singletransaction.SingleTransactionResponse; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.GraphInventoryPatchConverter; -import org.skyscreamer.jsonassert.JSONAssert; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -@RunWith(MockitoJUnitRunner.class) -public class AAISingleTransactionClientTest { - - private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/singletransaction/"; - AAIResourceUri uriA = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "pserver-hostname"); - AAIResourceUri uriB = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, "my-complex"); - AAIResourceUri uriC = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, "my-complex2"); - - ObjectMapper mapper; - - public AAIClient client = new AAIClient(); - - @Spy - public AAIResourcesClient aaiClient = new AAIResourcesClient(); - - @Before - public void before() throws JsonParseException, JsonMappingException, IOException { - mapper = new AAICommonObjectMapperProvider().getMapper(); - mapper.enable(SerializationFeature.INDENT_OUTPUT); - } - - @Test - public void testRequest() throws JSONException, IOException { - Pserver pserver = new Pserver(); - pserver.setHostname("pserver-hostname"); - pserver.setFqdn("pserver-bulk-process-single-transactions-multiple-actions-1-fqdn"); - Pserver pserver2 = new Pserver(); - pserver2.setFqdn("patched-fqdn"); - Complex complex = new Complex(); - complex.setCity("my-city"); - Map map = new HashMap<>(); - map.put("resource-version", "1234"); - doReturn(Optional.of(map)).when(aaiClient).get(any(GenericType.class), eq(uriC)); - AAISingleTransactionClient singleTransaction = aaiClient.beginSingleTransaction().create(uriA, pserver) - .update(uriA, pserver2).create(uriB, complex).delete(uriC); - - SingleTransactionRequest actual = singleTransaction.getRequest(); - - SingleTransactionRequest expected = - mapper.readValue(this.getJson("sample-request.json"), SingleTransactionRequest.class); - - JSONAssert.assertEquals(mapper.writeValueAsString(expected), mapper.writeValueAsString(actual), false); - } - - @Test - public void testFailure() throws IOException { - AAISingleTransactionClient singleTransaction = aaiClient.beginSingleTransaction(); - SingleTransactionResponse expected = - mapper.readValue(this.getJson("sample-response-failure.json"), SingleTransactionResponse.class); - Optional errorMessage = singleTransaction.locateErrorMessages(expected); - - assertThat(expected.getOperationResponses().size(), greaterThan(0)); - assertThat(errorMessage.isPresent(), equalTo(true)); - - } - - @Test - public void testSuccessResponse() throws IOException { - AAISingleTransactionClient singleTransaction = aaiClient.beginSingleTransaction(); - SingleTransactionResponse expected = - mapper.readValue(this.getJson("sample-response.json"), SingleTransactionResponse.class); - Optional errorMessage = singleTransaction.locateErrorMessages(expected); - - assertThat(expected.getOperationResponses().size(), greaterThan(0)); - assertThat(errorMessage.isPresent(), equalTo(false)); - - } - - @Test - public void confirmPatchFormat() { - AAISingleTransactionClient singleTransaction = spy(new AAISingleTransactionClient(aaiClient, client)); - GraphInventoryPatchConverter mock = mock(GraphInventoryPatchConverter.class); - doReturn(mock).when(singleTransaction).getPatchConverter(); - singleTransaction.update(uriA, "{}"); - verify(mock, times(1)).convertPatchFormat(any()); - } - - private String getJson(String filename) throws IOException { - return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename))); - } - -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java deleted file mode 100644 index cbcb60513b..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java +++ /dev/null @@ -1,174 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import javax.ws.rs.core.GenericType; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; -import org.onap.aai.domain.yang.Relationship; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.GraphInventoryPatchConverter; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -@RunWith(MockitoJUnitRunner.class) -public class AAITransactionalClientTest { - - private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/bulkprocess/"; - AAIResourceUri uriA = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1"); - AAIResourceUri uriB = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test2"); - AAIResourceUri uriC = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3"); - AAIResourceUri uriD = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test4"); - AAIResourceUri uriE = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test5"); - AAIResourceUri uriF = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test6"); - AAIResourceUri uriG = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test7"); - - ObjectMapper mapper; - - public AAIClient client = new AAIClient(); - - @Spy - public AAIResourcesClient aaiClient = new AAIResourcesClient(); - - @Before - public void before() throws JsonParseException, JsonMappingException, IOException { - mapper = new AAICommonObjectMapperProvider().getMapper(); - mapper.enable(SerializationFeature.INDENT_OUTPUT); - } - - @Test - public void testCreate() throws IOException { - final Relationship body = new Relationship(); - body.setRelatedLink(uriB.build().toString()); - - AAITransactionalClient transactions = aaiClient.beginTransaction().create(uriA.clone().relationshipAPI(), body); - - String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions()); - Map actual = - mapper.readValue(serializedTransactions, new TypeReference>() {}); - Map expected = - mapper.readValue(getJson("test-request-small.json"), new TypeReference>() {}); - - assertEquals(actual, expected); - } - - @Test - public void testConnect() throws IOException { - List uris = new ArrayList<>(); - uris.add(uriB); - - Map map = new HashMap<>(); - map.put("resource-version", "1234"); - doReturn(Optional.of(map)).when(aaiClient).get(any(GenericType.class), eq(uriG)); - AAIResourceUri uriAClone = uriA.clone(); - AAITransactionalClient transactions = aaiClient.beginTransaction().connect(uriA, uris).connect(uriC, uriD) - .beginNewTransaction().connect(uriE, uriF).beginNewTransaction().delete(uriG); - - String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions()); - Map actual = - mapper.readValue(serializedTransactions, new TypeReference>() {}); - Map expected = - mapper.readValue(getJson("test-request.json"), new TypeReference>() {}); - - assertEquals(actual, expected); - assertEquals("uri not manipulated", uriAClone.build().toString(), uriA.build().toString()); - } - - @Test - public void testDisconnect() throws IOException { - List uris = new ArrayList<>(); - uris.add(uriB); - - AAITransactionalClient transactions = aaiClient.beginTransaction().disconnect(uriA, uris); - - String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions()); - Map actual = - mapper.readValue(serializedTransactions, new TypeReference>() {}); - Map expected = mapper.readValue(getJson("test-request-small.json").replace("put", "delete"), - new TypeReference>() {}); - - assertEquals(actual, expected); - } - - @Test - public void testUpdate() throws IOException { - final Relationship body = new Relationship(); - body.setRelatedLink(uriB.build().toString()); - - AAIResourceUri uriAClone = uriA.clone().relationshipAPI(); - AAITransactionalClient transactions = aaiClient.beginTransaction().update(uriAClone, body); - - String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions()); - Map actual = - mapper.readValue(serializedTransactions, new TypeReference>() {}); - Map expected = mapper.readValue(getJson("test-request-small.json").replace("put", "patch"), - new TypeReference>() {}); - - assertEquals(actual, expected); - } - - @Test - public void verifyResponse() throws IOException { - AAITransactionalClient transactions = aaiClient.beginTransaction(); - - assertEquals("success status", Optional.empty(), - transactions.locateErrorMessages(getJson("response-success.json"))); - assertEquals(transactions.locateErrorMessages(getJson("response-failure.json")).get(), - "another error message\nmy great error"); - } - - @Test - public void confirmPatchFormat() { - AAITransactionalClient transactionClient = spy(new AAITransactionalClient(aaiClient, client)); - GraphInventoryPatchConverter mock = mock(GraphInventoryPatchConverter.class); - doReturn(mock).when(transactionClient).getPatchConverter(); - transactionClient.update(uriA, "{}"); - verify(mock, times(1)).convertPatchFormat(any()); - } - - private String getJson(String filename) throws IOException { - return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename))); - } - -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIURITest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIURITest.java deleted file mode 100644 index 8971f91602..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIURITest.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import static org.junit.Assert.assertEquals; -import javax.ws.rs.core.UriBuilder; -import org.junit.Test; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; - -public class AAIURITest { - - - - @Test - public void verifyTemplateReplacement() { - final String id = "test1"; - AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, id); - String manualReplace = AAIObjectType.CONFIGURATION.toString().replaceAll("\\{configuration-id\\}", id); - assertEquals("uri template replaced", aaiUri.build(), UriBuilder.fromPath(manualReplace).build()); - - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIUpdatorImplTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIUpdatorImplTest.java deleted file mode 100644 index fdfe41f12a..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIUpdatorImplTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei 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.so.client.aai; - -import org.junit.Test; - -public class AAIUpdatorImplTest { - - AAIUpdatorImpl test = new AAIUpdatorImpl(); - - protected AAIRestClientI client; - - @Test - public void getClientTest() throws Exception { - test.getClient(); - } - - @Test - public void setClientTest() throws Exception { - test.setClient(client); - } - - - @Test(expected = NullPointerException.class) - public void updateVnfToLockedTest() throws Exception { - test.updateVnfToLocked("vnfId"); - } - - - @Test(expected = NullPointerException.class) - public void updateVnfToUnLockedTest() throws Exception { - test.updateVnfToUnLocked("vnfId"); - } - -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIUpdatorTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIUpdatorTest.java deleted file mode 100644 index d18dbec944..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIUpdatorTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import static org.mockito.ArgumentMatchers.isA; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class AAIUpdatorTest { - - @Mock - protected AAIRestClientI client; - String vnfName = "testVnf"; - AAIUpdatorImpl updator; - - @Before - public void init() { - updator = new AAIUpdatorImpl(); - updator.setClient(client); - } - - @Test - public void testUpdateVnfToLocked() throws Exception { - doNothing().when(client).updateMaintenceFlagVnfId(isA(String.class), isA(Boolean.class)); - updator.updateVnfToLocked(vnfName); - verify(client, times(1)).updateMaintenceFlagVnfId(vnfName, true); - } - - @Test - public void testUpdateVnfToUnLocked() throws Exception { - doNothing().when(client).updateMaintenceFlagVnfId(isA(String.class), isA(Boolean.class)); - updator.updateVnfToUnLocked(vnfName); - verify(client, times(1)).updateMaintenceFlagVnfId(vnfName, false); - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java deleted file mode 100644 index b91d0e705a..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java +++ /dev/null @@ -1,113 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.Pserver; - -@RunWith(MockitoJUnitRunner.class) -public class AAIValidatorTest { - - @Mock - protected AAIRestClientI client; - String vnfName = "testVnf"; - String uuid = "UUID"; - AAIValidatorImpl validator; - - @Before - public void init() { - validator = new AAIValidatorImpl(); - validator.setClient(client); - } - - public List getPserversLocked() { - Pserver pserver1 = new Pserver(); - pserver1.setInMaint(true); - Pserver pserver2 = new Pserver(); - pserver2.setInMaint(false); - List pservers = new ArrayList(); - pservers.add(pserver1); - pservers.add(pserver2); - return pservers; - } - - public List getPserversNotLocked() { - Pserver pserver1 = new Pserver(); - pserver1.setInMaint(false); - Pserver pserver2 = new Pserver(); - pserver2.setInMaint(false); - List pservers = new ArrayList(); - pservers.add(pserver1); - pservers.add(pserver2); - return pservers; - } - - public GenericVnf createGenericVnfs(boolean locked) { - GenericVnf genericVnf = new GenericVnf(); - genericVnf.setInMaint(locked); - return genericVnf; - } - - @Test - public void test_IsPhysicalServerLocked_True() throws IOException { - when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(getPserversLocked()); - boolean locked = validator.isPhysicalServerLocked(vnfName); - assertEquals(true, locked); - } - - @Test - public void test_IsPhysicalServerLocked_False() throws IOException { - when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(getPserversNotLocked()); - boolean locked = validator.isPhysicalServerLocked(vnfName); - assertEquals(false, locked); - } - - @Test - public void test_IsPhysicalServerLocked_NoServers_False() throws IOException { - when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(null); - boolean locked = validator.isPhysicalServerLocked(vnfName); - assertEquals(false, locked); - } - - @Test - public void test_IsVNFLocked_False() { - when(client.getVnfByName(vnfName)).thenReturn(createGenericVnfs(false)); - boolean locked = validator.isVNFLocked(vnfName); - assertEquals(false, locked); - } - - @Test - public void test_IsVNFLocked_True() { - when(client.getVnfByName(vnfName)).thenReturn(createGenericVnfs(true)); - boolean locked = validator.isVNFLocked(vnfName); - assertEquals(true, locked); - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java deleted file mode 100644 index 1a1a7d124e..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java +++ /dev/null @@ -1,149 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.so.client.aai; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.junit.Test; -import org.onap.so.client.graphinventory.entities.DSLNodeKey; -import org.onap.so.client.graphinventory.entities.DSLQueryBuilder; -import org.onap.so.client.graphinventory.entities.DSLStartNode; -import org.onap.so.client.graphinventory.entities.Output; -import org.onap.so.client.graphinventory.entities.Start; -import org.onap.so.client.graphinventory.entities.TraversalBuilder; -import org.onap.so.client.graphinventory.entities.__; - -public class DSLQueryBuilderTest { - - @Test - public void whereTest() { - DSLQueryBuilder builder = TraversalBuilder.fragment(new DSLStartNode(AAIObjectType.CLOUD_REGION, - __.key("cloud-owner", "att-nc"), __.key("cloud-region-id", "test"))); - - builder.to(__.node(AAIObjectType.VLAN_TAG)) - .where(__.node(AAIObjectType.OWNING_ENTITY, __.key("owning-entity-name", "name"))) - .to(__.node(AAIObjectType.VLAN_TAG, __.key("vlan-id-outer", "108")).output()); - - assertEquals("cloud-region('cloud-owner', 'att-nc')('cloud-region-id', 'test') > " - + "vlan-tag (> owning-entity('owning-entity-name', 'name')) > " + "vlan-tag*('vlan-id-outer', '108')", - builder.build().get()); - } - - @Test - public void unionTest() { - DSLQueryBuilder builder = TraversalBuilder - .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output()); - - builder.union(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()), - __.node(AAIObjectType.VSERVER) - .to(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()))); - - assertEquals( - "generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, " + "vserver > pserver* > complex* ]", - builder.build().get()); - } - - @Test - public void whereUnionTest() { - DSLQueryBuilder builder = TraversalBuilder - .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output()); - - builder.where(__.union(__.node(AAIObjectType.PSERVER, __.key("hostname", "hostname1")), - __.node(AAIObjectType.VSERVER).to(__.node(AAIObjectType.PSERVER, __.key("hostname", "hostname1"))))); - - assertEquals("generic-vnf*('vnf-id', 'vnfId') (> [ pserver('hostname', 'hostname1'), " - + "vserver > pserver('hostname', 'hostname1') ])", builder.build().get()); - } - - @Test - public void notNullTest() { - DSLQueryBuilder builder = TraversalBuilder.traversal( - new DSLStartNode(AAIObjectType.CLOUD_REGION, __.key("cloud-owner", "", "null").not()).output()); - - assertEquals("cloud-region* !('cloud-owner', ' ', ' null ')", builder.build().get()); - } - - @Test - public void shortCutToTest() { - DSLQueryBuilder builder = TraversalBuilder - .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output()); - - builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id")); - assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')", - builder.build().get()); - } - - @Test - public void limitTest() { - DSLQueryBuilder builder = TraversalBuilder - .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output()); - - builder.to(AAIObjectType.P_INTERFACE).limit(2).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id")); - assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id') LIMIT 2", - builder.build().get()); - } - - @Test - public void equalsTest() { - DSLQueryBuilder builder = TraversalBuilder - .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output()); - - builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id")); - assertTrue( - builder.equals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')")); - assertTrue(builder.equals(builder)); - } - - @Test - public void mixedTypeTest() { - DSLQueryBuilder builder = TraversalBuilder.fragment(new DSLStartNode(AAIObjectType.CLOUD_REGION, - __.key("cloud-owner", "owner"), __.key("cloud-region-id", "id"))); - builder.to(__.node(AAIObjectType.VLAN_TAG, __.key("vlan-id-outer", 167), __.key("my-boolean", true)).output()); - assertTrue(builder.equals( - "cloud-region('cloud-owner', 'owner')('cloud-region-id', 'id') > vlan-tag*('vlan-id-outer', 167)('my-boolean', true)")); - } - - @Test - public void outputOnNodeLambdasTest() { - DSLQueryBuilder builder = TraversalBuilder - .fragment(new DSLStartNode(AAIObjectType.L_INTERFACE, new DSLNodeKey("interface-id", "myId"))); - - builder.to(AAIObjectType.VSERVER, __.key("vserver-name", "myName")).output().to(AAIObjectType.P_INTERFACE) - .output(); - assertEquals("l-interface('interface-id', 'myId') > vserver*('vserver-name', 'myName') > p-interface*", - builder.build().get()); - } - - @Test - public void skipOutputOnUnionTest() { - DSLQueryBuilder builder = TraversalBuilder - .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output()); - - builder.union(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()), - __.node(AAIObjectType.VSERVER) - .to(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()))) - .output(); - - assertEquals( - "generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, " + "vserver > pserver* > complex* ]", - builder.build().get()); - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java deleted file mode 100644 index 157109c119..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities; - -import static org.junit.Assert.assertEquals; -import java.io.IOException; -import java.io.Serializable; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.springframework.util.SerializationUtils; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@RunWith(MockitoJUnitRunner.class) -public class AAIResultWrapperTest { - String json; - @Rule - public ExpectedException thrown = ExpectedException.none(); - - AAIResultWrapper aaiResultWrapper; - AAIResultWrapper aaiResultWrapperEmpty; - - @Before - public void init() throws IOException { - final String RESOURCE_PATH = "src/test/resources/__files/aai/resources/"; - json = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "e2e-complex.json"))); - - aaiResultWrapper = new AAIResultWrapper(json); - aaiResultWrapperEmpty = new AAIResultWrapper("{}"); - } - - @Test - public void testAAIResultWrapperIsSerializable() throws IOException { - AAIResultWrapper original = new AAIResultWrapper(""); - byte[] serialized = SerializationUtils.serialize(original); - AAIResultWrapper deserialized = (AAIResultWrapper) SerializationUtils.deserialize(serialized); - assertEquals(deserialized.getJson(), original.getJson()); - } - - @Test - public void testGetRelationshipsEmpty() { - Optional relationships = aaiResultWrapperEmpty.getRelationships(); - assertEquals("Compare relationships", Optional.empty(), relationships); - } - - @Test - public void testAsMap() throws JsonParseException, JsonMappingException, IOException { - ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper(); - Map expected = mapper.readValue(json, new TypeReference>() {}); - - Map actual = aaiResultWrapper.asMap(); - assertEquals(expected, actual); - } - - @Test - public void testAsMapEmpty() { - Map actual = aaiResultWrapperEmpty.asMap(); - assertEquals(new HashMap<>(), actual); - } - - @Test - public void nullCases() { - - AAIResultWrapper wrapper = new AAIResultWrapper(null); - - assertEquals(Optional.empty(), wrapper.getRelationships()); - assertEquals("{}", wrapper.getJson()); - assertEquals(Optional.empty(), wrapper.asBean(GenericVnf.class)); - assertEquals(true, wrapper.asMap().isEmpty()); - assertEquals("{}", wrapper.toString()); - - } - - @Test - public void objectConstructor() { - AAIResultWrapper wrapper = new AAIResultWrapper(new GenericVnf()); - assertEquals("{}", wrapper.getJson()); - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java deleted file mode 100644 index 039bbb3614..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities; - -import static org.junit.Assert.assertTrue; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.List; -import org.junit.Test; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; - -public class RelationshipsTest { - - private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/resources/"; - - @Test - public void run() throws IOException { - final String content = new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "e2e-complex.json"))); - - AAIResultWrapper wrapper = new AAIResultWrapper(content); - Relationships relationships = wrapper.getRelationships().get(); - - List test = relationships.getRelatedUris(AAIObjectType.VCE); - List uris = Arrays.asList( - AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a9fec18e-1ea3-40e4-a6c0-a89b3de07053"), - AAIUriFactory.createResourceUri(AAIObjectType.VCE, "8ae1e5f8-61f1-4c71-913a-b40cc4593cb9"), - AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a2935fa9-b743-49f4-9813-a127f13c4e93"), - AAIUriFactory.createResourceUri(AAIObjectType.VCE, "c7fe7698-8063-4e26-8bd3-ca3edde0b0d4")); - - assertTrue(uris.containsAll(test) && test.containsAll(uris)); - - } - -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java deleted file mode 100644 index 0249bea794..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.uri; - -import static org.junit.Assert.assertEquals; -import org.junit.Test; -import org.onap.so.client.aai.AAIObjectType; - -public class AAISimpleUriFromParentUriTest { - - - @Test - public void appendChildren() { - - AAIResourceUri parentUri = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "key1", "key2", "key3"); - - AAIResourceUri uri = new AAISimpleUri(parentUri, AAIObjectType.ALLOTTED_RESOURCE, "key4"); - - assertEquals("path appended", - "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4", - uri.build().toString()); - - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java deleted file mode 100644 index 6bf67ffce8..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.uri; - -import static org.junit.Assert.assertEquals; -import javax.ws.rs.core.UriBuilder; -import org.junit.Test; -import org.onap.so.client.aai.AAIObjectType; - -public class AAISimpleUriFromUriTest { - - - - @Test - public void removeHost() { - - AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN, - UriBuilder - .fromUri("https://localhost:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053") - .build()); - - assertEquals("root and version removed", "/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", - uri.build().toString()); - - } - - @Test - public void noChange() { - - AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN, - UriBuilder.fromUri("/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053").build()); - - assertEquals("no change", "/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", uri.build().toString()); - - } - - @Test - public void encodingPreserved() { - - AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN, - UriBuilder.fromUri("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053").build()); - - assertEquals("encoding preserved", "/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053", - uri.build().toString()); - - } - - @Test - public void beforeBuildEquality() { - - AAIResourceUri uri = new AAISimpleUri(AAIObjectType.VCE, - UriBuilder.fromUri("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053").build()); - - AAIResourceUri uri2 = new AAISimpleUri(AAIObjectType.VCE, "a9f ec18e-1ea3-40e4-a6c0-a89b3de07053"); - assertEquals("are equal", uri2, uri); - - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java deleted file mode 100644 index 6c1b3d69a2..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.uri; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.util.Map; -import org.junit.Test; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.entities.uri.Depth; - -public class AAISimpleUriTest { - - - - @Test - public void relatedToTestPlural() { - AAIPluralResourceUri uri = - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1").relatedTo(AAIObjectPlurals.PSERVER); - String uriOutput = uri.build().toString(); - assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers", uriOutput); - } - - @Test - public void relatedToTestSingular() { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1") - .relatedTo(AAIObjectType.PSERVER, "test2"); - String uriOutput = uri.build().toString(); - assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers/pserver/test2", uriOutput); - } - - @Test - public void cloneTestSingular() { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1"); - AAIResourceUri cloned = uri.clone(); - assertEquals("/network/generic-vnfs/generic-vnf/test1", cloned.build().toString()); - - cloned.limit(2); - - assertNotEquals(uri.build().toString(), cloned.build().toString()); - } - - @Test - public void cloneTestPlural() { - AAISimplePluralUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF); - AAISimplePluralUri cloned = uri.clone(); - assertEquals("/network/generic-vnfs", cloned.build().toString()); - } - - @Test - public void cloneTestWithRelatedTo() { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1") - .relatedTo(AAIObjectType.PSERVER, "test2"); - String uriOutput = uri.clone().build().toString(); - assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers/pserver/test2", uriOutput); - } - - @Test - public void cloneTestPluralWithRelatedTo() { - AAIPluralResourceUri uri = - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1").relatedTo(AAIObjectPlurals.PSERVER); - String uriOutput = uri.clone().build().toString(); - assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers", uriOutput); - } - - @Test - public void getKeysTest() { - AAIResourceUri uri = - AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, "cloud1", "cloud2", "tenant1", "vserver1"); - Map keys = uri.getURIKeys(); - System.out.println(keys); - System.out.println(uri.build()); - assertEquals("vserver1", keys.get("vserver-id")); - } - - @Test - public void getEncodedKeyTest() { - AAIResourceUri uri = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "test1", "my value", "test3"); - Map keys = uri.getURIKeys(); - - assertEquals("my value", keys.get("service-type")); - } - - @Test - public void serializeTest() throws IOException, ClassNotFoundException { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1"); - - uri.depth(Depth.ONE); - uri.limit(1); - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - - ObjectOutputStream objectOutputStream = new ObjectOutputStream(bos); - objectOutputStream.writeObject(uri); - objectOutputStream.flush(); - objectOutputStream.close(); - - ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); - - ObjectInputStream objectInputStream = new ObjectInputStream(bis); - AAIResourceUri e2 = (AAIResourceUri) objectInputStream.readObject(); - objectInputStream.close(); - - uri.queryParam("test", "value"); - e2.queryParam("test", "value"); - - assertEquals(e2.build().toString(), uri.build().toString()); - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java deleted file mode 100644 index 8a203f6439..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.uri; - -import static org.junit.Assert.assertEquals; -import org.junit.Test; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; - -public class AAIUriFactoryTest { - - @Test - public void testCreateResourceUri() { - - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)"); - - String expected = "/network/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29"; - assertEquals(expected, uri.build().toString()); - } - - @Test - public void testCreateNodesUri() { - - AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)"); - - String expected = "/nodes/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29"; - assertEquals(expected, uri.build().toString()); - } - - @Test - public void testCreateResourceFromExistingURI() { - - AAIResourceUri uri = new AAISimpleUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)"); - AAIResourceUri uri2 = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.GENERIC_VNF, uri.build()); - - String expected = "/network/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29"; - assertEquals(expected, uri2.build().toString()); - } - - @Test - public void testCreateResourceURIForPluralsWithValues() { - - AAIPluralResourceUri uri = - AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, "customerId", "serviceType"); - - String expected = - "/business/customers/customer/customerId/service-subscriptions/service-subscription/serviceType/service-instances"; - assertEquals(expected, uri.build().toString()); - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java deleted file mode 100644 index a92a7c3c1a..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.uri; - -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.spy; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import javax.ws.rs.core.UriBuilder; -import org.junit.Test; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriNotFoundException; - -public class AllottedResourceLookupUriTest { - - @Test - public void oneKey() - throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException { - - AllottedResourceLookupUri instance = new AllottedResourceLookupUri("key1"); - AllottedResourceLookupUri spy = spy(instance); - doReturn( - "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4") - .when(spy).getObjectById(any(Object.class)); - - final URI result = spy.locateAndBuild(); - final URI expected = UriBuilder.fromPath( - "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4") - .build(); - assertEquals("result is equal", expected, result); - - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java deleted file mode 100644 index 3fbbc7c110..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.so.client.aai.entities.uri; - -import static org.hamcrest.CoreMatchers.equalTo; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.exceptions.IncorrectNumberOfUriKeys; - -public class IncorrectNumberOfUriKeysTest { - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - @Test - public void verifyIncorrectNumberOfKeysSingle() { - - thrown.expect(IncorrectNumberOfUriKeys.class); - thrown.expectMessage(equalTo("Expected 3 variables: [cloud-owner, cloud-region-id, volume-group-id]")); - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, "volume-group-id"); - - } - - @Test - public void verifyIncorrectNumberOfKeysPlural() { - - thrown.expect(IncorrectNumberOfUriKeys.class); - AAISimplePluralUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, "my-cloud-owner"); - - } - - @Test - public void verifyIncorrectNumberOfKeysFromParent() { - - thrown.expect(IncorrectNumberOfUriKeys.class); - AAIResourceUri parentUri = - AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, "my-cloud-owner", "my-cloud-region-id"); - AAIResourceUri uri = AAIUriFactory.createResourceFromParentURI(parentUri, AAIObjectType.VOLUME_GROUP); - } - - @Test - public void verifyIncorrectNumberOfKeysHttpAware() { - - thrown.expect(IncorrectNumberOfUriKeys.class); - AAIResourceUri uri = - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "customer-id", "subscription-id"); - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java deleted file mode 100644 index 71d65b6f45..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java +++ /dev/null @@ -1,301 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.aai.entities.uri; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.collection.IsIterableContainingInOrder.contains; -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.net.URI; -import java.net.URISyntaxException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Optional; -import javax.ws.rs.NotFoundException; -import javax.ws.rs.core.UriBuilder; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.runner.RunWith; -import org.mockito.ArgumentMatchers; -import org.mockito.InjectMocks; -import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.client.aai.AAIClient; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl; -import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriNotFoundException; -import com.github.tomakehurst.wiremock.junit.WireMockRule; - -@RunWith(MockitoJUnitRunner.class) -public class ServiceInstanceUriTest { - - private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/resources/"; - - @Rule - public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort()); - - @Rule - public final ExpectedException exception = ExpectedException.none(); - - @Spy - public AAIClient client; - - @InjectMocks - public AAIResourcesClient aaiClient = new AAIResourcesClient(); - - @Before - public void beforeTest() { - doReturn(new DefaultAAIPropertiesImpl(wireMockRule.port())).when(client).getRestProperties(); - } - - @Test - public void found() throws IOException { - final String content = new String( - Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "service-instance-pathed-query.json"))); - - ServiceInstanceUri instance = new ServiceInstanceUri("key3"); - final Optional result = instance.extractRelatedLink(content); - final String expected = - "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"; - assertEquals("result is equal", expected, result.get()); - - } - - @Test - public void oneKey() - throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException { - - ServiceInstanceUri instance = new ServiceInstanceUri("key1"); - ServiceInstanceUri spy = spy(instance); - doReturn( - "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3") - .when(spy).getObjectById(any(Object.class)); - - final URI result = spy.locateAndBuild(); - final URI expected = UriBuilder.fromPath( - "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3") - .build(); - assertEquals("result is equal", expected, result); - - } - - @Test - public void oneKeyQueryParams() - throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException { - - ServiceInstanceUri instance = new ServiceInstanceUri("key1"); - ServiceInstanceUri spy = spy(instance); - doReturn( - "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3") - .when(spy).getObjectById(any(Object.class)); - - final URI result = ((HttpAwareUri) spy.resourceVersion("1234")).locateAndBuild(); - final URI expected = UriBuilder.fromUri( - "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234") - .build(); - assertEquals("result is equal", expected, result); - - } - - @Test - public void oneKeyEncoded() - throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException { - - ServiceInstanceUri instance = new ServiceInstanceUri("key1"); - ServiceInstanceUri spy = spy(instance); - doReturn( - "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space") - .when(spy).getObjectById(any(Object.class)); - - final URI result = spy.locateAndBuild(); - final URI expected = UriBuilder.fromUri( - "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space") - .build(); - assertEquals("result is equal", expected, result); - - } - - @Test - public void oneKeyGetKeys() - throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException { - - ServiceInstanceUri instance = new ServiceInstanceUri("key1"); - ServiceInstanceUri spy = spy(instance); - doReturn( - "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%28space") - .when(spy).getObjectById(any(Object.class)); - - assertThat(spy.getURIKeys().values(), contains("key1", "key2", "key3(space")); - - } - - @Test - public void oneKeyClone() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException { - ServiceInstanceUri instance = new ServiceInstanceUri("key1"); - ServiceInstanceUri spy = spy(instance); - String uri = - "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"; - doReturn(Optional.of(uri)).when(spy).getCachedValue(); - final URI result = ((HttpAwareUri) spy.resourceVersion("1234").clone()).locateAndBuild(); - final URI expected = UriBuilder.fromUri( - "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234") - .build(); - assertEquals("result is equal", expected, result); - } - - @Test - public void threeKey() throws IOException { - - ServiceInstanceUri instance = new ServiceInstanceUri("key1", "key2", "key3"); - final URI result = instance.build(); - final URI expected = UriBuilder.fromPath( - "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3") - .build(); - assertEquals("result is equal", expected, result); - - } - - @Test - public void notfound() throws IOException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException { - final String content = - new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "empty-query-result.json"))); - - ServiceInstanceUri instance = new ServiceInstanceUri("key3"); - ServiceInstanceUri spy = spy(instance); - AAIResourcesClient mockResourcesClient = mock(AAIResourcesClient.class); - AAIResultWrapper wrapper = mock(AAIResultWrapper.class); - when(mockResourcesClient.get(ArgumentMatchers.any(AAIResourceUri.class), - ArgumentMatchers.>any())).thenReturn(wrapper); - when(wrapper.getJson()).thenReturn(content); - when(spy.getResourcesClient()).thenReturn(mockResourcesClient); - exception.expect(GraphInventoryUriComputationException.class); - spy.locateAndBuild(); - - } - - @Test - public void cloneTest() { - ServiceInstanceUri instance = new ServiceInstanceUri("key1", "key2", "key3"); - final URI result = instance.build(); - final URI result2 = instance.clone().queryParam("something", "new").build(); - assertEquals("uris are not equal", false, result.toString().equals(result2.toString())); - - } - - @Test - public void noVertexFound() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException { - ServiceInstanceUri instance = new ServiceInstanceUri("key3"); - ServiceInstanceUri spy = spy(instance); - AAIResourcesClient client = aaiClient; - doReturn(client).when(spy).getResourcesClient(); - wireMockRule - .stubFor(get(urlPathMatching("/aai/v[0-9]+/nodes/service-instances/service-instance/key3")).willReturn( - aResponse().withStatus(404).withHeader("Content-Type", "application/json").withBodyFile(""))); - exception.expect(NotFoundException.class); - spy.locateAndBuild(); - } - - @Test - public void serializeTest() throws IOException, ClassNotFoundException, GraphInventoryUriNotFoundException, - GraphInventoryPayloadException { - ServiceInstanceUri instance = new ServiceInstanceUri("key3"); - final String content = new String( - Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "service-instance-pathed-query.json"))); - - ServiceInstanceUri spy = spy(instance); - AAIResourcesClient mockResourcesClient = mock(AAIResourcesClient.class); - AAIResultWrapper wrapper = mock(AAIResultWrapper.class); - when(mockResourcesClient.get(ArgumentMatchers.any(AAIResourceUri.class), - ArgumentMatchers.>any())).thenReturn(wrapper); - when(wrapper.getJson()).thenReturn(content); - when(spy.getResourcesClient()).thenReturn(mockResourcesClient); - spy.locateAndBuild(); - instance = spy.clone(); - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - - ObjectOutputStream objectOutputStream = new ObjectOutputStream(bos); - objectOutputStream.writeObject(instance); - objectOutputStream.flush(); - objectOutputStream.close(); - - ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); - - ObjectInputStream objectInputStream = new ObjectInputStream(bis); - ServiceInstanceUri e2 = (ServiceInstanceUri) objectInputStream.readObject(); - objectInputStream.close(); - - ServiceInstanceUri spy2 = spy(e2); - - assertEquals(spy2.build().toString(), instance.build().toString()); - - // use the cached value do not call out to external system - verify(spy2, times(0)).getResourcesClient(); - } - - @Test - public void relatedToTest() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException { - ServiceInstanceUri instance = new ServiceInstanceUri("key1"); - ServiceInstanceUri spy = spy(instance); - doReturn( - "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3") - .when(spy).getObjectById(any(Object.class)); - - final URI result = spy.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "my-vnf-name").build(); - final URI expected = UriBuilder.fromUri( - "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/related-to/generic-vnfs?vnf-name=my-vnf-name") - .build(); - assertEquals("result is equal", expected, result); - } - - @Test - public void relatedToEqualityTestBeforeBuildTest() - throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException { - ServiceInstanceUri instance = new ServiceInstanceUri("key1"); - ServiceInstanceUri spy = spy(instance); - - final AAIPluralResourceUri result = - spy.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "my-vnf-name"); - - assertEquals("result is equal", result, result); - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/objects/CustomAAIObjectType.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/objects/CustomAAIObjectType.java deleted file mode 100644 index f437197f71..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/aai/objects/CustomAAIObjectType.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.so.client.aai.objects; - -import org.onap.so.client.aai.AAINamespaceConstants; -import org.onap.so.client.aai.AAIObjectType; - -public class CustomAAIObjectType extends AAIObjectType { - - private static final long serialVersionUID = 1919729212831978098L; - - public static final AAIObjectType CUSTOM = - new CustomAAIObjectType(AAINamespaceConstants.NETWORK, "my-url", "my-custom-name"); - - /* Default constructor automatically called by AAIObjectType */ - public CustomAAIObjectType() { - super(); - } - - protected CustomAAIObjectType(String parent, String uri, String name) { - super(parent, uri, name); - } - -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/defaultproperties/DefaultAAIPropertiesImpl.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/defaultproperties/DefaultAAIPropertiesImpl.java deleted file mode 100644 index 7789386667..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/defaultproperties/DefaultAAIPropertiesImpl.java +++ /dev/null @@ -1,95 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.defaultproperties; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; -import org.onap.so.client.aai.AAIProperties; -import org.onap.so.client.aai.AAIVersion; - -public class DefaultAAIPropertiesImpl implements AAIProperties { - - - final Map props; - - public DefaultAAIPropertiesImpl() { - File initialFile = new File("src/test/resources/aai.properties"); - Map temp; - try (InputStream targetStream = new FileInputStream(initialFile)) { - Properties properties = new Properties(); - properties.load(targetStream); - temp = properties; - } catch (IOException e) { - temp = new HashMap<>(); - } - this.props = temp; - - } - - public DefaultAAIPropertiesImpl(int port) { - File initialFile = new File("src/test/resources/aai.properties"); - Map temp; - try (InputStream targetStream = new FileInputStream(initialFile)) { - Properties properties = new Properties(); - properties.load(targetStream); - temp = properties; - } catch (IOException e) { - temp = new HashMap<>(); - } - this.props = temp; - this.props.put("aai.endpoint", this.props.get("aai.endpoint").toString().replaceFirst(":\\d+", ":" + port)); - - } - - @Override - public URL getEndpoint() throws MalformedURLException { - return new URL(props.get("aai.endpoint").toString()); - } - - @Override - public String getSystemName() { - return "MSO"; - } - - @Override - public AAIVersion getDefaultVersion() { - return AAIVersion.LATEST; - } - - @Override - public String getAuth() { - Object value = props.get("aai.auth"); - return value == null ? null : value.toString(); - } - - @Override - public String getKey() { - Object value = props.get("mso.msoKey"); - return value == null ? null : value.toString(); - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverterTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverterTest.java deleted file mode 100644 index 1f047b3b36..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverterTest.java +++ /dev/null @@ -1,118 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.HashMap; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.graphinventory.GraphInventoryPatchConverter; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - - -@RunWith(MockitoJUnitRunner.class) -public class GraphInventoryPatchConverterTest { - - private ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper(); - - @Test - public void convertObjectToPatchFormatTest() - throws URISyntaxException, JsonParseException, JsonMappingException, IOException { - GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter(); - GenericVnf vnf = new GenericVnf(); - vnf.setIpv4Loopback0Address(""); - String result = validator.marshallObjectToPatchFormat(vnf); - GenericVnf resultObj = mapper.readValue(result.toString(), GenericVnf.class); - assertTrue("expect object to become a String to prevent double marshalling", result instanceof String); - assertNull("expect null because of custom mapper", resultObj.getIpv4Loopback0Address()); - - } - - @Test - public void convertStringToPatchFormatTest() - throws URISyntaxException, JsonParseException, JsonMappingException, IOException { - GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter(); - String payload = "{\"ipv4-loopback0-address\":\"\"}"; - String result = validator.marshallObjectToPatchFormat(payload); - - assertEquals("expect no change", payload, result); - } - - @Test - public void convertStringToPatchFormatNull_Test() - throws URISyntaxException, JsonParseException, JsonMappingException, IOException { - GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter(); - String payload = "{\"ipv4-loopback0-address\": null}"; - String result = validator.marshallObjectToPatchFormat(payload); - System.out.println(result); - assertEquals("expect no change", payload, result); - } - - @Test - public void convertMapToPatchFormatTest() - throws URISyntaxException, JsonParseException, JsonMappingException, IOException { - GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter(); - HashMap map = new HashMap<>(); - map.put("ipv4-loopback0-address", ""); - map.put("ipv4-loopback1-address", "192.168.1.1"); - String result = validator.marshallObjectToPatchFormat(map); - - assertEquals("expect string", "{\"ipv4-loopback1-address\":\"192.168.1.1\"}", result); - } - - @Test - public void hasComplexObjectTest() { - GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter(); - String hasNesting = "{ \"hello\" : \"world\", \"nested\" : { \"key\" : \"value\" } }"; - String noNesting = "{ \"hello\" : \"world\" }"; - String arrayCase = - "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"nestedComplex\" : [{\"key\" : \"value\"}]}"; - String empty = "{}"; - String arrayCaseSimpleOnly = "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"]}"; - String relationshipListCaseNesting = - "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"relationship-list\" : [{\"key\" : \"value\"}], \"nested\" : { \"key\" : \"value\" }}"; - String relationshipListCase = - "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"relationship-list\" : [{\"key\" : \"value\"}]}"; - String nothing = ""; - - assertTrue("expect has nesting", validator.hasComplexObject(hasNesting)); - assertFalse("expect no nesting", validator.hasComplexObject(noNesting)); - assertTrue("expect has nesting", validator.hasComplexObject(arrayCase)); - assertFalse("expect no nesting", validator.hasComplexObject(empty)); - assertFalse("expect no nesting", validator.hasComplexObject(arrayCaseSimpleOnly)); - assertFalse("expect no nesting", validator.hasComplexObject(relationshipListCase)); - assertTrue("expect has nesting", validator.hasComplexObject(relationshipListCaseNesting)); - assertFalse("expect no nesting", validator.hasComplexObject(nothing)); - } - -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImplTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImplTest.java deleted file mode 100644 index fb26e1870e..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImplTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.so.client.graphinventory.entities.uri.parsers; - -import static org.junit.Assert.assertEquals; -import java.util.Map; -import org.junit.Test; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.entities.uri.parsers.UriParser; -import org.onap.so.client.graphinventory.entities.uri.parsers.UriParserSpringImpl; - -public class UriParserSpringImplTest { - - - - @Test - public void reverseTemplate() { - final UriParser parser = new UriParserSpringImpl(AAIObjectType.SERVICE_INSTANCE.toString()); - final String uri = - "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"; - - Map result = parser.parse(uri); - - assertEquals("found customer-id", "key1", result.get("global-customer-id")); - assertEquals("found service-type", "key2", result.get("service-type")); - assertEquals("found service-instance-id", "key3", result.get("service-instance-id")); - - } -} diff --git a/graph-inventory/aai-client/src/test/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadExceptionTest.java b/graph-inventory/aai-client/src/test/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadExceptionTest.java deleted file mode 100644 index 6b23cbbe86..0000000000 --- a/graph-inventory/aai-client/src/test/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadExceptionTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei 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.so.client.graphinventory.exceptions; - -import org.junit.Test; -import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException; - -public class GraphInventoryPayloadExceptionTest { - - Throwable t = new Throwable(); - - @Test - public void callConstructorTest() throws Exception { - - GraphInventoryPayloadException test1 = new GraphInventoryPayloadException("testing"); - - GraphInventoryPayloadException test2 = new GraphInventoryPayloadException("testing", t); - - GraphInventoryPayloadException test3 = new GraphInventoryPayloadException(t); - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java index fae55ff84b..665fa547cc 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java @@ -36,10 +36,10 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.*; import org.onap.aai.domain.yang.v16.ServiceInstance; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.apache.http.HttpStatus; import org.json.JSONObject; import org.onap.logging.filter.base.ErrorCode; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java index a522129c31..a87e94a6e0 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java @@ -11,19 +11,19 @@ import org.onap.aai.domain.yang.Tenant; import org.onap.aai.domain.yang.VfModule; import org.onap.aai.domain.yang.VolumeGroup; import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound; -import org.onap.so.client.aai.AAIDSLQueryClient; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.entities.DSLQuery; -import org.onap.so.client.graphinventory.entities.DSLQueryBuilder; -import org.onap.so.client.graphinventory.entities.DSLStartNode; -import org.onap.so.client.graphinventory.entities.Node; -import org.onap.so.client.graphinventory.entities.Start; -import org.onap.so.client.graphinventory.entities.TraversalBuilder; -import org.onap.so.client.graphinventory.entities.__; +import org.onap.aaiclient.client.aai.AAIDSLQueryClient; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.entities.DSLQuery; +import org.onap.aaiclient.client.graphinventory.entities.DSLQueryBuilder; +import org.onap.aaiclient.client.graphinventory.entities.DSLStartNode; +import org.onap.aaiclient.client.graphinventory.entities.Node; +import org.onap.aaiclient.client.graphinventory.entities.Start; +import org.onap.aaiclient.client.graphinventory.entities.TraversalBuilder; +import org.onap.aaiclient.client.graphinventory.entities.__; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java index f37713d5b2..8b270f8d5a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java @@ -32,8 +32,8 @@ import org.onap.aai.domain.yang.VolumeGroup; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound; import org.onap.so.apihandlerinfra.infra.rest.exception.CloudConfigurationNotFoundException; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.so.constants.Status; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; @@ -277,7 +277,7 @@ public class BpmnRequestBuilder { public CloudConfiguration mapCloudConfiguration(GenericVnf vnf, String vfModuleId) { CloudConfiguration cloudConfig = new CloudConfiguration(); AAIResultWrapper wrapper = new AAIResultWrapper(vnf); - Optional relationshipsOpt = wrapper.getRelationships(); + Optional relationshipsOpt = wrapper.getRelationships(); String tenantId = null; String cloudOwner = null; String lcpRegionId = null; @@ -319,7 +319,7 @@ public class BpmnRequestBuilder { public CloudConfiguration mapCloudConfigurationVolume(GenericVnf vnf, VolumeGroup volumeGroup) { CloudConfiguration cloudConfig = new CloudConfiguration(); AAIResultWrapper wrapper = new AAIResultWrapper(vnf); - Optional relationshipsOpt = wrapper.getRelationships(); + Optional relationshipsOpt = wrapper.getRelationships(); String tenantId = null; String cloudOwner = null; String lcpRegionId = null; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java index db2b5b6b4e..822627863a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java @@ -22,8 +22,8 @@ package org.onap.so.apihandlerinfra.tenantisolation; import java.net.MalformedURLException; import java.net.URL; -import org.onap.so.client.aai.AAIProperties; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIProperties; +import org.onap.aaiclient.client.aai.AAIVersion; import org.onap.so.spring.SpringContextHelper; import org.springframework.context.ApplicationContext; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java index 6942d441e6..a28298f859 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java @@ -28,12 +28,12 @@ import java.util.Map; import javax.ws.rs.NotFoundException; import org.onap.aai.domain.yang.OperationalEnvironment; import org.onap.so.apihandlerinfra.tenantisolation.exceptions.AAIClientCallFailed; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.entities.uri.Depth; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.springframework.stereotype.Component; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java index 9b24a14f68..4a244a6a7b 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java @@ -36,10 +36,10 @@ import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper; import org.onap.so.apihandlerinfra.tenantisolation.helpers.ActivateVnfDBHelper; import org.onap.so.apihandlerinfra.tenantisolation.helpers.SDCClientHelper; import org.onap.so.apihandlerinfra.tenantisolationbeans.ServiceModelList; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.so.db.request.beans.OperationalEnvDistributionStatus; import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus; import org.onap.logging.filter.base.ErrorCode; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java index 77579817ff..67c5aa2aaa 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java @@ -40,7 +40,7 @@ import org.onap.so.apihandlerinfra.tenantisolation.helpers.ActivateVnfDBHelper; import org.onap.so.apihandlerinfra.tenantisolation.helpers.SDCClientHelper; import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution; import org.onap.so.apihandlerinfra.tenantisolationbeans.DistributionStatus; -import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.so.db.request.beans.OperationalEnvDistributionStatus; import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus; import org.onap.logging.filter.base.ErrorCode; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java index d6969a9851..23537a7687 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java @@ -37,7 +37,7 @@ import org.onap.so.apihandlerinfra.tenantisolation.exceptions.TenantIsolationExc import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper; import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientObjectBuilder; import org.onap.so.apihandlerinfra.tenantisolationbeans.RelatedInstanceList; -import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.so.client.grm.GRMClient; import org.onap.so.client.grm.beans.OperationalInfo; import org.onap.so.client.grm.beans.Property; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java index 59f7621b90..b30140cd68 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java @@ -32,7 +32,7 @@ import org.onap.so.apihandlerinfra.exceptions.ValidateException; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper; -import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; import org.onap.so.requestsdb.RequestsDBHelper; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/AAIDeserializeTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/AAIDeserializeTest.java index e6409fab87..a279144eba 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/AAIDeserializeTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/AAIDeserializeTest.java @@ -31,7 +31,7 @@ import javax.ws.rs.core.MediaType; import org.junit.Before; import org.junit.Test; import org.onap.aai.domain.yang.Tenant; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIVersion; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java index faac11715a..389ff28dbd 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java @@ -41,11 +41,11 @@ import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.VfModule; import org.onap.aai.domain.yang.VolumeGroup; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.constants.Status; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.serviceinstancebeans.CloudConfiguration; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java index 3a389ce227..75d98180ac 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java @@ -40,8 +40,8 @@ import org.apache.http.HttpStatus; import org.junit.Test; import org.onap.aai.domain.yang.OperationalEnvironment; import org.onap.so.apihandlerinfra.BaseTest; -import org.onap.so.client.aai.AAIVersion; -import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.springframework.beans.factory.annotation.Autowired; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java index feebbd49d1..2cf9662b82 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java @@ -50,8 +50,8 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.RecoveryAction; import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestDetails; import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters; import org.onap.so.apihandlerinfra.tenantisolationbeans.ServiceModelList; -import org.onap.so.client.aai.AAIVersion; -import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.so.db.request.beans.InfraActiveRequests; import org.springframework.beans.factory.annotation.Autowired; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java index 9100e82beb..b21b468ce3 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java @@ -46,7 +46,7 @@ import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution; import org.onap.so.apihandlerinfra.tenantisolationbeans.DistributionStatus; import org.onap.so.apihandlerinfra.tenantisolationbeans.Status; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIVersion; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.beans.OperationalEnvDistributionStatus; import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java index 0f096ee374..865bfd12a2 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java @@ -44,7 +44,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment; import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestDetails; import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestInfo; import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIVersion; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.MessageEnum; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java index 6c00f8db27..59fc5075d5 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java @@ -41,7 +41,7 @@ import org.onap.aai.domain.yang.OperationalEnvironment; import org.onap.so.apihandlerinfra.BaseTest; import org.onap.so.apihandlerinfra.exceptions.ApiException; import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIVersion; import org.onap.so.client.grm.beans.Property; import org.onap.so.client.grm.beans.ServiceEndPointList; import org.onap.so.db.request.beans.InfraActiveRequests; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java index 9911bb8cb8..e49d8f7fe6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java @@ -41,7 +41,7 @@ import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandlerinfra.BaseTest; import org.onap.so.apihandlerinfra.exceptions.ValidateException; import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIVersion; import org.onap.so.db.request.beans.InfraActiveRequests; import org.springframework.beans.factory.annotation.Autowired; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/so-simulator/src/main/java/org/onap/so/simulator/AAIPropertiesImpl.java b/so-simulator/src/main/java/org/onap/so/simulator/AAIPropertiesImpl.java index a0c0007927..ae4583eca8 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/AAIPropertiesImpl.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/AAIPropertiesImpl.java @@ -22,10 +22,10 @@ package org.onap.so.simulator; import java.net.MalformedURLException; import java.net.URL; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIVersion; -public class AAIPropertiesImpl implements org.onap.so.client.aai.AAIProperties { +public class AAIPropertiesImpl implements org.onap.aaiclient.client.aai.AAIProperties { public static final String AAI_ENDPOINT = "aai.endpoint"; diff --git a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/DeleteVServers.java b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/DeleteVServers.java index 17a9846407..27d4ce78fd 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/DeleteVServers.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/DeleteVServers.java @@ -1,9 +1,9 @@ package org.onap.so.simulator.actions.aai; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.consol.citrus.actions.AbstractTestAction; diff --git a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessNetwork.java b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessNetwork.java index 7b6fb36fab..21f9528f0f 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessNetwork.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessNetwork.java @@ -1,10 +1,10 @@ package org.onap.so.simulator.actions.aai; import org.onap.aai.domain.yang.L3Network; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.consol.citrus.actions.AbstractTestAction; diff --git a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java index f586a22c45..f790d804ca 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java @@ -1,10 +1,10 @@ package org.onap.so.simulator.actions.aai; import org.onap.aai.domain.yang.Vnfc; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.consol.citrus.actions.AbstractTestAction; diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateAAInventory.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateAAInventory.java index c8fddcf19c..371c72dca9 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateAAInventory.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateAAInventory.java @@ -2,11 +2,11 @@ package org.onap.so.simulator.scenarios.openstack; import java.io.InputStream; import org.onap.aai.domain.yang.Vserver; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.core.io.ClassPathResource; -- cgit 1.2.3-korg