summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/.gitignore1
-rw-r--r--common/pom.xml346
-rw-r--r--common/src/main/java/org/onap/so/client/DefaultProperties.java42
-rw-r--r--common/src/main/java/org/onap/so/client/HttpClient.java53
-rw-r--r--common/src/main/java/org/onap/so/client/PreconditionFailedException.java (renamed from common/src/main/java/org/openecomp/mso/client/PreconditionFailedException.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/ResponseExceptionMapper.java (renamed from common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapper.java)35
-rw-r--r--common/src/main/java/org/onap/so/client/ResponseExceptionMapperImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapperImpl.java)16
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java320
-rw-r--r--common/src/main/java/org/onap/so/client/RestClientSSL.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/RestClientSSL.java)41
-rw-r--r--common/src/main/java/org/onap/so/client/RestProperties.java (renamed from common/src/main/java/org/openecomp/mso/client/RestProperties.java)15
-rw-r--r--common/src/main/java/org/onap/so/client/RestPropertiesLoader.java (renamed from common/src/main/java/org/openecomp/mso/client/RestPropertiesLoader.java)18
-rw-r--r--common/src/main/java/org/onap/so/client/RestRequest.java91
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIClient.java62
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIClientResponseExceptionMapper.java)34
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java35
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAICommonObjectMapperProvider.java)16
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIConfigurationClient.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIConfigurationClient.java)35
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIErrorFormatter.java)11
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAINamespaceConstants.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAINamespaceConstants.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIObjectPlurals.java)26
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectType.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIObjectType.java)166
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIProperties.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIProperties.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIQueryClient.java)50
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIQueryObjectMapperProvider.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIQueryObjectMapperProvider.java)7
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesClient.java)100
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIResourcesObjectMapperProvider.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesObjectMapperProvider.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIRestClient.java131
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientI.java)11
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientImpl.java)42
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAISubgraphType.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAISubgraphType.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAITransactionalClient.java)43
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIUpdator.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIUpdator.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIUpdatorImpl.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIValidator.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIValidator.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIValidatorImpl.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIVersion.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIVersion.java)13
-rw-r--r--common/src/main/java/org/onap/so/client/aai/EmptyStringToNullSerializer.java52
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIEntity.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntity.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIEntityObject.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntityObject.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIError.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/AAIError.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/AAIResultWrapper.java)38
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/Configuration.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/Configuration.java)7
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/CustomQuery.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/Relationships.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/Relationships.java)30
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/RequestError.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/RequestError.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/Results.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/Results.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/ServiceException.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/ServiceException.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/OperationBody.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transaction.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transaction.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transactions.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transactions.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIResourceUri.java)22
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java111
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUri.java)30
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactory.java)29
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/NodesUri.java)19
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUri.java)81
-rw-r--r--common/src/main/java/org/onap/so/client/aai/objects/AAIOperationalEnvironment.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOperationalEnvironment.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/objects/AAIServiceInstance.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/objects/AAIServiceInstance.java)240
-rw-r--r--common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java79
-rw-r--r--common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestProperties.java29
-rw-r--r--common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultDmaapPropertiesImpl.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/defaultproperties/PolicyRestPropertiesImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/defaultproperties/PolicyRestPropertiesImpl.java)14
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/Consumer.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/Consumer.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/DmaapClient.java)19
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java)20
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapProperties.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/DmaapProperties.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapPropertiesLoader.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPropertiesLoader.java)19
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapPublisher.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPublisher.java)12
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/Publisher.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/Publisher.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/exceptions/DMaaPConsumerFailure.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/DMaaPConsumerFailure.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/exceptions/ExceededMaximumPollingTime.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/ExceededMaximumPollingTime.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java)32
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/PropertiesBean.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/rest/PropertiesBean.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/RestConsumer.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestConsumer.java)13
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/RestPublisher.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestPublisher.java)11
-rw-r--r--common/src/main/java/org/onap/so/client/exceptions/SDNOException.java (renamed from common/src/main/java/org/openecomp/mso/client/exceptions/SDNOException.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/Format.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/Format.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java48
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectName.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIObjectName.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java25
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java25
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriPartial.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriPartial.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriTemplate.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriTemplate.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryVersion.java25
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/Depth.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/Depth.java)9
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java44
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java60
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/SimpleUri.java)75
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParser.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParser.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImpl.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/BulkProcessFailed.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/exceptions/BulkProcessFailed.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java31
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadException.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadException.java)14
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriComputationException.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriComputationException.java)12
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriNotFoundException.java)10
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMAction.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/GRMAction.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMClient.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/GRMClient.java)18
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMDefaultPropertiesImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/GRMDefaultPropertiesImpl.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMProperties.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/GRMProperties.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMPropertiesLoader.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/GRMPropertiesLoader.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMRestClient.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/GRMRestClient.java)31
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMRestInvoker.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/GRMRestInvoker.java)10
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/OperationalInfo.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/OperationalInfo.java)16
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/Property.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/Property.java)16
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPoint.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPoint.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointList.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointList.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookup.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookup.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookupRequest.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookupRequest.java)13
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointRequest.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointRequest.java)13
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/Status.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/Status.java)16
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/Version.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/Version.java)16
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/VersionLookup.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/VersionLookup.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/grm/exceptions/GRMClientCallFailed.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/exceptions/GRMClientCallFailed.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/CommonObjectMapperProvider.java)15
-rw-r--r--common/src/main/java/org/onap/so/client/policy/DecisionAttributes.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/DecisionAttributes.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/policy/JettisonStyleMapperProvider.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/JettisonStyleMapperProvider.java)22
-rw-r--r--common/src/main/java/org/onap/so/client/policy/LoggingFilter.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java)10
-rw-r--r--common/src/main/java/org/onap/so/client/policy/PolicyClient.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/PolicyClient.java)11
-rw-r--r--common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/PolicyClientImpl.java)48
-rw-r--r--common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java)38
-rw-r--r--common/src/main/java/org/onap/so/client/policy/PolicyRestProperties.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java)12
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/AllowedTreatments.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/AllowedTreatments.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/Bbid.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/Bbid.java)138
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/DecisionAttributes.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/DecisionAttributes.java)52
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/DictionaryData.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryData.java)174
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/DictionaryItemsRequest.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryItemsRequest.java)7
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryJson.java)71
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/Id.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/Id.java)102
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/PolicyDecision.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/PolicyDecision.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/PolicyDecisionRequest.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/PolicyDecisionRequest.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/Treatments.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/Treatments.java)138
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/Workstep.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/Workstep.java)139
-rw-r--r--common/src/main/java/org/onap/so/client/ruby/RubyClient.java (renamed from common/src/main/java/org/openecomp/mso/client/ruby/RubyClient.java)18
-rw-r--r--common/src/main/java/org/onap/so/client/ruby/beans/Event.java (renamed from common/src/main/java/org/openecomp/mso/client/ruby/beans/Event.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/ruby/beans/MsoRequest.java (renamed from common/src/main/java/org/openecomp/mso/client/ruby/beans/MsoRequest.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/ruby/beans/Ruby.java (renamed from common/src/main/java/org/openecomp/mso/client/ruby/beans/Ruby.java)7
-rw-r--r--common/src/main/java/org/onap/so/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java (renamed from common/src/main/java/org/openecomp/mso/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/SDNOHealthCheckClient.java)24
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/SDNOValidator.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java)25
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidatorImpl.java)56
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/beans/AAIParamList.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/Body.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/beans/Body.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/Input.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/beans/Input.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHdCustom.java)31
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHealthDiagnostic.java)26
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/beans/ResultInfo.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/beans/SDNO.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java)14
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java)8
-rw-r--r--common/src/main/java/org/onap/so/entity/MsoRequest.java (renamed from common/src/main/java/org/openecomp/mso/entity/MsoRequest.java)9
-rw-r--r--common/src/main/java/org/onap/so/entity/package-info.java (renamed from common/src/main/java/org/openecomp/mso/entity/package-info.java)2
-rw-r--r--common/src/main/java/org/onap/so/exceptions/MarshallerException.java (renamed from common/src/main/java/org/openecomp/mso/utils/RootIgnoringObjectMapper.java)40
-rw-r--r--common/src/main/java/org/onap/so/exceptions/ValidationException.java54
-rw-r--r--common/src/main/java/org/onap/so/jsonpath/JsonPathUtil.java (renamed from common/src/main/java/org/openecomp/mso/jsonpath/JsonPathUtil.java)13
-rw-r--r--common/src/main/java/org/onap/so/logger/LoggerStartupListener.java87
-rw-r--r--common/src/main/java/org/onap/so/logger/MessageEnum.java (renamed from common/src/main/java/org/openecomp/mso/logger/MessageEnum.java)456
-rw-r--r--common/src/main/java/org/onap/so/logger/MsoAlarmLogger.java (renamed from common/src/main/java/org/openecomp/mso/logger/MsoAlarmLogger.java)8
-rw-r--r--common/src/main/java/org/onap/so/logger/MsoLogger.java (renamed from common/src/main/java/org/openecomp/mso/logger/MsoLogger.java)527
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsClientLogging.java135
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java180
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/SpringClientFilter.java67
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/CustomSetterMustExistRule.java (renamed from common/src/main/java/org/openecomp/mso/openpojo/rules/CustomSetterMustExistRule.java)8
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java (renamed from common/src/main/java/org/openecomp/mso/openpojo/rules/EqualsAndHashCodeTester.java)6
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java (renamed from common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationMatcher.java)20
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java (renamed from common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java)8
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/HasEqualsAndHashCodeRule.java (renamed from common/src/main/java/org/openecomp/mso/openpojo/rules/HasEqualsAndHashCodeRule.java)4
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/HasToStringRule.java (renamed from common/src/main/java/org/openecomp/mso/openpojo/rules/HasToStringRule.java)4
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/ToStringTester.java (renamed from common/src/main/java/org/openecomp/mso/openpojo/rules/ToStringTester.java)4
-rw-r--r--common/src/main/java/org/onap/so/properties/MsoDatabaseException.java (renamed from common/src/main/java/org/openecomp/mso/properties/MsoDatabaseException.java)2
-rw-r--r--common/src/main/java/org/onap/so/security/MSOSpringFirewall.java34
-rw-r--r--common/src/main/java/org/onap/so/security/UserCredentials.java53
-rw-r--r--common/src/main/java/org/onap/so/security/UserDetailsServiceImpl.java56
-rw-r--r--common/src/main/java/org/onap/so/security/WebSecurityConfig.java76
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/CloudConfiguration.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ExceptionType.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/ExceptionType.java)13
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationListResponse.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationListResponse.java)4
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationResponse.java)2
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/InstanceDirection.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceDirection.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/InstanceReferences.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceReferences.java)8
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/LineOfBusiness.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/LineOfBusiness.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ModelInfo.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelInfo.java)23
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelType.java)5
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Networks.java98
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/OwningEntity.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/OwningEntity.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Platform.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/Platform.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/PolicyException.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/PolicyException.java)4
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Project.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/Project.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstance.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstance.java)4
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstanceList.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstanceList.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Request.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/Request.java)5
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestDetails.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestDetails.java)33
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestError.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestError.java)9
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestInfo.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestList.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestList.java)2
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestParameters.java)75
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestReferences.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestReferences.java)8
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestStatus.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecisionRequest.java)66
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Service.java98
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ServiceException.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceException.java)7
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java)2
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesResponse.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesResponse.java)2
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/SubscriberInfo.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/SubscriberInfo.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/VfModules.java99
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Vnfs.java131
-rw-r--r--common/src/main/java/org/onap/so/test/categories/SlowTests.java25
-rw-r--r--common/src/main/java/org/onap/so/utils/CheckResults.java (renamed from common/src/main/java/org/openecomp/mso/utils/CheckResults.java)2
-rw-r--r--common/src/main/java/org/onap/so/utils/CryptoUtils.java (renamed from common/src/main/java/org/openecomp/mso/utils/CryptoUtils.java)40
-rw-r--r--common/src/main/java/org/onap/so/utils/TargetEntity.java (renamed from common/src/main/java/org/openecomp/mso/properties/MsoPropertiesParameters.java)17
-rw-r--r--common/src/main/java/org/onap/so/utils/UUIDChecker.java (renamed from common/src/main/java/org/openecomp/mso/utils/UUIDChecker.java)12
-rw-r--r--common/src/main/java/org/onap/so/utils/XmlMarshaller.java84
-rw-r--r--common/src/main/java/org/onap/so/web/exceptions/ExceptionResponse.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecision.java)46
-rw-r--r--common/src/main/java/org/onap/so/web/exceptions/RuntimeExceptionMapper.java46
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIClient.java69
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java76
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOwningEntity.java67
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/objects/AAIProject.java55
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/RestClient.java243
-rw-r--r--common/src/main/java/org/openecomp/mso/db/AbstractSessionFactoryManager.java74
-rw-r--r--common/src/main/java/org/openecomp/mso/logger/LogFilter.java68
-rw-r--r--common/src/main/java/org/openecomp/mso/logger/MsoLogInitializer.java108
-rw-r--r--common/src/main/java/org/openecomp/mso/logger/MsoLoggingServlet.java163
-rw-r--r--common/src/main/java/org/openecomp/mso/properties/AbstractMsoProperties.java75
-rw-r--r--common/src/main/java/org/openecomp/mso/properties/MsoJavaProperties.java228
-rw-r--r--common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java167
-rw-r--r--common/src/main/java/org/openecomp/mso/properties/MsoPropertiesException.java51
-rw-r--r--common/src/main/java/org/openecomp/mso/properties/MsoPropertiesFactory.java395
-rw-r--r--common/src/main/java/org/openecomp/mso/properties/MsoPropertyInitializer.java87
-rw-r--r--common/src/main/java/org/openecomp/mso/utils/RootIgnoringJsonDeserializer.java67
-rw-r--r--common/src/main/resources/Policy.properties12
-rw-r--r--common/src/main/resources/dmaap/default-consumer.properties2
-rw-r--r--common/src/main/resources/dmaap/default-publisher.properties2
-rw-r--r--common/src/main/resources/test159
-rw-r--r--common/src/test/java/org/onap/so/BeansTest.java97
-rw-r--r--common/src/test/java/org/onap/so/adapter_utils/tests/CryptoTest.java (renamed from common/src/test/java/org/openecomp/mso/adapter_utils/tests/CryptoTest.java)8
-rw-r--r--common/src/test/java/org/onap/so/adapter_utils/tests/MsoAlarmLoggerTest.java (renamed from common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoAlarmLoggerTest.java)33
-rw-r--r--common/src/test/java/org/onap/so/adapter_utils/tests/MsoLoggerTest.java (renamed from common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java)12
-rw-r--r--common/src/test/java/org/onap/so/client/RestClientTest.java87
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIClientResponseExceptionMapperTest.java70
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIConfigurationClientTest.java181
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java (renamed from common/src/test/java/org/openecomp/mso/client/aai/AAIExceptionMapperTest.java)39
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java (renamed from common/src/test/java/org/openecomp/mso/client/aai/AAIObjectTypeTest.java)22
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIPServerTest.java (renamed from common/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java)6
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java93
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java (renamed from common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java)106
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java124
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java148
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIURITest.java (renamed from common/src/test/java/org/openecomp/mso/client/aai/AAIURITest.java)10
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIUpdatorImplTest.java (renamed from common/src/test/java/org/openecomp/mso/client/aai/AAIUpdatorImplTest.java)6
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIUpdatorTest.java61
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java (renamed from common/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java)6
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java94
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java (renamed from common/src/test/java/org/openecomp/mso/client/aai/entities/RelationshipsTest.java)28
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java (renamed from common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriFromUriTest.java)17
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java (renamed from common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriTest.java)23
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java (renamed from common/src/test/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactoryTest.java)40
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java (renamed from common/src/test/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUriTest.java)62
-rw-r--r--common/src/test/java/org/onap/so/client/aai/objects/AAIOperationalEnvironmentTest.java (renamed from common/src/test/java/org/openecomp/mso/client/aai/objects/AAIOperationalEnvironmentTest.java)34
-rw-r--r--common/src/test/java/org/onap/so/client/aai/objects/AAIServiceInstanceTest.java (renamed from common/src/test/java/org/openecomp/mso/client/aai/objects/AAIServiceInstanceTest.java)34
-rw-r--r--common/src/test/java/org/onap/so/client/defaultproperties/DefaultAAIPropertiesImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java)8
-rw-r--r--common/src/test/java/org/onap/so/client/dmaap/DmaapClientTest.java (renamed from common/src/test/java/org/openecomp/mso/client/dmaap/DmaapClientTest.java)8
-rw-r--r--common/src/test/java/org/onap/so/client/dmaap/DmaapPublisherTest.java (renamed from common/src/test/java/org/openecomp/mso/client/dmaap/DmaapPublisherTest.java)6
-rw-r--r--common/src/test/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImplTest.java (renamed from common/src/test/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImplTest.java)10
-rw-r--r--common/src/test/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadExceptionTest.java (renamed from common/src/test/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadExceptionTest.java)15
-rw-r--r--common/src/test/java/org/onap/so/client/grm/GRMBeansTest.java (renamed from common/src/test/java/org/openecomp/mso/client/grm/GRMBeansTest.java)10
-rw-r--r--common/src/test/java/org/onap/so/client/grm/GRMClientTest.java (renamed from common/src/test/java/org/openecomp/mso/client/grm/GRMClientTest.java)74
-rw-r--r--common/src/test/java/org/onap/so/client/grm/ServiceEndPointListTest.java (renamed from common/src/test/java/org/openecomp/mso/client/grm/ServiceEndPointListTest.java)12
-rw-r--r--common/src/test/java/org/onap/so/client/grm/ServiceEndPointRequestTest.java (renamed from common/src/test/java/org/openecomp/mso/client/grm/ServiceEndPointRequestTest.java)16
-rw-r--r--common/src/test/java/org/onap/so/client/policy/PolicyClientImplTest.java (renamed from common/src/test/java/org/openecomp/mso/client/policy/PolicyClientImplTest.java)215
-rw-r--r--common/src/test/java/org/onap/so/client/policy/entities/PolicyEntitiesTest.java (renamed from common/src/test/java/org/openecomp/mso/client/policy/entities/PolicyEntitiesTest.java)8
-rw-r--r--common/src/test/java/org/onap/so/client/ruby/RubyCheckClientTest.java (renamed from common/src/test/java/org/openecomp/mso/client/ruby/RubyCheckClientTest.java)10
-rw-r--r--common/src/test/java/org/onap/so/client/ruby/beans/RubyBeansTest.java (renamed from common/src/test/java/org/openecomp/mso/client/ruby/beans/RubyBeansTest.java)8
-rw-r--r--common/src/test/java/org/onap/so/client/sdno/SDNOHealthCheckClientTest.java (renamed from common/src/test/java/org/openecomp/mso/client/sdno/SDNOHealthCheckClientTest.java)10
-rw-r--r--common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java (renamed from common/src/test/java/org/openecomp/mso/client/sdno/SDNOValidatorTest.java)18
-rw-r--r--common/src/test/java/org/onap/so/client/sdno/beans/SdnoBeansTest.java (renamed from common/src/test/java/org/openecomp/mso/client/sdno/beans/SdnoBeansTest.java)8
-rw-r--r--common/src/test/java/org/onap/so/entity/MsoRequestTest.java (renamed from common/src/test/java/org/openecomp/mso/entity/MsoRequestTest.java)12
-rw-r--r--common/src/test/java/org/onap/so/exceptions/ValidationExceptionTest.java53
-rw-r--r--common/src/test/java/org/onap/so/jsonpath/JsonPathUtilTest.java (renamed from common/src/test/java/org/openecomp/mso/jsonpath/JsonPathUtilTest.java)14
-rw-r--r--common/src/test/java/org/onap/so/serviceinstancebeans/ServiceInstanceBeansTest.java (renamed from common/src/test/java/org/openecomp/mso/serviceinstancebeans/ServiceInstanceBeansTest.java)12
-rw-r--r--common/src/test/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequestTest.java (renamed from common/src/test/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequestTest.java)6
-rw-r--r--common/src/test/java/org/onap/so/utils/CheckResultsTest.java (renamed from common/src/test/java/org/openecomp/mso/utils/CheckResultsTest.java)28
-rw-r--r--common/src/test/java/org/onap/so/utils/TestAppender.java41
-rw-r--r--common/src/test/java/org/onap/so/utils/UUIDCheckerTest.java (renamed from common/src/test/java/org/openecomp/mso/utils/UUIDCheckerTest.java)50
-rw-r--r--common/src/test/java/org/onap/so/utils/XMLMarshallerTest.java101
-rw-r--r--common/src/test/java/org/onap/so/web/exceptions/RuntimeExceptionMapperTest.java71
-rw-r--r--common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryConcurrencyTest.java174
-rw-r--r--common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java611
-rw-r--r--common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertyInitializerTest.java88
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/AAIConfigurationTest.java75
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/AAITransactionalClientTest.java83
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/objects/AAIOwningEntityTest.java40
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/objects/AAIProjectTest.java41
-rw-r--r--common/src/test/java/org/openecomp/mso/utils/RootIgnoringObjectMapperTest.java94
-rw-r--r--common/src/test/resources/__files/aai/bulkprocess/test-request-small.json10
-rw-r--r--common/src/test/resources/__files/aai/resources/e2e-complex.json78
-rw-r--r--common/src/test/resources/__files/aai/resources/service-instance-pathed-query.json2
-rw-r--r--common/src/test/resources/__files/grm/endpoints.json6
-rw-r--r--common/src/test/resources/dmaap.properties4
-rw-r--r--common/src/test/resources/logback-test.xml39
-rw-r--r--common/src/test/resources/mso-bad.json38
-rw-r--r--common/src/test/resources/org/onap/so/client/ruby/create-ticket/create-ticket-request.json (renamed from common/src/test/resources/org/openecomp/mso/client/ruby/create-ticket/create-ticket-request.json)0
-rw-r--r--common/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json (renamed from common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-post-check-request.json)1
-rw-r--r--common/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json (renamed from common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-pre-check-request.json)1
-rw-r--r--common/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json (renamed from common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-post-check-request.json)1
-rw-r--r--common/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json (renamed from common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-pre-check-request.json)1
-rw-r--r--common/src/test/resources/org/onap/so/client/sdno/output-failure.json (renamed from common/src/test/resources/org/openecomp/mso/client/sdno/output-failure.json)2
-rw-r--r--common/src/test/resources/org/onap/so/client/sdno/output-success.json (renamed from common/src/test/resources/org/openecomp/mso/client/sdno/output-success.json)0
-rw-r--r--common/src/test/resources/org/onap/so/client/sdno/response.json (renamed from common/src/test/resources/org/openecomp/mso/client/sdno/response.json)0
309 files changed, 7348 insertions, 6135 deletions
diff --git a/common/.gitignore b/common/.gitignore
new file mode 100644
index 0000000000..a791146dad
--- /dev/null
+++ b/common/.gitignore
@@ -0,0 +1 @@
+/tattletale-jar/
diff --git a/common/pom.xml b/common/pom.xml
index 86b9f36e50..8a5f5a2e37 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -1,149 +1,93 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- </parent>
- <artifactId>common</artifactId>
- <name>MSO Common classes</name>
- <description>MSO Common classes:- Logger</description>
- <properties>
- <spring.version>4.3.2.RELEASE</spring.version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- <version>0.0.1</version>
- <exclusions>
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>1.2.3</version>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- <version>1.2.3</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>3.1.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.spec.javax.ejb</groupId>
- <artifactId>jboss-ejb-api_3.2_spec</artifactId>
- <version>1.0.0.Final</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-ext-api</artifactId>
- <version>2.2.0.Final</version>
- <scope>provided</scope>
- </dependency>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>common</artifactId>
+ <name>MSO Common classes</name>
+ <description>MSO Common classes:- Logger</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.8.7</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.8.7</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.module</groupId>
+ <artifactId>jackson-module-jaxb-annotations</artifactId>
+ <version>2.4.0</version>
+ </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
<dependency>
- <groupId>com.openpojo</groupId>
- <artifactId>openpojo</artifactId>
- <version>0.8.6</version>
- </dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-security</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ </dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>2.2.0</version>
</dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- <version>4.3.6.Final</version>
- <exclusions>
- <!-- Avoid hibernate inclusion as provided in Jboss -->
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jandex</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.javassist</groupId>
- <artifactId>javassist</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-annotations</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.spec.javax.transaction</groupId>
- <artifactId>jboss-transaction-api_1.2_spec</artifactId>
- </exclusion>
- <exclusion>
- <groupId>antlr</groupId>
- <artifactId>antlr</artifactId>
- </exclusion>
- <exclusion>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>4.3.6.Final</version>
+ </dependency>
+ <dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-annotations_2.9.1</artifactId>
<version>1.3.0</version>
</dependency>
- <dependency>
- <groupId>org.onap.appc.client</groupId>
- <artifactId>client-kit</artifactId>
- <version>1.3.0</version>
- </dependency>
- <dependency>
- <groupId>org.onap.appc.client</groupId>
- <artifactId>client-lib</artifactId>
- <version>1.3.0</version>
- </dependency>
+ <dependency>
+ <groupId>org.onap.appc.client</groupId>
+ <artifactId>client-kit</artifactId>
+ <version>1.3.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.appc.client</groupId>
+ <artifactId>client-lib</artifactId>
+ <version>1.3.0</version>
+ </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
- <version>${spring.version}</version>
</dependency>
- <dependency>
- <groupId>org.onap.aai.aai-common</groupId>
- <artifactId>aai-schema</artifactId>
- <version>1.2.1</version>
- </dependency>
<dependency>
- <groupId>org.modelmapper</groupId>
- <artifactId>modelmapper</artifactId>
- <version>1.1.0</version>
+ <groupId>org.onap.aai.aai-common</groupId>
+ <artifactId>aai-schema</artifactId>
+ <!-- TODO: replace with release a version when -->
+ <!-- org.onap.aai.domain.yang.Collection has -->
+ <!-- been released -->
+ <version>1.3.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.modelmapper</groupId>
+ <artifactId>modelmapper</artifactId>
+ <version>1.1.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
@@ -151,6 +95,17 @@
<version>22.0</version>
</dependency>
<dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-client</artifactId>
+ <version>${cxf.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>com.shazam</groupId>
<artifactId>shazamcrest</artifactId>
<version>0.11</version>
@@ -166,94 +121,69 @@
</exclusion>
</exclusions>
</dependency>
+ <!--for yang decoder -->
+ <!--<dependency> <groupId>org.opendaylight.yangtools</groupId> <artifactId>yang-data-codec-gson</artifactId>
+ <version>1.1.1-Carbon</version> </dependency> <dependency> <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-dom-adapter</artifactId> <version>2.2.1-Carbon</version>
+ </dependency> <dependency> <groupId>org.opendaylight.mdsal</groupId> <artifactId>mdsal-dom-broker</artifactId>
+ <version>2.2.1-Carbon</version> </dependency> <dependency> <groupId>org.opendaylight.netconf</groupId>
+ <artifactId>sal-rest-connector</artifactId> <version>1.5.1-Carbon</version>
+ </dependency> <dependency> <groupId>org.dom4j</groupId> <artifactId>dom4j</artifactId>
+ <version>2.0.0</version> </dependency> -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-ext</artifactId>
+ <version>1.7.25</version>
+ </dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.17</version>
- </dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.2.3</version>
+ </dependency>
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>3.4</version>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>1.2.3</version>
</dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>3.9.0</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- </resource>
- <resource>
- <directory>src/main/java</directory>
- <includes>
- <include>**/*.java</include>
- </includes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-maven-plugin</artifactId>
- <version>0.0.1</version>
- <executions>
- <execution>
- <id>validate</id>
- <phase>install</phase>
- <goals>
- <goal>ValidateApplicationMsgs</goal>
- </goals>
- <configuration>
- <resources>
- <resource>
- <messageClass>org.openecomp.mso.logger.MessageEnum</messageClass>
- </resource>
- </resources>
- </configuration>
- </execution>
- <execution>
- <id>wiki</id>
- <phase>install</phase>
- <goals>
- <goal>WikiMsgGenerator</goal>
- </goals>
- <configuration>
- <outputDirectory>target/messages</outputDirectory>
- <outputFile>messages.html</outputFile>
- <wiki>
- <title>Messages and Codes</title>
- <space>APP</space>
- <page>Messages and Codes</page>
- <principal>test</principal>
- <credentials>test</credentials>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
- </wiki>
- <resources>
- <resource>
- <messageClass>org.openecomp.mso.logger.MessageEnum</messageClass>
- <header><![CDATA[<p> <ac:macro ac:name="toc"/> </p>
-<!-- <p> -->
-<!-- <ac:macro ac:name="anchor"> <ac:default-parameter>Application Messages</ac:default-parameter> </ac:macro> </p> <h2>Application Messages</h2>]]></header>
- -->
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>common</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
+ </dependency>
+ <dependency>
+ <groupId>janino</groupId>
+ <artifactId>janino</artifactId>
+ <version>2.5.15</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-configuration-processor</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>net.jodah</groupId>
+ <artifactId>failsafe</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-web</artifactId>
+ <version>5.0.5.RELEASE</version>
+ </dependency>
- </plugin>
- </plugins>
- </build>
+ </dependencies>
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
</project>
diff --git a/common/src/main/java/org/onap/so/client/DefaultProperties.java b/common/src/main/java/org/onap/so/client/DefaultProperties.java
new file mode 100644
index 0000000000..84509ead05
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/DefaultProperties.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.so.client;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public class DefaultProperties implements RestProperties {
+
+ private final URL url;
+ public DefaultProperties(URL url) {
+ this.url = url;
+ }
+ @Override
+ public URL getEndpoint() throws MalformedURLException {
+ return this.url;
+ }
+
+ @Override
+ public String getSystemName() {
+ return RestClient.ECOMP_COMPONENT_NAME;
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/HttpClient.java b/common/src/main/java/org/onap/so/client/HttpClient.java
new file mode 100644
index 0000000000..ad13745919
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/HttpClient.java
@@ -0,0 +1,53 @@
+/*-
+ * ============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;
+
+import java.net.URL;
+import java.util.Map;
+import java.util.Optional;
+
+import org.onap.so.utils.TargetEntity;
+
+public class HttpClient extends RestClient {
+
+ private TargetEntity targetEntity;
+ public HttpClient(URL host, String contentType, TargetEntity targetEntity) {
+ super(host, contentType);
+ this.targetEntity = targetEntity;
+
+ }
+
+ @Override
+ public TargetEntity getTargetEntity(){
+ return targetEntity;
+ }
+
+ @Override
+ protected void initializeHeaderMap(Map<String, String> headerMap) {
+
+ }
+
+ @Override
+ protected Optional<ResponseExceptionMapper> addResponseExceptionMapper() {
+ return Optional.empty();
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/PreconditionFailedException.java b/common/src/main/java/org/onap/so/client/PreconditionFailedException.java
index df28baac74..4ff07a616d 100644
--- a/common/src/main/java/org/openecomp/mso/client/PreconditionFailedException.java
+++ b/common/src/main/java/org/onap/so/client/PreconditionFailedException.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client;
+package org.onap.so.client;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
diff --git a/common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapper.java b/common/src/main/java/org/onap/so/client/ResponseExceptionMapper.java
index 19c178496c..31cdd50aee 100644
--- a/common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapper.java
+++ b/common/src/main/java/org/onap/so/client/ResponseExceptionMapper.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,10 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client;
+package org.onap.so.client;
import java.io.IOException;
import java.io.InputStream;
+import java.io.StringWriter;
import java.util.Optional;
import javax.ws.rs.BadRequestException;
@@ -33,24 +34,30 @@ import javax.ws.rs.NotAuthorizedException;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.NotSupportedException;
import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.client.ClientRequestContext;
-import javax.ws.rs.client.ClientResponseContext;
-import javax.ws.rs.client.ClientResponseFilter;
import javax.ws.rs.core.Response;
-public abstract class ResponseExceptionMapper implements ClientResponseFilter {
+import org.apache.commons.io.IOUtils;
- @Override
- public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {
- if (responseContext.getStatus() >= 300) {
+public abstract class ResponseExceptionMapper {
+
+ public void map(Response response) {
+
+ response.bufferEntity();
+ if (response.getStatus() >= 300) {
String message = "empty message";
- if (responseContext.hasEntity()) {
- Optional<String> result = this.extractMessage(responseContext.getEntityStream());
+ if (response.hasEntity()) {
+ StringWriter writer = new StringWriter();
+ try {
+ IOUtils.copy((InputStream)response.getEntity(), writer, "UTF-8");
+ } catch (IOException e) {
+ writer.append("failed to read entity stream");
+ }
+ Optional<String> result = this.extractMessage(writer.toString());
if (result.isPresent()) {
message = result.get();
}
}
- Response.Status status = Response.Status.fromStatusCode(responseContext.getStatus());
+ Response.Status status = Response.Status.fromStatusCode(response.getStatus());
WebApplicationException webAppException;
switch (status) {
case BAD_REQUEST:
@@ -90,5 +97,5 @@ public abstract class ResponseExceptionMapper implements ClientResponseFilter {
}
}
- public abstract Optional<String> extractMessage(InputStream stream) throws IOException;
+ public abstract Optional<String> extractMessage(String entity);
}
diff --git a/common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapperImpl.java b/common/src/main/java/org/onap/so/client/ResponseExceptionMapperImpl.java
index 7841d7accd..0392b49629 100644
--- a/common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapperImpl.java
+++ b/common/src/main/java/org/onap/so/client/ResponseExceptionMapperImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,26 +18,20 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client;
+package org.onap.so.client;
-import java.io.IOException;
-import java.io.InputStream;
import java.util.Optional;
import javax.annotation.Priority;
import javax.ws.rs.ext.Provider;
-import org.apache.commons.io.IOUtils;
-
@Provider
@Priority(Integer.MIN_VALUE)
public class ResponseExceptionMapperImpl extends ResponseExceptionMapper {
@Override
- public Optional<String> extractMessage(InputStream stream) throws IOException {
- final String input = IOUtils.toString(stream, "UTF-8");
- IOUtils.closeQuietly(stream);
- return Optional.of(input);
+ public Optional<String> extractMessage(String entity) {
+ return Optional.of(entity);
}
diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java
new file mode 100644
index 0000000000..79fd7df7ce
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/RestClient.java
@@ -0,0 +1,320 @@
+/*-
+ * ============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;
+
+import java.net.ConnectException;
+import java.net.MalformedURLException;
+import java.net.SocketTimeoutException;
+import java.net.URI;
+import java.net.URL;
+import java.security.GeneralSecurityException;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Optional;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Predicate;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Invocation.Builder;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.core.UriBuilder;
+
+import org.onap.so.client.policy.CommonObjectMapperProvider;
+import org.onap.so.client.policy.LoggingFilter;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.logging.jaxrs.filter.jersey.JaxRsClientLogging;
+import org.onap.so.utils.CryptoUtils;
+import org.onap.so.utils.TargetEntity;
+import org.slf4j.MDC;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+import net.jodah.failsafe.Failsafe;
+import net.jodah.failsafe.RetryPolicy;
+
+
+public abstract class RestClient {
+ public static final String ECOMP_COMPONENT_NAME = "MSO";
+
+ private static final int MAX_PAYLOAD_SIZE = 1024 * 1024;
+ private WebTarget webTarget;
+
+ protected final Map<String, String> headerMap;
+ protected final MsoLogger msoLogger;
+ protected URL host;
+ protected Optional<URI> path;
+ protected String accept;
+ protected String contentType;
+ protected String requestId;
+ protected JaxRsClientLogging jaxRsClientLogging;
+ protected RestProperties props;
+
+ protected RestClient(RestProperties props, Optional<URI> path) {
+
+ msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, RestClient.class);
+ this.requestId = MDC.get(MsoLogger.REQUEST_ID);
+ if (requestId == null) {
+ requestId = "";
+ }
+ headerMap = new HashMap<>();
+ try {
+ host = props.getEndpoint();
+ } catch (MalformedURLException e) {
+
+ throw new RuntimeException(e);
+ }
+ this.props = props;
+ this.path = path;
+ }
+
+ protected RestClient(RestProperties props, Optional<URI> path, String accept, String contentType) {
+ this(props, path);
+ this.accept = accept;
+ this.contentType = contentType;
+ this.requestId = MDC.get(MsoLogger.REQUEST_ID);
+ if (requestId == null) {
+ requestId = "";
+ }
+ this.props = props;
+ }
+
+ protected RestClient(URL host, String contentType) {
+ headerMap = new HashMap<>();
+
+ msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, RestClient.class);
+ this.path = Optional.empty();
+ this.host = host;
+ this.contentType = contentType;
+ this.requestId = MDC.get(MsoLogger.REQUEST_ID);
+ if (requestId == null) {
+ requestId = "";
+ }
+ this.props = new DefaultProperties(host);
+ }
+
+ /**
+ * Override method to return false to disable logging.
+ *
+ * @return true - to enable logging, false otherwise
+ */
+ protected boolean enableLogging() {
+ return true;
+ }
+
+ /**
+ * Override method to return custom value for max payload size.
+ *
+ * @return Default value for MAX_PAYLOAD_SIZE = 1024 * 1024
+ */
+ protected int getMaxPayloadSize()
+ {
+ return MAX_PAYLOAD_SIZE;
+ }
+
+ protected Builder getBuilder() {
+
+ if (webTarget == null) {
+ initializeClient(getClient());
+ }
+ Builder builder = webTarget.request();
+ initializeHeaderMap(headerMap);
+
+ headerMap.put("X-ECOMP-RequestID", requestId);
+ for (Entry<String, String> entry : headerMap.entrySet()) {
+ builder.header(entry.getKey(), entry.getValue());
+ }
+ return builder;
+ }
+
+ protected abstract void initializeHeaderMap(Map<String, String> headerMap);
+
+ protected Optional<ResponseExceptionMapper> addResponseExceptionMapper() {
+ return Optional.of(new ResponseExceptionMapperImpl());
+ }
+
+ protected CommonObjectMapperProvider getCommonObjectMapperProvider() {
+ return new CommonObjectMapperProvider();
+ }
+
+ /**
+ * Adds a basic authentication header to the request.
+ * @param auth the encrypted credentials
+ * @param key the key for decrypting the credentials
+ */
+ protected void addBasicAuthHeader(String auth, String key) {
+ try {
+ byte[] decryptedAuth = CryptoUtils.decrypt(auth, key).getBytes();
+ String authHeaderValue = "Basic " + Base64.getEncoder().encodeToString(decryptedAuth);
+ headerMap.put("Authorization", authHeaderValue);
+ } catch (GeneralSecurityException e) {
+ msoLogger.error(e.getMessage(), e);
+ }
+ }
+
+ protected String getAccept() {
+ return accept;
+ }
+
+ protected String getContentType() {
+ return contentType;
+ }
+
+ protected String getMergeContentType() {
+ return "application/merge-patch+json";
+ }
+
+ protected Client getClient() {
+ return ClientBuilder.newBuilder().build();
+ }
+
+ protected abstract TargetEntity getTargetEntity();
+
+ protected void initializeClient(Client client) {
+ if (this.enableLogging()) {
+ client.register(new LoggingFilter(this.getMaxPayloadSize()));
+ }
+ CommonObjectMapperProvider provider = this.getCommonObjectMapperProvider();
+ client.register(new JacksonJsonProvider(provider.getMapper()));
+
+ jaxRsClientLogging = new JaxRsClientLogging();
+ jaxRsClientLogging.setTargetService(getTargetEntity());
+ client.register(jaxRsClientLogging);
+
+ if (!path.isPresent()) {
+ webTarget = client.target(host.toString());
+ } else {
+ webTarget = client.target(UriBuilder.fromUri(host + path.get().toString()));
+ }
+ if (getAccept() == null || getAccept().isEmpty()) {
+ this.accept = MediaType.APPLICATION_JSON;
+ }
+ if (getContentType() == null || getContentType().isEmpty()) {
+ this.contentType = MediaType.APPLICATION_JSON;
+ }
+ }
+
+ protected List<Predicate<Throwable>> retryOn() {
+
+ List<Predicate<Throwable>> result = new ArrayList<>();
+
+ result.add(e -> {
+ return e.getCause() instanceof SocketTimeoutException;
+ });
+ result.add(e -> {
+ return e.getCause() instanceof ConnectException;
+ });
+ return result;
+ }
+
+ public Response get() {
+ return method("GET", null);
+ }
+
+ public Response post(Object obj) {
+ return method("POST", obj);
+ }
+
+ public Response patch(Object obj) {
+ return method("PATCH", obj);
+ }
+
+ public Response put(Object obj) {
+ return method("PUT", obj);
+ }
+
+ public Response delete() {
+ return method("DELETE", null);
+ }
+
+ public Response delete(Object obj) {
+ return method("DELETE", obj);
+ }
+
+ public <T> Optional<T> get(Class<T> resultClass) {
+ return format(method("GET", null), resultClass);
+ }
+
+ public <T> Optional<T> get(GenericType<T> resultClass) {
+ return format(method("GET", null), resultClass);
+ }
+
+ public <T> T post(Object obj, Class<T> resultClass) {
+ return format(method("POST", obj), resultClass).orElse(null);
+ }
+
+ public <T> T patch(Object obj, Class<T> resultClass) {
+ return format(method("PATCH", obj), resultClass).orElse(null);
+ }
+
+ public <T> T put(Object obj, Class<T> resultClass) {
+ return format(method("PUT", obj), resultClass).orElse(null);
+ }
+
+ public <T> T delete(Class<T> resultClass) {
+ return format(method("DELETE", null), resultClass).orElse(null);
+ }
+
+ public <T> T delete(Object obj, Class<T> resultClass) {
+ return format(method("DELETE", obj), resultClass).orElse(null);
+ }
+
+ private Response method(String method, Object entity) {
+ RetryPolicy policy = new RetryPolicy();
+
+ List<Predicate<Throwable>> items = retryOn();
+
+ Predicate<Throwable> pred = items.stream().reduce(Predicate::or).orElse(x -> false);
+
+ policy.retryOn(error -> pred.test(error));
+
+ policy.withDelay(this.props.getDelayBetweenRetries(), TimeUnit.MILLISECONDS)
+ .withMaxRetries(this.props.getRetries());
+
+ return Failsafe.with(policy).get(buildRequest(method, entity));
+ }
+
+ protected RestRequest buildRequest(String method, Object entity) {
+ return new RestRequest(this, method, entity);
+ }
+ private <T> Optional<T> format(Response response, Class<T> resultClass) {
+ if (this.props.mapNotFoundToEmpty() && response.getStatus() == Status.NOT_FOUND.getStatusCode()) {
+ return Optional.empty();
+ }
+ return Optional.of(response.readEntity(resultClass));
+ }
+
+ private <T> Optional<T> format(Response response, GenericType<T> resultClass) {
+ if (this.props.mapNotFoundToEmpty() && response.getStatus() == Status.NOT_FOUND.getStatusCode()) {
+ return Optional.empty();
+ }
+ return Optional.of(response.readEntity(resultClass));
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/RestClientSSL.java b/common/src/main/java/org/onap/so/client/RestClientSSL.java
index 6146fc373f..461bb5832c 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/RestClientSSL.java
+++ b/common/src/main/java/org/onap/so/client/RestClientSSL.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,47 +18,38 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client;
import java.io.FileInputStream;
-import java.io.IOException;
import java.net.URI;
-import java.security.NoSuchAlgorithmException;
import java.security.KeyStore;
+import java.security.NoSuchAlgorithmException;
import java.util.Optional;
-import java.util.Properties;
-import java.util.UUID;
import javax.net.ssl.SSLContext;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
-import org.openecomp.mso.client.RestProperties;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
public abstract class RestClientSSL extends RestClient {
public static final String SSL_KEY_STORE_KEY = "javax.net.ssl.keyStore";
- public static String SSL_KEY_STORE_PASSWORD_KEY;
+ public static final String SSL_KEY_STORE_PASSWORD_KEY = "javax.net.ssl.keyStorePassword";
public static final String MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY = "mso.load.ssl.client.keystore";
- protected RestClientSSL(RestProperties props, UUID requestId, Optional<URI> path) {
- super(props, requestId, path);
+ protected RestClientSSL(RestProperties props, Optional<URI> path) {
+ super(props, path);
}
- protected RestClientSSL(RestProperties props, UUID requestId, Optional<URI> path, String accept, String contentType) {
- super(props, requestId, path, accept, contentType);
+ protected RestClientSSL(RestProperties props, Optional<URI> path, String accept, String contentType) {
+ super(props, path, accept, contentType);
}
@Override
protected Client getClient() {
+
Client client = null;
- Properties keyProp = new Properties ();
try {
- keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("Policy.properties"));
- SSL_KEY_STORE_PASSWORD_KEY=(String) keyProp.get ("ssl.key.store.password.key");
String loadSSLKeyStore = System.getProperty(RestClientSSL.MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY);
if(loadSSLKeyStore != null && loadSSLKeyStore.equalsIgnoreCase("true")) {
KeyStore ks = getKeyStore();
@@ -71,22 +62,17 @@ public abstract class RestClientSSL extends RestClient {
//Use default SSL context
client = ClientBuilder.newBuilder().sslContext(SSLContext.getDefault()).build();
this.msoLogger.debug("RestClientSSL using default SSL context!");
- } catch (NoSuchAlgorithmException | IOException e) {
- this.msoLogger.error(MessageEnum.APIH_GENERAL_EXCEPTION, "AAI", "Client init", MsoLogger.ErrorCode.UnknownError, "could not create SSL client", e);
+ } catch (NoSuchAlgorithmException e) {
+ //this.logger.error(MessageEnum.APIH_GENERAL_EXCEPTION, "AAI", "Client init", MsoLogger.ErrorCode.UnknownError, "could not create SSL client", e);
throw new RuntimeException(e);
}
return client;
}
- private KeyStore getKeyStore() throws IOException {
+ private KeyStore getKeyStore() {
KeyStore ks = null;
- Properties keyProp = new Properties ();
-
- keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("Policy.properties"));
- SSL_KEY_STORE_PASSWORD_KEY=(String) keyProp.get ("ssl.key.store.password.key");
char[] password = System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY).toCharArray();
FileInputStream fis = null;
-
try {
ks = KeyStore.getInstance(KeyStore.getDefaultType());
fis = new FileInputStream(System.getProperty(RestClientSSL.SSL_KEY_STORE_KEY));
@@ -95,7 +81,6 @@ public abstract class RestClientSSL extends RestClient {
catch(Exception e) {
return null;
}
-
finally {
if (fis != null) {
try {
diff --git a/common/src/main/java/org/openecomp/mso/client/RestProperties.java b/common/src/main/java/org/onap/so/client/RestProperties.java
index ae8862de5e..7043e89b1e 100644
--- a/common/src/main/java/org/openecomp/mso/client/RestProperties.java
+++ b/common/src/main/java/org/onap/so/client/RestProperties.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client;
+package org.onap.so.client;
import java.net.MalformedURLException;
import java.net.URL;
@@ -27,4 +27,13 @@ public interface RestProperties {
public URL getEndpoint() throws MalformedURLException;
public String getSystemName();
+ public default Integer getRetries() {
+ return Integer.valueOf(2);
+ }
+ public default Long getDelayBetweenRetries() {
+ return Long.valueOf(500);
+ }
+ public default boolean mapNotFoundToEmpty() {
+ return false;
+ }
}
diff --git a/common/src/main/java/org/openecomp/mso/client/RestPropertiesLoader.java b/common/src/main/java/org/onap/so/client/RestPropertiesLoader.java
index 647acdfcf4..570b48ecb8 100644
--- a/common/src/main/java/org/openecomp/mso/client/RestPropertiesLoader.java
+++ b/common/src/main/java/org/onap/so/client/RestPropertiesLoader.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,16 +18,21 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client;
+package org.onap.so.client;
import java.util.Iterator;
import java.util.ServiceLoader;
public class RestPropertiesLoader {
- private final ServiceLoader<RestProperties> services;
+ /* required to make ServiceLoader thread safe */
+ private static final ThreadLocal<ServiceLoader<RestProperties>> services = new ThreadLocal<ServiceLoader<RestProperties>>() {
+ @Override
+ protected ServiceLoader<RestProperties> initialValue() {
+ return ServiceLoader.load(RestProperties.class);
+ }
+ };
private RestPropertiesLoader() {
- services = ServiceLoader.load(RestProperties.class);
}
private static class Helper {
@@ -47,7 +52,8 @@ public class RestPropertiesLoader {
private <T> T getImpl(Class<? extends RestProperties> clazz, boolean forceNewInstance) {
T result = null;
- Iterator<RestProperties> propertyImpls = services.iterator();
+ ServiceLoader<RestProperties> loader = this.services.get();
+ Iterator<RestProperties> propertyImpls = loader.iterator();
RestProperties item;
while (propertyImpls.hasNext()) {
item = propertyImpls.next();
diff --git a/common/src/main/java/org/onap/so/client/RestRequest.java b/common/src/main/java/org/onap/so/client/RestRequest.java
new file mode 100644
index 0000000000..25bf54b643
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/RestRequest.java
@@ -0,0 +1,91 @@
+/*-
+ * ============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;
+
+import java.util.Optional;
+import java.util.concurrent.Callable;
+
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+
+import org.onap.so.logger.MsoLogger;
+
+public class RestRequest implements Callable<Response> {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, RestRequest.class);
+
+ private final RestClient client;
+ private final String method;
+ private final Object entity;
+
+ public RestRequest(RestClient client, String method, Object entity) {
+ this.client = client;
+ this.method = method;
+ this.entity = entity;
+ }
+ @Override
+ public Response call() throws Exception {
+ final Response response;
+ if ("GET".equals(method)) {
+ response = this.client.getBuilder().accept(this.client.getAccept()).get();
+ } else if ("POST".equals(method)) {
+ response = this.client.getBuilder().accept(this.client.getAccept()).post(Entity.entity(entity, this.client.getContentType()));
+ } else if ("PATCH".equals(method)) {
+ response = this.client.getBuilder().header("X-HTTP-Method-Override", "PATCH").accept(this.client.getAccept())
+ .post(Entity.entity(entity, this.client.getMergeContentType()));
+ } else if ("DELETE".equals(method)) {
+ if (entity == null) {
+ response = this.client.getBuilder().accept(this.client.getAccept()).delete();
+
+ } else {
+ response = this.client.getBuilder().header("X-HTTP-Method-Override", "DELETE").accept(this.client.getAccept())
+ .post(Entity.entity(entity, this.client.getContentType()));
+ }
+ } else if ("PUT".equals(method)) {
+ response = this.client.getBuilder().accept(this.client.getAccept()).put(Entity.entity(entity, this.client.getContentType()));
+ } else {
+ response = Response.serverError().entity(method + " not valid").build();
+ }
+
+ Optional<ResponseExceptionMapper> mapper = this.client.addResponseExceptionMapper();
+ if (mapper.isPresent()) {
+ try {
+ mapper.get().map(response);
+ } catch (NotFoundException e) {
+ if (this.client.props.mapNotFoundToEmpty()) {
+ msoLogger.error(e);
+ return response;
+ } else {
+ throw e;
+ }
+ }
+ } else {
+ if (response.getStatus() == Status.NOT_FOUND.getStatusCode() && this.client.props.mapNotFoundToEmpty()) {
+ return response;
+ }
+ }
+
+ return response;
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIClient.java b/common/src/main/java/org/onap/so/client/aai/AAIClient.java
new file mode 100644
index 0000000000..39843b2263
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/AAIClient.java
@@ -0,0 +1,62 @@
+/*-
+ * ============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.core.UriBuilder;
+
+import org.onap.so.client.RestClient;
+import org.onap.so.client.graphinventory.GraphInventoryClient;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AAIClient extends GraphInventoryClient {
+
+ private static final String AAI_ROOT = "/aai";
+ protected static Logger logger = LoggerFactory.getLogger(AAIClient.class);
+ protected AAIVersion version;
+ public AAIClient() {
+ super(AAIProperties.class);
+ }
+
+ public AAIClient(AAIVersion version) {
+ super(AAIProperties.class);
+ }
+ @Override
+ protected URI constructPath(GraphInventoryUri uri) {
+
+ return UriBuilder.fromUri(AAI_ROOT + "/" + this.getVersion().toString() + uri.build().toString()).build();
+ }
+ @Override
+ protected RestClient createClient(GraphInventoryUri uri) {
+ return new AAIRestClient(getRestProperties(), constructPath(uri));
+ }
+
+ protected AAIVersion getVersion() {
+ if (version == null) {
+ return this.<AAIProperties>getRestProperties().getDefaultVersion();
+ } else {
+ return this.version;
+ }
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIClientResponseExceptionMapper.java b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java
index 657b4c5a2c..514eab6fc4 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIClientResponseExceptionMapper.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,44 +18,46 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import java.io.IOException;
-import java.io.InputStream;
import java.util.Optional;
-import java.util.UUID;
import javax.annotation.Priority;
import javax.ws.rs.ext.Provider;
-import org.openecomp.mso.client.ResponseExceptionMapper;
-import org.openecomp.mso.client.aai.entities.AAIError;
+import javax.annotation.Priority;
+import javax.ws.rs.ext.Provider;
+
+import org.onap.so.client.ResponseExceptionMapper;
+import org.onap.so.client.aai.entities.AAIError;
+import org.onap.so.logger.MsoLogger;
+import org.slf4j.MDC;
-import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.ObjectMapper;
@Provider
@Priority(Integer.MIN_VALUE)
public class AAIClientResponseExceptionMapper extends ResponseExceptionMapper {
- private final UUID requestId;
- public AAIClientResponseExceptionMapper(UUID requestId) {
- this.requestId = requestId;
+ private final String requestId;
+ public AAIClientResponseExceptionMapper() {
+ this.requestId = MDC.get(MsoLogger.REQUEST_ID);
}
@Override
- public Optional<String> extractMessage(InputStream stream) throws IOException {
+ public Optional<String> extractMessage(String entity) {
String errorString = "Error calling A&AI. Request-Id=" + this.getRequestId() + " ";
try {
- AAIError error = new ObjectMapper().readValue(stream, AAIError.class);
+ AAIError error = new ObjectMapper().readValue(entity, AAIError.class);
AAIErrorFormatter formatter = new AAIErrorFormatter(error);
return Optional.of(errorString + formatter.getMessage());
- } catch (JsonParseException e) {
- return Optional.of(errorString);
+ } catch (IOException e) {
+ return Optional.of(errorString + entity);
}
}
- protected UUID getRequestId() {
+ protected String getRequestId() {
return this.requestId;
}
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java b/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java
new file mode 100644
index 0000000000..33c9769400
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.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.so.client.aai;
+
+import com.fasterxml.jackson.databind.module.SimpleModule;
+
+public class AAICommonObjectMapperPatchProvider extends AAICommonObjectMapperProvider {
+
+
+ public AAICommonObjectMapperPatchProvider() {
+ super();
+ EmptyStringToNullSerializer sp = new EmptyStringToNullSerializer();
+ SimpleModule emptyStringModule = new SimpleModule();
+ emptyStringModule.addSerializer(String.class, sp);
+ mapper.registerModule(emptyStringModule);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAICommonObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java
index cbee903835..0e2071842f 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAICommonObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
-import javax.ws.rs.ext.ContextResolver;
+import org.onap.so.client.policy.CommonObjectMapperProvider;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -33,9 +33,7 @@ import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
-public class AAICommonObjectMapperProvider implements ContextResolver<ObjectMapper> {
-
- final ObjectMapper mapper;
+public class AAICommonObjectMapperProvider extends CommonObjectMapperProvider {
public AAICommonObjectMapperProvider() {
mapper = new ObjectMapper();
@@ -51,12 +49,4 @@ public class AAICommonObjectMapperProvider implements ContextResolver<ObjectMapp
mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(aiJaxb, aiJackson));
}
- @Override
- public ObjectMapper getContext(Class<?> type) {
- return mapper;
- }
-
- public ObjectMapper getMapper() {
- return mapper;
- }
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIConfigurationClient.java b/common/src/main/java/org/onap/so/client/aai/AAIConfigurationClient.java
index fdeb975ad1..b29c8070c8 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIConfigurationClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIConfigurationClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,18 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
-import org.openecomp.mso.client.aai.entities.Configuration;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-import org.openecomp.mso.serviceinstancebeans.RequestDetails;
+import org.onap.so.client.aai.entities.Configuration;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.serviceinstancebeans.RequestDetails;
public class AAIConfigurationClient {
private AAIResourcesClient aaiClient;
- private static final String ORCHESTRATION_STATUS = "PendingCreate";
+ private static final String ORCHESTRATION_STATUS = "PreCreated";
public AAIConfigurationClient() {
aaiClient = new AAIResourcesClient();
@@ -37,6 +37,16 @@ public class AAIConfigurationClient {
public void createConfiguration(RequestDetails requestDetails, String configurationId, String configurationType,
String configurationSubType) {
+
+ AAIResourceUri uri = getConfigurationURI(configurationId);
+ Configuration payload = configurePayload(requestDetails, configurationId, configurationType, configurationSubType);
+
+ aaiClient.create(uri, payload);
+ }
+
+ public Configuration configurePayload(RequestDetails requestDetails, String configurationId, String configurationType,
+ String configurationSubType) {
+
Configuration payload = new Configuration();
payload.setConfigurationId(configurationId);
payload.setConfigurationType(configurationType);
@@ -45,11 +55,10 @@ public class AAIConfigurationClient {
payload.setModelVersionId(requestDetails.getModelInfo().getModelVersionId());
payload.setOrchestrationStatus(ORCHESTRATION_STATUS);
payload.setOperationalStatus("");
- AAIResourceUri uri = getConfigurationURI(payload.getConfigurationId());
- payload.setConfigurationSelflink(uri.build().getPath());
+ payload.setConfigurationSelflink(getConfigurationURI(configurationId).build().getPath());
payload.setModelCustomizationId(requestDetails.getModelInfo().getModelCustomizationId());
-
- aaiClient.create(uri, payload);
+
+ return payload;
}
public void deleteConfiguration(String uuid) {
@@ -61,7 +70,7 @@ public class AAIConfigurationClient {
}
public Configuration getConfiguration(String uuid) {
- return aaiClient.get(Configuration.class, getConfigurationURI(uuid));
+ return aaiClient.get(Configuration.class, getConfigurationURI(uuid)).orElse(null);
}
public boolean configurationExists(String uuid) {
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIErrorFormatter.java b/common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java
index dd56e9712f..6b3bb545de 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIErrorFormatter.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,13 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import java.util.List;
-import java.util.Optional;
-import org.openecomp.mso.client.aai.entities.AAIError;
-import org.openecomp.mso.client.aai.entities.ServiceException;
+import org.onap.so.client.aai.entities.AAIError;
+import org.onap.so.client.aai.entities.ServiceException;
public class AAIErrorFormatter {
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAINamespaceConstants.java b/common/src/main/java/org/onap/so/client/aai/AAINamespaceConstants.java
index 4bdfc4d793..242fd41b19 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAINamespaceConstants.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAINamespaceConstants.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
public class AAINamespaceConstants {
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectPlurals.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java
index dc2831c1ed..c50653a203 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectPlurals.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java
@@ -18,22 +18,31 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
+
+import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
import com.google.common.base.CaseFormat;
-public enum AAIObjectPlurals implements AAIObjectName, AAIObjectUriTemplate, AAIObjectUriPartial {
+public enum AAIObjectPlurals implements GraphInventoryObjectPlurals {
GENERIC_VNF(AAINamespaceConstants.NETWORK, "/generic-vnfs"),
- PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers");
-
+ PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers"),
+ P_INTERFACE(AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces"),
+ L3_NETWORK(AAINamespaceConstants.NETWORK, "/l3-networks"),
+ SERVICE_SUBSCRIPTION(AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions"),
+ SERVICE_INSTANCE(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances"),
+ OWNING_ENTITIES(AAINamespaceConstants.BUSINESS, "/owning-entities"),
+ VOLUME_GROUP(AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups/");
+
+
private final String uriTemplate;
private final String partialUri;
private AAIObjectPlurals(String parentUri, String partialUri) {
this.uriTemplate = parentUri + partialUri;
this.partialUri = partialUri;
}
-
+
@Override
public String toString() {
return this.uriTemplate();
@@ -55,11 +64,6 @@ public enum AAIObjectPlurals implements AAIObjectName, AAIObjectUriTemplate, AAI
}
@Override
public String typeName(CaseFormat format) {
- String enumName = this.name();
- if (this.equals(AAIObjectType.DEFAULT_CLOUD_REGION) || this.equals(AAIObjectType.DEFAULT_TENANT)) {
- enumName = enumName.replace("DEFAULT_", "");
- }
-
- return CaseFormat.UPPER_UNDERSCORE.to(format, enumName);
+ return CaseFormat.UPPER_UNDERSCORE.to(format, this.name());
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
index 9026c29522..ce75b1716a 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectType.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,81 +18,87 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
-
-import com.google.common.base.CaseFormat;
-
-public enum AAIObjectType implements AAIObjectName, AAIObjectUriTemplate, AAIObjectUriPartial {
-
- DEFAULT_CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/att-aic/{cloud-region-id}"),
- CUSTOMER(AAINamespaceConstants.BUSINESS, "/customers/customer/{global-customer-id}"),
- GENERIC_QUERY("/search", "/generic-query"),
- BULK_PROCESS("/bulkprocess", ""),
- GENERIC_VNF(AAINamespaceConstants.NETWORK, "/generic-vnfs/generic-vnf/{vnf-id}"),
- VF_MODULE(AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules/vf-module/{vf-module-id}"),
- L3_NETWORK(AAINamespaceConstants.NETWORK, "/l3-networks/l3-network/{network-id}"),
- NETWORK_POLICY(AAINamespaceConstants.NETWORK, "/network-policies/network-policy/{network-policy-id}"),
- NODES_QUERY("/search", "/nodes-query"),
- CUSTOM_QUERY("/query", ""),
- ROUTE_TABLE_REFERENCE(AAINamespaceConstants.NETWORK, "/route-table-references/route-table-reference/{route-table-reference-id}"),
- DEFAULT_TENANT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/att-aic/AAIAIC25", "/tenants/tenant/{tenant-id}"),
- VCE(AAINamespaceConstants.NETWORK, "/vces/vce/{vnf-id}"),
- VPN_BINDING(AAINamespaceConstants.NETWORK, "/vpn-bindings/vpn-binding/{vpn-id}"),
- CONFIGURATION(AAINamespaceConstants.NETWORK, "/configurations/configuration/{configuration-id}"),
- PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers/pserver/{hostname}"),
- SERVICE_SUBSCRIPTION(AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions/service-subscription/{service-type}"),
- SERVICE_INSTANCE(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances/service-instance/{service-instance-id}"),
- PROJECT(AAINamespaceConstants.BUSINESS, "/projects/project/{id}"),
- LINE_OF_BUSINESS(AAINamespaceConstants.BUSINESS, "/lines-of-business/line-of-business/{id}"),
- PLATFORM(AAINamespaceConstants.BUSINESS, "/platforms/platform/{id}"),
- OWNING_ENTITY(AAINamespaceConstants.BUSINESS, "/owning-entities/owning-entity/{id}"),
- ALLOTTED_RESOURCE(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/allotted-resources/allotted-resource/{id}"),
- PNF(AAINamespaceConstants.NETWORK, "/pnfs/pnf/{pnf-name}"),
- OPERATIONAL_ENVIRONMENT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/operational-environments/operational-environment/{operational-environment-id}"),
- CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/{cloud-owner-id}/{cloud-region-id}"),
- TENANT(AAIObjectType.CLOUD_REGION.uriTemplate(), "/tenants/tenant/{tenant-id}"),
- VSERVER(AAIObjectType.TENANT.uriTemplate(), "/vservers/vserver/{vserver-id}"),
- MODEL_VER(AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", "/model-vers/model-ver/{model-version-id}"),
- TUNNEL_XCONNECT(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), "/tunnel-xconnects/tunnel-xconnect/{id}"),
- P_INTERFACE(AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces/p-interface/{interface-name}"),
- PHYSICAL_LINK(AAINamespaceConstants.NETWORK, "/physical-links/physical-link/{link-name}"),
- UNKNOWN("", "");
-
- private final String uriTemplate;
- private final String parentUri;
- private final String partialUri;
- private AAIObjectType(String parentUri, String partialUri) {
- this.parentUri = parentUri;
- this.partialUri = partialUri;
- this.uriTemplate = parentUri + partialUri;
- }
-
- @Override
- public String toString() {
- return this.uriTemplate();
- }
-
- @Override
- public String typeName() {
- return this.typeName(CaseFormat.LOWER_HYPHEN);
- }
- @Override
- public String typeName(CaseFormat format) {
- String enumName = this.name();
- if (this.equals(AAIObjectType.DEFAULT_CLOUD_REGION) || this.equals(AAIObjectType.DEFAULT_TENANT)) {
- enumName = enumName.replace("DEFAULT_", "");
- }
-
- return CaseFormat.UPPER_UNDERSCORE.to(format, enumName);
- }
-
- @Override
- public String uriTemplate() {
- return this.uriTemplate;
- }
-
- @Override
- public String partialUri() {
- return this.partialUri;
- }
-} \ No newline at end of file
+package org.onap.so.client.aai;
+
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+
+import com.google.common.base.CaseFormat;
+
+public enum AAIObjectType implements GraphInventoryObjectType {
+
+ DEFAULT_CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/att-aic/{cloud-region-id}"),
+ CUSTOMER(AAINamespaceConstants.BUSINESS, "/customers/customer/{global-customer-id}"),
+ GENERIC_QUERY("/search", "/generic-query"),
+ BULK_PROCESS("/bulkprocess", ""),
+ GENERIC_VNF(AAINamespaceConstants.NETWORK, "/generic-vnfs/generic-vnf/{vnf-id}"),
+ VF_MODULE(AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules/vf-module/{vf-module-id}"),
+ L3_NETWORK(AAINamespaceConstants.NETWORK, "/l3-networks/l3-network/{network-id}"),
+ NETWORK_POLICY(AAINamespaceConstants.NETWORK, "/network-policies/network-policy/{network-policy-id}"),
+ NODES_QUERY("/search", "/nodes-query"),
+ CUSTOM_QUERY("/query", ""),
+ ROUTE_TABLE_REFERENCE(AAINamespaceConstants.NETWORK, "/route-table-references/route-table-reference/{route-table-reference-id}"),
+ DEFAULT_TENANT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/att-aic/AAIAIC25", "/tenants/tenant/{tenant-id}"),
+ VCE(AAINamespaceConstants.NETWORK, "/vces/vce/{vnf-id}"),
+ VPN_BINDING(AAINamespaceConstants.NETWORK, "/vpn-bindings/vpn-binding/{vpn-id}"),
+ VPN_BINDINGS(AAINamespaceConstants.NETWORK, "/vpn-bindings"),
+ CONFIGURATION(AAINamespaceConstants.NETWORK, "/configurations/configuration/{configuration-id}"),
+ PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers/pserver/{hostname}"),
+ SERVICE_SUBSCRIPTION(AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions/service-subscription/{service-type}"),
+ SERVICE_INSTANCE(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances/service-instance/{service-instance-id}"),
+ PROJECT(AAINamespaceConstants.BUSINESS, "/projects/project/{id}"),
+ LINE_OF_BUSINESS(AAINamespaceConstants.BUSINESS, "/lines-of-business/line-of-business/{id}"),
+ PLATFORM(AAINamespaceConstants.BUSINESS, "/platforms/platform/{id}"),
+ OWNING_ENTITY(AAINamespaceConstants.BUSINESS, "/owning-entities/owning-entity/{id}"),
+ ALLOTTED_RESOURCE(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/allotted-resources/allotted-resource/{id}"),
+ PNF(AAINamespaceConstants.NETWORK, "/pnfs/pnf/{pnf-name}"),
+ OPERATIONAL_ENVIRONMENT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/operational-environments/operational-environment/{operational-environment-id}"),
+ CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/{cloud-owner-id}/{cloud-region-id}"),
+ TENANT(AAIObjectType.CLOUD_REGION.uriTemplate(), "/tenants/tenant/{tenant-id}"),
+ VOLUME_GROUP(AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups/volume-group/{volume-group-id}"),
+ VSERVER(AAIObjectType.TENANT.uriTemplate(), "/vservers/vserver/{vserver-id}"),
+ MODEL_VER(AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", "/model-vers/model-ver/{model-version-id}"),
+ TUNNEL_XCONNECT(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), "/tunnel-xconnects/tunnel-xconnect/{tunnel-id}"),
+ P_INTERFACE(AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces/p-interface/{interface-name}"),
+ PHYSICAL_LINK(AAINamespaceConstants.NETWORK, "/physical-links/physical-link/{link-name}"),
+ INSTANCE_GROUP(AAINamespaceConstants.NETWORK, "/instance-groups/instance-group/{id}"),
+ COLLECTION(AAINamespaceConstants.NETWORK, "/collections/collection/{collection-id}"),
+ UNKNOWN("", "");
+
+ private final String uriTemplate;
+ private final String parentUri;
+ private final String partialUri;
+ private AAIObjectType(String parentUri, String partialUri) {
+ this.parentUri = parentUri;
+ this.partialUri = partialUri;
+ this.uriTemplate = parentUri + partialUri;
+ }
+
+ @Override
+ public String toString() {
+ return this.uriTemplate();
+ }
+
+ @Override
+ public String typeName() {
+ return this.typeName(CaseFormat.LOWER_HYPHEN);
+ }
+ @Override
+ public String typeName(CaseFormat format) {
+ String enumName = this.name();
+ if (this.equals(AAIObjectType.DEFAULT_CLOUD_REGION) || this.equals(AAIObjectType.DEFAULT_TENANT)) {
+ enumName = enumName.replace("DEFAULT_", "");
+ }
+
+ return CaseFormat.UPPER_UNDERSCORE.to(format, enumName);
+ }
+
+ @Override
+ public String uriTemplate() {
+ return this.uriTemplate;
+ }
+
+ @Override
+ public String partialUri() {
+ return this.partialUri;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIProperties.java b/common/src/main/java/org/onap/so/client/aai/AAIProperties.java
index c208d6dd5f..9f6708200c 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIProperties.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIProperties.java
@@ -18,13 +18,17 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
-import org.openecomp.mso.client.RestProperties;
+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/common/src/main/java/org/openecomp/mso/client/aai/AAIQueryClient.java b/common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java
index f8707dec3e..184b4e5251 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIQueryClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,47 +18,34 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import java.util.Optional;
-import java.util.UUID;
-import org.openecomp.mso.client.aai.entities.CustomQuery;
-import org.openecomp.mso.client.aai.entities.uri.AAIUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-import org.openecomp.mso.client.policy.RestClient;
-import org.openecomp.mso.client.aai.AAIVersion;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.aai.entities.CustomQuery;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
public class AAIQueryClient extends AAIClient {
-
- private final AAIVersion version;
private Optional<String> depth = Optional.empty();
private boolean nodesOnly = false;
private Optional<AAISubgraphType> subgraph = Optional.empty();
public AAIQueryClient() {
- super(UUID.randomUUID());
- this.version = super.getVersion();
- }
-
- public AAIQueryClient(AAIVersion version, UUID requestId) {
- super(requestId);
- this.version = version;
+ super();
}
public AAIQueryClient(AAIVersion version) {
- this(version, UUID.randomUUID());
+ super();
+ this.version = version;
}
public String query(Format format, CustomQuery query) {
return this.createClient(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY).queryParam("format", format.toString()))
- .addRequestId(requestId).put(query, String.class);
- }
-
- @Override
- protected AAIVersion getVersion() {
- return this.version;
+ .put(query, String.class);
}
public AAIQueryClient depth (String depth) {
@@ -76,9 +63,8 @@ public class AAIQueryClient extends AAIClient {
return this;
}
- @Override
- public RestClient createClient(AAIUri uri) {
- AAIUri clone = uri.clone();
+ protected GraphInventoryUri setupQueryParams(GraphInventoryUri uri) {
+ GraphInventoryUri clone = uri.clone();
if (this.depth.isPresent()) {
clone.queryParam("depth", depth.get());
}
@@ -88,6 +74,10 @@ public class AAIQueryClient extends AAIClient {
if (this.subgraph.isPresent()) {
clone.queryParam("subgraph", this.subgraph.get().toString());
}
- return super.createClient(clone);
+ return clone;
+ }
+ @Override
+ protected RestClient createClient(GraphInventoryUri uri) {
+ return super.createClient(setupQueryParams(uri));
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIQueryObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/aai/AAIQueryObjectMapperProvider.java
index 425d9ce60b..d5eeb83041 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIQueryObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIQueryObjectMapperProvider.java
@@ -18,10 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import com.fasterxml.jackson.databind.AnnotationIntrospector;
-import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
@@ -37,8 +36,4 @@ public class AAIQueryObjectMapperProvider extends AAICommonObjectMapperProvider
}
- @Override
- public ObjectMapper getContext(Class<?> type) {
- return mapper;
- }
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesClient.java b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java
index c55e5e9eee..04757c6fc2 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,40 +18,33 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
+import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import java.util.Optional;
-import java.util.UUID;
import javax.ws.rs.NotFoundException;
-import javax.ws.rs.client.ResponseProcessingException;
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.openecomp.mso.client.aai.entities.AAIResultWrapper;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUri;
-import org.openecomp.mso.client.aai.entities.uri.Depth;
-import org.openecomp.mso.client.policy.RestClient;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.RestProperties;
+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.AAIUri;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
public class AAIResourcesClient extends AAIClient {
-
- private final AAIVersion version;
-
+
public AAIResourcesClient() {
- super(UUID.randomUUID());
- this.version = super.getVersion();
+ super();
}
public AAIResourcesClient(AAIVersion version) {
- super(UUID.randomUUID());
- this.version = version;
- }
-
- public AAIResourcesClient(AAIVersion version, UUID requestId) {
- super(requestId);
+ super();
this.version = version;
}
@@ -89,16 +82,8 @@ public class AAIResourcesClient extends AAIClient {
public boolean exists(AAIResourceUri uri) {
AAIUri forceMinimal = this.addParams(Optional.of(Depth.ZERO), true, uri);
RestClient aaiRC = this.createClient(forceMinimal);
- try{
- aaiRC.get();
- } catch(ResponseProcessingException e) {
- if (e.getCause() instanceof NotFoundException) {
- return false;
- } else {
- throw e;
- }
- }
- return true;
+
+ return aaiRC.get().getStatus() == Status.OK.getStatusCode();
}
/**
@@ -137,7 +122,8 @@ public class AAIResourcesClient extends AAIClient {
public void delete(AAIResourceUri uri) {
AAIResourceUri clone = uri.clone();
RestClient aaiRC = this.createClient(clone);
- Map<String, Object> result = aaiRC.get(new GenericType<Map<String, Object>>(){});
+ Map<String, Object> result = aaiRC.get(new GenericType<Map<String, Object>>(){})
+ .orElseThrow(() -> new NotFoundException(clone.build() + " does not exist in A&AI"));
String resourceVersion = (String) result.get("resource-version");
aaiRC = this.createClient(clone.resourceVersion(resourceVersion));
aaiRC.delete();
@@ -154,17 +140,17 @@ public class AAIResourcesClient extends AAIClient {
aaiRC.patch(obj);
return;
}
-
+
/**
* Retrieves an object from A&AI and unmarshalls it into the Class specified
* @param clazz
* @param uri
* @return
*/
- public <T> T get(Class<T> clazz, AAIResourceUri uri) {
+ public <T> Optional<T> get(Class<T> clazz, AAIResourceUri uri) {
return this.createClient(uri).get(clazz);
}
-
+
/**
* Retrieves an object from A&AI and returns complete response
* @param uri
@@ -180,7 +166,7 @@ public class AAIResourcesClient extends AAIClient {
* @param uri
* @return
*/
- public <T> T get(GenericType<T> resultClass, AAIResourceUri uri) {
+ public <T> Optional<T> get(GenericType<T> resultClass, AAIResourceUri uri) {
return this.createClient(uri).get(resultClass);
}
@@ -191,11 +177,31 @@ public class AAIResourcesClient extends AAIClient {
* @return
*/
public AAIResultWrapper get(AAIResourceUri uri) {
- String json = this.createClient(uri).get(String.class);
+ String json = this.createClient(uri).get(String.class).orElse(null);
+ return new AAIResultWrapper(json);
+ }
+
+ /**
+ * Retrieves an object from A&AI wrapped in a helper class which offer additional features
+ * If the object cannot be found in A&AI the method will throw the runtime exception
+ * included as an argument
+ * @param uri
+ * @return
+ */
+ public AAIResultWrapper get(AAIResourceUri uri, Class<? extends RuntimeException> c) {
+ RuntimeException e;
+ try {
+ e = c.getConstructor(String.class).newInstance(uri.build() + " not found in A&AI");
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
+ | NoSuchMethodException | SecurityException e1) {
+ throw new IllegalArgumentException("could not create instance for " + c.getName());
+ }
+ String json = this.createClient(uri).get(String.class)
+ .orElseThrow(() -> e);
return new AAIResultWrapper(json);
-
}
+
private Relationship buildRelationship(AAIResourceUri uri) {
final Relationship result = new Relationship();
result.setRelatedLink(uri.build().toString());
@@ -227,17 +233,7 @@ public class AAIResourcesClient extends AAIClient {
* @return
*/
public AAITransactionalClient beginTransaction() {
- return new AAITransactionalClient(this.version, this.requestId);
- }
-
- @Override
- protected AAIVersion getVersion() {
- return this.version;
- }
-
- @Override
- protected RestClient createClient(AAIUri uri) {
- return super.createClient(uri);
+ return new AAITransactionalClient(this.getVersion());
}
private AAIUri addParams(Optional<Depth> depth, boolean nodesOnly, AAIUri uri) {
@@ -251,4 +247,8 @@ public class AAIResourcesClient extends AAIClient {
return clone;
}
+ @Override
+ protected <T extends RestProperties> T getRestProperties() {
+ return super.getRestProperties();
+ }
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/aai/AAIResourcesObjectMapperProvider.java
index ada1939951..15f2ed2fa2 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIResourcesObjectMapperProvider.java
@@ -18,9 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
+package org.onap.so.client.aai;
public class AAIResourcesObjectMapperProvider extends AAICommonObjectMapperProvider {
@@ -28,8 +26,4 @@ public class AAIResourcesObjectMapperProvider extends AAICommonObjectMapperProvi
super();
}
- @Override
- public ObjectMapper getContext(Class<?> type) {
- return mapper;
- }
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
new file mode 100644
index 0000000000..2bd5f118c0
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
@@ -0,0 +1,131 @@
+/*-
+ * ============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.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.regex.Pattern;
+
+import javax.ws.rs.core.Response;
+
+import org.onap.so.client.ResponseExceptionMapper;
+import org.onap.so.client.RestClientSSL;
+import org.onap.so.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException;
+import org.onap.so.client.policy.CommonObjectMapperProvider;
+import org.onap.so.jsonpath.JsonPathUtil;
+import org.onap.so.utils.TargetEntity;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+
+public class AAIRestClient extends RestClientSSL {
+
+ private final AAIProperties aaiProperties;
+ 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).)+?\\['[^\\[\\]]+?'\\]$");
+
+ protected AAIRestClient(AAIProperties props, URI uri) {
+ super(props, Optional.of(uri));
+ this.aaiProperties = props;
+ }
+
+ @Override
+ public TargetEntity getTargetEntity(){
+ return TargetEntity.AAI;
+ }
+
+ @Override
+ protected void initializeHeaderMap(Map<String, String> headerMap) {
+ headerMap.put("X-FromAppId", "MSO");
+ 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<ResponseExceptionMapper> addResponseExceptionMapper() {
+
+ return Optional.of(new AAIClientResponseExceptionMapper());
+ }
+
+ @Override
+ protected CommonObjectMapperProvider getCommonObjectMapperProvider() {
+ return standardProvider;
+ }
+
+ @Override
+ public Response patch(Object obj) {
+ String value = convertObjectToPatchFormat(obj);
+ validatePatchObject(value);
+ return super.patch(value);
+ }
+
+ @Override
+ public <T> T patch(Object obj, Class<T> resultClass) {
+ String value = convertObjectToPatchFormat(obj);
+ validatePatchObject(value);
+ return super.patch(value, resultClass);
+ }
+
+ protected String convertObjectToPatchFormat(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;
+ }
+
+
+ protected void validatePatchObject(String payload) {
+ if (hasComplexObject(payload)) {
+ throw new GraphInventoryPatchDepthExceededException(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<String> result = JsonPathUtil.getInstance().getPathList(json, complex);
+ List<String> result2 = JsonPathUtil.getInstance().getPathList(json, array);
+
+ result.addAll(result2);
+ return result.stream().anyMatch(item -> LOCATE_COMPLEX_OBJECT.matcher(item).find());
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientI.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java
index 6819ba1edf..b56a6779cc 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientI.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,12 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
+
import java.io.IOException;
import java.io.UnsupportedEncodingException;
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;
@@ -41,7 +42,7 @@ public interface AAIRestClientI {
void updateMaintenceFlag(String vnfId,boolean inMaint, String transactionLoggingUuid) throws Exception;
void updateMaintenceFlagVnfId(String vnfId, boolean inMaint, String transactionLoggingUuid) throws Exception;
-
+
GenericVnf getVnfByName(String vnfId, String transactionLoggingUuid) throws Exception;
Optional<Pnf> getPnfByName(String pnfId, String transactionLoggingUuid) throws Exception;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java
index a84aeaac8e..b471a1e53d 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientImpl.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java
@@ -18,10 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
+
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
@@ -36,17 +35,20 @@ import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.Pnf;
import org.onap.aai.domain.yang.Pserver;
import org.onap.aai.domain.yang.Pservers;
-import org.openecomp.mso.client.aai.entities.CustomQuery;
-import org.openecomp.mso.client.aai.entities.Results;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
-@Service
+
public class AAIRestClientImpl implements AAIRestClientI {
- private static final EELFLogger logger = EELFManager.getInstance().getMetricsLogger();
+ private static Logger logger = LoggerFactory.getLogger(AAIClient.class);
private static final AAIVersion ENDPOINT_VERSION = AAIVersion.V10;
private static final String ENDPOINT_GET_ALL = ENDPOINT_VERSION + "/cloud-infrastructure/pservers";
private static final String ENDPOINT_GET_ALL_VNFS = ENDPOINT_VERSION + "/network/generic-vnfs";
@@ -79,8 +81,8 @@ public class AAIRestClientImpl implements AAIRestClientI {
logger.warn("could not parse uuid: " + uuid + " creating valid uuid automatically");
requestId = UUID.randomUUID();
}
- return new AAIResourcesClient(ENDPOINT_VERSION, requestId)
- .get(Pservers.class, AAIUriFactory.createResourceUri(AAIObjectPlurals.PSERVER));
+ return new AAIResourcesClient(ENDPOINT_VERSION)
+ .get(Pservers.class, AAIUriFactory.createResourceUri(AAIObjectPlurals.PSERVER)).orElse(null);
}
@Override
@@ -94,7 +96,7 @@ public class AAIRestClientImpl implements AAIRestClientI {
}
List<AAIResourceUri> startNodes = new ArrayList<>();
startNodes.add(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
- String jsonInput = new AAIQueryClient(ENDPOINT_VERSION, requestId)
+ String jsonInput = new AAIQueryClient(ENDPOINT_VERSION)
.query(Format.RESOURCE, new CustomQuery(startNodes, PSERVER_VNF_QUERY));
return this.getListOfPservers(jsonInput);
@@ -102,7 +104,7 @@ public class AAIRestClientImpl implements AAIRestClientI {
}
protected List<Pserver> getListOfPservers(String jsonInput) throws IOException {
- ObjectMapper mapper = new AAICommonObjectMapperProvider().getContext(Object.class);
+ ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper();
Results<Map<String, Pserver>> resultsFromJson = mapper.readValue(jsonInput,
new TypeReference<Results<Map<String, Pserver>>>() {
});
@@ -122,8 +124,8 @@ public class AAIRestClientImpl implements AAIRestClientI {
logger.warn("could not parse uuid: " + transactionLoggingUuid + " creating valid uuid automatically");
requestId = UUID.randomUUID();
}
- GenericVnfs genericVnfs = new AAIResourcesClient(ENDPOINT_VERSION, requestId).get(GenericVnfs.class,
- AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName));
+ GenericVnfs genericVnfs = new AAIResourcesClient(ENDPOINT_VERSION).get(GenericVnfs.class,
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)).orElse(null);
if (genericVnfs.getGenericVnf().size() > 1) {
throw new IndexOutOfBoundsException("Multiple Generic Vnfs Returned");
}
@@ -144,7 +146,7 @@ public class AAIRestClientImpl implements AAIRestClientI {
}
GenericVnf genericVnf = new GenericVnf();
genericVnf.setInMaint(inMaint);
- new AAIResourcesClient(ENDPOINT_VERSION, requestId)
+ new AAIResourcesClient(ENDPOINT_VERSION)
.update(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId), genericVnf);
}
@@ -158,8 +160,8 @@ public class AAIRestClientImpl implements AAIRestClientI {
logger.warn("could not parse uuid: " + transactionLoggingUuid + " creating valid uuid automatically");
requestId = UUID.randomUUID();
}
- return new AAIResourcesClient(ENDPOINT_VERSION, requestId)
- .get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+ return new AAIResourcesClient(ENDPOINT_VERSION)
+ .get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)).orElse(null);
}
@Override
@@ -171,7 +173,7 @@ public class AAIRestClientImpl implements AAIRestClientI {
logger.warn("could not parse uuid: " + transactionLoggingUuid + " creating valid uuid automatically", e);
requestId = UUID.randomUUID();
}
- Response response = new AAIResourcesClient(ENDPOINT_VERSION, requestId)
+ Response response = new AAIResourcesClient(ENDPOINT_VERSION)
.getFullResponse(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId));
if (response.getStatus() != 200) {
return Optional.empty();
@@ -189,7 +191,7 @@ public class AAIRestClientImpl implements AAIRestClientI {
logger.warn("could not parse uuid: " + transactionLoggingUuid + " creating valid uuid automatically", e);
requestId = UUID.randomUUID();
}
- new AAIResourcesClient(ENDPOINT_VERSION, requestId)
+ new AAIResourcesClient(ENDPOINT_VERSION)
.createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId), Optional.of(pnf));
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAISubgraphType.java b/common/src/main/java/org/onap/so/client/aai/AAISubgraphType.java
index 917949967f..e9beb143fd 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAISubgraphType.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAISubgraphType.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
public enum AAISubgraphType {
@@ -35,4 +35,4 @@ public enum AAISubgraphType {
public String toString() {
return name;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAITransactionalClient.java b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
index 547862708a..884d2aaec6 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAITransactionalClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import java.io.IOException;
import java.util.ArrayList;
@@ -27,22 +27,22 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
-import java.util.UUID;
+import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import org.onap.aai.domain.yang.Relationship;
-import org.openecomp.mso.client.aai.entities.AAIError;
-import org.openecomp.mso.client.aai.entities.bulkprocess.OperationBody;
-import org.openecomp.mso.client.aai.entities.bulkprocess.Transaction;
-import org.openecomp.mso.client.aai.entities.bulkprocess.Transactions;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-import org.openecomp.mso.client.aai.exceptions.BulkProcessFailed;
-import org.openecomp.mso.client.policy.RestClient;
-import org.openecomp.mso.jsonpath.JsonPathUtil;
+import org.onap.so.client.RestClient;
+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.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed;
+import org.onap.so.jsonpath.JsonPathUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -54,8 +54,8 @@ public class AAITransactionalClient extends AAIClient {
private Transaction currentTransaction;
private final AAIVersion version;
private int actionCount = 0;
- protected AAITransactionalClient(AAIVersion version, UUID requestId) {
- super(requestId);
+ protected AAITransactionalClient(AAIVersion version) {
+ super();
this.version = version;
this.transactions = new Transactions();
startTransaction();
@@ -164,7 +164,8 @@ public class AAITransactionalClient extends AAIClient {
public AAITransactionalClient delete(AAIResourceUri uri) {
AAIResourcesClient client = new AAIResourcesClient();
AAIResourceUri clone = uri.clone();
- Map<String, Object> result = client.get(new GenericType<Map<String, Object>>(){}, clone);
+ Map<String, Object> result = client.get(new GenericType<Map<String, Object>>(){}, clone)
+ .orElseThrow(() -> new NotFoundException(clone.build() + " does not exist in A&AI"));
String resourceVersion = (String) result.get("resource-version");
currentTransaction.getDelete().add(new OperationBody().withUri(clone.resourceVersion(resourceVersion).build().toString()).withBody(""));
incrementActionAmount();
@@ -196,7 +197,7 @@ public class AAITransactionalClient extends AAIClient {
if (response.hasEntity()) {
final Optional<String> errorMessage = this.locateErrorMessages(response.readEntity(String.class));
if (errorMessage.isPresent()) {
- throw new BulkProcessFailed("One or more transactions failed in A&AI. Request-id=" + this.getRequestId() + ". Check logs for payloads.\nMessages:\n" + errorMessage.get());
+ 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.");
@@ -219,7 +220,7 @@ public class AAITransactionalClient extends AAIClient {
parsed.add(mapper.readValue(result, new TypeReference<Map<String, Object>>(){}));
}
} catch (IOException e) {
- metricsLogger.error("could not map json", e);
+ logger.error("could not map json", e);
}
for (Map<String, Object> map : parsed) {
for (Entry<String, Object> entry : map.entrySet()) {
@@ -228,12 +229,12 @@ public class AAITransactionalClient extends AAIClient {
try {
error = mapper.readValue(entry.getValue().toString(), AAIError.class);
} catch (IOException e) {
- metricsLogger.error("could not parse error object from A&AI", e);
+ logger.error("could not parse error object from A&AI", e);
error = new AAIError();
}
AAIErrorFormatter formatter = new AAIErrorFormatter(error);
String outputMessage = formatter.getMessage();
- metricsLogger.error("part of a bulk action failed in A&AI: " + entry.getValue());
+ logger.error("part of a bulk action failed in A&AI: " + entry.getValue());
errorMessages.add(outputMessage);
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIUpdator.java b/common/src/main/java/org/onap/so/client/aai/AAIUpdator.java
index 3bdcdc56a3..8921e4bbbe 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIUpdator.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIUpdator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import java.io.IOException;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIUpdatorImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java
index c808761040..a971fded0e 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIUpdatorImpl.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,9 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
public class AAIUpdatorImpl implements AAIUpdator {
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIValidator.java b/common/src/main/java/org/onap/so/client/aai/AAIValidator.java
index 117ec42a36..bf6485a631 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIValidator.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIValidator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import java.io.IOException;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIValidatorImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java
index c84d2f41bd..fb6d122630 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIValidatorImpl.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import java.io.IOException;
import java.util.List;
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Service;
-@Service
+
public class AAIValidatorImpl implements AAIValidator {
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIVersion.java b/common/src/main/java/org/onap/so/client/aai/AAIVersion.java
index 20117fb98b..20ee5becca 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIVersion.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIVersion.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,14 +18,17 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
-public enum AAIVersion {
+import org.onap.so.client.graphinventory.GraphInventoryVersion;
+
+public enum AAIVersion implements GraphInventoryVersion {
V8("v8"),
V9("v9"),
V10("v10"),
V11("v11"),
- V12("v12");
+ V12("v12"),
+ V13("v13");
public final static AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1];
private final String value;
diff --git a/common/src/main/java/org/onap/so/client/aai/EmptyStringToNullSerializer.java b/common/src/main/java/org/onap/so/client/aai/EmptyStringToNullSerializer.java
new file mode 100644
index 0000000000..1120ebe0b9
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/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.so.client.aai;
+
+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<String> {
+
+ private static final long serialVersionUID = 5367385969270400106L;
+
+ public EmptyStringToNullSerializer() {
+ this(null);
+ }
+ public EmptyStringToNullSerializer(Class<String> 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/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntity.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIEntity.java
index 3f0c4f3439..c2aceeeeba 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntity.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIEntity.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
public class AAIEntity{
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntityObject.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIEntityObject.java
index e4a64c4161..dc91c8a034 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntityObject.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIEntityObject.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
public interface AAIEntityObject {
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIError.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIError.java
index 5f895ef862..4261f4f3c0 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIError.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIError.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIResultWrapper.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java
index 9898f04844..9087995f97 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIResultWrapper.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,31 +18,36 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
import java.io.IOException;
+import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
-import org.openecomp.mso.client.aai.AAICommonObjectMapperProvider;
-import org.openecomp.mso.jsonpath.JsonPathUtil;
+import org.onap.so.client.aai.AAICommonObjectMapperProvider;
+import org.onap.so.jsonpath.JsonPathUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-public class AAIResultWrapper {
+public class AAIResultWrapper implements Serializable {
- private final String jsonBody;
+ private static final long serialVersionUID = 5895841925807816737L;
+ private final Optional<String> jsonBody;
private final ObjectMapper mapper;
public AAIResultWrapper(String json) {
- this.jsonBody = json;
+ this.jsonBody = Optional.ofNullable(json);
this.mapper = new AAICommonObjectMapperProvider().getMapper();
}
public Optional<Relationships> getRelationships() {
final String path = "$.relationship-list";
- Optional<String> result = JsonPathUtil.getInstance().locateResult(jsonBody, path);
+ if (!jsonBody.isPresent()) {
+ return Optional.empty();
+ }
+ Optional<String> result = JsonPathUtil.getInstance().locateResult(jsonBody.get(), path);
if (result.isPresent()) {
return Optional.of(new Relationships(result.get()));
} else {
@@ -51,25 +56,34 @@ public class AAIResultWrapper {
}
public String getJson() {
- return jsonBody;
+ return jsonBody.orElse("{}");
}
public Map<String, Object> asMap() {
+ if (!this.jsonBody.isPresent()) {
+ return new HashMap<>();
+ }
try {
- return mapper.readValue(this.jsonBody, new TypeReference<Map<String, Object>>(){});
+ return mapper.readValue(this.jsonBody.get(), new TypeReference<Map<String, Object>>(){});
} catch (IOException e) {
return new HashMap<>();
}
}
public <T> Optional<T> asBean(Class<T> clazz) {
+ if (!this.jsonBody.isPresent()) {
+ return Optional.empty();
+ }
try {
- return Optional.of(mapper.readValue(this.jsonBody, clazz));
+ return Optional.of(mapper.readValue(this.jsonBody.get(), clazz));
} catch (IOException e) {
return Optional.empty();
}
}
+ public boolean isEmpty() {
+ return !this.jsonBody.isPresent();
+ }
@Override
public String toString() {
return this.getJson();
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/Configuration.java b/common/src/main/java/org/onap/so/client/aai/entities/Configuration.java
index a2d0fb3604..e1ce3a8adc 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/Configuration.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/Configuration.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,8 +18,7 @@
* ============LICENSE_END=========================================================
*/
-
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/CustomQuery.java b/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java
index 3d014b8f67..8203476c82 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/CustomQuery.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import com.fasterxml.jackson.annotation.JsonInclude;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/Relationships.java b/common/src/main/java/org/onap/so/client/aai/entities/Relationships.java
index cca2fb3744..bab145b3fd 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/Relationships.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/Relationships.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
import java.io.IOException;
import java.util.ArrayList;
@@ -30,13 +30,13 @@ import java.util.function.Predicate;
import javax.ws.rs.core.UriBuilder;
-import org.openecomp.mso.client.aai.AAICommonObjectMapperProvider;
-import org.openecomp.mso.client.aai.AAIObjectName;
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.AAIResourcesClient;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-import org.openecomp.mso.jsonpath.JsonPathUtil;
+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.so.client.graphinventory.GraphInventoryObjectName;
+import org.onap.so.jsonpath.JsonPathUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -57,7 +57,7 @@ public class Relationships {
}
}
- public List<AAIResultWrapper> getByType(AAIObjectName type) {
+ public List<AAIResultWrapper> getByType(GraphInventoryObjectName type) {
return this.getAll(Optional.of(type));
}
@@ -72,7 +72,7 @@ public class Relationships {
return this.getRelatedLinks(Optional.empty());
}
- public List<String> getRelatedLinks(AAIObjectName type) {
+ public List<String> getRelatedLinks(GraphInventoryObjectName type) {
return this.getRelatedLinks(Optional.of(type));
}
@@ -80,7 +80,7 @@ public class Relationships {
return this.getRelatedAAIUris(x -> true);
}
- public List<AAIResourceUri> getRelatedAAIUris(AAIObjectName type) {
+ public List<AAIResourceUri> getRelatedAAIUris(GraphInventoryObjectName type) {
return this.getRelatedAAIUris(x -> type.typeName().equals(x));
}
protected List<AAIResourceUri> getRelatedAAIUris(Predicate<String> p) {
@@ -107,7 +107,7 @@ public class Relationships {
- protected List<AAIResultWrapper> getAll(final Optional<AAIObjectName> type) {
+ protected List<AAIResultWrapper> getAll(final Optional<GraphInventoryObjectName> type) {
List<AAIResourceUri> relatedLinks;
if (type.isPresent()) {
relatedLinks = this.getRelatedAAIUris(type.get());
@@ -126,7 +126,7 @@ public class Relationships {
}
- protected List<String> getRelatedLinks(Optional<AAIObjectName> type) {
+ protected List<String> getRelatedLinks(Optional<GraphInventoryObjectName> type) {
String matcher = "";
if (type.isPresent()) {
matcher = "[?(@.related-to=='" + type.get() + "')]";
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/RequestError.java b/common/src/main/java/org/onap/so/client/aai/entities/RequestError.java
index 2fd3572401..bc8c283e34 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/RequestError.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/RequestError.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/Results.java b/common/src/main/java/org/onap/so/client/aai/entities/Results.java
index e91823a348..c3f0ad1fa1 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/Results.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/Results.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
import java.util.ArrayList;
import java.util.List;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/ServiceException.java b/common/src/main/java/org/onap/so/client/aai/entities/ServiceException.java
index 66ca10d06b..9d9723c514 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/ServiceException.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/ServiceException.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
import java.util.ArrayList;
import java.util.List;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/OperationBody.java b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java
index ddd9a454f8..1803440edd 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/OperationBody.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.bulkprocess;
+package org.onap.so.client.aai.entities.bulkprocess;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transaction.java b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transaction.java
index 8c4d54dc16..1c405753c3 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transaction.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transaction.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.bulkprocess;
+package org.onap.so.client.aai.entities.bulkprocess;
import java.util.ArrayList;
import java.util.List;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transactions.java b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transactions.java
index f6ce3c5d2c..51d56d371a 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transactions.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transactions.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.bulkprocess;
+package org.onap.so.client.aai.entities.bulkprocess;
import java.util.ArrayList;
import java.util.List;
@@ -51,4 +51,4 @@ this.transactions = transactions;
return this;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIResourceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java
index 36e3d008ae..42fa1ad02a 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIResourceUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,19 +18,29 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+package org.onap.so.client.aai.entities.uri;
-import org.openecomp.mso.client.aai.AAIObjectPlurals;
-import org.openecomp.mso.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIObjectPlurals;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
-public interface AAIResourceUri extends AAIUri {
+public interface AAIResourceUri extends AAIUri, GraphInventoryResourceUri {
public AAIResourceUri relationshipAPI();
public AAIResourceUri relatedTo(AAIObjectPlurals plural);
public AAIResourceUri relatedTo(AAIObjectType type, String... values);
public AAIResourceUri resourceVersion(String version);
+ public AAIResourceUri format(Format format);
+ @Override
public AAIResourceUri depth(Depth depth);
+ @Override
public AAIResourceUri nodesOnly(boolean nodesOnly);
+ @Override
public AAIResourceUri queryParam(String name, String... values);
+ @Override
+ public AAIResourceUri replaceQueryParam(String name, String... values);
+ @Override
public AAIResourceUri clone();
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
new file mode 100644
index 0000000000..14671b2f85
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
@@ -0,0 +1,111 @@
+/*-
+ * ============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.Format;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
+
+public class AAISimpleUri extends SimpleUri implements AAIResourceUri {
+
+ 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(AAIObjectPlurals type, UriBuilder builder, Object... values) {
+ super(type, builder, values);
+ }
+ protected AAISimpleUri(AAIObjectPlurals type) {
+ super(type);
+ }
+ protected AAISimpleUri(AAIObjectPlurals type, Object... values) {
+ super(type, values);
+ }
+
+ @Override
+ public AAISimpleUri relationshipAPI() {
+ return (AAISimpleUri) super.relationshipAPI();
+ }
+
+ @Override
+ public AAISimpleUri relatedTo(AAIObjectPlurals plural) {
+ return (AAISimpleUri) super.relatedTo(plural);
+ }
+ @Override
+ public AAISimpleUri relatedTo(AAIObjectType type, String... values) {
+ return (AAISimpleUri) super.relatedTo(type, values);
+ }
+
+ @Override
+ public AAISimpleUri resourceVersion(String version) {
+ return (AAISimpleUri) super.resourceVersion(version);
+ }
+
+ @Override
+ public AAISimpleUri queryParam(String name, String... values) {
+ return (AAISimpleUri) super.queryParam(name, values);
+ }
+
+ @Override
+ public AAISimpleUri replaceQueryParam(String name, String... values) {
+ return (AAISimpleUri) super.replaceQueryParam(name, values);
+ }
+
+ @Override
+ public AAISimpleUri clone() {
+ if (this.type != null) {
+ return new AAISimpleUri((AAIObjectType)this.type, this.internalURI.clone(), values);
+ } else {
+ return new AAISimpleUri((AAIObjectPlurals)this.pluralType, this.internalURI.clone(), values);
+ }
+ }
+
+ @Override
+ public AAIObjectType getObjectType() {
+ return (AAIObjectType)this.type;
+ }
+
+ @Override
+ public AAISimpleUri depth(Depth depth) {
+ return (AAISimpleUri) super.depth(depth);
+ }
+ @Override
+ public AAISimpleUri nodesOnly(boolean nodesOnly) {
+ return (AAISimpleUri)super.nodesOnly(nodesOnly);
+ }
+
+ @Override
+ public AAISimpleUri format(Format format) {
+ return (AAISimpleUri)super.format(format);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java
index 1617bcddea..eb336d9219 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,17 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+package org.onap.so.client.aai.entities.uri;
import java.net.URI;
import java.util.Map;
-import org.openecomp.mso.client.aai.AAIObjectPlurals;
-import org.openecomp.mso.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
-public interface AAIUri {
+public interface AAIUri extends GraphInventoryUri {
- public URI build();
/**
* By default A&AI enforces a depth of 1. Some objects can be told to retrieve objects
* nested beneath them by increasing this number.
@@ -38,21 +39,22 @@ public interface AAIUri {
* @param depth
* @return
*/
+ @Override
public AAIUri depth(Depth depth);
/**
* Makes client only return object fields, no relationships
*
* @return
*/
+ @Override
public AAIUri nodesOnly(boolean nodesOnly);
+ @Override
public AAIUri queryParam(String name, String... values);
+ @Override
+ public AAIUri replaceQueryParam(String name, String... values);
+ @Override
public AAIUri clone();
- /**
- * returns all key values of the URI as a map. Key names can be found in {@link AAIObjectType}
- * @return
- */
- public Map<String, String> getURIKeys();
+ @Override
public AAIObjectType getObjectType();
- public boolean equals(Object o);
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactory.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java
index cb33435c69..2a7c8ee78c 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactory.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,12 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+package org.onap.so.client.aai.entities.uri;
import java.net.URI;
-import org.openecomp.mso.client.aai.AAIObjectPlurals;
-import org.openecomp.mso.client.aai.AAIObjectType;
+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 AAIUriFactory {
@@ -39,7 +40,7 @@ public class AAIUriFactory {
if (AAIObjectType.SERVICE_INSTANCE.equals(type)) {
return new ServiceInstanceUri(values);
} else {
- return new SimpleUri(type, values);
+ return new AAISimpleUri(type, values);
}
}
@@ -56,7 +57,7 @@ public class AAIUriFactory {
* @return
*/
public static AAIResourceUri createResourceFromExistingURI(AAIObjectType type, URI uri) {
- return new SimpleUri(type, uri);
+ return new AAISimpleUri(type, uri);
}
/**
@@ -67,7 +68,19 @@ public class AAIUriFactory {
*/
public static AAIResourceUri createResourceUri(AAIObjectPlurals type) {
- return new SimpleUri(type);
+ return new AAISimpleUri(type);
+
+ }
+
+ /**
+ * Creates a uri for a plural type with values e.g. /cloud-infrastructure/pservers
+ *
+ * @param type
+ * @return
+ */
+ public static AAIResourceUri createResourceUri(AAIObjectPlurals type, Object... values) {
+
+ return new AAISimpleUri(type, values);
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/NodesUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java
index 407e0ecc9e..ccae0b44b7 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/NodesUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,14 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+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.GraphInventoryObjectPlurals;
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
-import org.openecomp.mso.client.aai.AAIObjectPlurals;
-import org.openecomp.mso.client.aai.AAIObjectType;
-
-public class NodesUri extends SimpleUri {
+public class NodesUri extends AAISimpleUri {
protected NodesUri(AAIObjectType type, Object... values) {
super(type, values);
@@ -33,12 +32,12 @@ public class NodesUri extends SimpleUri {
@Override
- protected String getTemplate(AAIObjectType type) {
+ protected String getTemplate(GraphInventoryObjectType type) {
return "/nodes" + type.partialUri();
}
@Override
- protected String getTemplate(AAIObjectPlurals type) {
+ protected String getTemplate(GraphInventoryObjectPlurals type) {
return "/nodes" + type.partialUri();
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java
index cdaecedfa9..093918d49b 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+package org.onap.so.client.aai.entities.uri;
import java.io.IOException;
import java.net.URI;
@@ -27,22 +27,22 @@ import java.util.Map;
import java.util.Optional;
import javax.ws.rs.BadRequestException;
-import javax.ws.rs.client.ResponseProcessingException;
import javax.ws.rs.core.UriBuilder;
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.AAIQueryClient;
-import org.openecomp.mso.client.aai.Format;
-import org.openecomp.mso.client.aai.entities.CustomQuery;
-import org.openecomp.mso.client.aai.entities.Results;
-import org.openecomp.mso.client.aai.exceptions.AAIPayloadException;
-import org.openecomp.mso.client.aai.exceptions.AAIUriComputationException;
-import org.openecomp.mso.client.aai.exceptions.AAIUriNotFoundException;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIQueryClient;
+import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.aai.entities.CustomQuery;
+import org.onap.so.client.aai.entities.Results;
+import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
+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.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-public class ServiceInstanceUri extends SimpleUri {
+public class ServiceInstanceUri extends AAISimpleUri {
private Optional<String> cachedValue = Optional.empty();
@@ -53,49 +53,45 @@ public class ServiceInstanceUri extends SimpleUri {
super(AAIObjectType.SERVICE_INSTANCE, builder, values);
this.cachedValue = cachedValue;
}
- protected String getSerivceInstance(Object id) throws AAIUriNotFoundException, AAIPayloadException {
+ protected String getSerivceInstance(Object id) throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
if (!this.getCachedValue().isPresent()) {
AAIResourceUri serviceInstanceUri = AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE, id);
CustomQuery query = new CustomQuery(Collections.singletonList(serviceInstanceUri));
String resultJson;
try {
resultJson = this.getQueryClient().query(Format.PATHED, query);
- } catch (ResponseProcessingException e) {
- if (e.getCause() instanceof BadRequestException) {
- throw new AAIUriNotFoundException("Service instance " + id + " not found at: " + serviceInstanceUri.build());
- } else {
- throw e;
- }
+ } catch (BadRequestException e) {
+ throw new GraphInventoryUriNotFoundException("Service instance " + id + " not found at: " + serviceInstanceUri.build());
+
}
try {
cachedValue = extractRelatedLink(resultJson);
if (!cachedValue.isPresent()) {
- throw new AAIUriNotFoundException("Service instance " + id + " not found at: " + serviceInstanceUri.build());
+ throw new GraphInventoryUriNotFoundException("Service instance " + id + " not found at: " + serviceInstanceUri.build());
}
} catch (IOException e) {
- throw new AAIPayloadException("could not map payload: " + resultJson, e);
+ throw new GraphInventoryPayloadException("could not map payload: " + resultJson, e);
}
-
}
-
- return this.getCachedValue().get();
+ Optional<String> cachedValueOpt = this.getCachedValue();
+ return cachedValueOpt.isPresent() ? cachedValueOpt.get() : "";
}
protected Optional<String> extractRelatedLink(String jsonString) throws IOException {
Optional<String> result;
ObjectMapper mapper = new ObjectMapper();
- Results<Map<String, String>> results = mapper.readValue(jsonString, new TypeReference<Results<Map<String, String>>>(){});
- if (results.getResult().size() == 1) {
- String uriString = results.getResult().get(0).get("resource-link");
- URI uri = UriBuilder.fromUri(uriString).build();
- String rawPath = uri.getRawPath();
+ Results<Map<String, String>> results = mapper.readValue(jsonString, new TypeReference<Results<Map<String, String>>>(){});
+ if (results.getResult().size() == 1) {
+ String uriString = results.getResult().get(0).get("resource-link");
+ URI uri = UriBuilder.fromUri(uriString).build();
+ String rawPath = uri.getRawPath();
result = Optional.of(rawPath.replaceAll("/aai/v\\d+", ""));
- } else if (results.getResult().isEmpty()) {
+ } else if (results.getResult().isEmpty()) {
result = Optional.empty();
- } else {
- throw new IllegalStateException("more than one result returned");
- }
+ } else {
+ throw new IllegalStateException("more than one result returned");
+ }
return result;
}
@@ -107,13 +103,13 @@ public class ServiceInstanceUri extends SimpleUri {
@Override
public URI build() {
try {
- if (this.values.length == 1) {
- String uri = getSerivceInstance(this.values[0]);
- Map<String, String> map = getURIKeys(uri);
- return super.build(map.values().toArray(values));
- }
- } catch (AAIUriNotFoundException | AAIPayloadException e) {
- throw new AAIUriComputationException(e);
+ if (this.values.length == 1) {
+ String uri = getSerivceInstance(this.values[0]);
+ Map<String, String> map = getURIKeys(uri);
+ return super.build(map.values().toArray(values));
+ }
+ } catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) {
+ throw new GraphInventoryUriComputationException(e);
}
return super.build();
}
@@ -124,6 +120,7 @@ public class ServiceInstanceUri extends SimpleUri {
}
protected AAIQueryClient getQueryClient() {
+ AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectType.ALLOTTED_RESOURCE, "").clone();
return new AAIQueryClient();
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOperationalEnvironment.java b/common/src/main/java/org/onap/so/client/aai/objects/AAIOperationalEnvironment.java
index f044e2a237..02d8d56867 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOperationalEnvironment.java
+++ b/common/src/main/java/org/onap/so/client/aai/objects/AAIOperationalEnvironment.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.objects;
+package org.onap.so.client.aai.objects;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIServiceInstance.java b/common/src/main/java/org/onap/so/client/aai/objects/AAIServiceInstance.java
index dbb34fcd44..af21949277 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIServiceInstance.java
+++ b/common/src/main/java/org/onap/so/client/aai/objects/AAIServiceInstance.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,118 +18,124 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.objects;
-
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.entities.AAIEntityObject;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class AAIServiceInstance implements AAIEntityObject {
-
- @JsonProperty("service-instance-id")
- private String serviceInstanceId;
- @JsonProperty("service-instance-name")
- private String serviceInstanceName;
- @JsonProperty("service-type")
- private String serviceType;
- @JsonProperty("service-role")
- private String serviceRole;
- @JsonProperty("orchestration-status")
- private String oStatus;
- @JsonProperty("model-invariant-id")
- private String modelInvariantUuid;
- @JsonProperty("model-version-id")
- private String modelUuid;
- @JsonProperty("environment-context")
- private String environmentContext;
- @JsonProperty("workload-context")
- private String workloadContext;
-
- public String getServiceInstanceName() {
- return serviceInstanceName;
- }
-
- public void setServiceInstanceName(String serviceInstanceName) {
- this.serviceInstanceName = serviceInstanceName;
- }
-
- public String getServiceType() {
- return serviceType;
- }
-
- public void setServiceType(String serviceType) {
- this.serviceType = serviceType;
- }
-
- public String getServiceRole() {
- return serviceRole;
- }
-
- public void setServiceRole(String serviceRole) {
- this.serviceRole = serviceRole;
- }
-
- public String getoStatus() {
- return oStatus;
- }
-
- public void setoStatus(String oStatus) {
- this.oStatus = oStatus;
- }
-
- public String getModelInvariantUuid() {
- return modelInvariantUuid;
- }
-
- public void setModelInvariantUuid(String modelInvariantUuid) {
- this.modelInvariantUuid = modelInvariantUuid;
- }
-
- public String getModelUuid() {
- return modelUuid;
- }
-
- public void setModelUuid(String modelUuid) {
- this.modelUuid = modelUuid;
- }
-
- public String getEnvironmentContext() {
- return environmentContext;
- }
-
- public void setEnvironmentContext(String environmentContext) {
- this.environmentContext = environmentContext;
- }
-
- public String getWorkloadContext() {
- return workloadContext;
- }
-
- public void setWorkloadContext(String workloadContext) {
- this.workloadContext = workloadContext;
- }
-
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
-
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
-
- public AAIServiceInstance withServiceInstance(String serviceInstanceId) {
- this.setServiceInstanceId(serviceInstanceId);
- return this;
- }
-
- @Override
- public AAIResourceUri getUri() {
- final AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, this.serviceInstanceId);
- return uri;
- }
-
-
-}
+package org.onap.so.client.aai.objects;
+
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIEntityObject;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class AAIServiceInstance implements AAIEntityObject {
+
+ @JsonProperty("service-instance-id")
+ private String serviceInstanceId;
+ @JsonProperty("service-instance-name")
+ private String serviceInstanceName;
+ @JsonProperty("service-type")
+ private String serviceType;
+ @JsonProperty("service-role")
+ private String serviceRole;
+ @JsonProperty("orchestration-status")
+ private String oStatus;
+ @JsonProperty("model-invariant-id")
+ private String modelInvariantUuid;
+ @JsonProperty("model-version-id")
+ private String modelUuid;
+ @JsonProperty("environment-context")
+ private String environmentContext;
+ @JsonProperty("workload-context")
+ private String workloadContext;
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getServiceRole() {
+ return serviceRole;
+ }
+
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
+
+ public String getoStatus() {
+ return oStatus;
+ }
+
+ public void setoStatus(String oStatus) {
+ this.oStatus = oStatus;
+ }
+
+ public String getModelInvariantUuid() {
+ return modelInvariantUuid;
+ }
+
+ public void setModelInvariantUuid(String modelInvariantUuid) {
+ this.modelInvariantUuid = modelInvariantUuid;
+ }
+
+ public String getModelUuid() {
+ return modelUuid;
+ }
+
+ public void setModelUuid(String modelUuid) {
+ this.modelUuid = modelUuid;
+ }
+
+ public String getEnvironmentContext() {
+ return environmentContext;
+ }
+
+ public void setEnvironmentContext(String environmentContext) {
+ this.environmentContext = environmentContext;
+ }
+
+ public String getWorkloadContext() {
+ return workloadContext;
+ }
+
+ public void setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ }
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public AAIServiceInstance withServiceInstance(String serviceInstanceId) {
+ this.setServiceInstanceId(serviceInstanceId);
+ return this;
+ }
+
+ @Override
+ public AAIResourceUri getUri() {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, this.serviceInstanceId);
+ return uri;
+ }
+ @Override
+ public String toString() {
+ return "AAIServiceInstance [serviceInstanceId=" + serviceInstanceId + ", serviceInstanceName="
+ + serviceInstanceName + ", serviceType=" + serviceType + ", serviceRole=" + serviceRole + ", oStatus="
+ + oStatus + ", modelInvariantUuid=" + modelInvariantUuid + ", modelUuid=" + modelUuid
+ + ", environmentContext=" + environmentContext + ", workloadContext=" + workloadContext + "]";
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java
new file mode 100644
index 0000000000..2329a5acb9
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.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.so.client.adapter.rest;
+
+import java.net.URI;
+import java.security.GeneralSecurityException;
+import java.util.Map;
+import java.util.Optional;
+
+import org.apache.commons.codec.binary.Base64;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.policy.CommonObjectMapperProvider;
+import org.onap.so.client.policy.JettisonStyleMapperProvider;
+import org.onap.so.utils.CryptoUtils;
+import org.onap.so.utils.TargetEntity;
+
+public class AdapterRestClient extends RestClient {
+
+ private final AdapterRestProperties adapterRestProperties;
+ public AdapterRestClient(AdapterRestProperties props, URI uri) {
+ super(props, Optional.of(uri));
+ this.adapterRestProperties = props;
+ }
+
+ public AdapterRestClient(AdapterRestProperties props, URI uri, String accept, String contentType) {
+ super(props, Optional.of(uri), accept, contentType);
+ this.adapterRestProperties = props;
+ }
+
+ @Override
+ public TargetEntity getTargetEntity(){
+ return TargetEntity.OPENSTACK_ADAPTER;
+ }
+
+ @Override
+ protected void initializeHeaderMap(Map<String, String> headerMap) {
+ headerMap.put("Authorization",
+ this.getBasicAuth(adapterRestProperties.getAuth(), adapterRestProperties.getKey()));
+ }
+
+ @Override
+ protected CommonObjectMapperProvider getCommonObjectMapperProvider() {
+ return new JettisonStyleMapperProvider();
+ }
+
+ private String getBasicAuth(String encryptedAuth, String msoKey) {
+ if ((encryptedAuth == null || encryptedAuth.isEmpty()) || (msoKey == null || msoKey.isEmpty())) {
+ return null;
+ }
+ try {
+ String auth = CryptoUtils.decrypt(encryptedAuth, msoKey);
+ byte[] encoded = Base64.encodeBase64(auth.getBytes());
+ String encodedString = new String(encoded);
+ encodedString = "Basic " + encodedString;
+ return encodedString;
+ } catch (GeneralSecurityException e) {
+ this.msoLogger.debug(e.getMessage());
+ return null;
+ }
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestProperties.java b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestProperties.java
new file mode 100644
index 0000000000..18e0bd8996
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestProperties.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.so.client.adapter.rest;
+
+import org.onap.so.client.RestProperties;
+
+public interface AdapterRestProperties extends RestProperties {
+
+ public String getAuth();
+ public String getKey();
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultDmaapPropertiesImpl.java b/common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java
index 1345286d9c..ffebe77620 100644
--- a/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultDmaapPropertiesImpl.java
+++ b/common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.defaultproperties;
+package org.onap.so.client.defaultproperties;
import java.io.File;
import java.io.FileInputStream;
@@ -28,7 +28,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import org.openecomp.mso.client.dmaap.DmaapProperties;
+import org.onap.so.client.dmaap.DmaapProperties;
public class DefaultDmaapPropertiesImpl implements DmaapProperties {
diff --git a/common/src/main/java/org/openecomp/mso/client/defaultproperties/PolicyRestPropertiesImpl.java b/common/src/main/java/org/onap/so/client/defaultproperties/PolicyRestPropertiesImpl.java
index 655dc5a83d..9e4574df4c 100644
--- a/common/src/main/java/org/openecomp/mso/client/defaultproperties/PolicyRestPropertiesImpl.java
+++ b/common/src/main/java/org/onap/so/client/defaultproperties/PolicyRestPropertiesImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.defaultproperties;
+package org.onap.so.client.defaultproperties;
import java.io.File;
import java.io.FileInputStream;
@@ -30,7 +30,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import org.openecomp.mso.client.policy.PolicyRestProperties;
+import org.onap.so.client.policy.PolicyRestProperties;
public class PolicyRestPropertiesImpl implements PolicyRestProperties {
@@ -38,9 +38,8 @@ public class PolicyRestPropertiesImpl implements PolicyRestProperties {
final Map<Object, Object> props;
public PolicyRestPropertiesImpl() {
File initialFile = new File("src/test/resources/policy.properties");
-
Map<Object, Object> temp;
- try(InputStream targetStream = new FileInputStream(initialFile)) {
+ try (InputStream targetStream = new FileInputStream(initialFile)) {
Properties properties = new Properties();
properties.load(targetStream);
temp = properties;
@@ -64,14 +63,17 @@ public class PolicyRestPropertiesImpl implements PolicyRestProperties {
return "MSO";
}
+ @Override
public String getClientAuth() {
return (String)props.get("policy.client.auth");
}
+ @Override
public String getAuth() {
return (String)props.get("policy.auth");
}
+ @Override
public String getEnvironment() {
return (String)props.get("policy.environment");
}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/Consumer.java b/common/src/main/java/org/onap/so/client/dmaap/Consumer.java
index 0e00ae5da8..7b1310f252 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/Consumer.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/Consumer.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap;
+package org.onap.so.client.dmaap;
public interface Consumer {
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapClient.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java
index 5a2fa178de..dde0b31c90 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapClient.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap;
+package org.onap.so.client.dmaap;
import java.io.IOException;
import java.util.Base64;
@@ -26,23 +26,23 @@ import java.util.Map;
import java.util.Optional;
import java.util.Properties;
-import org.openecomp.mso.client.defaultproperties.DefaultDmaapPropertiesImpl;
+import org.onap.so.client.defaultproperties.DefaultDmaapPropertiesImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
public abstract class DmaapClient {
- protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
+ protected static Logger logger = LoggerFactory.getLogger(DmaapClient.class);
protected final Map<String, String> msoProperties;
protected final Properties properties;
public DmaapClient(String filepath) throws IOException {
Resource resource = new ClassPathResource(filepath);
DmaapProperties dmaapProperties = DmaapPropertiesLoader.getInstance().getNewImpl();
if (dmaapProperties == null) {
- auditLogger.error("No RestProperty implementation found on classpath, loading default");
+ logger.error("No RestProperty implementation found on classpath, loading default");
dmaapProperties = new DefaultDmaapPropertiesImpl();
}
this.msoProperties = dmaapProperties.getProperties();
@@ -51,8 +51,9 @@ public abstract class DmaapClient {
this.properties.put("password", this.deobfuscatePassword(this.getPassword()));
this.properties.put("username", this.getUserName());
this.properties.put("topic", this.getTopic());
- if (this.getHost().isPresent()) {
- this.properties.put("host", this.getHost().get());
+ Optional<String> host = this.getHost();
+ if (host.isPresent()) {
+ this.properties.put("host", host.get());
}
}
protected String deobfuscatePassword(String password) {
@@ -60,7 +61,7 @@ public abstract class DmaapClient {
try {
return new String(Base64.getDecoder().decode(password.getBytes()));
} catch(IllegalArgumentException iae) {
- auditLogger.error("llegal Arguments",iae);
+ logger.error("llegal Arguments",iae);
return password;
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
index 6a01fb61ba..c9acdd7e89 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap;
+package org.onap.so.client.dmaap;
import com.google.common.base.Stopwatch;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
-import org.openecomp.mso.client.dmaap.exceptions.DMaaPConsumerFailure;
-import org.openecomp.mso.client.dmaap.exceptions.ExceededMaximumPollingTime;
-import org.openecomp.mso.client.dmaap.rest.RestConsumer;
+import org.onap.so.client.dmaap.exceptions.DMaaPConsumerFailure;
+import org.onap.so.client.dmaap.exceptions.ExceededMaximumPollingTime;
+import org.onap.so.client.dmaap.rest.RestConsumer;
public abstract class DmaapConsumer extends DmaapClient {
@@ -45,7 +45,7 @@ public abstract class DmaapConsumer extends DmaapClient {
while (this.continuePolling()) {
if (stopwatch.elapsed(TimeUnit.MILLISECONDS) >= this.getMaximumElapsedTime()) {
final String message = "exceeded maximum retries on " + this.getRequestId() + " on " + this.getTopic();
- auditLogger.error(message);
+ logger.error(message);
throw new ExceededMaximumPollingTime(message);
}
stopwatch.start();
@@ -53,15 +53,15 @@ public abstract class DmaapConsumer extends DmaapClient {
stopwatch.stop();
for (String message : itr) {
if (!accepted && this.isAccepted(message)) {
- auditLogger.info("accepted message found for " + this.getRequestId() + " on " + this.getTopic());
+ logger.info("accepted message found for " + this.getRequestId() + " on " + this.getTopic());
accepted = true;
}
if (accepted) {
- auditLogger.info("received dmaap message: " + message);
+ logger.info("received dmaap message: " + message);
if (this.isFailure(message)) {
this.stopProcessingMessages();
final String errorMsg = "failure received from dmaap topic " + this.getTopic();
- auditLogger.error(errorMsg);
+ logger.error(errorMsg);
throw new DMaaPConsumerFailure(errorMsg);
} else {
this.processMessage(message);
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapProperties.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapProperties.java
index 7bdd7dfe40..161608dc77 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapProperties.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapProperties.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap;
+package org.onap.so.client.dmaap;
import java.util.Map;
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPropertiesLoader.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapPropertiesLoader.java
index 3c861991f6..3064f6142f 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPropertiesLoader.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapPropertiesLoader.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,15 +18,20 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap;
+package org.onap.so.client.dmaap;
import java.util.ServiceLoader;
public class DmaapPropertiesLoader {
+ /* required to make ServiceLoader thread safe */
+ private static final ThreadLocal<ServiceLoader<DmaapProperties>> services = new ThreadLocal<ServiceLoader<DmaapProperties>>() {
+ @Override
+ protected ServiceLoader<DmaapProperties> initialValue() {
+ return ServiceLoader.load(DmaapProperties.class);
+ }
+ };
- private final ServiceLoader<DmaapProperties> services;
private DmaapPropertiesLoader() {
- services = ServiceLoader.load(DmaapProperties.class);
}
private static class Helper {
@@ -43,7 +48,9 @@ public class DmaapPropertiesLoader {
return this.getImpl(true);
}
private DmaapProperties getImpl(boolean forceNewInstance) {
- for (DmaapProperties service : services) {
+
+ ServiceLoader<DmaapProperties> loader = this.services.get();
+ for (DmaapProperties service : loader) {
if (forceNewInstance) {
try {
return service.getClass().newInstance();
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPublisher.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapPublisher.java
index d2752c531b..48691dcd84 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPublisher.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapPublisher.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap;
+package org.onap.so.client.dmaap;
import java.io.FileNotFoundException;
import java.io.IOException;
-import org.openecomp.mso.client.dmaap.rest.RestPublisher;
+import org.onap.so.client.dmaap.rest.RestPublisher;
public abstract class DmaapPublisher extends DmaapClient {
@@ -41,8 +41,8 @@ public abstract class DmaapPublisher extends DmaapClient {
this.seconds = seconds;
}
- public void send(String json) throws IOException, InterruptedException {
- auditLogger.info("publishing message to dmaap topic " + this.getTopic() + ": " + json);
+ public void send(String json){
+ logger.info("publishing message to dmaap topic " + this.getTopic() + ": " + json);
publisher.send(json);
//publisher.close(seconds, TimeUnit.SECONDS);
}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/Publisher.java b/common/src/main/java/org/onap/so/client/dmaap/Publisher.java
index ed1b3f3796..ba6ce16418 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/Publisher.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/Publisher.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap;
+package org.onap.so.client.dmaap;
public interface Publisher {
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/DMaaPConsumerFailure.java b/common/src/main/java/org/onap/so/client/dmaap/exceptions/DMaaPConsumerFailure.java
index b1ae2b7e89..f845f7e6ef 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/DMaaPConsumerFailure.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/exceptions/DMaaPConsumerFailure.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap.exceptions;
+package org.onap.so.client.dmaap.exceptions;
public class DMaaPConsumerFailure extends Exception {
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/ExceededMaximumPollingTime.java b/common/src/main/java/org/onap/so/client/dmaap/exceptions/ExceededMaximumPollingTime.java
index c0cda6b0ed..0002f878d8 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/ExceededMaximumPollingTime.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/exceptions/ExceededMaximumPollingTime.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap.exceptions;
+package org.onap.so.client.dmaap.exceptions;
public class ExceededMaximumPollingTime extends RuntimeException {
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
index ad744ad31b..0438ff237a 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,41 +18,33 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap.rest;
+package org.onap.so.client.dmaap.rest;
import java.net.URL;
import java.util.Base64;
import java.util.Map;
-import java.util.Optional;
-import java.util.UUID;
-import javax.ws.rs.client.ClientResponseFilter;
+import org.onap.so.client.RestClient;
+import org.onap.so.utils.TargetEntity;
-import org.openecomp.mso.client.ResponseExceptionMapperImpl;
-import org.openecomp.mso.client.policy.RestClient;
-
-public class DMaaPRestClient extends RestClient {
+public class DMaaPRestClient extends RestClient {
private final String username;
private final String password;
public DMaaPRestClient(URL url, String contentType, String username, String password) {
- super(url, UUID.randomUUID(), contentType);
+ super(url, contentType);
this.username = username;
this.password = password;
}
+ @Override
+ public TargetEntity getTargetEntity(){
+ return TargetEntity.DMAAP;
+ }
+
@Override
protected void initializeHeaderMap(Map<String, String> headerMap) {
headerMap.put("Authorization", "Basic " + Base64.getEncoder().encodeToString((username + ":" + password).getBytes()));
}
- @Override
- protected Optional<ClientResponseFilter> addResponseFilter() {
- return Optional.of(new ResponseExceptionMapperImpl());
- }
-
- @Override
- public RestClient addRequestId(UUID requestId) {
- return this;
- }
}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/PropertiesBean.java b/common/src/main/java/org/onap/so/client/dmaap/rest/PropertiesBean.java
index e661dd87bd..f43c65808a 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/PropertiesBean.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/PropertiesBean.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap.rest;
+package org.onap.so.client.dmaap.rest;
import java.util.Properties;
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestConsumer.java b/common/src/main/java/org/onap/so/client/dmaap/rest/RestConsumer.java
index c2fb6f676f..39af15635a 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestConsumer.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/RestConsumer.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,18 +18,19 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap.rest;
+package org.onap.so.client.dmaap.rest;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.UriBuilder;
-import org.openecomp.mso.client.dmaap.Consumer;
-import org.openecomp.mso.client.policy.RestClient;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.dmaap.Consumer;
public class RestConsumer implements Consumer {
@@ -54,7 +55,7 @@ public class RestConsumer implements Consumer {
@Override
public Iterable<String> fetch() {
- return client.get(new GenericType<List<String>>() {});
+ return client.get(new GenericType<List<String>>() {}).orElse(new ArrayList<>());
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestPublisher.java b/common/src/main/java/org/onap/so/client/dmaap/rest/RestPublisher.java
index 3dab12f559..090e50543b 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestPublisher.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/RestPublisher.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,17 +18,16 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap.rest;
+package org.onap.so.client.dmaap.rest;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;
import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.core.UriBuilderException;
-import org.openecomp.mso.client.dmaap.Publisher;
-import org.openecomp.mso.client.policy.RestClient;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.dmaap.Publisher;
public class RestPublisher implements Publisher {
diff --git a/common/src/main/java/org/openecomp/mso/client/exceptions/SDNOException.java b/common/src/main/java/org/onap/so/client/exceptions/SDNOException.java
index d55f962662..1e14308ad5 100644
--- a/common/src/main/java/org/openecomp/mso/client/exceptions/SDNOException.java
+++ b/common/src/main/java/org/onap/so/client/exceptions/SDNOException.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.exceptions;
+package org.onap.so.client.exceptions;
public class SDNOException extends Exception {
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/Format.java b/common/src/main/java/org/onap/so/client/graphinventory/Format.java
index e4008151ef..5cbf1320c1 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/Format.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/Format.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.graphinventory;
public enum Format {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java
new file mode 100644
index 0000000000..0d10c21886
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java
@@ -0,0 +1,48 @@
+/*-
+ * ============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;
+
+public abstract class GraphInventoryClient {
+
+ private RestProperties props;
+ protected GraphInventoryClient(Class<? extends RestProperties> propertiesClass) {
+
+ RestProperties props = RestPropertiesLoader.getInstance().getNewImpl(propertiesClass);
+ this.props = props;
+ }
+ protected abstract URI constructPath(GraphInventoryUri uri);
+
+ protected abstract RestClient createClient(GraphInventoryUri uri);
+
+ protected <T extends RestProperties> T getRestProperties() {
+ if (props == null) {
+ throw new IllegalStateException("No RestProperty implementation found on classpath");
+ }
+ return (T)props;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectName.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectName.java
index c7459d31b5..4543d8523b 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectName.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectName.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.graphinventory;
import com.google.common.base.CaseFormat;
-public interface AAIObjectName {
+public interface GraphInventoryObjectName {
public String typeName();
public String typeName(CaseFormat format);
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java
new file mode 100644
index 0000000000..ba48eb279f
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.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.so.client.graphinventory;
+
+public interface GraphInventoryObjectPlurals extends GraphInventoryObjectName, GraphInventoryObjectUriTemplate, GraphInventoryObjectUriPartial {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java
new file mode 100644
index 0000000000..453becb75a
--- /dev/null
+++ b/common/src/main/java/org/onap/so/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.so.client.graphinventory;
+
+public interface GraphInventoryObjectType extends GraphInventoryObjectName, GraphInventoryObjectUriTemplate, GraphInventoryObjectUriPartial {
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriPartial.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriPartial.java
index 3fb867d6fa..0987221b0d 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriPartial.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriPartial.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.graphinventory;
-public interface AAIObjectUriPartial {
+public interface GraphInventoryObjectUriPartial {
public String partialUri();
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriTemplate.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriTemplate.java
index 397b66d547..e231ddb811 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriTemplate.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriTemplate.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.graphinventory;
-public interface AAIObjectUriTemplate {
+public interface GraphInventoryObjectUriTemplate {
public String uriTemplate();
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryVersion.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryVersion.java
new file mode 100644
index 0000000000..3b7dba70f8
--- /dev/null
+++ b/common/src/main/java/org/onap/so/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.so.client.graphinventory;
+
+public interface GraphInventoryVersion {
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/Depth.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/Depth.java
index 7522ea33d1..1205511d11 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/Depth.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/Depth.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+package org.onap.so.client.graphinventory.entities.uri;
public enum Depth {
ZERO("0"),
@@ -41,5 +41,4 @@ public enum Depth {
public String toString() {
return this.depth;
}
-
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java
new file mode 100644
index 0000000000..08e7304978
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.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.so.client.graphinventory.entities.uri;
+
+import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+
+public interface GraphInventoryResourceUri extends GraphInventoryUri {
+ public GraphInventoryResourceUri relationshipAPI();
+ public GraphInventoryResourceUri relatedTo(GraphInventoryObjectPlurals plural);
+ public GraphInventoryResourceUri relatedTo(GraphInventoryObjectType type, String... values);
+ public GraphInventoryResourceUri resourceVersion(String version);
+ public GraphInventoryResourceUri format(Format format);
+ @Override
+ public GraphInventoryResourceUri depth(Depth depth);
+ @Override
+ public GraphInventoryResourceUri nodesOnly(boolean nodesOnly);
+ @Override
+ public GraphInventoryResourceUri queryParam(String name, String... values);
+ @Override
+ public GraphInventoryResourceUri replaceQueryParam(String name, String... values);
+ @Override
+ public GraphInventoryResourceUri clone();
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java
new file mode 100644
index 0000000000..8a25c23895
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java
@@ -0,0 +1,60 @@
+/*-
+ * ============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 java.util.Map;
+
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+
+public interface GraphInventoryUri {
+
+ 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 GraphInventoryUri depth(Depth depth);
+ /**
+ * Makes client only return object fields, no relationships
+ *
+ * @return
+ */
+ public GraphInventoryUri nodesOnly(boolean nodesOnly);
+ public GraphInventoryUri queryParam(String name, String... values);
+ public GraphInventoryUri replaceQueryParam(String name, String... values);
+ public GraphInventoryUri clone();
+
+ /**
+ * returns all key values of the URI as a map. Key names can be found in {@link GraphInventoryObjectType}
+ * @return
+ */
+ public Map<String, String> getURIKeys();
+ public GraphInventoryObjectType getObjectType();
+ public boolean equals(Object o);
+ public int hashCode();
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/SimpleUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
index f3e6fad48b..9c86ec6348 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/SimpleUri.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+package org.onap.so.client.graphinventory.entities.uri;
import java.io.UnsupportedEncodingException;
import java.net.URI;
@@ -28,50 +28,60 @@ import java.util.Map;
import javax.ws.rs.core.UriBuilder;
-import org.openecomp.mso.client.aai.AAIObjectPlurals;
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.entities.uri.parsers.UriParser;
-import org.openecomp.mso.client.aai.entities.uri.parsers.UriParserSpringImpl;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.aai.entities.uri.AAIUri;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+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.GraphInventoryObjectPlurals;
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
import org.springframework.web.util.UriUtils;
-public class SimpleUri implements AAIResourceUri {
+public class SimpleUri implements GraphInventoryResourceUri {
protected UriBuilder internalURI;
protected final static String relationshipAPI = "/relationship-list/relationship";
protected final static String relatedTo = "/related-to";
protected final Object[] values;
- protected final AAIObjectType type;
- protected final AAIObjectPlurals pluralType;
- protected SimpleUri(AAIObjectType type, Object... values) {
+ protected final GraphInventoryObjectType type;
+ protected final GraphInventoryObjectPlurals pluralType;
+ protected SimpleUri(GraphInventoryObjectType type, Object... values) {
this.type = type;
this.pluralType = null;
this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
this.values = values;
}
- protected SimpleUri(AAIObjectType type, URI uri) {
+ protected SimpleUri(GraphInventoryObjectType type, URI uri) {
this.type = type;
this.pluralType = null;
this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll("/aai/v\\d+", ""));
this.values = new Object[0];
}
- protected SimpleUri(AAIObjectType type, UriBuilder builder, Object... values) {
+ protected SimpleUri(GraphInventoryObjectType type, UriBuilder builder, Object... values) {
this.internalURI = builder;
this.values = values;
this.type = type;
this.pluralType = null;
}
- protected SimpleUri(AAIObjectPlurals type, UriBuilder builder, Object... values) {
+ protected SimpleUri(GraphInventoryObjectPlurals type, UriBuilder builder, Object... values) {
this.internalURI = builder;
this.values = values;
this.type = null;
this.pluralType = type;
}
- protected SimpleUri(AAIObjectPlurals type) {
+ protected SimpleUri(GraphInventoryObjectPlurals type) {
this.type = null;
this.pluralType = type;
this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
this.values = new Object[0];
}
+ protected SimpleUri(GraphInventoryObjectPlurals type, Object... values) {
+ this.type = null;
+ this.pluralType = type;
+ this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
+ this.values = values;
+ }
@Override
public SimpleUri relationshipAPI() {
@@ -80,20 +90,20 @@ public class SimpleUri implements AAIResourceUri {
}
@Override
- public SimpleUri relatedTo(AAIObjectPlurals plural) {
+ public SimpleUri relatedTo(GraphInventoryObjectPlurals plural) {
this.internalURI = internalURI.path(relatedTo).path(plural.partialUri());
return this;
}
@Override
- public SimpleUri relatedTo(AAIObjectType type, String... values) {
+ public SimpleUri relatedTo(GraphInventoryObjectType type, String... values) {
this.internalURI = internalURI.path(relatedTo).path(UriBuilder.fromPath(type.partialUri()).build(values).toString());
return this;
}
@Override
public SimpleUri resourceVersion(String version) {
- this.internalURI = internalURI.queryParam("resource-version", version);
+ this.internalURI = internalURI.replaceQueryParam("resource-version", version);
return this;
}
@@ -104,6 +114,12 @@ public class SimpleUri implements AAIResourceUri {
}
@Override
+ public SimpleUri replaceQueryParam(String name, String... values) {
+ this.internalURI = internalURI.replaceQueryParam(name, values);
+ return this;
+ }
+
+ @Override
public URI build() {
return build(this.values);
}
@@ -152,7 +168,7 @@ public class SimpleUri implements AAIResourceUri {
}
@Override
- public AAIObjectType getObjectType() {
+ public GraphInventoryObjectType getObjectType() {
return this.type;
}
@@ -163,24 +179,37 @@ public class SimpleUri implements AAIResourceUri {
}
return false;
}
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(this.build()).toHashCode();
+ }
+
+
@Override
public SimpleUri depth(Depth depth) {
- this.internalURI.queryParam("depth", depth.toString());
+ this.internalURI.replaceQueryParam("depth", depth.toString());
return this;
}
@Override
public SimpleUri nodesOnly(boolean nodesOnly) {
if (nodesOnly) {
- this.internalURI.queryParam("nodes-only", "");
+ this.internalURI.replaceQueryParam("nodes-only", "");
}
return this;
}
- protected String getTemplate(AAIObjectType type) {
+ @Override
+ public SimpleUri format(Format format) {
+ this.internalURI.replaceQueryParam("format", format);
+ return this;
+ }
+
+ protected String getTemplate(GraphInventoryObjectType type) {
return type.uriTemplate();
}
- protected String getTemplate(AAIObjectPlurals type) {
+ protected String getTemplate(GraphInventoryObjectPlurals type) {
return type.uriTemplate();
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParser.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParser.java
index 8e37d595b0..03d83ebfb6 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParser.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParser.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri.parsers;
+package org.onap.so.client.graphinventory.entities.uri.parsers;
import java.util.Map;
import java.util.Set;
@@ -26,4 +26,4 @@ import java.util.Set;
public interface UriParser {
public Set<String> getVariables();
public Map<String, String> parse(final String uri);
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImpl.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java
index 75f9005125..aeaa923d1b 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImpl.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri.parsers;
+package org.onap.so.client.graphinventory.entities.uri.parsers;
import java.io.UnsupportedEncodingException;
import java.util.Collections;
import java.util.LinkedHashMap;
@@ -65,4 +65,4 @@ public class UriParserSpringImpl implements UriParser {
return result;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/BulkProcessFailed.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/BulkProcessFailed.java
index ea64f54c33..0c973a8457 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/BulkProcessFailed.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/BulkProcessFailed.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.exceptions;
+package org.onap.so.client.graphinventory.exceptions;
public class BulkProcessFailed extends Exception {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java
new file mode 100644
index 0000000000..07af13049c
--- /dev/null
+++ b/common/src/main/java/org/onap/so/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.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/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadException.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadException.java
index 35842204ac..24a6e5ccf9 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadException.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadException.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,21 +18,21 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.exceptions;
+package org.onap.so.client.graphinventory.exceptions;
-public class AAIPayloadException extends Exception {
+public class GraphInventoryPayloadException extends Exception {
private static final long serialVersionUID = -5712783905947711065L;
- public AAIPayloadException(Throwable t) {
+ public GraphInventoryPayloadException(Throwable t) {
super(t);
}
- public AAIPayloadException(String s, Throwable t) {
+ public GraphInventoryPayloadException(String s, Throwable t) {
super(s, t);
}
- public AAIPayloadException(String s) {
+ public GraphInventoryPayloadException(String s) {
super(s);
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriComputationException.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriComputationException.java
index 4d9f320cc8..51747d495a 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriComputationException.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriComputationException.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,17 +18,17 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.exceptions;
+package org.onap.so.client.graphinventory.exceptions;
-public class AAIUriComputationException extends RuntimeException {
+public class GraphInventoryUriComputationException extends RuntimeException {
private static final long serialVersionUID = 5187931752227522034L;
- public AAIUriComputationException(String s) {
+ public GraphInventoryUriComputationException(String s) {
super(s);
}
- public AAIUriComputationException(Throwable t) {
+ public GraphInventoryUriComputationException(Throwable t) {
super(t);
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriNotFoundException.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.java
index 3e373946ce..d2f47a5b00 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriNotFoundException.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.exceptions;
+package org.onap.so.client.graphinventory.exceptions;
-public class AAIUriNotFoundException extends Exception {
+public class GraphInventoryUriNotFoundException extends Exception {
private static final long serialVersionUID = 2789643165122257833L;
- public AAIUriNotFoundException(String message) {
+ public GraphInventoryUriNotFoundException(String message) {
super(message);
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMAction.java b/common/src/main/java/org/onap/so/client/grm/GRMAction.java
index 50544bab70..376c736037 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/GRMAction.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMAction.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
public enum GRMAction {
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMClient.java b/common/src/main/java/org/onap/so/client/grm/GRMClient.java
index 5b5f269731..84e25b9ce4 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/GRMClient.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
-import org.openecomp.mso.client.grm.beans.ServiceEndPointList;
-import org.openecomp.mso.client.grm.beans.ServiceEndPointLookup;
-import org.openecomp.mso.client.grm.beans.ServiceEndPointLookupRequest;
-import org.openecomp.mso.client.grm.beans.ServiceEndPointRequest;
-import org.openecomp.mso.client.grm.beans.VersionLookup;
-import org.openecomp.mso.client.grm.exceptions.GRMClientCallFailed;
+import org.onap.so.client.grm.beans.ServiceEndPointList;
+import org.onap.so.client.grm.beans.ServiceEndPointLookup;
+import org.onap.so.client.grm.beans.ServiceEndPointLookupRequest;
+import org.onap.so.client.grm.beans.ServiceEndPointRequest;
+import org.onap.so.client.grm.beans.VersionLookup;
+import org.onap.so.client.grm.exceptions.GRMClientCallFailed;
public class GRMClient {
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMDefaultPropertiesImpl.java b/common/src/main/java/org/onap/so/client/grm/GRMDefaultPropertiesImpl.java
index 3bdc769321..b38072e769 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/GRMDefaultPropertiesImpl.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMDefaultPropertiesImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
import java.net.MalformedURLException;
import java.net.URL;
@@ -32,7 +32,7 @@ public class GRMDefaultPropertiesImpl implements GRMProperties {
@Override
public URL getEndpoint() throws MalformedURLException {
- return new URL("http://localhost:28090");
+ return new URL("http://localhost:47389");
}
@Override
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMProperties.java b/common/src/main/java/org/onap/so/client/grm/GRMProperties.java
index 6fbbb21a8a..da9f215aac 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/GRMProperties.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMProperties.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
-import org.openecomp.mso.client.RestProperties;
+import org.onap.so.client.RestProperties;
public interface GRMProperties extends RestProperties {
public String getDefaultVersion();
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMPropertiesLoader.java b/common/src/main/java/org/onap/so/client/grm/GRMPropertiesLoader.java
index 9323e22065..485b9b0d15 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/GRMPropertiesLoader.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMPropertiesLoader.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
import java.util.Iterator;
import java.util.ServiceLoader;
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMRestClient.java b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java
index 7a81d7e7ec..ce16ccaaaa 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/GRMRestClient.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,20 +18,17 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
import java.net.URI;
import java.util.Base64;
import java.util.Map;
import java.util.Optional;
-import java.util.UUID;
-import javax.ws.rs.client.ClientResponseFilter;
-
-import org.openecomp.mso.client.ResponseExceptionMapperImpl;
-import org.openecomp.mso.client.RestProperties;
-import org.openecomp.mso.client.policy.RestClient;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.RestProperties;
+import org.onap.so.utils.TargetEntity;
public class GRMRestClient extends RestClient {
@@ -39,23 +36,19 @@ public class GRMRestClient extends RestClient {
private final String password;
public GRMRestClient(RestProperties props, URI path, String username, String password) {
- super(props, UUID.randomUUID(), Optional.of(path));
+ super(props, Optional.of(path));
this.username = username;
this.password = password;
}
+ @Override
+ public TargetEntity getTargetEntity(){
+ return TargetEntity.GRM;
+ }
+
@Override
protected void initializeHeaderMap(Map<String, String> headerMap) {
headerMap.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(new String(username + ":" + password).getBytes()));
}
- @Override
- protected Optional<ClientResponseFilter> addResponseFilter() {
- return Optional.of(new ResponseExceptionMapperImpl());
- }
-
- @Override
- public RestClient addRequestId(UUID requestId) {
- return this;
- }
}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMRestInvoker.java b/common/src/main/java/org/onap/so/client/grm/GRMRestInvoker.java
index d706be3f16..3045cb35f4 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/GRMRestInvoker.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMRestInvoker.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
import java.net.URI;
import java.util.Base64;
import javax.ws.rs.core.UriBuilder;
-import org.openecomp.mso.client.RestPropertiesLoader;
-import org.openecomp.mso.client.policy.RestClient;
+
+import org.onap.so.client.RestClient;
public class GRMRestInvoker {
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/OperationalInfo.java b/common/src/main/java/org/onap/so/client/grm/beans/OperationalInfo.java
index c5f5a7a7af..85e15f597c 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/OperationalInfo.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/OperationalInfo.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
+
+import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -28,8 +30,12 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonPropertyOrder({ "createdBy", "updatedBy", "createdTimestamp", "updatedTimestamp" })
-public class OperationalInfo {
+public class OperationalInfo implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7213334079745439793L;
@JsonProperty("createdBy")
private String createdBy;
@JsonProperty("updatedBy")
@@ -79,4 +85,4 @@ public class OperationalInfo {
this.updatedTimestamp = updatedTimestamp;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/Property.java b/common/src/main/java/org/onap/so/client/grm/beans/Property.java
index eff1659102..705db95222 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/Property.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/Property.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
+
+import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -28,8 +30,12 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonPropertyOrder({ "name", "value" })
-public class Property {
+public class Property implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6060749559638446881L;
@JsonProperty("name")
private String name;
@JsonProperty("value")
@@ -55,4 +61,4 @@ public class Property {
this.value = value;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPoint.java b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPoint.java
index a753afbe90..e739f00c9a 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPoint.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPoint.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
import java.io.Serializable;
import java.util.List;
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointList.java b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointList.java
index 0faf1fb826..19bbe69cf2 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointList.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointList.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
import java.util.List;
@@ -45,4 +45,4 @@ public class ServiceEndPointList {
this.serviceEndPointList = serviceEndPointList;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookup.java b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookup.java
index 37e23795e9..cab10e64f4 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookup.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookup.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookupRequest.java b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookupRequest.java
index fc1992c763..5e886300dd 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookupRequest.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookupRequest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,13 +18,8 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
-import java.util.HashMap;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -60,4 +55,4 @@ public class ServiceEndPointLookupRequest {
this.env = env;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointRequest.java b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointRequest.java
index 324fe9f32a..f7ea352f21 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointRequest.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointRequest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,13 +18,8 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
-import java.util.HashMap;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -60,4 +55,4 @@ public class ServiceEndPointRequest {
this.env = env;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/Status.java b/common/src/main/java/org/onap/so/client/grm/beans/Status.java
index 3c66c50a5c..8794139b67 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/Status.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/Status.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
+
+import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -28,8 +30,12 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonPropertyOrder({ "status", "statusReasonCode", "statusReasonDescription", "statusCheckTime" })
-public class Status {
+public class Status implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3555636617671062648L;
@JsonProperty("status")
private String status;
@JsonProperty("statusReasonCode")
@@ -79,4 +85,4 @@ public class Status {
this.statusCheckTime = statusCheckTime;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/Version.java b/common/src/main/java/org/onap/so/client/grm/beans/Version.java
index 1d4d959f02..fd1e5803ab 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/Version.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/Version.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
+
+import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -28,8 +30,12 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonPropertyOrder({ "major", "minor", "patch" })
-public class Version {
+public class Version implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 7509573030831487410L;
@JsonProperty("major")
private Integer major;
@JsonProperty("minor")
@@ -66,4 +72,4 @@ public class Version {
public void setPatch(String patch) {
this.patch = patch;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/VersionLookup.java b/common/src/main/java/org/onap/so/client/grm/beans/VersionLookup.java
index b9d5a63450..0dc86b04d6 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/VersionLookup.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/VersionLookup.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
import java.io.Serializable;
@@ -46,4 +46,4 @@ public class VersionLookup implements Serializable {
public void setMajor(Integer major) {
this.major = major;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/exceptions/GRMClientCallFailed.java b/common/src/main/java/org/onap/so/client/grm/exceptions/GRMClientCallFailed.java
index 60de57286d..7107d4027f 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/exceptions/GRMClientCallFailed.java
+++ b/common/src/main/java/org/onap/so/client/grm/exceptions/GRMClientCallFailed.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.exceptions;
+package org.onap.so.client.grm.exceptions;
public class GRMClientCallFailed extends Exception {
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/CommonObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java
index 4f41b6441e..f2f6f0362f 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/CommonObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,9 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
-
-import javax.ws.rs.ext.ContextResolver;
+package org.onap.so.client.policy;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
@@ -28,9 +26,9 @@ import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-public class CommonObjectMapperProvider implements ContextResolver<ObjectMapper> {
+public class CommonObjectMapperProvider {
- final ObjectMapper mapper;
+ protected ObjectMapper mapper;
public CommonObjectMapperProvider() {
@@ -42,8 +40,7 @@ public class CommonObjectMapperProvider implements ContextResolver<ObjectMapper>
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
- @Override
- public ObjectMapper getContext(Class<?> type) {
+ public ObjectMapper getMapper() {
return mapper;
}
} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/DecisionAttributes.java b/common/src/main/java/org/onap/so/client/policy/DecisionAttributes.java
index 7b765ebb5f..951372db42 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/DecisionAttributes.java
+++ b/common/src/main/java/org/onap/so/client/policy/DecisionAttributes.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client.policy;
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/JettisonStyleMapperProvider.java b/common/src/main/java/org/onap/so/client/policy/JettisonStyleMapperProvider.java
index 19579e810b..23b984a3d0 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/JettisonStyleMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/policy/JettisonStyleMapperProvider.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,32 +18,28 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client.policy;
-import javax.ws.rs.ext.ContextResolver;
+import org.springframework.stereotype.Component;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
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.module.jaxb.JaxbAnnotationModule;
-public class JettisonStyleMapperProvider implements ContextResolver<ObjectMapper> {
+@Component
+public class JettisonStyleMapperProvider extends CommonObjectMapperProvider {
- final ObjectMapper mapper;
-
public JettisonStyleMapperProvider() {
mapper = new ObjectMapper();
+ JaxbAnnotationModule jaxbModule = new JaxbAnnotationModule();
mapper.setSerializationInclusion(Include.NON_NULL);
- mapper.enable(MapperFeature.USE_ANNOTATIONS);
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ mapper.registerModule(jaxbModule);
}
- @Override
- public ObjectMapper getContext(Class<?> type) {
- return mapper;
- }
}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java b/common/src/main/java/org/onap/so/client/policy/LoggingFilter.java
index b04069697e..83cf08f77f 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java
+++ b/common/src/main/java/org/onap/so/client/policy/LoggingFilter.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client.policy;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
@@ -39,14 +39,14 @@ import javax.ws.rs.ext.Provider;
import javax.ws.rs.ext.WriterInterceptor;
import javax.ws.rs.ext.WriterInterceptorContext;
-import org.openecomp.mso.logger.MsoLogger;
+import org.onap.so.logger.MsoLogger;
@Provider
@Priority(0)
public class LoggingFilter implements ClientRequestFilter, ClientResponseFilter, WriterInterceptor {
- private static final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+ private static final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, LoggingFilter.class);
private static final String ENTITY_STREAM_PROPERTY = "LoggingFilter.entityStream";
private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
private final int maxEntitySize;
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyClient.java b/common/src/main/java/org/onap/so/client/policy/PolicyClient.java
index defd11bc99..74c1e398db 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyClient.java
+++ b/common/src/main/java/org/onap/so/client/policy/PolicyClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,11 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client.policy;
-import org.openecomp.mso.client.policy.entities.AllowedTreatments;
-import org.openecomp.mso.client.policy.entities.DictionaryData;
-import org.openecomp.mso.client.policy.entities.PolicyDecision;
+import org.onap.so.client.policy.entities.DictionaryData;
+import org.onap.so.client.policy.entities.PolicyDecision;
public interface PolicyClient {
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyClientImpl.java b/common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java
index 0ce1911c82..1fd01e65ed 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyClientImpl.java
+++ b/common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,33 +18,35 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
-
-import org.openecomp.mso.client.RestPropertiesLoader;
-import org.openecomp.mso.client.defaultproperties.PolicyRestPropertiesImpl;
-import org.openecomp.mso.client.policy.entities.AllowedTreatments;
-import org.openecomp.mso.client.policy.entities.Bbid;
-import org.openecomp.mso.client.policy.entities.DecisionAttributes;
-import org.openecomp.mso.client.policy.entities.DictionaryData;
-import org.openecomp.mso.client.policy.entities.DictionaryItemsRequest;
-import org.openecomp.mso.client.policy.entities.DictionaryJson;
-import org.openecomp.mso.client.policy.entities.PolicyDecision;
-import org.openecomp.mso.client.policy.entities.PolicyDecisionRequest;
-import org.openecomp.mso.client.policy.entities.PolicyServiceType;
-import org.openecomp.mso.client.policy.entities.Workstep;
+package org.onap.so.client.policy;
import java.util.List;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+
+import org.onap.so.client.RestClient;
+import org.onap.so.client.RestPropertiesLoader;
+import org.onap.so.client.defaultproperties.PolicyRestPropertiesImpl;
+import org.onap.so.client.policy.entities.AllowedTreatments;
+import org.onap.so.client.policy.entities.Bbid;
+import org.onap.so.client.policy.entities.DecisionAttributes;
+import org.onap.so.client.policy.entities.DictionaryData;
+import org.onap.so.client.policy.entities.DictionaryItemsRequest;
+import org.onap.so.client.policy.entities.DictionaryJson;
+import org.onap.so.client.policy.entities.PolicyDecision;
+import org.onap.so.client.policy.entities.PolicyDecisionRequest;
+import org.onap.so.client.policy.entities.PolicyServiceType;
+import org.onap.so.client.policy.entities.Workstep;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class PolicyClientImpl implements PolicyClient {
- protected final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
+ private static Logger logger = LoggerFactory.getLogger(PolicyClientImpl.class);
private PolicyRestProperties props;
public PolicyClientImpl() {
props = RestPropertiesLoader.getInstance().getNewImpl(PolicyRestProperties.class);
if (props == null) {
- metricsLogger.error("No RestProperty.PolicyRestProperties implementation found on classpath");
+ logger.error("No RestProperty.PolicyRestProperties implementation found on classpath");
props = new PolicyRestPropertiesImpl();
}
}
@@ -52,8 +54,8 @@ public class PolicyClientImpl implements PolicyClient {
String errorCode) {
DecisionAttributes decisionAttributes = new DecisionAttributes();
decisionAttributes.setServiceType(serviceType);
- decisionAttributes.setVNFType(vnfType);
- decisionAttributes.setBBID(bbID);
+ decisionAttributes.setvNFType(vnfType);
+ decisionAttributes.setBbID(bbID);
decisionAttributes.setWorkStep(workStep);
decisionAttributes.setErrorCode(errorCode);
@@ -87,7 +89,7 @@ public class PolicyClientImpl implements PolicyClient {
return dictData;
}
}
- metricsLogger.error("There is no AllowedTreatments with that specified parameter set");
+ logger.error("There is no AllowedTreatments with that specified parameter set");
return null;
}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java b/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java
index 77fec34de6..9427fa7eb9 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java
+++ b/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java
@@ -18,49 +18,37 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client.policy;
+
-import java.net.MalformedURLException;
import java.util.Map;
import java.util.Optional;
-import java.util.UUID;
-import javax.ws.rs.client.ClientResponseFilter;
import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.core.UriBuilderException;
-import org.openecomp.mso.client.ResponseExceptionMapperImpl;
-import org.openecomp.mso.client.RestProperties;
-import org.openecomp.mso.client.policy.entities.PolicyServiceType;
-import org.springframework.stereotype.Service;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.policy.entities.PolicyServiceType;
+import org.onap.so.utils.TargetEntity;
-@Service
public class PolicyRestClient extends RestClient {
- private static final UUID X_ECOMP_REQUESTID = UUID.randomUUID();
private final PolicyRestProperties properties;
+
public PolicyRestClient(PolicyRestProperties props, PolicyServiceType serviceType) {
- super(props, UUID.randomUUID(), Optional.of(UriBuilder.fromPath(serviceType.toString()).build()));
+ super(props, Optional.of(UriBuilder.fromPath(serviceType.toString()).build()));
this.properties = props;
- this.getClient();
}
+ @Override
+ public TargetEntity getTargetEntity(){
+ return TargetEntity.POLICY;
+ }
+
@Override
protected void initializeHeaderMap(Map<String, String> headerMap) {
headerMap.put("ClientAuth", properties.getClientAuth());
headerMap.put("Authorization", properties.getAuth());
headerMap.put("Environment", properties.getEnvironment());
- this.addRequestId(X_ECOMP_REQUESTID);
- }
-
- @Override
- protected Optional<ClientResponseFilter> addResponseFilter() {
- return Optional.of(new ResponseExceptionMapperImpl());
}
- @Override
- public RestClient addRequestId(UUID requestId) {
- this.headerMap.put("X-ECOMP-RequestID", requestId.toString());
- return this;
- }
-}
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java b/common/src/main/java/org/onap/so/client/policy/PolicyRestProperties.java
index d89bd54f66..1de6e8cd97 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java
+++ b/common/src/main/java/org/onap/so/client/policy/PolicyRestProperties.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,13 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client.policy;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Map;
-
-import org.openecomp.mso.client.RestProperties;
+import org.onap.so.client.RestProperties;
public interface PolicyRestProperties extends RestProperties {
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/AllowedTreatments.java b/common/src/main/java/org/onap/so/client/policy/entities/AllowedTreatments.java
index 50db843416..e82eca56b8 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/AllowedTreatments.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/AllowedTreatments.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy.entities;
+package org.onap.so.client.policy.entities;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -102,4 +102,4 @@ this.responseMessage = responseMessage;
return this;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/Bbid.java b/common/src/main/java/org/onap/so/client/policy/entities/Bbid.java
index 382b27a04b..34faa7df09 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/Bbid.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/Bbid.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,70 +18,70 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy.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({
-"valueType",
-"string",
-"chars"
-})
-public class Bbid {
-
-@JsonProperty("valueType")
-private String valueType;
-@JsonProperty("string")
-private String string;
-@JsonProperty("chars")
-private String chars;
-
-@JsonProperty("valueType")
-public String getValueType() {
-return valueType;
- }
-
-@JsonProperty("valueType")
-public void setValueType(String valueType) {
-this.valueType = valueType;
- }
-
-public Bbid withValueType(String valueType) {
-this.valueType = valueType;
-return this;
- }
-
-@JsonProperty("string")
-public String getString() {
-return string;
- }
-
-@JsonProperty("string")
-public void setString(String string) {
-this.string = string;
- }
-
-public Bbid withString(String string) {
-this.string = string;
-return this;
- }
-
-@JsonProperty("chars")
-public String getChars() {
-return chars;
- }
-
-@JsonProperty("chars")
-public void setChars(String chars) {
-this.chars = chars;
- }
-
-public Bbid withChars(String chars) {
-this.chars = chars;
-return this;
- }
-
-} \ No newline at end of file
+package org.onap.so.client.policy.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({
+"valueType",
+"string",
+"chars"
+})
+public class Bbid {
+
+@JsonProperty("valueType")
+private String valueType;
+@JsonProperty("string")
+private String string;
+@JsonProperty("chars")
+private String chars;
+
+@JsonProperty("valueType")
+public String getValueType() {
+return valueType;
+ }
+
+@JsonProperty("valueType")
+public void setValueType(String valueType) {
+this.valueType = valueType;
+ }
+
+public Bbid withValueType(String valueType) {
+this.valueType = valueType;
+return this;
+ }
+
+@JsonProperty("string")
+public String getString() {
+return string;
+ }
+
+@JsonProperty("string")
+public void setString(String string) {
+this.string = string;
+ }
+
+public Bbid withString(String string) {
+this.string = string;
+return this;
+ }
+
+@JsonProperty("chars")
+public String getChars() {
+return chars;
+ }
+
+@JsonProperty("chars")
+public void setChars(String chars) {
+this.chars = chars;
+ }
+
+public Bbid withChars(String chars) {
+this.chars = chars;
+return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/DecisionAttributes.java b/common/src/main/java/org/onap/so/client/policy/entities/DecisionAttributes.java
index 655f71f823..07db7d8568 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/DecisionAttributes.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/DecisionAttributes.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,8 +18,7 @@
* ============LICENSE_END=========================================================
*/
-
-package org.openecomp.mso.client.policy.entities;
+package org.onap.so.client.policy.entities;
@@ -34,9 +33,9 @@ public class DecisionAttributes {
@JsonProperty("ServiceType")
private String serviceType;
@JsonProperty("VNFType")
- private String VNFType;
+ private String vNFType;
@JsonProperty("BB_ID")
- private String BBID;
+ private String bbID;
@JsonProperty("WorkStep")
private String workStep;
@JsonProperty("ErrorCode")
@@ -52,26 +51,6 @@ public class DecisionAttributes {
this.serviceType = serviceType;
}
- @JsonProperty("VNFType")
- public String getVNFType() {
- return VNFType;
- }
-
- @JsonProperty("VNFType")
- public void setVNFType(String vNFType) {
- this.VNFType = vNFType;
- }
-
- @JsonProperty("BB_ID")
- public String getBBID() {
- return BBID;
- }
-
- @JsonProperty("BB_ID")
- public void setBBID(String bBID) {
- this.BBID = bBID;
- }
-
@JsonProperty("WorkStep")
public String getWorkStep() {
return workStep;
@@ -91,4 +70,25 @@ public class DecisionAttributes {
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
+
+ @JsonProperty("VNFType")
+ public String getvNFType() {
+ return vNFType;
+ }
+
+ @JsonProperty("VNFType")
+ public void setvNFType(String vNFType) {
+ this.vNFType = vNFType;
+ }
+
+ @JsonProperty("BB_ID")
+ public String getBbID() {
+ return bbID;
+ }
+
+ @JsonProperty("BB_ID")
+ public void setBbID(String bbID) {
+ this.bbID = bbID;
+ }
+
}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryData.java b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryData.java
index 1ecf3366c7..8207999a80 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryData.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryData.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,88 +18,88 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy.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({
-"id",
-"bbid",
-"workstep",
-"treatments"
-})
-public class DictionaryData {
-
-@JsonProperty("id")
-private Id id;
-@JsonProperty("bbid")
-private Bbid bbid;
-@JsonProperty("workstep")
-private Workstep workstep;
-@JsonProperty("treatments")
-private Treatments treatments;
-
-@JsonProperty("id")
-public Id getId() {
-return id;
- }
-
-@JsonProperty("id")
-public void setId(Id id) {
-this.id = id;
- }
-
-public DictionaryData withId(Id id) {
-this.id = id;
-return this;
- }
-
-@JsonProperty("bbid")
-public Bbid getBbid() {
-return bbid;
- }
-
-@JsonProperty("bbid")
-public void setBbid(Bbid bbid) {
-this.bbid = bbid;
- }
-
-public DictionaryData withBbid(Bbid bbid) {
-this.bbid = bbid;
-return this;
- }
-
-@JsonProperty("workstep")
-public Workstep getWorkstep() {
-return workstep;
- }
-
-@JsonProperty("workstep")
-public void setWorkstep(Workstep workstep) {
-this.workstep = workstep;
- }
-
-public DictionaryData withWorkstep(Workstep workstep) {
-this.workstep = workstep;
-return this;
- }
-
-@JsonProperty("treatments")
-public Treatments getTreatments() {
-return treatments;
- }
-
-@JsonProperty("treatments")
-public void setTreatments(Treatments treatments) {
-this.treatments = treatments;
- }
-
-public DictionaryData withTreatments(Treatments treatments) {
-this.treatments = treatments;
-return this;
- }
-
-} \ No newline at end of file
+package org.onap.so.client.policy.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({
+"id",
+"bbid",
+"workstep",
+"treatments"
+})
+public class DictionaryData {
+
+@JsonProperty("id")
+private Id id;
+@JsonProperty("bbid")
+private Bbid bbid;
+@JsonProperty("workstep")
+private Workstep workstep;
+@JsonProperty("treatments")
+private Treatments treatments;
+
+@JsonProperty("id")
+public Id getId() {
+return id;
+ }
+
+@JsonProperty("id")
+public void setId(Id id) {
+this.id = id;
+ }
+
+public DictionaryData withId(Id id) {
+this.id = id;
+return this;
+ }
+
+@JsonProperty("bbid")
+public Bbid getBbid() {
+return bbid;
+ }
+
+@JsonProperty("bbid")
+public void setBbid(Bbid bbid) {
+this.bbid = bbid;
+ }
+
+public DictionaryData withBbid(Bbid bbid) {
+this.bbid = bbid;
+return this;
+ }
+
+@JsonProperty("workstep")
+public Workstep getWorkstep() {
+return workstep;
+ }
+
+@JsonProperty("workstep")
+public void setWorkstep(Workstep workstep) {
+this.workstep = workstep;
+ }
+
+public DictionaryData withWorkstep(Workstep workstep) {
+this.workstep = workstep;
+return this;
+ }
+
+@JsonProperty("treatments")
+public Treatments getTreatments() {
+return treatments;
+ }
+
+@JsonProperty("treatments")
+public void setTreatments(Treatments treatments) {
+this.treatments = treatments;
+ }
+
+public DictionaryData withTreatments(Treatments treatments) {
+this.treatments = treatments;
+return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryItemsRequest.java b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryItemsRequest.java
index d37d0c6f13..8b063e83c7 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryItemsRequest.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryItemsRequest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,8 +18,7 @@
* ============LICENSE_END=========================================================
*/
-
-package org.openecomp.mso.client.policy.entities;
+package org.onap.so.client.policy.entities;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryJson.java b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java
index b6a95ae12a..097c9a5cb9 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryJson.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,36 +18,37 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy.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({
-"DictionaryDatas"
-})
-public class DictionaryJson {
-
-@JsonProperty("DictionaryDatas")
-private List<DictionaryData> dictionaryDatas = new ArrayList<DictionaryData>();
-
-@JsonProperty("DictionaryDatas")
-public List<DictionaryData> getDictionaryDatas() {
-return dictionaryDatas;
- }
-
-@JsonProperty("DictionaryDatas")
-public void setDictionaryDatas(List<DictionaryData> dictionaryDatas) {
-this.dictionaryDatas = dictionaryDatas;
- }
-
-public DictionaryJson withDictionaryDatas(List<DictionaryData> dictionaryDatas) {
-this.dictionaryDatas = dictionaryDatas;
-return this;
- }
-
-} \ No newline at end of file
+package org.onap.so.client.policy.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({
+"DictionaryDatas"
+})
+public class DictionaryJson {
+
+@JsonProperty("DictionaryDatas")
+private List<DictionaryData> dictionaryDatas = new ArrayList<DictionaryData>();
+
+@JsonProperty("DictionaryDatas")
+public List<DictionaryData> getDictionaryDatas() {
+return dictionaryDatas;
+ }
+
+@JsonProperty("DictionaryDatas")
+public void setDictionaryDatas(List<DictionaryData> dictionaryDatas) {
+this.dictionaryDatas = dictionaryDatas;
+ }
+
+public DictionaryJson withDictionaryDatas(List<DictionaryData> dictionaryDatas) {
+this.dictionaryDatas = dictionaryDatas;
+return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/Id.java b/common/src/main/java/org/onap/so/client/policy/entities/Id.java
index 728381a60b..af164d6866 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/Id.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/Id.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,52 +18,52 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy.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({
-"integral",
-"valueType"
-})
-public class Id {
-
-@JsonProperty("integral")
-private Boolean integral;
-@JsonProperty("valueType")
-private String valueType;
-
-@JsonProperty("integral")
-public Boolean getIntegral() {
-return integral;
- }
-
-@JsonProperty("integral")
-public void setIntegral(Boolean integral) {
-this.integral = integral;
- }
-
-public Id withIntegral(Boolean integral) {
-this.integral = integral;
-return this;
- }
-
-@JsonProperty("valueType")
-public String getValueType() {
-return valueType;
- }
-
-@JsonProperty("valueType")
-public void setValueType(String valueType) {
-this.valueType = valueType;
- }
-
-public Id withValueType(String valueType) {
-this.valueType = valueType;
-return this;
- }
-
-} \ No newline at end of file
+package org.onap.so.client.policy.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({
+"integral",
+"valueType"
+})
+public class Id {
+
+@JsonProperty("integral")
+private Boolean integral;
+@JsonProperty("valueType")
+private String valueType;
+
+@JsonProperty("integral")
+public Boolean getIntegral() {
+return integral;
+ }
+
+@JsonProperty("integral")
+public void setIntegral(Boolean integral) {
+this.integral = integral;
+ }
+
+public Id withIntegral(Boolean integral) {
+this.integral = integral;
+return this;
+ }
+
+@JsonProperty("valueType")
+public String getValueType() {
+return valueType;
+ }
+
+@JsonProperty("valueType")
+public void setValueType(String valueType) {
+this.valueType = valueType;
+ }
+
+public Id withValueType(String valueType) {
+this.valueType = valueType;
+return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecision.java b/common/src/main/java/org/onap/so/client/policy/entities/PolicyDecision.java
index 98c7e1558d..57c93927cb 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecision.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/PolicyDecision.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client.policy.entities;
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecisionRequest.java b/common/src/main/java/org/onap/so/client/policy/entities/PolicyDecisionRequest.java
index c83fb19e34..b402e85e32 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecisionRequest.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/PolicyDecisionRequest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client.policy.entities;
import com.fasterxml.jackson.annotation.JsonInclude;
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java b/common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java
index 01f6738947..83dc6b7862 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy.entities;
+package org.onap.so.client.policy.entities;
public enum PolicyServiceType {
GET_CONFIG("getConfig"),
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/Treatments.java b/common/src/main/java/org/onap/so/client/policy/entities/Treatments.java
index 13af8932aa..433d32756c 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/Treatments.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/Treatments.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,70 +18,70 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy.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({
-"valueType",
-"string",
-"chars"
-})
-public class Treatments {
-
-@JsonProperty("valueType")
-private String valueType;
-@JsonProperty("string")
-private String string;
-@JsonProperty("chars")
-private String chars;
-
-@JsonProperty("valueType")
-public String getValueType() {
-return valueType;
- }
-
-@JsonProperty("valueType")
-public void setValueType(String valueType) {
-this.valueType = valueType;
- }
-
-public Treatments withValueType(String valueType) {
-this.valueType = valueType;
-return this;
- }
-
-@JsonProperty("string")
-public String getString() {
-return string;
- }
-
-@JsonProperty("string")
-public void setString(String string) {
-this.string = string;
- }
-
-public Treatments withString(String string) {
-this.string = string;
-return this;
- }
-
-@JsonProperty("chars")
-public String getChars() {
-return chars;
- }
-
-@JsonProperty("chars")
-public void setChars(String chars) {
-this.chars = chars;
- }
-
-public Treatments withChars(String chars) {
-this.chars = chars;
-return this;
- }
-
-} \ No newline at end of file
+package org.onap.so.client.policy.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({
+"valueType",
+"string",
+"chars"
+})
+public class Treatments {
+
+@JsonProperty("valueType")
+private String valueType;
+@JsonProperty("string")
+private String string;
+@JsonProperty("chars")
+private String chars;
+
+@JsonProperty("valueType")
+public String getValueType() {
+return valueType;
+ }
+
+@JsonProperty("valueType")
+public void setValueType(String valueType) {
+this.valueType = valueType;
+ }
+
+public Treatments withValueType(String valueType) {
+this.valueType = valueType;
+return this;
+ }
+
+@JsonProperty("string")
+public String getString() {
+return string;
+ }
+
+@JsonProperty("string")
+public void setString(String string) {
+this.string = string;
+ }
+
+public Treatments withString(String string) {
+this.string = string;
+return this;
+ }
+
+@JsonProperty("chars")
+public String getChars() {
+return chars;
+ }
+
+@JsonProperty("chars")
+public void setChars(String chars) {
+this.chars = chars;
+ }
+
+public Treatments withChars(String chars) {
+this.chars = chars;
+return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/Workstep.java b/common/src/main/java/org/onap/so/client/policy/entities/Workstep.java
index 9d2adfe2c0..4fbd6e2f8a 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/Workstep.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/Workstep.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,71 +18,70 @@
* ============LICENSE_END=========================================================
*/
-
-package org.openecomp.mso.client.policy.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({
-"valueType",
-"string",
-"chars"
-})
-public class Workstep {
-
-@JsonProperty("valueType")
-private String valueType;
-@JsonProperty("string")
-private String string;
-@JsonProperty("chars")
-private String chars;
-
-@JsonProperty("valueType")
-public String getValueType() {
-return valueType;
- }
-
-@JsonProperty("valueType")
-public void setValueType(String valueType) {
-this.valueType = valueType;
- }
-
-public Workstep withValueType(String valueType) {
-this.valueType = valueType;
-return this;
- }
-
-@JsonProperty("string")
-public String getString() {
-return string;
- }
-
-@JsonProperty("string")
-public void setString(String string) {
-this.string = string;
- }
-
-public Workstep withString(String string) {
-this.string = string;
-return this;
- }
-
-@JsonProperty("chars")
-public String getChars() {
-return chars;
- }
-
-@JsonProperty("chars")
-public void setChars(String chars) {
-this.chars = chars;
- }
-
-public Workstep withChars(String chars) {
-this.chars = chars;
-return this;
- }
-
-}
+package org.onap.so.client.policy.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({
+"valueType",
+"string",
+"chars"
+})
+public class Workstep {
+
+@JsonProperty("valueType")
+private String valueType;
+@JsonProperty("string")
+private String string;
+@JsonProperty("chars")
+private String chars;
+
+@JsonProperty("valueType")
+public String getValueType() {
+return valueType;
+ }
+
+@JsonProperty("valueType")
+public void setValueType(String valueType) {
+this.valueType = valueType;
+ }
+
+public Workstep withValueType(String valueType) {
+this.valueType = valueType;
+return this;
+ }
+
+@JsonProperty("string")
+public String getString() {
+return string;
+ }
+
+@JsonProperty("string")
+public void setString(String string) {
+this.string = string;
+ }
+
+public Workstep withString(String string) {
+this.string = string;
+return this;
+ }
+
+@JsonProperty("chars")
+public String getChars() {
+return chars;
+ }
+
+@JsonProperty("chars")
+public void setChars(String chars) {
+this.chars = chars;
+ }
+
+public Workstep withChars(String chars) {
+this.chars = chars;
+return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/ruby/RubyClient.java b/common/src/main/java/org/onap/so/client/ruby/RubyClient.java
index a4adcb23f7..15b232475b 100644
--- a/common/src/main/java/org/openecomp/mso/client/ruby/RubyClient.java
+++ b/common/src/main/java/org/onap/so/client/ruby/RubyClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,18 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.ruby;
+package org.onap.so.client.ruby;
import java.io.IOException;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
-import org.openecomp.mso.client.dmaap.DmaapPublisher;
-import org.openecomp.mso.client.ruby.beans.Event;
-import org.openecomp.mso.client.ruby.beans.MsoRequest;
-import org.openecomp.mso.client.ruby.beans.Ruby;
-import org.openecomp.mso.client.ruby.dmaap.RubyCreateTicketRequestPublisher;
+import org.onap.so.client.dmaap.DmaapPublisher;
+import org.onap.so.client.ruby.beans.Event;
+import org.onap.so.client.ruby.beans.MsoRequest;
+import org.onap.so.client.ruby.beans.Ruby;
+import org.onap.so.client.ruby.dmaap.RubyCreateTicketRequestPublisher;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -87,4 +87,4 @@ public class RubyClient {
final DmaapPublisher publisher = this.getPublisher();
publisher.send(request);
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/ruby/beans/Event.java b/common/src/main/java/org/onap/so/client/ruby/beans/Event.java
index b9263596be..93745ff55e 100644
--- a/common/src/main/java/org/openecomp/mso/client/ruby/beans/Event.java
+++ b/common/src/main/java/org/onap/so/client/ruby/beans/Event.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.ruby.beans;
+package org.onap.so.client.ruby.beans;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -64,4 +64,4 @@ this.msoRequest = msoRequest;
return this;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/ruby/beans/MsoRequest.java b/common/src/main/java/org/onap/so/client/ruby/beans/MsoRequest.java
index d00adae88a..f2c004ea6e 100644
--- a/common/src/main/java/org/openecomp/mso/client/ruby/beans/MsoRequest.java
+++ b/common/src/main/java/org/onap/so/client/ruby/beans/MsoRequest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.ruby.beans;
+package org.onap.so.client.ruby.beans;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -204,4 +204,4 @@ this.notification = notification;
return this;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/ruby/beans/Ruby.java b/common/src/main/java/org/onap/so/client/ruby/beans/Ruby.java
index 1b81043faf..725e6a3a94 100644
--- a/common/src/main/java/org/openecomp/mso/client/ruby/beans/Ruby.java
+++ b/common/src/main/java/org/onap/so/client/ruby/beans/Ruby.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,8 +18,7 @@
* ============LICENSE_END=========================================================
*/
-
-package org.openecomp.mso.client.ruby.beans;
+package org.onap.so.client.ruby.beans;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/common/src/main/java/org/openecomp/mso/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java b/common/src/main/java/org/onap/so/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java
index 521318f822..1d4e014300 100644
--- a/common/src/main/java/org/openecomp/mso/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java
+++ b/common/src/main/java/org/onap/so/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.ruby.dmaap;
+package org.onap.so.client.ruby.dmaap;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Optional;
-import org.openecomp.mso.client.dmaap.DmaapPublisher;
+import org.onap.so.client.dmaap.DmaapPublisher;
public class RubyCreateTicketRequestPublisher extends DmaapPublisher{
public RubyCreateTicketRequestPublisher() throws FileNotFoundException, IOException {
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/SDNOHealthCheckClient.java b/common/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java
index 3ba75bb2b4..93a35f34b0 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/SDNOHealthCheckClient.java
+++ b/common/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno;
+package org.onap.so.client.sdno;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -27,15 +27,15 @@ import java.util.Collections;
import java.util.List;
import java.util.Optional;
-import org.openecomp.mso.client.dmaap.DmaapConsumer;
-import org.openecomp.mso.client.dmaap.DmaapPublisher;
-import org.openecomp.mso.client.sdno.beans.AAIParamList;
-import org.openecomp.mso.client.sdno.beans.Body;
-import org.openecomp.mso.client.sdno.beans.Input;
-import org.openecomp.mso.client.sdno.beans.RequestHdCustom;
-import org.openecomp.mso.client.sdno.beans.SDNO;
-import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
-import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapPublisher;
+import org.onap.so.client.dmaap.DmaapConsumer;
+import org.onap.so.client.dmaap.DmaapPublisher;
+import org.onap.so.client.sdno.beans.AAIParamList;
+import org.onap.so.client.sdno.beans.Body;
+import org.onap.so.client.sdno.beans.Input;
+import org.onap.so.client.sdno.beans.RequestHdCustom;
+import org.onap.so.client.sdno.beans.SDNO;
+import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
+import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapPublisher;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java b/common/src/main/java/org/onap/so/client/sdno/SDNOValidator.java
index 534186b7ef..f3cab1e3e8 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java
+++ b/common/src/main/java/org/onap/so/client/sdno/SDNOValidator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,21 +18,38 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno;
+package org.onap.so.client.sdno;
import java.io.IOException;
import java.util.UUID;
+import org.onap.aai.domain.yang.GenericVnf;
+
public interface SDNOValidator {
/**
* Issues a health diagnostic request for a given vnf to SDN-O
*
* @param vnfId
+ * @param uuid
+ * @param requestingUserId
+ * @return diagnostic result
+ * @throws IOException
+ * @throws Exception
+ */
+ public boolean healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception;
+
+
+ /**
+ * Issues a health diagnostic request for a given GenericVnf to SDN-O
+ *
+ * @param genericVnf
+ * @param uuid
* @param requestingUserId
+ * @return diagnostic result
* @throws IOException
* @throws Exception
*/
- public void healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception;
+ public boolean healthDiagnostic(GenericVnf genericVnf, UUID uuid, String requestingUserId) throws IOException, Exception;
}
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidatorImpl.java b/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
index e6955f57fc..be79c8b927 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidatorImpl.java
+++ b/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,48 +18,60 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno;
+package org.onap.so.client.sdno;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Optional;
import java.util.UUID;
+import javax.ws.rs.NotFoundException;
+
import org.onap.aai.domain.yang.GenericVnf;
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.AAIResourcesClient;
-import org.openecomp.mso.client.aai.AAIVersion;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-import org.openecomp.mso.client.dmaap.DmaapConsumer;
-import org.openecomp.mso.client.dmaap.DmaapPublisher;
-import org.openecomp.mso.client.sdno.beans.Body;
-import org.openecomp.mso.client.sdno.beans.Input;
-import org.openecomp.mso.client.sdno.beans.RequestHealthDiagnostic;
-import org.openecomp.mso.client.sdno.beans.SDNO;
-import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
-import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapPublisher;
+import org.onap.so.client.aai.AAIObjectType;
+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.so.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;
+import org.onap.so.client.sdno.beans.Input;
+import org.onap.so.client.sdno.beans.RequestHealthDiagnostic;
+import org.onap.so.client.sdno.beans.SDNO;
+import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
+import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapPublisher;
import com.fasterxml.jackson.databind.ObjectMapper;
-
public class SDNOValidatorImpl implements SDNOValidator {
private final static String clientName = "MSO";
@Override
- public void healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception {
+ public boolean healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
- AAIResourcesClient client = new AAIResourcesClient(AAIVersion.V10, uuid);
- GenericVnf vnf = client.get(GenericVnf.class, uri);
+ AAIResourcesClient client = new AAIResourcesClient(AAIVersion.V10);
+ GenericVnf vnf = client.get(GenericVnf.class, uri).orElseThrow(() -> new NotFoundException(vnfId + " not found in A&AI"));
SDNO requestDiagnostic = buildRequestDiagnostic(vnf, uuid, requestingUserId);
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(requestDiagnostic);
this.submitRequest(json);
- this.pollForResponse(uuid.toString());
+ boolean status = this.pollForResponse(uuid.toString());
+ return status;
+ }
+
+ @Override
+ public boolean healthDiagnostic(GenericVnf genericVnf, UUID uuid, String requestingUserId) throws IOException, Exception {
+ SDNO requestDiagnostic = buildRequestDiagnostic(genericVnf, uuid, requestingUserId);
+ ObjectMapper mapper = new ObjectMapper();
+ String json = mapper.writeValueAsString(requestDiagnostic);
+ this.submitRequest(json);
+ boolean status = this.pollForResponse(uuid.toString());
+ return status;
}
protected SDNO buildRequestDiagnostic(GenericVnf vnf, UUID uuid, String requestingUserId) {
@@ -80,8 +92,10 @@ public class SDNOValidatorImpl implements SDNOValidator {
body.setInput(input);
RequestHealthDiagnostic request = new RequestHealthDiagnostic();
+
request.setRequestClientName(clientName);
request.setRequestNodeName(vnf.getVnfName());
+ request.setRequestNodeUuid(vnf.getVnfId());
request.setRequestNodeIp(vnf.getIpv4OamAddress()); //generic-vnf oam ip
request.setRequestUserId(requestingUserId); //mech id?
request.setRequestId(uuid.toString()); //something to identify this request by for polling
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/AAIParamList.java b/common/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java
index bab37c0685..0de9b90d66 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/beans/AAIParamList.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno.beans;
+package org.onap.so.client.sdno.beans;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -84,4 +84,4 @@ this.value = value;
return this;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/Body.java b/common/src/main/java/org/onap/so/client/sdno/beans/Body.java
index 0898f3ca36..dfca9ec124 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/beans/Body.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/Body.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno.beans;
+package org.onap.so.client.sdno.beans;
import java.io.Serializable;
import java.util.HashMap;
@@ -41,7 +41,7 @@ public class Body implements Serializable
@JsonProperty("input")
private Input input;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<>();
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
private final static long serialVersionUID = 9101706044452851559L;
@JsonProperty("input")
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/Input.java b/common/src/main/java/org/onap/so/client/sdno/beans/Input.java
index 9626ff06b4..e565f71445 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/beans/Input.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/Input.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno.beans;
+package org.onap.so.client.sdno.beans;
import java.io.Serializable;
import java.util.HashMap;
@@ -45,7 +45,7 @@ public class Input implements Serializable
private RequestHdCustom requestHdCustom;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<>();
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
private final static long serialVersionUID = 7155546785389227528L;
@JsonProperty("request-healthdiagnostic")
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHdCustom.java b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java
index a0d00a7e6e..b3a6a4815e 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHdCustom.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,11 +18,12 @@
* ============LICENSE_END=========================================================
*/
+package org.onap.so.client.sdno.beans;
-package org.openecomp.mso.client.sdno.beans;
-
+import java.io.Serializable;
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;
@@ -34,10 +35,15 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
"request-id",
"health-diagnostic-code",
"operation-type",
+"send-detailed-cmd-response",
"aai-param-list"
})
-public class RequestHdCustom {
+public class RequestHdCustom implements Serializable {
+/**
+ *
+ */
+ private static final long serialVersionUID = -206110458275127710L;
@JsonProperty("request-client-name")
private String requestClientName;
@JsonProperty("request-user-id")
@@ -48,6 +54,8 @@ private String requestId;
private String healthDiagnosticCode;
@JsonProperty("operation-type")
private String operationType;
+@JsonProperty("send-detailed-cmd-response")
+private String sendDetailedCmdResponse = "false";
@JsonProperty("aai-param-list")
private List<AAIParamList> aaiParamList = new ArrayList<AAIParamList>();
@@ -152,6 +160,19 @@ this.operationType = operationType;
return this;
}
+public void setSendDetailedCmdResponse(String sendDetailedCmdResponse) {
+ this.sendDetailedCmdResponse = sendDetailedCmdResponse;
+}
+
+public String getSendDetailedCmdResponse() {
+ return sendDetailedCmdResponse;
+}
+
+public RequestHdCustom withSendDetailedCmdResponse(String sendDetailedCmdResponse) {
+ this.sendDetailedCmdResponse = sendDetailedCmdResponse;
+ return this;
+}
+
@JsonProperty("aai-param-list")
public List<AAIParamList> getAaiParamList() {
return aaiParamList;
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHealthDiagnostic.java b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java
index 5ff47fa4be..69745d6bfb 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHealthDiagnostic.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno.beans;
+package org.onap.so.client.sdno.beans;
import java.io.Serializable;
import java.util.HashMap;
@@ -35,6 +35,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonPropertyOrder({
"request-client-name",
"request-node-name",
+ "request-node-uuid",
"request-node-ip",
"request-id",
"request-user-id",
@@ -48,6 +49,8 @@ public class RequestHealthDiagnostic implements Serializable
private String requestClientName;
@JsonProperty("request-node-name")
private String requestNodeName;
+ @JsonProperty("request-node-uuid")
+ private String requestNodeUuid;
@JsonProperty("request-node-ip")
private String requestNodeIp;
@JsonProperty("request-id")
@@ -59,7 +62,7 @@ public class RequestHealthDiagnostic implements Serializable
@JsonProperty("health-diagnostic-code")
private String healthDiagnosticCode;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<>();
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
private final static long serialVersionUID = 1166788526178388021L;
@JsonProperty("request-client-name")
@@ -91,6 +94,21 @@ public class RequestHealthDiagnostic implements Serializable
this.requestNodeName = requestNodeName;
return this;
}
+
+ @JsonProperty("request-node-uuid")
+ public String getRequestNodeUuid() {
+ return requestNodeUuid;
+ }
+
+ @JsonProperty("request-node-uuid")
+ public void setRequestNodeUuid(String requestNodeUuid) {
+ this.requestNodeUuid = requestNodeUuid;
+ }
+
+ public RequestHealthDiagnostic withRequestNodeUuid(String requestNodeUuid) {
+ this.requestNodeUuid = requestNodeUuid;
+ return this;
+ }
@JsonProperty("request-node-ip")
public String getRequestNodeIp() {
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/ResultInfo.java b/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java
index 1fdc9b2484..7cf9c7cb06 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/beans/ResultInfo.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno.beans;
+package org.onap.so.client.sdno.beans;
import java.util.HashMap;
import java.util.Map;
@@ -51,7 +51,7 @@ private String requestId;
@JsonProperty("status")
private String status;
@JsonIgnore
-private Map<String, Object> additionalProperties = new HashMap<>();
+private Map<String, Object> additionalProperties = new HashMap<String, Object>();
@JsonProperty("client-name")
public String getClientName() {
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/SDNO.java b/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java
index fa3a26a9ef..7c728a7bab 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/beans/SDNO.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno.beans;
+package org.onap.so.client.sdno.beans;
import java.io.Serializable;
import java.util.HashMap;
@@ -50,7 +50,7 @@ public class SDNO implements Serializable
@JsonProperty("body")
private Body body;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<>();
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
private final static long serialVersionUID = -5303297382564282650L;
@JsonProperty("operation")
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java
index ca5888caca..6f415af8b0 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java
+++ b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno.dmaap;
+package org.onap.so.client.sdno.dmaap;
import java.io.IOException;
import java.util.Optional;
-import org.openecomp.mso.client.dmaap.DmaapConsumer;
-import org.openecomp.mso.client.exceptions.SDNOException;
-import org.openecomp.mso.jsonpath.JsonPathUtil;
+import org.onap.so.client.dmaap.DmaapConsumer;
+import org.onap.so.client.exceptions.SDNOException;
+import org.onap.so.jsonpath.JsonPathUtil;
public class SDNOHealthCheckDmaapConsumer extends DmaapConsumer {
@@ -81,7 +81,7 @@ public class SDNOHealthCheckDmaapConsumer extends DmaapConsumer {
throw new SDNOException("failed with no status message");
}
} else {
- auditLogger.info("successful health diagnostic found for request: " + this.getRequestId());
+ logger.info("successful health diagnostic found for request: {}" ,getRequestId());
stopProcessingMessages();
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java
index ef19bb7921..2556e67e3c 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java
+++ b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno.dmaap;
+package org.onap.so.client.sdno.dmaap;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Optional;
-import org.openecomp.mso.client.dmaap.DmaapPublisher;
+import org.onap.so.client.dmaap.DmaapPublisher;
public class SDNOHealthCheckDmaapPublisher extends DmaapPublisher {
diff --git a/common/src/main/java/org/openecomp/mso/entity/MsoRequest.java b/common/src/main/java/org/onap/so/entity/MsoRequest.java
index 39ba8dc175..c61684bec7 100644
--- a/common/src/main/java/org/openecomp/mso/entity/MsoRequest.java
+++ b/common/src/main/java/org/onap/so/entity/MsoRequest.java
@@ -18,9 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.entity;
+package org.onap.so.entity;
+import java.io.Serializable;
/**
* This simple bean holds tracking information for MSO requests within
@@ -29,8 +30,9 @@ package org.openecomp.mso.entity;
*
*
*/
-public class MsoRequest
+public class MsoRequest implements Serializable
{
+ private static final long serialVersionUID = 1797142528913733469L;
private String requestId;
private String serviceInstanceId;
@@ -38,11 +40,12 @@ public class MsoRequest
this.requestId = null;
this.serviceInstanceId = null;
}
+
public MsoRequest(String r, String s) {
this.requestId = r;
this.serviceInstanceId = s;
}
-
+
public String getRequestId() {
return requestId;
}
diff --git a/common/src/main/java/org/openecomp/mso/entity/package-info.java b/common/src/main/java/org/onap/so/entity/package-info.java
index bf7201c15d..c4f5a16aee 100644
--- a/common/src/main/java/org/openecomp/mso/entity/package-info.java
+++ b/common/src/main/java/org/onap/so/entity/package-info.java
@@ -22,5 +22,5 @@
* Entities used for logging.
*/
-package org.openecomp.mso.entity;
+package org.onap.so.entity;
diff --git a/common/src/main/java/org/openecomp/mso/utils/RootIgnoringObjectMapper.java b/common/src/main/java/org/onap/so/exceptions/MarshallerException.java
index 6f3c5b7d99..8b06a8519f 100644
--- a/common/src/main/java/org/openecomp/mso/utils/RootIgnoringObjectMapper.java
+++ b/common/src/main/java/org/onap/so/exceptions/MarshallerException.java
@@ -18,22 +18,32 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.utils;
+package org.onap.so.exceptions;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-/**
- * An ObjectMapper for a specific class that ignores the root element
- * if it is present.
- */
-public class RootIgnoringObjectMapper<T> extends ObjectMapper {
+public class MarshallerException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+ private String message;
+ private int errorCode;
+
+ public MarshallerException(String message) {
+ super(message);
+ }
+
+ public MarshallerException(String message, int errorCode, Exception e) {
+ super (e);
+ this.message = message;
+ this.errorCode = errorCode;
+
+ }
- private static final long serialVersionUID = 6812584067195377395L;
+ @Override
+ public String getMessage() {
+ return message;
+ }
- public RootIgnoringObjectMapper(Class<T> clazz) {
- SimpleModule module = new SimpleModule();
- module.addDeserializer(clazz, new RootIgnoringJsonDeserializer<T>(clazz));
- registerModule(module);
- }
-} \ No newline at end of file
+ public int getErrorCode() {
+ return errorCode;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/exceptions/ValidationException.java b/common/src/main/java/org/onap/so/exceptions/ValidationException.java
new file mode 100644
index 0000000000..713fac70f3
--- /dev/null
+++ b/common/src/main/java/org/onap/so/exceptions/ValidationException.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.so.exceptions;
+
+
+public class ValidationException extends Exception {
+
+ /**
+ * This class simply extends Exception (without addition additional functionality)
+ * to provide an identifier for RequestsDB related exceptions on create, delete, query.
+ *
+ *
+ **/
+
+ private static final long serialVersionUID = 1L;
+ private static final String VALIDATION_FAIL = "No valid $ELEMENT is specified";
+ private static final String INVALID_ELEMENT = "$ELEMENT is not valid in the $VERSION version";
+ private static final String REPLACE_ELEMENT_KEY = "\\$ELEMENT";
+ private static final String REPLACE_VERSION_KEY = "\\$VERSION";
+
+ @Deprecated
+ public ValidationException (String msg) {
+ super (VALIDATION_FAIL.replaceAll (REPLACE_ELEMENT_KEY, msg));
+ }
+
+ public ValidationException(String msg, boolean overrideExistingMessage) {
+ super(overrideExistingMessage ? VALIDATION_FAIL.replaceAll(REPLACE_ELEMENT_KEY, msg) : msg);
+ }
+
+ public ValidationException (String msg, Exception cause) {
+ super (VALIDATION_FAIL.replaceAll (REPLACE_ELEMENT_KEY, msg), cause);
+ }
+ public ValidationException(String msg, String version) {
+ super(INVALID_ELEMENT.replaceAll(REPLACE_ELEMENT_KEY, msg).replaceAll(REPLACE_VERSION_KEY, version));
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/jsonpath/JsonPathUtil.java b/common/src/main/java/org/onap/so/jsonpath/JsonPathUtil.java
index 148eb74068..cb0de998ba 100644
--- a/common/src/main/java/org/openecomp/mso/jsonpath/JsonPathUtil.java
+++ b/common/src/main/java/org/onap/so/jsonpath/JsonPathUtil.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.jsonpath;
+package org.onap.so.jsonpath;
import java.util.ArrayList;
import java.util.List;
@@ -35,9 +35,10 @@ public class JsonPathUtil {
private final Configuration conf;
-
+ private final Configuration pathListConf;
private JsonPathUtil() {
conf = Configuration.defaultConfiguration().jsonProvider(new JacksonJsonNodeJsonProvider()).addOptions(Option.ALWAYS_RETURN_LIST, Option.SUPPRESS_EXCEPTIONS);
+ pathListConf = Configuration.defaultConfiguration().addOptions(Option.AS_PATH_LIST, Option.SUPPRESS_EXCEPTIONS,Option.ALWAYS_RETURN_LIST);
}
private static class Helper {
@@ -79,4 +80,8 @@ public class JsonPathUtil {
}
return result;
}
+
+ public List<String> getPathList(String json, String jsonPath) {
+ return JsonPath.using(pathListConf).parse(json).read(jsonPath);
+ }
}
diff --git a/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java b/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java
new file mode 100644
index 0000000000..0d20dd8bf9
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java
@@ -0,0 +1,87 @@
+/*-
+ * ============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.logger;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+import org.springframework.stereotype.Component;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.spi.LoggerContextListener;
+import ch.qos.logback.core.Context;
+import ch.qos.logback.core.spi.ContextAwareBase;
+import ch.qos.logback.core.spi.LifeCycle;
+
+@Component
+public class LoggerStartupListener extends ContextAwareBase implements LoggerContextListener, LifeCycle {
+
+ private boolean started = false;
+
+ @Override
+ public void start() {
+ if (started)
+ return;
+ InetAddress addr= null;
+ try {
+ addr = InetAddress.getLocalHost();
+ } catch (UnknownHostException e) {
+ e.printStackTrace();
+ }
+ Context context = getContext();
+ if (addr != null) {
+ context.putProperty("server.name", addr.getHostName());
+ }
+ started = true;
+ }
+
+ @Override
+ public void stop() {
+ }
+
+ @Override
+ public boolean isStarted() {
+ return started;
+ }
+
+ @Override
+ public boolean isResetResistant() {
+ return true;
+ }
+
+ @Override
+ public void onLevelChange(Logger arg0, Level arg1) {
+ }
+
+ @Override
+ public void onReset(LoggerContext arg0) {
+ }
+
+ @Override
+ public void onStart(LoggerContext arg0) {
+ }
+
+ @Override
+ public void onStop(LoggerContext arg0) {
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/logger/MessageEnum.java b/common/src/main/java/org/onap/so/logger/MessageEnum.java
index 419bbf8ca6..fcaa52024b 100644
--- a/common/src/main/java/org/openecomp/mso/logger/MessageEnum.java
+++ b/common/src/main/java/org/onap/so/logger/MessageEnum.java
@@ -1,233 +1,223 @@
-/*-
- * ============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.openecomp.mso.logger;
-
-
-import com.att.eelf.i18n.EELFResolvableErrorEnum;
-import com.att.eelf.i18n.EELFResourceManager;
-
-public enum MessageEnum implements EELFResolvableErrorEnum{
- // Api Handler Messages
- APIH_REQUEST_NULL,
- APIH_QUERY_FOUND,
- APIH_QUERY_NOT_FOUND,
- APIH_QUERY_PARAM_WRONG,
- APIH_DB_ACCESS_EXC,
- APIH_DB_ACCESS_EXC_REASON,
- APIH_VALIDATION_ERROR,
- APIH_REQUEST_VALIDATION_ERROR,
- APIH_SERVICE_VALIDATION_ERROR,
- APIH_GENERAL_EXCEPTION_ARG,
- APIH_GENERAL_EXCEPTION,
- APIH_GENERAL_WARNING,
- APIH_AUDIT_EXEC,
- APIH_GENERAL_METRICS,
- APIH_DUPLICATE_CHECK_EXC,
- APIH_DUPLICATE_FOUND,
- APIH_BAD_ORDER,
- APIH_DB_ATTRIBUTE_NOT_FOUND,
- APIH_BPEL_COMMUNICATE_ERROR,
- APIH_BPEL_RESPONSE_ERROR,
- APIH_WARP_REQUEST,
- APIH_ERROR_FROM_BPEL_SERVER,
- APIH_DB_INSERT_EXC,
- APIH_DB_UPDATE_EXC,
- APIH_NO_PROPERTIES,
- APIH_PROPERTY_LOAD_SUC,
- APIH_LOAD_PROPERTIES_FAIL,
- APIH_SDNC_COMMUNICATE_ERROR,
- APIH_SDNC_RESPONSE_ERROR,
- APIH_CANNOT_READ_SCHEMA,
- APIH_HEALTH_CHECK_EXCEPTION,
- APIH_REQUEST_VALIDATION_ERROR_REASON,
- APIH_JAXB_MARSH_ERROR,
- APIH_JAXB_UNMARSH_ERROR,
- APIH_VNFREQUEST_VALIDATION_ERROR,
- APIH_DOM2STR_ERROR,
- APIH_READ_VNFOUTPUT_CLOB_EXCEPTION,
- APIH_DUPLICATE_CHECK_EXC_ATT,
- APIH_GENERATED_REQUEST_ID,
- APIH_GENERATED_SERVICE_INSTANCE_ID,
- APIH_REPLACE_REQUEST_ID,
- // Resource Adapter Messages
- RA_GENERAL_EXCEPTION_ARG,
- RA_GENERAL_EXCEPTION,
- RA_GENERAL_WARNING,
- RA_MISSING_PARAM,
- RA_AUDIT_EXEC,
- RA_GENERAL_METRICS,
- RA_CREATE_STACK_TIMEOUT,
- RA_DELETE_STACK_TIMEOUT,
- RA_UPDATE_STACK_TIMEOUT,
- RA_CONNECTION_EXCEPTION,
- RA_PARSING_ERROR,
- RA_PROPERTIES_NOT_FOUND,
- RA_LOAD_PROPERTIES_SUC,
- RA_NETWORK_ALREADY_EXIST,
- RA_UPDATE_NETWORK_ERR,
- RA_CREATE_STACK_ERR,
- RA_UPDATE_STACK_ERR,
- RA_CREATE_TENANT_ERR,
- RA_NETWORK_NOT_FOUND,
- RA_NETWORK_ORCHE_MODE_NOT_SUPPORT,
- RA_CREATE_NETWORK_EXC,
- RA_NS_EXC,
- RA_PARAM_NOT_FOUND,
- RA_CONFIG_EXC,
- RA_UNKOWN_PARAM,
- RA_VLAN_PARSE,
- RA_DELETE_NETWORK_EXC,
- RA_ROLLBACK_NULL,
- RA_TENANT_NOT_FOUND,
- RA_QUERY_NETWORK_EXC,
- RA_CREATE_NETWORK_NOTIF_EXC,
- RA_ASYNC_ROLLBACK,
- RA_WSDL_NOT_FOUND,
- RA_WSDL_URL_CONVENTION_EXC,
- RA_INIT_NOTIF_EXC,
- RA_SET_CALLBACK_AUTH_EXC,
- RA_FAULT_INFO_EXC,
- RA_MARSHING_ERROR,
- RA_PARSING_REQUEST_ERROR,
- RA_SEND_REQUEST_SDNC,
- RA_RESPONSE_FROM_SDNC,
- RA_EXCEPTION_COMMUNICATE_SDNC,
- RA_EVALUATE_XPATH_ERROR,
- RA_ANALYZE_ERROR_EXC,
- RA_ERROR_GET_RESPONSE_SDNC,
- RA_CALLBACK_BPEL,
- RA_INIT_CALLBACK_WSDL_ERR,
- RA_CALLBACK_BPEL_EXC,
- RA_CALLBACK_BPEL_COMPLETE,
- RA_SDNC_MISS_CONFIG_PARAM,
- RA_SDNC_INVALID_CONFIG,
- RA_PRINT_URL,
- RA_ERROR_CREATE_SDNC_REQUEST,
- RA_ERROR_CREATE_SDNC_RESPONSE,
- RA_ERROR_CONVERT_XML2STR,
- RA_RECEIVE_SDNC_NOTIF,
- RA_INIT_SDNC_ADAPTER,
- RA_SEND_REQUEST_APPC_ERR,
- RA_SEND_REQUEST_SDNC_ERR,
- RA_RECEIVE_BPEL_REQUEST,
- RA_TENANT_ALREADY_EXIST,
- RA_UPDATE_TENANT_ERR,
- RA_DELETE_TEMAMT_ERR,
- RA_ROLLBACK_TENANT_ERR,
- RA_QUERY_VNF_ERR,
- RA_VNF_ALREADY_EXIST,
- RA_VNF_UNKNOWN_PARAM,
- RA_VNF_EXTRA_PARAM,
- RA_CREATE_VNF_ERR,
- RA_VNF_NOT_EXIST,
- RA_UPDATE_VNF_ERR,
- RA_DELETE_VNF_ERR,
- RA_ASYNC_CREATE_VNF,
- RA_SEND_VNF_NOTIF_ERR,
- RA_ASYNC_CREATE_VNF_COMPLETE,
- RA_ASYNC_UPDATE_VNF,
- RA_ASYNC_UPDATE_VNF_COMPLETE,
- RA_ASYNC_QUERY_VNF,
- RA_ASYNC_QUERY_VNF_COMPLETE,
- RA_ASYNC_DELETE_VNF,
- RA_ASYNC_DELETE_VNF_COMPLETE,
- RA_ASYNC_ROLLBACK_VNF,
- RA_ASYNC_ROLLBACK_VNF_COMPLETE,
- RA_ROLLBACK_VNF_ERR,
- RA_DB_INVALID_STATUS,
- RA_CANT_UPDATE_REQUEST,
- RA_DB_REQUEST_NOT_EXIST,
- RA_CONFIG_NOT_FOUND,
- RA_CONFIG_LOAD,
- RA_RECEIVE_WORKFLOW_MESSAGE,
- // BPEL engine Messages
- BPMN_GENERAL_INFO,
- BPMN_GENERAL_EXCEPTION_ARG,
- BPMN_GENERAL_EXCEPTION,
- BPMN_GENERAL_WARNING,
- BPMN_AUDIT_EXEC,
- BPMN_GENERAL_METRICS,
- BPMN_URN_MAPPING_FAIL,
- BPMN_VARIABLE_NULL,
- BPMN_CALLBACK_EXCEPTION,
- // ASDC Messages
- ASDC_GENERAL_EXCEPTION_ARG,
- ASDC_GENERAL_EXCEPTION,
- ASDC_GENERAL_WARNING,
- ASDC_GENERAL_INFO,
- ASDC_AUDIT_EXEC,
- ASDC_GENERAL_METRICS,
- ASDC_CREATE_SERVICE,
- ASDC_ARTIFACT_ALREADY_DEPLOYED,
- ASDC_CREATE_ARTIFACT,
- ASDC_ARTIFACT_INSTALL_EXC,
- ASDC_ARTIFACT_ALREADY_DEPLOYED_DETAIL,
- ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL,
- ASDC_ARTIFACT_CHECK_EXC,
- ASDC_INIT_ASDC_CLIENT_EXC,
- ASDC_INIT_ASDC_CLIENT_SUC,
- ASDC_LOAD_ASDC_CLIENT_EXC,
- ASDC_SINGLETON_CHECKT_EXC,
- ASDC_SHUTDOWN_ASDC_CLIENT_EXC,
- ASDC_CHECK_HEAT_TEMPLATE,
- ASDC_START_INSTALL_ARTIFACT,
- ASDC_ARTIFACT_TYPE_NOT_SUPPORT,
- ASDC_ARTIFACT_ALREADY_EXIST,
- ASDC_ARTIFACT_DOWNLOAD_SUC,
- ASDC_ARTIFACT_DOWNLOAD_FAIL,
- ASDC_START_DEPLOY_ARTIFACT,
- ASDC_SEND_NOTIF_ASDC,
- ASDC_SEND_NOTIF_ASDC_EXEC,
- ASDC_RECEIVE_CALLBACK_NOTIF,
- ASDC_RECEIVE_SERVICE_NOTIF,
- ASDC_ARTIFACT_NULL,
- ASDC_SERVICE_NOT_SUPPORT,
- ASDC_ARTIFACT_DEPLOY_SUC,
- ASDC_PROPERTIES_NOT_FOUND,
- ASDC_PROPERTIES_LOAD_SUCCESS,
- // Default Messages, in case Log catalog is not defined
- GENERAL_EXCEPTION_ARG,
- GENERAL_EXCEPTION,
- GENERAL_WARNING,
- AUDIT_EXEC,
- GENERAL_METRICS,
- LOGGER_SETUP,
- LOGGER_NOT_FOUND,
- LOGGER_UPDATE_SUC,
- LOGGER_UPDATE_DEBUG,
- LOGGER_UPDATE_DEBUG_SUC,
- LOAD_PROPERTIES_SUC,
- NO_PROPERTIES,
- MADATORY_PARAM_MISSING,
- LOAD_PROPERTIES_FAIL,
- INIT_LOGGER,
- INIT_LOGGER_FAIL,
- JAXB_EXCEPTION,
- IDENTITY_SERVICE_NOT_FOUND;
-
- static {
- EELFResourceManager.loadMessageBundle("GenericMessages");
- EELFResourceManager.loadMessageBundle("ApiHandler");
- EELFResourceManager.loadMessageBundle("BPMN");
- EELFResourceManager.loadMessageBundle("ResourceAdapter");
- EELFResourceManager.loadMessageBundle("ASDC");
- }
-}
+/*-
+ * ============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.logger;
+
+
+
+public enum MessageEnum{
+ // Api Handler Messages
+ APIH_REQUEST_NULL,
+ APIH_QUERY_FOUND,
+ APIH_QUERY_NOT_FOUND,
+ APIH_QUERY_PARAM_WRONG,
+ APIH_DB_ACCESS_EXC,
+ APIH_DB_ACCESS_EXC_REASON,
+ APIH_VALIDATION_ERROR,
+ APIH_REQUEST_VALIDATION_ERROR,
+ APIH_SERVICE_VALIDATION_ERROR,
+ APIH_GENERAL_EXCEPTION_ARG,
+ APIH_GENERAL_EXCEPTION,
+ APIH_GENERAL_WARNING,
+ APIH_AUDIT_EXEC,
+ APIH_GENERAL_METRICS,
+ APIH_DUPLICATE_CHECK_EXC,
+ APIH_DUPLICATE_FOUND,
+ APIH_BAD_ORDER,
+ APIH_DB_ATTRIBUTE_NOT_FOUND,
+ APIH_BPEL_COMMUNICATE_ERROR,
+ APIH_BPEL_RESPONSE_ERROR,
+ APIH_WARP_REQUEST,
+ APIH_ERROR_FROM_BPEL_SERVER,
+ APIH_DB_INSERT_EXC,
+ APIH_DB_UPDATE_EXC,
+ APIH_NO_PROPERTIES,
+ APIH_PROPERTY_LOAD_SUC,
+ APIH_LOAD_PROPERTIES_FAIL,
+ APIH_SDNC_COMMUNICATE_ERROR,
+ APIH_SDNC_RESPONSE_ERROR,
+ APIH_CANNOT_READ_SCHEMA,
+ APIH_HEALTH_CHECK_EXCEPTION,
+ APIH_REQUEST_VALIDATION_ERROR_REASON,
+ APIH_JAXB_MARSH_ERROR,
+ APIH_JAXB_UNMARSH_ERROR,
+ APIH_VNFREQUEST_VALIDATION_ERROR,
+ APIH_DOM2STR_ERROR,
+ APIH_READ_VNFOUTPUT_CLOB_EXCEPTION,
+ APIH_DUPLICATE_CHECK_EXC_ATT,
+ APIH_GENERATED_REQUEST_ID,
+ APIH_GENERATED_SERVICE_INSTANCE_ID,
+ APIH_REPLACE_REQUEST_ID,
+ // Resource Adapter Messages
+ RA_GENERAL_EXCEPTION_ARG,
+ RA_GENERAL_EXCEPTION,
+ RA_GENERAL_WARNING,
+ RA_MISSING_PARAM,
+ RA_AUDIT_EXEC,
+ RA_GENERAL_METRICS,
+ RA_CREATE_STACK_TIMEOUT,
+ RA_DELETE_STACK_TIMEOUT,
+ RA_UPDATE_STACK_TIMEOUT,
+ RA_CONNECTION_EXCEPTION,
+ RA_PARSING_ERROR,
+ RA_PROPERTIES_NOT_FOUND,
+ RA_LOAD_PROPERTIES_SUC,
+ RA_NETWORK_ALREADY_EXIST,
+ RA_UPDATE_NETWORK_ERR,
+ RA_CREATE_STACK_ERR,
+ RA_UPDATE_STACK_ERR,
+ RA_CREATE_TENANT_ERR,
+ RA_NETWORK_NOT_FOUND,
+ RA_NETWORK_ORCHE_MODE_NOT_SUPPORT,
+ RA_CREATE_NETWORK_EXC,
+ RA_NS_EXC,
+ RA_PARAM_NOT_FOUND,
+ RA_CONFIG_EXC,
+ RA_UNKOWN_PARAM,
+ RA_VLAN_PARSE,
+ RA_DELETE_NETWORK_EXC,
+ RA_ROLLBACK_NULL,
+ RA_TENANT_NOT_FOUND,
+ RA_QUERY_NETWORK_EXC,
+ RA_CREATE_NETWORK_NOTIF_EXC,
+ RA_ASYNC_ROLLBACK,
+ RA_WSDL_NOT_FOUND,
+ RA_WSDL_URL_CONVENTION_EXC,
+ RA_INIT_NOTIF_EXC,
+ RA_SET_CALLBACK_AUTH_EXC,
+ RA_FAULT_INFO_EXC,
+ RA_MARSHING_ERROR,
+ RA_PARSING_REQUEST_ERROR,
+ RA_SEND_REQUEST_SDNC,
+ RA_RESPONSE_FROM_SDNC,
+ RA_EXCEPTION_COMMUNICATE_SDNC,
+ RA_EVALUATE_XPATH_ERROR,
+ RA_ANALYZE_ERROR_EXC,
+ RA_ERROR_GET_RESPONSE_SDNC,
+ RA_CALLBACK_BPEL,
+ RA_INIT_CALLBACK_WSDL_ERR,
+ RA_CALLBACK_BPEL_EXC,
+ RA_CALLBACK_BPEL_COMPLETE,
+ RA_SDNC_MISS_CONFIG_PARAM,
+ RA_SDNC_INVALID_CONFIG,
+ RA_PRINT_URL,
+ RA_ERROR_CREATE_SDNC_REQUEST,
+ RA_ERROR_CREATE_SDNC_RESPONSE,
+ RA_ERROR_CONVERT_XML2STR,
+ RA_RECEIVE_SDNC_NOTIF,
+ RA_INIT_SDNC_ADAPTER,
+ RA_SEND_REQUEST_APPC_ERR,
+ RA_SEND_REQUEST_SDNC_ERR,
+ RA_RECEIVE_BPEL_REQUEST,
+ RA_TENANT_ALREADY_EXIST,
+ RA_UPDATE_TENANT_ERR,
+ RA_DELETE_TEMAMT_ERR,
+ RA_ROLLBACK_TENANT_ERR,
+ RA_QUERY_VNF_ERR,
+ RA_VNF_ALREADY_EXIST,
+ RA_VNF_UNKNOWN_PARAM,
+ RA_VNF_EXTRA_PARAM,
+ RA_CREATE_VNF_ERR,
+ RA_VNF_NOT_EXIST,
+ RA_UPDATE_VNF_ERR,
+ RA_DELETE_VNF_ERR,
+ RA_ASYNC_CREATE_VNF,
+ RA_SEND_VNF_NOTIF_ERR,
+ RA_ASYNC_CREATE_VNF_COMPLETE,
+ RA_ASYNC_UPDATE_VNF,
+ RA_ASYNC_UPDATE_VNF_COMPLETE,
+ RA_ASYNC_QUERY_VNF,
+ RA_ASYNC_QUERY_VNF_COMPLETE,
+ RA_ASYNC_DELETE_VNF,
+ RA_ASYNC_DELETE_VNF_COMPLETE,
+ RA_ASYNC_ROLLBACK_VNF,
+ RA_ASYNC_ROLLBACK_VNF_COMPLETE,
+ RA_ROLLBACK_VNF_ERR,
+ RA_DB_INVALID_STATUS,
+ RA_CANT_UPDATE_REQUEST,
+ RA_DB_REQUEST_NOT_EXIST,
+ RA_CONFIG_NOT_FOUND,
+ RA_CONFIG_LOAD,
+ RA_RECEIVE_WORKFLOW_MESSAGE,
+ // BPEL engine Messages
+ BPMN_GENERAL_INFO,
+ BPMN_GENERAL_EXCEPTION_ARG,
+ BPMN_GENERAL_EXCEPTION,
+ BPMN_GENERAL_WARNING,
+ BPMN_AUDIT_EXEC,
+ BPMN_GENERAL_METRICS,
+ BPMN_URN_MAPPING_FAIL,
+ BPMN_VARIABLE_NULL,
+ BPMN_CALLBACK_EXCEPTION,
+ // ASDC Messages
+ ASDC_GENERAL_EXCEPTION_ARG,
+ ASDC_GENERAL_EXCEPTION,
+ ASDC_GENERAL_WARNING,
+ ASDC_GENERAL_INFO,
+ ASDC_AUDIT_EXEC,
+ ASDC_GENERAL_METRICS,
+ ASDC_CREATE_SERVICE,
+ ASDC_ARTIFACT_ALREADY_DEPLOYED,
+ ASDC_CREATE_ARTIFACT,
+ ASDC_ARTIFACT_INSTALL_EXC,
+ ASDC_ARTIFACT_ALREADY_DEPLOYED_DETAIL,
+ ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL,
+ ASDC_ARTIFACT_CHECK_EXC,
+ ASDC_INIT_ASDC_CLIENT_EXC,
+ ASDC_INIT_ASDC_CLIENT_SUC,
+ ASDC_LOAD_ASDC_CLIENT_EXC,
+ ASDC_SINGLETON_CHECKT_EXC,
+ ASDC_SHUTDOWN_ASDC_CLIENT_EXC,
+ ASDC_CHECK_HEAT_TEMPLATE,
+ ASDC_START_INSTALL_ARTIFACT,
+ ASDC_ARTIFACT_TYPE_NOT_SUPPORT,
+ ASDC_ARTIFACT_ALREADY_EXIST,
+ ASDC_ARTIFACT_DOWNLOAD_SUC,
+ ASDC_ARTIFACT_DOWNLOAD_FAIL,
+ ASDC_START_DEPLOY_ARTIFACT,
+ ASDC_SEND_NOTIF_ASDC,
+ ASDC_SEND_NOTIF_ASDC_EXEC,
+ ASDC_RECEIVE_CALLBACK_NOTIF,
+ ASDC_RECEIVE_SERVICE_NOTIF,
+ ASDC_ARTIFACT_NULL,
+ ASDC_SERVICE_NOT_SUPPORT,
+ ASDC_ARTIFACT_DEPLOY_SUC,
+ ASDC_PROPERTIES_NOT_FOUND,
+ ASDC_PROPERTIES_LOAD_SUCCESS,
+ // Default Messages, in case Log catalog is not defined
+ GENERAL_EXCEPTION_ARG,
+ GENERAL_EXCEPTION,
+ GENERAL_WARNING,
+ AUDIT_EXEC,
+ GENERAL_METRICS,
+ LOGGER_SETUP,
+ LOGGER_NOT_FOUND,
+ LOGGER_UPDATE_SUC,
+ LOGGER_UPDATE_DEBUG,
+ LOGGER_UPDATE_DEBUG_SUC,
+ LOAD_PROPERTIES_SUC,
+ NO_PROPERTIES,
+ MADATORY_PARAM_MISSING,
+ LOAD_PROPERTIES_FAIL,
+ INIT_LOGGER,
+ INIT_LOGGER_FAIL,
+ JAXB_EXCEPTION,
+ IDENTITY_SERVICE_NOT_FOUND;
+}
diff --git a/common/src/main/java/org/openecomp/mso/logger/MsoAlarmLogger.java b/common/src/main/java/org/onap/so/logger/MsoAlarmLogger.java
index b2b8d0aa33..890aac93c0 100644
--- a/common/src/main/java/org/openecomp/mso/logger/MsoAlarmLogger.java
+++ b/common/src/main/java/org/onap/so/logger/MsoAlarmLogger.java
@@ -18,10 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.logger;
+package org.onap.so.logger;
import java.io.File;
+
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
@@ -145,6 +146,11 @@ public class MsoAlarmLogger implements ServletContextListener {
alarmLogger.setAdditive (false);
}
+ public void resetAppender() {
+ synchronized (MsoAlarmLogger.class) {
+ fileAppender = null;
+ }
+ }
private static RollingFileAppender<ILoggingEvent> getAppender (String msoAlarmFile) {
// Create a Logger for alarms. Just use a default Pattern that outputs
diff --git a/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java b/common/src/main/java/org/onap/so/logger/MsoLogger.java
index 9f918805c0..10f572e772 100644
--- a/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java
+++ b/common/src/main/java/org/onap/so/logger/MsoLogger.java
@@ -19,82 +19,91 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.logger;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
+package org.onap.so.logger;
+
+
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.lang.invoke.MethodHandles;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.UUID;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.slf4j.MDC;
-
-import org.openecomp.mso.entity.MsoRequest;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.att.eelf.i18n.EELFResolvableErrorEnum;
-
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
+import org.onap.so.entity.MsoRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+
+
/**
- * Simple wrapper around the EELF Logger class for MSO usage. This class
- * supports all of the normal logging functions (debug, info, etc.), prepending
+ * This class supports all of the normal logging functions (debug, info, etc.), prepending
* a string of format "[<requestId>|<serviceId]" to each message.
*
- * MSO code should initialize with these IDs when available, so that individual
+ * SO code should initialize with these IDs when available, so that individual
* requests and/or services can be tracked throughout the various MSO component
* logs (API Handler, BPEL, and Adapters).
*
*
*/
+
public class MsoLogger {
// MDC parameters
- public static final String REQUEST_ID = "RequestId";
- public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId";
- public static final String SERVICE_NAME = "ServiceName";
- private static final String SERVICE_NAME_IS_METHOD_NAME = "ServiceNameIsMethodName";
- private static final String INSTANCE_UUID = "InstanceUUID";
- private static final String SERVER_IP = "ServerIPAddress";
- private static final String FQDN = "ServerFQDN";
- public static final String REMOTE_HOST = "RemoteHost";
- public static final String ALERT_SEVERITY = "AlertSeverity";
- public static final String TIMER = "Timer";
- private static final String USER = "User";
- private static final String DUMMY_VALUE = "trace-#";
- public static final String UNKNOWN = "UNKNOWN";
+ public static final String REQUEST_ID = "RequestId";
+ public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId";
+ public static final String SERVICE_NAME = "ServiceName";
+ public static final String SERVICE_NAME_IS_METHOD_NAME = "ServiceNameIsMethodName";
+ public static final String INSTANCE_UUID = "InstanceUUID";
+ public static final String SERVER_IP = "ServerIPAddress";
+
+ public static final String FQDN = "ServerFQDN";
+ public static final String REMOTE_HOST = "RemoteHost";
+ public static final String ALERT_SEVERITY = "AlertSeverity";
+ public static final String TIMER = "Timer";
+ public static final String USER = "User";
+ public static final String DUMMY_VALUE = "trace-#";
+ public static final String UNKNOWN = "UNKNOWN";
+ public static final String CAT_LOG_LEVEL = "CategoryLogLevel";
+ public static final String AUDI_CAT_LOG_LEVEL = "AuditCategoryLogLevel";
+
//For getting an identity of calling application
- public static final String HEADER_FROM_APP_ID = "X-FromAppId";
- public static final String FROM_APP_ID = "FromAppId";
+ public static final String HEADER_FROM_APP_ID = "X-FromAppId";
+ public static final String FROM_APP_ID = "FromAppId";
+ public static final String HEADER_REQUEST_ID = "X-RequestId";
+ public static final String TRANSACTION_ID = "X-TransactionID";
+ public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID";
+ public static final String CLIENT_ID = "X-ClientID";
+
// Audit/Metric log specific
- private static final String BEGINTIME = "BeginTimestamp";
- private static final String ENDTIME = "EndTimestamp";
- public static final String PARTNERNAME = "PartnerName";
- private static final String STATUSCODE = "StatusCode";
- private static final String RESPONSECODE = "ResponseCode";
- private static final String RESPONSEDESC = "ResponseDesc";
+ public static final String BEGINTIME = "BeginTimestamp";
+ public static final String STARTTIME = "StartTimeMilis";
+ public static final String ENDTIME = "EndTimestamp";
+ public static final String PARTNERNAME = "PartnerName";
+ public static final String STATUSCODE = "StatusCode";
+ public static final String RESPONSECODE = "ResponseCode";
+ public static final String RESPONSEDESC = "ResponseDesc";
+
+
// Metric log specific
- private static final String TARGETENTITY = "TargetEntity";
- private static final String TARGETSERVICENAME = "TargetServiceName";
- private static final String TARGETVIRTUALENTITY = "TargetVirtualEntity";
-
- private static final String FATAL_LEVEL = "FATAL";
- private static final String ERROR_LEVEL = "ERROR";
- private static final String WARN_LEVEL = "WARN";
- private static final String INFO_LEVEL = "INFO";
- private static final String DEBUG_LEVEL = "DEBUG";
-
- private static final String ERRORCODE = "ErrorCode";
- private static final String ERRORDESC = "ErrorDesc";
+ public static final String METRIC_BEGIN_TIME = "MetricBeginTime";
+ public static final String METRIC_START_TIME = "MetricStartTime";
+ public static final String METRIC_END_TIME = "MetricEndTime";
+ public static final String METRIC_TIMER = "MetricEndTime";
+ public static final String TARGETENTITY = "TargetEntity";
+ public static final String TARGETSERVICENAME = "TargetServiceName";
+ public static final String TARGETVIRTUALENTITY = "TargetVirtualEntity";
+
+ public static final String FATAL_LEVEL = "FATAL";
+ public static final String ERROR_LEVEL = "ERROR";
+ public static final String WARN_LEVEL = "WARN";
+ public static final String INFO_LEVEL = "INFO";
+ public static final String DEBUG_LEVEL = "DEBUG";
+
+ public static final String ERRORCODE = "ErrorCode";
+ public static final String ERRORDESC = "ErrorDesc";
+
+ public static final String COMPLETE = "COMPLETE";
public enum Catalog {
APIH, BPEL, RA, ASDC, GENERAL
@@ -103,6 +112,20 @@ public class MsoLogger {
public enum StatusCode {
COMPLETE, ERROR
}
+
+ public enum TargetEntity {
+ CAMUNDA("Camunda");
+
+ private String name;
+
+ TargetEntity(String name) {
+ this.name = name;
+ }
+
+ public String getUrl() {
+ return name;
+ }
+ }
public enum ResponseCode {
Suc(0), PermissionError(100), DataError(300), DataNotFound(301), BadRequest(302), SchemaError(
@@ -115,7 +138,7 @@ public class MsoLogger {
return this.value;
}
- ResponseCode(int value) {
+ private ResponseCode(int value) {
this.value = value;
}
}
@@ -130,30 +153,37 @@ public class MsoLogger {
return this.value;
}
- ErrorCode(int value) {
+ private ErrorCode(int value) {
this.value = value;
}
}
- private EELFLogger logger, auditLogger, metricsLogger;
- private static final String CONFIG_FILE = System.getProperty("jboss.home.dir") + "/mso-config/uuid/uuid_"
- + System.getProperty("jboss.server.name");
+ private Logger logger;
+ private Logger metricsLogger;
+ private Logger auditLogger;
private static String instanceUUID, serverIP, serverName;
private MessageEnum exceptionArg, defaultException, defaultWarning, defaultAudit, defaultMetrics;
// For internal logging of the initialization of MSO logs
- private static final Logger LOGGER = Logger.getLogger(MsoLogger.class.getName());
-
+ private static final Logger initLOGGER = LoggerFactory.getLogger(MsoLogger.class.getName());
- // Since four adaptors are using the instance of MsoLogger which will be referenced everywhere
- // hence limiting the number of MsoLogger instances to five.
- private static final MsoLogger generalMsoLogger = new MsoLogger(Catalog.GENERAL);
- private static final MsoLogger apihLogger = new MsoLogger(Catalog.APIH);
- private static final MsoLogger asdcLogger = new MsoLogger(Catalog.ASDC);
- private static final MsoLogger raLogger = new MsoLogger(Catalog.RA);
- private static final MsoLogger bpelLogger = new MsoLogger(Catalog.BPEL);
+ private MsoLogger() {
+ this(MsoLogger.Catalog.GENERAL);
+ }
+
+ private MsoLogger(MsoLogger.Catalog cat) {
+ this(cat, MethodHandles.lookup().lookupClass());
+ }
+
+ private MsoLogger(MsoLogger.Catalog cat, Class<?> clazz) {
+ this.logger = LoggerFactory.getLogger(clazz);
+ this.auditLogger = LoggerFactory.getLogger("AUDIT");
+ this.metricsLogger = LoggerFactory.getLogger("METRIC");
+ MsoLogger.initialization();
+ setDefaultLogCatalog(cat);
+ }
- static {
+ private static synchronized void initialization() {
if (instanceUUID == null || ("").equals(instanceUUID)) {
instanceUUID = getInstanceUUID();
}
@@ -164,48 +194,20 @@ public class MsoLogger {
serverIP = server.getHostAddress();
serverName = server.getHostName();
} catch (UnknownHostException e) {
- LOGGER.log(Level.SEVERE, "Could not get local hostname", e);
+ initLOGGER.error("Could not get local hostname", e);
serverIP = "";
serverName = "";
}
}
}
- // Singleton instances of the EELFLogger of all types are referenced by MsoLogger
- private MsoLogger(Catalog cat) {
- this.logger = EELFManager.getInstance().getErrorLogger();
- this.auditLogger = EELFManager.getInstance().getAuditLogger();
- this.metricsLogger = EELFManager.getInstance().getMetricsLogger();
- this.setDefaultLogCatalog(cat);
- }
-
-
- /**
- * Get the MsoLogger based on the catalog
- * This method is fixed now to resolve the total number of objects that are getting created
- * everytime this function gets called. Its supposed to have fixed number of instance per java process.
- *
- * @param cat
- * Catalog of the logger
- * @return the MsoLogger
- */
- public static synchronized MsoLogger getMsoLogger(MsoLogger.Catalog cat) {
- switch (cat) {
- case GENERAL:
- return generalMsoLogger;
- case APIH:
- return apihLogger;
- case RA:
- return raLogger;
- case BPEL:
- return bpelLogger;
- case ASDC:
- return asdcLogger;
- default:
- return generalMsoLogger;
- }
+
+ public static MsoLogger getMsoLogger(MsoLogger.Catalog cat, Class<?> clazz) {
+ return new MsoLogger(cat,clazz);
}
+
+
/**
* Record the Metrics event with no argument
@@ -225,6 +227,13 @@ public class MsoLogger {
* @param targetVEntity
* Target VNF or VM acted opon by the component, if available
*/
+ public void recordMetricEvent() {
+ metricsLogger.info("");
+ MDC.remove(TIMER);
+ MDC.remove(TARGETENTITY);
+ MDC.remove(TARGETSERVICENAME);
+ }
+
public void recordMetricEvent(Long startTime, StatusCode statusCode, ResponseCode responseCode, String responseDesc,
String targetEntity, String targetServiceName, String targetVEntity) {
prepareMetricMsg(startTime, statusCode, responseCode.getValue(), responseDesc, targetEntity, targetServiceName,
@@ -235,6 +244,7 @@ public class MsoLogger {
MDC.remove(TARGETSERVICENAME);
}
+
/**
* Record the Audit event
*
@@ -247,8 +257,13 @@ public class MsoLogger {
* @param responseDesc
* Human redable description of the application response code
*/
+ public void recordAuditEvent(){
+ auditLogger.info("");
+ }
+
public void recordAuditEvent(Long startTime, StatusCode statusCode, ResponseCode responseCode,
String responseDesc) {
+ MDC.put(MsoLogger.PARTNERNAME, "UNKNOWN");
prepareAuditMsg(startTime, statusCode, responseCode.getValue(), responseDesc);
auditLogger.info("");
MDC.remove(TIMER);
@@ -278,7 +293,23 @@ public class MsoLogger {
prepareMsg(DEBUG_LEVEL);
logger.debug(msg, t);
}
-
+
+ public void info(String msg) {
+ prepareMsg(DEBUG_LEVEL);
+ logger.info(msg);
+ }
+
+
+ /**
+ * Log error message with the details of the exception that caused the error.
+ * @param msg
+ * @param throwable
+ */
+ public void error(String msg) {
+ prepareMsg(ERROR_LEVEL);
+ logger.error(msg);
+ }
+
/**
* Log error message with the details of the exception that caused the error.
* @param msg
@@ -296,7 +327,7 @@ public class MsoLogger {
* @param msg
* The log message to put
*/
- public void info(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName) {
+ public void info(String msg, String targetEntity, String targetServiceName) {
prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
logger.info(msg);
@@ -312,10 +343,10 @@ public class MsoLogger {
* @param arg0
* The argument used in the log message
*/
- public void info(EELFResolvableErrorEnum msg, String arg0, String targetEntity, String targetServiceName) {
+ public void info(MessageEnum msg, String arg0, String targetEntity, String targetServiceName) {
prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
- logger.info(msg, normalize(arg0));
+ logger.info(msg.toString(), normalize(arg0));
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -328,7 +359,7 @@ public class MsoLogger {
* @param arg0,arg1
* The arguments used in the log message
*/
- public void info(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity,
+ public void info(String msg, String arg0, String arg1, String targetEntity,
String targetServiceName) {
prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
@@ -345,11 +376,11 @@ public class MsoLogger {
* @param arg0,arg1,arg2
* The arguments used in the log message
*/
- public void info(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity,
+ public void info(MessageEnum msg, String arg0, String arg1, String arg2, String targetEntity,
String targetServiceName) {
prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
- logger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2));
+ logger.info(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2));
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -362,7 +393,7 @@ public class MsoLogger {
* @param arg0,arg1,arg2,arg3
* The arguments used in the log message
*/
- public void info(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3,
+ public void info(String msg, String arg0, String arg1, String arg2, String arg3,
String targetEntity, String targetServiceName) {
prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
@@ -379,7 +410,7 @@ public class MsoLogger {
* @param arg0,arg1,arg2,arg3,arg4
* The arguments used in the log message
*/
- public void info(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
+ public void info(String msg, String arg0, String arg1, String arg2, String arg3, String arg4,
String targetEntity, String targetServiceName) {
prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
@@ -396,7 +427,7 @@ public class MsoLogger {
* @param arg0,arg1,arg2,arg3,arg4,arg5
* The arguments used in the log message
*/
- public void info(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
+ public void info(String msg, String arg0, String arg1, String arg2, String arg3, String arg4,
String arg5, String targetEntity, String targetServiceName) {
prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
@@ -407,17 +438,28 @@ public class MsoLogger {
}
// Warning methods
+
+
/**
* Record the Warning event
*
* @param msg
* The log message to put
*/
- public void warn(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
+ public void warnSimple( String targetServiceName, String errorDesc) {
+ logger.warn("Service Name: {} Error: {}" , targetServiceName, errorDesc);
+ }
+ /**
+ * Record the Warning event
+ *
+ * @param msg
+ * The log message to put
+ */
+ public void warn(MessageEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
String errorDesc) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg);
+ logger.warn(msg.toString());
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -430,12 +472,10 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void warn(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
+ public void warn(MessageEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
String errorDesc, Throwable t) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg);
- logger.warn("Exception raised: " + getNormalizedStackTrace(t));
- logger.debug("Exception raised", t);
+ logger.warn("Warning: "+msg, t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -448,10 +488,10 @@ public class MsoLogger {
* @param arg
* The argument used in the log message
*/
- public void warn(EELFResolvableErrorEnum msg, String arg, String targetEntity, String targetServiceName,
+ public void warn(MessageEnum msg, String arg, String targetEntity, String targetServiceName,
ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg, arg);
+ logger.warn(msg.toString(), arg);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -466,11 +506,10 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void warn(EELFResolvableErrorEnum msg, String arg, String targetEntity, String targetServiceName,
+ public void warn(MessageEnum msg, String arg, String targetEntity, String targetServiceName,
ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg, arg);
- logger.warn("Exception raised: " + getNormalizedStackTrace(t));
+ logger.warn(msg.toString(), arg);
logger.debug("Exception raised", t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
@@ -484,10 +523,10 @@ public class MsoLogger {
* @param arg0,arg1
* The arguments used in the log message
*/
- public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity,
+ public void warn(MessageEnum msg, String arg0, String arg1, String targetEntity,
String targetServiceName, ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg, normalize(arg0), normalize(arg1));
+ logger.warn(msg.toString(), normalize(arg0), normalize(arg1));
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -502,12 +541,11 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity,
+ public void warn(String msg, String arg0, String arg1, String targetEntity,
String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
logger.warn(msg, normalize(arg0), normalize(arg1));
- logger.warn("Exception raised: " + getNormalizedStackTrace(t));
- logger.debug("Exception raised", t);
+ logger.warn(msg, t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -520,7 +558,7 @@ public class MsoLogger {
* @param arg0,arg1,arg2
* The arguments used in the log message
*/
- public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity,
+ public void warn(String msg, String arg0, String arg1, String arg2, String targetEntity,
String targetServiceName, ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2));
@@ -538,12 +576,11 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity,
+ public void warn(String msg, String arg0, String arg1, String arg2, String targetEntity,
String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2));
- logger.warn("Exception raised: " + getNormalizedStackTrace(t));
- logger.debug("Exception raised", t);
+ logger.warn(msg, t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -556,7 +593,7 @@ public class MsoLogger {
* @param arg0,arg1,arg2,arg3
* The arguments used in the log message
*/
- public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3,
+ public void warn(String msg, String arg0, String arg1, String arg2, String arg3,
String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
@@ -574,12 +611,11 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3,
+ public void warn(String msg, String arg0, String arg1, String arg2, String arg3,
String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
- logger.warn("Exception raised: " + getNormalizedStackTrace(t));
- logger.debug("Exception raised", t);
+ logger.warn(msg, t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -592,7 +628,7 @@ public class MsoLogger {
* @param arg0,arg1,arg2,arg3,arg4
* The arguments used in the log message
*/
- public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
+ public void warn(String msg, String arg0, String arg1, String arg2, String arg3, String arg4,
String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
@@ -610,30 +646,58 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
+ public void warn(String msg, String arg0, String arg1, String arg2, String arg3, String arg4,
String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
- logger.warn("Exception raised: " + getNormalizedStackTrace(t));
- logger.debug("Exception raised", t);
+ logger.warn(msg, t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
+
+
// Error methods
/**
* Record the Error event
*
- * @param msg
+ * @param generalException
* The log message to put
*/
- public void error(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
+ public void error(MessageEnum generalException, String targetEntity, String targetServiceName, ErrorCode errorCode,
String errorDesc) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg);
+ logger.error(generalException.toString() + ": " +errorDesc);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
+
+
+ /**
+ * Record the Error event
+ *
+ * @param msg
+ * The log message to put
+ * @param t
+ * The exception info
+ */
+ public void trace(String traceMessage) {
+ logger.trace(traceMessage);
+ }
+
+
+ /**
+ * Record the Error event
+ *
+ * @param msg
+ * The log message to put
+ * @param t
+ * The exception info
+ */
+ public void error( Throwable t) {
+ logger.error(t.getMessage(), t);
+ }
+
/**
* Record the Error event
@@ -643,16 +707,14 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void error(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
+ public void error(MessageEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
String errorDesc, Throwable t) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg);
- logger.error(exceptionArg, getNormalizedStackTrace(t));
- logger.debug("Exception raised", t);
+ logger.error(msg.toString(), t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
-
+
/**
* Record the Error event with 1 argument
*
@@ -661,10 +723,10 @@ public class MsoLogger {
* @param arg0
* The arguments used in the log message
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String targetEntity, String targetServiceName,
+ public void error(MessageEnum msg, String arg0, String targetEntity, String targetServiceName,
ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0));
+ logger.error(msg.toString(), normalize(arg0));
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -679,12 +741,10 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String targetEntity, String targetServiceName,
+ public void error(MessageEnum msg, String arg0, String targetEntity, String targetServiceName,
ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0));
- logger.error(exceptionArg, getNormalizedStackTrace(t));
- logger.debug("Exception raised", t);
+ logger.error(msg.toString(), normalize(arg0), t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -697,10 +757,10 @@ public class MsoLogger {
* @param arg0,arg1
* The arguments used in the log message
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity,
+ public void error(MessageEnum msg, String arg0, String arg1, String targetEntity,
String targetServiceName, ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0), normalize(arg1));
+ logger.error(msg.toString(), normalize(arg0), normalize(arg1));
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -715,11 +775,10 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity,
+ public void error(MessageEnum msg, String arg0, String arg1, String targetEntity,
String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0), normalize(arg1));
- logger.error(exceptionArg, getNormalizedStackTrace(t));
+ logger.error(msg.toString(), normalize(arg0), normalize(arg1), t);
logger.debug("Exception raised", t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
@@ -733,10 +792,10 @@ public class MsoLogger {
* @param arg0,arg1,arg2
* The arguments used in the log message
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity,
+ public void error(MessageEnum msg, String arg0, String arg1, String arg2, String targetEntity,
String targetServiceName, ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2));
+ logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2));
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -751,12 +810,10 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity,
+ public void error(MessageEnum msg, String arg0, String arg1, String arg2, String targetEntity,
String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2));
- logger.error(exceptionArg, getNormalizedStackTrace(t));
- logger.debug("Exception raised", t);
+ logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -769,10 +826,10 @@ public class MsoLogger {
* @param arg0,arg1,arg2,arg3
* The arguments used in the log message
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3,
+ public void error(MessageEnum msg, String arg0, String arg1, String arg2, String arg3,
String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
+ logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -787,11 +844,11 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3,
+ public void error(MessageEnum msg, String arg0, String arg1, String arg2, String arg3,
String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
- logger.error(exceptionArg, getNormalizedStackTrace(t));
+ logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), t);
+
logger.debug("Exception raised", t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
@@ -805,10 +862,10 @@ public class MsoLogger {
* @param arg0,arg1,arg2,arg3,arg4
* The arguments used in the log message
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
+ public void error(MessageEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
+ logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -823,15 +880,29 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
+ public void error(MessageEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
- logger.error(exceptionArg, getNormalizedStackTrace(t));
+ logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4), t);
logger.debug("Exception raised", t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
+
+ public void error(String errorMessage, String errorSource, String targetEntity, String targetServiceName,
+ ErrorCode errorCode, String errorText) {
+ prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorText);
+ logger.error(errorMessage);
+ MDC.remove(TARGETENTITY);
+ MDC.remove(TARGETSERVICENAME);
+
+ }
+
+ public void logStackTrace(Exception ex){
+ StringWriter errors = new StringWriter();
+ ex.printStackTrace(new PrintWriter(errors));
+ logger.error(errors.toString());
+ }
public boolean isDebugEnabled() {
return logger.isDebugEnabled();
@@ -851,23 +922,24 @@ public class MsoLogger {
MDC.put(REQUEST_ID, DUMMY_VALUE);
}
- if (svcId == null || svcId.isEmpty()) {
- MDC.put(SERVICE_INSTANCE_ID, DUMMY_VALUE);
- }
-
if (timer != null) {
MDC.put(TIMER, timer);
- } else {
- MDC.remove(TIMER);
- }
-
- MDC.put(SERVICE_NAME, getFinalServiceName(serviceNamep));
- MDC.put(ALERT_SEVERITY, getSeverityLevel(loggingLevel));
- MDC.put(INSTANCE_UUID, instanceUUID);
- MDC.put(SERVER_IP, serverIP);
- MDC.put(FQDN, serverName);
+ }
+
+ writeIfNotNullorEmpty(SERVICE_NAME,getFinalServiceName(serviceNamep));
+ writeIfNotNullorEmpty(ALERT_SEVERITY,getSeverityLevel(loggingLevel));
+ writeIfNotNullorEmpty(INSTANCE_UUID,instanceUUID);
+ writeIfNotNullorEmpty(SERVER_IP,serverIP);
+ writeIfNotNullorEmpty(FQDN,serverName);
+
}
+ private void writeIfNotNullorEmpty(String Key, String value) {
+ if (MDC.get(Key) == null|| MDC.get(Key).isEmpty()) {
+ MDC.put(Key, value);
+ }
+ }
+
private void prepareAuditMsg(long startTime, StatusCode statusCode, int responseCode, String responseDesc) {
long endTime = System.currentTimeMillis();
prepareMsg(INFO_LEVEL, null, String.valueOf(endTime - startTime));
@@ -890,7 +962,9 @@ public class MsoLogger {
private void prepareErrorMsg(String loggingLevel, String targetEntity, String targetServiceName,
ErrorCode errorCode, String errorDesc) {
MDC.put(ALERT_SEVERITY, getSeverityLevel(loggingLevel));
- MDC.put(ERRORCODE, String.valueOf(errorCode));
+ if(errorCode != null) {
+ MDC.put(ERRORCODE, Integer.toString(errorCode.getValue()));
+ }
MDC.put(ERRORDESC, errorDesc);
MDC.put(TARGETENTITY, targetEntity);
MDC.put(TARGETSERVICENAME, targetServiceName);
@@ -968,8 +1042,7 @@ public class MsoLogger {
limit = classArr.length;
}
for (int i = 1; i < limit; i++) {
- String className = classArr[i].getClassName();
- if (!className.equals(this.getClass().getName())) {
+ if (!classArr[i].getClassName().equals(this.getClass().getName())) {
return classArr[i].getMethodName();
}
}
@@ -981,55 +1054,8 @@ public class MsoLogger {
// it is generated during mso instance initialization period
// The same mso instnace will use the same instanceUUID value, even after
// restart
- private static String getInstanceUUID() {
- // Avoid creation during build and tests
- if (System.getProperty("jboss.server.name") == null) {
- return "Test UUID as JBoss not found";
- }
- File configFile = new File(CONFIG_FILE);
- String uuid = "";
- BufferedReader in = null;
- try{
- // Verify whether instanceUUID file exist,
- // If yes, read the content; if not, generate the instanceUUID and
- // write to the file
- if (configFile.exists()) {
- // read the content of the file
- in = new BufferedReader(new FileReader(CONFIG_FILE));
- if ((uuid = in.readLine()) == null) {
- // the file is empty, regenerate the file
- uuid = UUID.randomUUID().toString();
- try(BufferedWriter bw = new BufferedWriter(new FileWriter(configFile.getAbsoluteFile()))) {
- bw.write(uuid);
- } catch (IOException e) {
- LOGGER.log(Level.SEVERE, "Error trying to write UUID file", e);
- }
- }
- in.close();
- } else {
- // file doesn't exist yet -> create the file and generate the
- // instanceUUID
- uuid = UUID.randomUUID().toString();
- configFile.getParentFile().mkdirs();
- configFile.createNewFile();
- try(BufferedWriter bw1 = new BufferedWriter(new FileWriter(configFile.getAbsoluteFile()))){
- bw1.write(uuid);
- } catch (IOException e) {
- LOGGER.log(Level.SEVERE, "Error trying to write UUID file", e);
- }
- }
- } catch (IOException e) {
- LOGGER.log(Level.SEVERE, "Error trying to read UUID file", e);
- } finally {
- try {
- if (in != null) {
- in.close();
- }
- } catch (IOException ex) {
- LOGGER.log(Level.SEVERE, "Error trying to close UUID file", ex);
- }
- }
- return uuid;
+ private static String getInstanceUUID() {
+ return System.getProperty("mso-instance-id");
}
/**
@@ -1121,13 +1147,6 @@ public class MsoLogger {
return result;
}
- private String getNormalizedStackTrace(Throwable t) {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- t.printStackTrace(pw);
- return sw.toString().replace('|', '!').replace("\n", " - ");
- }
-
private void setDefaultLogCatalog(MsoLogger.Catalog cat) {
if ("APIH".equals(cat.toString())) {
exceptionArg = MessageEnum.APIH_GENERAL_EXCEPTION_ARG;
@@ -1161,4 +1180,14 @@ public class MsoLogger {
defaultMetrics = MessageEnum.GENERAL_METRICS;
}
}
+
+ public void warnSimple(String message, Exception e) {
+ logger.warn(message,e);
+
+ }
+
+
+
+
+
}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsClientLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsClientLogging.java
new file mode 100644
index 0000000000..2888cbf3a1
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsClientLogging.java
@@ -0,0 +1,135 @@
+/*-
+ * ============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.logging.jaxrs.filter.jersey;
+
+
+import org.apache.commons.io.IOUtils;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.utils.TargetEntity;
+import org.slf4j.MDC;
+import org.springframework.stereotype.Component;
+
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientRequestFilter;
+import javax.ws.rs.client.ClientResponseContext;
+import javax.ws.rs.client.ClientResponseFilter;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+
+import java.io.*;
+
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.Locale;
+import java.util.UUID;
+
+@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
+@Component
+public class JaxRsClientLogging implements ClientRequestFilter,ClientResponseFilter {
+
+ private static MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,JaxRsClientLogging.class);
+
+ private TargetEntity targetEntity;
+
+ public void setTargetService(TargetEntity targetEntity){
+ this.targetEntity = targetEntity;
+ }
+
+ @Override
+ public void filter(ClientRequestContext clientRequest) {
+ try{
+ MultivaluedMap<String, Object> headers = clientRequest.getHeaders();
+
+
+ Instant instant = Instant.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" )
+ .withLocale( Locale.US )
+ .withZone( ZoneId.systemDefault() );
+
+ String requestId = MDC.get(MsoLogger.REQUEST_ID);
+ if(requestId == null || requestId.isEmpty()){
+ requestId = UUID.randomUUID().toString();
+ logger.warnSimple(clientRequest.getUri().getPath(),"Could not Find Request ID Generating New One");
+ }
+
+ MDC.put(MsoLogger.METRIC_BEGIN_TIME, formatter.format(instant));
+ MDC.put(MsoLogger.METRIC_START_TIME, String.valueOf(System.currentTimeMillis()));
+ MDC.put(MsoLogger.REQUEST_ID,requestId);
+ MDC.put(MsoLogger.TARGETSERVICENAME, clientRequest.getUri().toString());
+ } catch (Exception e) {
+ logger.warnSimple("Error in incoming JAX-RS Inteceptor", e);
+ }
+ }
+
+
+ @Override
+ public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) {
+
+ try {
+ Instant instant = Instant.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" )
+ .withLocale( Locale.US )
+ .withZone( ZoneId.systemDefault() );
+ String startTime= MDC.get(MsoLogger.METRIC_START_TIME);
+
+ long elapsedTime = System.currentTimeMillis()-Long.parseLong(startTime);
+ String statusCode;
+ if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){
+ statusCode=MsoLogger.COMPLETE;
+ }else{
+ statusCode=MsoLogger.StatusCode.ERROR.toString();
+ }
+ MultivaluedMap<String, String> headers = responseContext.getHeaders();
+
+ String partnerName = headers.getFirst(MsoLogger.HEADER_FROM_APP_ID );
+ if(partnerName == null || partnerName.isEmpty())
+ partnerName="UNKNOWN";
+ MDC.put(MsoLogger.RESPONSEDESC,getStringFromInputStream(responseContext));
+ MDC.put(MsoLogger.STATUSCODE, statusCode);
+ MDC.put(MsoLogger.RESPONSECODE,String.valueOf(responseContext.getStatus()));
+ MDC.put(MsoLogger.METRIC_TIMER, String.valueOf(elapsedTime));
+ MDC.put(MsoLogger.METRIC_END_TIME,formatter.format(instant));
+ MDC.put(MsoLogger.PARTNERNAME,partnerName);
+ MDC.put(MsoLogger.TARGETENTITY, targetEntity.toString());
+ logger.recordMetricEvent();
+ } catch ( Exception e) {
+ logger.warnSimple("Error in outgoing JAX-RS Inteceptor", e);
+ }
+ }
+
+ private static String getStringFromInputStream(ClientResponseContext clientResponseContext) {
+
+ InputStream is = clientResponseContext.getEntityStream();
+ ByteArrayOutputStream boas = new ByteArrayOutputStream();
+
+ try {
+ IOUtils.copy(is,boas);
+ InputStream copiedStream = new ByteArrayInputStream(boas.toByteArray());
+ clientResponseContext.setEntityStream(copiedStream);
+ return boas.toString();
+
+ } catch (IOException e) {
+ logger.warnSimple("Failed to read response body", e);
+ }
+ return "Unable to read input stream";
+ }
+}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java
new file mode 100644
index 0000000000..9fab4ff0df
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java
@@ -0,0 +1,180 @@
+/*-
+ * ============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.logging.jaxrs.filter.jersey;
+
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.Locale;
+import java.util.UUID;
+
+import javax.annotation.Priority;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.ContainerResponseContext;
+import javax.ws.rs.container.ContainerResponseFilter;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+import javax.ws.rs.ext.Providers;
+
+import org.onap.so.logger.MsoLogger;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Priority(1)
+@Provider
+@Component
+public class JaxRsFilterLogging implements ContainerRequestFilter,ContainerResponseFilter {
+
+ private static MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,JaxRsFilterLogging.class);
+
+ @Context
+ private HttpServletRequest httpServletRequest;
+
+ @Context
+ private Providers providers;
+
+ @Autowired
+ ObjectMapper objectMapper;
+
+ @Override
+ public void filter(ContainerRequestContext containerRequest) {
+
+ try {
+ String clientID = null;
+ //check headers for request id
+ MultivaluedMap<String, String> headers = containerRequest.getHeaders();
+ String requestId = (String) headers.getFirst(MsoLogger.HEADER_REQUEST_ID );
+ if(requestId == null || requestId.isEmpty()){
+ if(headers.containsKey(MsoLogger.TRANSACTION_ID)){
+ requestId = headers.getFirst(MsoLogger.TRANSACTION_ID);
+ }else if(headers.containsKey(MsoLogger.ECOMP_REQUEST_ID)){
+ requestId = headers.getFirst(MsoLogger.ECOMP_REQUEST_ID);
+ }else{
+ requestId = UUID.randomUUID().toString();
+ logger.warnSimple(containerRequest.getUriInfo().getPath(),"Generating RequestId for Request");
+ }
+ }
+ containerRequest.setProperty("requestId", requestId);
+ if(headers.containsKey(MsoLogger.CLIENT_ID)){
+ clientID = headers.getFirst(MsoLogger.CLIENT_ID);
+ }else{
+ clientID = "UNKNOWN";
+ headers.add(MsoLogger.CLIENT_ID, clientID);
+ }
+ String remoteIpAddress = "";
+ if (httpServletRequest != null) {
+ remoteIpAddress = httpServletRequest.getRemoteAddr();
+ }
+ Instant instant = Instant.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" )
+ .withLocale( Locale.US )
+ .withZone( ZoneId.systemDefault() );
+
+ String partnerName = headers.getFirst(MsoLogger.HEADER_FROM_APP_ID );
+ if(partnerName == null || partnerName.isEmpty())
+ partnerName="UNKNOWN";
+
+ MDC.put(MsoLogger.FROM_APP_ID,partnerName);
+ MDC.put(MsoLogger.SERVICE_NAME, containerRequest.getUriInfo().getPath());
+ MDC.put(MsoLogger.BEGINTIME, formatter.format(instant));
+ MDC.put(MsoLogger.REQUEST_ID,requestId);
+ MDC.put(MsoLogger.PARTNERNAME,partnerName);
+ MDC.put(MsoLogger.REMOTE_HOST, String.valueOf(remoteIpAddress));
+ MDC.put(MsoLogger.STARTTIME, String.valueOf(System.currentTimeMillis()));
+ MDC.put(MsoLogger.CLIENT_ID, clientID);
+ } catch (Exception e) {
+ logger.warnSimple("Error in incoming JAX-RS Inteceptor", e);
+ }
+ }
+
+
+ @Override
+ public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
+ throws IOException {
+ try {
+ Instant instant = Instant.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" )
+ .withLocale( Locale.US )
+ .withZone( ZoneId.systemDefault() );
+ String startTime= MDC.get(MsoLogger.STARTTIME);
+ long elapsedTime;
+ try {
+ elapsedTime = System.currentTimeMillis() - Long.parseLong(startTime);
+ }catch(NumberFormatException e){
+ elapsedTime = 0;
+ }
+ String statusCode;
+ if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){
+ statusCode=MsoLogger.COMPLETE;
+ }else{
+ statusCode= MsoLogger.StatusCode.ERROR.toString();
+ }
+
+ MDC.put(MsoLogger.RESPONSEDESC,payloadMessage(responseContext));
+ MDC.put(MsoLogger.STATUSCODE, statusCode);
+ MDC.put(MsoLogger.RESPONSECODE,String.valueOf(responseContext.getStatus()));
+ MDC.put(MsoLogger.TIMER, String.valueOf(elapsedTime));
+ MDC.put(MsoLogger.ENDTIME,formatter.format(instant));
+ logger.recordAuditEvent();
+ } catch ( Exception e) {
+ logger.warnSimple("Error in outgoing JAX-RS Inteceptor", e);
+ }
+ }
+
+ private String payloadMessage(ContainerResponseContext responseContext) throws IOException {
+ String message = new String();
+ if (responseContext.hasEntity()) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ Class<?> entityClass = responseContext.getEntityClass();
+ Type entityType = responseContext.getEntityType();
+ Annotation[] entityAnnotations = responseContext.getEntityAnnotations();
+ MediaType mediaType = responseContext.getMediaType();
+ @SuppressWarnings("unchecked")
+ MessageBodyWriter<Object> bodyWriter = (MessageBodyWriter<Object>) providers.getMessageBodyWriter(entityClass,
+ entityType,
+ entityAnnotations,
+ mediaType);
+ bodyWriter.writeTo(responseContext.getEntity(),
+ entityClass,
+ entityType,
+ entityAnnotations,
+ mediaType,
+ responseContext.getHeaders(),
+ baos);
+ message = message.concat(new String(baos.toByteArray()));
+ }
+ return message;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/SpringClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/SpringClientFilter.java
new file mode 100644
index 0000000000..0477c9a429
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/SpringClientFilter.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.so.logging.jaxrs.filter.jersey;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpRequest;
+import org.springframework.http.client.ClientHttpRequestExecution;
+import org.springframework.http.client.ClientHttpRequestInterceptor;
+import org.springframework.http.client.ClientHttpResponse;
+import org.springframework.util.StreamUtils;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+
+public class SpringClientFilter implements ClientHttpRequestInterceptor {
+
+ private final Logger log = LoggerFactory.getLogger(this.getClass());
+
+ @Override
+ public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
+ logRequest(request, body);
+ ClientHttpResponse response = execution.execute(request, body);
+ logResponse(response);
+ return response;
+ }
+
+ private void logRequest(HttpRequest request, byte[] body) throws IOException {
+ if (log.isDebugEnabled()) {
+ log.debug("===========================request begin================================================");
+ log.debug("URI : {}", request.getURI());
+ log.debug("Method : {}", request.getMethod());
+ log.debug("Headers : {}", request.getHeaders());
+ log.debug("Request body: {}", new String(body, "UTF-8"));
+ log.debug("==========================request end================================================");
+ }
+ }
+
+ private void logResponse(ClientHttpResponse response) throws IOException {
+ if (log.isDebugEnabled()) {
+ log.debug("============================response begin==========================================");
+ log.debug("Status code : {}", response.getStatusCode());
+ log.debug("Status text : {}", response.getStatusText());
+ log.debug("Headers : {}", response.getHeaders());
+ log.debug("Response body: {}", StreamUtils.copyToString(response.getBody(), Charset.defaultCharset()));
+ log.debug("=======================response end=================================================");
+ }
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/CustomSetterMustExistRule.java b/common/src/main/java/org/onap/so/openpojo/rules/CustomSetterMustExistRule.java
index fa24662d69..2c6590afb3 100644
--- a/common/src/main/java/org/openecomp/mso/openpojo/rules/CustomSetterMustExistRule.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/CustomSetterMustExistRule.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.openpojo.rules;
+package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.anything;
@@ -33,7 +33,7 @@ import com.openpojo.validation.rule.Rule;
public class CustomSetterMustExistRule implements Rule {
- private Matcher<PojoField>[] excludeMatchers = new Matcher[]{not(anything())};
+ private Matcher[] excludeMatchers = new Matcher[]{not(anything())};
private Matcher<PojoField>[] includeMatchers = new Matcher[]{anything()};
public CustomSetterMustExistRule() {
}
@@ -45,7 +45,7 @@ public class CustomSetterMustExistRule implements Rule {
}
}
}
- public CustomSetterMustExistRule exclude(Matcher<PojoField>... excludeMatchers) {
+ public CustomSetterMustExistRule exclude(Matcher... excludeMatchers) {
this.excludeMatchers = excludeMatchers;
return this;
}
diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/EqualsAndHashCodeTester.java b/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java
index 9540409e16..5433681b83 100644
--- a/common/src/main/java/org/openecomp/mso/openpojo/rules/EqualsAndHashCodeTester.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.openpojo.rules;
+package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.anything;
@@ -29,6 +29,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.hamcrest.Matcher;
@@ -118,6 +119,7 @@ public class EqualsAndHashCodeTester implements Tester {
fields.addAll(pojoClass.getPojoFieldsAnnotatedWith(BusinessKey.class));
fields.addAll(pojoClass.getPojoFieldsAnnotatedWith(Id.class));
+ fields.removeAll(pojoClass.getPojoFieldsAnnotatedWith(GeneratedValue.class));
return fields;
diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationMatcher.java b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java
index fdfb9695e7..6a06834d87 100644
--- a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationMatcher.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.openpojo.rules;
+package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anything;
@@ -29,18 +29,20 @@ import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeDiagnosingMatcher;
-public class HasAnnotationMatcher<T extends Annotation> extends TypeSafeDiagnosingMatcher<AnnotatedElement> {
- private final Class<T> annotationType;
+import com.openpojo.reflection.PojoField;
+
+public class HasAnnotationMatcher<T extends PojoField> extends TypeSafeDiagnosingMatcher<T> {
+ private final Class<? extends Annotation> annotationType;
private final Matcher<? super T> annotationMatcher;
- public HasAnnotationMatcher(final Class<T> annotationType, final Matcher<? super T> annotationMatcher) {
+ public HasAnnotationMatcher(final Class<? extends Annotation> annotationType, final Matcher<? super T> annotationMatcher) {
this.annotationType = annotationType;
this.annotationMatcher = annotationMatcher;
}
@Override
- protected boolean matchesSafely(final AnnotatedElement item, final Description mismatchDescription) {
- final T annotation = item.getAnnotation(this.annotationType);
+ protected boolean matchesSafely(final PojoField item, final Description mismatchDescription) {
+ final Annotation annotation = item.getAnnotation(this.annotationType);
if (annotation == null) {
mismatchDescription.appendText("does not have annotation ").appendText(this.annotationType.getName());
return false;
@@ -59,11 +61,11 @@ public class HasAnnotationMatcher<T extends Annotation> extends TypeSafeDiagnosi
// Intentionally left blank.
}
- public static Matcher<AnnotatedElement> hasAnnotation(final Class<? extends Annotation> annotationType) {
+ public static <T extends PojoField> Matcher<T> hasAnnotation(final Class<? extends Annotation> annotationType) {
return hasAnnotation(annotationType, anything(""));
}
- public static <T extends Annotation> Matcher<AnnotatedElement> hasAnnotation(final Class<T> annotationType, final Matcher<? super T> annotationMatcher) {
+ public static <T extends PojoField> Matcher<T> hasAnnotation(final Class<? extends Annotation> annotationType, final Matcher<? super T> annotationMatcher) {
return new HasAnnotationMatcher<T>(annotationType, annotationMatcher);
}
}
diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java
index d1b2fb1d11..551305c14a 100644
--- a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.openpojo.rules;
+package org.onap.so.openpojo.rules;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
@@ -28,12 +28,12 @@ import java.lang.reflect.Method;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeDiagnosingMatcher;
-import org.openecomp.mso.logger.MsoLogger;
+import org.onap.so.logger.MsoLogger;
import com.openpojo.reflection.PojoField;
public class HasAnnotationPropertyWithValueMatcher<T extends PojoField> extends TypeSafeDiagnosingMatcher<T> {
- private MsoLogger logger=MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
+ private MsoLogger logger=MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, HasAnnotationPropertyWithValueMatcher.class);
private final String attribute;
private final Matcher<?> annotationMatcher;
private final Class<? extends Annotation> annotationClass;
diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasEqualsAndHashCodeRule.java b/common/src/main/java/org/onap/so/openpojo/rules/HasEqualsAndHashCodeRule.java
index 4ef560721f..0c7d6add73 100644
--- a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasEqualsAndHashCodeRule.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/HasEqualsAndHashCodeRule.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.openpojo.rules;
+package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.anything;
diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasToStringRule.java b/common/src/main/java/org/onap/so/openpojo/rules/HasToStringRule.java
index f866650d66..8a4333e0e2 100644
--- a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasToStringRule.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/HasToStringRule.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.openpojo.rules;
+package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.anything;
diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/ToStringTester.java b/common/src/main/java/org/onap/so/openpojo/rules/ToStringTester.java
index bd582d45dc..ff1a139768 100644
--- a/common/src/main/java/org/openecomp/mso/openpojo/rules/ToStringTester.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/ToStringTester.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.openpojo.rules;
+package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.anything;
diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoDatabaseException.java b/common/src/main/java/org/onap/so/properties/MsoDatabaseException.java
index 9583e519f5..84216af6e8 100644
--- a/common/src/main/java/org/openecomp/mso/properties/MsoDatabaseException.java
+++ b/common/src/main/java/org/onap/so/properties/MsoDatabaseException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.properties;
+package org.onap.so.properties;
/**
diff --git a/common/src/main/java/org/onap/so/security/MSOSpringFirewall.java b/common/src/main/java/org/onap/so/security/MSOSpringFirewall.java
new file mode 100644
index 0000000000..82a30f05be
--- /dev/null
+++ b/common/src/main/java/org/onap/so/security/MSOSpringFirewall.java
@@ -0,0 +1,34 @@
+/*-
+ * ============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.security;
+
+import org.springframework.security.web.firewall.StrictHttpFirewall;
+
+public class MSOSpringFirewall extends StrictHttpFirewall {
+
+
+ public MSOSpringFirewall() {
+ super();
+ this.setAllowUrlEncodedSlash(true);
+ this.setAllowSemicolon(true);
+ this.setAllowUrlEncodedPercent(true);
+ }
+}
diff --git a/common/src/main/java/org/onap/so/security/UserCredentials.java b/common/src/main/java/org/onap/so/security/UserCredentials.java
new file mode 100644
index 0000000000..f411789e00
--- /dev/null
+++ b/common/src/main/java/org/onap/so/security/UserCredentials.java
@@ -0,0 +1,53 @@
+/*-
+ * ============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.security;
+
+public class UserCredentials {
+
+ private String username;
+ private String password;
+ private String role;
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getRole() {
+ return role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/security/UserDetailsServiceImpl.java b/common/src/main/java/org/onap/so/security/UserDetailsServiceImpl.java
new file mode 100644
index 0000000000..90d484ebf4
--- /dev/null
+++ b/common/src/main/java/org/onap/so/security/UserDetailsServiceImpl.java
@@ -0,0 +1,56 @@
+/*-
+ * ============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.security;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import java.util.List;
+
+@ConfigurationProperties(prefix = "spring.security")
+public class UserDetailsServiceImpl implements UserDetailsService {
+
+ private List<UserCredentials> usercredentials;
+
+ public List<UserCredentials> getUsercredentials() {
+ return usercredentials;
+ }
+
+ public void setUsercredentials(List<UserCredentials> usercredentials) {
+ this.usercredentials = usercredentials;
+ }
+
+ @Override
+ public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
+
+ for (int i = 0; usercredentials != null && i < usercredentials.size(); i++) {
+ if (usercredentials.get(i).getUsername().equals(username)) {
+ return User.withUsername(username).password(usercredentials.get(i).getPassword())
+ .roles(usercredentials.get(i).getRole()).build();
+ }
+ }
+
+ throw new UsernameNotFoundException("User not found, username: " + username);
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/security/WebSecurityConfig.java b/common/src/main/java/org/onap/so/security/WebSecurityConfig.java
new file mode 100644
index 0000000000..11eec46f41
--- /dev/null
+++ b/common/src/main/java/org/onap/so/security/WebSecurityConfig.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.so.security;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+
+
+@ConfigurationProperties(prefix = "spring.security")
+public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
+
+ private List<UserCredentials> credentials;
+ private List<String> roles = new ArrayList<>();
+
+ public List<String> getRoles() {
+ return roles;
+ }
+
+ @PostConstruct
+ private void addRoles() {
+ for(int i=0; i <credentials.size(); i++) {
+ roles.add(credentials.get(i).getRole());
+ }
+ }
+
+ public List<UserCredentials> getUsercredentials() {
+ return credentials;
+ }
+
+ public void setUsercredentials(List<UserCredentials> usercredentials) {
+ this.credentials = usercredentials;
+ }
+
+ @Bean
+ public UserDetailsService userDetailsService() {
+ return new UserDetailsServiceImpl();
+ }
+
+ @Bean
+ public BCryptPasswordEncoder passwordEncoder() {
+ return new BCryptPasswordEncoder();
+ }
+
+ @Override
+ protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+ auth.userDetailsService(userDetailsService()).passwordEncoder(passwordEncoder());
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/CloudConfiguration.java b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java
index cb5a1018ad..a58949e498 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/CloudConfiguration.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ExceptionType.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ExceptionType.java
index 84518cf160..e5d586f165 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ExceptionType.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ExceptionType.java
@@ -26,15 +26,17 @@
//
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.util.ArrayList;
import java.util.List;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
+
import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -153,15 +155,14 @@ public class ExceptionType {
}
return this.variables;
}
-
- public void setVariables(List<String> variables) {
- this.variables = variables;
- }
+
+ public void setVariables(List<String> variables) {
+ this.variables = variables;
+ }
@Override
public String toString() {
return new ToStringBuilder(this).append("messageId", messageId).append("text", text)
.append("variables", variables).toString();
}
-
}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationListResponse.java b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationListResponse.java
index adb1d38464..7be03e635f 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationListResponse.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationListResponse.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP - SO
+ * OPENECOMP - MSO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.util.List;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationResponse.java b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java
index 8d57d57513..788cdd973d 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationResponse.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceDirection.java b/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceDirection.java
index b49825ee60..ad796b21f9 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceDirection.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceDirection.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
public enum InstanceDirection {
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceReferences.java b/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceReferences.java
index 17f09556c3..69d21c41ac 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceReferences.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceReferences.java
@@ -1,15 +1,15 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP - SO
+ * OPENECOMP - MSO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import org.apache.commons.lang3.builder.ToStringBuilder;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/LineOfBusiness.java b/common/src/main/java/org/onap/so/serviceinstancebeans/LineOfBusiness.java
index ce46291da6..27bc0e84a4 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/LineOfBusiness.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/LineOfBusiness.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelInfo.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ModelInfo.java
index f91dd10f38..6976fb6791 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelInfo.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ModelInfo.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,7 +26,7 @@
//
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
@@ -46,6 +46,8 @@ public class ModelInfo implements Serializable {
protected String modelInvariantId;
@JsonProperty("modelType")
protected ModelType modelType;
+ @JsonProperty("modelId")
+ protected String modelId;
//v2
@JsonProperty("modelNameVersionId")
protected String modelNameVersionId;
@@ -60,6 +62,7 @@ public class ModelInfo implements Serializable {
protected String modelVersionId;
@JsonProperty("modelCustomizationId")
protected String modelCustomizationId;
+
//Decomposition fields
@JsonProperty("modelUuid")
protected String modelUuid;
@@ -72,6 +75,7 @@ public class ModelInfo implements Serializable {
return modelCustomizationName;
}
public void setModelCustomizationName(String modelCustomizationName) {
+ modelInstanceName = modelCustomizationName;
this.modelCustomizationName = modelCustomizationName;
}
public String getModelNameVersionId() {
@@ -102,6 +106,7 @@ public class ModelInfo implements Serializable {
return modelInvariantId;
}
public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantUuid = modelInvariantId;
this.modelInvariantId = modelInvariantId;
}
public String getModelCustomizationUuid() {
@@ -114,19 +119,29 @@ public class ModelInfo implements Serializable {
return modelVersionId;
}
public void setModelVersionId(String modelVersionId) {
+ this.modelUuid=modelVersionId;
this.modelVersionId = modelVersionId;
}
public String getModelCustomizationId() {
return modelCustomizationId;
}
public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationUuid = modelCustomizationId;
this.modelCustomizationId = modelCustomizationId;
}
public String getModelUuid() {
return modelUuid;
}
+ public String getModelId() {
+ return modelId;
+ }
public void setModelUuid(String modelUuid) {
+ this.modelId = modelUuid;
this.modelUuid = modelUuid;
+
+ }
+ public void setModelId(String modelId) {
+ this.modelId = modelId;
}
public String getModelInvariantUuid() {
return modelInvariantUuid;
@@ -151,4 +166,4 @@ public class ModelInfo implements Serializable {
}
-}
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelType.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java
index 1080c57976..2ddad20346 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelType.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
/*
* Enum for Model Type values returned by API Handler to BPMN
@@ -31,5 +31,6 @@ public enum ModelType {
network,
configuration,
connectionPoint,
- pnf
+ pnf,
+ networkCollection
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Networks.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Networks.java
new file mode 100644
index 0000000000..386078a60b
--- /dev/null
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Networks.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.serviceinstancebeans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonRootName(value = "networks")
+@JsonInclude(Include.NON_DEFAULT)
+public class Networks implements Serializable{
+
+ private static final long serialVersionUID = 8081495240474276501L;
+ @JsonProperty("modelInfo")
+ protected ModelInfo modelInfo;
+ @JsonProperty("cloudConfiguration")
+ protected CloudConfiguration cloudConfiguration;
+ @JsonProperty("instanceName")
+ protected String instanceName;
+ @JsonProperty("productFamilyId")
+ protected String productFamilyId;
+ @JsonProperty("instanceParams")
+ private List<Map<String, String>> instanceParams = new ArrayList<>();
+
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public String getProductFamilyId() {
+ return productFamilyId;
+ }
+
+ public void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+ public List<Map<String, String>> getInstanceParams() {
+ return instanceParams;
+ }
+
+ public void setInstanceParams(List<Map<String, String>> instanceParams) {
+ this.instanceParams = instanceParams;
+ }
+
+ @Override
+ public String toString() {
+ return "Networks [modelInfo=" + modelInfo +
+ ", cloudConfiguration=" + cloudConfiguration +
+ ", instanceName=" + instanceName + ", productFamilyId=" + productFamilyId +
+ ", instanceParams=" + instanceParams + "]";
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/OwningEntity.java b/common/src/main/java/org/onap/so/serviceinstancebeans/OwningEntity.java
index 985de7d41a..f552554ad4 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/OwningEntity.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/OwningEntity.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Platform.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Platform.java
index a7a34cc39b..961062299f 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Platform.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Platform.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/PolicyException.java b/common/src/main/java/org/onap/so/serviceinstancebeans/PolicyException.java
index dfa23f6490..263089e5c1 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/PolicyException.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/PolicyException.java
@@ -26,7 +26,7 @@
//
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -41,7 +41,7 @@ import javax.xml.bind.annotation.XmlType;
* <pre>
* &lt;complexType name="policyException">
* &lt;complexContent>
- * &lt;extension base="{http://org.openecomp/mso/request/types/v1}exceptionType">
+ * &lt;extension base="{http://org.onap/so/request/types/v1}exceptionType">
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Project.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Project.java
index b7e80162ff..47bd2bb802 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Project.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Project.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstance.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstance.java
index 60e7d9b69a..cfdba18fe1 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstance.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstance.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP - SO
+ * OPENECOMP - MSO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstanceList.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstanceList.java
index b11acccf2a..9d10865e24 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstanceList.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstanceList.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Request.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java
index 0671089d99..bda3096f05 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Request.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import org.apache.commons.lang3.builder.ToStringBuilder;
-//@JsonRootName(value = "request")
+
@JsonInclude(Include.NON_DEFAULT)
public class Request {
@@ -32,7 +32,6 @@ public class Request {
protected String startTime;
protected String requestScope;
protected String requestType;
- //protected String requestDetails;
protected RequestDetails requestDetails;
protected InstanceReferences instanceReferences;
protected RequestStatus requestStatus;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestDetails.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestDetails.java
index 2bae526efa..d71334288e 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestDetails.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestDetails.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,10 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -53,7 +56,11 @@ public class RequestDetails implements Serializable {
protected Platform platform;
@JsonProperty("lineOfBusiness")
protected LineOfBusiness lineOfBusiness;
- /**
+ @JsonProperty("instanceName")
+ private List<Map<String, String>> instanceName = new ArrayList<>();
+
+
+ /**
* Gets the value of the serviceInfo property.
*
* @return
@@ -268,6 +275,21 @@ public class RequestDetails implements Serializable {
public void setLineOfBusiness(LineOfBusiness value){
this.lineOfBusiness = value;
}
+ /**
+ * Gets the value of the instanceName property.
+ */
+ public List<Map<String, String>> getInstanceName() {
+ return instanceName;
+ }
+ /**
+ * Sets the value of the instanceName property.
+ *
+ * @param value
+ *
+ */
+ public void setInstanceName(List<Map<String, String>> instanceName) {
+ this.instanceName = instanceName;
+ }
@Override
public String toString() {
return "RequestDetails [modelInfo=" + modelInfo + ", requestInfo="
@@ -275,6 +297,7 @@ public class RequestDetails implements Serializable {
+ Arrays.toString(relatedInstanceList) + ", subscriberInfo="
+ subscriberInfo + ", cloudConfiguration=" + cloudConfiguration
+ ", requestParameters=" + requestParameters + ", platform=" + platform
- + ", lineOfBusiness=" + ", project=" + project + ", owningEntity=" + owningEntity + "]";
+ + ", lineOfBusiness=" + ", project=" + project + ", owningEntity=" + owningEntity
+ + ", instanceName" + instanceName + "]";
}
}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestError.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestError.java
index efd5358073..76137d0f58 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestError.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestError.java
@@ -26,7 +26,7 @@
//
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -34,6 +34,8 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.commons.lang3.builder.ToStringBuilder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
/**
* <p>Java class for anonymous complex type.
@@ -46,8 +48,8 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;choice>
- * &lt;element name="policyException" type="{http://org.openecomp/mso/request/types/v1}policyException"/>
- * &lt;element name="serviceException" type="{http://org.openecomp/mso/request/types/v1}serviceException"/>
+ * &lt;element name="policyException" type="{http://org.onap/so/request/types/v1}policyException"/>
+ * &lt;element name="serviceException" type="{http://org.onap/so/request/types/v1}serviceException"/>
* &lt;/choice>
* &lt;/sequence>
* &lt;/restriction>
@@ -63,6 +65,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
"serviceException"
})
@XmlRootElement(name = "requestError")
+@JsonRootName(value = "requestError")
public class RequestError {
protected PolicyException policyException;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestInfo.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java
index d1e489a174..158ca7a819 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestInfo.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestList.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestList.java
index 799e2f8c60..a4c0ddfcf2 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestList.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestList.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestParameters.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
index 06d53285b0..1697a4eb5f 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestParameters.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
@@ -1,15 +1,15 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP - SO
+ * OPENECOMP - MSO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,13 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import javax.persistence.Transient;
+
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -41,18 +43,23 @@ public class RequestParameters implements Serializable {
private List<Map<String, Object>> userParams = new ArrayList<>();
@JsonProperty("aLaCarte")
private Boolean aLaCarte;
+
+ // DONOT USE. It is intended to handle older VID requests(prior to 1802)
+ @Deprecated
+ @JsonProperty("alaCarte")
+ private Boolean alaCarte;
@JsonProperty("autoBuildVfModules")
private Boolean autoBuildVfModules;
@JsonProperty("cascadeDelete")
private Boolean cascadeDelete;
+ @JsonProperty("testApi")
+ private String testApi; // usePreload would always be true for Update
@JsonProperty("usePreload")
private Boolean usePreload; // usePreload would always be true for Update
@JsonProperty("rebuildVolumeGroups")
private Boolean rebuildVolumeGroups;
@JsonProperty("payload")
private String payload;
- @JsonProperty("controllerType")
- private String controllerType;
public String getSubscriptionServiceType() {
return subscriptionServiceType;
@@ -61,11 +68,11 @@ public class RequestParameters implements Serializable {
public void setSubscriptionServiceType(String subscriptionServiceType) {
this.subscriptionServiceType = subscriptionServiceType;
}
-
+ @JsonProperty("aLaCarte")
public Boolean getALaCarte() {
return aLaCarte;
}
-
+ @JsonProperty("aLaCarte")
public void setaLaCarte(Boolean aLaCarte) {
this.aLaCarte = aLaCarte;
}
@@ -74,6 +81,27 @@ public class RequestParameters implements Serializable {
return aLaCarte;
}
+ @Deprecated
+ @Transient
+ @JsonProperty("alaCarte")
+ public Boolean getAlaCarte() {
+ return alaCarte;
+ }
+
+ @Deprecated
+ @JsonProperty("alaCarte")
+ public void setAlaCarte(Boolean alaCarte) {
+ this.alaCarte = alaCarte;
+ }
+
+ public String getTestApi() {
+ return testApi;
+ }
+
+ public void setTestApi(String testApi) {
+ this.testApi = testApi;
+ }
+
public List<Map<String, Object>> getUserParams() {
return userParams;
}
@@ -92,11 +120,11 @@ public class RequestParameters implements Serializable {
}
return null;
}
-
+
public Boolean getAutoBuildVfModules() {
return autoBuildVfModules;
}
-
+
public void setAutoBuildVfModules(Boolean autoBuildVfModules) {
this.autoBuildVfModules = autoBuildVfModules;
}
@@ -117,13 +145,10 @@ public class RequestParameters implements Serializable {
this.usePreload = usePreload;
}
- public Boolean rebuildVolumeGroups() {
+ public Boolean getRebuildVolumeGroups() {
return rebuildVolumeGroups;
}
- public Boolean isRebuildVolumeGroups() {
- return rebuildVolumeGroups;
- }
public void setRebuildVolumeGroups(Boolean rebuildVolumeGroups) {
this.rebuildVolumeGroups = rebuildVolumeGroups;
}
@@ -134,19 +159,13 @@ public class RequestParameters implements Serializable {
this.payload = value;
}
- public String getControllerType() {
- return controllerType;
- }
-
- public void setControllerType(String controllerType) {
- this.controllerType = controllerType;
- }
-
@Override
public String toString() {
- return "RequestParameters [subscriptionServiceType=" + subscriptionServiceType + ", userParams=" + userParams
- + ", aLaCarte=" + aLaCarte + ", autoBuildVfModules=" + autoBuildVfModules + ", cascadeDelete="
- + cascadeDelete + ", usePreload=" + usePreload + ", rebuildVolumeGroups=" + rebuildVolumeGroups
- + ", payload=" + payload + ", controllerType=" + controllerType + "]";
- }
-}
+ return "RequestParameters [subscriptionServiceType="
+ + subscriptionServiceType + ", userParams=" + userParams
+ + ", aLaCarte=" + aLaCarte + ", testApi= " + testApi + ", autoBuildVfModules="
+ + autoBuildVfModules + ", usePreload="
+ + usePreload + ", rebuildVolumeGroups="
+ + rebuildVolumeGroups + ", payload=" + payload + "]";
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestReferences.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestReferences.java
index d4d70190ff..c30e39a028 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestReferences.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestReferences.java
@@ -18,10 +18,16 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import org.apache.commons.lang3.builder.ToStringBuilder;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonRootName(value = "requestReferences")
+@JsonInclude(Include.NON_DEFAULT)
public class RequestReferences {
String requestId;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestStatus.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
index d6a8fc0084..527aa037ed 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestStatus.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecisionRequest.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java
index bc20b9c143..68fd95c293 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecisionRequest.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java
@@ -3,13 +3,14 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,41 +19,42 @@
* ============LICENSE_END=========================================================
*/
+package org.onap.so.serviceinstancebeans;
-package org.openecomp.mso.client.policy.entities;
-
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({ "decisionAttributes", "ecompcomponentName" })
-public class PolicyDecisionRequest {
-
- @JsonProperty("decisionAttributes")
- private DecisionAttributes decisionAttributes;
- @JsonProperty("ecompcomponentName")
- private String ecompcomponentName;
-
- @JsonProperty("decisionAttributes")
- public DecisionAttributes getDecisionAttributes() {
- return decisionAttributes;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "resources")
+@JsonInclude(Include.NON_DEFAULT)
+public class Resources implements Serializable{
+
+ private static final long serialVersionUID = 2194797231782624520L;
+ @JsonProperty("vnfs")
+ private List<Vnfs> vnfs = new ArrayList<>();
+ @JsonProperty("networks")
+ private List<Networks> networks = new ArrayList<>();
+
+ public List<Vnfs> getVnfs() {
+ return vnfs;
}
-
- @JsonProperty("decisionAttributes")
- public void setDecisionAttributes(DecisionAttributes decisionAttributes) {
- this.decisionAttributes = decisionAttributes;
+ public void setVnfs(List<Vnfs> vnfs) {
+ this.vnfs = vnfs;
}
-
- @JsonProperty("ecompcomponentName")
- public String getEcompcomponentName() {
- return ecompcomponentName;
+ public List<Networks> getNetworks() {
+ return networks;
}
-
- @JsonProperty("ecompcomponentName")
- public void setEcompcomponentName(String ecompcomponentName) {
- this.ecompcomponentName = ecompcomponentName;
+ public void setNetworks(List<Networks> networks) {
+ this.networks = networks;
}
-
-}
+ @Override
+ public String toString() {
+ return "Resources [vnfs=" + vnfs + ", networks=" + networks + "]";
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Service.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Service.java
new file mode 100644
index 0000000000..66848d343c
--- /dev/null
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Service.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.serviceinstancebeans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonRootName(value = "service")
+@JsonInclude(Include.NON_DEFAULT)
+public class Service implements Serializable{
+
+ private static final long serialVersionUID = 2194797231782624520L;
+ @JsonProperty("modelInfo")
+ protected ModelInfo modelInfo;
+ @JsonProperty("cloudConfiguration")
+ protected CloudConfiguration cloudConfiguration;
+ @JsonProperty("instanceName")
+ protected String instanceName;
+ @JsonProperty("instanceParams")
+ private List<Map<String, String>> instanceParams = new ArrayList<>();
+ @JsonProperty("resources")
+ protected Resources resources;
+
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public List<Map<String, String>> getInstanceParams() {
+ return instanceParams;
+ }
+
+ public void setInstanceParams(List<Map<String, String>> instanceParams) {
+ this.instanceParams = instanceParams;
+ }
+
+ public Resources getResources() {
+ return resources;
+ }
+
+ public void setResources(Resources resources) {
+ this.resources = resources;
+ }
+
+ @Override
+ public String toString() {
+ return "Service [modelInfo=" + modelInfo +
+ ", cloudConfiguration=" + cloudConfiguration
+ + ", instanceName=" + instanceName +
+ ", instanceParams=" + instanceParams +
+ ", resources=" + resources + "]";
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceException.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceException.java
index 0fe8b5f0cf..7efb7f0bff 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceException.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceException.java
@@ -26,12 +26,14 @@
//
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
/**
* <p>Java class for serviceException complex type.
@@ -41,7 +43,7 @@ import javax.xml.bind.annotation.XmlType;
* <pre>
* &lt;complexType name="serviceException">
* &lt;complexContent>
- * &lt;extension base="{http://org.openecomp/mso/request/types/v1}exceptionType">
+ * &lt;extension base="{http://org.onap/so/request/types/v1}exceptionType">
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
@@ -51,6 +53,7 @@ import javax.xml.bind.annotation.XmlType;
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "serviceException")
+@JsonRootName(value = "serviceException")
public class ServiceException
extends ExceptionType
{
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java
index d06c532f88..3ccf29127f 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesResponse.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesResponse.java
index 614a87d009..db3add8d47 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesResponse.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesResponse.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import org.apache.commons.lang3.builder.ToStringBuilder;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/SubscriberInfo.java b/common/src/main/java/org/onap/so/serviceinstancebeans/SubscriberInfo.java
index 47cb1f2d26..03780231fc 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/SubscriberInfo.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/SubscriberInfo.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/VfModules.java b/common/src/main/java/org/onap/so/serviceinstancebeans/VfModules.java
new file mode 100644
index 0000000000..74f8af80a7
--- /dev/null
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/VfModules.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.serviceinstancebeans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonRootName(value = "vfmodules")
+@JsonInclude(Include.NON_DEFAULT)
+public class VfModules implements Serializable{
+
+ private static final long serialVersionUID = 8081495240474276501L;
+ @JsonProperty("modelInfo")
+ protected ModelInfo modelInfo;
+ @JsonProperty("cloudConfiguration")
+ protected CloudConfiguration cloudConfiguration;
+ @JsonProperty("instanceName")
+ protected String instanceName;
+ @JsonProperty("volumeGroupInstanceName")
+ protected String volumeGroupInstanceName;
+ @JsonProperty("instanceParams")
+ private List<Map<String, String>> instanceParams = new ArrayList<>();
+
+
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public String getVolumeGroupInstanceName() {
+ return volumeGroupInstanceName;
+ }
+
+ public void setVolumeGroupInstanceName(String volumeGroupInstanceName) {
+ this.volumeGroupInstanceName = volumeGroupInstanceName;
+ }
+
+ public List<Map<String, String>> getInstanceParams() {
+ return instanceParams;
+ }
+
+ public void setInstanceParams(List<Map<String, String>> instanceParams) {
+ this.instanceParams = instanceParams;
+ }
+
+ @Override
+ public String toString() {
+ return "VfModules [modelInfo=" + modelInfo +
+ ", cloudConfiguration=" + cloudConfiguration +
+ ", instanceName=" + instanceName + ", volumeGroupInstanceName="
+ + volumeGroupInstanceName + ", instanceParams=" + instanceParams + "]";
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Vnfs.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Vnfs.java
new file mode 100644
index 0000000000..b55a528935
--- /dev/null
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Vnfs.java
@@ -0,0 +1,131 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.serviceinstancebeans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonRootName(value = "vnfs")
+@JsonInclude(Include.NON_DEFAULT)
+public class Vnfs implements Serializable{
+
+ private static final long serialVersionUID = 8081495240474276501L;
+ @JsonProperty("modelInfo")
+ protected ModelInfo modelInfo;
+ @JsonProperty("cloudConfiguration")
+ protected CloudConfiguration cloudConfiguration;
+ @JsonProperty("instanceName")
+ protected String instanceName;
+ @JsonProperty("platform")
+ protected Platform platform;
+ @JsonProperty("lineOfBusiness")
+ protected LineOfBusiness lineOfBusiness;
+ @JsonProperty("productFamilyId")
+ protected String productFamilyId;
+ @JsonProperty("instanceParams")
+ private List<Map<String, String>> instanceParams = new ArrayList<>();
+ @JsonProperty("vfModules")
+ private List<VfModules> vfModules = new ArrayList<>();
+
+
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public Platform getPlatform() {
+ return platform;
+ }
+
+ public void setPlatform(Platform platform) {
+ this.platform = platform;
+ }
+
+ public LineOfBusiness getLineOfBusiness() {
+ return lineOfBusiness;
+ }
+
+ public void setLineOfBusiness(LineOfBusiness lineOfBusiness) {
+ this.lineOfBusiness = lineOfBusiness;
+ }
+
+ public String getProductFamilyId() {
+ return productFamilyId;
+ }
+
+ public void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+ public List<Map<String, String>> getInstanceParams() {
+ return instanceParams;
+ }
+
+ public void setInstanceParams(List<Map<String, String>> instanceParams) {
+ this.instanceParams = instanceParams;
+ }
+
+ public List<VfModules> getVfModules() {
+ return vfModules;
+ }
+
+ public void setVfModules(List<VfModules> vfModules) {
+ this.vfModules = vfModules;
+ }
+
+ @Override
+ public String toString() {
+ return "Vnfs [modelInfo=" + modelInfo +
+ ", cloudConfiguration=" + cloudConfiguration +
+ ", instanceName=" + instanceName + ", platform=" + platform + ", " +
+ "lineOfBusiness=" + lineOfBusiness +
+ ", productFamilyId=" + productFamilyId + ", instanceParams=" + instanceParams +
+ ", vfModules=" + vfModules + "]";
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/onap/so/test/categories/SlowTests.java b/common/src/main/java/org/onap/so/test/categories/SlowTests.java
new file mode 100644
index 0000000000..58a14041d0
--- /dev/null
+++ b/common/src/main/java/org/onap/so/test/categories/SlowTests.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.so.test.categories;
+
+public interface SlowTests {
+/* category marker */
+}
diff --git a/common/src/main/java/org/openecomp/mso/utils/CheckResults.java b/common/src/main/java/org/onap/so/utils/CheckResults.java
index ad0344d028..4f6089d0e3 100644
--- a/common/src/main/java/org/openecomp/mso/utils/CheckResults.java
+++ b/common/src/main/java/org/onap/so/utils/CheckResults.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.utils;
+package org.onap.so.utils;
diff --git a/common/src/main/java/org/openecomp/mso/utils/CryptoUtils.java b/common/src/main/java/org/onap/so/utils/CryptoUtils.java
index 5d0ff5b79e..11d464a85c 100644
--- a/common/src/main/java/org/openecomp/mso/utils/CryptoUtils.java
+++ b/common/src/main/java/org/onap/so/utils/CryptoUtils.java
@@ -18,17 +18,19 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.utils;
+package org.onap.so.utils;
-import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+
/**
* CryptoUtils adapted from RTTP client.
@@ -36,8 +38,10 @@ import javax.crypto.spec.SecretKeySpec;
*/
public final class CryptoUtils {
- public static final String AES = "AES";
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, CryptoUtils.class);
+ public static final String AES = "AES";
+ private static final String CLOUD_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
/**
* encrypt a value and generate a keyfile
* if the keyfile is not found then a new one is created
@@ -65,6 +69,36 @@ public final class CryptoUtils {
return new String (decrypted);
}
+ /**
+ * decrypt a value or return defaultValue
+ *
+ */
+ public static String decryptProperty (String prop, String defaultValue, String encryptionKey) {
+ try {
+ return CryptoUtils.decrypt(prop, encryptionKey);
+ }
+ catch (GeneralSecurityException e) {
+ LOGGER.debug("Security exception", e);
+ }
+ return defaultValue;
+ }
+
+ public static String encryptCloudConfigPassword(String message) {
+ try {
+ return CryptoUtils.encrypt(message, CryptoUtils.CLOUD_KEY);
+ } catch (GeneralSecurityException e) {
+ LOGGER.error (MessageEnum.RA_GENERAL_EXCEPTION, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in encryptPassword", e);
+ return null;
+ }
+ }
+ public static String decryptCloudConfigPassword(String message) {
+ try {
+ return CryptoUtils.decrypt(message, CryptoUtils.CLOUD_KEY);
+ } catch (GeneralSecurityException e) {
+ LOGGER.error (MessageEnum.RA_GENERAL_EXCEPTION, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in encryptPassword", e);
+ return null;
+ }
+ }
private static SecretKeySpec getSecretKeySpec (String keyString) throws NoSuchAlgorithmException {
byte[] key = hexStringToByteArray (keyString);
SecretKeySpec sks = new SecretKeySpec (key, CryptoUtils.AES);
diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesParameters.java b/common/src/main/java/org/onap/so/utils/TargetEntity.java
index b89a5d4791..ad76e56a56 100644
--- a/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesParameters.java
+++ b/common/src/main/java/org/onap/so/utils/TargetEntity.java
@@ -18,16 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.properties;
+package org.onap.so.utils;
-public class MsoPropertiesParameters {
-
- protected enum MsoPropertiesType {JSON_PROP,JAVA_PROP}
+public enum TargetEntity {
+ OPENSTACK_ADAPTER, BPMN, GRM ,AAI, DMAAP, POLICY, CATALOG_DB, REQUEST_DB, VNF_ADAPTER, SDNC_ADAPTER, NARAD;
- protected MsoPropertiesType msoPropertiesType;
-
- protected int refreshCounter;
-
- protected AbstractMsoProperties msoProperties;
+ private static final String PREFIX = "MSO";
+ @Override
+ public String toString(){
+ return TargetEntity.PREFIX + "." + this.name();
+ }
}
diff --git a/common/src/main/java/org/openecomp/mso/utils/UUIDChecker.java b/common/src/main/java/org/onap/so/utils/UUIDChecker.java
index b715717924..fac73e84f9 100644
--- a/common/src/main/java/org/openecomp/mso/utils/UUIDChecker.java
+++ b/common/src/main/java/org/onap/so/utils/UUIDChecker.java
@@ -19,18 +19,18 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.utils;
-
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
+package org.onap.so.utils;
import java.util.UUID;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+
/**
*/
public class UUIDChecker {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, UUIDChecker.class);
private UUIDChecker() {
@@ -49,7 +49,7 @@ public class UUIDChecker {
}
}
- private static String getUUID () {
+ public static String getUUID () {
return UUID.randomUUID().toString();
}
diff --git a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
new file mode 100644
index 0000000000..903d055548
--- /dev/null
+++ b/common/src/main/java/org/onap/so/utils/XmlMarshaller.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.so.utils;
+
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.sax.SAXSource;
+
+import org.onap.so.exceptions.MarshallerException;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
+public class XmlMarshaller {
+
+ private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, XmlMarshaller.class);
+
+ public static String marshal(Object object) throws MarshallerException {
+
+ StringWriter stringWriter = new StringWriter();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance(object.getClass());
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
+ jaxbMarshaller.marshal(object, stringWriter);
+ } catch (JAXBException e) {
+ logger.error(MessageEnum.GENERAL_EXCEPTION, "", "", "", MsoLogger.ErrorCode.SchemaError, e.getMessage(), e);
+ throw new MarshallerException(e.getMessage(), MsoLogger.ErrorCode.SchemaError.getValue(), e);
+ }
+
+ return stringWriter.toString();
+ }
+
+ public static Object unMarshal(String input, Object object) throws MarshallerException {
+
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ spf.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ spf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+ spf.setNamespaceAware(true);
+ XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+
+ JAXBContext jaxbContext = JAXBContext.newInstance(object.getClass());
+ Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
+
+ InputSource inputSource = new InputSource(new StringReader(input));
+ SAXSource source = new SAXSource(xmlReader, inputSource);
+ object = jaxbUnmarshaller.unmarshal(source, object.getClass()).getValue();
+ } catch (Exception e) {
+ logger.error(MessageEnum.GENERAL_EXCEPTION, "", "", "", MsoLogger.ErrorCode.SchemaError, e.getMessage(), e);
+ throw new MarshallerException(e.getMessage(), MsoLogger.ErrorCode.SchemaError.getValue(), e);
+ }
+
+ return object;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecision.java b/common/src/main/java/org/onap/so/web/exceptions/ExceptionResponse.java
index fbc8e23151..048634190a 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecision.java
+++ b/common/src/main/java/org/onap/so/web/exceptions/ExceptionResponse.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -18,41 +18,29 @@
* ============LICENSE_END=========================================================
*/
-
-package org.openecomp.mso.client.policy.entities;
-
-
+package org.onap.so.web.exceptions;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({ "decision", "details" })
-public class PolicyDecision {
-
- @JsonProperty("decision")
- private String decision;
- @JsonProperty("details")
- private String details;
-
- @JsonProperty("decision")
- public String getDecision() {
- return decision;
+@JsonPropertyOrder({
+ "message"
+})
+public class ExceptionResponse {
+ @JsonProperty("message")
+ private String message;
+
+ public ExceptionResponse(String message) {
+ this.message = message;
}
-
- @JsonProperty("decision")
- public void setDecision(String decision) {
- this.decision = decision;
+ public String getMessage() {
+ return message;
}
- @JsonProperty("details")
- public String getDetails() {
- return details;
+ public void setMessage(String message) {
+ this.message = message;
}
- @JsonProperty("details")
- public void setDetails(String details) {
- this.details = details;
- }
}
diff --git a/common/src/main/java/org/onap/so/web/exceptions/RuntimeExceptionMapper.java b/common/src/main/java/org/onap/so/web/exceptions/RuntimeExceptionMapper.java
new file mode 100644
index 0000000000..72e609acbd
--- /dev/null
+++ b/common/src/main/java/org/onap/so/web/exceptions/RuntimeExceptionMapper.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.so.web.exceptions;
+
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.ext.ExceptionMapper;
+
+import org.onap.so.logger.MsoAlarmLogger;
+import org.onap.so.logger.MsoLogger;
+
+public class RuntimeExceptionMapper implements ExceptionMapper<RuntimeException> {
+
+ private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, RuntimeExceptionMapper.class);
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
+ @Override
+ public Response toResponse(RuntimeException exception) {
+
+ if (exception instanceof NotFoundException) {
+ return Response.status(Status.NOT_FOUND).build();
+ } else {
+ alarmLogger.sendAlarm("MsoApplicationError", MsoAlarmLogger.CRITICAL, exception.getMessage());
+ logger.error(exception);
+ return Response.status(Status.INTERNAL_SERVER_ERROR).entity(new ExceptionResponse("Unexpected Internal Exception")).build();
+ }
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIClient.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIClient.java
deleted file mode 100644
index 9150dcab15..0000000000
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIClient.java
+++ /dev/null
@@ -1,69 +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.openecomp.mso.client.aai;
-
-import java.net.URI;
-import java.util.UUID;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.openecomp.mso.client.RestPropertiesLoader;
-import org.openecomp.mso.client.aai.entities.uri.AAIUri;
-import org.openecomp.mso.client.defaultproperties.DefaultAAIPropertiesImpl;
-import org.openecomp.mso.client.policy.RestClient;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public abstract class AAIClient {
-
- protected final AAIVersion defaultVersion;
- private static final String AAI_ROOT = "/aai";
- protected final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
- private final AAIProperties properties;
- protected final UUID requestId;
- public AAIClient(UUID requestId) {
- AAIProperties props = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class);
- if (props == null) {
- metricsLogger.error("No RestProperty.AAIProperties implementation found on classpath");
- props = new DefaultAAIPropertiesImpl();
- }
- this.properties = props;
- this.defaultVersion = props.getDefaultVersion();
- this.requestId = requestId;
- }
- protected URI constructPath(AAIUri uri) {
-
- return UriBuilder.fromUri(AAI_ROOT + "/" + this.getVersion().toString() + uri.build().toString()).build();
- }
-
- protected RestClient createClient(AAIUri uri) {
- return new AAIRestClient(properties, this.getRequestId(), constructPath(uri)).addRequestId(this.getRequestId());
-
- }
-
- protected UUID getRequestId() {
- return this.requestId;
- }
- protected AAIVersion getVersion() {
- return defaultVersion;
- }
-} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java
deleted file mode 100644
index e36033faa0..0000000000
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.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.openecomp.mso.client.aai;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.Optional;
-import java.util.UUID;
-
-import javax.ws.rs.client.ClientResponseFilter;
-import javax.ws.rs.ext.ContextResolver;
-
-import org.openecomp.mso.client.policy.RestClient;
-import org.openecomp.mso.client.policy.RestClientSSL;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class AAIRestClient extends RestClientSSL {
-
- private final AAIProperties props;
-
- protected AAIRestClient(AAIProperties props, UUID requestId, URI uri) {
- super(props, requestId, Optional.of(uri));
- this.props = props;
- headerMap.put("X-TransactionId", requestId.toString());
- }
-
- @Override
- protected void initializeHeaderMap(Map<String, String> headerMap) {
- headerMap.put("X-FromAppId", "MSO");
-
- String auth = props.getAuth();
- String key = props.getKey();
-
- if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) {
- addBasicAuthHeader(auth, key);
- }
- }
-
- @Override
- protected Optional<ClientResponseFilter> addResponseFilter() {
-
- return Optional.of(new AAIClientResponseExceptionMapper(this.getRequestId()));
- }
-
- @Override
- public RestClient addRequestId(UUID requestId) {
- headerMap.put("X-TransactionId", requestId.toString());
- this.requestId = requestId;
- return this;
- }
-
- @Override
- protected ContextResolver<ObjectMapper> getMapper() {
- return new AAICommonObjectMapperProvider();
- }
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOwningEntity.java b/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOwningEntity.java
deleted file mode 100644
index b0b3d06669..0000000000
--- a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOwningEntity.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.openecomp.mso.client.aai.objects;
-
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.entities.AAIEntityObject;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class AAIOwningEntity implements AAIEntityObject {
-
- @JsonProperty("owning-entity-name")
- private String owningEntityName;
-
- @JsonProperty("owning-entity-id")
- private String owningEntityId;
-
- public String getOwningEntityName() {
- return owningEntityName;
- }
-
- public void setOwningEntityName(String owningEntityName) {
- this.owningEntityName = owningEntityName;
- }
-
- public String getOwningEntityId() {
- return owningEntityId;
- }
-
- public void setOwningEntityId(String owningEntityId) {
- this.owningEntityId = owningEntityId;
- }
-
- public AAIOwningEntity withOwningEntity(String owningEntityName, String owningEntityId) {
- this.setOwningEntityName(owningEntityName);
- this.setOwningEntityId(owningEntityId);
- return this;
- }
-
- @Override
- public AAIResourceUri getUri() {
- final AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, this.owningEntityId);
- return uri;
- }
-
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIProject.java b/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIProject.java
deleted file mode 100644
index 34f715d98a..0000000000
--- a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIProject.java
+++ /dev/null
@@ -1,55 +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.openecomp.mso.client.aai.objects;
-
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.entities.AAIEntityObject;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class AAIProject implements AAIEntityObject {
-
- @JsonProperty("project-name")
- private String projectName;
-
- public String getProjectName() {
- return projectName;
- }
-
- public void setProjectName(String projectName) {
- this.projectName = projectName;
- }
-
- public AAIProject withProjectName(String projectName) {
- this.setProjectName(projectName);
- return this;
- }
-
- @Override
- public AAIResourceUri getUri() {
- final AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, this.projectName);
- return uri;
- }
-
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/RestClient.java b/common/src/main/java/org/openecomp/mso/client/policy/RestClient.java
deleted file mode 100644
index 77afe82758..0000000000
--- a/common/src/main/java/org/openecomp/mso/client/policy/RestClient.java
+++ /dev/null
@@ -1,243 +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.openecomp.mso.client.policy;
-
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.security.GeneralSecurityException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Optional;
-import java.util.UUID;
-
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.ClientResponseFilter;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.Invocation.Builder;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.GenericType;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.ext.ContextResolver;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.log4j.Logger;
-import org.openecomp.mso.client.RestProperties;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.utils.CryptoUtils;
-import org.springframework.stereotype.Service;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-@Service
-public abstract class RestClient {
- protected static final String ECOMP_COMPONENT_NAME = "MSO";
-
- private static final int MAX_PAYLOAD_SIZE = 1024 * 1024;
- private WebTarget webTarget;
-
- protected final Map<String, String> headerMap;
- protected final MsoLogger msoLogger;
- protected URL host;
- protected Optional<URI> path;
- protected Logger logger;
- protected String accept;
- protected String contentType;
- protected UUID requestId;
-
- protected RestClient(RestProperties props, UUID requestId, Optional<URI> path) {
- logger = Logger.getLogger(getClass().getName());
- msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
- this.requestId = requestId;
- headerMap = new HashMap<>();
- try {
- host = props.getEndpoint();
- } catch (MalformedURLException e) {
- logger.error("url not valid", e);
- throw new RuntimeException(e);
- }
-
- this.path = path;
- initializeClient(getClient());
- }
-
- protected RestClient(RestProperties props, UUID requestId, Optional<URI> path, String accept, String contentType) {
- this(props, requestId, path);
- this.accept = accept;
- this.contentType = contentType;
- }
-
- protected RestClient(URL host, UUID requestId, String contentType) {
- headerMap = new HashMap<>();
- logger = Logger.getLogger(getClass().getName());
- msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
- this.path = Optional.empty();
- this.host = host;
- this.contentType = contentType;
- this.requestId = requestId;
- initializeClient(getClient());
- }
-
- /**
- * Override method to return false to disable logging.
- *
- * @return true - to enable logging, false otherwise
- */
- protected boolean enableLogging() {
- return true;
- }
-
- /**
- * Override method to return custom value for max payload size.
- *
- * @return Default value for MAX_PAYLOAD_SIZE = 1024 * 1024
- */
- protected int getMaxPayloadSize()
- {
- return MAX_PAYLOAD_SIZE;
- }
-
- protected Builder getBuilder() {
-
- Builder builder = webTarget.request();
- initializeHeaderMap(headerMap);
-
- for (Entry<String, String> entry : headerMap.entrySet()) {
- builder.header(entry.getKey(), entry.getValue());
- }
- return builder;
- }
-
- protected abstract void initializeHeaderMap(Map<String, String> headerMap);
-
- protected abstract Optional<ClientResponseFilter> addResponseFilter();
-
- public abstract RestClient addRequestId(UUID requestId);
-
- /**
- * Adds a basic authentication header to the request.
- * @param auth the encrypted credentials
- * @param key the key for decrypting the credentials
- */
- protected void addBasicAuthHeader(String auth, String key) {
- try {
- byte[] decryptedAuth = CryptoUtils.decrypt(auth, key).getBytes();
- String authHeaderValue = "Basic " + new String(Base64.encodeBase64(decryptedAuth));
- headerMap.put("Authorization", authHeaderValue);
- } catch (GeneralSecurityException e) {
- logger.warn(e.getMessage(), e);
- }
- }
-
- protected ContextResolver<ObjectMapper> getMapper() {
- return new CommonObjectMapperProvider();
- }
-
- protected String getAccept() {
- return accept;
- }
-
- protected String getContentType() {
- return contentType;
- }
-
- protected String getMergeContentType() {
- return "application/merge-patch+json";
- }
-
- protected Client getClient() {
- return ClientBuilder.newBuilder().build();
- }
-
- protected UUID getRequestId() {
- return this.requestId;
- }
- protected void initializeClient(Client client) {
- if (this.enableLogging()) {
- client.register(logger).register(new LoggingFilter(this.getMaxPayloadSize()));
- }
- client.register(this.getMapper());
- Optional<ClientResponseFilter> responseFilter = this.addResponseFilter();
- responseFilter.ifPresent(clientResponseFilter -> client.register(clientResponseFilter));
- webTarget = path.<WebTarget>map(uri -> client.target(UriBuilder.fromUri(host + uri.toString())))
- .orElseGet(() -> client.target(host.toString()));
- this.accept = MediaType.APPLICATION_JSON;
- this.contentType = MediaType.APPLICATION_JSON;
- }
-
- public Response get() {
- return this.getBuilder().accept(this.getAccept()).get();
- }
-
- public Response post(Object obj) {
- return this.getBuilder().accept(this.getAccept()).post(Entity.entity(obj, this.getContentType()));
- }
-
- public Response patch(Object obj) {
- return this.getBuilder().header("X-HTTP-Method-Override", "PATCH").accept(this.getAccept())
- .post(Entity.entity(obj, this.getMergeContentType()));
- }
-
- public Response put(Object obj) {
- return this.getBuilder().accept(this.getAccept()).put(Entity.entity(obj, this.getContentType()));
- }
-
- public Response delete() {
- return this.getBuilder().accept(this.getAccept()).delete();
- }
-
- public Response delete(Object obj) {
- return this.getBuilder().header("X-HTTP-Method-Override", "DELETE").accept(this.getAccept())
- .put(Entity.entity(obj, this.getContentType()));
- }
-
- public <T> T get(Class<T> resultClass) {
- return this.get().readEntity(resultClass);
- }
-
- public <T> T get(GenericType<T> resultClass) {
- return this.get().readEntity(resultClass);
- }
-
- public <T> T post(Object obj, Class<T> resultClass) {
- return this.post(obj).readEntity(resultClass);
- }
-
- public <T> T patch(Object obj, Class<T> resultClass) {
- return this.patch(obj).readEntity(resultClass);
- }
-
- public <T> T put(Object obj, Class<T> resultClass) {
- return this.put(obj).readEntity(resultClass);
- }
-
- public <T> T delete(Class<T> resultClass) {
- return this.delete().readEntity(resultClass);
- }
-
- public <T> T delete(Object obj, Class<T> resultClass) {
- return this.delete(obj).readEntity(resultClass);
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/db/AbstractSessionFactoryManager.java b/common/src/main/java/org/openecomp/mso/db/AbstractSessionFactoryManager.java
deleted file mode 100644
index 2988e30254..0000000000
--- a/common/src/main/java/org/openecomp/mso/db/AbstractSessionFactoryManager.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.openecomp.mso.db;
-
-import org.hibernate.cfg.Configuration;
-import org.hibernate.SessionFactory;
-import org.hibernate.service.ServiceRegistry;
-import org.openecomp.mso.properties.MsoDatabaseException;
-import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
-import java.net.URL;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-public abstract class AbstractSessionFactoryManager {
-
- protected static Map<String, SessionFactory> sessionFactories = new ConcurrentHashMap<>();
-
- protected synchronized SessionFactory initializeSessionFactory(URL hibernateConfigFile)
- throws MsoDatabaseException {
- try {
- if (hibernateConfigFile != null) {
- SessionFactory tempFactory = sessionFactories.get(hibernateConfigFile.getPath());
- // Already initialized, skip
- if (tempFactory != null) {
- return tempFactory;
- }
-
- Configuration conf = new Configuration().configure(hibernateConfigFile);
- ServiceRegistry sr = new StandardServiceRegistryBuilder().applySettings(conf.getProperties()).build();
- tempFactory = conf.buildSessionFactory(sr);
- if (tempFactory == null) {
- throw new MsoDatabaseException(
- "SessionFactory can't be initialized, method buildSessionFactory returned null !");
- }
- sessionFactories.put(hibernateConfigFile.getPath(), tempFactory);
- return tempFactory;
- } else {
- throw new MsoDatabaseException(
- "HibernateConfigFile provided is null, therefore Hibernate can't be initialized !");
- }
- } catch (Exception e) {
- throw new MsoDatabaseException("Exception occurred during the SessionFactory Build", e);
- }
- }
-
- public SessionFactory getSessionFactory() throws MsoDatabaseException {
- URL hibernateConfigFile = getHibernateConfigFile();
- SessionFactory factory = sessionFactories.get(hibernateConfigFile.getPath());
- if (factory == null) {
- factory = initializeSessionFactory(hibernateConfigFile);
- }
- return factory;
- }
-
- protected abstract URL getHibernateConfigFile();
-}
diff --git a/common/src/main/java/org/openecomp/mso/logger/LogFilter.java b/common/src/main/java/org/openecomp/mso/logger/LogFilter.java
deleted file mode 100644
index d799b47e15..0000000000
--- a/common/src/main/java/org/openecomp/mso/logger/LogFilter.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.openecomp.mso.logger;
-
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.slf4j.MDC;
-
-import java.io.IOException;
-import java.security.Principal;
-
-public class LogFilter implements Filter {
- @Override
- public void destroy() {
- // Nothing to do.
- }
-
- @Override
- public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
- final HttpServletRequest httpRequest = (HttpServletRequest) request;
- final HttpServletResponse httpResponse = (HttpServletResponse) response;
-
- MDC.clear ();
- MDC.put (MsoLogger.REMOTE_HOST, httpRequest.getRemoteAddr());
-
- Principal userPrincipal = httpRequest.getUserPrincipal();
- if (null != userPrincipal) {
- MDC.put (MsoLogger.PARTNERNAME, userPrincipal.getName ());
- }
- //Set identity of calling application / component
- String fromAppId = httpRequest.getHeader(MsoLogger.HEADER_FROM_APP_ID);
- if(fromAppId != null && !fromAppId.isEmpty()) {
- MDC.put (MsoLogger.FROM_APP_ID, fromAppId);
- }
- chain.doFilter(httpRequest, httpResponse);
- }
-
- @Override
- public void init(final FilterConfig config) throws ServletException {
- // Nothing to do
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/logger/MsoLogInitializer.java b/common/src/main/java/org/openecomp/mso/logger/MsoLogInitializer.java
deleted file mode 100644
index 6ed2786f35..0000000000
--- a/common/src/main/java/org/openecomp/mso/logger/MsoLogInitializer.java
+++ /dev/null
@@ -1,108 +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.openecomp.mso.logger;
-
-
-import java.io.File;
-
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-import javax.servlet.annotation.WebListener;
-
-import org.slf4j.LoggerFactory;
-
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.joran.JoranConfigurator;
-
-
-/**
- * This class will attempt to initialize MSO log4j when part of a web application.
- * It will look for the logback configuration file logback.xml in the
- * following order:
- * 1. In an init-param "log.configuration" in web.xml
- * 2. TODO: In a property "log.configuration" in an "application.properties" file
- * 3. In the default location "/etc/ecomp/mso/config"
- * 4. Using the log4j default (check system property log.configuration or
- * just look on the classpath for logback.xml)
- *
- *
- */
-@WebListener
-public class MsoLogInitializer implements ServletContextListener
-{
- private static String DEFAULT_LOG4J_PROPERTIES_FILE = "/etc/ecomp/mso/config/logback.xml";
- private static String prefixMsoPropertiesPath = System.getProperty("mso.config.path");
- static {
- if (prefixMsoPropertiesPath == null) {
- prefixMsoPropertiesPath = "/";
- } else if (!(prefixMsoPropertiesPath.charAt(prefixMsoPropertiesPath.length() - 1) == '/')) {
- prefixMsoPropertiesPath = prefixMsoPropertiesPath + "/";
- }
- }
-
- public MsoLogInitializer () {
- }
-
-
- @Override
- public void contextDestroyed(ServletContextEvent event) {
- // Nothing to do...
- }
-
- @Override
- public void contextInitialized(ServletContextEvent event)
- {
- String logPropertiesFile = null;
- try {
- // Look first in the init-parameters
- String initParam = event.getServletContext().getInitParameter("log.configuration");
- if (initParam != null && fileIsReadable(prefixMsoPropertiesPath + initParam)) {
- logPropertiesFile = prefixMsoPropertiesPath + initParam;
- }
- else if (fileIsReadable(DEFAULT_LOG4J_PROPERTIES_FILE)) {
- logPropertiesFile = DEFAULT_LOG4J_PROPERTIES_FILE;
- }
-
- if (logPropertiesFile != null) {
- // Initialize loggers with the specified file. If no such file was
- // specified, will use the default Log4j resolution.
- LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
- JoranConfigurator jc = new JoranConfigurator();
- jc.setContext(context);
- context.reset();
- jc.doConfigure(logPropertiesFile);
- // Try it out
- MsoLogger initLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
- initLogger.info(MessageEnum.INIT_LOGGER, logPropertiesFile, "", "");
- }
- } catch (Exception e) {
- MsoLogger initLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
- initLogger.error (MessageEnum.INIT_LOGGER_FAIL, "", "", MsoLogger.ErrorCode.UnknownError, "", e);
- }
- }
-
- private boolean fileIsReadable (String filePath) {
- File f = new File(filePath);
- if (f.exists() && f.canRead())
- return true;
- return false;
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/logger/MsoLoggingServlet.java b/common/src/main/java/org/openecomp/mso/logger/MsoLoggingServlet.java
deleted file mode 100644
index dd42efbfda..0000000000
--- a/common/src/main/java/org/openecomp/mso/logger/MsoLoggingServlet.java
+++ /dev/null
@@ -1,163 +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.openecomp.mso.logger;
-
-
-import java.util.List;
-
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Response;
-
-import org.slf4j.LoggerFactory;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.joran.JoranConfigurator;
-import ch.qos.logback.core.Appender;
-
-import com.wordnik.swagger.annotations.Api;
-import com.wordnik.swagger.annotations.ApiOperation;
-
-@Path("/logging")
-@Api(value="/logging",description="logging")
-public class MsoLoggingServlet {
-
- private static final String DEBUGLOG = "asyncEELFDebug";
- private MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
- private static final String GENERAL_LOGGER = "com.att.eelf.error";
- private static final String AUDIT_LOGGER = "com.att.eelf.audit";
- private static final String METRICS_LOGGER = "com.att.eelf.metrics";
-
- @GET
- @Path("/setLevel/{logContext}/{level}")
- @Produces("text/plain")
- @ApiOperation(value="message print",response=Response.class)
- public Response setLogLevel (@PathParam("logContext") String logContext, @PathParam("level") String level) {
- logger.info (MessageEnum.LOGGER_SETUP, "", "");
-
- LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
- JoranConfigurator jc = new JoranConfigurator();
- jc.setContext(context);
- Logger updateLogger = context.getLogger (logContext);
-
- if (updateLogger == null) {
- logger.info (MessageEnum.LOGGER_NOT_FOUND, logContext, "", "");
- String response = "Unknown logger: " + logContext;
- return Response.status (200).entity (response).build ();
- }
-
- Level currentLevel = updateLogger.getLevel();
- if (!currentLevel.equals(Level.toLevel(level))) {
- Level newLevel = Level.toLevel (level);
- updateLogger.setLevel (newLevel);
- logger.info (MessageEnum.LOGGER_UPDATE_SUC, updateLogger.getName (), currentLevel.toString(), newLevel.toString());
- }
-
- String response = "Log level set to: " + level + " for " + updateLogger.getName ();
- return Response.status (200).entity (response).build ();
-
- }
-
- @GET
- @Path("/loggers")
- @Produces("text/plain")
- @SuppressWarnings("rawtypes")
- @ApiOperation(value="message print",response=Response.class)
- public Response getLoggers () {
- StringBuilder response = new StringBuilder ();
- LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
- JoranConfigurator jc = new JoranConfigurator();
- jc.setContext(context);
- List <Logger> loggerList = context.getLoggerList();
- for (Logger logger:loggerList) {
- //if (logger.getLevel() != null) {
- response.append(logger.getName()).append(":").append(logger.getLevel()).append(" (")
- .append(logger.getEffectiveLevel()).append(")\n");
- //}
- }
- return Response.status (200).entity (response).build ();
-
- }
-
- @GET
- @Path("/debug")
- @Produces("text/plain")
- @ApiOperation(value="message print",response=Response.class)
- @SuppressWarnings("rawtypes")
- /*
- * Debug log is used as a general log to store all the logs events, including events generated by MSO code or by
- * components used by MSO.
- * This method will only enable/disable the function to store MSO generated events into debug log,
- * since those events will also be generated to error, audit, metrics log.
- * The events generated by other components will not be affected by this interface.
- */
- public Response updateDebugAppender (@DefaultValue("true") @QueryParam("enable") Boolean enable) {
- String response;
-
- LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
- JoranConfigurator jc = new JoranConfigurator();
- jc.setContext(context);
- List <Logger> loggerList = context.getLoggerList();
- Logger rootLogger = context.getLogger("ROOT");
- Appender appender = rootLogger.getAppender(DEBUGLOG);
-
- if (null == appender) {
- return Response.status (500).entity ("Not able to found Debug appender. Please verify to make sure the needed logback file is present in the config folder.").build ();
- }
-
- if (enable) {
- logger.info (MessageEnum.LOGGER_UPDATE_DEBUG, "", "");
-
- for (Logger logger: loggerList) {
- if (isMsoLogger (logger.getName ()) && logger.getAppender (DEBUGLOG) == null && logger.getLevel () != null) {
- logger.addAppender (appender);
- logger.setAdditive(false);
- }
- }
- logger.info (MessageEnum.LOGGER_UPDATE_DEBUG_SUC, "enabled", "", "");
- response = "Debuglog successfully enabled.";
- } else {
- logger.info (MessageEnum.LOGGER_UPDATE_DEBUG, "", "");
- for (Logger logger: loggerList) {
- if (isMsoLogger (logger.getName ())) {
- logger.detachAppender (appender);
- }
- }
- logger.info (MessageEnum.LOGGER_UPDATE_DEBUG_SUC, "disabled", "", "");
- response = "Debuglog successfully disabled.";
- }
- return Response.status (200).entity (response).build ();
-
-
- }
-
- private boolean isMsoLogger (String loggerName) {
- return loggerName.contains (GENERAL_LOGGER) || loggerName.equals (AUDIT_LOGGER)
- || loggerName.equals (METRICS_LOGGER);
- }
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/properties/AbstractMsoProperties.java b/common/src/main/java/org/openecomp/mso/properties/AbstractMsoProperties.java
deleted file mode 100644
index 8ab275e734..0000000000
--- a/common/src/main/java/org/openecomp/mso/properties/AbstractMsoProperties.java
+++ /dev/null
@@ -1,75 +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.openecomp.mso.properties;
-
-
-import java.io.IOException;
-import java.util.Properties;
-
-import org.openecomp.mso.logger.MsoLogger;
-
-public abstract class AbstractMsoProperties {
-
- public static final int DEFAULT_RELOAD_TIME_MIN=1;
-
- public static final String RELOAD_TIME_PROPERTY="mso.properties.reload.time.minutes";
-
- protected static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
-
- protected String propertiesFileName;
-
- protected int automaticRefreshInMinutes=0;
-
- public String getPropertiesFileName() {
- return propertiesFileName;
- }
-
- public int getAutomaticRefreshInMinutes() {
- return automaticRefreshInMinutes;
- }
-
- protected synchronized void reloadPropertiesFile() throws IOException {
- this.loadPropertiesFile(this.propertiesFileName);
- }
-
- /**
- * This method load a properties file from a source path.
- *
- * @param propertiesPath The path to the file
- * @throws IOException In case of issues during the opening
- */
-
- protected abstract void loadPropertiesFile(String propertiesPath) throws IOException;
-
- @Override
- protected abstract AbstractMsoProperties clone();
-
- @Override
- public abstract int hashCode();
-
- @Override
- public abstract boolean equals(Object obj);
-
- @Override
- public abstract String toString();
-
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoJavaProperties.java b/common/src/main/java/org/openecomp/mso/properties/MsoJavaProperties.java
deleted file mode 100644
index c13b9e0b53..0000000000
--- a/common/src/main/java/org/openecomp/mso/properties/MsoJavaProperties.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.openecomp.mso.properties;
-
-
-import java.io.FileReader;
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.commons.codec.binary.Base64;
-import org.openecomp.mso.utils.CryptoUtils;
-
-public class MsoJavaProperties extends AbstractMsoProperties {
-
-
- private Properties msoProperties = new Properties();
-
-
- public MsoJavaProperties() {
-
- }
-
- public synchronized void setProperty(String key,String value) {
- msoProperties.setProperty(key, value);
- }
-
- public synchronized String getProperty(String key, String defaultValue) {
- if (msoProperties.containsKey(key)) {
- return msoProperties.getProperty(key);
- } else {
- return defaultValue;
- }
- }
-
- public synchronized int getIntProperty(String key, int defaultValue) {
-
- int value = defaultValue;
- if (msoProperties.containsKey(key)) {
- try {
- value = Integer.parseInt(msoProperties.getProperty(key));
- } catch (NumberFormatException e) {
- LOGGER.debug("Exception while parsing integer: " + msoProperties.getProperty(key), e);
- }
- }
- return value;
-
- }
-
- public synchronized boolean getBooleanProperty(String key, boolean defaultValue) {
-
- if (msoProperties.containsKey(key)) {
- return Boolean.parseBoolean(msoProperties.getProperty(key));
- } else {
- return defaultValue;
- }
-
- }
-
- public synchronized String getEncryptedProperty(String key, String defaultValue, String encryptionKey) {
-
- if (msoProperties.containsKey(key)) {
- try {
- return CryptoUtils.decrypt(msoProperties.getProperty(key), encryptionKey);
- } catch (GeneralSecurityException e) {
- LOGGER.debug("Exception while decrypting property: " + msoProperties.getProperty(key), e);
- }
- }
- return defaultValue;
-
- }
-
- /**
- * @param encryptedAuth: encrypted credentials from properties
- * @param msoKey: key to use to decrypt from properties
- * @return base 64 encoded basic auth credentials
- */
- public synchronized String getBasicAuth(String encryptedAuth, String msoKey){
- String encodedString = null;
- if ((encryptedAuth == null || encryptedAuth.isEmpty()) || (msoKey == null || msoKey.isEmpty()))
- return null;
- try {
- String auth = decrypt(encryptedAuth, msoKey);
- byte[] encoded = Base64.encodeBase64(auth.getBytes());
- encodedString = new String(encoded);
- encodedString = "Basic " + encodedString;
-
- } catch (Exception ex) {
- LOGGER.debug("Exception while getBasicAuth " + encryptedAuth, ex);
- }
- return encodedString;
- }
-
- public synchronized int size() {
- return this.msoProperties.size();
- }
-
- public synchronized String decrypt(String toDecrypt, String msokey){
- String result = null;
- try {
- result = CryptoUtils.decrypt(toDecrypt, msokey);
-
- }
- catch (Exception e) {
- LOGGER.debug("Failed to decrypt credentials: " + toDecrypt, e);
- }
- return result;
- }
-
- @Override
- protected synchronized void reloadPropertiesFile() throws IOException {
- this.loadPropertiesFile(this.propertiesFileName);
- }
-
- /**
- * This method load a properties file from a source path.
- *
- * @param propertiesPath The path to the file
- * @throws IOException In case of issues during the opening
- */
- @Override
- protected synchronized void loadPropertiesFile(String propertiesPath) throws IOException {
-
- FileReader reader = null;
-
- propertiesFileName = propertiesPath;
- try {
- msoProperties.clear();
- reader = new FileReader(propertiesPath);
- msoProperties.load(reader);
-
- } finally {
- this.automaticRefreshInMinutes = this.getIntProperty(RELOAD_TIME_PROPERTY, DEFAULT_RELOAD_TIME_MIN);
- try {
- if (reader != null) {
- reader.close();
- }
- } catch (IOException e) {
- LOGGER.debug("Exception while closing reader for file:" + propertiesPath, e);
- }
- }
- }
-
- @Override
- public synchronized MsoJavaProperties clone() {
- MsoJavaProperties msoCopy = new MsoJavaProperties();
- msoCopy.msoProperties.putAll(msoProperties);
- msoCopy.propertiesFileName = this.propertiesFileName;
- msoCopy.automaticRefreshInMinutes = this.automaticRefreshInMinutes;
- return msoCopy;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((msoProperties == null) ? 0 : msoProperties.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- MsoJavaProperties other = (MsoJavaProperties) obj;
-
- return msoProperties.equals(other.msoProperties);
- }
-
- @Override
- public String toString() {
-
- StringBuilder response = new StringBuilder();
- response.append("Config file ")
- .append(propertiesFileName)
- .append("(Timer:")
- .append(automaticRefreshInMinutes)
- .append("mins):")
- .append(System.lineSeparator());
-
- for (Object key : this.msoProperties.keySet()) {
- String propertyName = (String) key;
- response.append(propertyName);
- response.append("=");
- response.append(this.msoProperties.getProperty(propertyName));
- response.append(System.lineSeparator());
- }
- response.append(System.lineSeparator());
- response.append(System.lineSeparator());
-
- return response.toString();
- }
-
- public Map<String, String> asMap() {
- final Map<String, String> result = new HashMap<>();
- msoProperties.forEach((key, value) -> result.put(key.toString(), value.toString()));
-
- return result;
- }
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java b/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java
deleted file mode 100644
index ec0b54a14f..0000000000
--- a/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java
+++ /dev/null
@@ -1,167 +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.openecomp.mso.properties;
-
-
-import java.io.FileReader;
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-
-import org.openecomp.mso.utils.CryptoUtils;
-
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-
-public class MsoJsonProperties extends AbstractMsoProperties {
-
- protected ObjectMapper mapper = new ObjectMapper();
-
- protected JsonNode jsonRootNode = mapper.createObjectNode();
-
- protected MsoJsonProperties() {
-
- }
-
- public synchronized JsonNode getJsonRootNode () {
- return this.jsonRootNode;
- }
-
- /**
- * This method is used to get the text encrypted in the string value of the node.
- * @param jsonNode The JsonNode containing the strig to decode
- * @param defaultValue The default value in case of issue
- * @param encryptionKey The encryption Key in AES 128 bits
- * @return the String decrypted
- */
- public synchronized String getEncryptedProperty(JsonNode jsonNode, String defaultValue, String encryptionKey) {
-
- if (jsonNode.isTextual()) {
- try {
- return CryptoUtils.decrypt(jsonNode.asText(), encryptionKey);
- } catch (GeneralSecurityException e) {
- LOGGER.debug("Exception while decrypting property: " + jsonNode.asText(), e);
- }
- }
-
- return defaultValue;
- }
-
- /**
- * This method load a properties file from a source path.
- *
- * @param propertiesPath The path to the file
- * @throws IOException In case of issues during the opening
- */
- @Override
- protected synchronized void loadPropertiesFile(String propertiesPath) throws IOException {
-
- FileReader reader = null;
-
- this.propertiesFileName = propertiesPath;
-
- try {
- // Clean
- this.jsonRootNode = mapper.createObjectNode();
-
- reader = new FileReader(propertiesPath);
-
- // Try a tree load
- this.jsonRootNode = mapper.readValue(reader, JsonNode.class);
-
-
- } finally {
- JsonNode reloadJsonProp = this.jsonRootNode.get(RELOAD_TIME_PROPERTY);
- if (reloadJsonProp != null) {
- this.automaticRefreshInMinutes = reloadJsonProp.asInt(DEFAULT_RELOAD_TIME_MIN);
- } else {
- this.automaticRefreshInMinutes = DEFAULT_RELOAD_TIME_MIN;
- }
-
- // Always close the file
- try {
- if (reader != null) {
- reader.close();
- }
- } catch (IOException e) {
- LOGGER.debug("Exception while closing reader for file:" + propertiesFileName, e);
- }
- }
- }
-
- @Override
- public synchronized MsoJsonProperties clone() {
- MsoJsonProperties msoCopy = new MsoJsonProperties();
-
- ObjectMapper newMapper = new ObjectMapper();
- try {
- msoCopy.jsonRootNode = newMapper.createObjectNode();
- msoCopy.jsonRootNode = newMapper.readValue(this.jsonRootNode.toString(), JsonNode.class);
- } catch (JsonParseException e) {
- LOGGER.debug("JsonParseException when cloning the object:" + this.propertiesFileName, e);
- } catch (JsonMappingException e) {
- LOGGER.debug("JsonMappingException when cloning the object:" + this.propertiesFileName, e);
- } catch (IOException e) {
- LOGGER.debug("IOException when cloning the object:" + this.propertiesFileName, e);
- }
-
- msoCopy.propertiesFileName = this.propertiesFileName;
- msoCopy.automaticRefreshInMinutes = this.automaticRefreshInMinutes;
- return msoCopy;
- }
-
-
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((jsonRootNode == null) ? 0 : jsonRootNode.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- MsoJsonProperties other = (MsoJsonProperties) obj;
- if (jsonRootNode == null) {
- if (other.jsonRootNode != null)
- return false;
- } else if (!jsonRootNode.equals(other.jsonRootNode))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "Config file " + propertiesFileName + "(Timer:" + automaticRefreshInMinutes + "mins):" + System
- .getProperty("line.separator") + this.jsonRootNode.toString() + System.getProperty("line.separator")
- + System.getProperty("line.separator");
- }
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesException.java b/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesException.java
deleted file mode 100644
index 1563ca556c..0000000000
--- a/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesException.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.openecomp.mso.properties;
-
-
-/**
- * Exception during artifact installation.
- */
-public class MsoPropertiesException extends Exception {
-
- /**
- * serialization id.
- */
- private static final long serialVersionUID = 4095937499475915021L;
-
- /**
- * @param message The message to dump
- * @param cause The Throwable cause object
- */
- public MsoPropertiesException (final String message) {
- super (message);
-
- }
-
- /**
- * @param message The message to dump
- * @param cause The Throwable cause object
- */
- public MsoPropertiesException (final String message, final Throwable cause) {
- super (message, cause);
-
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesFactory.java b/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesFactory.java
deleted file mode 100644
index 3f81734796..0000000000
--- a/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesFactory.java
+++ /dev/null
@@ -1,395 +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.openecomp.mso.properties;
-
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import javax.ejb.ConcurrencyManagement;
-import javax.ejb.ConcurrencyManagementType;
-import javax.ejb.LocalBean;
-import javax.ejb.Schedule;
-import javax.ejb.Singleton;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Response;
-
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.utils.CryptoUtils;
-
-/**
- * This EJB Singleton class returns an instance of the mso properties for a specified file.
- * This class can handle many config at the same time and is thread safe.
- * This instance is a copy of the one cached so it can be modified or reloaded without impacting the others class using
- * it.
- * The mso properties files loaded and cached here will be reloaded every X second (it's configurable with the init
- * method)
- * This class can be used as an EJB or can be instantiated directly as long as the EJB has been initialized for the current
- * module. Locks are made manually and not using EJB locks to allow this.
- *
- *
- */
-@Singleton(name = "MsoPropertiesFactory")
-@ConcurrencyManagement(ConcurrencyManagementType.BEAN)
-@LocalBean
-@Path("/properties")
-public class MsoPropertiesFactory implements Serializable {
-
- private static final long serialVersionUID = 4365495305496742113L;
-
- protected static String prefixMsoPropertiesPath = System.getProperty ("mso.config.path");
-
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
-
- // Keep a static copy of properties for global usage
- private static final ConcurrentHashMap <String, MsoPropertiesParameters> msoPropertiesCache;
-
- static {
- if (prefixMsoPropertiesPath == null) {
- // Hardcode if nothing is received
- prefixMsoPropertiesPath = "";
- }
- msoPropertiesCache = new ConcurrentHashMap<>();
- }
-
- private static final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock ();
-
- public MsoPropertiesFactory () {
-
- }
-
- private boolean isJsonFile(String propertiesFilePath) {
- return propertiesFilePath.endsWith(".json");
- }
-
-
- private boolean isJavaPropertiesFile (String propertiesFilePath) {
- return propertiesFilePath.endsWith(".properties");
- }
-
- private MsoPropertiesParameters createObjectType (MsoPropertiesParameters msoPropParams, String propertiesFilePath) throws MsoPropertiesException, IOException {
-
- try {
- if (this.isJavaPropertiesFile(propertiesFilePath)) {
-
- msoPropParams.msoProperties = new MsoJavaProperties();
- msoPropParams.msoPropertiesType = MsoPropertiesParameters.MsoPropertiesType.JAVA_PROP;
- } else if (this.isJsonFile(propertiesFilePath)) {
-
- msoPropParams.msoProperties = new MsoJsonProperties();
- msoPropParams.msoPropertiesType = MsoPropertiesParameters.MsoPropertiesType.JSON_PROP;
- } else {
- throw new MsoPropertiesException("Unable to load the MSO properties file because format is not recognized (only .json or .properties): " + propertiesFilePath);
- }
-
- msoPropParams.msoProperties.loadPropertiesFile (propertiesFilePath);
-
- return msoPropParams;
- } finally {
- if (msoPropParams.msoProperties!=null) {
- msoPropParams.refreshCounter = msoPropParams.msoProperties.getAutomaticRefreshInMinutes();
- }
- }
-
- }
-
- /**
- * This method is used to create a MsoProperties file cache and factory.
- * The ID is kept in cache even if the config fails to be loaded.
- * This is used to maintain the config ID until someone fixes the config file.
- *
- * @param msoPropertiesID A string representing the key of the config
- * @param propertiesFilePath The mso properties file to load
- *
- * @throws MsoPropertiesException In case of issues with the mso properties loading
- *
- * @see MsoPropertiesFactory#getMsoJavaProperties()
- * @see MsoPropertiesFactory#getMsoJsonProperties()
- */
- public void initializeMsoProperties (String msoPropertiesID,
- String propertiesFilePath) throws MsoPropertiesException {
-
- rwl.writeLock ().lock ();
-
- String msoPropPath="none";
- MsoPropertiesParameters msoPropertiesParams=new MsoPropertiesParameters();
- try {
- msoPropPath = prefixMsoPropertiesPath + propertiesFilePath;
- if (msoPropertiesCache.get (msoPropertiesID) != null) {
- throw new MsoPropertiesException ("The factory contains already an instance of this mso properties: "
- + msoPropPath);
- }
- // Create the global MsoProperties object
- msoPropertiesParams = createObjectType(msoPropertiesParams, msoPropPath);
-
- } catch (FileNotFoundException e) {
- throw new MsoPropertiesException ("Unable to load the MSO properties file because it has not been found:"
- + msoPropPath, e);
-
- } catch (IOException e) {
- throw new MsoPropertiesException ("Unable to load the MSO properties file because IOException occurs: "
- + msoPropPath, e);
- } finally {
- // put it in all cases, just to not forget about him and attempt a default reload
- msoPropertiesCache.put (msoPropertiesID, msoPropertiesParams);
- rwl.writeLock ().unlock ();
- }
- }
-
- public void removeMsoProperties (String msoPropertiesID) throws MsoPropertiesException {
-
- rwl.writeLock ().lock ();
- try {
- if (MsoPropertiesFactory.msoPropertiesCache.remove (msoPropertiesID) == null) {
- throw new MsoPropertiesException ("Mso properties not found in cache:" + msoPropertiesID);
- }
- } finally {
- rwl.writeLock ().unlock ();
- }
- }
-
- /**
- * This method clears all the configs in cache, the factory will then be free of any config.
- *
- * @see MsoPropertiesFactory#initializeMsoProperties(String, String)
- */
- public void removeAllMsoProperties () {
-
- rwl.writeLock ().lock ();
- try {
- MsoPropertiesFactory.msoPropertiesCache.clear ();
- } finally {
- rwl.writeLock ().unlock ();
- }
- }
-
- /**
- * THis method can be used to change the file and timer fields of an existing MSO properties file.
- *
- * @param msoPropertiesID The MSO properties ID
- * @param newMsoPropPath The new file Path
- * @throws MsoPropertiesException In case of the MSO Properties is not found in cache
- */
- public void changeMsoPropertiesFilePath (String msoPropertiesID,
- String newMsoPropPath) throws MsoPropertiesException {
-
- rwl.writeLock ().lock ();
- try {
- MsoPropertiesParameters msoPropInCache = MsoPropertiesFactory.msoPropertiesCache.get (msoPropertiesID);
-
- if (msoPropInCache != null) {
- msoPropInCache.msoProperties.propertiesFileName = prefixMsoPropertiesPath + newMsoPropPath;
-
- } else {
- throw new MsoPropertiesException ("Mso properties not found in cache:" + msoPropertiesID);
- }
- } finally {
- rwl.writeLock ().unlock ();
- }
- }
-
- private AbstractMsoProperties getAndCloneProperties(String msoPropertiesID, MsoPropertiesParameters.MsoPropertiesType type) throws MsoPropertiesException {
- rwl.readLock ().lock ();
- try {
- MsoPropertiesParameters msoPropInCache = MsoPropertiesFactory.msoPropertiesCache.get (msoPropertiesID);
- if (msoPropInCache == null) {
- throw new MsoPropertiesException ("Mso properties not found in cache:" + msoPropertiesID);
- } else {
- if (type.equals(msoPropInCache.msoPropertiesType)) {
- return msoPropInCache.msoProperties.clone ();
- } else {
- throw new MsoPropertiesException ("Mso properties is not "+type.name()+" properties type:" + msoPropertiesID);
- }
-
- }
- } finally {
- rwl.readLock ().unlock ();
- }
- }
-
- /**
- * Get the MSO Properties (As Java Properties) as a copy of the mso properties cache.
- * The object returned can therefore be modified.
- *
- * @return A copy of the mso properties, properties class can be empty if the file has not been read properly
- * @throws MsoPropertiesException If the mso properties does not exist in the cache
- */
- public MsoJavaProperties getMsoJavaProperties (String msoPropertiesID) throws MsoPropertiesException {
-
- return (MsoJavaProperties)getAndCloneProperties(msoPropertiesID,MsoPropertiesParameters.MsoPropertiesType.JAVA_PROP);
- }
-
- /**
- * Get the MSO Properties (As JSON Properties) as a copy of the mso properties cache.
- * The object returned can therefore be modified.
- *
- * @return A copy of the mso properties, properties class can be empty if the file has not been read properly
- * @throws MsoPropertiesException If the mso properties does not exist in the cache
- */
- public MsoJsonProperties getMsoJsonProperties (String msoPropertiesID) throws MsoPropertiesException {
-
- return (MsoJsonProperties)getAndCloneProperties(msoPropertiesID,MsoPropertiesParameters.MsoPropertiesType.JSON_PROP);
- }
-
- /**
- * Get all MSO Properties as a copy of the mso properties cache.
- * The objects returned can therefore be modified.
- *
- * @return A List of copies of the mso properties, can be empty
- */
- public List <AbstractMsoProperties> getAllMsoProperties () {
-
- List <AbstractMsoProperties> resultList = new LinkedList<>();
- rwl.readLock ().lock ();
- try {
-
- for (MsoPropertiesParameters msoProp:MsoPropertiesFactory.msoPropertiesCache.values ()) {
- resultList.add(msoProp.msoProperties.clone());
- }
- return resultList;
-
- } finally {
- rwl.readLock ().unlock ();
- }
-
- }
-
- /**
- * This method is not intended to be called, it's used to refresh the config automatically
- *
- * @return true if Properties have been reloaded, false otherwise
- */
- @Schedule(minute = "*/1", hour = "*", persistent = false)
- public boolean reloadMsoProperties () {
- AbstractMsoProperties msoPropInCache = null;
- try {
- if (!rwl.writeLock ().tryLock () && !rwl.writeLock ().tryLock (30L, TimeUnit.SECONDS)) {
- LOGGER.debug ("Busy write lock on mso properties factory, skipping the reloading");
- return false;
- }
- } catch (InterruptedException e1) {
- LOGGER.debug ("Interrupted while trying to acquire write lock on mso properties factory, skipping the reloading");
- Thread.currentThread ().interrupt ();
- return false;
- }
- try {
- for (Entry <String, MsoPropertiesParameters> entryMsoPropTimer : MsoPropertiesFactory.msoPropertiesCache.entrySet ()) {
-
- if (entryMsoPropTimer.getValue ().refreshCounter <= 1) {
- // It's time to reload the config
- msoPropInCache = MsoPropertiesFactory.msoPropertiesCache.get (entryMsoPropTimer.getKey ()).msoProperties;
- try {
- AbstractMsoProperties oldProps = msoPropInCache.clone ();
- msoPropInCache.reloadPropertiesFile ();
- entryMsoPropTimer.getValue().refreshCounter=entryMsoPropTimer.getValue().msoProperties.getAutomaticRefreshInMinutes();
-
- if (!msoPropInCache.equals (oldProps)) {
- LOGGER.info (MessageEnum.LOAD_PROPERTIES_SUC, msoPropInCache.getPropertiesFileName (), "", "");
- }
- } catch (FileNotFoundException ef) {
- LOGGER.error (MessageEnum.NO_PROPERTIES, msoPropInCache.propertiesFileName, "", "", MsoLogger.ErrorCode.PermissionError, "", ef);
- } catch (Exception e) {
- LOGGER.error (MessageEnum.LOAD_PROPERTIES_FAIL, msoPropInCache.propertiesFileName, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "", e);
- }
-
- } else {
- --entryMsoPropTimer.getValue().refreshCounter;
- }
- }
- return true;
- } catch (Exception e) {
- LOGGER.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Global issue while reloading", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "", e);
- return false;
- } finally {
- rwl.writeLock ().unlock ();
- }
- }
-
- /**
- * This method can be used to known if the MSO properties instance hold is different from the one in cache
- *
- * @param msoPropertiesID The MSO properties ID
- * @param oldMsoProperties The MSO Properties instance that must be compared to
- * @return True if they are the same, false otherwise
- * @throws MsoPropertiesException
- */
- public boolean propertiesHaveChanged (String msoPropertiesID, AbstractMsoProperties oldMsoProperties) throws MsoPropertiesException {
- rwl.readLock ().lock ();
- try {
- if (MsoPropertiesFactory.msoPropertiesCache.get (msoPropertiesID) == null) {
- throw new MsoPropertiesException ("Mso properties not found in cache:" + msoPropertiesID);
- }
-
- AbstractMsoProperties msoPropInCache = MsoPropertiesFactory.msoPropertiesCache.get (msoPropertiesID).msoProperties;
- if (oldMsoProperties != null) {
- return !oldMsoProperties.equals (msoPropInCache);
- } else {
- return msoPropInCache != null;
- }
- } finally {
- rwl.readLock ().unlock ();
- }
- }
-
- @GET
- @Path("/show")
- @Produces("text/plain")
- public Response showProperties () {
-
- List <AbstractMsoProperties> listMsoProp = this.getAllMsoProperties ();
- StringBuffer response = new StringBuffer ();
-
- if (listMsoProp.isEmpty ()) {
- response.append ("No file defined");
- }
-
- for (AbstractMsoProperties properties : listMsoProp) {
-
- response.append(properties.toString());
- }
-
- return Response.status (200).entity (response).build ();
- }
-
- @GET
- @Path("/encrypt/{value}/{cryptKey}")
- @Produces("text/plain")
- public Response encryptProperty (@PathParam("value") String value, @PathParam("cryptKey") String cryptKey) {
- try {
- String encryptedValue = CryptoUtils.encrypt (value, cryptKey);
- return Response.status (200).entity (encryptedValue).build ();
- } catch (Exception e) {
- LOGGER.error (MessageEnum.GENERAL_EXCEPTION_ARG, "Encryption error", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Error in encrypting property", e);
- return Response.status (500).entity (e.getMessage ()).build ();
- }
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoPropertyInitializer.java b/common/src/main/java/org/openecomp/mso/properties/MsoPropertyInitializer.java
deleted file mode 100644
index 8490ff8afa..0000000000
--- a/common/src/main/java/org/openecomp/mso/properties/MsoPropertyInitializer.java
+++ /dev/null
@@ -1,87 +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.openecomp.mso.properties;
-
-
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-import javax.servlet.annotation.WebListener;
-
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * This class will attempt to initialize MSO Properties when part of a web application.
- * It will look for the configuration file mso.properties in the
- * following order:
- * 1. In an init-param "mso.configuration" in web.xml
- * 2. In a system property "mso.configuration"
- * 3. In the default location "/etc/ecomp/mso/config/mso.properties"
- *
- * If all else fails, the MSO Properties will go uninitialized, and will
- * attempt to use the default constructors within the MsoProperties class.
- *
- *
- */
-@WebListener
-public class MsoPropertyInitializer implements ServletContextListener
-{
-
- private MsoPropertiesFactory msoPropertiesFactory=new MsoPropertiesFactory();
-
- public MsoPropertyInitializer () {
- }
-
- @Override
- public void contextDestroyed(ServletContextEvent event) {
- // Nothing to do...
- }
-
-
- @Override
- public void contextInitialized(ServletContextEvent event)
- {
-
- // Note - this logger may be before or after MSO Logging configuration applied
- MsoLogger initLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
- try {
- // Look first in the init-parameters
- String msoPropConfigParam = event.getServletContext().getInitParameter("mso.configuration");
- if (msoPropConfigParam != null && !msoPropConfigParam.isEmpty() ) {
- String[] configFileSplit = msoPropConfigParam.split(",");
- for (String msoPropConfig:configFileSplit) {
- String[] msoPropDecoded = msoPropConfig.split("=");
-
- try {
- msoPropertiesFactory.initializeMsoProperties(msoPropDecoded[0], msoPropDecoded[1]);
- initLogger.info(MessageEnum.LOAD_PROPERTIES_SUC, msoPropDecoded[1], "", "");
- initLogger.debug("Mso properties successfully loaded:"+msoPropDecoded[1]+",ID:"+msoPropDecoded[0]+")");
- } catch (MsoPropertiesException e) {
- initLogger.error(MessageEnum.LOAD_PROPERTIES_FAIL, msoPropDecoded[1] + ". MSO Properties failed due to an mso properties exception", "", "", MsoLogger.ErrorCode.DataError, "Error in contextInitialized", e);
- }
- }
- }
- }
- catch (Exception e) {
- initLogger.error(MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. MSO Properties failed to initialize completely", "", "", MsoLogger.ErrorCode.DataError, "", e);
- }
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/utils/RootIgnoringJsonDeserializer.java b/common/src/main/java/org/openecomp/mso/utils/RootIgnoringJsonDeserializer.java
deleted file mode 100644
index 95f72c4dd4..0000000000
--- a/common/src/main/java/org/openecomp/mso/utils/RootIgnoringJsonDeserializer.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.openecomp.mso.utils;
-
-import java.io.IOException;
-import java.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonRootName;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * A JSON deserializer that ignores the root element if it is present.
- */
-public class RootIgnoringJsonDeserializer<T> extends JsonDeserializer<T> {
-
- private final ObjectMapper mapper = new ObjectMapper();
- private final Class<T> clazz;
- private final String jsonRootName;
-
- public RootIgnoringJsonDeserializer(Class<T> clazz) {
- this.clazz = clazz;
-
- JsonRootName annotation = clazz.getAnnotation(JsonRootName.class);
-
- if (annotation == null || annotation.value() == null || annotation.value().equals("")) {
- jsonRootName = clazz.getSimpleName();
- } else {
- jsonRootName = annotation.value();
- }
- }
-
- @Override
- public T deserialize(JsonParser jp, DeserializationContext dc)
- throws IOException, JsonProcessingException {
- JsonNode rootNode = jp.getCodec().readTree(jp);
- Map.Entry<String,JsonNode> field = rootNode.fields().next();
-
- if (jsonRootName.equals(field.getKey())) {
- rootNode = field.getValue();
- }
-
- return mapper.convertValue(rootNode, clazz);
- }
-} \ No newline at end of file
diff --git a/common/src/main/resources/Policy.properties b/common/src/main/resources/Policy.properties
index b5b38c465b..b82b7e4084 100644
--- a/common/src/main/resources/Policy.properties
+++ b/common/src/main/resources/Policy.properties
@@ -1,7 +1,7 @@
-HOST = https://mtanjvsgcvm02.nvp.cip.att.com:8081/pdp/api/getDecision
-CLIENT_AUTH = Basic bTAzNzQzOnBvbGljeVIwY2sk
-AUTHORIZATION = Basic dGVzdHBkcDphbHBoYTEyMw==
-ENVIRONMENT = TEST
-X_ECOMP_REQUESTID = 1234567h
-ECOMP_COMPONENT_NAME = MSO
+HOST = https://localhost:8081/pdp/api/getDecision
+CLIENT_AUTH = Basic bTAzNzQzOnBvbGljeVIwY2sk
+AUTHORIZATION = Basic dGVzdHBkcDphbHBoYTEyMw==
+ENVIRONMENT = TEST
+X_ECOMP_REQUESTID = 1234567h
+ECOMP_COMPONENT_NAME = MSO
ssl.key.store.password.key = javax.net.ssl.keyStorePassword \ No newline at end of file
diff --git a/common/src/main/resources/dmaap/default-consumer.properties b/common/src/main/resources/dmaap/default-consumer.properties
index 4d2ecce068..f19b64242d 100644
--- a/common/src/main/resources/dmaap/default-consumer.properties
+++ b/common/src/main/resources/dmaap/default-consumer.properties
@@ -10,7 +10,7 @@ SubContextPath=/events/
Protocol=http
MethodType=GET
contenttype=application/json
-host=http://olsd005.wnsnet.attws.com:3904
+host=http://localhost:3904
partition=MSO
maxBatchSize=100
maxAgeMs=250
diff --git a/common/src/main/resources/dmaap/default-publisher.properties b/common/src/main/resources/dmaap/default-publisher.properties
index af1b481165..6d9be7528d 100644
--- a/common/src/main/resources/dmaap/default-publisher.properties
+++ b/common/src/main/resources/dmaap/default-publisher.properties
@@ -10,7 +10,7 @@ SubContextPath=/events/
Protocol=http
MethodType=POST
contenttype=application/json
-host=http://olsd005.wnsnet.attws.com:3904
+host=http://localhost:3904
partition=MSO
maxBatchSize=100
maxAgeMs=250
diff --git a/common/src/main/resources/test b/common/src/main/resources/test
new file mode 100644
index 0000000000..7a8e433b1e
--- /dev/null
+++ b/common/src/main/resources/test
@@ -0,0 +1,159 @@
+
+ 1 <configuration debug="false" scan="true" scanPeriod="3 seconds">
+ 2 <!--<jmxConfigurator /> -->
+ 3 <!-- directory path for all other type logs -->
+ 4 <property name="logDir" value="/var/log/onap" />
+ 5 <property name="componentName" value="logging-demo"></property>
+ 6 <property name="subComponentName" value="demo"></property>
+ 7 <property name="logDirectory" value="${logDir}/${componentName}/${subComponentName}" /> 8
+ 9 <property name="generalLogName" value="error" />
+ 10 <property name="metricsLogName" value="metric" />
+ 11 <property name="auditLogName" value="audit" />
+ 12 <property name="debugLogName" value="debug" />
+ 13 <property name="queueSize" value="256" />
+ 14 <property name="maxFileSize" value="50MB" />
+ 15 <property name="maxHistory" value="30" />
+ 16 <property name="totalSizeCap" value="10GB" />
+ 17 <property name="pattern" value="%nopexception%logger|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%level|%replace(%replace(%replace(%message){'\t','\\\\t'}){'\n','\\\\n'}){'|','\\\\|'}|%replace(%replace(%replace(%mdc){'\t','\\\\t'}){'\n','\\\\n'}){'|','\\\\|'}|%replace(%replace(%replace(%rootException){'\t','\\\\t'}){'\n','\\\\n'}){'|','\\\\|'}|%replace(%replace(%replace(%marker){'\t','\\\\t'}){'\n','\\\\n'}){'|','\\\\|'}|%thread|%n"/>
+ 18 <!-- Example evaluator filter applied against console appender -->
+ 19 <appender class="ch.qos.logback.core.ConsoleAppender" name="STDOUT">
+ 20 <encoder>
+ 21 <pattern>${pattern}</pattern>
+ 22 </encoder>
+ 23 </appender>
+ 24 <!-- ============================================================================ -->
+ 25 <!-- EELF Appenders -->
+ 26 <!-- ============================================================================ -->
+ 27 <!-- The EELFAppender is used to record events to the general application
+ 28 log -->
+ 29 <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="EELF">
+ 30 <file>${logDirectory}/${generalLogName}.log</file>
+ 31 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ 32 <fileNamePattern>${logDirectory}/${generalLogName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ 33 <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+ 34 <maxFileSize>${maxFileSize}</maxFileSize>
+ 35 </timeBasedFileNamingAndTriggeringPolicy>
+ 36 <maxHistory>${maxHistory}</maxHistory>
+ 37 <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ 38 </rollingPolicy>
+ 39 <encoder>
+ 40 <pattern>${pattern}</pattern>
+ 41 </encoder>
+ 42 </appender>
+ 43 <appender class="ch.qos.logback.classic.AsyncAppender" name="asyncEELF">
+ 44 <!-- deny all events with a level below INFO, that is TRACE and DEBUG -->
+ 45 <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ 46 <level>INFO</level>
+ 47 </filter>
+ 48 <queueSize>${queueSize}</queueSize>
+ 49 <appender-ref ref="EELF" />
+ 50 </appender>
+ 51 <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="EELFAudit">
+ 52 <file>${logDirectory}/${auditLogName}.log</file>
+ 53 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ 54 <fileNamePattern>${logDirectory}/${auditLogName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ 55 <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+ 56 <maxFileSize>${maxFileSize}</maxFileSize>
+ 57 </timeBasedFileNamingAndTriggeringPolicy>
+ 58 <maxHistory>${maxHistory}</maxHistory>
+ 59 <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ 60 </rollingPolicy>
+ 61 <encoder>
+ 62 <pattern>${pattern}</pattern>
+ 63 </encoder>
+ 64 </appender>
+ 65 <appender class="ch.qos.logback.classic.AsyncAppender" name="asyncEELFAudit">
+ 66 <queueSize>${queueSize}</queueSize>
+ 67 <appender-ref ref="EELFAudit" />
+ 68 </appender>
+ 69 <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="EELFMetrics">
+ 70 <file>${logDirectory}/${metricsLogName}.log</file>
+ 71 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ 72 <fileNamePattern>${logDirectory}/${metricsLogName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ 73 <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+ 74 <maxFileSize>${maxFileSize}</maxFileSize>
+ 75 </timeBasedFileNamingAndTriggeringPolicy>
+ 76 <maxHistory>${maxHistory}</maxHistory>
+ 77 <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ 78 </rollingPolicy>
+ 79 <encoder>
+ 80 <pattern>${pattern}</pattern>
+ 81 </encoder>
+ 82 </appender>
+ 83 <appender class="ch.qos.logback.classic.AsyncAppender" name="asyncEELFMetrics">
+ 84 <queueSize>${queueSize}</queueSize>
+ 85 <appender-ref ref="EELFMetrics" />
+ 86 </appender>
+ 87 <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="EELFDebug">
+ 88 <file>${logDirectory}/${debugLogName}.log</file>
+ 89 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ 90 <fileNamePattern>${logDirectory}/${debugLogName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ 91 <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+ 92 <maxFileSize>${maxFileSize}</maxFileSize>
+ 93 </timeBasedFileNamingAndTriggeringPolicy>
+ 94 <maxHistory>${maxHistory}</maxHistory>
+ 95 <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ 96 </rollingPolicy>
+ 97 <encoder>
+ 98 <pattern>${pattern}</pattern>
+ 99 </encoder>
+ 100 </appender>
+ 101 <appender class="ch.qos.logback.classic.AsyncAppender" name="asyncEELFDebug">
+ 102 <queueSize>${queueSize}</queueSize>
+ 103 <appender-ref ref="EELFDebug" />
+ 104 <includeCallerData>true</includeCallerData>
+ 105 </appender>
+ 106 <!-- ============================================================================ -->
+ 107 <!-- EELF loggers -->
+ 108 <!-- ============================================================================ -->
+ 109 <logger additivity="false" level="info" name="com.att.eelf">
+ 110 <appender-ref ref="asyncEELF" />
+ 111 <appender-ref ref="asyncEELFDebug" />
+ 112 </logger>
+ 113 <logger additivity="false" level="info" name="com.att.eelf.security">
+ 114 <appender-ref ref="asyncEELFSecurity" />
+ 115 </logger>
+ 116 <logger additivity="false" level="info" name="com.att.eelf.perf">
+ 117 <appender-ref ref="asyncEELFPerformance" />
+ 118 </logger>
+ 119 <logger additivity="false" level="info" name="com.att.eelf.server">
+ 120 <appender-ref ref="asyncEELFServer" />
+ 121 </logger>
+ 122 <logger additivity="false" level="info" name="com.att.eelf.policy">
+ 123 <appender-ref ref="asyncEELFPolicy" />
+ 124 </logger>
+ 125 <logger additivity="false" level="info" name="com.att.eelf.audit">
+ 126 <appender-ref ref="asyncEELFAudit" />
+ 127 </logger>
+ 128 <logger additivity="false" level="info" name="com.att.eelf.metrics">
+ 129 <appender-ref ref="asyncEELFMetrics" />
+ 130 </logger>
+ 131 <!-- Spring related loggers -->
+ 132 <logger level="WARN" name="org.springframework" />
+ 133 <logger level="WARN" name="org.springframework.beans" />
+ 134 <logger level="WARN" name="org.springframework.web" />
+ 135 <logger level="WARN" name="com.blog.spring.jms" />
+ 136 <logger level="INFO" name="com.att" />
+ 137 <!-- Other Loggers that may help troubleshoot -->
+ 138 <logger level="WARN" name="net.sf" />
+ 139 <logger level="WARN" name="org.apache.commons.httpclient" />
+ 140 <logger level="WARN" name="org.apache.commons" />
+ 141 <logger level="WARN" name="org.apache.coyote" />
+ 142 <logger level="WARN" name="org.apache.jasper" />
+ 143 <!-- Camel Related Loggers (including restlet/servlet/jaxrs/cxf logging.
+ 144 May aid in troubleshooting) -->
+ 145 <logger level="WARN" name="org.apache.camel" />
+ 146 <logger level="WARN" name="org.apache.cxf" />
+ 147 <logger level="WARN" name="org.apache.camel.processor.interceptor" />
+ 148 <logger level="WARN" name="org.apache.cxf.jaxrs.interceptor" />
+ 149 <logger level="WARN" name="org.apache.cxf.service" />
+ 150 <logger level="WARN" name="org.restlet" />
+ 151 <logger level="WARN" name="org.apache.camel.component.restlet" />
+ 152 <!-- logback internals logging -->
+ 153 <logger level="WARN" name="ch.qos.logback.classic" />
+ 154 <logger level="WARN" name="ch.qos.logback.core" />
+ 155 <root>
+ 156 <appender-ref ref="asyncEELF" />
+ 157 <!-- <appender-ref ref="asyncEELFDebug" /> -->
+ 158 </root>
+ 159 </configuration>
diff --git a/common/src/test/java/org/onap/so/BeansTest.java b/common/src/test/java/org/onap/so/BeansTest.java
new file mode 100644
index 0000000000..2e825cf8c7
--- /dev/null
+++ b/common/src/test/java/org/onap/so/BeansTest.java
@@ -0,0 +1,97 @@
+/*-
+ * ============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;
+
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.onap.so.openpojo.rules.HasAnnotationMatcher.hasAnnotation;
+import static org.onap.so.openpojo.rules.HasAnnotationPropertyWithValueMatcher.hasAnnotationPropertyWithValue;
+
+import javax.persistence.Column;
+import javax.persistence.Temporal;
+
+import org.junit.Test;
+import org.onap.so.openpojo.rules.CustomSetterMustExistRule;
+import org.onap.so.openpojo.rules.EqualsAndHashCodeTester;
+import org.onap.so.openpojo.rules.HasEqualsAndHashCodeRule;
+import org.onap.so.openpojo.rules.HasToStringRule;
+import org.onap.so.openpojo.rules.ToStringTester;
+
+import com.openpojo.reflection.PojoClass;
+import com.openpojo.reflection.PojoClassFilter;
+import com.openpojo.reflection.filters.FilterEnum;
+import com.openpojo.reflection.filters.FilterNonConcrete;
+import com.openpojo.reflection.filters.FilterPackageInfo;
+import com.openpojo.validation.Validator;
+import com.openpojo.validation.ValidatorBuilder;
+import com.openpojo.validation.rule.impl.BusinessKeyMustExistRule;
+import com.openpojo.validation.rule.impl.GetterMustExistRule;
+import com.openpojo.validation.rule.impl.NoNestedClassRule;
+import com.openpojo.validation.rule.impl.NoPrimitivesRule;
+import com.openpojo.validation.rule.impl.NoPublicFieldsExceptStaticFinalRule;
+import com.openpojo.validation.rule.impl.NoStaticExceptFinalRule;
+import com.openpojo.validation.rule.impl.SerializableMustHaveSerialVersionUIDRule;
+import com.openpojo.validation.test.impl.GetterTester;
+import com.openpojo.validation.test.impl.SetterTester;
+
+
+public class BeansTest {
+
+ private PojoClassFilter filterTestClasses = new FilterTestClasses();
+
+ private PojoClassFilter enumFilter = new FilterEnum();
+
+
+
+ @Test
+ public void pojoStructure() {
+ test("org.onap.so.client.aai.objects");
+ test("org.onap.so.client.policy.entities");
+ test("org.onap.so.client.grm.beans");
+ test("org.onap.so.client.ruby.beans");
+ test("org.onap.so.client.sdno.beans");
+ test("org.onap.so.entity");
+ test("org.onap.so.serviceinstancebeans");
+ }
+
+ private void test(String pojoPackage) {
+ Validator validator = ValidatorBuilder.create()
+ .with(new GetterMustExistRule())
+ .with(new NoNestedClassRule())
+ .with(new NoStaticExceptFinalRule())
+ .with(new SerializableMustHaveSerialVersionUIDRule())
+ .with(new NoPublicFieldsExceptStaticFinalRule())
+ .with(new SetterTester())
+ .with(new GetterTester())
+
+
+
+ .build();
+
+
+ validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses,enumFilter,new FilterNonConcrete());
+ }
+ private static class FilterTestClasses implements PojoClassFilter {
+ public boolean include(PojoClass pojoClass) {
+ return !pojoClass.getSourcePath().contains("/test-classes/");
+ }
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/CryptoTest.java b/common/src/test/java/org/onap/so/adapter_utils/tests/CryptoTest.java
index 3415420c88..15368f9966 100644
--- a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/CryptoTest.java
+++ b/common/src/test/java/org/onap/so/adapter_utils/tests/CryptoTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapter_utils.tests;
+package org.onap.so.adapter_utils.tests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -30,7 +30,7 @@ import java.security.GeneralSecurityException;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.openecomp.mso.utils.CryptoUtils;
+import org.onap.so.utils.CryptoUtils;
/**
* This class implements all test methods of the CryptoUtils features.
@@ -74,6 +74,10 @@ public class CryptoTest {
assertEquals(encodeString,encode2String);
assertEquals(CryptoUtils.decrypt(encodeString, testKey),CryptoUtils.decrypt(encode2String, testKey));
+
+ encodeString = CryptoUtils.encryptCloudConfigPassword(testData);
+
+ assertEquals(testData, CryptoUtils.decryptCloudConfigPassword(encodeString));
}
}
diff --git a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoAlarmLoggerTest.java b/common/src/test/java/org/onap/so/adapter_utils/tests/MsoAlarmLoggerTest.java
index f7d27acaf3..6756bc98ad 100644
--- a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoAlarmLoggerTest.java
+++ b/common/src/test/java/org/onap/so/adapter_utils/tests/MsoAlarmLoggerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapter_utils.tests;
+package org.onap.so.adapter_utils.tests;
import static org.junit.Assert.assertNull;
@@ -31,40 +31,43 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.onap.so.logger.MsoAlarmLogger;
-import org.openecomp.mso.logger.MsoAlarmLogger;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
/**
* This junit test very roughly the alarm logger
*
*/
public class MsoAlarmLoggerTest {
-
- public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+
public static MsoAlarmLogger msoAlarmLogger;
@BeforeClass
- public static final void createObjects() throws MsoPropertiesException
+ public static final void createObjects() throws IOException
{
- File outputFile = new File ("target/alarm-test.log");
+ File outputFile = new File ("./target/alarm-test.log");
if (outputFile.exists()) {
outputFile.delete();
+ } else {
+ outputFile.createNewFile();
}
- msoAlarmLogger = new MsoAlarmLogger("target/alarm-test.log");
+ msoAlarmLogger = new MsoAlarmLogger("./target/alarm-test.log");
}
+ @AfterClass
+ public static void tearDown() {
+ msoAlarmLogger.resetAppender();
+ }
@Test
- public void testAlarmConfig() throws MsoPropertiesException, IOException {
+ public void testAlarmConfig() throws IOException {
msoAlarmLogger.sendAlarm("test", 0, "detail message");
- FileInputStream inputStream = new FileInputStream("target/alarm-test.log");
+ FileInputStream inputStream = new FileInputStream("./target/alarm-test.log");
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
String line = reader.readLine();
@@ -80,7 +83,7 @@ public class MsoAlarmLoggerTest {
inputStream.close();
// Reset the file for others tests
- PrintWriter writer = new PrintWriter(new File("target/alarm-test.log"));
+ PrintWriter writer = new PrintWriter(new File("./target/alarm-test.log"));
writer.print("");
writer.close();
@@ -93,7 +96,7 @@ public class MsoAlarmLoggerTest {
msoAlarmLogger.sendAlarm("test2", 1, "detail message2");
msoAlarmLogger.sendAlarm("test3", 2, "detail message3");
- FileInputStream inputStream = new FileInputStream("target/alarm-test.log");
+ FileInputStream inputStream = new FileInputStream("./target/alarm-test.log");
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
String line = reader.readLine();
@@ -123,7 +126,7 @@ public class MsoAlarmLoggerTest {
inputStream.close();
// Reset the file for others tests
- PrintWriter writer = new PrintWriter(new File("target/alarm-test.log"));
+ PrintWriter writer = new PrintWriter(new File("./target/alarm-test.log"));
writer.print("");
writer.close();
diff --git a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java b/common/src/test/java/org/onap/so/adapter_utils/tests/MsoLoggerTest.java
index 6ac7002101..29ac91c864 100644
--- a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoLoggerTest.java
+++ b/common/src/test/java/org/onap/so/adapter_utils/tests/MsoLoggerTest.java
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapter_utils.tests;
+package org.onap.so.adapter_utils.tests;
-import org.openecomp.mso.entity.MsoRequest;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.logger.MsoLogger.ErrorCode;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.logger.MsoLogger.ErrorCode;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -50,7 +50,7 @@ import java.util.List;
*/
public class MsoLoggerTest {
- static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
+ static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, MsoLoggerTest.class);
/**
* This method is called before any test occurs. It creates a fake tree from
diff --git a/common/src/test/java/org/onap/so/client/RestClientTest.java b/common/src/test/java/org/onap/so/client/RestClientTest.java
new file mode 100644
index 0000000000..1443f04f3a
--- /dev/null
+++ b/common/src/test/java/org/onap/so/client/RestClientTest.java
@@ -0,0 +1,87 @@
+/*-
+ * ============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;
+
+import static org.mockito.Matchers.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.net.MalformedURLException;
+import java.net.SocketTimeoutException;
+
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriBuilderException;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.utils.TargetEntity;
+
+@RunWith(MockitoJUnitRunner.class)
+public class RestClientTest {
+
+
+ @Mock
+ private RestProperties props;
+
+
+ @Test
+ public void retries() throws Exception {
+ RestClient spy = buildSpy();
+ RestRequest mockCallable = mock(RestRequest.class);
+ when(mockCallable.call()).thenThrow(new WebApplicationException(new SocketTimeoutException()));
+ doReturn(mockCallable).when(spy).buildRequest(any(String.class), any(Object.class));
+ try {
+ spy.get();
+ } catch (Exception e) {
+ //we expect an exception, ignore it
+ }
+ verify(mockCallable, times(3)).call();
+
+ }
+
+ @Test
+ public void exceptionDoNotRetry() throws Exception {
+ RestClient spy = buildSpy();
+ RestRequest mockCallable = mock(RestRequest.class);
+ when(mockCallable.call()).thenThrow(new WebApplicationException(new NotFoundException()));
+ doReturn(mockCallable).when(spy).buildRequest(any(String.class), any(Object.class));
+ try {
+ spy.get();
+ } catch (Exception e) {
+ //we expect an exception, ignore it
+ }
+ verify(mockCallable, times(1)).call();
+
+ }
+ private RestClient buildSpy() throws MalformedURLException, IllegalArgumentException, UriBuilderException {
+ RestClient client = new HttpClient(UriBuilder.fromUri("http://localhost/test").build().toURL(), "application/json", TargetEntity.BPMN);
+
+ return spy(client);
+ }
+}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIClientResponseExceptionMapperTest.java b/common/src/test/java/org/onap/so/client/aai/AAIClientResponseExceptionMapperTest.java
new file mode 100644
index 0000000000..981a4ddacc
--- /dev/null
+++ b/common/src/test/java/org/onap/so/client/aai/AAIClientResponseExceptionMapperTest.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.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/common/src/test/java/org/onap/so/client/aai/AAIConfigurationClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIConfigurationClientTest.java
new file mode 100644
index 0000000000..40410019f0
--- /dev/null
+++ b/common/src/test/java/org/onap/so/client/aai/AAIConfigurationClientTest.java
@@ -0,0 +1,181 @@
+/*-
+ * ============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.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.util.Optional;
+import java.util.UUID;
+
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.client.aai.entities.Configuration;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+@RunWith(MockitoJUnitRunner.class)
+public class AAIConfigurationClientTest {
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8443));
+
+ @Mock
+ AAIResourcesClient aaiClient;
+
+ @InjectMocks
+ AAIConfigurationClient aaiConfigurationClient = new AAIConfigurationClient();
+
+ @Test
+ public void verifyCreate() {
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelInvariantId("testInvariantID");
+ modelInfo.setModelVersionId("testVersionID");
+ modelInfo.setModelCustomizationId("testCustomizationID");
+
+ RequestDetails requestDetails = new RequestDetails();
+ requestDetails.setModelInfo(modelInfo);
+
+ String configurationId = UUID.randomUUID().toString();
+ String configurationType = "test";
+ String configurationSubType = "test";
+
+ // Test Create Configuration
+ doNothing().when(aaiClient).create(isA(AAIResourceUri.class), isA(Object.class));
+ aaiConfigurationClient.createConfiguration(requestDetails, configurationId, configurationType, configurationSubType);
+ verify(aaiClient, times(1)).create(isA(AAIResourceUri.class), isA(Object.class));
+ }
+
+ @Test
+ public void verifyConfigurePayload() {
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelInvariantId("testInvariantID");
+ modelInfo.setModelVersionId("testVersionID");
+ modelInfo.setModelCustomizationId("testCustomizationID");
+
+ RequestDetails requestDetails = new RequestDetails();
+ requestDetails.setModelInfo(modelInfo);
+
+ String configurationId = UUID.randomUUID().toString();
+ String configurationType = "test";
+ String configurationSubType = "test";
+ AAIResourceUri uri = aaiConfigurationClient.getConfigurationURI(configurationId);
+
+ Configuration payload = aaiConfigurationClient.configurePayload(requestDetails, configurationId, configurationType, configurationSubType);
+
+ assertEquals(configurationId, payload.getConfigurationId());
+ assertEquals(configurationType, payload.getConfigurationType());
+ assertEquals(configurationSubType, payload.getConfigurationSubType());
+ assertEquals(uri.build().getPath(), payload.getConfigurationSelflink());
+ assertEquals("PreCreated", payload.getOrchestrationStatus());
+ assertEquals("", payload.getOperationalStatus());
+ assertEquals(modelInfo.getModelVersionId(), payload.getModelVersionId());
+ assertEquals(modelInfo.getModelInvariantId(), payload.getModelInvariantId());
+ assertEquals(modelInfo.getModelCustomizationId(), payload.getModelCustomizationId());
+ }
+
+ @Test
+ public void testDeleteConfiguration() {
+ String uuid = UUID.randomUUID().toString();
+ doNothing().when(aaiClient).delete(isA(AAIResourceUri.class));
+ aaiConfigurationClient.deleteConfiguration(uuid);
+ verify(aaiClient, times(1)).delete(aaiConfigurationClient.getConfigurationURI(uuid));
+ }
+
+ @Test
+ public void testUpdateOrchestrationStatus() {
+ String uuid = UUID.randomUUID().toString();
+ doNothing().when(aaiClient).update(isA(AAIResourceUri.class), isA(Object.class));
+ aaiConfigurationClient.updateOrchestrationStatus(uuid, "testPayload");
+ verify(aaiClient, times(1)).update(aaiConfigurationClient.getConfigurationURI(uuid), "testPayload");
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testGetConfiguration() {
+ String uuid = UUID.randomUUID().toString();
+ Optional<Configuration> expectedConfiguration = Optional.of(new Configuration());
+ expectedConfiguration.get().setConfigurationId(uuid);
+
+ doReturn(expectedConfiguration).when(aaiClient).get(isA(Class.class), isA(AAIResourceUri.class));
+ Configuration actualConfiguration = aaiConfigurationClient.getConfiguration(uuid);
+ verify(aaiClient, times(1)).get(Configuration.class, aaiConfigurationClient.getConfigurationURI(uuid));
+ assertEquals(expectedConfiguration.get(), actualConfiguration);
+ }
+
+ @Test
+ public void testConfigurationExists() {
+ String uuid = UUID.randomUUID().toString();
+ AAIResourceUri uri = aaiConfigurationClient.getConfigurationURI(uuid);
+ boolean expectedResult;
+ boolean actualResult;
+
+ expectedResult = true;
+ doReturn(expectedResult).when(aaiClient).exists(isA(AAIResourceUri.class));
+ actualResult = aaiConfigurationClient.configurationExists(uuid);
+ assertEquals(expectedResult, actualResult);
+
+ expectedResult = false;
+ doReturn(expectedResult).when(aaiClient).exists(isA(AAIResourceUri.class));
+ actualResult = aaiConfigurationClient.configurationExists(uuid);
+ assertEquals(expectedResult, actualResult);
+
+ verify(aaiClient, times(2)).exists(uri);
+ }
+
+ @Test
+ public void testGetConfigurationURI() {
+ String uuid = UUID.randomUUID().toString();
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, uuid);
+ assertEquals(uri, aaiConfigurationClient.getConfigurationURI(uuid));
+ }
+
+ @Test
+ public void verifyNotExists() {
+ AAIUri path = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "test2");
+ wireMockRule.stubFor(get(
+ urlMatching("/aai/v[0-9]+" + path.build() + ".*"))
+ .willReturn(
+ aResponse()
+ .withHeader("Content-Type", "text/plain")
+ .withBody("hello")
+ .withStatus(404)));
+ boolean result = aaiConfigurationClient.configurationExists("test2");
+ assertEquals("path not found", false, result);
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIExceptionMapperTest.java b/common/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java
index 625e281792..bea927afa5 100644
--- a/common/src/test/java/org/openecomp/mso/client/aai/AAIExceptionMapperTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,9 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+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;
@@ -30,9 +31,11 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import org.openecomp.mso.client.aai.entities.AAIError;
+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 AAIExceptionMapperTest {
+public class AAIErrorFormatterTest {
@Mock private AAIError errorObj;
@@ -41,7 +44,7 @@ public class AAIExceptionMapperTest {
MockitoAnnotations.initMocks(this);
}
@Test
- public void nestedReplace() {
+ public void testFillInTemplateWithReplace() {
String error = "Error %1 on %2";
List<String> list = Arrays.asList("PUT", "hello %1");
AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj);
@@ -51,13 +54,35 @@ public class AAIExceptionMapperTest {
}
@Test
- public void noReplace() {
+ public void testFillInTemplateWithoutReplace() {
String error = "Error";
List<String> 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 testGetMessageNoParsable() {
+ errorObj.setRequestError(null);
+ AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj);
+ String result = formatter.getMessage();
+ assertEquals("equal", "no parsable error message found", result);
+ }
}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIObjectTypeTest.java b/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
index c8f6299d81..ce90ccdc0e 100644
--- a/common/src/test/java/org/openecomp/mso/client/aai/AAIObjectTypeTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,11 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
+import org.onap.so.client.aai.entities.uri.AAIUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
public class AAIObjectTypeTest {
@@ -36,4 +38,18 @@ public class AAIObjectTypeTest {
public void verifyRegularCase() {
assertEquals("default removed for tenant", "allotted-resource", AAIObjectType.ALLOTTED_RESOURCE.typeName());
}
+
+ @Test
+ public void instanceGroupObjectTypeTest() {
+ final String id = "test1";
+ AAIUri 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";
+ AAIUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, id);
+ assertEquals("/network/collections/collection/test1", aaiUri.build().toString());
+ }
}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java b/common/src/test/java/org/onap/so/client/aai/AAIPServerTest.java
index b6b01b384a..1e2e7471f1 100644
--- a/common/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIPServerTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import static org.junit.Assert.assertEquals;
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
new file mode 100644
index 0000000000..6e9c38517d
--- /dev/null
+++ b/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
@@ -0,0 +1,93 @@
+/*-
+ * ============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.assertNotNull;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.isA;
+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.util.Arrays;
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.aai.entities.CustomQuery;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.Format;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class AAIQueryClientTest {
+
+ @Mock
+ Response response;
+
+ @Mock
+ RestClient restClient;
+
+ @Spy
+ AAIQueryClient aaiQueryClient = new AAIQueryClient();
+
+ @Test
+ public void testQuery() {
+ List<AAIResourceUri> uris = Arrays.asList(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY));
+
+ Format format = Format.SIMPLE;
+ CustomQuery query = new CustomQuery(uris);
+
+ doReturn(restClient).when(aaiQueryClient).createClient(isA(AAIUri.class));
+ aaiQueryClient.query(format, query);
+ verify(aaiQueryClient, times(1)).createClient(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY).queryParam("format", format.toString()));
+ verify(restClient, times(1)).put(query, String.class);
+ }
+
+ @Test
+ public void testCreateClient() {
+ String depth = "testDepth";
+ AAISubgraphType subgraph = AAISubgraphType.STAR;
+
+ aaiQueryClient.depth(depth);
+ aaiQueryClient.nodesOnly();
+ aaiQueryClient.subgraph(subgraph);
+
+ AAIUri 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());
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
index c7cc549130..63f8f652ce 100644
--- a/common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
@@ -18,41 +18,52 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+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 org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+import org.junit.rules.ExpectedException;
+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.defaultproperties.DefaultAAIPropertiesImpl;
+import com.github.tomakehurst.wiremock.admin.NotFoundException;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
public class AAIResourcesClientTest {
-
-
+
@Rule
public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8443));
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
@Test
public void verifyNotExists() {
AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
wireMockRule.stubFor(get(
- urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString()))
+ urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build()))
.willReturn(
aResponse()
.withHeader("Content-Type", "text/plain")
.withBody("hello")
.withStatus(404)));
- AAIResourcesClient client = new AAIResourcesClient();
+ AAIResourcesClient client= createClient();
boolean result = client.exists(path);
assertEquals("path not found", false, result);
}
@@ -61,19 +72,19 @@ public class AAIResourcesClientTest {
public void verifyDelete() {
AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2");
wireMockRule.stubFor(get(
- urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString()))
+ 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().toString()))
+ urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build()))
.withQueryParam("resource-version", equalTo("1234"))
.willReturn(
aResponse()
.withStatus(204)));
- AAIResourcesClient client = new AAIResourcesClient();
+ AAIResourcesClient client= createClient();
client.delete(path);
}
@@ -88,7 +99,7 @@ public class AAIResourcesClientTest {
.withHeader("Content-Type", "application/json")
.withBodyFile("aai/resources/mockObject.json")
.withStatus(200)));
- AAIResourcesClient client = new AAIResourcesClient();
+ AAIResourcesClient client= createClient();
client.get(path);
}
@@ -97,15 +108,84 @@ public class AAIResourcesClientTest {
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().toString() + "/relationship-list/relationship"))
+ urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build() + "/relationship-list/relationship"))
.willReturn(
aResponse()
.withHeader("Content-Type", "application/json")
.withStatus(200)));
AAIResourceUri pathClone = path.clone();
- AAIResourcesClient client = new AAIResourcesClient();
+ AAIResourcesClient client= createClient();
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(post(
+ urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build() + "/relationship-list/relationship"))
+ .willReturn(
+ aResponse()
+ .withStatus(204)));
+
+ AAIResourceUri pathClone = path.clone();
+ AAIResourcesClient client= createClient();
+ 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= createClient();
+
+ 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= createClient();
+ 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= createClient();
+ thrown.expect(NotFoundException.class);
+ thrown.expectMessage(containsString(path.build() + " not found in A&AI"));
+ AAIResultWrapper result = client.get(path, NotFoundException.class);
+ }
+
+ private AAIResourcesClient createClient() {
+ AAIResourcesClient client = spy(new AAIResourcesClient());
+ doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties();
+ return client;
+ }
}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java
new file mode 100644
index 0000000000..f2e371c999
--- /dev/null
+++ b/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java
@@ -0,0 +1,124 @@
+/*-
+ * ============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.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.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 java.util.HashMap;
+
+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.runners.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.so.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+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 convertObjectToPatchFormatTest() throws URISyntaxException, JsonParseException, JsonMappingException, IOException {
+ AAIRestClient client = new AAIRestClient(props, new URI(""));
+ GenericVnf vnf = new GenericVnf();
+ vnf.setIpv4Loopback0Address("");
+ String result = client.convertObjectToPatchFormat(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 {
+ AAIRestClient client = new AAIRestClient(props, new URI(""));
+ String payload = "{\"ipv4-loopback0-address\":\"\"}";
+ String result = client.convertObjectToPatchFormat(payload);
+
+ assertEquals("expect no change", payload, result);
+ }
+
+ @Test
+ public void convertMapToPatchFormatTest() throws URISyntaxException, JsonParseException, JsonMappingException, IOException {
+ AAIRestClient client = new AAIRestClient(props, new URI(""));
+ HashMap<String, String> map = new HashMap<>();
+ map.put("ipv4-loopback0-address", "");
+ String result = client.convertObjectToPatchFormat(map);
+
+ assertEquals("expect string", "{\"ipv4-loopback0-address\":\"\"}", result);
+ }
+
+ @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 hasComplexObjectTest() throws URISyntaxException {
+ AAIRestClient client = new AAIRestClient(props, new URI(""));
+ 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", client.hasComplexObject(hasNesting));
+ assertFalse("expect no nesting", client.hasComplexObject(noNesting));
+ assertTrue("expect has nesting", client.hasComplexObject(arrayCase));
+ assertFalse("expect no nesting", client.hasComplexObject(empty));
+ assertFalse("expect no nesting", client.hasComplexObject(arrayCaseSimpleOnly));
+ assertFalse("expect no nesting", client.hasComplexObject(relationshipListCase));
+ assertTrue("expect has nesting", client.hasComplexObject(relationshipListCaseNesting));
+ assertFalse("expect no nesting", client.hasComplexObject(nothing));
+ }
+}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
new file mode 100644
index 0000000000..f6ee826a78
--- /dev/null
+++ b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
@@ -0,0 +1,148 @@
+/*-
+ * ============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 static org.mockito.Mockito.spy;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import org.junit.Before;
+import org.junit.Test;
+
+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.defaultproperties.DefaultAAIPropertiesImpl;
+
+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;
+
+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");
+
+ ObjectMapper mapper;
+
+ @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 = createClient().beginTransaction()
+ .create(uriA.clone().relationshipAPI(), body);
+
+ String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions());
+ Map<String, Object> actual = mapper.readValue(serializedTransactions, new TypeReference<Map<String, Object>>(){});
+ Map<String, Object> expected = mapper.readValue(getJson("test-request-small.json"), new TypeReference<Map<String, Object>>(){});
+
+ assertEquals(actual, expected);
+ }
+
+ @Test
+ public void testConnect() throws IOException {
+ List<AAIResourceUri> uris = new ArrayList<AAIResourceUri>();
+ uris.add(uriB);
+
+ AAIResourceUri uriAClone = uriA.clone();
+ AAITransactionalClient transactions = createClient()
+ .beginTransaction().connect(uriA, uris).connect(uriC, uriD)
+ .beginNewTransaction().connect(uriE, uriF);
+
+ String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions());
+ Map<String, Object> actual = mapper.readValue(serializedTransactions, new TypeReference<Map<String, Object>>(){});
+ Map<String, Object> expected = mapper.readValue(getJson("test-request.json"), new TypeReference<Map<String, Object>>(){});
+
+ assertEquals(actual, expected);
+ assertEquals("uri not manipulated", uriAClone.build().toString(), uriA.build().toString());
+ }
+
+ @Test
+ public void testDisconnect() throws IOException {
+ List<AAIResourceUri> uris = new ArrayList<AAIResourceUri>();
+ uris.add(uriB);
+
+ AAITransactionalClient transactions = createClient().beginTransaction()
+ .disconnect(uriA, uris);
+
+ String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions());
+ Map<String, Object> actual = mapper.readValue(serializedTransactions, new TypeReference<Map<String, Object>>(){});
+ Map<String, Object> expected = mapper.readValue(getJson("test-request-small.json").replace("put", "delete"), new TypeReference<Map<String, Object>>(){});
+
+ 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 = createClient().beginTransaction().update(uriAClone, body);
+
+ String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions());
+ Map<String, Object> actual = mapper.readValue(serializedTransactions, new TypeReference<Map<String, Object>>(){});
+ Map<String, Object> expected = mapper.readValue(getJson("test-request-small.json").replace("put", "patch"), new TypeReference<Map<String, Object>>(){});
+
+ assertEquals(actual, expected);
+ }
+
+ @Test
+ public void verifyResponse() throws IOException {
+ AAITransactionalClient transactions = createClient()
+ .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");
+ }
+
+ private String getJson(String filename) throws IOException {
+ return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename)));
+ }
+
+ private AAIResourcesClient createClient() {
+ AAIResourcesClient client = spy(new AAIResourcesClient());
+ doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties();
+ return client;
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIURITest.java b/common/src/test/java/org/onap/so/client/aai/AAIURITest.java
index 366c587b11..cb426c5392 100644
--- a/common/src/test/java/org/openecomp/mso/client/aai/AAIURITest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIURITest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,15 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import static org.junit.Assert.assertEquals;
import javax.ws.rs.core.UriBuilder;
import org.junit.Test;
-import org.openecomp.mso.client.aai.entities.uri.AAIUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.entities.uri.AAIUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
public class AAIURITest {
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIUpdatorImplTest.java b/common/src/test/java/org/onap/so/client/aai/AAIUpdatorImplTest.java
index 86adb5f458..7ba92a1f06 100644
--- a/common/src/test/java/org/openecomp/mso/client/aai/AAIUpdatorImplTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIUpdatorImplTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import org.junit.Test;
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIUpdatorTest.java b/common/src/test/java/org/onap/so/client/aai/AAIUpdatorTest.java
new file mode 100644
index 0000000000..fddd1e63ba
--- /dev/null
+++ b/common/src/test/java/org/onap/so/client/aai/AAIUpdatorTest.java
@@ -0,0 +1,61 @@
+/*-
+ * ============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.Matchers.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.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AAIUpdatorTest {
+
+ @Mock
+ protected AAIRestClientI client;
+ String vnfName = "testVnf";
+ String uuid = "UUID";
+ 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), isA(String.class));
+ updator.updateVnfToLocked(vnfName, uuid);
+ verify(client, times(1)).updateMaintenceFlagVnfId(vnfName, true, uuid);
+ }
+
+ @Test
+ public void testUpdateVnfToUnLocked() throws Exception {
+ doNothing().when(client).updateMaintenceFlagVnfId(isA(String.class), isA(Boolean.class), isA(String.class));
+ updator.updateVnfToUnLocked(vnfName, uuid);
+ verify(client, times(1)).updateMaintenceFlagVnfId(vnfName, false, uuid);
+ }
+} \ No newline at end of file
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java b/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
index 12034e0eea..04c8b15b51 100644
--- a/common/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java b/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java
new file mode 100644
index 0000000000..ff940a0dea
--- /dev/null
+++ b/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java
@@ -0,0 +1,94 @@
+/*-
+ * ============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.*;
+
+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 org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.so.client.aai.AAICommonObjectMapperProvider;
+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;
+
+ 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 testGetRelationshipsEmpty() {
+ Optional<Relationships> relationships = aaiResultWrapperEmpty.getRelationships();
+ assertEquals("Compare relationships", Optional.empty(), relationships);
+ }
+
+ @Test
+ public void testAsMap() throws JsonParseException, JsonMappingException, IOException {
+ ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper();
+ Map<String, Object> expected = mapper.readValue(json, new TypeReference<Map<String, Object>>(){});
+
+ Map<String, Object> actual = aaiResultWrapper.asMap();
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void testAsMapEmpty() {
+ Map<String, Object> 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());
+
+
+
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/entities/RelationshipsTest.java b/common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java
index b2c1f9ed64..1ce6e4377c 100644
--- a/common/src/test/java/org/openecomp/mso/client/aai/entities/RelationshipsTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
import static org.junit.Assert.assertTrue;
@@ -29,9 +29,9 @@ import java.util.Arrays;
import java.util.List;
import org.junit.Test;
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+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 {
@@ -40,22 +40,22 @@ public class RelationshipsTest {
@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<AAIResourceUri> test = relationships.getRelatedAAIUris(AAIObjectType.VCE);
-
+
System.out.println(test.get(0).build());
List<AAIResourceUri> 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));
+
+ }
- }
-
-} \ No newline at end of file
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriFromUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java
index 6e3ab64108..5a69a42f35 100644
--- a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriFromUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,23 +18,24 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+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.openecomp.mso.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
-public class SimpleUriFromUriTest {
+public class AAISimpleUriFromUriTest {
@Test
public void removeHost() {
- AAIUri uri = new SimpleUri(AAIObjectType.UNKNOWN, UriBuilder.fromUri("https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053").build());
+ AAIUri 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());
@@ -42,7 +43,7 @@ public class SimpleUriFromUriTest {
@Test
public void noChange() {
- AAIUri uri = new SimpleUri(AAIObjectType.UNKNOWN, UriBuilder.fromUri("/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053").build());
+ AAIUri 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());
@@ -51,7 +52,7 @@ public class SimpleUriFromUriTest {
@Test
public void encodingPreserved() {
- AAIUri uri = new SimpleUri(AAIObjectType.UNKNOWN, UriBuilder.fromUri("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053").build());
+ AAIUri 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());
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java
index f4fe216cd2..1b6cc7bf66 100644
--- a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,19 +18,20 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+package org.onap.so.client.aai.entities.uri;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
+import static org.hamcrest.collection.IsEmptyCollection.empty;
import static org.junit.Assert.assertEquals;
import java.util.Map;
import org.junit.Test;
-import org.openecomp.mso.client.aai.AAIObjectPlurals;
-import org.openecomp.mso.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIObjectPlurals;
+import org.onap.so.client.aai.AAIObjectType;
-public class SimpleUriTest {
+public class AAISimpleUriTest {
@@ -51,7 +52,7 @@ public class SimpleUriTest {
}
@Test
- public void cloneTest() {
+ public void cloneTestSingular() {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
AAIResourceUri cloned = uri.clone();
Map<String,String> keys = cloned.getURIKeys();
@@ -59,6 +60,14 @@ public class SimpleUriTest {
}
@Test
+ public void cloneTestPlural() {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+ AAIResourceUri cloned = uri.clone();
+ Map<String,String> keys = cloned.getURIKeys();
+ assertThat(keys.values(), empty());
+ }
+
+ @Test
public void getKeysTest() {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, "cloud1", "cloud2", "tenant1", "vserver1");
Map<String,String> keys = uri.getURIKeys();
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactoryTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java
index a62d4b89c6..0ddf5c707b 100644
--- a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactoryTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,23 +18,51 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+package org.onap.so.client.aai.entities.uri;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.openecomp.mso.client.aai.AAIObjectType;
+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 AAIUriFactoryTest {
+ @Test
+ public void testCreateResourceUri() {
+
+ AAIUri 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() {
+
+ AAIUri 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 automaticallyEncodeUriTemplateValue() {
+ public void testCreateResourceFromExistingURI() {
- AAIUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
+ AAIUri uri = new AAISimpleUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
+ AAIUri 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() {
+
+ AAIUri 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/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
index 12ca0a2709..73720f55c2 100644
--- a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,10 +18,16 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+package org.onap.so.client.aai.entities.uri;
-import static org.hamcrest.CoreMatchers.containsString;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.containing;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
@@ -30,14 +36,6 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static com.github.tomakehurst.wiremock.client.WireMock.containing;
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-
-
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -45,20 +43,17 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Optional;
-import javax.ws.rs.BadRequestException;
import javax.ws.rs.core.UriBuilder;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.mockito.Matchers;
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.AAIQueryClient;
-import org.openecomp.mso.client.aai.Format;
-import org.openecomp.mso.client.aai.entities.CustomQuery;
-import org.openecomp.mso.client.aai.exceptions.AAIPayloadException;
-import org.openecomp.mso.client.aai.exceptions.AAIUriComputationException;
-import org.openecomp.mso.client.aai.exceptions.AAIUriNotFoundException;
+import org.onap.so.client.aai.AAIQueryClient;
+import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.aai.entities.CustomQuery;
+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;
@@ -69,8 +64,8 @@ public class ServiceInstanceUriTest {
@Rule
public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8443));
- @Rule
- public final ExpectedException exception = ExpectedException.none();
+ @Rule
+ public final ExpectedException exception = ExpectedException.none();
@Test
public void found() throws IOException {
@@ -84,7 +79,7 @@ public class ServiceInstanceUriTest {
}
@Test
- public void oneKey() throws IOException, URISyntaxException, AAIUriNotFoundException, AAIPayloadException {
+ public void oneKey() throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
ServiceInstanceUri instance = new ServiceInstanceUri("key1");
ServiceInstanceUri spy = spy(instance);
@@ -97,7 +92,7 @@ public class ServiceInstanceUriTest {
}
@Test
- public void oneKeyQueryParams() throws IOException, URISyntaxException, AAIUriNotFoundException, AAIPayloadException {
+ public void oneKeyQueryParams() throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
ServiceInstanceUri instance = new ServiceInstanceUri("key1");
ServiceInstanceUri spy = spy(instance);
@@ -110,7 +105,7 @@ public class ServiceInstanceUriTest {
}
@Test
- public void oneKeyEncoded() throws IOException, URISyntaxException, AAIUriNotFoundException, AAIPayloadException {
+ public void oneKeyEncoded() throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
ServiceInstanceUri instance = new ServiceInstanceUri("key1");
ServiceInstanceUri spy = spy(instance);
@@ -123,7 +118,7 @@ public class ServiceInstanceUriTest {
}
@Test
- public void oneKeyGetKeys() throws IOException, URISyntaxException, AAIUriNotFoundException, AAIPayloadException {
+ public void oneKeyGetKeys() throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
ServiceInstanceUri instance = new ServiceInstanceUri("key1");
ServiceInstanceUri spy = spy(instance);
@@ -133,7 +128,7 @@ public class ServiceInstanceUriTest {
}
@Test
- public void oneKeyClone() throws AAIUriNotFoundException, AAIPayloadException {
+ 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";
@@ -155,7 +150,7 @@ public class ServiceInstanceUriTest {
}
@Test
- public void notfound() throws IOException, AAIUriNotFoundException, AAIPayloadException {
+ 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");
@@ -163,7 +158,7 @@ public class ServiceInstanceUriTest {
AAIQueryClient mockQueryClient = mock(AAIQueryClient.class);
when(mockQueryClient.query(any(Format.class), any(CustomQuery.class))).thenReturn(content);
when(spy.getQueryClient()).thenReturn(mockQueryClient);
- exception.expect(AAIUriComputationException.class);
+ exception.expect(GraphInventoryUriComputationException.class);
spy.build();
}
@@ -178,16 +173,19 @@ public class ServiceInstanceUriTest {
}
@Test
- public void noVertexFound() throws AAIUriNotFoundException, AAIPayloadException {
+ public void noVertexFound() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
ServiceInstanceUri instance = new ServiceInstanceUri("key3");
ServiceInstanceUri spy = spy(instance);
+ AAIQueryClient client = mock(AAIQueryClient.class);
+ when(client.query(any(Format.class), any(CustomQuery.class))).thenReturn("{\"results\":[]}");
+ doReturn(client).when(spy).getQueryClient();
stubFor(put(urlMatching("/aai/v[0-9]+/query.*"))
.withRequestBody(containing("key3"))
.willReturn(aResponse()
.withStatus(400)
.withHeader("Content-Type", "application/json")
.withBodyFile("")));
- exception.expect(AAIUriComputationException.class);
+ exception.expect(GraphInventoryUriComputationException.class);
exception.expectMessage(containsString("NotFoundException"));
spy.build();
}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIOperationalEnvironmentTest.java b/common/src/test/java/org/onap/so/client/aai/objects/AAIOperationalEnvironmentTest.java
index f512de848c..e2a3cbd6bd 100644
--- a/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIOperationalEnvironmentTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/objects/AAIOperationalEnvironmentTest.java
@@ -1,23 +1,23 @@
/*
* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
+ * ONAP : SO
+ * ================================================================================
+ * Copyright (C) 2018 TechMahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.objects;
+package org.onap.so.client.aai.objects;
import static org.junit.Assert.*;
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIServiceInstanceTest.java b/common/src/test/java/org/onap/so/client/aai/objects/AAIServiceInstanceTest.java
index 692e3bba0b..4b080252b2 100644
--- a/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIServiceInstanceTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/objects/AAIServiceInstanceTest.java
@@ -1,23 +1,23 @@
/*
* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
+ * ONAP : SO
+ * ================================================================================
+ * Copyright (C) 2018 TechMahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.objects;
+package org.onap.so.client.aai.objects;
import static org.junit.Assert.*;
diff --git a/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java b/common/src/test/java/org/onap/so/client/defaultproperties/DefaultAAIPropertiesImpl.java
index ce08759dd9..77e1dfee7d 100644
--- a/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java
+++ b/common/src/test/java/org/onap/so/client/defaultproperties/DefaultAAIPropertiesImpl.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.defaultproperties;
+package org.onap.so.client.defaultproperties;
import java.io.File;
import java.io.FileInputStream;
@@ -30,8 +30,8 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import org.openecomp.mso.client.aai.AAIProperties;
-import org.openecomp.mso.client.aai.AAIVersion;
+import org.onap.so.client.aai.AAIProperties;
+import org.onap.so.client.aai.AAIVersion;
public class DefaultAAIPropertiesImpl implements AAIProperties {
@@ -40,7 +40,7 @@ public class DefaultAAIPropertiesImpl implements AAIProperties {
public DefaultAAIPropertiesImpl() {
File initialFile = new File("src/test/resources/aai.properties");
Map<Object, Object> temp;
- try(InputStream targetStream = new FileInputStream(initialFile)) {
+ try (InputStream targetStream = new FileInputStream(initialFile)) {
Properties properties = new Properties();
properties.load(targetStream);
temp = properties;
diff --git a/common/src/test/java/org/openecomp/mso/client/dmaap/DmaapClientTest.java b/common/src/test/java/org/onap/so/client/dmaap/DmaapClientTest.java
index dda7754712..4b90cfe021 100644
--- a/common/src/test/java/org/openecomp/mso/client/dmaap/DmaapClientTest.java
+++ b/common/src/test/java/org/onap/so/client/dmaap/DmaapClientTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap;
+package org.onap.so.client.dmaap;
import static org.junit.Assert.assertEquals;
@@ -26,7 +26,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import org.junit.Test;
-import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
+import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
public class DmaapClientTest {
diff --git a/common/src/test/java/org/openecomp/mso/client/dmaap/DmaapPublisherTest.java b/common/src/test/java/org/onap/so/client/dmaap/DmaapPublisherTest.java
index a9bf81d2ad..e1afa82e1e 100644
--- a/common/src/test/java/org/openecomp/mso/client/dmaap/DmaapPublisherTest.java
+++ b/common/src/test/java/org/onap/so/client/dmaap/DmaapPublisherTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap;
+package org.onap.so.client.dmaap;
import org.junit.Test;
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImplTest.java b/common/src/test/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImplTest.java
index e8d98718a4..be93f47585 100644
--- a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImplTest.java
+++ b/common/src/test/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImplTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,14 +18,16 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri.parsers;
+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.openecomp.mso.client.aai.AAIObjectType;
+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 {
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadExceptionTest.java b/common/src/test/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadExceptionTest.java
index 3895230ed4..6b23cbbe86 100644
--- a/common/src/test/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadExceptionTest.java
+++ b/common/src/test/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadExceptionTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,22 +18,23 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.exceptions;
+package org.onap.so.client.graphinventory.exceptions;
import org.junit.Test;
+import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException;
-public class AAIPayloadExceptionTest {
+public class GraphInventoryPayloadExceptionTest {
Throwable t = new Throwable();
@Test
public void callConstructorTest() throws Exception {
- AAIPayloadException test1 = new AAIPayloadException("testing");
+ GraphInventoryPayloadException test1 = new GraphInventoryPayloadException("testing");
- AAIPayloadException test2 = new AAIPayloadException("testing", t);
+ GraphInventoryPayloadException test2 = new GraphInventoryPayloadException("testing", t);
- AAIPayloadException test3 = new AAIPayloadException(t);
+ GraphInventoryPayloadException test3 = new GraphInventoryPayloadException(t);
}
}
diff --git a/common/src/test/java/org/openecomp/mso/client/grm/GRMBeansTest.java b/common/src/test/java/org/onap/so/client/grm/GRMBeansTest.java
index e22dc7b754..76b7369399 100644
--- a/common/src/test/java/org/openecomp/mso/client/grm/GRMBeansTest.java
+++ b/common/src/test/java/org/onap/so/client/grm/GRMBeansTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
import java.util.List;
@@ -38,9 +38,9 @@ import com.openpojo.validation.test.impl.GetterTester;
import com.openpojo.validation.test.impl.SetterTester;
public class GRMBeansTest {
- private static final String POJO_PACKAGE = "org.openecomp.mso.client.grm.beans";
+ private static final String POJO_PACKAGE = "org.onap.so.client.grm.beans";
private PojoClassFilter filterTestClasses = new FilterTestClasses();
-
+
@Test
public void testPojoStructureAndBehavior() {
Validator validator = ValidatorBuilder.create()
diff --git a/common/src/test/java/org/openecomp/mso/client/grm/GRMClientTest.java b/common/src/test/java/org/onap/so/client/grm/GRMClientTest.java
index 6865bbd773..3cce6a626b 100644
--- a/common/src/test/java/org/openecomp/mso/client/grm/GRMClientTest.java
+++ b/common/src/test/java/org/onap/so/client/grm/GRMClientTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,61 +18,91 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import java.io.File;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import javax.ws.rs.core.MediaType;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+
+import org.apache.log4j.MDC;
+import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
-import org.openecomp.mso.client.grm.exceptions.GRMClientCallFailed;
-import org.openecomp.mso.client.grm.GRMClient;
-import org.openecomp.mso.client.grm.beans.ServiceEndPointRequest;
-import org.openecomp.mso.client.grm.beans.OperationalInfo;
-import org.openecomp.mso.client.grm.beans.Property;
-import org.openecomp.mso.client.grm.beans.ServiceEndPoint;
-import org.openecomp.mso.client.grm.beans.ServiceEndPointList;
-import org.openecomp.mso.client.grm.beans.ServiceEndPointLookupRequest;
-import org.openecomp.mso.client.grm.beans.Version;
+import org.junit.rules.ExpectedException;
+import org.onap.so.client.grm.beans.OperationalInfo;
+import org.onap.so.client.grm.beans.Property;
+import org.onap.so.client.grm.beans.ServiceEndPoint;
+import org.onap.so.client.grm.beans.ServiceEndPointList;
+import org.onap.so.client.grm.beans.ServiceEndPointLookupRequest;
+import org.onap.so.client.grm.beans.ServiceEndPointRequest;
+import org.onap.so.client.grm.beans.Version;
+import org.onap.so.client.grm.exceptions.GRMClientCallFailed;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.logger.MsoLogger.Catalog;
+import org.onap.so.utils.TestAppender;
public class GRMClientTest {
@Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(28090));
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(47389));
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ System.setProperty("mso.config.path", "src/test/resources");
+ }
private ObjectMapper mapper = new ObjectMapper();
@Test
public void testFind() throws Exception {
+ TestAppender.events.clear();
String endpoints = getFileContentsAsString("__files/grm/endpoints.json");
wireMockRule.stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/findRunning"))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", MediaType.APPLICATION_JSON)
+ .withHeader("X-FromAppId", "GRM")
.withBody(endpoints)));
-
+ MDC.put(MsoLogger.SERVICE_NAME, "my-value");
GRMClient client = new GRMClient();
ServiceEndPointList sel = client.findRunningServices("TEST.ECOMP_PSL.*", 1, "TEST");
List<ServiceEndPoint> list = sel.getServiceEndPointList();
assertEquals(3, list.size());
+ ILoggingEvent logEvent = TestAppender.events.get(0);
+ Map<String,String> mdc = logEvent.getMDCPropertyMap();
+ assertNotNull(mdc.get(MsoLogger.METRIC_BEGIN_TIME));
+ assertNotNull(mdc.get(MsoLogger.METRIC_END_TIME));
+ assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(MsoLogger.METRIC_TIMER));
+ assertEquals("200",mdc.get(MsoLogger.RESPONSECODE));
+ assertEquals("GRM",mdc.get(MsoLogger.PARTNERNAME));
+ assertEquals("expect value to not be overwritten by jax rs client interceptor", "my-value",mdc.get(MsoLogger.SERVICE_NAME));
+ assertEquals("COMPLETE",mdc.get(MsoLogger.STATUSCODE));
+ assertNotNull(mdc.get(MsoLogger.RESPONSEDESC));
}
- @Test(expected = GRMClientCallFailed.class)
+ @Test
public void testFindFail() throws Exception {
wireMockRule.stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/findRunning"))
@@ -82,13 +112,14 @@ public class GRMClientTest {
.withBody("")));
GRMClient client = new GRMClient();
+ thrown.expect(GRMClientCallFailed.class);
client.findRunningServices("TEST.ECOMP_PSL.*", 1, "TEST");
}
@Ignore
@Test
public void testAdd() throws Exception {
-
+
wireMockRule.stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/add"))
.willReturn(aResponse()
.withStatus(202)
@@ -147,7 +178,7 @@ public class GRMClientTest {
client.addServiceEndPoint(request);
}
- @Test(expected = GRMClientCallFailed.class)
+ @Test
public void testAddFail() throws Exception {
wireMockRule.stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/add"))
.willReturn(aResponse()
@@ -156,6 +187,7 @@ public class GRMClientTest {
.withBody("test")));
ServiceEndPointRequest request = new ServiceEndPointRequest();
GRMClient client = new GRMClient();
+ thrown.expect(GRMClientCallFailed.class);
client.addServiceEndPoint(request);
}
diff --git a/common/src/test/java/org/openecomp/mso/client/grm/ServiceEndPointListTest.java b/common/src/test/java/org/onap/so/client/grm/ServiceEndPointListTest.java
index 111fec46eb..a1fb43ea5e 100644
--- a/common/src/test/java/org/openecomp/mso/client/grm/ServiceEndPointListTest.java
+++ b/common/src/test/java/org/onap/so/client/grm/ServiceEndPointListTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,15 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
import java.io.File;
import java.nio.file.Files;
import java.util.List;
import static org.junit.Assert.*;
import org.junit.Test;
-import org.openecomp.mso.client.grm.beans.ServiceEndPoint;
-import org.openecomp.mso.client.grm.beans.ServiceEndPointList;
+import org.onap.so.client.grm.beans.ServiceEndPoint;
+import org.onap.so.client.grm.beans.ServiceEndPointList;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -47,7 +47,7 @@ public class ServiceEndPointListTest {
assertEquals(Integer.valueOf(1), Integer.valueOf(se.getVersion().getMajor()));
assertEquals(Integer.valueOf(0), Integer.valueOf(se.getVersion().getMinor()));
assertEquals(Integer.valueOf(0), Integer.valueOf(se.getVersion().getPatch()));
- assertEquals("135.144.120.218", se.getHostAddress());
+ assertEquals("192.168.120.218", se.getHostAddress());
assertEquals("32004", se.getListenPort());
assertEquals("37.7022", se.getLatitude());
assertEquals("121.9358", se.getLongitude());
diff --git a/common/src/test/java/org/openecomp/mso/client/grm/ServiceEndPointRequestTest.java b/common/src/test/java/org/onap/so/client/grm/ServiceEndPointRequestTest.java
index 230b58bd84..4fe6bca05e 100644
--- a/common/src/test/java/org/openecomp/mso/client/grm/ServiceEndPointRequestTest.java
+++ b/common/src/test/java/org/onap/so/client/grm/ServiceEndPointRequestTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,17 +18,17 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
-import org.openecomp.mso.client.grm.beans.OperationalInfo;
-import org.openecomp.mso.client.grm.beans.Property;
-import org.openecomp.mso.client.grm.beans.ServiceEndPoint;
-import org.openecomp.mso.client.grm.beans.ServiceEndPointRequest;
-import org.openecomp.mso.client.grm.beans.Version;
+import org.onap.so.client.grm.beans.OperationalInfo;
+import org.onap.so.client.grm.beans.Property;
+import org.onap.so.client.grm.beans.ServiceEndPoint;
+import org.onap.so.client.grm.beans.ServiceEndPointRequest;
+import org.onap.so.client.grm.beans.Version;
import com.fasterxml.jackson.databind.ObjectMapper;
diff --git a/common/src/test/java/org/openecomp/mso/client/policy/PolicyClientImplTest.java b/common/src/test/java/org/onap/so/client/policy/PolicyClientImplTest.java
index f406667870..104d40f76e 100644
--- a/common/src/test/java/org/openecomp/mso/client/policy/PolicyClientImplTest.java
+++ b/common/src/test/java/org/onap/so/client/policy/PolicyClientImplTest.java
@@ -1,104 +1,111 @@
-/*-
- * ============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.openecomp.mso.client.policy;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.doReturn;
-import static com.shazam.shazamcrest.MatcherAssert.assertThat;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.openecomp.mso.client.defaultproperties.PolicyRestPropertiesImpl;
-import org.openecomp.mso.client.policy.entities.DecisionAttributes;
-import org.openecomp.mso.client.policy.entities.DictionaryData;
-import org.openecomp.mso.client.policy.entities.PolicyDecision;
-import org.openecomp.mso.client.policy.entities.PolicyServiceType;
-
-public class PolicyClientImplTest {
-
- @Test
- public void successReadProperties() {
- PolicyRestClient client = new PolicyRestClient(new PolicyRestPropertiesImpl(), PolicyServiceType.GET_DECISION);
- client.initializeHeaderMap(client.headerMap);
-
- assertEquals("Found expected Client Auth", client.headerMap.get("ClientAuth"),
- "Basic bTAzNzQzOnBvbGljeVIwY2sk");
- assertEquals("Found expected Authorization", client.headerMap.get("Authorization"),
- "Basic dGVzdHBkcDphbHBoYTEyMw==");
- assertEquals("Found expected Environment", client.headerMap.get("Environment"), "TEST");
- assertEquals("Has X-ECOMP-RequestID", client.headerMap.containsKey("X-ECOMP-RequestID"), true);
- }
-
- @Test
- public void getDecisionMockTest() {
- String serviceType = "S";
- String vnfType = "V";
- String bbID = "BB1";
- String workStep = "1";
- String errorCode = "123";
-
- PolicyDecision expected = new PolicyDecision();
- expected.setDecision("PERMIT");
- expected.setDetails("Retry");
-
- DecisionAttributes decisionAttributes = new DecisionAttributes();
- decisionAttributes.setServiceType(serviceType);
- decisionAttributes.setVNFType(vnfType);
- decisionAttributes.setBBID(bbID);
- decisionAttributes.setWorkStep(workStep);
- decisionAttributes.setErrorCode(errorCode);
- PolicyClient client = Mockito.spy(PolicyClientImpl.class);
-
- doReturn(expected).when(client).getDecision(serviceType, vnfType, bbID, workStep, errorCode);
-
- PolicyDecision actual = client.getDecision(serviceType, vnfType, bbID, workStep, errorCode);
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- @Ignore
- public void getDecisionTest() {
- PolicyClient client = new PolicyClientImpl();
- PolicyDecision decision = client.getDecision("S", "V", "BB1", "1", "123");
- assertEquals("Decision is correct", decision.getDecision(), "PERMIT");
- assertEquals("Decision details is correct", decision.getDetails(), "Retry");
- }
-
- @Test
- @Ignore
- public void getAllowedTreatmentsTest() {
- PolicyClient client = new PolicyClientImpl();
- DictionaryData dictClient = client.getAllowedTreatments("BB1", "1");
- final String dictBbidString = dictClient.getBbid().getString();
- final String dictWorkStepString = dictClient.getWorkstep().getString();
- assertEquals("DictionaryData matches a response Bbid", dictBbidString, "BB1");
- assertEquals("DicitonaryData matches a response WorkStep", dictWorkStepString, "1");
- }
- /*
- * @Test public void getAllowedTreatmentsTest() { PolicyClient client = new
- * PolicyClientImpl(); AllowedTreatments allowedTreatments =
- * client.getAllowedTreatments("BB1", "1"); int expectedSizeOfList = 4; int
- * sizeOfList = allowedTreatments.getAllowedTreatments().size();
- * assertEquals("Decision is correct", sizeOfList, expectedSizeOfList); }
- */
-}
+/*-
+ * ============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.policy;
+
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.doReturn;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.so.client.defaultproperties.PolicyRestPropertiesImpl;
+import org.onap.so.client.policy.entities.DictionaryData;
+import org.onap.so.client.policy.entities.PolicyDecision;
+import org.onap.so.client.policy.entities.PolicyServiceType;
+
+public class PolicyClientImplTest {
+
+ @BeforeClass
+ public static void setUp() {
+ System.setProperty("mso.config.path", "src/test/resources");
+ }
+ @Test
+ public void successReadProperties() {
+ PolicyRestClient client = new PolicyRestClient(new PolicyRestPropertiesImpl(), PolicyServiceType.GET_DECISION);
+ Map<String, String> map = new HashMap<>();
+ client.initializeHeaderMap(map);
+ assertEquals("Found expected Client Auth", "Basic bTAzNzQzOnBvbGljeVIwY2sk", map.get("ClientAuth"));
+ assertEquals("Found expected Authorization", "Basic dGVzdHBkcDphbHBoYTEyMw==", map.get("Authorization"));
+ assertEquals("Found expected Environment", "TEST", map.get("Environment"));
+ }
+
+ @Test
+ @Ignore
+ public void getDecisionTest() {
+ PolicyClient client = new PolicyClientImpl();
+ PolicyDecision decision = client.getDecision("S", "V", "BB1", "1", "123");
+ assertEquals("Decision is correct", decision.getDecision(), "PERMIT");
+ assertEquals("Decision details is correct", decision.getDetails(), "Retry");
+ }
+
+ @Test
+ @Ignore
+ public void getAllowedTreatmentsTest(){
+ PolicyClient client = new PolicyClientImpl();
+ DictionaryData dictClient = client.getAllowedTreatments("BB1", "1");
+ final String dictBbidString = dictClient.getBbid().getString();
+ final String dictWorkStepString = dictClient.getWorkstep().getString();
+ assertEquals("DictionaryData matches a response Bbid", dictBbidString, "BB1");
+ assertEquals("DicitonaryData matches a response WorkStep", dictWorkStepString, "1");
+ }
+
+ @Test
+ public void getDecisionMockTest() {
+ String serviceType = "S";
+ String vnfType = "V";
+ String bbID = "BB1";
+ String workStep = "1";
+ String errorCode = "123";
+
+ PolicyDecision expected = new PolicyDecision();
+ expected.setDecision("PERMIT");
+ expected.setDetails("Retry");
+
+ DecisionAttributes decisionAttributes = new DecisionAttributes();
+ decisionAttributes.setServiceType(serviceType);
+ decisionAttributes.setVNFType(vnfType);
+ decisionAttributes.setBBID(bbID);
+ decisionAttributes.setWorkStep(workStep);
+ decisionAttributes.setErrorCode(errorCode);
+ PolicyClient client = Mockito.spy(PolicyClientImpl.class);
+
+ doReturn(expected).when(client).getDecision(serviceType, vnfType, bbID, workStep, errorCode);
+
+ PolicyDecision actual = client.getDecision(serviceType, vnfType, bbID, workStep, errorCode);
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ /*
+ @Test
+ public void getAllowedTreatmentsTest() {
+ PolicyClient client = new PolicyClientImpl();
+ AllowedTreatments allowedTreatments = client.getAllowedTreatments("BB1", "1");
+ int expectedSizeOfList = 4;
+ int sizeOfList = allowedTreatments.getAllowedTreatments().size();
+ assertEquals("Decision is correct", sizeOfList, expectedSizeOfList);
+ }*/
+}
diff --git a/common/src/test/java/org/openecomp/mso/client/policy/entities/PolicyEntitiesTest.java b/common/src/test/java/org/onap/so/client/policy/entities/PolicyEntitiesTest.java
index f526e10249..2796affa49 100644
--- a/common/src/test/java/org/openecomp/mso/client/policy/entities/PolicyEntitiesTest.java
+++ b/common/src/test/java/org/onap/so/client/policy/entities/PolicyEntitiesTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy.entities;
+package org.onap.so.client.policy.entities;
import org.junit.Test;
@@ -39,7 +39,7 @@ public class PolicyEntitiesTest {
@Test
public void pojoStructure() {
- test("org.openecomp.mso.client.policy.entities");
+ test("org.onap.so.client.policy.entities");
}
private void test(String pojoPackage) {
diff --git a/common/src/test/java/org/openecomp/mso/client/ruby/RubyCheckClientTest.java b/common/src/test/java/org/onap/so/client/ruby/RubyCheckClientTest.java
index 053f1f2533..ba8772b05c 100644
--- a/common/src/test/java/org/openecomp/mso/client/ruby/RubyCheckClientTest.java
+++ b/common/src/test/java/org/onap/so/client/ruby/RubyCheckClientTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.ruby;
+package org.onap.so.client.ruby;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
@@ -32,13 +32,13 @@ import java.text.ParseException;
import java.time.format.DateTimeFormatter;
import org.junit.Test;
-import org.openecomp.mso.client.ruby.beans.Ruby;
+import org.onap.so.client.ruby.beans.Ruby;
import static org.apache.commons.lang3.StringUtils.*;
import com.fasterxml.jackson.databind.ObjectMapper;
public class RubyCheckClientTest {
- private final String fileLocation = "src/test/resources/org/openecomp/mso/client/ruby/create-ticket/";
+ private final String fileLocation = "src/test/resources/org/onap/so/client/ruby/create-ticket/";
private static final String REQUEST_ID = "abc123";
private static final String SOURCE_NAME = "source-name";
private static final String TIME = "test-time";
diff --git a/common/src/test/java/org/openecomp/mso/client/ruby/beans/RubyBeansTest.java b/common/src/test/java/org/onap/so/client/ruby/beans/RubyBeansTest.java
index 90e1861292..eb142be4c6 100644
--- a/common/src/test/java/org/openecomp/mso/client/ruby/beans/RubyBeansTest.java
+++ b/common/src/test/java/org/onap/so/client/ruby/beans/RubyBeansTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.ruby.beans;
+package org.onap.so.client.ruby.beans;
import org.junit.Test;
@@ -39,7 +39,7 @@ public class RubyBeansTest {
@Test
public void pojoStructure() {
- test("org.openecomp.mso.client.ruby.beans");
+ test("org.onap.so.client.ruby.beans");
}
private void test(String pojoPackage) {
diff --git a/common/src/test/java/org/openecomp/mso/client/sdno/SDNOHealthCheckClientTest.java b/common/src/test/java/org/onap/so/client/sdno/SDNOHealthCheckClientTest.java
index 6c64d90ff4..4887aed522 100644
--- a/common/src/test/java/org/openecomp/mso/client/sdno/SDNOHealthCheckClientTest.java
+++ b/common/src/test/java/org/onap/so/client/sdno/SDNOHealthCheckClientTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno;
+package org.onap.so.client.sdno;
import static org.junit.Assert.assertEquals;
@@ -28,7 +28,7 @@ import java.nio.file.Paths;
import java.util.Optional;
import org.junit.Test;
-import org.openecomp.mso.client.sdno.beans.SDNO;
+import org.onap.so.client.sdno.beans.SDNO;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -36,7 +36,7 @@ public class SDNOHealthCheckClientTest {
- private final String fileLocation = "src/test/resources/org/openecomp/mso/client/sdno/health-check/";
+ private final String fileLocation = "src/test/resources/org/onap/so/client/sdno/health-check/";
private static final String userId = "test-user";
private static final Optional<String> clliCode = Optional.of("test-clli");
private static final String requestId = "test-request-id";
diff --git a/common/src/test/java/org/openecomp/mso/client/sdno/SDNOValidatorTest.java b/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java
index cd84e7854d..89dd2f554f 100644
--- a/common/src/test/java/org/openecomp/mso/client/sdno/SDNOValidatorTest.java
+++ b/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno;
+package org.onap.so.client.sdno;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
@@ -42,11 +42,11 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.onap.aai.domain.yang.GenericVnf;
-import org.openecomp.mso.client.dmaap.Consumer;
-import org.openecomp.mso.client.dmaap.exceptions.DMaaPConsumerFailure;
-import org.openecomp.mso.client.exceptions.SDNOException;
-import org.openecomp.mso.client.sdno.beans.SDNO;
-import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
+import org.onap.so.client.dmaap.Consumer;
+import org.onap.so.client.dmaap.exceptions.DMaaPConsumerFailure;
+import org.onap.so.client.exceptions.SDNOException;
+import org.onap.so.client.sdno.beans.SDNO;
+import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -56,7 +56,7 @@ public class SDNOValidatorTest {
@Mock private Consumer mrConsumer;
@Spy private SDNOHealthCheckDmaapConsumer dmaapConsumer;
- private final String fileLocation = "src/test/resources/org/openecomp/mso/client/sdno/";
+ private final String fileLocation = "src/test/resources/org/onap/so/client/sdno/";
private final String uuid = "xyz123";
@Rule public ExpectedException thrown = ExpectedException.none();
diff --git a/common/src/test/java/org/openecomp/mso/client/sdno/beans/SdnoBeansTest.java b/common/src/test/java/org/onap/so/client/sdno/beans/SdnoBeansTest.java
index 4a2580f3f1..bdfefd028c 100644
--- a/common/src/test/java/org/openecomp/mso/client/sdno/beans/SdnoBeansTest.java
+++ b/common/src/test/java/org/onap/so/client/sdno/beans/SdnoBeansTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno.beans;
+package org.onap.so.client.sdno.beans;
import org.junit.Test;
@@ -39,7 +39,7 @@ public class SdnoBeansTest {
@Test
public void pojoStructure() {
- test("org.openecomp.mso.client.sdno.beans");
+ test("org.onap.so.client.sdno.beans");
}
private void test(String pojoPackage) {
diff --git a/common/src/test/java/org/openecomp/mso/entity/MsoRequestTest.java b/common/src/test/java/org/onap/so/entity/MsoRequestTest.java
index a7fc7e223e..73b5c7ea2d 100644
--- a/common/src/test/java/org/openecomp/mso/entity/MsoRequestTest.java
+++ b/common/src/test/java/org/onap/so/entity/MsoRequestTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.entity;
+package org.onap.so.entity;
import org.junit.Test;
-import org.openecomp.mso.openpojo.rules.HasToStringRule;
-import org.openecomp.mso.openpojo.rules.ToStringTester;
+import org.onap.so.openpojo.rules.HasToStringRule;
+import org.onap.so.openpojo.rules.ToStringTester;
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.PojoClassFilter;
@@ -42,7 +42,7 @@ public class MsoRequestTest {
@Test
public void pojoStructure() {
- test("org.openecomp.mso.entity");
+ test("org.onap.so.entity");
}
private void test(String pojoPackage) {
diff --git a/common/src/test/java/org/onap/so/exceptions/ValidationExceptionTest.java b/common/src/test/java/org/onap/so/exceptions/ValidationExceptionTest.java
new file mode 100644
index 0000000000..b3ae7ba9f5
--- /dev/null
+++ b/common/src/test/java/org/onap/so/exceptions/ValidationExceptionTest.java
@@ -0,0 +1,53 @@
+/*-
+ * ============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.exceptions;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Created by ANANDSAN on 4/12/2018.
+ */
+public class ValidationExceptionTest {
+ @Test
+ public void validationExceptionOverrideMessageFalse(){
+ ValidationException e = new ValidationException("testMessage", false);
+ Assert.assertEquals("testMessage", e.getMessage());
+ }
+
+ @Test
+ public void validationExceptionOverrideMessageTrue(){
+ ValidationException e = new ValidationException("testMessage", true);
+ Assert.assertEquals("No valid testMessage is specified", e.getMessage());
+ }
+
+ @Test
+ public void validationException(){
+ ValidationException e = new ValidationException("testMessage");
+ Assert.assertEquals("No valid testMessage is specified", e.getMessage());
+ }
+
+ @Test
+ public void validationExceptionVersion(){
+ ValidationException e = new ValidationException("testMessage", "1.0");
+ Assert.assertEquals("testMessage is not valid in the 1.0 version", e.getMessage());
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/jsonpath/JsonPathUtilTest.java b/common/src/test/java/org/onap/so/jsonpath/JsonPathUtilTest.java
index 85bb8b6804..06e25daa98 100644
--- a/common/src/test/java/org/openecomp/mso/jsonpath/JsonPathUtilTest.java
+++ b/common/src/test/java/org/onap/so/jsonpath/JsonPathUtilTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,10 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.jsonpath;
+package org.onap.so.jsonpath;
import static org.junit.Assert.assertEquals;
+import java.util.Collections;
import java.util.Optional;
import org.junit.Test;
@@ -46,4 +47,9 @@ public class JsonPathUtilTest {
assertEquals("json doc found", Optional.of("{\"nested\":\"value\"}"), JsonPathUtil.getInstance().locateResult(json, "$.test2"));
assertEquals("value found", Optional.of("value"), JsonPathUtil.getInstance().locateResult(json, "$.test2.nested"));
}
-} \ No newline at end of file
+
+ @Test
+ public void pathListTest() {
+ assertEquals(Collections.singletonList("$['test2']['nested']"), JsonPathUtil.getInstance().getPathList(json, "$.*.*"));
+ }
+}
diff --git a/common/src/test/java/org/openecomp/mso/serviceinstancebeans/ServiceInstanceBeansTest.java b/common/src/test/java/org/onap/so/serviceinstancebeans/ServiceInstanceBeansTest.java
index f0853305ee..7a4af7808e 100644
--- a/common/src/test/java/org/openecomp/mso/serviceinstancebeans/ServiceInstanceBeansTest.java
+++ b/common/src/test/java/org/onap/so/serviceinstancebeans/ServiceInstanceBeansTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import org.junit.Test;
-import org.openecomp.mso.openpojo.rules.HasToStringRule;
-import org.openecomp.mso.openpojo.rules.ToStringTester;
+import org.onap.so.openpojo.rules.HasToStringRule;
+import org.onap.so.openpojo.rules.ToStringTester;
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.PojoClassFilter;
@@ -41,7 +41,7 @@ public class ServiceInstanceBeansTest {
@Test
public void pojoStructure() {
- test("org.openecomp.mso.serviceinstancebeans");
+ test("org.onap.so.serviceinstancebeans");
}
private void test(String pojoPackage) {
diff --git a/common/src/test/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequestTest.java b/common/src/test/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequestTest.java
index 28cbe799cd..2e67ff4b2b 100644
--- a/common/src/test/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequestTest.java
+++ b/common/src/test/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequestTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import org.junit.Assert;
import org.junit.Test;
diff --git a/common/src/test/java/org/openecomp/mso/utils/CheckResultsTest.java b/common/src/test/java/org/onap/so/utils/CheckResultsTest.java
index eeb7342d50..0e1da16b9e 100644
--- a/common/src/test/java/org/openecomp/mso/utils/CheckResultsTest.java
+++ b/common/src/test/java/org/onap/so/utils/CheckResultsTest.java
@@ -18,18 +18,20 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.utils;
+package org.onap.so.utils;
+
+import static org.junit.Assert.*;
import java.util.List;
import org.junit.Test;
-import org.openecomp.mso.utils.CheckResults.CheckResult;
+import org.onap.so.utils.CheckResults.CheckResult;
public class CheckResultsTest {
/**
- * Test method for {@link org.openecomp.mso.utils.CheckResults#getResults()}.
+ * Test method for {@link org.onap.so.utils.CheckResults#getResults()}.
*/
@Test
public final void testGetResults () {
@@ -41,16 +43,16 @@ public class CheckResultsTest {
cr.addServiceCheckResult ("host2", "service1", 0, "output2Serv");
cr.addServiceCheckResult ("host2", "service2", 2, "output2Serv2");
List <CheckResult> res = cr.getResults ();
- assert(res.size () == 6);
- assert(res.get (0).getHostname ().equals ("host1"));
- assert(res.get (1).getHostname ().equals ("host2"));
- assert(res.get (2).getHostname ().equals ("host1"));
- assert(res.get (3).getHostname ().equals ("host1"));
- assert(res.get (4).getHostname ().equals ("host2"));
- assert(res.get (5).getHostname ().equals ("host2"));
- assert(res.get (0).getServicename () == null);
- assert(res.get (3).getServicename ().equals ("service2"));
- assert(res.get (5).getState () == 2);
+ assertEquals(res.size (), 6);
+ assertEquals(res.get (0).getHostname (), "host1");
+ assertEquals(res.get (1).getHostname (), "host2");
+ assertEquals(res.get (2).getHostname (), "host1");
+ assertEquals(res.get (3).getHostname (), "host1");
+ assertEquals(res.get (4).getHostname (), "host2");
+ assertEquals(res.get (5).getHostname (), "host2");
+ assertEquals(res.get (0).getServicename (), null);
+ assertEquals(res.get (3).getServicename (), "service2");
+ assertEquals(res.get (5).getState (), 2);
}
}
diff --git a/common/src/test/java/org/onap/so/utils/TestAppender.java b/common/src/test/java/org/onap/so/utils/TestAppender.java
new file mode 100644
index 0000000000..fba9c71c68
--- /dev/null
+++ b/common/src/test/java/org/onap/so/utils/TestAppender.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.so.utils;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.AppenderBase;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class TestAppender extends AppenderBase<ILoggingEvent> {
+ public static List<ILoggingEvent> events = new ArrayList<>();
+
+ @Override
+ protected void append(ILoggingEvent loggingEvent) {
+ if (loggingEvent.getLevel() == Level.INFO) {
+ events.add(loggingEvent);
+ }
+ }
+
+}
diff --git a/common/src/test/java/org/openecomp/mso/utils/UUIDCheckerTest.java b/common/src/test/java/org/onap/so/utils/UUIDCheckerTest.java
index fa00246e8b..b4058a7ba8 100644
--- a/common/src/test/java/org/openecomp/mso/utils/UUIDCheckerTest.java
+++ b/common/src/test/java/org/onap/so/utils/UUIDCheckerTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -18,27 +18,43 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.utils;
+package org.onap.so.utils;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
import org.junit.Test;
-import org.openecomp.mso.logger.MsoLogger;
+import org.onap.so.logger.MsoLogger;
public class UUIDCheckerTest {
-
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, UUIDCheckerTest.class);
- @Test
- public void testUUIDChecker() throws Exception {
- boolean isValidUUID = UUIDChecker.isValidUUID("invalid-uuid");
- assertEquals(false, isValidUUID);
- String validUUID = UUIDChecker.verifyOldUUID("invalid-uuid", LOGGER);
- assertEquals(true, UUIDChecker.isValidUUID(validUUID));
- String generatedUUID = UUIDChecker.generateUUID(LOGGER);
- assertEquals(true, UUIDChecker.isValidUUID(generatedUUID));
- String generatedServiceInstanceId = UUIDChecker.generateServiceInstanceID(LOGGER);
- assertEquals(true, UUIDChecker.isValidUUID(generatedServiceInstanceId));
- }
+ @Test
+ public void isValidUUIDTest(){
+ String nullID = null;
+ String badID = "This is not a UUID";
+ String id = UUIDChecker.getUUID();
+ assertFalse(UUIDChecker.isValidUUID(nullID));
+ assertFalse(UUIDChecker.isValidUUID(badID));
+ assertTrue(UUIDChecker.isValidUUID(id));
+ }
+ @Test
+ public void verifyOldUUIDTest(){
+ String oldID = UUIDChecker.getUUID();
+ String invalidID = "This is not a UUID";
+ assertEquals(UUIDChecker.verifyOldUUID(oldID,LOGGER),oldID);
+ assertNotEquals(UUIDChecker.verifyOldUUID(invalidID,LOGGER),invalidID);
+ }
+
+ @Test
+ public void generateTest(){
+ String id = UUIDChecker.generateUUID(LOGGER);
+ assertNotNull(id);
+ assertTrue(UUIDChecker.isValidUUID(id));
+
+ id = UUIDChecker.generateServiceInstanceID(LOGGER);
+ assertNotNull(id);
+ assertTrue(UUIDChecker.isValidUUID(id));
+
+ }
}
diff --git a/common/src/test/java/org/onap/so/utils/XMLMarshallerTest.java b/common/src/test/java/org/onap/so/utils/XMLMarshallerTest.java
new file mode 100644
index 0000000000..148e1b452c
--- /dev/null
+++ b/common/src/test/java/org/onap/so/utils/XMLMarshallerTest.java
@@ -0,0 +1,101 @@
+/*-
+ * ============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.utils;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Tests the XMLMarshaller to ensure that it's able to marshal and unmarshall a POJO
+ */
+
+public class XMLMarshallerTest {
+
+ @Test
+ public void testMarshal() throws Exception {
+ Assert.assertEquals(getXML(), XmlMarshaller.marshal(getPOJO()));
+ }
+
+ @Test
+ public void testUnMarshal() throws Exception {
+ Assert.assertEquals(XmlMarshaller.unMarshal(getXML(), new TestPOJO()), getPOJO());
+ }
+
+ private TestPOJO getPOJO() {
+ TestPOJO testPOJO = new TestPOJO();
+ testPOJO.setFirstName("FN");
+ testPOJO.setLastName("LN");
+ return testPOJO;
+ }
+
+ private String getXML() {
+ return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><testPOJO><firstName>FN</firstName><lastName>LN</lastName></testPOJO>";
+ }
+
+ @XmlRootElement
+ static class TestPOJO {
+ String firstName;
+ String lastName;
+
+ public TestPOJO() {
+ }
+
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof TestPOJO)) return false;
+
+ TestPOJO testPOJO = (TestPOJO) o;
+
+ if (getFirstName() != null ? !getFirstName().equals(testPOJO.getFirstName()) : testPOJO.getFirstName() != null)
+ return false;
+ return getLastName() != null ? getLastName().equals(testPOJO.getLastName()) : testPOJO.getLastName() == null;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = getFirstName() != null ? getFirstName().hashCode() : 0;
+ result = 31 * result + (getLastName() != null ? getLastName().hashCode() : 0);
+ return result;
+ }
+ }
+
+
+}
diff --git a/common/src/test/java/org/onap/so/web/exceptions/RuntimeExceptionMapperTest.java b/common/src/test/java/org/onap/so/web/exceptions/RuntimeExceptionMapperTest.java
new file mode 100644
index 0000000000..8bcc73515b
--- /dev/null
+++ b/common/src/test/java/org/onap/so/web/exceptions/RuntimeExceptionMapperTest.java
@@ -0,0 +1,71 @@
+/*-
+ * ============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.web.exceptions;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+
+import org.junit.AfterClass;
+import org.junit.Test;
+import org.onap.so.logger.MsoAlarmLogger;
+
+public class RuntimeExceptionMapperTest {
+
+
+ @AfterClass
+ public static void tearDown() {
+ MsoAlarmLogger logger = new MsoAlarmLogger();
+ logger.resetAppender();
+ }
+
+ @Test
+ public void testResponse() {
+
+ RuntimeExceptionMapper mapper = new RuntimeExceptionMapper();
+
+ Response r = mapper.toResponse(new RuntimeException("This is the run time exception message"));
+
+ assertEquals(Status.INTERNAL_SERVER_ERROR.getStatusCode(), r.getStatus());
+ assertThat(r.getEntity(), instanceOf(ExceptionResponse.class));
+ assertThat(((ExceptionResponse)r.getEntity()).getMessage(), equalTo("Unexpected Internal Exception"));
+
+ }
+
+ @Test
+ public void preserve404ExceptionForForwarding() {
+
+ RuntimeExceptionMapper mapper = new RuntimeExceptionMapper();
+
+ Response r = mapper.toResponse(new NotFoundException("not found"));
+
+ assertEquals(Status.NOT_FOUND.getStatusCode(), r.getStatus());
+ assertThat(r.getEntity(), is(nullValue()));
+ }
+
+}
diff --git a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryConcurrencyTest.java b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryConcurrencyTest.java
deleted file mode 100644
index a814c4ea9c..0000000000
--- a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryConcurrencyTest.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.openecomp.mso.adapter_utils.tests;
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import org.openecomp.mso.properties.AbstractMsoProperties;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-/**
- * This class implements test methods of the MsoPropertiesFactory features.
- *
- *
- */
-public class MsoPropertiesFactoryConcurrencyTest {
-
- public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- public static final String MSO_PROP_ID = "TEST_PROP";
- public static final String PATH_MSO_PROP1 = MsoJavaProperties.class.getClassLoader().getResource("mso.properties")
- .toString().substring(5);
- public static final String PATH_MSO_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.properties")
- .toString().substring(5);
-
- /**
- * This method is called before any test occurs. It creates a fake tree from
- * scratch
- *
- * @throws MsoPropertiesException
- */
- @BeforeClass
- public static final void prepare() throws MsoPropertiesException {
- // it's possible to have it already initialized, as tests are executed in the same JVM
- msoPropertiesFactory.removeAllMsoProperties ();
- msoPropertiesFactory.initializeMsoProperties(MSO_PROP_ID, PATH_MSO_PROP1);
- }
-
- private Callable<Integer> taskReload = new Callable<Integer>() {
- @Override
- public Integer call() {
- try {
- if (!msoPropertiesFactory.reloadMsoProperties()) {
- return 1;
- }
- } catch (Exception e) {
- e.printStackTrace ();
- return 1;
- }
- return 0;
- }
- };
-
- private Callable<Integer> taskRead = new Callable<Integer>() {
- @Override
- public Integer call() {
- try {
- MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_ID);
- String property1 = msoProperties.getProperty("ecomp.mso.cloud.1.cloudId", "defaultValue");
- String property2 = msoProperties.getProperty("ecomp.mso.cloud.1.keystoneUrl", "defaultValue");
- String property3 = msoProperties.getProperty("ecomp.mso.cloud.1.msoId", "defaultValue");
- String property4 = msoProperties.getProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue");
- String property5 = msoProperties.getProperty("does.not.exist", "defaultValue");
- String property6 = msoProperties.getProperty("ecomp.mso.cloud.1.test", "defaultValue");
- String property7 = msoProperties.getProperty("ecomp.mso.cloud.1.boolean", "defaultValue");
-
- assertEquals(property1, "MT");
- assertEquals(property2, "http://localhost:5000/v2.0");
- assertEquals(property3, "John");
- assertEquals(property4, "FD205490A48D48475607C36B9AD902BF");
- assertEquals(property5, "defaultValue");
- assertEquals(property6, "1234");
- assertEquals(property7, "true");
-
- } catch (MsoPropertiesException e) {
- e.printStackTrace ();
- return 1;
- }
- return 0;
- }
- };
-
- private Callable<Integer> taskReadAll = new Callable<Integer>() {
- @Override
- public Integer call() {
- try {
- List<AbstractMsoProperties> msoPropertiesList = msoPropertiesFactory.getAllMsoProperties();
- String property1 = ((MsoJavaProperties)msoPropertiesList.get(0)).getProperty("ecomp.mso.cloud.1.cloudId", "defaultValue");
- String property2 = ((MsoJavaProperties)msoPropertiesList.get(0)).getProperty("ecomp.mso.cloud.1.keystoneUrl", "defaultValue");
- String property3 = ((MsoJavaProperties)msoPropertiesList.get(0)).getProperty("ecomp.mso.cloud.1.msoId", "defaultValue");
- String property4 = ((MsoJavaProperties)msoPropertiesList.get(0)).getProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue");
- String property5 = ((MsoJavaProperties)msoPropertiesList.get(0)).getProperty("does.not.exist", "defaultValue");
- String property6 = ((MsoJavaProperties)msoPropertiesList.get(0)).getProperty("ecomp.mso.cloud.1.test", "defaultValue");
- String property7 = ((MsoJavaProperties)msoPropertiesList.get(0)).getProperty("ecomp.mso.cloud.1.boolean", "defaultValue");
-
- assertEquals(property1, "MT");
- assertEquals(property2, "http://localhost:5000/v2.0");
- assertEquals(property3, "John");
- assertEquals(property4, "FD205490A48D48475607C36B9AD902BF");
- assertEquals(property5, "defaultValue");
- assertEquals(property6, "1234");
- assertEquals(property7, "true");
- } catch (Exception e) {
- e.printStackTrace ();
- return 1;
- }
- return 0;
- }
- };
-
- @Test
- public final void testGetMsoProperties()
- throws MsoPropertiesException, InterruptedException, ExecutionException, FileNotFoundException {
-
- List<Future<Integer>> list = new ArrayList<>();
- ExecutorService executor = Executors.newFixedThreadPool(20);
-
- for (int i = 0; i <= 100000; i++) {
-
- Future<Integer> futureResult = executor.submit(taskRead);
- list.add(futureResult);
-
- futureResult = executor.submit(taskReload);
- list.add(futureResult);
-
- futureResult = executor.submit(taskReadAll);
- list.add(futureResult);
- }
- executor.shutdown();
- while (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
- ;
- }
-
- for (Future<Integer> result : list) {
- assertTrue(result.get().equals(0));
- }
-
- }
-
-}
diff --git a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java
deleted file mode 100644
index db58c5a49e..0000000000
--- a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java
+++ /dev/null
@@ -1,611 +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.openecomp.mso.adapter_utils.tests;
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoJsonProperties;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * This class implements test methods of the MsoPropertiesFactory features.
- *
- *
- */
-public class MsoPropertiesFactoryTest {
-
- public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- public static final String MSO_JAVA_PROP_ID = "TEST_JAVA_PROP";
- public static final String MSO_JSON_PROP_ID = "TEST_JSON_PROP";
- public static final String PATH_MSO_JAVA_PROP1 = MsoJavaProperties.class.getClassLoader().getResource("mso.properties")
- .toString().substring(5);
- public static final String PATH_MSO_JAVA_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.properties")
- .toString().substring(5);
- public static final String PATH_MSO_JSON_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.json")
- .toString().substring(5);
- public static final String PATH_MSO_JSON_PROP2 = MsoJavaProperties.class.getClassLoader().getResource("mso2.json")
- .toString().substring(5);
- public static final String PATH_MSO_JSON_PROP_BAD = MsoJavaProperties.class.getClassLoader().getResource("mso-bad.json")
- .toString().substring(5);
-
- @BeforeClass
- public static final void prepareBeforeAllTests() {
- msoPropertiesFactory.removeAllMsoProperties();
- }
- /**
- * This method is called before any test occurs. It creates a fake tree from
- * scratch
- *
- * @throws MsoPropertiesException
- */
- @Before
- public final void prepareBeforeEachTest() throws MsoPropertiesException {
-
- msoPropertiesFactory.initializeMsoProperties(MSO_JAVA_PROP_ID, PATH_MSO_JAVA_PROP1);
- msoPropertiesFactory.initializeMsoProperties(MSO_JSON_PROP_ID, PATH_MSO_JSON_PROP);
- }
-
- @After
- public final void cleanAfterEachTest() throws MsoPropertiesException {
- msoPropertiesFactory.removeAllMsoProperties ();
- }
-
- @Test
- public final void testNotRecognizedFile() {
- try {
- msoPropertiesFactory.initializeMsoProperties("BAD_FILE", "new_file.toto");
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Unable to load the MSO properties file because format is not recognized (only .json or .properties): new_file.toto").equals(ep.getMessage()));
- }
- }
-
- @Test
- public final void testDoubleInit() {
-
- try {
- msoPropertiesFactory.initializeMsoProperties(MSO_JAVA_PROP_ID, PATH_MSO_JAVA_PROP1);
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("The factory contains already an instance of this mso properties: "+PATH_MSO_JAVA_PROP1).equals(ep.getMessage()));
- }
-
-
- }
-
- /**
- * This method implements a test for the getMsoJavaProperties method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testGetMsoJavaProperties() throws MsoPropertiesException {
- assertNotNull(msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID));
- assertTrue(msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID).size()==8);
-
- try {
- msoPropertiesFactory.getMsoJavaProperties(MSO_JSON_PROP_ID);
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties is not JAVA_PROP properties type:" + MSO_JSON_PROP_ID).equals(ep.getMessage()));
- }
-
- try {
- msoPropertiesFactory.getMsoJavaProperties("DUMB_PROP");
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties not found in cache:"+"DUMB_PROP").equals(ep.getMessage()));
- }
-
- }
-
- /**
- * This method test the MsoJavaProperties Set, equals and hascode
- * @throws MsoPropertiesException
- */
- @Test
- public final void testSetMsoJavaProperties() throws MsoPropertiesException {
- MsoJavaProperties msoPropChanged = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
- msoPropChanged.setProperty("testos", "testos");
- assertNotNull(msoPropChanged.getProperty("testos", null));
-
- // Check no modification occurred on cache one
- MsoJavaProperties msoPropCache = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
- assertNull(msoPropCache.getProperty("testos", null));
- assertFalse(msoPropChanged.hashCode() != msoPropCache.hashCode());
-
- assertFalse(msoPropChanged.equals(null));
- assertFalse(msoPropChanged.equals(msoPropCache));
- assertFalse(msoPropChanged.equals(Boolean.TRUE));
-
- assertTrue(msoPropChanged.equals(msoPropChanged));
- }
-
-
- /**
- * This method implements a test for the testGetMsoJsonProperties method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testGetMsoJsonProperties() throws MsoPropertiesException {
- assertNotNull(msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID));
-
- try {
- msoPropertiesFactory.getMsoJsonProperties(MSO_JAVA_PROP_ID);
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties is not JSON_PROP properties type:" + MSO_JAVA_PROP_ID).equals(ep.getMessage()));
- }
-
- try {
- msoPropertiesFactory.getMsoJsonProperties("DUMB_PROP");
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties not found in cache:"+"DUMB_PROP").equals(ep.getMessage()));
- }
-
- }
-
- /**
- * This method implements a test for the testGetAllMsoProperties method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testGetAllMsoProperties() throws MsoPropertiesException {
- assertNotNull(msoPropertiesFactory.getAllMsoProperties().size()==2);
-
- }
-
- /**
- * This method implements a test for the testGetAllMsoProperties method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testToString() throws MsoPropertiesException {
- String dump = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID).toString();
- assertTrue(dump != null && !dump.isEmpty());
-
- dump = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID).toString();
- assertTrue(dump != null && !dump.isEmpty());
-
- }
-
- /**
- * This method implements a test for the getProperty of JAVA_PROP type method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testGetProperties() throws MsoPropertiesException {
- MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
-
- String property1 = msoProperties.getProperty("ecomp.mso.cloud.1.cloudId", "defaultValue");
- String property2 = msoProperties.getProperty("ecomp.mso.cloud.1.keystoneUrl", "defaultValue");
- String property3 = msoProperties.getProperty("ecomp.mso.cloud.1.msoId", "defaultValue");
- String property4 = msoProperties.getProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue");
- String property5 = msoProperties.getProperty("does.not.exist", "defaultValue");
- String property6 = msoProperties.getProperty("ecomp.mso.cloud.1.test", "defaultValue");
- String property7 = msoProperties.getProperty("ecomp.mso.cloud.1.boolean", "defaultValue");
-
- assertEquals(property1, "MT");
- assertEquals(property2, "http://localhost:5000/v2.0");
- assertEquals(property3, "John");
- assertEquals(property4, "FD205490A48D48475607C36B9AD902BF");
- assertEquals(property5, "defaultValue");
- assertEquals(property6, "1234");
- assertEquals(property7, "true");
- }
-
- /**
- * This method implements a test for the getIntProperty JAVA_RPOP type method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testGetIntProperties() throws MsoPropertiesException {
- MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
- int property1 = msoProperties.getIntProperty("ecomp.mso.cloud.1.test", 345);
- int property2 = msoProperties.getIntProperty("ecomp.mso.cloud.1.publicNetId", 345);
- int property3 = msoProperties.getIntProperty("does.not.exist", 345);
- assertEquals(property1, 1234);
- assertEquals(property2, 345);
- assertEquals(property3, 345);
- }
-
- /**
- * This method implements a test for the getBooleanProperty JAVA_RPOP type method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testGetBooleanProperty() throws MsoPropertiesException {
- MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
- boolean property1 = msoProperties.getBooleanProperty("ecomp.mso.cloud.1.boolean", false);
- boolean property2 = msoProperties.getBooleanProperty("ecomp.mso.cloud.1.publicNetId", false);
- boolean property3NotThere = msoProperties.getBooleanProperty("ecomp.mso.cloud.1.publicNetIdBad", true);
-
- assertEquals(property1, true);
- assertEquals(property2, false);
- assertEquals(property3NotThere, true);
- }
-
- /**
- * This method implements a test for the getEncryptedProperty JAVA_RPOP type method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testGetEncryptedProperty() throws MsoPropertiesException {
- MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
- String property1 = msoProperties.getEncryptedProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue",
- "aa3871669d893c7fb8abbcda31b88b4f");
- String property2 = msoProperties.getEncryptedProperty("test", "defaultValue",
- "aa3871669d893c7fb8abbcda31b88b4f");
-
-
- String property3Wrong = msoProperties.getEncryptedProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue",
- "aa3871669d893c7fb8abbcda31b88b4");
-
-
- assertEquals(property1, "changeme");
- assertEquals(property2, "defaultValue");
- assertEquals(property3Wrong, "defaultValue");
- }
-
- /**
- * This method implements a test for the getEncryptedProperty JAVA_RPOP type method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testencryptProperty() {
-
- assertTrue("FD205490A48D48475607C36B9AD902BF"
- .contains(msoPropertiesFactory.encryptProperty("changeme", "aa3871669d893c7fb8abbcda31b88b4f").getEntity().toString()));
-
-
- assertTrue("Invalid AES key length: 15 bytes".contains(msoPropertiesFactory.encryptProperty("changeme", "aa3871669d893c7fb8abbcda31b88b4").getEntity().toString()));
-
- }
-
- /**
- * This method implements a test for the getJSON JSON_RPOP type method.
- *
- * @throws MsoPropertiesException
- */
- @Test
- public final void testGetJsonNode() throws MsoPropertiesException {
- MsoJsonProperties msoProperties = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
-
- JsonNode propNode = msoProperties.getJsonRootNode();
- assertNotNull(propNode);
- assertFalse(propNode.toString().isEmpty());
- assertTrue(propNode.isContainerNode());
- assertNotNull(propNode.path("asdc-connections").path("asdc-controller1"));
- assertNotNull(propNode.path("asdc-connections").path("asdc-controller2"));
-
- }
-
- /**
- * This method implements a test for the reloadMsoProperties method.
- *
- * @throws MsoPropertiesException
- *
- */
- @Test
- public final void testReloadJavaMsoProperties() throws MsoPropertiesException {
- MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
-
- // Do some additional test on propertiesHaveChanged method
- assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, null));
-
- // Change path with bad one
- try {
- msoPropertiesFactory.changeMsoPropertiesFilePath("DO_NOT_EXIST", PATH_MSO_JAVA_PROP2);
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties not found in cache:DO_NOT_EXIST").equals(ep.getMessage()));
- }
-
-
- // Change path with right one
- msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JAVA_PROP_ID, PATH_MSO_JAVA_PROP2);
- assertTrue(PATH_MSO_JAVA_PROP2.equals(msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID).getPropertiesFileName()));
-
- assertTrue(msoPropertiesFactory.reloadMsoProperties());
- assertFalse(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
- // Do a second time as timer value is set to 2
- assertTrue(msoPropertiesFactory.reloadMsoProperties());
- assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
-
- // Get the new one
- msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
- String property1 = msoProperties.getProperty("ecomp.mso.cloud.1.cloudId", "defaultValue");
- String property2 = msoProperties.getProperty("ecomp.mso.cloud.1.keystoneUrl", "defaultValue");
- String property3 = msoProperties.getProperty("ecomp.mso.cloud.1.msoId", "defaultValue");
- String property4 = msoProperties.getProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue");
- String property5 = msoProperties.getProperty("does.not.exist", "defaultValue");
- String property6 = msoProperties.getProperty("ecomp.mso.cloud.1.test", "defaultValue");
- String property7 = msoProperties.getProperty("ecomp.mso.cloud.1.boolean", "defaultValue");
-
- assertEquals(property1, "MT2");
- assertEquals(property2, "defaultValue");
- assertEquals(property3, "defaultValue");
- assertEquals(property4, "defaultValue");
- assertEquals(property5, "defaultValue");
- assertEquals(property6, "defaultValue");
- assertEquals(property7, "defaultValue");
-
- // Additional test on propertiesHaveChanged
- msoPropertiesFactory.removeAllMsoProperties();
-
- // Do some additional test on propertiesHaveChanged method
- try {
- msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, null);
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties not found in cache:"+MSO_JAVA_PROP_ID).equals(ep.getMessage()));
- }
-
- try {
- msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties);
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties not found in cache:"+MSO_JAVA_PROP_ID).equals(ep.getMessage()));
- }
-
- }
-
- /**
- * This method implements a test for the reloadMsoProperties method.
- *
- * @throws MsoPropertiesException
- *
- */
- @Test
- public final void testReloadMoreThanAMinuteMsoProperties() throws MsoPropertiesException {
- MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JAVA_PROP_ID, PATH_MSO_JAVA_PROP2);
-
- // Simulate 2 minutes
- msoPropertiesFactory.reloadMsoProperties();
- assertFalse(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
- msoPropertiesFactory.reloadMsoProperties();
-
- assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
-
- // Get the new one
- msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
- String property1 = msoProperties.getProperty("ecomp.mso.cloud.1.cloudId", "defaultValue");
- String property2 = msoProperties.getProperty("ecomp.mso.cloud.1.keystoneUrl", "defaultValue");
- String property3 = msoProperties.getProperty("ecomp.mso.cloud.1.msoId", "defaultValue");
- String property4 = msoProperties.getProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue");
- String property5 = msoProperties.getProperty("does.not.exist", "defaultValue");
- String property6 = msoProperties.getProperty("ecomp.mso.cloud.1.test", "defaultValue");
- String property7 = msoProperties.getProperty("ecomp.mso.cloud.1.boolean", "defaultValue");
-
- assertEquals(property1, "MT2");
- assertEquals(property2, "defaultValue");
- assertEquals(property3, "defaultValue");
- assertEquals(property4, "defaultValue");
- assertEquals(property5, "defaultValue");
- assertEquals(property6, "defaultValue");
- assertEquals(property7, "defaultValue");
-
-
- }
-
- /**
- * This method implements a test for the reloadMsoProperties method.
- *
- * @throws MsoPropertiesException
- *
- */
- @Test
- public final void testReloadBadMsoProperties() throws MsoPropertiesException {
- MsoJavaProperties msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JAVA_PROP_ID, "file-does-not-exist.properties");
- msoPropertiesFactory.reloadMsoProperties();
- assertFalse(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
- // Reload it a second time as initial timer parameter was set to 2
- msoPropertiesFactory.reloadMsoProperties();
-
- assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JAVA_PROP_ID, msoProperties));
-
- // Get the new one
- msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
- String property1 = msoProperties.getProperty("ecomp.mso.cloud.1.cloudId", "defaultValue");
- String property2 = msoProperties.getProperty("ecomp.mso.cloud.1.keystoneUrl", "defaultValue");
- String property3 = msoProperties.getProperty("ecomp.mso.cloud.1.msoId", "defaultValue");
- String property4 = msoProperties.getProperty("ecomp.mso.cloud.1.publicNetId", "defaultValue");
- String property5 = msoProperties.getProperty("does.not.exist", "defaultValue");
- String property6 = msoProperties.getProperty("ecomp.mso.cloud.1.test", "defaultValue");
- String property7 = msoProperties.getProperty("ecomp.mso.cloud.1.boolean", "defaultValue");
-
- assertEquals(property1, "defaultValue");
- assertEquals(property2, "defaultValue");
- assertEquals(property3, "defaultValue");
- assertEquals(property4, "defaultValue");
- assertEquals(property5, "defaultValue");
- assertEquals(property6, "defaultValue");
- assertEquals(property7, "defaultValue");
-
- }
-
- /**
- * This method implements a test for the reloadMsoProperties method.
- *
- * @throws MsoPropertiesException
- *
- */
- @Test
- public final void testReloadBadMsoJsonProperties() throws MsoPropertiesException {
- // Load a bad JSON file
- MsoJsonProperties msoProperties = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JSON_PROP_ID, PATH_MSO_JSON_PROP_BAD);
-
- msoPropertiesFactory.reloadMsoProperties();
- assertFalse(msoPropertiesFactory.propertiesHaveChanged(MSO_JSON_PROP_ID, msoProperties));
- // Reload it a second time as initial timer parameter was set to 2
- msoPropertiesFactory.reloadMsoProperties();
-
- assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JSON_PROP_ID, msoProperties));
-
- // Get the new one
- msoProperties = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
- assertNotNull(msoProperties);
- assertNotNull(msoProperties.getJsonRootNode());
- assertTrue(msoProperties.getJsonRootNode().size() == 0);
-
- }
-
- @Test
- public final void testRemoveMsoProperties() throws MsoPropertiesException {
- try {
- msoPropertiesFactory.removeMsoProperties("DUMB_PROP");
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties not found in cache:"+"DUMB_PROP").equals(ep.getMessage()));
- }
-
- msoPropertiesFactory.removeMsoProperties(MSO_JAVA_PROP_ID);
-
- try {
- msoPropertiesFactory.getMsoJavaProperties(MSO_JAVA_PROP_ID);
-
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Mso properties not found in cache:"+MSO_JAVA_PROP_ID).equals(ep.getMessage()));
- }
-
- }
-
- @Test
- public final void testInitializeWithNonExistingPropertiesFile () throws MsoPropertiesException {
- try {
- msoPropertiesFactory.initializeMsoProperties("NEW_BAD_FILE", "no_file.properties");
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Unable to load the MSO properties file because it has not been found:no_file.properties").equals(ep.getMessage()));
- }
-
- // empty object should be returned as no config has been loaded, anyway no exception should be raised because the config ID must be loaded in cache
- // This is there for automatic reload attempt
- assertTrue(msoPropertiesFactory.getMsoJavaProperties("NEW_BAD_FILE").size()==0);
- }
-
-
- @Test
- public final void testInitializeWithNonExistingJsonFile () throws MsoPropertiesException {
- try {
- msoPropertiesFactory.initializeMsoProperties("NEW_BAD_FILE", "no_file.json");
- fail ("MsoPropertiesException should have been raised");
- } catch (MsoPropertiesException ep) {
- assertTrue(("Unable to load the MSO properties file because it has not been found:no_file.json").equals(ep.getMessage()));
- }
-
- // empty object should be returned as no config has been loaded, anyway no exception should be raised because the config ID must be loaded in cache
- // This is there for automatic reload attempt
- assertTrue(msoPropertiesFactory.getMsoJsonProperties("NEW_BAD_FILE").getJsonRootNode()!=null);
- assertTrue("{}".equals(msoPropertiesFactory.getMsoJsonProperties("NEW_BAD_FILE").getJsonRootNode().toString()));
- }
-
- @Test
- public final void testShowProperties() {
- assertTrue(msoPropertiesFactory.showProperties().getEntity().toString().contains("/target/test-classes/mso.json(Timer:2mins)"));
- assertTrue(msoPropertiesFactory.showProperties().getEntity().toString().contains("asdc-controller1"));
- assertTrue(msoPropertiesFactory.showProperties().getEntity().toString().contains("/target/test-classes/mso.properties(Timer:2mins):"));
- assertTrue(msoPropertiesFactory.showProperties().getEntity().toString().contains("ecomp.mso.cloud.1.keystoneUrl"));
-
- }
-
- @Test
- public final void testGetEncryptedPropertyJson() throws MsoPropertiesException {
- MsoJsonProperties msoProperties = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
- assertTrue("ThePassword".equals(msoProperties.getEncryptedProperty(msoProperties.getJsonRootNode().get("asdc-connections").get("asdc-controller1").get("asdcPassword"),"defautlvalue","566B754875657232314F5548556D3665")));
-
- assertTrue("defautlvalue".equals(msoProperties.getEncryptedProperty(msoProperties.getJsonRootNode().get("asdc-connections").get("asdc-controller1").get("asdcPassword"),"defautlvalue","566B754875657232314F5548556D366")));
-
-
- }
-
- @Test
- public final void testHashcodeAndEqualsMsoJsonProperties() throws MsoPropertiesException {
-
- MsoJsonProperties msoProperties = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
-
- msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JSON_PROP_ID, PATH_MSO_JSON_PROP2);
-
- msoPropertiesFactory.reloadMsoProperties();
- assertFalse(msoPropertiesFactory.propertiesHaveChanged(MSO_JSON_PROP_ID, msoProperties));
- // Reload it a second time as initial timer parameter was set to 2
- msoPropertiesFactory.reloadMsoProperties();
- assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JSON_PROP_ID, msoProperties));
-
- // Get the new one
- MsoJsonProperties msoProperties2 = msoPropertiesFactory.getMsoJsonProperties(MSO_JSON_PROP_ID);
- assertFalse(msoProperties.hashCode()==msoProperties2.hashCode());
-
- assertFalse(msoProperties.equals(msoProperties2));
- assertTrue(msoProperties.equals(msoProperties));
- assertFalse(msoProperties.equals(null));
- assertFalse(msoProperties.toString().isEmpty());
-
- // Test a reload with timer set to 1 in PATH_MSO_JSON_PROP2
- msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JSON_PROP_ID, PATH_MSO_JSON_PROP);
-
- msoPropertiesFactory.reloadMsoProperties();
- assertTrue(msoPropertiesFactory.propertiesHaveChanged(MSO_JSON_PROP_ID, msoProperties2));
-
- }
-
-}
diff --git a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertyInitializerTest.java b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertyInitializerTest.java
deleted file mode 100644
index 419a82b8a4..0000000000
--- a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertyInitializerTest.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.openecomp.mso.adapter_utils.tests;
-
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletContextEvent;
-
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-import org.openecomp.mso.properties.MsoPropertyInitializer;
-
-public class MsoPropertyInitializerTest {
-
- public static final String ASDC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.json").toString().substring(5);
- public static ServletContextEvent servletContextEvent = Mockito.mock(ServletContextEvent.class);
- public static ServletContext servletContext = Mockito.mock(ServletContext.class);
- public MsoPropertyInitializer msoPropInitializer = new MsoPropertyInitializer();
-
- @BeforeClass
- public static final void prepareBeforeClass() throws MsoPropertiesException {
-
- Mockito.when(servletContextEvent.getServletContext()).thenReturn(servletContext);
- }
-
- @Before
- public final void preparebeforeEachTest() throws MsoPropertiesException {
- MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- msoPropertiesFactory.removeAllMsoProperties();
-
- }
-
- @Test
- public void testContextInitialized() throws MsoPropertiesException {
- Mockito.when(servletContext.getInitParameter("mso.configuration")).thenReturn("MSO_PROP_ASDC="+ASDC_PROP);
- msoPropInitializer.contextInitialized(servletContextEvent);
-
- MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- assertNotNull(msoPropertiesFactory.getMsoJsonProperties("MSO_PROP_ASDC"));
- assertFalse("{}".equals(msoPropertiesFactory.getMsoJsonProperties("MSO_PROP_ASDC").getJsonRootNode().toString()));
- assertTrue(msoPropertiesFactory.getMsoJsonProperties("MSO_PROP_ASDC").getJsonRootNode().get("asdc-connections")!= null);
- }
-
- @Test
- public void testContextInitializedFailure() throws MsoPropertiesException {
- Mockito.when(servletContext.getInitParameter("mso.configuration")).thenReturn("MSO_PROP_ASDC="+"Does_not_exist.json");
- msoPropInitializer.contextInitialized(servletContextEvent);
-
- // No exception should be raised, log instead
- MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- assertTrue("{}".equals(msoPropertiesFactory.getMsoJsonProperties("MSO_PROP_ASDC").getJsonRootNode().toString()));
- assertTrue(msoPropertiesFactory.getMsoJsonProperties("MSO_PROP_ASDC").getJsonRootNode().get("asdc-connections")== null);
-
-
-
- }
-
-}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIConfigurationTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIConfigurationTest.java
deleted file mode 100644
index da63b27efb..0000000000
--- a/common/src/test/java/org/openecomp/mso/client/aai/AAIConfigurationTest.java
+++ /dev/null
@@ -1,75 +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.openecomp.mso.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.urlPathEqualTo;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static org.junit.Assert.assertEquals;
-
-import java.util.UUID;
-
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.openecomp.mso.client.aai.entities.uri.AAIUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-import org.openecomp.mso.serviceinstancebeans.ModelInfo;
-import org.openecomp.mso.serviceinstancebeans.RequestDetails;
-
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-public class AAIConfigurationTest {
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8443));
-
- @Ignore
- @Test
- public void verifyCreate() {
- AAIConfigurationClient aaiConfiguration = new AAIConfigurationClient();
- ModelInfo modelInfo = new ModelInfo();
- modelInfo.setModelInvariantId("testInvariantID");
- modelInfo.setModelVersionId("testVersionID");
- modelInfo.setModelCustomizationId("testCustomizationID");
- RequestDetails requestDetails = new RequestDetails();
- requestDetails.setModelInfo(modelInfo);
- String configurationType = "test";
- String configurationSubType = "test";
- aaiConfiguration.createConfiguration(requestDetails, UUID.randomUUID().toString(), configurationType, configurationSubType);
- }
-
- @Test
- public void verifyNotExists() {
- AAIUri path = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "test2");
- wireMockRule.stubFor(get(
- urlPathEqualTo("/aai/v11" + path.build()))
- .willReturn(
- aResponse()
- .withHeader("Content-Type", "text/plain")
- .withBody("hello")
- .withStatus(404)));
- AAIConfigurationClient aaiConfiguration = new AAIConfigurationClient();
- boolean result = aaiConfiguration.configurationExists("test2");
- assertEquals("path not found", false, result);
- }
-}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAITransactionalClientTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAITransactionalClientTest.java
deleted file mode 100644
index 1abb940f6e..0000000000
--- a/common/src/test/java/org/openecomp/mso/client/aai/AAITransactionalClientTest.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.openecomp.mso.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.Map;
-import java.util.Optional;
-
-import org.junit.Test;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-
-public class AAITransactionalClientTest {
-
-
- private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/bulkprocess/";
-
- @Test
- public void run() throws IOException {
-
-
- AAIResourcesClient client = new AAIResourcesClient();
- 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 uriAClone = uriA.clone();
- AAITransactionalClient transactions = client
- .beginTransaction().connect(uriA, uriB).connect(uriC, uriD)
- .beginNewTransaction().connect(uriE, uriF);
- ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper();
- mapper.enable(SerializationFeature.INDENT_OUTPUT);
- String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions());
- Map<String, Object> map1 = mapper.readValue(serializedTransactions, new TypeReference<Map<String, Object>>(){});
- Map<String, Object> map2 = mapper.readValue(getJson("test-request.json"), new TypeReference<Map<String, Object>>(){});
- assertEquals("payloads are equal", map2, map1);
- assertEquals("uri not manipulated", uriAClone.build().toString(), uriA.build().toString());
- }
-
- @Test
- public void verifyResponse() throws IOException {
- AAIResourcesClient client = new AAIResourcesClient();
- AAITransactionalClient transactions = client
- .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");
-
-
- }
-
- private String getJson(String filename) throws IOException {
- return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename)));
- }
-}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIOwningEntityTest.java b/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIOwningEntityTest.java
deleted file mode 100644
index bc2ae41dd6..0000000000
--- a/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIOwningEntityTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.client.aai.objects;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-
-public class AAIOwningEntityTest {
- AAIOwningEntity aaiOE= new AAIOwningEntity();
- @Test
- public void test() {
- aaiOE.setOwningEntityId("OwningEntityId");
- aaiOE.setOwningEntityName("OwningEntityName");
- assertEquals(aaiOE.getOwningEntityId(), "OwningEntityId");
- assertEquals(aaiOE.getOwningEntityName(), "OwningEntityName");
- aaiOE.withOwningEntity("OwningEntityId1", "OwningEntityName1");
- assert(aaiOE.getUri()!=null);
- }
-}
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIProjectTest.java b/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIProjectTest.java
deleted file mode 100644
index 872b17a759..0000000000
--- a/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIProjectTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
-* ONAP : SO
-* ================================================================================
-* Copyright 2018 TechMahindra
-*=================================================================================
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ============LICENSE_END=========================================================
-*/
-package org.openecomp.mso.client.aai.objects;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-
-public class AAIProjectTest {
-
-
- @Test
- public void test() {
- AAIProject aaiP =new AAIProject();
- aaiP.setProjectName("projectName");
- assertEquals(aaiP.getProjectName(),"projectName");
- aaiP.withProjectName("projectName");
- assert(aaiP.getUri()!=null);
-
- }
-}
diff --git a/common/src/test/java/org/openecomp/mso/utils/RootIgnoringObjectMapperTest.java b/common/src/test/java/org/openecomp/mso/utils/RootIgnoringObjectMapperTest.java
deleted file mode 100644
index 1c7e845f16..0000000000
--- a/common/src/test/java/org/openecomp/mso/utils/RootIgnoringObjectMapperTest.java
+++ /dev/null
@@ -1,94 +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.openecomp.mso.utils;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class RootIgnoringObjectMapperTest {
-
- @Test
- public void someObjectWithoutRootTest() throws Exception {
- ObjectMapper mapper = new RootIgnoringObjectMapper<SomeObject>(SomeObject.class);
-
- String content = "{"
- + "\"attribute\":\"charm\""
- + "}";
-
- SomeObject response = mapper.readValue(content, SomeObject.class);
- assertEquals("SomeObject[attribute=charm]", response.toString());
- }
-
- @Test
- public void someObjectWithRootTest() throws Exception {
- ObjectMapper mapper = new RootIgnoringObjectMapper<SomeObject>(SomeObject.class);
-
- String content = "{\"SomeObject\":{"
- + "\"attribute\":\"charm\""
- + "}}";
-
- SomeObject response = mapper.readValue(content, SomeObject.class);
- assertEquals("SomeObject[attribute=charm]", response.toString());
- }
-
- @Test
- public void annotatedObjectWithoutRootTest() throws Exception {
- ObjectMapper mapper = new RootIgnoringObjectMapper<AnnotatedObject>(AnnotatedObject.class);
-
- String content = "{"
- + "\"attribute\":\"charm\""
- + "}";
-
- AnnotatedObject response = mapper.readValue(content, AnnotatedObject.class);
- assertEquals("AnnotatedObject[attribute=charm]", response.toString());
- }
-
- @Test
- public void annotatedObjectWithRootTest() throws Exception {
- ObjectMapper mapper = new RootIgnoringObjectMapper<AnnotatedObject>(AnnotatedObject.class);
-
- String content = "{\"annotated-object\":{"
- + "\"attribute\":\"charm\""
- + "}}";
-
- AnnotatedObject response = mapper.readValue(content, AnnotatedObject.class);
- assertEquals("AnnotatedObject[attribute=charm]", response.toString());
- }
-
- public static class SomeObject {
-
- @JsonProperty("attribute")
- private String attribute;
-
- public String toString() {
- return getClass().getSimpleName() + "[attribute=" + attribute + "]";
- }
- }
-
- @JsonRootName(value = "annotated-object")
- public static class AnnotatedObject extends SomeObject {
- }
-} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/bulkprocess/test-request-small.json b/common/src/test/resources/__files/aai/bulkprocess/test-request-small.json
new file mode 100644
index 0000000000..973928108f
--- /dev/null
+++ b/common/src/test/resources/__files/aai/bulkprocess/test-request-small.json
@@ -0,0 +1,10 @@
+{
+ "transactions" : [ {
+ "put" : [ {
+ "uri" : "/network/generic-vnfs/generic-vnf/test1/relationship-list/relationship",
+ "body" : {
+ "related-link" : "/cloud-infrastructure/pservers/pserver/test2"
+ }
+ } ]
+ } ]
+} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/resources/e2e-complex.json b/common/src/test/resources/__files/aai/resources/e2e-complex.json
index 6fc9cb36e6..21bacbd5ce 100644
--- a/common/src/test/resources/__files/aai/resources/e2e-complex.json
+++ b/common/src/test/resources/__files/aai/resources/e2e-complex.json
@@ -24,7 +24,7 @@
"relationship": [
{
"related-to": "vpls-pe",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vpls-pes/vpls-pe/sfcca301vr1",
+ "related-link": "https://localhost:8443/aai/v9/network/vpls-pes/vpls-pe/sfcca301vr1",
"relationship-data": [
{
"relationship-key": "vpls-pe.equipment-name",
@@ -48,7 +48,7 @@
"relationship": [
{
"related-to": "vce",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053",
+ "related-link": "https://localhost:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053",
"relationship-data": [
{
"relationship-key": "vce.vnf-id",
@@ -64,7 +64,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj104snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj104snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -79,7 +79,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj105snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj105snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -94,7 +94,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/compute_host",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/compute_host",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -109,7 +109,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj106snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj106snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -124,7 +124,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj126sd9",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj126sd9",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -139,7 +139,7 @@
},
{
"related-to": "vce",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/8ae1e5f8-61f1-4c71-913a-b40cc4593cb9",
+ "related-link": "https://localhost:8443/aai/v9/network/vces/vce/8ae1e5f8-61f1-4c71-913a-b40cc4593cb9",
"relationship-data": [
{
"relationship-key": "vce.vnf-id",
@@ -155,7 +155,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj102sta",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj102sta",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -170,7 +170,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnjtax102",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnjtax102",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -185,7 +185,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj107snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj107snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -200,7 +200,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj118snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj118snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -215,7 +215,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj110snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj110snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -230,7 +230,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj109snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj109snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -245,7 +245,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj114snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj114snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -260,7 +260,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj119snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj119snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -275,7 +275,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj116snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj116snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -290,7 +290,7 @@
},
{
"related-to": "vce",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/a2935fa9-b743-49f4-9813-a127f13c4e93",
+ "related-link": "https://localhost:8443/aai/v9/network/vces/vce/a2935fa9-b743-49f4-9813-a127f13c4e93",
"relationship-data": [
{
"relationship-key": "vce.vnf-id",
@@ -306,7 +306,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj108snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj108snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -321,7 +321,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj123sd9",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj123sd9",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -336,7 +336,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj101snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj101snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -351,7 +351,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj102snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj102snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -366,7 +366,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnjtax101",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnjtax101",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -381,7 +381,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj113snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj113snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -396,7 +396,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj111snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj111snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -411,7 +411,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj103snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj103snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -426,7 +426,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj117snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj117snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -441,7 +441,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj101sta",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj101sta",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -456,7 +456,7 @@
},
{
"related-to": "vce",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/c7fe7698-8063-4e26-8bd3-ca3edde0b0d4",
+ "related-link": "https://localhost:8443/aai/v9/network/vces/vce/c7fe7698-8063-4e26-8bd3-ca3edde0b0d4",
"relationship-data": [
{
"relationship-key": "vce.vnf-id",
@@ -472,7 +472,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj120snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj120snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -487,7 +487,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj124sd9",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj124sd9",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -502,7 +502,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj125sd9",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj125sd9",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -517,7 +517,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj112snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj112snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -532,7 +532,7 @@
},
{
"related-to": "pserver",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj115snd",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj115snd",
"relationship-data": [
{
"relationship-key": "pserver.hostname",
@@ -547,7 +547,7 @@
},
{
"related-to": "cloud-region",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtcnj2",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtcnj2",
"relationship-data": [
{
"relationship-key": "cloud-region.cloud-owner",
@@ -567,7 +567,7 @@
},
{
"related-to": "oam-network",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/f9263cat-4eaa-43a0-bea4-adcf6e123456",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/f9263cat-4eaa-43a0-bea4-adcf6e123456",
"relationship-data": [
{
"relationship-key": "cloud-region.cloud-owner",
@@ -591,7 +591,7 @@
},
{
"related-to": "oam-network",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/b9263fab-4eaa-43a0-bea4-adcf6e999999",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/b9263fab-4eaa-43a0-bea4-adcf6e999999",
"relationship-data": [
{
"relationship-key": "cloud-region.cloud-owner",
@@ -615,7 +615,7 @@
},
{
"related-to": "oam-network",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/cf33dc95-c5d2-48fd-8078-fd949363f63b",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/oam-networks/oam-network/cf33dc95-c5d2-48fd-8078-fd949363f63b",
"relationship-data": [
{
"relationship-key": "cloud-region.cloud-owner",
@@ -639,7 +639,7 @@
},
{
"related-to": "availability-zone",
- "related-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/availability-zones/availability-zone/mtcnj-esx-az01",
+ "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/availability-zones/availability-zone/mtcnj-esx-az01",
"relationship-data": [
{
"relationship-key": "cloud-region.cloud-owner",
diff --git a/common/src/test/resources/__files/aai/resources/service-instance-pathed-query.json b/common/src/test/resources/__files/aai/resources/service-instance-pathed-query.json
index 6ec513e4bb..0fa9515820 100644
--- a/common/src/test/resources/__files/aai/resources/service-instance-pathed-query.json
+++ b/common/src/test/resources/__files/aai/resources/service-instance-pathed-query.json
@@ -2,7 +2,7 @@
"results": [
{
"resource-type": "service-instance",
- "resource-link": "https://aai-conexus-e2e.test.att.com:8443/aai/v9/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"
+ "resource-link": "https://localhost:8443/aai/v9/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"
}
]
} \ No newline at end of file
diff --git a/common/src/test/resources/__files/grm/endpoints.json b/common/src/test/resources/__files/grm/endpoints.json
index 20947540b4..7e92c21c9e 100644
--- a/common/src/test/resources/__files/grm/endpoints.json
+++ b/common/src/test/resources/__files/grm/endpoints.json
@@ -7,7 +7,7 @@
"minor": 0,
"patch": "0"
},
- "hostAddress": "135.144.120.218",
+ "hostAddress": "192.168.120.218",
"listenPort": "32004",
"latitude": "37.7022",
"longitude": "121.9358",
@@ -54,7 +54,7 @@
"minor": 0,
"patch": "0"
},
- "hostAddress": "135.144.120.22",
+ "hostAddress": "192.168.120.22",
"listenPort": "32004",
"latitude": "1.0",
"longitude": "1.0",
@@ -101,7 +101,7 @@
"minor": 0,
"patch": "0"
},
- "hostAddress": "135.144.120.218",
+ "hostAddress": "192.168.120.218",
"listenPort": "32002",
"latitude": "1.0",
"longitude": "1.0",
diff --git a/common/src/test/resources/dmaap.properties b/common/src/test/resources/dmaap.properties
index 8adb8e4976..7ce101996c 100644
--- a/common/src/test/resources/dmaap.properties
+++ b/common/src/test/resources/dmaap.properties
@@ -1,7 +1,7 @@
-sdno.health-check.dmaap.username=m04768@mso.ecomp.att.com
+sdno.health-check.dmaap.username=testuser
sdno.health-check.dmaap.password=eHQ1cUJrOUc
sdno.health-check.dmaap.subscriber.topic=com.att.sdno.test-health-diagnostic-v02
sdno.health-check.dmaap.publisher.topic=com.att.sdno.test-health-diagnostic-v02
-ruby.create-ticket-request.dmaap.username=m04768@mso.ecomp.att.com
+ruby.create-ticket-request.dmaap.username=testuser
ruby.create-ticket-request.dmaap.password=eHQ1cUJrOUc
ruby.create-ticket-request.publisher.topic=com.att.pdas.st1.msoCMFallout-v1 \ No newline at end of file
diff --git a/common/src/test/resources/logback-test.xml b/common/src/test/resources/logback-test.xml
index b1888ac986..c4248bf985 100644
--- a/common/src/test/resources/logback-test.xml
+++ b/common/src/test/resources/logback-test.xml
@@ -21,6 +21,7 @@
<configuration scan="false" debug="true">
<!--<jmxConfigurator /> -->
<!-- directory path for all other type logs -->
+
<property name="logDir" value="./target" />
<!-- directory path for debugging type logs -->
@@ -44,15 +45,8 @@
<property name="logDirectory" value="${logDir}/${componentName}/${subComponentName}" />
<property name="debugLogDirectory" value="${debugDir}/${componentName}/${subComponentName}" />
-
-
- <!-- Example evaluator filter applied against console appender -->
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>${defaultPattern}</pattern>
- </encoder>
- </appender>
+ <appender name="test" class="org.onap.so.utils.TestAppender"/>
<!-- ============================================================================ -->
<!-- EELF Appenders -->
<!-- ============================================================================ -->
@@ -148,24 +142,35 @@
<includeCallerData>true</includeCallerData>
</appender>
-
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level
+ %logger{1024} - %msg%n
+ </pattern>
+ </encoder>
+ </appender>
+
<!-- ============================================================================ -->
<!-- EELF loggers -->
<!-- ============================================================================ -->
- <logger name="com.att.eelf.audit" level="info" additivity="false">
- <appender-ref ref="asyncEELFAudit" />
+ <logger name="com.att.eelf.audit" level="${so.log.level:-DEBUG}" additivity="false">
+ <appender-ref ref="asyncEELFAudit" />
</logger>
- <logger name="com.att.eelf.metrics" level="info" additivity="false">
- <appender-ref ref="asyncEELFMetrics" />
+ <logger name="METRIC" level="${so.log.level:-DEBUG}" additivity="true">
+ <appender-ref ref="asyncEELFMetrics" />
+ <appender-ref ref="test" />
</logger>
- <logger name="com.att.eelf.error" level="debug" additivity="false">
+ <logger name="com.att.eelf.error" level="${so.log.level:-DEBUG}" additivity="false">
<appender-ref ref="asyncEELFError" />
- </logger>
- <root level="INFO">
+ </logger>
+
+ <root level="${so.log.level:-DEBUG}">
<appender-ref ref="asyncEELFDebug" />
+ <appender-ref ref="STDOUT" />
</root>
-</configuration>
+
+</configuration> \ No newline at end of file
diff --git a/common/src/test/resources/mso-bad.json b/common/src/test/resources/mso-bad.json
index 57b271459e..1aaea50042 100644
--- a/common/src/test/resources/mso-bad.json
+++ b/common/src/test/resources/mso-bad.json
@@ -1,20 +1,20 @@
{
- "asdc-connections":{,
- "asdc-controller1":{
- "asdcUser": "user1",
- "asdcConsumerGroup": "consumer1",
- "asdcConsumerId": "consumer1",
- "asdcEnvironmentName": "PROD",
- "asdcAddress": "localhost:8443",
- "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199"
- },
- "asdc-controller2":{
- "asdcUser": "user2",
- "asdcConsumerGroup": "consumer2",
- "asdcConsumerId": "consumer2",
- "asdcEnvironmentName": "E2E",
- "asdcAddress": "localhost:8443",
- "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199"
- }
- }
-}
+ "asdc-connections": {
+ "asdc-controller1": {
+ "asdcUser": "user1",
+ "asdcConsumerGroup": "consumer1",
+ "asdcConsumerId": "consumer1",
+ "asdcEnvironmentName": "PROD",
+ "asdcAddress": "localhost:8443",
+ "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199"
+ },
+ "asdc-controller2": {
+ "asdcUser": "user2",
+ "asdcConsumerGroup": "consumer2",
+ "asdcConsumerId": "consumer2",
+ "asdcEnvironmentName": "E2E",
+ "asdcAddress": "localhost:8443",
+ "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199"
+ }
+ }
+} \ No newline at end of file
diff --git a/common/src/test/resources/org/openecomp/mso/client/ruby/create-ticket/create-ticket-request.json b/common/src/test/resources/org/onap/so/client/ruby/create-ticket/create-ticket-request.json
index e388d3e9ad..e388d3e9ad 100644
--- a/common/src/test/resources/org/openecomp/mso/client/ruby/create-ticket/create-ticket-request.json
+++ b/common/src/test/resources/org/onap/so/client/ruby/create-ticket/create-ticket-request.json
diff --git a/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-post-check-request.json b/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json
index 8c3ca1938d..2c46b5a8cb 100644
--- a/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-post-check-request.json
+++ b/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json
@@ -7,6 +7,7 @@
"request-id": "test-request-id",
"health-diagnostic-code": "VROUTER000004",
"operation-type": "lport_mirroring_check",
+ "send-detailed-cmd-response": "false",
"aai-param-list": [
{
"key": "configuration-id",
diff --git a/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-pre-check-request.json b/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json
index 08220abe2d..bf168b0028 100644
--- a/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-lport-mirror-pre-check-request.json
+++ b/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json
@@ -7,6 +7,7 @@
"request-id": "test-request-id",
"health-diagnostic-code": "VROUTER000003",
"operation-type": "lport_mirroring_check",
+ "send-detailed-cmd-response": "false",
"aai-param-list": [
{
"key": "configuration-id",
diff --git a/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-post-check-request.json b/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json
index 834fcc8e72..89e505e7d0 100644
--- a/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-post-check-request.json
+++ b/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json
@@ -7,6 +7,7 @@
"request-id": "test-request-id",
"health-diagnostic-code": "VROUTER000004",
"operation-type": "mirroring_check",
+ "send-detailed-cmd-response": "false",
"aai-param-list": [
{
"key": "configuration-id",
diff --git a/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-pre-check-request.json b/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json
index 19d934d291..86897c8a1f 100644
--- a/common/src/test/resources/org/openecomp/mso/client/sdno/health-check/custom-port-mirror-pre-check-request.json
+++ b/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json
@@ -7,6 +7,7 @@
"request-id": "test-request-id",
"health-diagnostic-code": "VROUTER000003",
"operation-type": "mirroring_check",
+ "send-detailed-cmd-response": "false",
"aai-param-list": [
{
"key": "configuration-id",
diff --git a/common/src/test/resources/org/openecomp/mso/client/sdno/output-failure.json b/common/src/test/resources/org/onap/so/client/sdno/output-failure.json
index 15160b9dd9..8cf0a820cd 100644
--- a/common/src/test/resources/org/openecomp/mso/client/sdno/output-failure.json
+++ b/common/src/test/resources/org/onap/so/client/sdno/output-failure.json
@@ -8,7 +8,7 @@
"response-id": "191bf423-8473-4f7c-9fbb-e5dcbb40a12b",
"remote_end_time": "2017-10-13T14:51:53.490+0000",
"response-client-name": "MSO",
- "user_id": "md5621",
+ "user_id": "xxxxxx",
"remote_start_time": "2017-10-13T14:51:53.173+0000",
"error-message": "my error message",
"connection-failure-msg": "SDNO was unable to connect to an Ansible REST API server; Please ensure Ansible REST server is running"
diff --git a/common/src/test/resources/org/openecomp/mso/client/sdno/output-success.json b/common/src/test/resources/org/onap/so/client/sdno/output-success.json
index a6794327d8..a6794327d8 100644
--- a/common/src/test/resources/org/openecomp/mso/client/sdno/output-success.json
+++ b/common/src/test/resources/org/onap/so/client/sdno/output-success.json
diff --git a/common/src/test/resources/org/openecomp/mso/client/sdno/response.json b/common/src/test/resources/org/onap/so/client/sdno/response.json
index 2355e86938..2355e86938 100644
--- a/common/src/test/resources/org/openecomp/mso/client/sdno/response.json
+++ b/common/src/test/resources/org/onap/so/client/sdno/response.json