Reduce the number of problems in aai-common by removing unused imports 21/132021/1
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Mon, 7 Nov 2022 08:35:37 +0000 (08:35 +0000)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Mon, 7 Nov 2022 08:38:19 +0000 (08:38 +0000)
- run mvn spotless:apply across aai-commmon to remove unused imports
- run mvn formatter:format across aai-common

Issue-ID: AAI-3583

Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Change-Id: I2dfeb395eafa2824ce8369bba3a18db3e1845522

357 files changed:
aai-aaf-auth/src/main/java/org/onap/aai/aaf/auth/AAIAuthCore.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/auth/AafRequestFilter.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/auth/AafRequestWrapper.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/auth/CertUtil.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/auth/ResponseFormatter.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafAuthorizationFilter.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafCertAuthorizationFilter.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafCertFilter.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafFilter.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/AafProfiles.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/CadiProps.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/FilterPriority.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/GremlinFilter.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/PayloadBufferingRequestWrapper.java
aai-aaf-auth/src/main/java/org/onap/aai/aaf/filters/TwoWaySslAuthorization.java
aai-aaf-auth/src/test/java/org/onap/aai/aaf/auth/AAIAuthCoreTest.java
aai-aaf-auth/src/test/java/org/onap/aai/aaf/auth/AAISetup.java
aai-aaf-auth/src/test/java/org/onap/aai/aaf/auth/AAIUserTest.java
aai-aaf-auth/src/test/java/org/onap/aai/aaf/auth/AafRequestWrapperTest.java
aai-aaf-auth/src/test/java/org/onap/aai/aaf/auth/CertUtilTest.java
aai-aaf-auth/src/test/java/org/onap/aai/aaf/filters/CadiPropsTest.java
aai-annotations/src/main/java/org/onap/aai/schema/enums/ObjectMetadata.java
aai-annotations/src/test/java/org/onap/aai/annotations/AnnotationsTest.java
aai-core/src/main/java/org/onap/aai/audit/ListEndpoints.java
aai-core/src/main/java/org/onap/aai/concurrent/AaiCallable.java
aai-core/src/main/java/org/onap/aai/config/XmlFormatTransformerConfiguration.java
aai-core/src/main/java/org/onap/aai/dbgen/GraphSONPartialReader.java
aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java
aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator4Hist.java
aai-core/src/main/java/org/onap/aai/dbmap/AAIGraph.java
aai-core/src/main/java/org/onap/aai/dbmap/AAIGraphConfig.java
aai-core/src/main/java/org/onap/aai/dbmap/InMemoryGraph.java
aai-core/src/main/java/org/onap/aai/dmaap/AAIDmaapEventJMSConsumer.java
aai-core/src/main/java/org/onap/aai/dmaap/MessageProducer.java
aai-core/src/main/java/org/onap/aai/domain/model/AAIResources.java
aai-core/src/main/java/org/onap/aai/domain/notificationEvent/NotificationEvent.java
aai-core/src/main/java/org/onap/aai/domain/responseMessage/AAIResponseMessageData.java
aai-core/src/main/java/org/onap/aai/domain/responseMessage/AAIResponseMessages.java
aai-core/src/main/java/org/onap/aai/domain/translog/TransactionLogEntries.java
aai-core/src/main/java/org/onap/aai/domain/translog/TransactionLogEntry.java
aai-core/src/main/java/org/onap/aai/extensions/ExtensionController.java
aai-core/src/main/java/org/onap/aai/extensions/OrphanLInterfaceHandler.java
aai-core/src/main/java/org/onap/aai/ingestModel/CreateWidgetModels.java
aai-core/src/main/java/org/onap/aai/introspection/Introspector.java
aai-core/src/main/java/org/onap/aai/introspection/IntrospectorWalker.java
aai-core/src/main/java/org/onap/aai/introspection/JSONStrategy.java
aai-core/src/main/java/org/onap/aai/introspection/MoxyLoader.java
aai-core/src/main/java/org/onap/aai/introspection/MoxyStrategy.java
aai-core/src/main/java/org/onap/aai/introspection/PropertyPredicates.java
aai-core/src/main/java/org/onap/aai/introspection/exceptions/AAIUnmarshallingException.java
aai-core/src/main/java/org/onap/aai/introspection/generator/CreateExample.java
aai-core/src/main/java/org/onap/aai/introspection/sideeffect/DataCopy.java
aai-core/src/main/java/org/onap/aai/introspection/sideeffect/OwnerCheck.java
aai-core/src/main/java/org/onap/aai/introspection/sideeffect/PrivateEdge.java
aai-core/src/main/java/org/onap/aai/introspection/sideeffect/SideEffect.java
aai-core/src/main/java/org/onap/aai/introspection/sideeffect/SideEffectRunner.java
aai-core/src/main/java/org/onap/aai/parsers/query/LegacyQueryParser.java
aai-core/src/main/java/org/onap/aai/parsers/query/RelationshipQueryParser.java
aai-core/src/main/java/org/onap/aai/parsers/relationship/RelationshipToURI.java
aai-core/src/main/java/org/onap/aai/parsers/uri/URIParser.java
aai-core/src/main/java/org/onap/aai/prevalidation/Validation.java
aai-core/src/main/java/org/onap/aai/prevalidation/ValidationConfiguration.java
aai-core/src/main/java/org/onap/aai/prevalidation/ValidationService.java
aai-core/src/main/java/org/onap/aai/prevalidation/ValidationServiceNoAuthClient.java
aai-core/src/main/java/org/onap/aai/prevalidation/ValidationServiceOneWayClient.java
aai-core/src/main/java/org/onap/aai/prevalidation/ValidationServiceRestClient.java
aai-core/src/main/java/org/onap/aai/prevalidation/Violation.java
aai-core/src/main/java/org/onap/aai/query/builder/GraphTraversalBuilder.java
aai-core/src/main/java/org/onap/aai/query/builder/GremlinQueryBuilder.java
aai-core/src/main/java/org/onap/aai/query/builder/GremlinTraversal.java
aai-core/src/main/java/org/onap/aai/query/builder/HistoryGremlinTraversal.java
aai-core/src/main/java/org/onap/aai/query/builder/HistoryTraversalURIOptimizedQuery.java
aai-core/src/main/java/org/onap/aai/query/builder/QueryBuilder.java
aai-core/src/main/java/org/onap/aai/rest/db/HttpEntry.java
aai-core/src/main/java/org/onap/aai/rest/ueb/NotificationEvent.java
aai-core/src/main/java/org/onap/aai/rest/ueb/UEBNotification.java
aai-core/src/main/java/org/onap/aai/restcore/RESTAPI.java
aai-core/src/main/java/org/onap/aai/restcore/search/AAIAbstractGroovyShell.java
aai-core/src/main/java/org/onap/aai/restcore/search/GremlinGroovyShell.java
aai-core/src/main/java/org/onap/aai/restcore/search/GroovyQueryBuilder.java
aai-core/src/main/java/org/onap/aai/restcore/util/URITools.java
aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java
aai-core/src/main/java/org/onap/aai/serialization/db/GraphSingleton.java
aai-core/src/main/java/org/onap/aai/serialization/db/ImpliedDelete.java
aai-core/src/main/java/org/onap/aai/serialization/engines/InMemoryDBEngine.java
aai-core/src/main/java/org/onap/aai/serialization/engines/JanusGraphDBEngine.java
aai-core/src/main/java/org/onap/aai/serialization/engines/TransactionalGraphEngine.java
aai-core/src/main/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngine.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/Aggregate.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/ChangesFormat.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/Console.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/Count.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/FormatFactory.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/FormatMapper.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/Formatter.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/HistoryFormat.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/IdURL.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/LifecycleFormat.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/MultiFormatMapper.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/PathedURL.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/RawFormat.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/Resource.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/ResourceWithSoT.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/StateFormat.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/TreeFormat.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/utils/QueryParamInjector.java
aai-core/src/main/java/org/onap/aai/serialization/queryformats/utils/UrlBuilder.java
aai-core/src/main/java/org/onap/aai/service/NodeValidationService.java
aai-core/src/main/java/org/onap/aai/tasks/ScheduledTasks.java
aai-core/src/main/java/org/onap/aai/transforms/XmlFormatTransformer.java
aai-core/src/main/java/org/onap/aai/util/Entity.java
aai-core/src/main/java/org/onap/aai/util/EntityList.java
aai-core/src/main/java/org/onap/aai/util/HttpsAuthClient.java
aai-core/src/main/java/org/onap/aai/util/KeyValueList.java
aai-core/src/main/java/org/onap/aai/util/PojoUtils.java
aai-core/src/main/java/org/onap/aai/util/Request.java
aai-core/src/main/java/org/onap/aai/util/RestController.java
aai-core/src/main/java/org/onap/aai/util/RestControllerInterface.java
aai-core/src/main/java/org/onap/aai/util/StoreNotificationEvent.java
aai-core/src/main/java/org/onap/aai/util/delta/DeltaAction.java
aai-core/src/main/java/org/onap/aai/util/delta/DeltaEvents.java
aai-core/src/main/java/org/onap/aai/util/delta/ObjectDelta.java
aai-core/src/main/java/org/onap/aai/util/delta/PropertyDelta.java
aai-core/src/main/java/org/onap/aai/util/delta/PropertyDeltaFactory.java
aai-core/src/main/java/org/onap/aai/util/delta/RelationshipDelta.java
aai-core/src/test/java/org/onap/aai/AAISetup.java
aai-core/src/test/java/org/onap/aai/AbstractConfigTranslator.java
aai-core/src/test/java/org/onap/aai/DataLinkSetup.java
aai-core/src/test/java/org/onap/aai/HttpTestUtil.java
aai-core/src/test/java/org/onap/aai/audit/ListEndpointsTest.java
aai-core/src/test/java/org/onap/aai/concurrent/AaiCallableTest.java
aai-core/src/test/java/org/onap/aai/db/DbMethHelperTest.java
aai-core/src/test/java/org/onap/aai/dbmap/AAIGraphTest.java
aai-core/src/test/java/org/onap/aai/domain/model/AAIResourceTest.java
aai-core/src/test/java/org/onap/aai/domain/translog/TransactionLogEntriesTest.java
aai-core/src/test/java/org/onap/aai/domain/translog/TransactionLogEntryTest.java
aai-core/src/test/java/org/onap/aai/exceptions/AAIExceptionTest.java
aai-core/src/test/java/org/onap/aai/introspection/JSONStrategyTest.java
aai-core/src/test/java/org/onap/aai/introspection/MoxyEngineTest.java
aai-core/src/test/java/org/onap/aai/introspection/generator/CreateExampleTest.java
aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataCopyTest.java
aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataLinkTest.java
aai-core/src/test/java/org/onap/aai/introspection/sideeffect/OwnerCheckTest.java
aai-core/src/test/java/org/onap/aai/introspection/sideeffect/PrivateEdgeTest.java
aai-core/src/test/java/org/onap/aai/introspection/tools/IntrospectorValidatorTest.java
aai-core/src/test/java/org/onap/aai/introspection/validation/IntrospectorValidationTest.java
aai-core/src/test/java/org/onap/aai/logging/DME2RestFlagTest.java
aai-core/src/test/java/org/onap/aai/logging/ErrorObjectTest.java
aai-core/src/test/java/org/onap/aai/parsers/query/GraphTraversalTest.java
aai-core/src/test/java/org/onap/aai/parsers/query/LegacyQueryTest.java
aai-core/src/test/java/org/onap/aai/parsers/uri/URIToDBKeyTest.java
aai-core/src/test/java/org/onap/aai/parsers/uri/URIToObjectTest.java
aai-core/src/test/java/org/onap/aai/prevalidation/ValidationServiceTest.java
aai-core/src/test/java/org/onap/aai/query/builder/ExcludeQueryTest.java
aai-core/src/test/java/org/onap/aai/query/builder/GremlinTraversalTest.java
aai-core/src/test/java/org/onap/aai/query/builder/QueryBuilderTestAbstraction.java
aai-core/src/test/java/org/onap/aai/query/builder/QueryTestsConfigTranslator.java
aai-core/src/test/java/org/onap/aai/query/builder/TraversalQueryTest.java
aai-core/src/test/java/org/onap/aai/query/builder/UntilTest.java
aai-core/src/test/java/org/onap/aai/query/builder/optimization/AbstractGraphTraversalBuilderOptmizationTest.java
aai-core/src/test/java/org/onap/aai/rest/HPACapabilityTest.java
aai-core/src/test/java/org/onap/aai/rest/ImpliedDeleteIntegrationTest.java
aai-core/src/test/java/org/onap/aai/rest/NotificationDmaapEventTest.java
aai-core/src/test/java/org/onap/aai/rest/PrivateEdgeIntegrationTest.java
aai-core/src/test/java/org/onap/aai/rest/PserverDuplicateTest.java
aai-core/src/test/java/org/onap/aai/rest/PserverTest.java
aai-core/src/test/java/org/onap/aai/rest/VipAddressListTest.java
aai-core/src/test/java/org/onap/aai/rest/VnfcRelationshipIssueTest.java
aai-core/src/test/java/org/onap/aai/rest/db/HttpEntryTest.java
aai-core/src/test/java/org/onap/aai/rest/ueb/UEBNotificationTest.java
aai-core/src/test/java/org/onap/aai/restcore/JettyObfuscationConversionCommandLineUtilTest.java
aai-core/src/test/java/org/onap/aai/restcore/RESTAPITest.java
aai-core/src/test/java/org/onap/aai/serialization/db/AAICoreFakeEdgesConfigTranslator.java
aai-core/src/test/java/org/onap/aai/serialization/db/AAICorePrivateEdgeTestConfigTranslator.java
aai-core/src/test/java/org/onap/aai/serialization/db/DbAliasTest.java
aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializerDeltasTest.java
aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializerNotificationEventsTest.java
aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializerTest.java
aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializer_needsFakeRulesTest.java
aai-core/src/test/java/org/onap/aai/serialization/db/EdgeRulesTest.java
aai-core/src/test/java/org/onap/aai/serialization/db/EdgerPairCanBeBothCousinAndParentChildTest.java
aai-core/src/test/java/org/onap/aai/serialization/db/ImpliedDeleteUnitTest.java
aai-core/src/test/java/org/onap/aai/serialization/db/OneToOneEdgeUpdateTest.java
aai-core/src/test/java/org/onap/aai/serialization/db/VersionedScenariosTest.java
aai-core/src/test/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngineTest.java
aai-core/src/test/java/org/onap/aai/serialization/engines/query/GraphTraversalQueryEngine_needsFakeEdgeRulesTest.java
aai-core/src/test/java/org/onap/aai/serialization/queryformats/AggregateFormatTest.java
aai-core/src/test/java/org/onap/aai/serialization/queryformats/CountQuerySupportTest.java
aai-core/src/test/java/org/onap/aai/serialization/queryformats/GraphSONTest.java
aai-core/src/test/java/org/onap/aai/serialization/queryformats/MultiFormatTest.java
aai-core/src/test/java/org/onap/aai/serialization/queryformats/PathedURLTest.java
aai-core/src/test/java/org/onap/aai/serialization/queryformats/RawFormatTest.java
aai-core/src/test/java/org/onap/aai/serialization/queryformats/ResourceFormatTest.java
aai-core/src/test/java/org/onap/aai/serialization/queryformats/ResourceWithSoTTest.java
aai-core/src/test/java/org/onap/aai/serialization/queryformats/SimpleFormatTest.java
aai-core/src/test/java/org/onap/aai/serialization/tinkerpop/TreeBackedVertexTest.java
aai-core/src/test/java/org/onap/aai/stress/IndexStressTest.java
aai-core/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforBusiness.java
aai-core/src/test/java/org/onap/aai/testutils/TestUtilConfigTranslatorforEdges.java
aai-core/src/test/java/org/onap/aai/transforms/XmlFormatTransformerTest.java
aai-core/src/test/java/org/onap/aai/util/PojoUtilsTest.java
aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/AaiAuditLogContainerFilter.java
aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/RestClientLoggingInterceptor.java
aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/RestControllerClientLoggingInterceptor.java
aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiDBMetricLog.java
aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiDebugLog.java
aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiDmaapMetricLog.java
aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiScheduledTaskAuditLog.java
aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/DBRequestWrapper.java
aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/ServiceName.java
aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/Fault.java
aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/ObjectFactory.java
aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/PolicyException.java
aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RESTResponse.java
aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RequestError.java
aai-els-onap-logging/src/main/java/org/onap/aai/domain/restResponseInfo/Info.java
aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/Fault.java
aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RESTResponse.java
aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RequestError.java
aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/ServiceException.java
aai-els-onap-logging/src/main/java/org/onap/aai/exceptions/AAIException.java
aai-els-onap-logging/src/main/java/org/onap/aai/logging/CNName.java
aai-els-onap-logging/src/main/java/org/onap/aai/logging/ErrorLogHelper.java
aai-els-onap-logging/src/main/java/org/onap/aai/logging/ErrorObject.java
aai-els-onap-logging/src/main/java/org/onap/aai/logging/LoggingContext.java
aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIApplicationConfig.java
aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConfig.java
aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConfigProxy.java
aai-els-onap-logging/src/main/java/org/onap/aai/util/HbaseSaltPrefixer.java
aai-els-onap-logging/src/main/java/org/onap/aai/util/MapperUtil.java
aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AbstractAuditLogFilter.java
aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AbstractMetricLogFilter.java
aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AbstractServletFilter.java
aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AuditLogContainerFilter.java
aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AuditLogServletFilter.java
aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/MDCSetup.java
aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/MetricLogClientFilter.java
aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/ONAPComponents.java
aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/PayloadLoggingClientFilter.java
aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/PayloadLoggingServletFilter.java
aai-els-onap-logging/src/main/java/org/onap/logging/ref/slf4j/ONAPLogAdapter.java
aai-els-onap-logging/src/main/java/org/onap/logging/ref/slf4j/ONAPLogConstants.java
aai-els-onap-logging/src/main/java/org/onap/logging/ref/slf4j/package-info.java
aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/AaiAuditLogContainerFilterTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/RestClientLoggingInterceptorTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/RestControllerClientLoggingInterceptorTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/domain/restResponseInfo/InfoTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/domain/restResponseInfo/ObjectFactoryTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/exceptions/AAIExceptionTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/exceptions/AAIExceptionWithInfoTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/logging/CNNameTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/logging/CustomLogPatternLayoutTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/logging/DME2RestFlagTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorLogHelperTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorObjectFormatExceptionTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorObjectNotFoundExceptionTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/logging/ErrorObjectTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/logging/LogFormatToolsTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/logging/LoggingContextTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/logging/StopWatchNotStartedExceptionTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/logging/StopWatchTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/util/AAIApplicationConfigTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/util/AAIConfigTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/util/FormatDateTest.java
aai-els-onap-logging/src/test/java/org/onap/aai/util/LogFile.java
aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/AuditLogContainerFilterTest.java
aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/AuditLogServletFilterTest.java
aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/LoggingContainerFilterTest.java
aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/MDCSetupTest.java
aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/MetricLogClientFilterTest.java
aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/PayloadLoggingClientFilterTest.java
aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/SimpleJaxrsHeadersMapTest.java
aai-els-onap-logging/src/test/java/org/onap/logging/filter/base/SimpleServletHeadersMapTest.java
aai-els-onap-logging/src/test/java/org/onap/logging/ref/slf4j/ONAPLogAdapterTest.java
aai-els-onap-logging/src/test/java/org/onap/logging/ref/slf4j/ONAPLogConstantsTest.java
aai-failover/src/main/java/org/onap/aai/failover/FailoverAspect.java
aai-failover/src/main/java/org/onap/aai/failover/FailoverMonitor.java
aai-rest/src/main/java/org/onap/aai/restclient/AAIRestClient.java
aai-rest/src/main/java/org/onap/aai/restclient/NoAuthRestClient.java
aai-rest/src/main/java/org/onap/aai/restclient/OneWaySSLRestClient.java
aai-rest/src/main/java/org/onap/aai/restclient/PropertyPasswordConfiguration.java
aai-rest/src/main/java/org/onap/aai/restclient/RestClient.java
aai-rest/src/main/java/org/onap/aai/restclient/RestClientResponseErrorHandler.java
aai-rest/src/main/java/org/onap/aai/restclient/TwoWaySSLRestClient.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/SchemaProvider.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/SchemaProviderException.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/SchemaProviderMsgs.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/definitions/EdgeSchema.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/definitions/PropertySchema.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/definitions/VertexSchema.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/definitions/types/BooleanDataType.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/definitions/types/ComplexDataType.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/definitions/types/DataType.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/definitions/types/FloatDataType.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/definitions/types/IntDataType.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/definitions/types/ListDataType.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/definitions/types/LongDataType.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/definitions/types/MapDataType.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/definitions/types/StringDataType.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/json/FromJsonEdgeSchema.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/json/FromJsonPropertySchema.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/json/FromJsonVertexSchema.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/json/JsonSchemaProvider.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/json/JsonSchemaProviderConfig.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/json/SchemaInstance.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/json/SchemaServiceResponse.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/json/SecureClientHttpRequestFactory.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/json/definitions/DataTypeDefinition.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/json/definitions/JsonEdgeSchema.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/json/definitions/JsonPropertySchema.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/json/definitions/JsonSchema.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/json/definitions/JsonVertexSchema.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/oxm/EdgePropsConfiguration.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/oxm/FromOxmEdgeSchema.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/oxm/FromOxmPropertySchema.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/oxm/FromOxmVertexSchema.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/oxm/OxmEdgeRulesLoader.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/oxm/OxmSchemaLoader.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/oxm/OxmSchemaProvider.java
aai-schema-abstraction/src/main/java/org/onap/aai/schemaif/oxm/RelationshipSchema.java
aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/json/JsonSchemaProviderTest.java
aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/oxm/OxmSchemaProviderTest.java
aai-schema-abstraction/src/test/java/org/onap/aai/schemaif/oxm/OxmSchemaServiceSetup.java
aai-schema-ingest/src/main/java/org/onap/aai/config/NodesConfiguration.java
aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeIngestor.java
aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeRule.java
aai-schema-ingest/src/main/java/org/onap/aai/edges/EdgeRuleQuery.java
aai-schema-ingest/src/main/java/org/onap/aai/edges/JsonIngestor.java
aai-schema-ingest/src/main/java/org/onap/aai/nodes/NodeIngestor.java
aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceNoAuthClient.java
aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceOneWayClient.java
aai-schema-ingest/src/main/java/org/onap/aai/restclient/SchemaServiceRestClient.java
aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaServiceTranslator.java
aai-schema-ingest/src/main/java/org/onap/aai/setup/SchemaVersions.java
aai-schema-ingest/src/main/java/org/onap/aai/setup/Translator.java
aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorLocalTest.java
aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorTest.java
aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java
aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorLocalTest.java
aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorTest.java
aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java
aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockProvider.java
aai-schema-ingest/src/test/java/org/onap/aai/restclient/MockRestClient.java
aai-schema-ingest/src/test/java/org/onap/aai/restclient/SchemaRestClientTest.java
aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java
aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java
aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java
aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java
aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorRainyDayTest.java
aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java
aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java
aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorRainyDayTest.java
aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSchemaIncompleteTest.java
aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java
aai-utils/src/main/java/org/onap/aaiutils/oxm/OxmModelLoaderConstants.java
pom.xml

index 0e17030..f591125 100644 (file)
 
 package org.onap.aai.aaf.auth;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
-import org.eclipse.jetty.util.security.Password;
-import org.onap.aai.aaf.auth.exceptions.AAIUnrecognizedFunctionException;
-import org.onap.aai.logging.ErrorLogHelper;
-import org.onap.aai.util.AAIConfig;
-import org.onap.aai.util.AAIConstants;
 
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -43,6 +36,14 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
+import org.eclipse.jetty.util.security.Password;
+import org.onap.aai.aaf.auth.exceptions.AAIUnrecognizedFunctionException;
+import org.onap.aai.logging.ErrorLogHelper;
+import org.onap.aai.util.AAIConfig;
+import org.onap.aai.util.AAIConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * The Class AAIAuthCore.
  */
@@ -69,14 +70,14 @@ public final class AAIAuthCore {
         this(basePath, AAIConstants.AAI_AUTH_CONFIG_FILENAME);
     }
 
-    public AAIAuthCore(String basePath, String filename){
+    public AAIAuthCore(String basePath, String filename) {
         this.basePath = basePath;
         this.globalAuthFileName = filename;
         authPolicyPattern = Pattern.compile("^" + this.basePath + "/v\\d+/([\\w\\-]*)");
         init();
     }
 
-    public AAIAuthCore(String basePath, String filename, String pattern){
+    public AAIAuthCore(String basePath, String filename, String pattern) {
         this.basePath = basePath;
         this.globalAuthFileName = filename;
         authPolicyPattern = Pattern.compile(pattern);
@@ -364,7 +365,7 @@ public final class AAIAuthCore {
      * @return true, if successful
      */
     private boolean authorize(AAIUser aaiUser, String aaiMethod, String httpMethod) {
-        if ("info".equalsIgnoreCase(aaiMethod)|| aaiUser.hasAccess(aaiMethod, httpMethod)) {
+        if ("info".equalsIgnoreCase(aaiMethod) || aaiUser.hasAccess(aaiMethod, httpMethod)) {
             LOGGER.debug("AUTH ACCEPTED: " + aaiUser.getUsername() + " on function " + aaiMethod + " request type "
                     + httpMethod);
             return true;
index 9a02fe2..cfaa61b 100644 (file)
 
 package org.onap.aai.aaf.auth;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.onap.aaf.cadi.filter.CadiFilter;
+import static org.onap.aai.aaf.auth.ResponseFormatter.errorResponse;
 
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Properties;
 
-import static org.onap.aai.aaf.auth.ResponseFormatter.errorResponse;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.onap.aaf.cadi.filter.CadiFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * The Class AafRequestFilter provides common auth filter methods
index 0ecca67..f74ed3e 100644 (file)
 
 package org.onap.aai.aaf.auth;
 
+import java.util.*;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequestWrapper;
-import java.util.*;
 
 /**
  * The AafRequestWrapper sets the user in the principal name
index 26273a6..139e46c 100644 (file)
 
 package org.onap.aai.aaf.auth;
 
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.security.cert.X509Certificate;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
 import java.util.Properties;
+import java.util.stream.Collectors;
 
 import javax.servlet.http.HttpServletRequest;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.security.cert.X509Certificate;
-import java.util.stream.Collectors;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -39,8 +40,8 @@ import org.slf4j.LoggerFactory;
  * The Class CertUtil provides cert related utility methods.
  */
 public class CertUtil {
-    public static final String DEFAULT_CADI_ISSUERS = "CN=ATT AAF CADI Test Issuing " +
-        "CA 01, OU=CSO, O=ATT, C=US:CN=ATT AAF CADI Test Issuing CA 02, OU=CSO, O=ATT, C=US";
+    public static final String DEFAULT_CADI_ISSUERS = "CN=ATT AAF CADI Test Issuing "
+            + "CA 01, OU=CSO, O=ATT, C=US:CN=ATT AAF CADI Test Issuing CA 02, OU=CSO, O=ATT, C=US";
     public static final String CADI_PROP_FILES = "cadi_prop_files";
     public static final String CADI_ISSUERS_PROP_NAME = "cadi_x509_issuers";
     public static final String CADI_ISSUERS_SEPARATOR = ":";
index f5583b7..1748ed1 100644 (file)
 
 package org.onap.aai.aaf.auth;
 
-import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.logging.ErrorLogHelper;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.ws.rs.core.MediaType;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
+
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.logging.ErrorLogHelper;
 
 public class ResponseFormatter {
 
@@ -43,9 +44,10 @@ public class ResponseFormatter {
         errorResponse(new AAIException("AAI_3300"), request, response);
     }
 
-    public static void errorResponse(AAIException exception, HttpServletRequest request, HttpServletResponse response) throws IOException {
+    public static void errorResponse(AAIException exception, HttpServletRequest request, HttpServletResponse response)
+            throws IOException {
 
-        if(response.isCommitted()){
+        if (response.isCommitted()) {
             return;
         }
 
@@ -62,7 +64,8 @@ public class ResponseFormatter {
         response.setStatus(exception.getErrorObject().getHTTPResponseCode().getStatusCode());
         response.resetBuffer();
 
-        String resp = ErrorLogHelper.getRESTAPIErrorResponse(Collections.singletonList(MediaType.valueOf(accept)), exception, new ArrayList<>());
+        String resp = ErrorLogHelper.getRESTAPIErrorResponse(Collections.singletonList(MediaType.valueOf(accept)),
+                exception, new ArrayList<>());
         response.getOutputStream().print(resp);
         response.flushBuffer();
     }
index 82651e9..485fa7e 100644 (file)
 
 package org.onap.aai.aaf.filters;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 import org.onap.aai.aaf.auth.ResponseFormatter;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -28,16 +39,6 @@ import org.springframework.context.annotation.Profile;
 import org.springframework.context.annotation.PropertySource;
 import org.springframework.stereotype.Component;
 
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-
 /**
  * AAF authorization filter
  */
@@ -59,52 +60,49 @@ public class AafAuthorizationFilter extends OrderedRequestContextFilter {
     private List<String> advancedKeywordsList;
 
     @Autowired
-    public AafAuthorizationFilter(
-        GremlinFilter gremlinFilter,
-        @Value("${permission.type}") String type,
-        @Value("${permission.instance}") String instance,
-        @Value("${advanced.keywords.list:}") String advancedKeys
-    ) {
+    public AafAuthorizationFilter(GremlinFilter gremlinFilter, @Value("${permission.type}") String type,
+            @Value("${permission.instance}") String instance,
+            @Value("${advanced.keywords.list:}") String advancedKeys) {
         this.gremlinFilter = gremlinFilter;
         this.type = type;
         this.instance = instance;
-        if(advancedKeys == null || advancedKeys.isEmpty()){
+        if (advancedKeys == null || advancedKeys.isEmpty()) {
             this.advancedKeywordsList = new ArrayList<>();
         } else {
-            this.advancedKeywordsList = Arrays.stream(advancedKeys.split(","))
-                .collect(Collectors.toList());
+            this.advancedKeywordsList = Arrays.stream(advancedKeys.split(",")).collect(Collectors.toList());
         }
         this.setOrder(FilterPriority.AAF_AUTHORIZATION.getPriority());
     }
 
     @Override
-    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException {
-       if(request.getRequestURI().matches("^.*/util/echo$")){
-           filterChain.doFilter(request, response);
-       }
-        if(request.getRequestURI().endsWith("/query")){
+    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
+            throws IOException, ServletException {
+        if (request.getRequestURI().matches("^.*/util/echo$")) {
+            filterChain.doFilter(request, response);
+        }
+        if (request.getRequestURI().endsWith("/query")) {
             gremlinFilter.doBasicAuthFilter(request, response, filterChain);
         } else {
 
             String permission = null;
 
-            if(advancedKeywordsList == null || advancedKeywordsList.size() == 0) {
+            if (advancedKeywordsList == null || advancedKeywordsList.size() == 0) {
                 permission = String.format("%s|%s|%s", type, instance, request.getMethod().toLowerCase());
             } else {
 
                 boolean isAdvanced = this.containsAdvancedKeywords(request);
 
-                //if the URI contains advanced.keywords it's an advanced query
+                // if the URI contains advanced.keywords it's an advanced query
                 String queryType = isAdvanced ? ADVANCED : BASIC;
                 permission = String.format("%s|%s|%s", type, instance, queryType);
             }
 
             boolean isAuthorized = request.isUserInRole(permission);
 
-            if(!isAuthorized){
+            if (!isAuthorized) {
                 ResponseFormatter.errorResponse(request, response);
             } else {
-                filterChain.doFilter(request,response);
+                filterChain.doFilter(request, response);
             }
 
         }
@@ -112,7 +110,7 @@ public class AafAuthorizationFilter extends OrderedRequestContextFilter {
 
     private boolean containsAdvancedKeywords(HttpServletRequest request) {
         String uri = request.getRequestURI();
-        for (String keyword: advancedKeywordsList) {
+        for (String keyword : advancedKeywordsList) {
             if (uri.contains(keyword)) {
                 return true;
             }
index e0adf19..56799f1 100644 (file)
 
 package org.onap.aai.aaf.filters;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 import org.onap.aai.aaf.auth.AafRequestFilter;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -28,18 +39,6 @@ import org.springframework.context.annotation.Profile;
 import org.springframework.context.annotation.PropertySource;
 import org.springframework.stereotype.Component;
 
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-import java.util.stream.Collectors;
-
-
 /**
  * AAF with client cert authorization filter
  */
@@ -62,42 +61,41 @@ public class AafCertAuthorizationFilter extends OrderedRequestContextFilter {
     private List<String> advancedKeywordsList;
 
     @Autowired
-    public AafCertAuthorizationFilter(
-        @Value("${permission.type}") String type,
-        @Value("${permission.instance}") String instance,
-        @Value("${advanced.keywords.list:}") String advancedKeys,
-        CadiProps cadiProps
-    ) {
+    public AafCertAuthorizationFilter(@Value("${permission.type}") String type,
+            @Value("${permission.instance}") String instance, @Value("${advanced.keywords.list:}") String advancedKeys,
+            CadiProps cadiProps) {
         this.type = type;
         this.instance = instance;
         this.cadiProps = cadiProps;
-        if(advancedKeys == null || advancedKeys.isEmpty()){
+        if (advancedKeys == null || advancedKeys.isEmpty()) {
             this.advancedKeywordsList = new ArrayList<>();
         } else {
-            this.advancedKeywordsList = Arrays.stream(advancedKeys.split(","))
-                .collect(Collectors.toList());
+            this.advancedKeywordsList = Arrays.stream(advancedKeys.split(",")).collect(Collectors.toList());
         }
         this.setOrder(FilterPriority.AAF_CERT_AUTHORIZATION.getPriority());
     }
 
     @Override
-    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException {
-        if(advancedKeywordsList == null || advancedKeywordsList.size() == 0){
+    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
+            throws IOException, ServletException {
+        if (advancedKeywordsList == null || advancedKeywordsList.size() == 0) {
             String permission = String.format("%s|%s|%s", type, instance, request.getMethod().toLowerCase());
-            AafRequestFilter.authorizationFilter(request, response, filterChain, permission, cadiProps.getCadiProperties());
+            AafRequestFilter.authorizationFilter(request, response, filterChain, permission,
+                    cadiProps.getCadiProperties());
         } else {
             boolean isAdvanced = this.containsAdvancedKeywords(request);
 
-            //if the URI contains advanced.keywords it's an advanced query
+            // if the URI contains advanced.keywords it's an advanced query
             String queryType = isAdvanced ? ADVANCED : BASIC;
             String permission = String.format("%s|%s|%s", type, instance, queryType);
-            AafRequestFilter.authorizationFilter(request, response, filterChain, permission, cadiProps.getCadiProperties());
+            AafRequestFilter.authorizationFilter(request, response, filterChain, permission,
+                    cadiProps.getCadiProperties());
         }
     }
 
     private boolean containsAdvancedKeywords(HttpServletRequest request) {
         String uri = request.getRequestURI();
-        for (String keyword: advancedKeywordsList) {
+        for (String keyword : advancedKeywordsList) {
             if (uri.contains(keyword)) {
                 return true;
             }
index 7a47b97..e423dc0 100644 (file)
 
 package org.onap.aai.aaf.filters;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.io.IOException;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 import org.onap.aaf.cadi.PropAccess;
 import org.onap.aaf.cadi.filter.CadiFilter;
 import org.onap.aai.aaf.auth.AafRequestFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter;
@@ -32,12 +39,6 @@ import org.springframework.context.annotation.Profile;
 import org.springframework.context.annotation.PropertySource;
 import org.springframework.stereotype.Component;
 
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
 /**
  * AAF with client cert authentication filter
  */
@@ -57,12 +58,12 @@ public class AafCertFilter extends OrderedRequestContextFilter {
     private final CadiProps cadiProps;
 
     @Autowired
-    public AafCertFilter( @Value("${aaf.userchain.pattern}") String aafUserChainPattern,
-                          CadiProps cadiProps) throws IOException, ServletException {
+    public AafCertFilter(@Value("${aaf.userchain.pattern}") String aafUserChainPattern, CadiProps cadiProps)
+            throws IOException, ServletException {
 
         this.aafUserChainPattern = aafUserChainPattern;
         this.cadiProps = cadiProps;
-        cadiFilter = new CadiFilter(new PropAccess((level,element)->{
+        cadiFilter = new CadiFilter(new PropAccess((level, element) -> {
             switch (level) {
                 case DEBUG:
                     LOGGER.debug(buildMsg(element));
@@ -86,22 +87,24 @@ public class AafCertFilter extends OrderedRequestContextFilter {
                 case NONE:
                     break;
             }
-        }, new String[]{"cadi_prop_files=" + cadiProps.getCadiFileName()} ));
+        }, new String[] {"cadi_prop_files=" + cadiProps.getCadiFileName()}));
         this.setOrder(FilterPriority.AAF_CERT_AUTHENTICATION.getPriority());
     }
 
     @Override
-    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException {
-        AafRequestFilter.authenticationFilter(request, response, filterChain, cadiFilter, cadiProps.getCadiProperties(), aafUserChainPattern);
+    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
+            throws IOException, ServletException {
+        AafRequestFilter.authenticationFilter(request, response, filterChain, cadiFilter, cadiProps.getCadiProperties(),
+                aafUserChainPattern);
     }
+
     private String buildMsg(Object[] objects) {
         StringBuilder sb = new StringBuilder();
         boolean first = true;
-        for ( Object o: objects ) {
+        for (Object o : objects) {
             if (first) {
                 first = false;
-            }
-            else {
+            } else {
                 sb.append(' ');
             }
             sb.append(o.toString());
index e6769dd..5dbc2e7 100644 (file)
 
 package org.onap.aai.aaf.filters;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.io.IOException;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 import org.onap.aaf.cadi.PropAccess;
 import org.onap.aaf.cadi.filter.CadiFilter;
 import org.onap.aai.aaf.auth.ResponseFormatter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter;
 import org.springframework.context.annotation.Profile;
 import org.springframework.stereotype.Component;
 
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-
 /**
  * AAF authentication filter
  */
@@ -51,7 +51,7 @@ public class AafFilter extends OrderedRequestContextFilter {
 
     @Autowired
     public AafFilter(CadiProps cadiProps) throws IOException, ServletException {
-        cadiFilter = new CadiFilter(new PropAccess((level,element)->{
+        cadiFilter = new CadiFilter(new PropAccess((level, element) -> {
             switch (level) {
                 case DEBUG:
                     LOGGER.debug(buildMsg(element));
@@ -75,12 +75,13 @@ public class AafFilter extends OrderedRequestContextFilter {
                 case NONE:
                     break;
             }
-        }, new String[]{"cadi_prop_files=" + cadiProps.getCadiFileName()} ));
+        }, new String[] {"cadi_prop_files=" + cadiProps.getCadiFileName()}));
         this.setOrder(FilterPriority.AAF_AUTHENTICATION.getPriority());
     }
 
     @Override
-    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException {
+    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
+            throws IOException, ServletException {
         if (!request.getRequestURI().matches("^.*/util/echo$")) {
             cadiFilter.doFilter(request, response, filterChain);
             if (response.getStatus() == 401 || response.getStatus() == 403) {
@@ -94,11 +95,10 @@ public class AafFilter extends OrderedRequestContextFilter {
     private String buildMsg(Object[] objects) {
         StringBuilder sb = new StringBuilder();
         boolean first = true;
-        for ( Object o: objects ) {
+        for (Object o : objects) {
             if (first) {
                 first = false;
-            }
-            else {
+            } else {
                 sb.append(' ');
             }
             sb.append(o.toString());
index b587716..e87dc4a 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.aaf.filters;
 
 public class AafProfiles {
 
     // AAF Basic Auth
-    public static final String AAF_AUTHENTICATION  = "aaf-auth";
+    public static final String AAF_AUTHENTICATION = "aaf-auth";
 
     // AAF Auth with Client Certs
-    public static final String AAF_CERT_AUTHENTICATION  = "aaf-cert-auth";
+    public static final String AAF_CERT_AUTHENTICATION = "aaf-cert-auth";
 
-    public static final String TWO_WAY_SSL  = "two-way-ssl";
+    public static final String TWO_WAY_SSL = "two-way-ssl";
 
-    private AafProfiles(){}
+    private AafProfiles() {
+    }
 }
index 35e88f5..4bf9ea8 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.aaf.filters;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import javax.annotation.PostConstruct;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -26,20 +35,9 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Profile;
 import org.springframework.stereotype.Component;
 
-import javax.annotation.PostConstruct;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
 // This component will be created if and only if any of the following profiles are active
 @Component
-@Profile({
-    AafProfiles.AAF_CERT_AUTHENTICATION,
-    AafProfiles.AAF_AUTHENTICATION,
-    AafProfiles.TWO_WAY_SSL
-})
+@Profile({AafProfiles.AAF_CERT_AUTHENTICATION, AafProfiles.AAF_AUTHENTICATION, AafProfiles.TWO_WAY_SSL})
 public class CadiProps {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(CadiProps.class);
@@ -49,18 +47,19 @@ public class CadiProps {
     private Properties cadiProperties;
 
     @Autowired
-    public CadiProps(@Value("${aaf.cadi.file:./resources/cadi.properties}") String filename){
-        cadiFileName   = filename;
+    public CadiProps(@Value("${aaf.cadi.file:./resources/cadi.properties}") String filename) {
+        cadiFileName = filename;
         cadiProperties = new Properties();
     }
 
     @PostConstruct
     public void init() throws IOException {
 
-        File cadiFile  = new File(cadiFileName);
+        File cadiFile = new File(cadiFileName);
 
-        if(!cadiFile.exists()){
-            LOGGER.warn("Unable to find the cadi file in the given path {} so loading cadi.properties from classloader", cadiFileName);
+        if (!cadiFile.exists()) {
+            LOGGER.warn("Unable to find the cadi file in the given path {} so loading cadi.properties from classloader",
+                    cadiFileName);
             InputStream is = this.getClass().getClassLoader().getResourceAsStream("cadi.properties");
             cadiProperties.load(is);
         } else {
@@ -72,10 +71,12 @@ public class CadiProps {
 
         }
     }
+
     public String getCadiFileName() {
         return cadiFileName;
     }
-    public Properties getCadiProperties(){
+
+    public Properties getCadiProperties() {
         return cadiProperties;
     }
 }
index 17b9f0e..e242342 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.aaf.filters;
 
 import org.springframework.core.Ordered;
 
 public enum FilterPriority {
 
-    AAF_AUTHENTICATION(Ordered.HIGHEST_PRECEDENCE),
-    AAF_AUTHORIZATION(Ordered.HIGHEST_PRECEDENCE + 1), //higher number = lower priority
-    AAF_CERT_AUTHENTICATION(Ordered.HIGHEST_PRECEDENCE + 2 ),
-    AAF_CERT_AUTHORIZATION(Ordered.HIGHEST_PRECEDENCE + 3),
-    TWO_WAY_SSL_AUTH(Ordered.HIGHEST_PRECEDENCE + 4);
+    AAF_AUTHENTICATION(Ordered.HIGHEST_PRECEDENCE), AAF_AUTHORIZATION(Ordered.HIGHEST_PRECEDENCE + 1), // higher number
+                                                                                                       // = lower
+                                                                                                       // priority
+    AAF_CERT_AUTHENTICATION(Ordered.HIGHEST_PRECEDENCE + 2), AAF_CERT_AUTHORIZATION(
+            Ordered.HIGHEST_PRECEDENCE + 3), TWO_WAY_SSL_AUTH(Ordered.HIGHEST_PRECEDENCE + 4);
 
     private final int priority;
 
@@ -35,5 +36,7 @@ public enum FilterPriority {
         priority = p;
     }
 
-    public int getPriority() { return priority; }
+    public int getPriority() {
+        return priority;
+    }
 }
index ce96acf..dffa74e 100644 (file)
@@ -17,6 +17,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.aaf.filters;
 
 import java.io.IOException;
@@ -38,10 +39,7 @@ import org.springframework.context.annotation.Profile;
 import org.springframework.stereotype.Component;
 
 @Component
-@Profile({
-    AafProfiles.AAF_CERT_AUTHENTICATION,
-    AafProfiles.AAF_AUTHENTICATION
-})
+@Profile({AafProfiles.AAF_CERT_AUTHENTICATION, AafProfiles.AAF_AUTHENTICATION})
 public class GremlinFilter {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(GremlinFilter.class);
@@ -57,44 +55,46 @@ public class GremlinFilter {
     private CadiProps cadiProps;
 
     @Autowired
-    public GremlinFilter(
-        @Value("${permission.type}") String type,
-        @Value("${permission.instance}") String instance,
-        CadiProps cadiProps
-    ) {
+    public GremlinFilter(@Value("${permission.type}") String type, @Value("${permission.instance}") String instance,
+            CadiProps cadiProps) {
         this.type = type;
         this.instance = instance;
         this.cadiProps = cadiProps;
     }
 
-    public void doBasicAuthFilter(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException {
+    public void doBasicAuthFilter(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
+            throws IOException, ServletException {
         PayloadBufferingRequestWrapper requestBufferWrapper = new PayloadBufferingRequestWrapper(request);
 
-        if(ECHO_ENDPOINT.matcher(request.getRequestURI()).matches()){
+        if (ECHO_ENDPOINT.matcher(request.getRequestURI()).matches()) {
             filterChain.doFilter(requestBufferWrapper, response);
         }
 
         String payload = IOUtils.toString(requestBufferWrapper.getInputStream(), StandardCharsets.UTF_8.name());
         boolean containsWordGremlin = payload.contains("\"gremlin\"");
 
-        //if the requestBufferWrapper contains the word "gremlin" it's an "advanced" query needing an "advanced" role
+        // if the requestBufferWrapper contains the word "gremlin" it's an "advanced" query needing an "advanced" role
         String permissionBasic = String.format("%s|%s|%s", type, instance, BASIC);
         String permissionAdvanced = String.format("%s|%s|%s", type, instance, ADVANCED);
 
         boolean isAuthorized;
 
-        if(containsWordGremlin){
+        if (containsWordGremlin) {
             isAuthorized = requestBufferWrapper.isUserInRole(permissionAdvanced);
-        }else{
-            isAuthorized = requestBufferWrapper.isUserInRole(permissionAdvanced) || requestBufferWrapper.isUserInRole(permissionBasic);
+        } else {
+            isAuthorized = requestBufferWrapper.isUserInRole(permissionAdvanced)
+                    || requestBufferWrapper.isUserInRole(permissionBasic);
         }
 
-        if(!isAuthorized){
-            String name = requestBufferWrapper.getUserPrincipal() != null ? requestBufferWrapper.getUserPrincipal().getName() : "unknown";
-            LOGGER.info("User " + name + " does not have a role for " + (containsWordGremlin ? "gremlin" : "non-gremlin") + " query" );
+        if (!isAuthorized) {
+            String name =
+                    requestBufferWrapper.getUserPrincipal() != null ? requestBufferWrapper.getUserPrincipal().getName()
+                            : "unknown";
+            LOGGER.info("User " + name + " does not have a role for "
+                    + (containsWordGremlin ? "gremlin" : "non-gremlin") + " query");
             ResponseFormatter.errorResponse(request, response);
         } else {
-            filterChain.doFilter(requestBufferWrapper,response);
+            filterChain.doFilter(requestBufferWrapper, response);
         }
     }
 }
index 138189e..e8c72dc 100644 (file)
@@ -17,6 +17,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.aaf.filters;
 
 import java.io.ByteArrayInputStream;
index 150802b..3dad92d 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.aaf.filters;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.security.cert.X509Certificate;
+import java.util.*;
+
+import javax.security.auth.x500.X500Principal;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 import org.onap.aai.aaf.auth.AAIAuthCore;
 import org.onap.aai.aaf.auth.CertUtil;
 import org.onap.aai.aaf.auth.ResponseFormatter;
 import org.onap.aai.exceptions.AAIException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter;
 import org.springframework.context.annotation.Profile;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Component;
 
-import javax.security.auth.x500.X500Principal;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.security.cert.X509Certificate;
-import java.util.*;
-
 @Component
 @Profile("two-way-ssl")
 public class TwoWaySslAuthorization extends OrderedRequestContextFilter {
@@ -59,12 +61,13 @@ public class TwoWaySslAuthorization extends OrderedRequestContextFilter {
     @Autowired
     private CadiProps cadiProps;
 
-    public TwoWaySslAuthorization(){
+    public TwoWaySslAuthorization() {
         this.setOrder(FilterPriority.TWO_WAY_SSL_AUTH.getPriority());
     }
 
     @Override
-    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException {
+    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
+            throws IOException, ServletException {
 
         String uri = request.getRequestURI();
         String httpMethod = getHttpMethod(request);
@@ -80,11 +83,11 @@ public class TwoWaySslAuthorization extends OrderedRequestContextFilter {
                 ResponseFormatter.errorResponse(aaie, request, response);
                 return;
             }
-            issuer = issuer.replaceAll("\\s+","").toUpperCase();
+            issuer = issuer.replaceAll("\\s+", "").toUpperCase();
 
             List<String> cadiConfiguredIssuers = CertUtil.getCadiCertIssuers(cadiProperties);
             boolean isAafAuthProfileActive = this.isAafAuthProfileActive();
-            if ((!isAafAuthProfileActive) || (!cadiConfiguredIssuers.contains(issuer))  ) {
+            if ((!isAafAuthProfileActive) || (!cadiConfiguredIssuers.contains(issuer))) {
                 try {
                     this.authorize(uri, httpMethod, authUser.get(), this.getHaProxyUser(request), issuer);
                 } catch (AAIException e) {
@@ -100,11 +103,9 @@ public class TwoWaySslAuthorization extends OrderedRequestContextFilter {
         filterChain.doFilter(request, response);
     }
 
-
     private String getHttpMethod(HttpServletRequest request) {
         String httpMethod = request.getMethod();
-        if ("POST".equalsIgnoreCase(httpMethod)
-            && "PATCH".equals(request.getHeader(HTTP_METHOD_OVERRIDE))) {
+        if ("POST".equalsIgnoreCase(httpMethod) && "PATCH".equals(request.getHeader(HTTP_METHOD_OVERRIDE))) {
             httpMethod = MERGE_PATCH;
         }
         if (httpMethod.equalsIgnoreCase(MERGE_PATCH) || "patch".equalsIgnoreCase(httpMethod)) {
@@ -148,26 +149,26 @@ public class TwoWaySslAuthorization extends OrderedRequestContextFilter {
 
     private String getHaProxyUser(HttpServletRequest hsr) {
         String haProxyUser;
-        if (Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-CN"))
-            || Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-OU"))
-            || Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-O"))
-            || Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-L"))
-            || Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-ST"))
-            || Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-C"))) {
+        if (Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-CN")) || Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-OU"))
+                || Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-O"))
+                || Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-L"))
+                || Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-ST"))
+                || Objects.isNull(hsr.getHeader("X-AAI-SSL-Client-C"))) {
             haProxyUser = "";
         } else {
             haProxyUser = String.format("CN=%s, OU=%s, O=\"%s\", L=%s, ST=%s, C=%s",
-                Objects.toString(hsr.getHeader("X-AAI-SSL-Client-CN"), ""),
-                Objects.toString(hsr.getHeader("X-AAI-SSL-Client-OU"), ""),
-                Objects.toString(hsr.getHeader("X-AAI-SSL-Client-O"), ""),
-                Objects.toString(hsr.getHeader("X-AAI-SSL-Client-L"), ""),
-                Objects.toString(hsr.getHeader("X-AAI-SSL-Client-ST"), ""),
-                Objects.toString(hsr.getHeader("X-AAI-SSL-Client-C"), "")).toLowerCase();
+                    Objects.toString(hsr.getHeader("X-AAI-SSL-Client-CN"), ""),
+                    Objects.toString(hsr.getHeader("X-AAI-SSL-Client-OU"), ""),
+                    Objects.toString(hsr.getHeader("X-AAI-SSL-Client-O"), ""),
+                    Objects.toString(hsr.getHeader("X-AAI-SSL-Client-L"), ""),
+                    Objects.toString(hsr.getHeader("X-AAI-SSL-Client-ST"), ""),
+                    Objects.toString(hsr.getHeader("X-AAI-SSL-Client-C"), "")).toLowerCase();
         }
         return haProxyUser;
     }
 
-    private void authorize(String uri, String httpMethod, String authUser, String haProxyUser, String issuer) throws AAIException {
+    private void authorize(String uri, String httpMethod, String authUser, String haProxyUser, String issuer)
+            throws AAIException {
         if (!aaiAuthCore.authorize(authUser, uri, httpMethod, haProxyUser, issuer)) {
             throw new AAIException("AAI_9101", "Request on " + httpMethod + " " + uri + " status is not OK");
         }
@@ -176,8 +177,7 @@ public class TwoWaySslAuthorization extends OrderedRequestContextFilter {
     private boolean isAafAuthProfileActive() {
         String[] profiles = environment.getActiveProfiles();
         if (profiles != null) {
-            if (Arrays.stream(profiles).anyMatch(
-                env -> (env.equalsIgnoreCase(AafProfiles.AAF_CERT_AUTHENTICATION)))) {
+            if (Arrays.stream(profiles).anyMatch(env -> (env.equalsIgnoreCase(AafProfiles.AAF_CERT_AUTHENTICATION)))) {
                 return true;
             }
         }
index 6fca4fd..813e8fa 100644 (file)
 
 package org.onap.aai.aaf.auth;
 
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.aai.aaf.auth.exceptions.AAIUnrecognizedFunctionException;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.aai.aaf.auth.exceptions.AAIUnrecognizedFunctionException;
+
 public class AAIAuthCoreTest extends AAISetup {
 
     private AAIAuthCore authCore;
index 0827782..3284d7a 100644 (file)
@@ -17,6 +17,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.aaf.auth;
 
 import org.junit.BeforeClass;
@@ -24,7 +25,7 @@ import org.junit.BeforeClass;
 public class AAISetup {
 
     @BeforeClass
-    public static void preSetup(){
+    public static void preSetup() {
         System.setProperty("AJSC_HOME", ".");
         System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local");
     }
index e3b79cb..5f02f1a 100644 (file)
 
 package org.onap.aai.aaf.auth;
 
-import org.junit.Test;
-
 import static org.junit.Assert.assertEquals;
 
+import org.junit.Test;
+
 public class AAIUserTest extends AAISetup {
 
     @Test
index ebc72e2..46389d0 100644 (file)
  *
  *
  */
-package org.onap.aai.aaf.auth;
-
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
 
-import javax.servlet.http.HttpServletRequest;
+package org.onap.aai.aaf.auth;
 
 import static org.easymock.EasyMock.*;
 import static org.junit.Assert.assertEquals;
 
-public class AafRequestWrapperTest {
+import javax.servlet.http.HttpServletRequest;
 
+import org.junit.Test;
 
+public class AafRequestWrapperTest {
 
     @Test
-    public void testGetHeader(){
+    public void testGetHeader() {
         HttpServletRequest mockRequest = createMock(HttpServletRequest.class);
         expect(mockRequest.getHeader(CertUtil.AAI_SSL_CLIENT_OU_HDR)).andReturn("m55555@org.onap.com:TEST").times(1, 4);
         replay(mockRequest);
-        AafRequestWrapper af= new AafRequestWrapper(mockRequest);
-        assertEquals(af.getHeader("X-AAI-SSL-Client-OU"),"m55555@org.onap.com:TEST");
-        af.putHeader("X-AAI-SSL-Client-C","test@org.onap.com:test");
-        assertEquals(af.getHeader("X-AAI-SSL-Client-C"),"test@org.onap.com:test");
+        AafRequestWrapper af = new AafRequestWrapper(mockRequest);
+        assertEquals(af.getHeader("X-AAI-SSL-Client-OU"), "m55555@org.onap.com:TEST");
+        af.putHeader("X-AAI-SSL-Client-C", "test@org.onap.com:test");
+        assertEquals(af.getHeader("X-AAI-SSL-Client-C"), "test@org.onap.com:test");
     }
 }
index 9f307ac..81a9c1b 100644 (file)
 
 package org.onap.aai.aaf.auth;
 
-import org.junit.BeforeClass;
-import org.junit.Test;
+import static org.easymock.EasyMock.*;
+import static org.junit.Assert.assertTrue;
 
-import javax.servlet.http.HttpServletRequest;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.List;
 import java.util.Properties;
 
-import static org.easymock.EasyMock.*;
-import static org.junit.Assert.assertTrue;
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Test;
 
 /**
  * The Class CertUtilTest
index c3973b1..601b829 100644 (file)
  *
  *
  */
-package org.onap.aai.aaf.filters;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.util.AAIConfig;
-import org.springframework.beans.factory.annotation.Autowired;
 
-import java.io.IOException;
+package org.onap.aai.aaf.filters;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
 public class CadiPropsTest {
     @Autowired
-    CadiProps ca =new CadiProps("src/test/resources/bundleconfig-local/aaf/org.onap.aai.props");
+    CadiProps ca = new CadiProps("src/test/resources/bundleconfig-local/aaf/org.onap.aai.props");
 
     @Test
-    public void testGetCadiFileName(){
-        assertEquals(ca.getCadiFileName(),"src/test/resources/bundleconfig-local/aaf/org.onap.aai.props");
+    public void testGetCadiFileName() {
+        assertEquals(ca.getCadiFileName(), "src/test/resources/bundleconfig-local/aaf/org.onap.aai.props");
         assertNotNull(ca.getCadiProperties());
     }
 }
index 1534c8d..406800f 100644 (file)
@@ -127,7 +127,8 @@ public enum ObjectMetadata {
     ALLOW_DIRECT_WRITE("allowDirectWrite"),
     /**
      * properties that are allowed to be in start node in a DSL
-     * <br><b>comma separated list</b>
+     * <br>
+     * <b>comma separated list</b>
      */
     DSL_START_NODE_PROPS("dslStartNodeProps");
 
index e41ae28..c988ddf 100644 (file)
@@ -20,8 +20,6 @@
 
 package org.onap.aai.annotations;
 
-import org.onap.aai.annotations.Metadata;
-
 public class AnnotationsTest {
 
     public AnnotationsTest() {
index 0a027d6..ae493ef 100644 (file)
@@ -22,6 +22,8 @@
 
 package org.onap.aai.audit;
 
+import com.google.common.base.CaseFormat;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -46,8 +48,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 
-import com.google.common.base.CaseFormat;
-
 /**
  * The Class ListEndpoints.
  */
index 69560ec..2703bdc 100644 (file)
@@ -44,7 +44,7 @@ public abstract class AaiCallable<T> implements Callable<T> {
      * The call method
      */
     public T call() throws Exception {
-        if ( mdcCopy != null ) {
+        if (mdcCopy != null) {
             MDC.setContextMap(mdcCopy);
         }
         return process();
index 0c83c2b..b945d85 100644 (file)
@@ -17,6 +17,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.config;
 
 import org.onap.aai.transforms.XmlFormatTransformer;
@@ -27,7 +28,7 @@ import org.springframework.context.annotation.Configuration;
 public class XmlFormatTransformerConfiguration {
 
     @Bean
-    public XmlFormatTransformer xmlFormatTransformer(){
+    public XmlFormatTransformer xmlFormatTransformer() {
         return new XmlFormatTransformer();
     }
 }
index 1b3a328..7ed8da4 100644 (file)
@@ -20,9 +20,6 @@
 
 package org.onap.aai.dbgen;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
@@ -60,6 +57,8 @@ import org.apache.tinkerpop.shaded.jackson.core.type.TypeReference;
 import org.apache.tinkerpop.shaded.jackson.databind.JsonNode;
 import org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper;
 import org.apache.tinkerpop.shaded.jackson.databind.node.JsonNodeType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * This is a Wrapper around the GraphsonReader class
index 9f3e747..250c126 100644 (file)
  */
 
 package org.onap.aai.dbgen;
-import org.onap.aai.util.AAIConstants;
+
 import com.google.common.collect.Multimap;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.janusgraph.core.Cardinality;
 import org.janusgraph.core.Multiplicity;
 import org.janusgraph.core.PropertyKey;
-import org.janusgraph.core.schema.JanusGraphManagement;
-import org.janusgraph.core.schema.JanusGraphIndex;
 import org.janusgraph.core.schema.ConsistencyModifier;
+import org.janusgraph.core.schema.JanusGraphIndex;
+import org.janusgraph.core.schema.JanusGraphManagement;
 import org.onap.aai.config.SpringContextAware;
 import org.onap.aai.edges.EdgeIngestor;
 import org.onap.aai.edges.EdgeRule;
@@ -37,17 +46,10 @@ import org.onap.aai.introspection.LoaderUtil;
 import org.onap.aai.logging.LogFormatTools;
 import org.onap.aai.schema.enums.PropertyMetadata;
 import org.onap.aai.util.AAIConfig;
+import org.onap.aai.util.AAIConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
 public class SchemaGenerator {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(SchemaGenerator.class);
@@ -85,7 +87,6 @@ public class SchemaGenerator {
 
         makeEdgeLabels(graphMgmt);
 
-
         Map<String, Introspector> objs = LoaderUtil.getLatestVersion().getAllObjects();
         Map<String, PropertyKey> seenProps = new HashMap<>();
 
@@ -112,8 +113,8 @@ public class SchemaGenerator {
 
                     if (process) {
 
-                        LOGGER.info("Creating PropertyKey: [{}], [{}], [{}]",
-                                dbPropName, type.getSimpleName(), cardinality);
+                        LOGGER.info("Creating PropertyKey: [{}], [{}], [{}]", dbPropName, type.getSimpleName(),
+                                cardinality);
                         PropertyKey propK;
                         if (!seenProps.containsKey(dbPropName)) {
                             propK = graphMgmt.makePropertyKey(dbPropName).dataType(type).cardinality(cardinality)
@@ -125,8 +126,7 @@ public class SchemaGenerator {
                                     LOGGER.info(" Lock is being set for aai-uri Property.");
                                     graphMgmt.setConsistency(propK, ConsistencyModifier.LOCK);
                                 }
-                            }
-                            else if (dbPropName.equals("resource-version")) {
+                            } else if (dbPropName.equals("resource-version")) {
                                 String aai_rv_lock_enabled = AAIConfig.get(AAIConstants.AAI_LOCK_RV_ENABLED, "false");
                                 LOGGER.info(" Info: aai_rv_lock_enabled:" + aai_rv_lock_enabled);
                                 if ("true".equals(aai_rv_lock_enabled)) {
@@ -146,21 +146,23 @@ public class SchemaGenerator {
                                 if (obj.getUniqueProperties().contains(propName)) {
                                     LOGGER.info("Add Unique index for PropertyKey: [{}]", dbPropName);
                                     indexG = graphMgmt.buildIndex(dbPropName, Vertex.class).addKey(propK).unique()
-                                           .buildCompositeIndex();
+                                            .buildCompositeIndex();
                                 } else {
                                     LOGGER.info("Add index for PropertyKey: [{}]", dbPropName);
-                                    indexG = graphMgmt.buildIndex(dbPropName, Vertex.class).addKey(propK).buildCompositeIndex();
+                                    indexG = graphMgmt.buildIndex(dbPropName, Vertex.class).addKey(propK)
+                                            .buildCompositeIndex();
                                 }
                                 if (indexG != null && dbPropName.equals("aai-uri")) {
-                                    String aai_uri_lock_enabled = AAIConfig.get(AAIConstants.AAI_LOCK_URI_ENABLED, "false");
+                                    String aai_uri_lock_enabled =
+                                            AAIConfig.get(AAIConstants.AAI_LOCK_URI_ENABLED, "false");
                                     LOGGER.info(" Info:: aai_uri_lock_enabled:" + aai_uri_lock_enabled);
                                     if ("true".equals(aai_uri_lock_enabled)) {
                                         LOGGER.info("Lock is being set for aai-uri Index.");
                                         graphMgmt.setConsistency(indexG, ConsistencyModifier.LOCK);
                                     }
-                                }
-                                else if (indexG != null && dbPropName.equals("resource-version")) {
-                                    String aai_rv_lock_enabled = AAIConfig.get(AAIConstants.AAI_LOCK_RV_ENABLED, "false");
+                                } else if (indexG != null && dbPropName.equals("resource-version")) {
+                                    String aai_rv_lock_enabled =
+                                            AAIConfig.get(AAIConstants.AAI_LOCK_RV_ENABLED, "false");
                                     LOGGER.info(" Info:: aai_rv_lock_enabled:" + aai_rv_lock_enabled);
                                     if ("true".equals(aai_rv_lock_enabled)) {
                                         LOGGER.info("Lock is being set for resource-version Index.");
@@ -189,8 +191,7 @@ public class SchemaGenerator {
             EdgeIngestor edgeIngestor = SpringContextAware.getBean(EdgeIngestor.class);
 
             Set<String> labels = Optional.ofNullable(edgeIngestor.getAllCurrentRules())
-                    .map(collectValues(EdgeRule::getLabel))
-                    .orElseGet(HashSet::new);
+                    .map(collectValues(EdgeRule::getLabel)).orElseGet(HashSet::new);
 
             labels.forEach(label -> {
                 if (graphMgmt.containsRelationType(label)) {
index a35625f..9582568 100644 (file)
 
 package org.onap.aai.dbgen;
 
+import static org.onap.aai.db.props.AAIProperties.*;
+
 import com.google.common.collect.Multimap;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.janusgraph.core.Cardinality;
 import org.janusgraph.core.Multiplicity;
@@ -39,21 +48,14 @@ import org.onap.aai.util.AAIConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-
-import static org.onap.aai.db.props.AAIProperties.*;
-
 public class SchemaGenerator4Hist {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(SchemaGenerator4Hist.class);
 
-    private SchemaGenerator4Hist(){
+    private SchemaGenerator4Hist() {
 
     }
+
     /**
      * Load schema into JanusGraph.
      *
@@ -125,12 +127,12 @@ public class SchemaGenerator4Hist {
                     Cardinality cardinality = Cardinality.LIST;
                     boolean process = false;
                     if (obj.isListType(propName) && obj.isSimpleGenericType(propName)) {
-                       // NOTE - For history - All properties have cardinality = LIST
-                       // It is assumed that there is special processing in the Resources MS
-                       // for History to turn what used to be SET (referred to as isListType
-                       // above) will be stored in our db as a single String.  And that
-                       // single string will have Cardinality = LIST so we can track its
-                       // history.
+                        // NOTE - For history - All properties have cardinality = LIST
+                        // It is assumed that there is special processing in the Resources MS
+                        // for History to turn what used to be SET (referred to as isListType
+                        // above) will be stored in our db as a single String. And that
+                        // single string will have Cardinality = LIST so we can track its
+                        // history.
                         type = obj.getGenericTypeClass(propName);
                         process = true;
                     } else if (obj.isSimpleType(propName)) {
@@ -139,8 +141,8 @@ public class SchemaGenerator4Hist {
 
                     if (process) {
 
-                        LOGGER.info(" Creating PropertyKey: [{}], [{}], [{}]",
-                                dbPropName, type.getSimpleName(), cardinality);
+                        LOGGER.info(" Creating PropertyKey: [{}], [{}], [{}]", dbPropName, type.getSimpleName(),
+                                cardinality);
                         PropertyKey propK;
                         if (!seenProps.containsKey(dbPropName)) {
                             propK = graphMgmt.makePropertyKey(dbPropName).dataType(type).cardinality(cardinality)
@@ -153,7 +155,7 @@ public class SchemaGenerator4Hist {
                             LOGGER.debug(" Index  [{}] already existed in the DB. ", dbPropName);
                         } else {
                             if (obj.getIndexedProperties().contains(propName)) {
-                               // NOTE - for History we never add a unique index - just a regular index
+                                // NOTE - for History we never add a unique index - just a regular index
                                 LOGGER.info("Add index for PropertyKey: [{}]", dbPropName);
                                 graphMgmt.buildIndex(dbPropName, Vertex.class).addKey(propK).buildCompositeIndex();
                             } else {
@@ -163,20 +165,19 @@ public class SchemaGenerator4Hist {
                     }
                 }
             }
-        }// Done processing all properties defined in the OXM
+        } // Done processing all properties defined in the OXM
 
         // Add the 3 new History properties are in the DB
         // They are all Cardinality=Single since instance of a Node, Edge or Property can
-        //  only have one of them.  That is, a Property can show up many times in a
-        //  node, but each instance of that property will only have a single start-ts,
-        //  end-ts, end-source-of-truth.  Same goes for a node or edge itself.
+        // only have one of them. That is, a Property can show up many times in a
+        // node, but each instance of that property will only have a single start-ts,
+        // end-ts, end-source-of-truth. Same goes for a node or edge itself.
         makeNewProperty(graphMgmt, seenProps, String.class, END_SOT);
         makeNewProperty(graphMgmt, seenProps, Long.class, START_TS);
         makeNewProperty(graphMgmt, seenProps, Long.class, END_TS);
         makeNewProperty(graphMgmt, seenProps, String.class, START_TX_ID);
         makeNewProperty(graphMgmt, seenProps, String.class, END_TX_ID);
 
-
         String imsg = "-- About to call graphMgmt commit";
         LOGGER.info(imsg);
         graphMgmt.commit();
@@ -186,17 +187,14 @@ public class SchemaGenerator4Hist {
 
     }
 
-    private static <T> void makeNewProperty(JanusGraphManagement graphMgmt,
-                                            Map<String, PropertyKey> seenProps,
-                                            Class<T> type,
-                                            String propertyName) {
+    private static <T> void makeNewProperty(JanusGraphManagement graphMgmt, Map<String, PropertyKey> seenProps,
+            Class<T> type, String propertyName) {
         if (graphMgmt.containsRelationType(propertyName)) {
             LOGGER.debug("PropertyKey [{}] already existed in the DB.", propertyName);
         } else if (!seenProps.containsKey(propertyName)) {
-            LOGGER.info("Creating PropertyKey: [{}], [{}], [{}]",
-                    propertyName, type.getSimpleName(), Cardinality.SINGLE);
-            graphMgmt.makePropertyKey(propertyName).dataType(type).cardinality(Cardinality.SINGLE)
-                    .make();
+            LOGGER.info("Creating PropertyKey: [{}], [{}], [{}]", propertyName, type.getSimpleName(),
+                    Cardinality.SINGLE);
+            graphMgmt.makePropertyKey(propertyName).dataType(type).cardinality(Cardinality.SINGLE).make();
         }
     }
 }
index 62ac4f0..cb388cc 100644 (file)
@@ -58,8 +58,6 @@ public class AAIGraph {
     protected JanusGraph graph;
     private static boolean isInit = false;
 
-
-
     /**
      * Instantiates a new AAI graph.
      */
@@ -139,7 +137,8 @@ public class AAIGraph {
                     transaction.tx().commit();
                     logger.info("Snapshot loaded to inmemory graph.");
                 } catch (Exception e) {
-                    logger.info(String.format("ERROR: Could not load datasnapshot to in memory graph. %n%s", ExceptionUtils.getStackTrace(e)));
+                    logger.info(String.format("ERROR: Could not load datasnapshot to in memory graph. %n%s",
+                            ExceptionUtils.getStackTrace(e)));
                     throw new RuntimeException(e);
                 }
             }
@@ -151,7 +150,8 @@ public class AAIGraph {
         JanusGraphManagement graphMgt = graph.openManagement();
 
         logger.info("-- loading schema into JanusGraph");
-        if ("true".equals(SpringContextAware.getApplicationContext().getEnvironment().getProperty("history.enabled", "false"))) {
+        if ("true".equals(
+                SpringContextAware.getApplicationContext().getEnvironment().getProperty("history.enabled", "false"))) {
             SchemaGenerator4Hist.loadSchemaIntoJanusGraph(graphMgt, IN_MEMORY);
         } else {
             SchemaGenerator.loadSchemaIntoJanusGraph(graphMgt, IN_MEMORY);
index 4dbc122..b6afe62 100644 (file)
@@ -35,7 +35,6 @@ import org.janusgraph.diskstorage.configuration.ConfigElement;
  */
 public class AAIGraphConfig {
 
-
     private AAIGraphConfig() {
 
     }
index ac9407e..51a2c22 100644 (file)
@@ -20,9 +20,6 @@
 
 package org.onap.aai.dbmap;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -36,6 +33,8 @@ import org.janusgraph.core.schema.JanusGraphManagement;
 import org.onap.aai.dbgen.GraphSONPartialIO;
 import org.onap.aai.dbgen.SchemaGenerator;
 import org.onap.aai.logging.LogFormatTools;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class InMemoryGraph {
 
@@ -46,7 +45,7 @@ public class InMemoryGraph {
         /*
          * Create a In-memory graph
          */
-        try(InputStream is = new FileInputStream(builder.propertyFile)){
+        try (InputStream is = new FileInputStream(builder.propertyFile)) {
             graph = JanusGraphFactory.open(builder.propertyFile);
 
             Properties graphProps = new Properties();
@@ -63,7 +62,7 @@ public class InMemoryGraph {
                         transaction.io(GraphSONPartialIO.build()).readGraph(builder.graphsonLocation);
                     } else {
                         transaction.io(GraphSONPartialIO.build()).reader().create().readGraph(builder.seqInputStream,
-                            graph);
+                                graph);
                     }
                 } else {
                     if ((builder.graphsonLocation != null) && (builder.graphsonLocation.length() > 0)) {
@@ -76,7 +75,8 @@ public class InMemoryGraph {
             }
 
         } catch (Exception e) {
-            LOGGER.error(String.format("ERROR: Could not load datasnapshot to in memory graph. %n%s", LogFormatTools.getStackTop(e)));
+            LOGGER.error(String.format("ERROR: Could not load datasnapshot to in memory graph. %n%s",
+                    LogFormatTools.getStackTop(e)));
             throw new IllegalStateException("Could not load datasnapshot to in memory graph");
 
         }
index 3c03046..2858ece 100644 (file)
 
 package org.onap.aai.dmaap;
 
+import java.util.Map;
+import java.util.Objects;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TextMessage;
+
 import org.json.JSONException;
 import org.json.JSONObject;
 import org.onap.aai.aailog.logs.AaiDmaapMetricLog;
@@ -37,13 +45,6 @@ import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpMethod;
 import org.springframework.web.client.RestTemplate;
 
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.TextMessage;
-import java.util.Map;
-import java.util.Objects;
-
 public class AAIDmaapEventJMSConsumer implements MessageListener {
 
     private static final String EVENT_TOPIC = "event-topic";
@@ -57,7 +58,6 @@ public class AAIDmaapEventJMSConsumer implements MessageListener {
     private Environment environment;
     private Map<String, String> mdcCopy;
 
-
     public AAIDmaapEventJMSConsumer(Environment environment, RestTemplate restTemplate, HttpHeaders httpHeaders) {
         super();
         mdcCopy = MDC.getCopyOfContextMap();
@@ -86,7 +86,7 @@ public class AAIDmaapEventJMSConsumer implements MessageListener {
         String aaiElsErrorCode = AaiElsErrorCode.SUCCESS;
         String errorDescription = "";
 
-        if ( mdcCopy != null ) {
+        if (mdcCopy != null) {
             MDC.setContextMap(mdcCopy);
         }
 
@@ -113,8 +113,7 @@ public class AAIDmaapEventJMSConsumer implements MessageListener {
                         if (aaiEventHeader.has("entity-link")) {
                             serviceName = aaiEventHeader.get("entity-link").toString();
                         }
-                    }
-                    catch (JSONException jexc) {
+                    } catch (JSONException jexc) {
                         // ignore, this is just used for logging
                     }
                 }
@@ -139,8 +138,7 @@ public class AAIDmaapEventJMSConsumer implements MessageListener {
                 aaiElsErrorCode = AaiElsErrorCode.AVAILABILITY_TIMEOUT_ERROR;
                 errorDescription = e.getMessage();
                 ErrorLogHelper.logException(new AAIException("AAI_7304", jsmMessageTxt));
-            }
-            finally {
+            } finally {
                 metricLog.post(aaiElsErrorCode, errorDescription);
             }
         }
index 1df64b6..da70d50 100644 (file)
@@ -25,5 +25,6 @@ import org.json.JSONObject;
 public interface MessageProducer {
 
     void sendMessageToDefaultDestination(JSONObject finalJson);
+
     void sendMessageToDefaultDestination(String msg);
 }
index ac13ab0..7b5b2da 100644 (file)
 
 package org.onap.aai.domain.model;
 
-import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
-
 import java.util.HashMap;
 import java.util.Map;
 
+import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
+
 public class AAIResources {
 
     private DynamicJAXBContext jaxbContext;
index 1e6307c..dad3566 100644 (file)
 
 package org.onap.aai.domain.notificationEvent;
 
-import org.w3c.dom.Element;
-
 import javax.xml.bind.annotation.*;
 
+import org.w3c.dom.Element;
+
 /**
  * <p>
  * Java class for anonymous complex type.
index c48f1ed..f7fe13b 100644 (file)
@@ -29,10 +29,11 @@ package org.onap.aai.domain.responseMessage;
 //Generated on: 2015.09.11 at 11:53:27 AM EDT
 //
 
-import javax.xml.bind.annotation.*;
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.xml.bind.annotation.*;
+
 @XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = "", propOrder = {"aaiResponseMessageDatum", "any"})
 @XmlRootElement(name = "aai-response-message-data", namespace = "http://org.onap.aai.inventory")
index 8263e58..f506874 100644 (file)
@@ -27,10 +27,11 @@ package org.onap.aai.domain.responseMessage;
 //Generated on: 2015.09.11 at 11:53:27 AM EDT
 //
 
-import javax.xml.bind.annotation.*;
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.xml.bind.annotation.*;
+
 /**
  * <p>
  * Java class for anonymous complex type.
index cde4f4b..d1caf51 100644 (file)
 
 package org.onap.aai.domain.translog;
 
+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.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
-import java.util.ArrayList;
-import java.util.List;
 
 /**
  * <p>
index 16c773a..37a1eef 100644 (file)
 
 package org.onap.aai.domain.translog;
 
-import org.eclipse.persistence.oxm.annotations.XmlCDATA;
-
 import javax.xml.bind.annotation.*;
 
+import org.eclipse.persistence.oxm.annotations.XmlCDATA;
+
 @XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(
         name = "",
index ec28858..612273d 100644 (file)
 
 package org.onap.aai.extensions;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.lang.reflect.Method;
 
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.util.AAIConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ExtensionController {
 
index 094e7ce..5f7a9a1 100644 (file)
@@ -31,7 +31,6 @@ import org.onap.aai.edges.enums.EdgeType;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.Introspector;
 import org.onap.aai.introspection.Loader;
-import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
 import org.onap.aai.parsers.query.QueryParser;
 import org.onap.aai.query.builder.QueryBuilder;
 import org.onap.aai.rest.db.DBRequest;
index 62cadab..1d66a8a 100644 (file)
@@ -30,7 +30,6 @@ import java.util.UUID;
 
 import javax.xml.transform.stream.StreamSource;
 
-import org.onap.aai.config.SpringContextAware;
 import org.onap.aai.introspection.Introspector;
 import org.onap.aai.introspection.Loader;
 import org.onap.aai.introspection.LoaderFactory;
index 117610f..c9e1f45 100644 (file)
@@ -20,6 +20,8 @@
 
 package org.onap.aai.introspection;
 
+import com.google.common.base.CaseFormat;
+
 import java.io.UnsupportedEncodingException;
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
@@ -48,8 +50,6 @@ import org.onap.aai.workarounds.NamingExceptions;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.CaseFormat;
-
 public abstract class Introspector implements Cloneable {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(Introspector.class);
@@ -185,7 +185,7 @@ public abstract class Introspector implements Cloneable {
         if (obj != null) {
 
             try {
-                if (! (obj.getClass().getCanonicalName().equals(nameClass.getCanonicalName()))) {
+                if (!(obj.getClass().getCanonicalName().equals(nameClass.getCanonicalName()))) {
                     if (nameClass.isPrimitive()) {
                         nameClass = ClassUtils.primitiveToWrapper(nameClass);
                         result = nameClass.getConstructor(String.class).newInstance(obj.toString());
@@ -317,8 +317,7 @@ public abstract class Introspector implements Cloneable {
             String indexedKeys = this.getMetadata(ObjectMetadata.INDEXED_PROPS);
             if (dslKeys != null) {
                 Arrays.stream(dslKeys.split(",")).forEach(result::add);
-            }
-            else if(indexedKeys != null){
+            } else if (indexedKeys != null) {
                 Arrays.stream(indexedKeys.split(",")).forEach(result::add);
             }
             this.dslStartNodeProperties = Collections.unmodifiableSet(result);
index 93a4829..e6ecef0 100644 (file)
@@ -20,9 +20,6 @@
 
 package org.onap.aai.introspection;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.List;
@@ -31,6 +28,8 @@ import java.util.Set;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
 import org.onap.aai.logging.LogFormatTools;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class IntrospectorWalker {
 
index 484e561..4035236 100644 (file)
@@ -25,6 +25,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
+
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
 import org.onap.aai.schema.enums.ObjectMetadata;
index 7471c74..6099e1b 100644 (file)
@@ -20,8 +20,6 @@
 
 package org.onap.aai.introspection;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.google.common.base.CaseFormat;
 import com.google.common.collect.ImmutableMap;
 
@@ -49,6 +47,8 @@ import org.onap.aai.restcore.MediaType;
 import org.onap.aai.schema.enums.ObjectMetadata;
 import org.onap.aai.setup.SchemaVersion;
 import org.onap.aai.workarounds.NamingExceptions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class MoxyLoader extends Loader {
 
index 57e4108..df8e923 100644 (file)
@@ -20,8 +20,6 @@
 
 package org.onap.aai.introspection;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.google.common.base.CaseFormat;
 import com.google.common.base.Joiner;
 
@@ -44,12 +42,12 @@ import org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping;
 import org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping;
 import org.onap.aai.config.SpringContextAware;
 import org.onap.aai.logging.LogFormatTools;
-import org.onap.aai.nodes.CaseFormatStore;
-import org.onap.aai.nodes.NodeIngestor;
 import org.onap.aai.restcore.MediaType;
 import org.onap.aai.schema.enums.ObjectMetadata;
 import org.onap.aai.schema.enums.PropertyMetadata;
 import org.onap.aai.setup.SchemaVersion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.web.util.UriUtils;
 
 public class MoxyStrategy extends Introspector {
index 1aca431..822b046 100644 (file)
@@ -22,6 +22,7 @@ package org.onap.aai.introspection;
 
 import java.util.Map;
 import java.util.Set;
+
 import org.onap.aai.schema.enums.PropertyMetadata;
 
 public final class PropertyPredicates {
index 6ce42e4..0cf1996 100644 (file)
@@ -26,7 +26,8 @@ public class AAIUnmarshallingException extends AAIException {
 
     private static final long serialVersionUID = -5615651557821878103L;
 
-    private static final String AAI_MSG="AAI_3000";
+    private static final String AAI_MSG = "AAI_3000";
+
     public AAIUnmarshallingException() {
     }
 
index 8288fd6..c5a14ce 100644 (file)
 
 package org.onap.aai.introspection.generator;
 
-import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.introspection.*;
-
 import java.security.SecureRandom;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.introspection.*;
+
 public class CreateExample implements Wanderer {
 
     private SecureRandom rand = new SecureRandom();
index 0994f02..d778092 100644 (file)
 
 package org.onap.aai.introspection.sideeffect;
 
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.Optional;
+
+import javax.ws.rs.core.MultivaluedMap;
+
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.Introspector;
@@ -31,16 +42,6 @@ import org.onap.aai.schema.enums.PropertyMetadata;
 import org.onap.aai.serialization.db.DBSerializer;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
 
-import javax.ws.rs.core.MultivaluedMap;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Objects;
-import java.util.Optional;
-
 public class DataCopy extends SideEffect {
 
     public DataCopy(Introspector obj, Vertex self, TransactionalGraphEngine dbEngine, DBSerializer serializer) {
@@ -73,7 +74,7 @@ public class DataCopy extends SideEffect {
                             "multiple values of " + entry.getKey() + " found when searching " + uri);
                 }
             }
-        } //else skip processing because no required properties were specified
+        } // else skip processing because no required properties were specified
     }
 
     @Override
index 4d75f38..d997645 100644 (file)
@@ -42,14 +42,13 @@ public class OwnerCheck extends SideEffect {
     }
 
     @Override
-    protected void processURI(Optional<String> completeUri, Entry<String, String> entry)
-        throws AAIException {
+    protected void processURI(Optional<String> completeUri, Entry<String, String> entry) throws AAIException {
         if (!isAuthorized(serializer.getGroups(), self)) {
 
             throw new AAIException("AAI_3304",
-                "Group(s) :" + serializer.getGroups() + " not authorized to perform function");
+                    "Group(s) :" + serializer.getGroups() + " not authorized to perform function");
 
-        } //else skip processing because no required properties were specified
+        } // else skip processing because no required properties were specified
 
     }
 
@@ -60,7 +59,7 @@ public class OwnerCheck extends SideEffect {
                 String dataOwner = dataOwnerProperty.toString();
                 String dataOwnerWithReadAccess = dataOwner + READ_ONLY_SUFFIX;
                 return groups.stream()
-                    .anyMatch(group -> group.equals(dataOwner) || group.equals(dataOwnerWithReadAccess));
+                        .anyMatch(group -> group.equals(dataOwner) || group.equals(dataOwnerWithReadAccess));
             }
         }
         return true;
index 0658631..9e32ef4 100644 (file)
 package org.onap.aai.introspection.sideeffect;
 
 import com.google.common.collect.Multimap;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.*;
+import java.util.Map.Entry;
+
+import javax.ws.rs.core.MultivaluedMap;
+
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
@@ -46,13 +55,6 @@ import org.onap.aai.serialization.db.EdgeSerializer;
 import org.onap.aai.serialization.db.exceptions.EdgeMultiplicityException;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
 
-import javax.ws.rs.core.MultivaluedMap;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.*;
-import java.util.Map.Entry;
-
 public class PrivateEdge extends SideEffect {
 
     public PrivateEdge(Introspector obj, Vertex self, TransactionalGraphEngine dbEngine, DBSerializer serializer) {
@@ -134,8 +136,8 @@ public class PrivateEdge extends SideEffect {
                                 break;
                         }
                     } else {
-                        edgeSerializer.addPrivateEdge(this.dbEngine.asAdmin().getTraversalSource(), self,
-                                otherVertex, edgeRule.getLabel());
+                        edgeSerializer.addPrivateEdge(this.dbEngine.asAdmin().getTraversalSource(), self, otherVertex,
+                                edgeRule.getLabel());
                     }
                 }
             } else {
@@ -143,7 +145,7 @@ public class PrivateEdge extends SideEffect {
                     throw new AAIException("AAI_6114", "object located at " + uri + " not found");
                 } else {
                     throw new AAIMultiplePropertiesException(
-                        "multiple values of " + entry.getKey() + " found when searching " + uri);
+                            "multiple values of " + entry.getKey() + " found when searching " + uri);
                 }
             }
         }
index 9ca396a..bec4652 100644 (file)
@@ -31,6 +31,7 @@ import java.util.Optional;
 import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.onap.aai.edges.exceptions.AmbiguousRuleChoiceException;
 import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
index 8bc8315..5862767 100644 (file)
@@ -20,9 +20,6 @@
 
 package org.onap.aai.introspection.sideeffect;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.UnsupportedEncodingException;
 import java.lang.reflect.InvocationTargetException;
 import java.net.URISyntaxException;
index ca73535..dfa7c95 100644 (file)
@@ -20,9 +20,6 @@
 
 package org.onap.aai.parsers.query;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -43,6 +40,8 @@ import org.onap.aai.parsers.uri.URIToObject;
 import org.onap.aai.query.builder.QueryBuilder;
 import org.onap.aai.restcore.util.URITools;
 import org.onap.aai.schema.enums.PropertyMetadata;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * The Class LegacyQueryParser.
index e131980..7df49b2 100644 (file)
@@ -20,9 +20,6 @@
 
 package org.onap.aai.parsers.query;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.UnsupportedEncodingException;
 
 import org.onap.aai.config.SpringContextAware;
@@ -34,6 +31,8 @@ import org.onap.aai.introspection.ModelType;
 import org.onap.aai.parsers.relationship.RelationshipToURI;
 import org.onap.aai.parsers.uri.URIParser;
 import org.onap.aai.query.builder.QueryBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.context.ApplicationContext;
 
 /**
index 0ee22f5..8ed0fcb 100644 (file)
@@ -20,9 +20,6 @@
 
 package org.onap.aai.parsers.relationship;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -50,6 +47,8 @@ import org.onap.aai.parsers.exceptions.AmbiguousMapAAIException;
 import org.onap.aai.parsers.uri.URIParser;
 import org.onap.aai.schema.enums.ObjectMetadata;
 import org.onap.aai.setup.SchemaVersions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.context.ApplicationContext;
 
 /**
index 8064342..3ca20c5 100644 (file)
@@ -52,7 +52,7 @@ public class URIParser {
     private URI originalURI = null;
 
     private MultivaluedMap<String, String> queryParams = null;
-  
+
     private static String aaiExceptionCode = "AAI_3001";
 
     /**
index d420c55..db1e36b 100644 (file)
@@ -19,6 +19,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.prevalidation;
 
 import com.google.gson.annotations.SerializedName;
@@ -70,9 +71,8 @@ public class Validation {
             return false;
         }
         Validation that = (Validation) o;
-        return Objects.equals(validationId, that.validationId) &&
-            Objects.equals(action, that.action) &&
-            Objects.equals(violations, that.violations);
+        return Objects.equals(validationId, that.validationId) && Objects.equals(action, that.action)
+                && Objects.equals(violations, that.violations);
     }
 
     @Override
@@ -82,11 +82,8 @@ public class Validation {
 
     @Override
     public String toString() {
-        return "Validation{" +
-            "validationId='" + validationId + '\'' +
-            ", action='" + action + '\'' +
-            ", violations=" + violations +
-            '}';
+        return "Validation{" + "validationId='" + validationId + '\'' + ", action='" + action + '\'' + ", violations="
+                + violations + '}';
     }
 
 }
index 36569dd..7030cf7 100644 (file)
@@ -19,6 +19,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.prevalidation;
 
 import org.onap.aai.restclient.RestClient;
index 29b3108..c66511f 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.prevalidation;
 
 import com.google.gson.Gson;
 import com.google.gson.JsonSyntaxException;
+
 import java.net.ConnectException;
 import java.net.SocketTimeoutException;
 import java.util.ArrayList;
@@ -34,7 +36,9 @@ import java.util.Set;
 import java.util.UUID;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
+
 import javax.annotation.PostConstruct;
+
 import org.apache.http.conn.ConnectTimeoutException;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.Introspector;
@@ -63,25 +67,24 @@ public class ValidationService {
      * Error indicating that the service trying to connect is down
      */
     static final String CONNECTION_REFUSED_STRING =
-        "Connection refused to the validation microservice due to service unreachable";
+            "Connection refused to the validation microservice due to service unreachable";
 
     /**
      * Error indicating that the server is unable to reach the port
      * Could be server related connectivity issue
      */
-    static final String CONNECTION_TIMEOUT_STRING =
-        "Connection timeout to the validation microservice as this could " +
-        "indicate the server is unable to reach port, " +
-        "please check on server by running: nc -w10 -z -v ${VALIDATION_HOST} ${VALIDATION_PORT}";
+    static final String CONNECTION_TIMEOUT_STRING = "Connection timeout to the validation microservice as this could "
+            + "indicate the server is unable to reach port, "
+            + "please check on server by running: nc -w10 -z -v ${VALIDATION_HOST} ${VALIDATION_PORT}";
 
     /**
      * Error indicating that the request exceeded the allowed time
      *
      * Note: This means that the service could be active its
-     *       just taking some time to process our request
+     * just taking some time to process our request
      */
     static final String REQUEST_TIMEOUT_STRING =
-        "Request to validation service took longer than the currently set timeout";
+            "Request to validation service took longer than the currently set timeout";
 
     static final String VALIDATION_ENDPOINT = "/v1/validate";
     static final String VALIDATION_HEALTH_ENDPOINT = "/v1/info";
@@ -105,26 +108,20 @@ public class ValidationService {
     private final Gson gson;
 
     @Autowired
-    public ValidationService(
-        @Qualifier("validationRestClient") RestClient validationRestClient,
-        @Value("${spring.application.name}") String appName,
-        @Value("${validation.service.node-types}") String validationNodes,
-        @Value("${validation.service.exclusion-regexes}") String exclusionRegexes
-    ){
+    public ValidationService(@Qualifier("validationRestClient") RestClient validationRestClient,
+            @Value("${spring.application.name}") String appName,
+            @Value("${validation.service.node-types}") String validationNodes,
+            @Value("${validation.service.exclusion-regexes}") String exclusionRegexes) {
         this.validationRestClient = validationRestClient;
         this.appName = appName;
 
-        this.validationNodeTypes = Arrays
-            .stream(validationNodes.split(","))
-            .collect(Collectors.toSet());
+        this.validationNodeTypes = Arrays.stream(validationNodes.split(",")).collect(Collectors.toSet());
 
-        if(exclusionRegexes == null || exclusionRegexes.isEmpty()){
+        if (exclusionRegexes == null || exclusionRegexes.isEmpty()) {
             this.exclusionList = new ArrayList<>();
         } else {
-            this.exclusionList = Arrays
-                .stream(exclusionRegexes.split(","))
-                .map(Pattern::compile)
-                .collect(Collectors.toList());
+            this.exclusionList =
+                    Arrays.stream(exclusionRegexes.split(",")).map(Pattern::compile).collect(Collectors.toList());
         }
         this.gson = new Gson();
         LOGGER.info("Successfully initialized the pre validation service");
@@ -143,32 +140,28 @@ public class ValidationService {
 
         try {
 
-            healthCheckResponse = validationRestClient.execute(
-                VALIDATION_HEALTH_ENDPOINT,
-                HttpMethod.GET,
-                httpHeaders,
-                null
-            );
+            healthCheckResponse =
+                    validationRestClient.execute(VALIDATION_HEALTH_ENDPOINT, HttpMethod.GET, httpHeaders, null);
 
-        } catch(Exception ex){
+        } catch (Exception ex) {
             AAIException validationException = new AAIException("AAI_4021", ex);
             throw validationException;
         }
 
-        if(!isSuccess(healthCheckResponse)){
+        if (!isSuccess(healthCheckResponse)) {
             throw new AAIException("AAI_4021");
         }
 
         LOGGER.info("Successfully connected to the validation service endpoint");
     }
 
-    public boolean shouldValidate(String nodeType){
+    public boolean shouldValidate(String nodeType) {
         return this.validationNodeTypes.contains(nodeType);
     }
 
     public void validate(List<NotificationEvent> notificationEvents) throws AAIException {
 
-        if(notificationEvents == null || notificationEvents.isEmpty()){
+        if (notificationEvents == null || notificationEvents.isEmpty()) {
             return;
         }
 
@@ -177,10 +170,10 @@ public class ValidationService {
             // is in one of the regexes then we skip sending it to validation
             NotificationEvent notification = notificationEvents.get(0);
             Introspector eventHeader = notification.getEventHeader();
-            if(eventHeader != null){
+            if (eventHeader != null) {
                 String source = eventHeader.getValue(SOURCE_NAME);
-                for(Pattern pattern: exclusionList){
-                    if(pattern.matcher(source).matches()){
+                for (Pattern pattern : exclusionList) {
+                    if (pattern.matcher(source).matches()) {
                         return;
                     }
                 }
@@ -192,7 +185,7 @@ public class ValidationService {
 
             Introspector eventHeader = event.getEventHeader();
 
-            if(eventHeader == null){
+            if (eventHeader == null) {
                 // Should I skip processing the request and let it continue
                 // or fail the request and cause client impact
                 continue;
@@ -205,13 +198,13 @@ public class ValidationService {
              * Skipping the delete events for now
              * Note: Might revisit this later when validation supports DELETE events
              */
-            if(DELETE.equalsIgnoreCase(action)){
+            if (DELETE.equalsIgnoreCase(action)) {
                 continue;
             }
 
             if (this.shouldValidate(entityType)) {
                 List<String> violations = this.preValidate(event.getNotificationEvent());
-                if(!violations.isEmpty()){
+                if (!violations.isEmpty()) {
                     AAIException aaiException = new AAIException("AAI_4019");
                     aaiException.getTemplateVars().addAll(violations);
                     throw aaiException;
@@ -232,47 +225,40 @@ public class ValidationService {
         ResponseEntity responseEntity;
         try {
 
-            responseEntity = validationRestClient.execute(
-                VALIDATION_ENDPOINT,
-                HttpMethod.POST,
-                httpHeaders,
-                body
-            );
+            responseEntity = validationRestClient.execute(VALIDATION_ENDPOINT, HttpMethod.POST, httpHeaders, body);
 
             Object responseBody = responseEntity.getBody();
-            if(isSuccess(responseEntity)){
-                LOGGER.debug("Validation Service returned following response status code {} and body {}", responseEntity.getStatusCodeValue(), responseEntity.getBody());
+            if (isSuccess(responseEntity)) {
+                LOGGER.debug("Validation Service returned following response status code {} and body {}",
+                        responseEntity.getStatusCodeValue(), responseEntity.getBody());
             } else if (responseBody != null) {
                 Validation validation = null;
                 try {
                     validation = gson.fromJson(responseBody.toString(), Validation.class);
-                } catch(JsonSyntaxException jsonException){
+                } catch (JsonSyntaxException jsonException) {
                     LOGGER.warn("Unable to convert the response body {}", jsonException.getMessage());
                 }
 
-                if(validation == null){
-                    LOGGER.debug(
-                        "Validation Service following status code {} with body {}",
-                        responseEntity.getStatusCodeValue(),
-                        responseEntity.getBody()
-                    );
+                if (validation == null) {
+                    LOGGER.debug("Validation Service following status code {} with body {}",
+                            responseEntity.getStatusCodeValue(), responseEntity.getBody());
                 } else {
                     violations.addAll(extractViolations(validation));
                 }
             } else {
                 LOGGER.warn("Unable to convert the response body null");
             }
-        } catch(Exception e){
+        } catch (Exception e) {
             // If the exception cause is client side timeout
             // then proceed as if it passed validation
             // resources microservice shouldn't be blocked because of validation service
             // is taking too long or if the validation service is down
             // Any other exception it should block the request from passing?
-            if(e.getCause() instanceof SocketTimeoutException){
+            if (e.getCause() instanceof SocketTimeoutException) {
                 LOGGER.error(REQUEST_TIMEOUT_STRING, e.getCause());
-            } else if(e.getCause() instanceof ConnectException){
+            } else if (e.getCause() instanceof ConnectException) {
                 LOGGER.error(CONNECTION_REFUSED_STRING, e.getCause());
-            } else if(e.getCause() instanceof ConnectTimeoutException){
+            } else if (e.getCause() instanceof ConnectTimeoutException) {
                 LOGGER.error(CONNECTION_TIMEOUT_STRING, e.getCause());
             } else {
                 LOGGER.error("Unknown exception thrown please investigate", e.getCause());
@@ -281,7 +267,7 @@ public class ValidationService {
         return violations;
     }
 
-    boolean isSuccess(ResponseEntity responseEntity){
+    boolean isSuccess(ResponseEntity responseEntity) {
         return responseEntity != null && responseEntity.getStatusCode().is2xxSuccessful();
     }
 
@@ -289,7 +275,7 @@ public class ValidationService {
 
         List<String> errorMessages = new ArrayList<>();
 
-        if(validation == null){
+        if (validation == null) {
             return errorMessages;
         }
 
index 6173e4b..f899e9f 100644 (file)
 
 package org.onap.aai.prevalidation;
 
+import java.util.Collections;
+import java.util.Map;
+import java.util.UUID;
+
+import org.onap.aai.restclient.NoAuthRestClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.onap.aai.restclient.NoAuthRestClient;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
-import org.springframework.http.client.ClientHttpRequestFactory;
 import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
 import org.springframework.util.MultiValueMap;
 
-import java.util.Collections;
-import java.util.Map;
-import java.util.UUID;
-
 public class ValidationServiceNoAuthClient extends NoAuthRestClient {
 
     private static Logger logger = LoggerFactory.getLogger(ValidationServiceNoAuthClient.class);
index 40efd46..f72f6bc 100644 (file)
 
 package org.onap.aai.prevalidation;
 
+import java.util.Collections;
+import java.util.Map;
+import java.util.UUID;
+
 import org.onap.aai.restclient.OneWaySSLRestClient;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpHeaders;
@@ -27,10 +31,6 @@ import org.springframework.http.MediaType;
 import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
 import org.springframework.util.MultiValueMap;
 
-import java.util.Collections;
-import java.util.Map;
-import java.util.UUID;
-
 public class ValidationServiceOneWayClient extends OneWaySSLRestClient {
 
     @Value("${validation.service.base.url}")
@@ -75,7 +75,7 @@ public class ValidationServiceOneWayClient extends OneWaySSLRestClient {
 
         String defaultAccept = headers.getOrDefault(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON.toString());
         String defaultContentType =
-            headers.getOrDefault(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON.toString());
+                headers.getOrDefault(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON.toString());
 
         if (headers.isEmpty()) {
             httpHeaders.setAccept(Collections.singletonList(MediaType.parseMediaType(defaultAccept)));
index 8674272..af28306 100644 (file)
 
 package org.onap.aai.prevalidation;
 
+import java.util.Collections;
+import java.util.Map;
+import java.util.UUID;
+
 import org.onap.aai.restclient.TwoWaySSLRestClient;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpHeaders;
@@ -29,10 +33,6 @@ import org.springframework.http.MediaType;
 import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
 import org.springframework.util.MultiValueMap;
 
-import java.util.Collections;
-import java.util.Map;
-import java.util.UUID;
-
 public class ValidationServiceRestClient extends TwoWaySSLRestClient {
 
     @Value("${validation.service.base.url}")
index e5472a7..59b9f41 100644 (file)
@@ -94,14 +94,9 @@ public class Violation {
 
     @Override
     public String toString() {
-        return "Violation{" +
-            "violationId='" + violationId + '\'' +
-            ", modelName='" + modelName + '\'' +
-            ", category='" + category + '\'' +
-            ", severity='" + severity + '\'' +
-            ", violationType='" + violationType + '\'' +
-            ", errorMessage='" + errorMessage + '\'' +
-            '}';
+        return "Violation{" + "violationId='" + violationId + '\'' + ", modelName='" + modelName + '\'' + ", category='"
+                + category + '\'' + ", severity='" + severity + '\'' + ", violationType='" + violationType + '\''
+                + ", errorMessage='" + errorMessage + '\'' + '}';
     }
 
     @Override
@@ -113,12 +108,10 @@ public class Violation {
             return false;
         }
         Violation violation = (Violation) o;
-        return Objects.equals(violationId, violation.violationId) &&
-            Objects.equals(modelName, violation.modelName) &&
-            Objects.equals(category, violation.category) &&
-            Objects.equals(severity, violation.severity) &&
-            Objects.equals(violationType, violation.violationType) &&
-            Objects.equals(errorMessage, violation.errorMessage);
+        return Objects.equals(violationId, violation.violationId) && Objects.equals(modelName, violation.modelName)
+                && Objects.equals(category, violation.category) && Objects.equals(severity, violation.severity)
+                && Objects.equals(violationType, violation.violationType)
+                && Objects.equals(errorMessage, violation.errorMessage);
     }
 
     @Override
index 1dc3f1d..2517e2c 100644 (file)
@@ -72,7 +72,7 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> {
      * Instantiates a new graph traversal builder.
      *
      * @param loader the loader
-     * @param start  the start
+     * @param start the start
      */
     public GraphTraversalBuilder(Loader loader, GraphTraversalSource source, Vertex start) {
         super(loader, source, start);
@@ -108,12 +108,14 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> {
         traversal.has(key);
     }
 
-    //TODO: Remove this once we test this - at this point i dont thib this is required
-    //because predicare is an object
-    /*@Override
-    protected void vertexHas(final String key, final P<?> predicate) {
-        traversal.has(key, predicate);
-    }*/
+    // TODO: Remove this once we test this - at this point i dont thib this is required
+    // because predicare is an object
+    /*
+     * @Override
+     * protected void vertexHas(final String key, final P<?> predicate) {
+     * traversal.has(key, predicate);
+     * }
+     */
 
     /**
      * @{inheritDoc}
@@ -154,7 +156,7 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> {
     public QueryBuilder<Vertex> getVerticesStartsWithProperty(String key, Object value) {
 
         // correct value call because the index is registered as an Integer
-        //TODO Check if this needs to be in QB and add these as internal
+        // TODO Check if this needs to be in QB and add these as internal
         this.vertexHas(key, org.janusgraph.core.attribute.Text.textPrefix(value));
 
         stepIndex++;
@@ -355,7 +357,7 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> {
      */
     @Override
     public QueryBuilder<Vertex> createEdgeTraversal(EdgeType type, Introspector parent, Introspector child)
-        throws AAIException {
+            throws AAIException {
         createTraversal(type, parent, child, false);
         return (QueryBuilder<Vertex>) this;
 
@@ -363,13 +365,13 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> {
 
     @Override
     public QueryBuilder<Vertex> createPrivateEdgeTraversal(EdgeType type, Introspector parent, Introspector child)
-        throws AAIException {
+            throws AAIException {
         this.createTraversal(type, parent, child, true);
         return (QueryBuilder<Vertex>) this;
     }
 
     private void createTraversal(EdgeType type, Introspector parent, Introspector child, boolean isPrivateEdge)
-        throws AAIException {
+            throws AAIException {
         String isAbstractType = parent.getMetadata(ObjectMetadata.ABSTRACT);
         if ("true".equals(isAbstractType)) {
             markParentBoundary();
@@ -385,13 +387,13 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> {
      */
     @Override
     public QueryBuilder<Vertex> createEdgeTraversalWithLabels(EdgeType type, Introspector out, Introspector in,
-                                                              List<String> labels) throws AAIException {
+            List<String> labels) throws AAIException {
         this.edgeQueryToVertex(type, out, in, labels);
         return (QueryBuilder<Vertex>) this;
     }
 
     private Traversal<Vertex, Vertex>[] handleAbstractEdge(EdgeType type, Introspector abstractParent,
-                                                           Introspector child, boolean isPrivateEdge) throws AAIException {
+            Introspector child, boolean isPrivateEdge) throws AAIException {
         String childName = child.getDbName();
         String inheritorMetadata = abstractParent.getMetadata(ObjectMetadata.INHERITORS);
         String[] inheritors = inheritorMetadata.split(",");
@@ -427,7 +429,7 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> {
                     innerTraversal.in(inLabels.toArray(new String[inLabels.size()]));
                 } else {
                     innerTraversal.union(__.out(outLabels.toArray(new String[outLabels.size()])),
-                        __.in(inLabels.toArray(new String[inLabels.size()])));
+                            __.in(inLabels.toArray(new String[inLabels.size()])));
                 }
 
                 innerTraversal.has(AAIProperties.NODE_TYPE, childName);
@@ -439,7 +441,7 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> {
     }
 
     public QueryBuilder<Edge> getEdgesBetweenWithLabels(EdgeType type, String outNodeType, String inNodeType,
-                                                        List<String> labels) throws AAIException {
+            List<String> labels) throws AAIException {
         Introspector outObj = loader.introspectorFromName(outNodeType);
         Introspector inObj = loader.introspectorFromName(inNodeType);
         this.edgeQuery(type, outObj, inObj, labels);
@@ -600,7 +602,6 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> {
         return this;
     }
 
-
     /**
      * {@inheritDoc}
      */
@@ -694,12 +695,12 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> {
      * Edge query.
      *
      * @param outObj the out type
-     * @param inObj  the in type
+     * @param inObj the in type
      * @throws NoEdgeRuleFoundException
      * @throws AAIException
      */
     private void edgeQueryToVertex(EdgeType type, Introspector outObj, Introspector inObj, List<String> labels)
-        throws AAIException {
+            throws AAIException {
         String outType = outObj.getDbName();
         String inType = inObj.getDbName();
 
@@ -731,7 +732,7 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> {
             }
             if (rules.isEmpty()) {
                 throw new NoEdgeRuleFoundException(
-                    "No edge rules found for " + outType + " and " + inType + " of type " + type.toString());
+                        "No edge rules found for " + outType + " and " + inType + " of type " + type.toString());
             }
         }
 
@@ -756,7 +757,7 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> {
             traversal.in(inLabels.toArray(new String[inLabels.size()]));
         } else {
             traversal.union(__.out(outLabels.toArray(new String[outLabels.size()])),
-                __.in(inLabels.toArray(new String[inLabels.size()])));
+                    __.in(inLabels.toArray(new String[inLabels.size()])));
         }
 
         stepIndex++;
@@ -769,12 +770,12 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> {
      * Edge query.
      *
      * @param outObj the out type
-     * @param inObj  the in type
+     * @param inObj the in type
      * @throws NoEdgeRuleFoundException
      * @throws AAIException
      */
     private void edgeQuery(EdgeType type, Introspector outObj, Introspector inObj, List<String> labels)
-        throws AAIException {
+            throws AAIException {
         String outType = outObj.getDbName();
         String inType = inObj.getDbName();
 
@@ -822,7 +823,7 @@ public abstract class GraphTraversalBuilder<E> extends QueryBuilder<E> {
             traversal.inE(inLabels.toArray(new String[inLabels.size()]));
         } else {
             traversal.union(__.outE(outLabels.toArray(new String[outLabels.size()])),
-                __.inE(inLabels.toArray(new String[inLabels.size()])));
+                    __.inE(inLabels.toArray(new String[inLabels.size()])));
         }
     }
 
index 712a1dd..4500a47 100644 (file)
@@ -22,8 +22,6 @@
 
 package org.onap.aai.query.builder;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.google.common.base.Joiner;
 import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.Multimap;
@@ -48,6 +46,8 @@ import org.onap.aai.introspection.Loader;
 import org.onap.aai.restcore.search.GremlinGroovyShell;
 import org.onap.aai.schema.enums.ObjectMetadata;
 import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * The Class GremlinQueryBuilder.
@@ -85,7 +85,6 @@ public abstract class GremlinQueryBuilder<E> extends QueryBuilder<E> {
         list = new ArrayList<>();
     }
 
-
     @Override
     public QueryBuilder<Vertex> exactMatchQuery(Introspector obj) {
         // TODO not implemented because this is implementation is no longer used
@@ -121,7 +120,7 @@ public abstract class GremlinQueryBuilder<E> extends QueryBuilder<E> {
             String valueString = value.toString();
 
             if (valueString.indexOf('\'') != -1) {
-                value =  valueString.replace(SINGLE_QUOTE, ESCAPE_SINGLE_QUOTE);
+                value = valueString.replace(SINGLE_QUOTE, ESCAPE_SINGLE_QUOTE);
             }
             LOGGER.trace("Inside getVerticesByProperty(): key = {}, value = {}", key, value);
             term = value.toString();
@@ -129,7 +128,7 @@ public abstract class GremlinQueryBuilder<E> extends QueryBuilder<E> {
             String valueString = value.toString();
 
             if (valueString.indexOf('\'') != -1) {
-                value =  valueString.replace(SINGLE_QUOTE, ESCAPE_SINGLE_QUOTE);
+                value = valueString.replace(SINGLE_QUOTE, ESCAPE_SINGLE_QUOTE);
             }
             LOGGER.trace("Inside getVerticesByProperty(): key = {}, value = {}", key, value);
             term = "'" + value + "'";
@@ -189,22 +188,20 @@ public abstract class GremlinQueryBuilder<E> extends QueryBuilder<E> {
         stepIndex++;
         return (QueryBuilder<Vertex>) this;
     }
-    
+
     /**
      * @{inheritDoc}
      */
     @Override
     public QueryBuilder<Vertex> getVerticesByCommaSeperatedValue(String key, String value) {
         ArrayList<String> arguments = new ArrayList<>(Arrays.asList(value.split(",")));
-        //add the single quotes
+        // add the single quotes
         for (int i = 0; i < arguments.size(); i++) {
-           if(arguments.get(i) != null && !arguments.get(i).startsWith("'") 
-                          && !arguments.get(i).endsWith("'")) {
-                  arguments.set(i,"'" + arguments.get(i).trim() + "'");
-           }
-           else {
-                  arguments.set(i, arguments.get(i).trim());
-           }
+            if (arguments.get(i) != null && !arguments.get(i).startsWith("'") && !arguments.get(i).endsWith("'")) {
+                arguments.set(i, "'" + arguments.get(i).trim() + "'");
+            } else {
+                arguments.set(i, arguments.get(i).trim());
+            }
         }
         String predicate = "P.within(#!#argument#!#)";
         String argument = Joiner.on(",").join(arguments);
@@ -339,7 +336,7 @@ public abstract class GremlinQueryBuilder<E> extends QueryBuilder<E> {
     public QueryBuilder<Vertex> getTypedVerticesByMap(String type, Map<String, String> map) {
 
         for (Map.Entry<String, String> es : map.entrySet()) {
-            //TODO what is this and where is it used - need to check
+            // TODO what is this and where is it used - need to check
             list.add(HAS + es.getKey() + "', '" + es.getValue() + "')");
             stepIndex++;
         }
@@ -729,7 +726,7 @@ public abstract class GremlinQueryBuilder<E> extends QueryBuilder<E> {
 
         return this;
     }
-    
+
     @Override
     public QueryBuilder<E> valueMap() {
         this.list.add(".valueMap()");
@@ -737,23 +734,22 @@ public abstract class GremlinQueryBuilder<E> extends QueryBuilder<E> {
 
         return this;
     }
-    
+
     @Override
     public QueryBuilder<E> valueMap(String... names) {
-        String stepString = ".valueMap('";
-         for (int i = 0; i < names.length; i++) {
-             stepString = stepString + names[i] + "'";
-             if (i != (names.length - 1)) {
-                 stepString = stepString + ",'";
-             }
-         }
-         stepString = stepString + ")";
-         this.list.add(stepString);
-         stepIndex++;
+        String stepString = ".valueMap('";
+        for (int i = 0; i < names.length; i++) {
+            stepString = stepString + names[i] + "'";
+            if (i != (names.length - 1)) {
+                stepString = stepString + ",'";
+            }
+        }
+        stepString = stepString + ")";
+        this.list.add(stepString);
+        stepIndex++;
 
-         return this;
+        return this;
     }
-    
 
     /**
      * {@inheritDoc}
@@ -955,5 +951,4 @@ public abstract class GremlinQueryBuilder<E> extends QueryBuilder<E> {
      * This is required for the subgraphstrategies to work
      */
 
-
 }
index 9cd35ab..710db48 100644 (file)
@@ -61,7 +61,6 @@ public class GremlinTraversal<E> extends GremlinQueryBuilder<E> {
         this.factory = new TraversalStrategy(this.loader, this);
     }
 
-
     protected GremlinTraversal(List<String> traversal, Loader loader, GraphTraversalSource source,
             GremlinQueryBuilder<E> gtb) {
         super(loader, source);
index 5b14995..49772b0 100644 (file)
 
 package org.onap.aai.query.builder;
 
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.core.MultivaluedMap;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.Introspector;
 import org.onap.aai.introspection.Loader;
 import org.onap.aai.parsers.query.QueryParser;
-import org.onap.aai.parsers.query.TraversalStrategy;
-
-import javax.ws.rs.core.MultivaluedMap;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
 
 /**
  * The Class GremlinTraversal.
@@ -60,9 +59,8 @@ public class HistoryGremlinTraversal<E> extends GremlinTraversal<E> {
         super(loader, source, start);
     }
 
-
     protected HistoryGremlinTraversal(List<String> traversal, Loader loader, GraphTraversalSource source,
-                                      GremlinQueryBuilder<E> gtb) {
+            GremlinQueryBuilder<E> gtb) {
         super(traversal, loader, source, gtb);
     }
 
@@ -155,15 +153,15 @@ public class HistoryGremlinTraversal<E> extends GremlinTraversal<E> {
     /*
      * This is required for the subgraphstrategies to work
      */
-    private void touchHistoryProperties(String key){
-        if(key != null && !key.isEmpty() && !key.equals(AAIProperties.NODE_TYPE)) {
+    private void touchHistoryProperties(String key) {
+        if (key != null && !key.isEmpty() && !key.equals(AAIProperties.NODE_TYPE)) {
             list.add(".where(__.properties('" + key + "'))");
         }
 
     }
 
     private void touchHistoryProperties(String key, Object value) {
-        if(key != null && !key.isEmpty() && !key.equals(AAIProperties.NODE_TYPE)) {
+        if (key != null && !key.isEmpty() && !key.equals(AAIProperties.NODE_TYPE)) {
             list.add(".where(__.properties('" + key + "').hasValue(" + value + "))");
         }
     }
index 119f852..c30850c 100644 (file)
@@ -21,6 +21,7 @@
 package org.onap.aai.query.builder;
 
 import java.util.Map;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
@@ -39,12 +40,12 @@ public class HistoryTraversalURIOptimizedQuery<E> extends TraversalURIOptimizedQ
     }
 
     protected HistoryTraversalURIOptimizedQuery(GraphTraversal traversal, Loader loader, GraphTraversalSource source,
-                                                GraphTraversalBuilder gtb) {
+            GraphTraversalBuilder gtb) {
         super(traversal, loader, source, gtb);
     }
 
     protected HistoryTraversalURIOptimizedQuery(GraphTraversal traversal, Loader loader, GraphTraversalSource source,
-                                                GraphTraversalBuilder gtb, Map<Integer, String> stepToAaiUri) {
+            GraphTraversalBuilder gtb, Map<Integer, String> stepToAaiUri) {
         super(traversal, loader, source, gtb, stepToAaiUri);
     }
 
index 007f979..423583f 100644 (file)
 
 package org.onap.aai.query.builder;
 
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.core.MultivaluedMap;
+
 import org.apache.tinkerpop.gremlin.process.traversal.Path;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
@@ -38,13 +46,6 @@ import org.onap.aai.parsers.query.QueryParser;
 import org.onap.aai.parsers.query.QueryParserStrategy;
 import org.springframework.context.ApplicationContext;
 
-import javax.ws.rs.core.MultivaluedMap;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
 /**
  * The Class QueryBuilder.
  */
@@ -111,7 +112,6 @@ public abstract class QueryBuilder<E> implements Iterator<E> {
      */
     public abstract QueryBuilder<Vertex> getVerticesByProperty(String key, Object value);
 
-
     /**
      * Gets the edges by property.
      *
@@ -374,7 +374,7 @@ public abstract class QueryBuilder<E> implements Iterator<E> {
      * @throws AAIException
      */
     public QueryBuilder<Vertex> createEdgeTraversalWithLabels(MissingOptionalParameter edgeType, String outNodeType,
-                                                    String inNodeType, List<String> labels) throws AAIException {
+            String inNodeType, List<String> labels) throws AAIException {
         /*
          * When no optional parameter edgetype is sent get all edges between the 2 nodetypes
          */
@@ -413,7 +413,8 @@ public abstract class QueryBuilder<E> implements Iterator<E> {
         return queryBuilder;
     }
 
-    public QueryBuilder<Vertex> createEdgeTraversalWithLabels(String outNodeType, String inNodeType, List<String> labels) throws AAIException {
+    public QueryBuilder<Vertex> createEdgeTraversalWithLabels(String outNodeType, String inNodeType,
+            List<String> labels) throws AAIException {
 
         Introspector out = loader.introspectorFromName(outNodeType);
         Introspector in = loader.introspectorFromName(inNodeType);
@@ -480,13 +481,13 @@ public abstract class QueryBuilder<E> implements Iterator<E> {
     public abstract QueryBuilder<Vertex> createEdgeTraversalWithLabels(EdgeType type, Introspector out, Introspector in,
             List<String> labels) throws AAIException;
 
-
     /**
      * This method and it's overloaded counterpart are conditional statements.
      * This method creates an edge traversal step if an optional property is present
      * This is necessary in cases such as "if the Optional Property 1 is sent,
      * find all Nodes of type A with edges to Nodes of type B with property 1,
      * otherwise, simply find all nodes of type A".
+     * 
      * @param type
      * @param outNodeType
      * @param inNodeType
@@ -494,9 +495,9 @@ public abstract class QueryBuilder<E> implements Iterator<E> {
      * @return
      * @throws AAIException
      */
-    public QueryBuilder<Vertex> createEdgeTraversalIfParameterIsPresent(EdgeType type, String outNodeType, String inNodeType,
-               Object value) throws AAIException {
-       return this.createEdgeTraversal(type, outNodeType, inNodeType);
+    public QueryBuilder<Vertex> createEdgeTraversalIfParameterIsPresent(EdgeType type, String outNodeType,
+            String inNodeType, Object value) throws AAIException {
+        return this.createEdgeTraversal(type, outNodeType, inNodeType);
     }
 
     /**
@@ -505,6 +506,7 @@ public abstract class QueryBuilder<E> implements Iterator<E> {
      * This is necessary in cases such as "if the Optional Property 1 is sent,
      * find all Nodes of type A with edges to Nodes of type B with property 1,
      * otherwise, simply find all nodes of type A".
+     * 
      * @param type
      * @param outNodeType
      * @param inNodeType
@@ -512,9 +514,9 @@ public abstract class QueryBuilder<E> implements Iterator<E> {
      * @return
      * @throws AAIException
      */
-    public QueryBuilder<Vertex> createEdgeTraversalIfParameterIsPresent(EdgeType type, String outNodeType, String inNodeType,
-               MissingOptionalParameter value) throws AAIException {
-       return (QueryBuilder<Vertex>) this;
+    public QueryBuilder<Vertex> createEdgeTraversalIfParameterIsPresent(EdgeType type, String outNodeType,
+            String inNodeType, MissingOptionalParameter value) throws AAIException {
+        return (QueryBuilder<Vertex>) this;
     }
 
     /**
@@ -783,12 +785,12 @@ public abstract class QueryBuilder<E> implements Iterator<E> {
         return getVerticesByProperty(key, value);
     }
 
-    protected abstract void vertexHas(String key, Object value) ;
+    protected abstract void vertexHas(String key, Object value);
 
     protected abstract void vertexHasNot(String key);
 
     protected abstract void vertexHas(String key);
 
-   //TODO: This probably is not required but need to test
+    // TODO: This probably is not required but need to test
     // protected abstract void vertexHas(final String key, final P<?> predicate);
 }
index 554ecb3..28d66dd 100644 (file)
 
 package org.onap.aai.rest.db;
 
-import org.onap.aai.introspection.sideeffect.OwnerCheck;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.github.fge.jsonpatch.JsonPatchException;
 import com.github.fge.jsonpatch.mergepatch.JsonMergePatch;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import javax.ws.rs.core.*;
+import javax.ws.rs.core.Response.Status;
+
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.janusgraph.core.JanusGraphException;
 import org.javatuples.Pair;
@@ -35,6 +45,7 @@ import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.*;
 import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
+import org.onap.aai.introspection.sideeffect.OwnerCheck;
 import org.onap.aai.logging.ErrorLogHelper;
 import org.onap.aai.nodes.NodeIngestor;
 import org.onap.aai.parsers.query.QueryParser;
@@ -56,20 +67,10 @@ import org.onap.aai.transforms.XmlFormatTransformer;
 import org.onap.aai.util.AAIConfig;
 import org.onap.aai.util.AAIConstants;
 import org.onap.aai.util.delta.DeltaEvents;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.ResponseEntity;
-
-import javax.ws.rs.core.*;
-import javax.ws.rs.core.Response.Status;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.*;
-import java.util.stream.Collectors;
 
 /**
  * The Class HttpEntry.
@@ -187,7 +188,8 @@ public class HttpEntry {
         return this;
     }
 
-    public HttpEntry setHttpEntryProperties(SchemaVersion version, UEBNotification notification, int notificationDepth) {
+    public HttpEntry setHttpEntryProperties(SchemaVersion version, UEBNotification notification,
+            int notificationDepth) {
         this.version = version;
         this.loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, version);
         this.dbEngine = new JanusGraphDBEngine(queryStyle, loader);
@@ -244,10 +246,8 @@ public class HttpEntry {
         return dbEngine;
     }
 
-    public Pair<Boolean, List<Pair<URI, Response>>> process(List<DBRequest> requests,
-        String sourceOfTruth,
-        Set<String> groups)
-        throws AAIException {
+    public Pair<Boolean, List<Pair<URI, Response>>> process(List<DBRequest> requests, String sourceOfTruth,
+            Set<String> groups) throws AAIException {
         return this.process(requests, sourceOfTruth, groups, true);
     }
 
@@ -347,21 +347,21 @@ public class HttpEntry {
      * @throws AAIException the AAI exception
      */
     public Pair<Boolean, List<Pair<URI, Response>>> process(List<DBRequest> requests, String sourceOfTruth,
-        boolean enableResourceVersion) throws AAIException {
+            boolean enableResourceVersion) throws AAIException {
         return this.process(requests, sourceOfTruth, Collections.EMPTY_SET, enableResourceVersion);
     }
 
-    private Pair<Boolean, List<Pair<URI, Response>>> process(List<DBRequest> requests,
-        String sourceOfTruth,
-        Set<String> groups,
-        boolean enableResourceVersion) throws AAIException {
+    private Pair<Boolean, List<Pair<URI, Response>>> process(List<DBRequest> requests, String sourceOfTruth,
+            Set<String> groups, boolean enableResourceVersion) throws AAIException {
 
         DBSerializer serializer = null;
 
-        if(serverBase != null){
-            serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, sourceOfTruth, groups, notificationDepth, serverBase);
+        if (serverBase != null) {
+            serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, sourceOfTruth, groups,
+                    notificationDepth, serverBase);
         } else {
-            serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, sourceOfTruth, groups, notificationDepth);
+            serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, sourceOfTruth, groups,
+                    notificationDepth);
         }
 
         Response response;
@@ -383,7 +383,7 @@ public class HttpEntry {
 
         String outputMediaType = null;
 
-        if(requests != null && !requests.isEmpty()){
+        if (requests != null && !requests.isEmpty()) {
             HttpHeaders headers = requests.get(0).getHeaders();
             outputMediaType = getMediaType(headers.getAcceptableMediaTypes());
         }
@@ -451,8 +451,8 @@ public class HttpEntry {
                         String resourceVersion = obj.getValue(AAIProperties.RESOURCE_VERSION);
                         if (vertices.isEmpty()) {
                             if (enableResourceVersion) {
-                                serializer.verifyResourceVersion("create", query.getResultType(), "",
-                                        resourceVersion, obj.getURI());
+                                serializer.verifyResourceVersion("create", query.getResultType(), "", resourceVersion,
+                                        obj.getURI());
                             }
                             isNewVertex = true;
                         } else {
@@ -477,10 +477,13 @@ public class HttpEntry {
                     }
 
                     /*
-                     * This skip-related-to query parameter is used to determine if the relationships object will omit the related-to-property
-                     * If a GET is sent to resources without a format, if format=resource, or if format=resource_and_url with this param set to false
+                     * This skip-related-to query parameter is used to determine if the relationships object will omit
+                     * the related-to-property
+                     * If a GET is sent to resources without a format, if format=resource, or if format=resource_and_url
+                     * with this param set to false
                      * then behavior will be keep the related-to properties. By default, set to true.
-                     * Otherwise, for any other case, when the skip-related-to parameter exists, has value=true, or some unfamiliar input (e.g. skip-related-to=bogusvalue), the value is true.
+                     * Otherwise, for any other case, when the skip-related-to parameter exists, has value=true, or some
+                     * unfamiliar input (e.g. skip-related-to=bogusvalue), the value is true.
                      */
                     boolean isSkipRelatedTo = true;
                     if (params.containsKey("skip-related-to")) {
@@ -498,27 +501,29 @@ public class HttpEntry {
                         case GET:
 
                             if (format == null) {
-                                obj = this.getObjectFromDb(vertices, serializer, query, obj, request.getUri(),
-                                        depth, isNodeOnly, cleanUp, isSkipRelatedTo);
+                                obj = this.getObjectFromDb(vertices, serializer, query, obj, request.getUri(), depth,
+                                        isNodeOnly, cleanUp, isSkipRelatedTo);
 
                                 if (obj != null) {
                                     status = Status.OK;
                                     MarshallerProperties properties;
-                                    Optional<MarshallerProperties> marshallerPropOpt = request.getMarshallerProperties();
+                                    Optional<MarshallerProperties> marshallerPropOpt =
+                                            request.getMarshallerProperties();
                                     if (marshallerPropOpt.isPresent()) {
                                         properties = marshallerPropOpt.get();
                                     } else {
                                         properties = new MarshallerProperties.Builder(
-                                            org.onap.aai.restcore.MediaType.getEnum(outputMediaType)).build();
+                                                org.onap.aai.restcore.MediaType.getEnum(outputMediaType)).build();
                                     }
                                     result = obj.marshal(properties);
                                 }
                             } else {
-                                FormatFactory ff =
-                                        new FormatFactory(loader, serializer, schemaVersions, basePath + "/", serverBase);
+                                FormatFactory ff = new FormatFactory(loader, serializer, schemaVersions, basePath + "/",
+                                        serverBase);
                                 Formatter formatter = ff.get(format, params);
-                                result = formatter.output(vertices.stream().map(vertex -> (Object) vertex)
-                                        .collect(Collectors.toList())).toString();
+                                result = formatter.output(
+                                        vertices.stream().map(vertex -> (Object) vertex).collect(Collectors.toList()))
+                                        .toString();
 
                                 if (outputMediaType == null) {
                                     outputMediaType = MediaType.APPLICATION_JSON;
@@ -547,16 +552,17 @@ public class HttpEntry {
                                     }
                                     result = obj.marshal(properties);
                                 } else {
-                                    String msg = createRelationshipNotFoundMessage(query.getResultType(),
-                                            request.getUri());
+                                    String msg =
+                                            createRelationshipNotFoundMessage(query.getResultType(), request.getUri());
                                     throw new AAIException("AAI_6149", msg);
                                 }
                             } else {
-                                FormatFactory ff =
-                                        new FormatFactory(loader, serializer, schemaVersions, basePath + "/", serverBase);
+                                FormatFactory ff = new FormatFactory(loader, serializer, schemaVersions, basePath + "/",
+                                        serverBase);
                                 Formatter formatter = ff.get(format, params);
-                                result = formatter.output(vertices.stream().map(vertex -> (Object) vertex)
-                                        .collect(Collectors.toList())).toString();
+                                result = formatter.output(
+                                        vertices.stream().map(vertex -> (Object) vertex).collect(Collectors.toList()))
+                                        .toString();
 
                                 if (outputMediaType == null) {
                                     outputMediaType = MediaType.APPLICATION_JSON;
@@ -580,16 +586,19 @@ public class HttpEntry {
 
                             mainVertexesToNotifyOn.add(v);
                             if (notificationDepth == AAIProperties.MINIMUM_DEPTH) {
-                                Map<String, Pair<Introspector, LinkedHashMap<String,Introspector>>> allImpliedDeleteObjs = serializer.getImpliedDeleteUriObjectPair();
+                                Map<String, Pair<Introspector, LinkedHashMap<String, Introspector>>> allImpliedDeleteObjs =
+                                        serializer.getImpliedDeleteUriObjectPair();
 
-                                for (Map.Entry<String, Pair<Introspector, LinkedHashMap<String,Introspector>>> entry: allImpliedDeleteObjs.entrySet()) {
+                                for (Map.Entry<String, Pair<Introspector, LinkedHashMap<String, Introspector>>> entry : allImpliedDeleteObjs
+                                        .entrySet()) {
                                     // The format is purposefully %s/%s%s due to the fact
                                     // that every aai-uri will have a slash at the beginning
                                     // If that assumption isn't true, then its best to change this code
-                                    String curUri = String.format("%s/%s%s", basePath , version , entry.getKey());
+                                    String curUri = String.format("%s/%s%s", basePath, version, entry.getKey());
                                     Introspector curObj = entry.getValue().getValue0();
                                     HashMap<String, Introspector> curObjRelated = entry.getValue().getValue1();
-                                    notification.createNotificationEvent(transactionId, sourceOfTruth, Status.NO_CONTENT, URI.create(curUri), curObj, curObjRelated, basePath);
+                                    notification.createNotificationEvent(transactionId, sourceOfTruth,
+                                            Status.NO_CONTENT, URI.create(curUri), curObj, curObjRelated, basePath);
                                 }
                             }
 
@@ -638,8 +647,7 @@ public class HttpEntry {
                             String resourceVersion = params.getFirst(AAIProperties.RESOURCE_VERSION);
                             obj = serializer.getLatestVersionView(v, notificationDepth);
                             if (query.isDependent()) {
-                                relatedObjects =
-                                        serializer.getRelatedObjects(queryEngine, v, obj, this.loader);
+                                relatedObjects = serializer.getRelatedObjects(queryEngine, v, obj, this.loader);
                             }
                             /*
                              * Find all Delete-other-vertex vertices and create structure for notify
@@ -664,8 +672,7 @@ public class HttpEntry {
                                 deleteObjects = this.buildIntrospectorObjects(serializer, deletableVertices);
 
                                 uriMap = this.buildURIMap(serializer, deleteObjects);
-                                deleteRelatedObjects =
-                                        this.buildRelatedObjects(serializer, queryEngine, deleteObjects);
+                                deleteRelatedObjects = this.buildRelatedObjects(serializer, queryEngine, deleteObjects);
                             }
 
                             serializer.delete(v, deletableVertices, resourceVersion, enableResourceVersion);
@@ -701,10 +708,8 @@ public class HttpEntry {
                      * to be able to use for testing the vertex id endpoint functionality
                      * since we presently have no other way of generating those id urls
                      */
-                    if (response == null && v != null
-                            && (method.equals(HttpMethod.PUT) || method.equals(HttpMethod.GET)
-                                    || method.equals(HttpMethod.MERGE_PATCH)
-                                    || method.equals(HttpMethod.GET_RELATIONSHIP))
+                    if (response == null && v != null && (method.equals(HttpMethod.PUT) || method.equals(HttpMethod.GET)
+                            || method.equals(HttpMethod.MERGE_PATCH) || method.equals(HttpMethod.GET_RELATIONSHIP))
 
                     ) {
                         String myvertid = v.id().toString();
@@ -734,10 +739,11 @@ public class HttpEntry {
                 templateVars.add(request.getUri().getPath());
                 templateVars.addAll(e.getTemplateVars());
                 ErrorLogHelper.logException(e);
-                response = Response.status(e.getErrorObject().getHTTPResponseCode()).entity(ErrorLogHelper
-                        .getRESTAPIErrorResponse(request.getHeaders().getAcceptableMediaTypes(), e, templateVars))
-                        .type(outputMediaType)
-                        .build();
+                response =
+                        Response.status(e.getErrorObject().getHTTPResponseCode())
+                                .entity(ErrorLogHelper.getRESTAPIErrorResponse(
+                                        request.getHeaders().getAcceptableMediaTypes(), e, templateVars))
+                                .type(outputMediaType).build();
                 Pair<URI, Response> pairedResp = Pair.with(request.getUri(), response);
                 responses.add(pairedResp);
             } catch (Exception e) {
@@ -747,23 +753,23 @@ public class HttpEntry {
                 templateVars.add(request.getMethod().toString()); // GET, PUT, etc
                 templateVars.add(request.getUri().getPath());
                 ErrorLogHelper.logException(ex);
-                response = Response.status(ex.getErrorObject().getHTTPResponseCode()).entity(ErrorLogHelper
-                        .getRESTAPIErrorResponse(request.getHeaders().getAcceptableMediaTypes(), ex, templateVars))
-                        .type(outputMediaType)
-                        .build();
+                response =
+                        Response.status(ex.getErrorObject().getHTTPResponseCode())
+                                .entity(ErrorLogHelper.getRESTAPIErrorResponse(
+                                        request.getHeaders().getAcceptableMediaTypes(), ex, templateVars))
+                                .type(outputMediaType).build();
                 Pair<URI, Response> pairedResp = Pair.with(request.getUri(), response);
                 responses.add(pairedResp);
-            }
-            finally {
+            } finally {
                 if (response != null) {
                     metricLog.post(request, response);
                 }
             }
         }
 
-       if (success) {
-           generateEvents(sourceOfTruth, serializer, transactionId, queryEngine, mainVertexesToNotifyOn);
-       } else {
+        if (success) {
+            generateEvents(sourceOfTruth, serializer, transactionId, queryEngine, mainVertexesToNotifyOn);
+        } else {
             notification.clearEvents();
         }
 
@@ -774,18 +780,19 @@ public class HttpEntry {
      * Generate notification events for the resulting db requests.
      */
     private void generateEvents(String sourceOfTruth, DBSerializer serializer, String transactionId,
-                                QueryEngine queryEngine, Set<Vertex> mainVertexesToNotifyOn)
-        throws AAIException {
+            QueryEngine queryEngine, Set<Vertex> mainVertexesToNotifyOn) throws AAIException {
         if (notificationDepth == AAIProperties.MINIMUM_DEPTH) {
-            serializer.getUpdatedVertexes().entrySet().stream().filter(Map.Entry::getValue)
-                .map(Map.Entry::getKey).forEach(mainVertexesToNotifyOn::add);
+            serializer.getUpdatedVertexes().entrySet().stream().filter(Map.Entry::getValue).map(Map.Entry::getKey)
+                    .forEach(mainVertexesToNotifyOn::add);
         }
         Set<Vertex> edgeVertexes = serializer.touchStandardVertexPropertiesForEdges().stream()
-            .filter(v -> !mainVertexesToNotifyOn.contains(v)).collect(Collectors.toSet());
+                .filter(v -> !mainVertexesToNotifyOn.contains(v)).collect(Collectors.toSet());
         try {
-            createNotificationEvents(mainVertexesToNotifyOn, sourceOfTruth, serializer, transactionId, queryEngine, notificationDepth);
-            if("true".equals(AAIConfig.get("aai.notification.both.sides.enabled", "true"))){
-                createNotificationEvents(edgeVertexes, sourceOfTruth, serializer, transactionId, queryEngine, AAIProperties.MINIMUM_DEPTH);
+            createNotificationEvents(mainVertexesToNotifyOn, sourceOfTruth, serializer, transactionId, queryEngine,
+                    notificationDepth);
+            if ("true".equals(AAIConfig.get("aai.notification.both.sides.enabled", "true"))) {
+                createNotificationEvents(edgeVertexes, sourceOfTruth, serializer, transactionId, queryEngine,
+                        AAIProperties.MINIMUM_DEPTH);
             }
         } catch (UnsupportedEncodingException e) {
             LOGGER.warn("Encountered exception generating events", e);
@@ -793,15 +800,14 @@ public class HttpEntry {
 
         // Since @Autowired required is set to false, we need to do a null check
         // for the existence of the validationService since its only enabled if profile is enabled
-        if (validationService != null){
+        if (validationService != null) {
             validationService.validate(notification.getEvents());
         }
         notification.triggerEvents();
         if (isDeltaEventsEnabled) {
             try {
                 DeltaEvents deltaEvents =
-                    new DeltaEvents(transactionId, sourceOfTruth, version.toString(),
-                        serializer.getObjectDeltas());
+                        new DeltaEvents(transactionId, sourceOfTruth, version.toString(), serializer.getObjectDeltas());
                 deltaEvents.triggerEvents();
             } catch (Exception e) {
                 LOGGER.error("Error sending Delta Events", e);
@@ -813,10 +819,12 @@ public class HttpEntry {
      * Generate notification events for provided set of vertexes at the specified depth
      */
     private void createNotificationEvents(Set<Vertex> vertexesToNotifyOn, String sourceOfTruth, DBSerializer serializer,
-                                          String transactionId, QueryEngine queryEngine, int eventDepth) throws AAIException, UnsupportedEncodingException {
+            String transactionId, QueryEngine queryEngine, int eventDepth)
+            throws AAIException, UnsupportedEncodingException {
         for (Vertex vertex : vertexesToNotifyOn) {
             if (canGenerateEvent(vertex)) {
-                boolean isCurVertexNew = vertex.value(AAIProperties.CREATED_TS).equals(vertex.value(AAIProperties.LAST_MOD_TS));
+                boolean isCurVertexNew =
+                        vertex.value(AAIProperties.CREATED_TS).equals(vertex.value(AAIProperties.LAST_MOD_TS));
                 Status curObjStatus = (isCurVertexNew) ? Status.CREATED : Status.OK;
 
                 Introspector curObj = serializer.getLatestVersionView(vertex, eventDepth);
@@ -826,14 +834,15 @@ public class HttpEntry {
                 if (!curObj.isTopLevel()) {
                     curRelatedObjs = serializer.getRelatedObjects(queryEngine, vertex, curObj, this.loader);
                 }
-                notification.createNotificationEvent(transactionId, sourceOfTruth, curObjStatus,
-                    URI.create(uri), curObj, curRelatedObjs, basePath);
+                notification.createNotificationEvent(transactionId, sourceOfTruth, curObjStatus, URI.create(uri),
+                        curObj, curRelatedObjs, basePath);
             }
         }
     }
 
     /**
      * Verifies that vertex has needed properties to generate on
+     * 
      * @param vertex Vertex to be verified
      * @return <code>true</code> if vertex has necessary properties and exists
      */
@@ -843,8 +852,8 @@ public class HttpEntry {
             if (!vertex.property(AAIProperties.AAI_URI).isPresent()) {
                 LOGGER.debug("Encountered an vertex {} with missing aai-uri", vertex.id());
                 canGenerate = false;
-            } else if (!vertex.property(AAIProperties.CREATED_TS).isPresent() ||
-                !vertex.property(AAIProperties.LAST_MOD_TS).isPresent()) {
+            } else if (!vertex.property(AAIProperties.CREATED_TS).isPresent()
+                    || !vertex.property(AAIProperties.LAST_MOD_TS).isPresent()) {
                 LOGGER.debug("Encountered an vertex {} with missing timestamp", vertex.id());
                 canGenerate = false;
             }
@@ -912,6 +921,7 @@ public class HttpEntry {
         return serializer.dbToObject(results, obj, depth, nodeOnly, cleanUp);
 
     }
+
     /**
      * Gets the object from db.
      *
@@ -971,8 +981,8 @@ public class HttpEntry {
      * @throws URISyntaxException
      */
     private Introspector getRelationshipObjectFromDb(List<Vertex> results, DBSerializer serializer, QueryParser query,
-            URI uri, boolean isSkipRelatedTo) throws AAIException, IllegalArgumentException, SecurityException, UnsupportedEncodingException,
-            AAIUnknownObjectException {
+            URI uri, boolean isSkipRelatedTo) throws AAIException, IllegalArgumentException, SecurityException,
+            UnsupportedEncodingException, AAIUnknownObjectException {
 
         // nothing found
         if (results.isEmpty()) {
@@ -996,7 +1006,7 @@ public class HttpEntry {
      * @return the string
      */
     private String createNotFoundMessage(String resultType, URI uri) {
-        return  "No Node of type " + resultType + " found at: " + uri.getPath();
+        return "No Node of type " + resultType + " found at: " + uri.getPath();
     }
 
     /**
@@ -1007,7 +1017,7 @@ public class HttpEntry {
      * @return the string
      */
     private String createRelationshipNotFoundMessage(String resultType, URI uri) {
-        return  "No relationship found of type " + resultType + " at the given URI: " + uri.getPath()
+        return "No relationship found of type " + resultType + " at the given URI: " + uri.getPath()
                 + "/relationship-list";
     }
 
@@ -1105,8 +1115,7 @@ public class HttpEntry {
                 if (null != entry.getValue()) {
                     relatedObjectsMap.put(entry.getValue().getObjectId(), relatedObjects);
                 }
-            } catch (IllegalArgumentException | SecurityException
-                    | UnsupportedEncodingException | AAIException e) {
+            } catch (IllegalArgumentException | SecurityException | UnsupportedEncodingException | AAIException e) {
                 LOGGER.warn("Unable to get realted Objects, Just continue");
             }
 
@@ -1153,14 +1162,16 @@ public class HttpEntry {
                     List<Object> vertexList = (List<Object>) aggregateVertexList.get(0);
                     this.setTotalsForPaging(vertexList.size(), this.getPaginationBucket());
                     int startIndex = (this.getPaginationIndex() - 1) * this.getPaginationBucket();
-                    int endIndex = Math.min((this.getPaginationBucket() * this.getPaginationIndex()), vertexList.size());
+                    int endIndex =
+                            Math.min((this.getPaginationBucket() * this.getPaginationIndex()), vertexList.size());
                     if (startIndex > endIndex) {
                         throw new AAIException("AAI_6150",
-                            " ResultIndex is not appropriate for the result set, Needs to be <= " + endIndex);
+                                " ResultIndex is not appropriate for the result set, Needs to be <= " + endIndex);
                     }
                     finalList.add(new ArrayList<Object>());
                     for (int i = startIndex; i < endIndex; i++) {
-                        ((ArrayList<Object>) finalList.get(0)).add(((ArrayList<Object>) aggregateVertexList.get(0)).get(i));
+                        ((ArrayList<Object>) finalList.get(0))
+                                .add(((ArrayList<Object>) aggregateVertexList.get(0)).get(i));
                     }
                     return finalList;
                 }
index 14e554c..b8e93c5 100644 (file)
@@ -70,6 +70,7 @@ public class NotificationEvent {
     public String getNotificationEvent() throws AAIException {
         return new StoreNotificationEvent(transactionId, sourceOfTruth).storeEventOnly(loader, eventHeader, obj);
     }
+
     /**
      * Gets the notification version.
      *
index d951631..be30c46 100644 (file)
@@ -27,7 +27,9 @@ import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+
 import javax.ws.rs.core.Response.Status;
+
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.Introspector;
 import org.onap.aai.introspection.Loader;
@@ -204,6 +206,7 @@ public class UEBNotification {
     public List<NotificationEvent> getEvents() {
         return new ArrayList<>(this.events.values());
     }
+
     public Map<String, NotificationEvent> getEventsMap() {
         return this.events;
     }
index 7c5d43c..3666eb6 100644 (file)
@@ -32,10 +32,12 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
+
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
+
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.Introspector;
index 13f3f05..4a8760e 100644 (file)
@@ -92,11 +92,11 @@ public abstract class AAIAbstractGroovyShell {
      * @return result of graph traversal
      */
     public abstract String executeTraversal(TransactionalGraphEngine engine, String traversal,
-                                            Map<String, Object> params, QueryStyle style, GraphTraversalSource source);
+            Map<String, Object> params, QueryStyle style, GraphTraversalSource source);
 
-    protected Loader getLoader(){
+    protected Loader getLoader() {
         SchemaVersions schemaVersions = (SchemaVersions) SpringContextAware.getBean("schemaVersions");
         return SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(ModelType.MOXY,
-            schemaVersions.getDefaultVersion());
+                schemaVersions.getDefaultVersion());
     }
 }
index 85e4722..cc7a601 100644 (file)
@@ -61,7 +61,8 @@ public class GremlinGroovyShell extends AAIAbstractGroovyShell {
     }
 
     @Override
-    public String executeTraversal(TransactionalGraphEngine engine, String traversal, Map<String, Object> params, QueryStyle style, GraphTraversalSource source) {
+    public String executeTraversal(TransactionalGraphEngine engine, String traversal, Map<String, Object> params,
+            QueryStyle style, GraphTraversalSource source) {
         throw new UnsupportedOperationException();
     }
 }
index fbaa746..7a94876 100644 (file)
@@ -28,14 +28,9 @@ import java.util.Map;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.onap.aai.config.SpringContextAware;
-import org.onap.aai.introspection.Loader;
-import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.introspection.ModelType;
 import org.onap.aai.query.builder.QueryBuilder;
 import org.onap.aai.serialization.engines.QueryStyle;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
-import org.onap.aai.setup.SchemaVersions;
 
 /**
  * Creates and returns a groovy shell with the
@@ -74,7 +69,8 @@ public class GroovyQueryBuilder extends AAIAbstractGroovyShell {
     }
 
     @Override
-    public String executeTraversal(TransactionalGraphEngine engine, String traversal, Map<String, Object> params, QueryStyle style, GraphTraversalSource traversalSource) {
+    public String executeTraversal(TransactionalGraphEngine engine, String traversal, Map<String, Object> params,
+            QueryStyle style, GraphTraversalSource traversalSource) {
         QueryBuilder<Vertex> builder = engine.getQueryBuilder(style, traversalSource);
         builder.changeLoader(getLoader());
         Binding binding = new Binding(params);
index fc32f85..962d2e9 100644 (file)
@@ -20,7 +20,6 @@
 
 package org.onap.aai.restcore.util;
 
-import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.util.HashMap;
 import java.util.LinkedHashSet;
index db92bab..dc47833 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.serialization.db;
 
+import com.google.common.base.CaseFormat;
+
 import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Array;
 import java.lang.reflect.InvocationTargetException;
@@ -111,8 +114,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.ApplicationContext;
 
-import com.google.common.base.CaseFormat;
-
 public class DBSerializer {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(DBSerializer.class);
@@ -140,7 +141,8 @@ public class DBSerializer {
     private Map<String, ObjectDelta> objectDeltas = new LinkedHashMap<>();
     private Map<Vertex, Boolean> updatedVertexes = new LinkedHashMap<>();
     private Set<Vertex> edgeVertexes = new LinkedHashSet<>();
-    private Map<String, Pair<Introspector, LinkedHashMap<String, Introspector>>> impliedDeleteUriObjectPair = new LinkedHashMap<>();
+    private Map<String, Pair<Introspector, LinkedHashMap<String, Introspector>>> impliedDeleteUriObjectPair =
+            new LinkedHashMap<>();
     private int notificationDepth;
     private boolean isDeltaEventsEnabled;
     private boolean isMultiTenancyEnabled;
@@ -162,8 +164,8 @@ public class DBSerializer {
         this.introspectionType = introspectionType;
         this.schemaVersions = (SchemaVersions) SpringContextAware.getBean("schemaVersions");
         SchemaVersion latestVersion = schemaVersions.getDefaultVersion();
-        this.latestLoader =
-                SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, latestVersion);
+        this.latestLoader = SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType,
+                latestVersion);
         this.version = version;
         this.loader =
                 SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, version);
@@ -176,18 +178,18 @@ public class DBSerializer {
     }
 
     public DBSerializer(SchemaVersion version, TransactionalGraphEngine engine, ModelType introspectionType,
-        String sourceOfTruth, Set<String> groups) throws AAIException {
+            String sourceOfTruth, Set<String> groups) throws AAIException {
         this.engine = engine;
         this.sourceOfTruth = sourceOfTruth;
         this.groups = groups;
         this.introspectionType = introspectionType;
         this.schemaVersions = (SchemaVersions) SpringContextAware.getBean("schemaVersions");
         SchemaVersion latestVersion = schemaVersions.getDefaultVersion();
-        this.latestLoader =
-            SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, latestVersion);
+        this.latestLoader = SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType,
+                latestVersion);
         this.version = version;
         this.loader =
-            SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, version);
+                SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, version);
         this.namedPropNodes = this.latestLoader.getNamedPropNodes();
         this.baseURL = AAIConfig.get(AAIConstants.AAI_SERVER_URL_BASE);
         this.currentTimeMillis = System.currentTimeMillis();
@@ -196,22 +198,19 @@ public class DBSerializer {
         initBeans();
     }
 
-    public DBSerializer(SchemaVersion version,
-                        TransactionalGraphEngine engine,
-                        ModelType introspectionType,
-                        String sourceOfTruth,
-                        int notificationDepth) throws AAIException {
+    public DBSerializer(SchemaVersion version, TransactionalGraphEngine engine, ModelType introspectionType,
+            String sourceOfTruth, int notificationDepth) throws AAIException {
         this.engine = engine;
         this.sourceOfTruth = sourceOfTruth;
         this.groups = Collections.EMPTY_SET;
         this.introspectionType = introspectionType;
         this.schemaVersions = (SchemaVersions) SpringContextAware.getBean("schemaVersions");
         SchemaVersion latestVersion = schemaVersions.getDefaultVersion();
-        this.latestLoader =
-            SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, latestVersion);
+        this.latestLoader = SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType,
+                latestVersion);
         this.version = version;
         this.loader =
-            SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, version);
+                SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, version);
         this.namedPropNodes = this.latestLoader.getNamedPropNodes();
         this.baseURL = AAIConfig.get(AAIConstants.AAI_SERVER_URL_BASE);
         this.currentTimeMillis = System.currentTimeMillis();
@@ -219,23 +218,19 @@ public class DBSerializer {
         initBeans();
     }
 
-    public DBSerializer(SchemaVersion version,
-        TransactionalGraphEngine engine,
-        ModelType introspectionType,
-        String sourceOfTruth,
-        Set<String> groups,
-        int notificationDepth) throws AAIException {
+    public DBSerializer(SchemaVersion version, TransactionalGraphEngine engine, ModelType introspectionType,
+            String sourceOfTruth, Set<String> groups, int notificationDepth) throws AAIException {
         this.engine = engine;
         this.sourceOfTruth = sourceOfTruth;
         this.groups = groups;
         this.introspectionType = introspectionType;
         this.schemaVersions = (SchemaVersions) SpringContextAware.getBean("schemaVersions");
         SchemaVersion latestVersion = schemaVersions.getDefaultVersion();
-        this.latestLoader =
-            SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, latestVersion);
+        this.latestLoader = SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType,
+                latestVersion);
         this.version = version;
         this.loader =
-            SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, version);
+                SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, version);
         this.namedPropNodes = this.latestLoader.getNamedPropNodes();
         this.baseURL = AAIConfig.get(AAIConstants.AAI_SERVER_URL_BASE);
         this.currentTimeMillis = System.currentTimeMillis();
@@ -243,23 +238,19 @@ public class DBSerializer {
         initBeans();
     }
 
-    public DBSerializer(SchemaVersion version,
-                        TransactionalGraphEngine engine,
-                        ModelType introspectionType,
-                        String sourceOfTruth,
-                        int notificationDepth,
-                        String serverBase) throws AAIException {
+    public DBSerializer(SchemaVersion version, TransactionalGraphEngine engine, ModelType introspectionType,
+            String sourceOfTruth, int notificationDepth, String serverBase) throws AAIException {
         this.engine = engine;
         this.sourceOfTruth = sourceOfTruth;
         this.groups = Collections.EMPTY_SET;
         this.introspectionType = introspectionType;
         this.schemaVersions = (SchemaVersions) SpringContextAware.getBean("schemaVersions");
         SchemaVersion latestVersion = schemaVersions.getDefaultVersion();
-        this.latestLoader =
-            SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, latestVersion);
+        this.latestLoader = SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType,
+                latestVersion);
         this.version = version;
         this.loader =
-            SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, version);
+                SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, version);
         this.namedPropNodes = this.latestLoader.getNamedPropNodes();
         this.baseURL = serverBase;
         this.currentTimeMillis = System.currentTimeMillis();
@@ -267,24 +258,19 @@ public class DBSerializer {
         initBeans();
     }
 
-    public DBSerializer(SchemaVersion version,
-        TransactionalGraphEngine engine,
-        ModelType introspectionType,
-        String sourceOfTruth,
-        Set<String> groups,
-        int notificationDepth,
-        String serverBase) throws AAIException {
+    public DBSerializer(SchemaVersion version, TransactionalGraphEngine engine, ModelType introspectionType,
+            String sourceOfTruth, Set<String> groups, int notificationDepth, String serverBase) throws AAIException {
         this.engine = engine;
         this.sourceOfTruth = sourceOfTruth;
         this.groups = groups;
         this.introspectionType = introspectionType;
         this.schemaVersions = (SchemaVersions) SpringContextAware.getBean("schemaVersions");
         SchemaVersion latestVersion = schemaVersions.getDefaultVersion();
-        this.latestLoader =
-            SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, latestVersion);
+        this.latestLoader = SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType,
+                latestVersion);
         this.version = version;
         this.loader =
-            SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, version);
+                SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(introspectionType, version);
         this.namedPropNodes = this.latestLoader.getNamedPropNodes();
         this.baseURL = serverBase;
         this.currentTimeMillis = System.currentTimeMillis();
@@ -299,8 +285,10 @@ public class DBSerializer {
         setEdgeIngestor(ei);
         EdgeSerializer es = ctx.getBean(EdgeSerializer.class);
         setEdgeSerializer(es);
-        isDeltaEventsEnabled = Boolean.parseBoolean(SpringContextAware.getApplicationContext().getEnvironment().getProperty("delta.events.enabled", FALSE));
-        isMultiTenancyEnabled = Boolean.parseBoolean(SpringContextAware.getApplicationContext().getEnvironment().getProperty("multi.tenancy.enabled", FALSE));
+        isDeltaEventsEnabled = Boolean.parseBoolean(
+                SpringContextAware.getApplicationContext().getEnvironment().getProperty("delta.events.enabled", FALSE));
+        isMultiTenancyEnabled = Boolean.parseBoolean(SpringContextAware.getApplicationContext().getEnvironment()
+                .getProperty("multi.tenancy.enabled", FALSE));
     }
 
     public void setEdgeSerializer(EdgeSerializer edgeSer) {
@@ -333,7 +321,8 @@ public class DBSerializer {
 
     /**
      * Touch standard vertex properties.
-     *  @param v the v
+     * 
+     * @param v the v
      * @param isNewVertex the is new vertex
      */
     public void touchStandardVertexProperties(Vertex v, boolean isNewVertex) {
@@ -347,7 +336,7 @@ public class DBSerializer {
             v.property(AAIProperties.LAST_MOD_TS, currentTimeMillis);
             v.property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, this.sourceOfTruth);
         } else {
-            if(isDeltaEventsEnabled) {
+            if (isDeltaEventsEnabled) {
                 standardVertexPropsDeltas(v, timeNowInSec);
             }
             v.property(AAIProperties.RESOURCE_VERSION, timeNowInSec);
@@ -364,42 +353,37 @@ public class DBSerializer {
             getObjectDeltas().get(uri).setAction(objDeltaAction);
         }
 
-        addPropDelta(uri, AAIProperties.AAI_UUID, PropertyDeltaFactory
-                .getDelta(DeltaAction.STATIC, v.property(AAIProperties.AAI_UUID).value()),
-            objDeltaAction);
-        addPropDelta(uri, AAIProperties.NODE_TYPE, PropertyDeltaFactory
-                .getDelta(DeltaAction.STATIC, v.property(AAIProperties.NODE_TYPE).value()),
-            objDeltaAction);
-        addPropDelta(uri, AAIProperties.SOURCE_OF_TRUTH, PropertyDeltaFactory
-                .getDelta(DeltaAction.STATIC, v.property(AAIProperties.SOURCE_OF_TRUTH).value()),
-            objDeltaAction);
-        addPropDelta(uri, AAIProperties.CREATED_TS, PropertyDeltaFactory
-                .getDelta(DeltaAction.STATIC, v.property(AAIProperties.CREATED_TS).value()),
-            objDeltaAction);
+        addPropDelta(uri, AAIProperties.AAI_UUID,
+                PropertyDeltaFactory.getDelta(DeltaAction.STATIC, v.property(AAIProperties.AAI_UUID).value()),
+                objDeltaAction);
+        addPropDelta(uri, AAIProperties.NODE_TYPE,
+                PropertyDeltaFactory.getDelta(DeltaAction.STATIC, v.property(AAIProperties.NODE_TYPE).value()),
+                objDeltaAction);
+        addPropDelta(uri, AAIProperties.SOURCE_OF_TRUTH,
+                PropertyDeltaFactory.getDelta(DeltaAction.STATIC, v.property(AAIProperties.SOURCE_OF_TRUTH).value()),
+                objDeltaAction);
+        addPropDelta(uri, AAIProperties.CREATED_TS,
+                PropertyDeltaFactory.getDelta(DeltaAction.STATIC, v.property(AAIProperties.CREATED_TS).value()),
+                objDeltaAction);
 
         if (objDeltaAction.equals(DeltaAction.UPDATE)) {
+            addPropDelta(uri, AAIProperties.RESOURCE_VERSION, PropertyDeltaFactory.getDelta(objDeltaAction,
+                    timeNowInSec, v.property(AAIProperties.RESOURCE_VERSION).value()), objDeltaAction);
+            addPropDelta(uri, AAIProperties.LAST_MOD_TS, PropertyDeltaFactory.getDelta(objDeltaAction,
+                    currentTimeMillis, v.property(AAIProperties.LAST_MOD_TS).value()), objDeltaAction);
             addPropDelta(
-                uri,
-                AAIProperties.RESOURCE_VERSION,
-                PropertyDeltaFactory.getDelta(objDeltaAction, timeNowInSec, v.property(AAIProperties.RESOURCE_VERSION).value()),
-                objDeltaAction
-            );
-            addPropDelta(
-                uri,
-                AAIProperties.LAST_MOD_TS,
-                PropertyDeltaFactory.getDelta(objDeltaAction, currentTimeMillis, v.property(AAIProperties.LAST_MOD_TS).value()),
-                objDeltaAction
-            );
-            addPropDelta(
-                uri,
-                AAIProperties.LAST_MOD_SOURCE_OF_TRUTH,
-                PropertyDeltaFactory.getDelta(objDeltaAction, this.sourceOfTruth, v.property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH).value()),
-                objDeltaAction
-            );
+                    uri, AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, PropertyDeltaFactory.getDelta(objDeltaAction,
+                            this.sourceOfTruth, v.property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH).value()),
+                    objDeltaAction);
         } else {
-            addPropDelta(uri, AAIProperties.RESOURCE_VERSION, PropertyDeltaFactory.getDelta(objDeltaAction, v.property(AAIProperties.RESOURCE_VERSION).value()), objDeltaAction);
-            addPropDelta(uri, AAIProperties.LAST_MOD_TS, PropertyDeltaFactory.getDelta(objDeltaAction, v.property(AAIProperties.LAST_MOD_TS).value()), objDeltaAction);
-            addPropDelta(uri, AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, PropertyDeltaFactory.getDelta(objDeltaAction, v.property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH).value()), objDeltaAction);
+            addPropDelta(uri, AAIProperties.RESOURCE_VERSION,
+                    PropertyDeltaFactory.getDelta(objDeltaAction, v.property(AAIProperties.RESOURCE_VERSION).value()),
+                    objDeltaAction);
+            addPropDelta(uri, AAIProperties.LAST_MOD_TS,
+                    PropertyDeltaFactory.getDelta(objDeltaAction, v.property(AAIProperties.LAST_MOD_TS).value()),
+                    objDeltaAction);
+            addPropDelta(uri, AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, PropertyDeltaFactory.getDelta(objDeltaAction,
+                    v.property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH).value()), objDeltaAction);
         }
     }
 
@@ -408,13 +392,15 @@ public class DBSerializer {
     }
 
     private void addPropDelta(String uri, String prop, PropertyDelta delta, DeltaAction objDeltaAction) {
-        ObjectDelta objectDelta = this.objectDeltas.getOrDefault(uri, new ObjectDelta(uri, objDeltaAction, this.sourceOfTruth, this.currentTimeMillis));
+        ObjectDelta objectDelta = this.objectDeltas.getOrDefault(uri,
+                new ObjectDelta(uri, objDeltaAction, this.sourceOfTruth, this.currentTimeMillis));
         objectDelta.addPropertyDelta(prop, delta);
         objectDeltas.put(uri, objectDelta);
     }
 
     private void addRelationshipDelta(String uri, RelationshipDelta delta, DeltaAction objDeltaAction) {
-        ObjectDelta objectDelta = this.objectDeltas.getOrDefault(uri, new ObjectDelta(uri, objDeltaAction, this.sourceOfTruth, this.currentTimeMillis));
+        ObjectDelta objectDelta = this.objectDeltas.getOrDefault(uri,
+                new ObjectDelta(uri, objDeltaAction, this.sourceOfTruth, this.currentTimeMillis));
         objectDelta.addRelationshipDelta(delta);
         objectDeltas.put(uri, objectDelta);
     }
@@ -552,12 +538,12 @@ public class DBSerializer {
         List<Vertex> dependentVertexes = new ArrayList<>();
         List<Vertex> processedVertexes = new ArrayList<>();
 
-        boolean isComplexType ;
+        boolean isComplexType;
         boolean isListType;
 
         // If the notification depth is set to maximum
         // this is the behavior of the expected clients
-        if(notificationDepth == AAIProperties.MAXIMUM_DEPTH) {
+        if (notificationDepth == AAIProperties.MAXIMUM_DEPTH) {
             if (!obj.isContainer()) {
                 this.touchStandardVertexProperties(v, false);
             }
@@ -602,7 +588,9 @@ public class DBSerializer {
                         if (oldValue != null) {
                             v.property(dbProperty).remove();
                             if (isDeltaEventsEnabled) {
-                                addPropDelta(uri, dbProperty, PropertyDeltaFactory.getDelta(DeltaAction.DELETE, oldValue), DeltaAction.UPDATE);
+                                addPropDelta(uri, dbProperty,
+                                        PropertyDeltaFactory.getDelta(DeltaAction.DELETE, oldValue),
+                                        DeltaAction.UPDATE);
                             }
                             this.updatedVertexes.putIfAbsent(v, false);
                         }
@@ -626,7 +614,8 @@ public class DBSerializer {
                         engine.setListProperty(v, property, list);
                         if (list == null || list.isEmpty()) { // property delete scenario, there is no new value
                             if (oldVal != null && !oldVal.isEmpty()) { // and there is an old value
-                                addPropDelta(uri, property, PropertyDeltaFactory.getDelta(DeltaAction.DELETE, oldVal), DeltaAction.UPDATE);
+                                addPropDelta(uri, property, PropertyDeltaFactory.getDelta(DeltaAction.DELETE, oldVal),
+                                        DeltaAction.UPDATE);
                             }
                         } else { // is either a create or update and is handled by the called method
                             createDeltaProperty(uri, list, property, oldVal);
@@ -680,7 +669,8 @@ public class DBSerializer {
         }
 
         ImpliedDelete impliedDelete = new ImpliedDelete(engine, this);
-        List<Vertex> impliedDeleteVertices = impliedDelete.execute(v.id(), sourceOfTruth, obj.getName(), dependentVertexes);
+        List<Vertex> impliedDeleteVertices =
+                impliedDelete.execute(v.id(), sourceOfTruth, obj.getName(), dependentVertexes);
 
         if (notificationDepth == AAIProperties.MINIMUM_DEPTH) {
             for (Vertex curVertex : impliedDeleteVertices) {
@@ -694,7 +684,8 @@ public class DBSerializer {
                 LinkedHashMap<String, Introspector> curObjRelated = new LinkedHashMap<>();
 
                 if (!curObj.isTopLevel()) {
-                    curObjRelated.putAll(this.getRelatedObjects(engine.getQueryEngine(), curVertex, curObj, this.loader));
+                    curObjRelated
+                            .putAll(this.getRelatedObjects(engine.getQueryEngine(), curVertex, curObj, this.loader));
                 }
 
                 if (!impliedDeleteUriObjectPair.containsKey(curAaiUri)) {
@@ -707,14 +698,12 @@ public class DBSerializer {
 
         // touch svp using vertex list for what changed
         // if the notification depth is zero
-        if(notificationDepth == AAIProperties.MINIMUM_DEPTH){
-            this.updatedVertexes.entrySet().stream()
-                .filter(e -> !e.getValue())
-                .filter(e -> !edgeVertexes.contains(e.getKey()))
-                .forEach(e -> {
-                    this.touchStandardVertexProperties(e.getKey(), false);
-                    e.setValue(true);
-                });
+        if (notificationDepth == AAIProperties.MINIMUM_DEPTH) {
+            this.updatedVertexes.entrySet().stream().filter(e -> !e.getValue())
+                    .filter(e -> !edgeVertexes.contains(e.getKey())).forEach(e -> {
+                        this.touchStandardVertexProperties(e.getKey(), false);
+                        e.setValue(true);
+                    });
         }
         this.executePostSideEffects(obj, v);
         return processedVertexes;
@@ -724,12 +713,14 @@ public class DBSerializer {
         if (oldValue == null) {
             addPropDelta(uri, dbProperty, PropertyDeltaFactory.getDelta(DeltaAction.CREATE, value), DeltaAction.UPDATE);
         } else {
-            addPropDelta(uri, dbProperty, PropertyDeltaFactory.getDelta(DeltaAction.UPDATE, value, oldValue), DeltaAction.UPDATE);
+            addPropDelta(uri, dbProperty, PropertyDeltaFactory.getDelta(DeltaAction.UPDATE, value, oldValue),
+                    DeltaAction.UPDATE);
         }
     }
 
-    public HashMap<String, Introspector> getRelatedObjects(QueryEngine queryEngine, Vertex v,
-                                                            Introspector obj, Loader loader) throws IllegalArgumentException, SecurityException, UnsupportedEncodingException, AAIException {
+    public HashMap<String, Introspector> getRelatedObjects(QueryEngine queryEngine, Vertex v, Introspector obj,
+            Loader loader)
+            throws IllegalArgumentException, SecurityException, UnsupportedEncodingException, AAIException {
 
         HashMap<String, Introspector> relatedVertices = new HashMap<>();
         VertexProperty aaiUriProperty = v.property(AAIProperties.AAI_URI);
@@ -737,10 +728,10 @@ public class DBSerializer {
         if (!aaiUriProperty.isPresent()) {
             if (LOGGER.isDebugEnabled()) {
                 LOGGER.debug("For the given vertex {}, it seems aai-uri is not present so not getting related objects",
-                    v.id().toString());
+                        v.id().toString());
             } else {
                 LOGGER.info(
-                    "It seems aai-uri is not present in vertex, so not getting related objects, for more info enable debug log");
+                        "It seems aai-uri is not present in vertex, so not getting related objects, for more info enable debug log");
             }
             return relatedVertices;
         }
@@ -754,13 +745,14 @@ public class DBSerializer {
             // into a list of aai-uris so falling back to the old mechanism for finding parents
             if (uriList == null) {
                 LOGGER.info(
-                    "Falling back to the old mechanism due to unable to convert aai-uri to list of uris but this is not optimal");
+                        "Falling back to the old mechanism due to unable to convert aai-uri to list of uris but this is not optimal");
                 vertexChain = queryEngine.findParents(v);
             } else if (uriList.length == 1) {
                 // If the uri list is size 1 the only uri in the list is the one represented by v thus no need to query
                 vertexChain = Collections.singletonList(v);
             } else {
-                // the uriList at element 0 is the node in question and should not be included in the vertex chain lookup.
+                // the uriList at element 0 is the node in question and should not be included in the vertex chain
+                // lookup.
                 vertexChain = queryEngine.findParents(Arrays.copyOfRange(uriList, 1, uriList.length));
                 // inject v into start of vertexChain
                 vertexChain.add(0, v);
@@ -829,7 +821,7 @@ public class DBSerializer {
      * @throws AAIException
      */
     String[] convertIntrospectorToUriList(String aaiUri, Introspector obj, Loader loader)
-        throws UnsupportedEncodingException, AAIException {
+            throws UnsupportedEncodingException, AAIException {
 
         List<String> uriList = new ArrayList<>();
         String template;
@@ -893,17 +885,15 @@ public class DBSerializer {
      * @throws AAIException the AAI exception
      */
     private void processRelationshipList(Introspector wrapped, Vertex v)
-        throws UnsupportedEncodingException, AAIException {
+            throws UnsupportedEncodingException, AAIException {
 
         List<Object> relationships = wrapped.getValue("relationship");
         String mainUri = getURIForVertex(v).toString();
         String aNodeType = v.property(AAIProperties.NODE_TYPE).value().toString();
-        EdgeRuleQuery.Builder cousinQueryBuilder = new EdgeRuleQuery.Builder(aNodeType)
-            .edgeType(EdgeType.COUSIN)
-            .version(wrapped.getVersion());
-        EdgeRuleQuery.Builder treeQueryBuilder = new EdgeRuleQuery.Builder(aNodeType)
-            .edgeType(EdgeType.TREE)
-            .version(wrapped.getVersion());
+        EdgeRuleQuery.Builder cousinQueryBuilder =
+                new EdgeRuleQuery.Builder(aNodeType).edgeType(EdgeType.COUSIN).version(wrapped.getVersion());
+        EdgeRuleQuery.Builder treeQueryBuilder =
+                new EdgeRuleQuery.Builder(aNodeType).edgeType(EdgeType.TREE).version(wrapped.getVersion());
 
         EdgeIngestor edgeIngestor = SpringContextAware.getBean(EdgeIngestor.class);
 
@@ -918,8 +908,9 @@ public class DBSerializer {
                 QueryParser parser = engine.getQueryBuilder().createQueryFromRelationship(wrappedRel);
                 List<Vertex> results = parser.getQueryBuilder().toList();
                 if (results.isEmpty()) {
-                    final AAIException ex = new AAIException(AAI_6129,
-                        String.format("Node of type %s. Could not find object at: %s", parser.getResultType(), parser.getUri()));
+                    final AAIException ex =
+                            new AAIException(AAI_6129, String.format("Node of type %s. Could not find object at: %s",
+                                    parser.getResultType(), parser.getUri()));
                     ex.getTemplateVars().add(parser.getResultType());
                     ex.getTemplateVars().add(parser.getUri().toString());
                     throw ex;
@@ -928,7 +919,8 @@ public class DBSerializer {
                     if (results.get(0).property(AAIProperties.AAI_URI).isPresent()) {
                         relUri = results.get(0).value(AAIProperties.AAI_URI);
                     } else {
-                        LOGGER.warn("Not processing the vertex {} because its missing required property aai-uri", results.get(0).id());
+                        LOGGER.warn("Not processing the vertex {} because its missing required property aai-uri",
+                                results.get(0).id());
                         continue;
                     }
                 }
@@ -943,19 +935,18 @@ public class DBSerializer {
                 if (!edgeIngestor.hasRule(ruleQuery)) {
                     EdgeRuleQuery treeQuery = treeQueryBuilder.to(bNodeType).build();
                     if (edgeIngestor.hasRule(treeQuery)) {
-                        throw new AAIException(AAI_6145); //attempted to create cousin edge for a parent-child edge rule
+                        throw new AAIException(AAI_6145); // attempted to create cousin edge for a parent-child edge
+                                                          // rule
                     }
-                    throw new AAIException("AAI_6120", String.format(
-                        "No EdgeRule found for passed nodeTypes: %s, %s.",
-                        aNodeType, bNodeType));
+                    throw new AAIException("AAI_6120",
+                            String.format("No EdgeRule found for passed nodeTypes: %s, %s.", aNodeType, bNodeType));
                 } else {
                     try {
                         final List<EdgeRule> rules = new ArrayList<>(edgeIngestor.getRules(ruleQuery).values());
                         if (rules.size() == 1) {
                             label = rules.get(0).getLabel();
                         } else {
-                            Optional<EdgeRule>
-                                defaultRule = rules.stream().filter(EdgeRule::isDefault).findFirst();
+                            Optional<EdgeRule> defaultRule = rules.stream().filter(EdgeRule::isDefault).findFirst();
                             if (defaultRule.isPresent()) {
                                 label = defaultRule.get().getLabel();
                             } else {
@@ -973,18 +964,17 @@ public class DBSerializer {
         List<Path> paths = this.engine.getQueryEngine().findCousinsAsPath(v);
         Set<Path> toRemove = new HashSet<>();
 
-
-        //  for each path 3 things can happen:
-        //      1. The edge rule that created it is not in this version no action is to be taken on that edge
-        //      2. The edge rule exits in this version it's included in the request the edge is left alone
-        //      3. The edge rule exits in this version and is not included in the request it is marked for removal
+        // for each path 3 things can happen:
+        // 1. The edge rule that created it is not in this version no action is to be taken on that edge
+        // 2. The edge rule exits in this version it's included in the request the edge is left alone
+        // 3. The edge rule exits in this version and is not included in the request it is marked for removal
         for (Path path : paths) {
             if (path.size() < 3) {
                 continue;
             }
 
             // Path represents
-            //       v   ----related-to-->    otherV
+            // v ----related-to--> otherV
             // In the above case,
             // path objects get(0) returns vertex v
             // path objects.get(1) returns edge related-to
@@ -1028,7 +1018,7 @@ public class DBSerializer {
             List<Vertex> results = parser.getQueryBuilder().toList();
             if (results.isEmpty()) {
                 final AAIException ex = new AAIException(AAI_6129,
-                    "Node of type " + parser.getResultType() + ". Could not find object at: " + parser.getUri());
+                        "Node of type " + parser.getResultType() + ". Could not find object at: " + parser.getUri());
                 ex.getTemplateVars().add(parser.getResultType());
                 ex.getTemplateVars().add(parser.getUri().toString());
                 throw ex;
@@ -1043,11 +1033,11 @@ public class DBSerializer {
                 EdgeRuleQuery.Builder baseQ = new EdgeRuleQuery.Builder(vType, cousinType).label(label);
 
                 if (!edgeRules.hasRule(baseQ.build())) {
-                    throw new AAIException("AAI_6120", String.format(
-                        "No EdgeRule found for passed nodeTypes: %s, %s%s.",
-                        aNodeType, cousinType, label != null ? (" with label " + label) : ""));
+                    throw new AAIException("AAI_6120",
+                            String.format("No EdgeRule found for passed nodeTypes: %s, %s%s.", aNodeType, cousinType,
+                                    label != null ? (" with label " + label) : ""));
                 } else if (edgeRules.hasRule(baseQ.edgeType(EdgeType.TREE).build())
-                    && !edgeRules.hasRule(baseQ.edgeType(EdgeType.COUSIN).build())) {
+                        && !edgeRules.hasRule(baseQ.edgeType(EdgeType.COUSIN).build())) {
                     throw new AAIException(AAI_6145);
                 }
 
@@ -1060,7 +1050,7 @@ public class DBSerializer {
         }
 
         for (Path path : toRemove) {
-            if(isDeltaEventsEnabled) {
+            if (isDeltaEventsEnabled) {
                 deltaForEdge(mainUri, path.get(1), DeltaAction.DELETE_REL, DeltaAction.UPDATE);
             }
             this.updatedVertexes.putIfAbsent(v, false);
@@ -1070,7 +1060,8 @@ public class DBSerializer {
 
         for (Pair<Vertex, String> create : toBeCreated) {
             try {
-                Edge e = edgeSer.addEdge(this.engine.asAdmin().getTraversalSource(), v, create.getValue0(), create.getValue1());
+                Edge e = edgeSer.addEdge(this.engine.asAdmin().getTraversalSource(), v, create.getValue0(),
+                        create.getValue1());
                 if (isDeltaEventsEnabled) {
                     deltaForEdge(mainUri, e, DeltaAction.CREATE_REL, DeltaAction.UPDATE);
                 }
@@ -1082,15 +1073,12 @@ public class DBSerializer {
         }
     }
 
-
     private void deltaForEdge(String mainUri, Edge edge, DeltaAction edgeAction, DeltaAction mainAction) {
-        RelationshipDelta relationshipDelta = new RelationshipDelta(
-            edgeAction,
-            edge.inVertex().property(AAIProperties.AAI_UUID).value().toString(),
-            edge.outVertex().property(AAIProperties.AAI_UUID).value().toString(),
-            edge.inVertex().property(AAIProperties.AAI_URI).value().toString(),
-            edge.outVertex().property(AAIProperties.AAI_URI).value().toString(),
-            edge.label());
+        RelationshipDelta relationshipDelta =
+                new RelationshipDelta(edgeAction, edge.inVertex().property(AAIProperties.AAI_UUID).value().toString(),
+                        edge.outVertex().property(AAIProperties.AAI_UUID).value().toString(),
+                        edge.inVertex().property(AAIProperties.AAI_URI).value().toString(),
+                        edge.outVertex().property(AAIProperties.AAI_URI).value().toString(), edge.label());
         edge.properties().forEachRemaining(p -> relationshipDelta.addProp(p.key(), p.value().toString()));
         addRelationshipDelta(mainUri, relationshipDelta, mainAction);
     }
@@ -1196,8 +1184,9 @@ public class DBSerializer {
                 }
             }
             e = edgeSer.addTreeEdge(this.engine.asAdmin().getTraversalSource(), parent, child);
-            if(isDeltaEventsEnabled) {
-                deltaForEdge(child.property(AAIProperties.AAI_URI).value().toString(), e, DeltaAction.CREATE_REL, DeltaAction.CREATE);
+            if (isDeltaEventsEnabled) {
+                deltaForEdge(child.property(AAIProperties.AAI_URI).value().toString(), e, DeltaAction.CREATE_REL,
+                        DeltaAction.CREATE);
             }
         }
         return child;
@@ -1230,7 +1219,7 @@ public class DBSerializer {
      * @throws URISyntaxException
      */
     public Introspector dbToObject(List<Vertex> vertices, final Introspector obj, int depth, boolean nodeOnly,
-                                   String cleanUp, boolean isSkipRelatedTo) throws UnsupportedEncodingException, AAIException {
+            String cleanUp, boolean isSkipRelatedTo) throws UnsupportedEncodingException, AAIException {
         final int internalDepth;
         if (depth == Integer.MAX_VALUE) {
             internalDepth = depth--;
@@ -1241,7 +1230,7 @@ public class DBSerializer {
         if (vertices.size() > 1 && !obj.isContainer()) {
             dbTimeMsecs += StopWatch.stopIfStarted();
             throw new AAIException("AAI_6136",
-                "query object mismatch: this object cannot hold multiple items." + obj.getDbName());
+                    "query object mismatch: this object cannot hold multiple items." + obj.getDbName());
         } else if (obj.isContainer()) {
             final List getList;
             String listProperty = null;
@@ -1357,7 +1346,7 @@ public class DBSerializer {
      * @throws URISyntaxException
      */
     private Introspector dbToObject(Introspector obj, Vertex v, Set<Vertex> seen, int depth, boolean nodeOnly,
-                                    String cleanUp, boolean isSkipRelatedTo) throws AAIException, UnsupportedEncodingException {
+            String cleanUp, boolean isSkipRelatedTo) throws AAIException, UnsupportedEncodingException {
 
         if (depth < 0) {
             return null;
@@ -1406,7 +1395,7 @@ public class DBSerializer {
 
                         try {
                             rule = edgeRules.getRule(
-                                new EdgeRuleQuery.Builder(vType, childDbName).edgeType(EdgeType.TREE).build());
+                                    new EdgeRuleQuery.Builder(vType, childDbName).edgeType(EdgeType.TREE).build());
                         } catch (EdgeRuleNotFoundException e) {
                             throw new NoEdgeRuleFoundException(e);
                         } catch (AmbiguousRuleChoiceException e) {
@@ -1429,8 +1418,8 @@ public class DBSerializer {
                                 if (!seen.contains(childVertex)) {
                                     Introspector argumentObject = obj.newIntrospectorInstanceOfNestedProperty(property);
 
-                                    Object result =
-                                        dbToObject(argumentObject, childVertex, seen, depth, nodeOnly, cleanUp, isSkipRelatedTo);
+                                    Object result = dbToObject(argumentObject, childVertex, seen, depth, nodeOnly,
+                                            cleanUp, isSkipRelatedTo);
                                     if (result != null && getList != null) {
                                         getList.add(argumentObject.getUnderlyingObject());
                                     }
@@ -1438,7 +1427,7 @@ public class DBSerializer {
                                     processed++;
                                 } else {
                                     LOGGER.warn("Cycle found while serializing vertex id={}",
-                                        childVertex.id().toString());
+                                            childVertex.id().toString());
                                 }
                             }
                             if (processed == 0) {
@@ -1532,7 +1521,8 @@ public class DBSerializer {
         return simplePropsHashMap;
     }
 
-    public Introspector dbToRelationshipObject(Vertex v, boolean isSkipRelatedTo) throws UnsupportedEncodingException, AAIException {
+    public Introspector dbToRelationshipObject(Vertex v, boolean isSkipRelatedTo)
+            throws UnsupportedEncodingException, AAIException {
         Introspector relationshipList = this.latestLoader.introspectorFromName("relationship-list");
         relationshipList = createRelationshipList(v, relationshipList, FALSE, isSkipRelatedTo);
         return relationshipList;
@@ -1588,9 +1578,8 @@ public class DBSerializer {
 
         EdgeIngestor edgeIngestor = SpringContextAware.getBean(EdgeIngestor.class);
 
-        EdgeRuleQuery.Builder queryBuilder = new EdgeRuleQuery.Builder(aNodeType)
-            .edgeType(EdgeType.COUSIN)
-            .version(obj.getVersion());
+        EdgeRuleQuery.Builder queryBuilder =
+                new EdgeRuleQuery.Builder(aNodeType).edgeType(EdgeType.COUSIN).version(obj.getVersion());
 
         for (Path path : paths) {
             if (path.size() < 3) {
@@ -1598,7 +1587,7 @@ public class DBSerializer {
             }
 
             // Path represents
-            //       v   ----related-to-->    otherV
+            // v ----related-to--> otherV
             // In the above case,
             // path objects get(0) returns vertex v
             // path objects.get(1) returns edge related-to
@@ -1627,7 +1616,7 @@ public class DBSerializer {
             EdgeRuleQuery ruleQuery = queryBuilder.to(bNodeType).label(edgeLabel).build();
 
             if (!edgeIngestor.hasRule(ruleQuery)) {
-                LOGGER.debug( "Caught an edge rule not found for query {}", ruleQuery);
+                LOGGER.debug("Caught an edge rule not found for query {}", ruleQuery);
                 continue;
             }
 
@@ -1724,7 +1713,6 @@ public class DBSerializer {
         return uri;
     }
 
-
     public void addRelatedToProperty(Introspector relationship, Vertex cousinVertex, String cousinType)
             throws AAIUnknownObjectException {
 
@@ -1816,8 +1804,9 @@ public class DBSerializer {
                 e = this.getEdgeBetween(EdgeType.COUSIN, inputVertex, relatedVertex, label);
                 if (e == null) {
                     e = edgeSer.addEdge(this.engine.asAdmin().getTraversalSource(), inputVertex, relatedVertex, label);
-                    if(isDeltaEventsEnabled) {
-                        deltaForEdge(inputVertex.property(AAIProperties.AAI_URI).value().toString(), e, DeltaAction.CREATE_REL, DeltaAction.UPDATE);
+                    if (isDeltaEventsEnabled) {
+                        deltaForEdge(inputVertex.property(AAIProperties.AAI_URI).value().toString(), e,
+                                DeltaAction.CREATE_REL, DeltaAction.UPDATE);
                     }
                 } else {
                     // attempted to link two vertexes already linked
@@ -2046,23 +2035,22 @@ public class DBSerializer {
 
         for (Vertex v : vertices) {
             LOGGER.debug("Removing vertex {} with label {}", v.id(), v.label());
-            if(isDeltaEventsEnabled) {
+            if (isDeltaEventsEnabled) {
                 deltaForVertexDelete(v);
             }
-            //add the cousin vertexes of v to have their resource-version updated and notified on.
-            v.edges(Direction.BOTH)
-                .forEachRemaining(e -> {
-                    if (e.property(EdgeProperty.CONTAINS.toString()).isPresent()
+            // add the cousin vertexes of v to have their resource-version updated and notified on.
+            v.edges(Direction.BOTH).forEachRemaining(e -> {
+                if (e.property(EdgeProperty.CONTAINS.toString()).isPresent()
                         && AAIDirection.NONE.toString().equals(e.<String>value(EdgeProperty.CONTAINS.toString()))) {
-                        e.bothVertices().forEachRemaining(cousinV -> {
-                            if (!v.equals(cousinV)) {
-                                edgeVertexes.add(cousinV);
-                            }
-                        });
-                    }
-                });
+                    e.bothVertices().forEachRemaining(cousinV -> {
+                        if (!v.equals(cousinV)) {
+                            edgeVertexes.add(cousinV);
+                        }
+                    });
+                }
+            });
 
-            //if somewhere along the way v was added to the sets tracking the what is to be updated/notified on
+            // if somewhere along the way v was added to the sets tracking the what is to be updated/notified on
             // it should be removed from them as v is to be deleted
             edgeVertexes.remove(v);
             updatedVertexes.remove(v);
@@ -2078,16 +2066,15 @@ public class DBSerializer {
             List<Object> list = new ArrayList<>();
             vertex.properties(k).forEachRemaining(vp -> list.add(vp.value()));
             if (list.size() == 1) {
-                addPropDelta(aaiUri, k,
-                    PropertyDeltaFactory.getDelta(DeltaAction.DELETE, list.get(0)),
-                    DeltaAction.DELETE);
+                addPropDelta(aaiUri, k, PropertyDeltaFactory.getDelta(DeltaAction.DELETE, list.get(0)),
+                        DeltaAction.DELETE);
             } else {
-                addPropDelta(aaiUri, k, PropertyDeltaFactory.getDelta(DeltaAction.DELETE, list),
-                    DeltaAction.DELETE);
+                addPropDelta(aaiUri, k, PropertyDeltaFactory.getDelta(DeltaAction.DELETE, list), DeltaAction.DELETE);
             }
 
         });
-        vertex.edges(Direction.BOTH).forEachRemaining(e -> deltaForEdge(aaiUri, e, DeltaAction.DELETE, DeltaAction.DELETE));
+        vertex.edges(Direction.BOTH)
+                .forEachRemaining(e -> deltaForEdge(aaiUri, e, DeltaAction.DELETE, DeltaAction.DELETE));
     }
 
     /**
@@ -2162,7 +2149,7 @@ public class DBSerializer {
         nodeType = vertex.<String>property(AAIProperties.NODE_TYPE).orElse(null);
         if (enableResourceVersion) {
             this.verifyResourceVersion("delete", nodeType,
-                vertex.<String>property(AAIProperties.RESOURCE_VERSION).orElse(null), resourceVersion, nodeType);
+                    vertex.<String>property(AAIProperties.RESOURCE_VERSION).orElse(null), resourceVersion, nodeType);
         }
         List<Vertex> vertices = new ArrayList<>();
         vertices.add(vertex);
@@ -2202,10 +2189,9 @@ public class DBSerializer {
         dbTimeMsecs += StopWatch.stopIfStarted();
         if (!preventDeleteVertices.isEmpty()) {
             aaiExceptionCode = "AAI_6110";
-            errorDetail = String.format(
-                "Object is being reference by additional objects preventing it from being deleted." +
-                    " Please clean up references from the following types %s",
-                preventDeleteVertices);
+            errorDetail =
+                    String.format("Object is being reference by additional objects preventing it from being deleted."
+                            + " Please clean up references from the following types %s", preventDeleteVertices);
             result = false;
         }
         if (!result) {
@@ -2319,9 +2305,8 @@ public class DBSerializer {
 
     private void executePreSideEffects(Introspector obj, Vertex self) throws AAIException {
 
-        SideEffectRunner.Builder runnerBuilder =
-            new SideEffectRunner.Builder(this.engine, this).addSideEffect(DataCopy.class)
-                .addSideEffect(PrivateEdge.class);
+        SideEffectRunner.Builder runnerBuilder = new SideEffectRunner.Builder(this.engine, this)
+                .addSideEffect(DataCopy.class).addSideEffect(PrivateEdge.class);
         if (isMultiTenancyEnabled) {
             runnerBuilder.addSideEffect(OwnerCheck.class);
         }
@@ -2339,7 +2324,7 @@ public class DBSerializer {
     private void enrichData(Introspector obj, Vertex self) throws AAIException {
 
         SideEffectRunner.Builder runnerBuilder =
-            new SideEffectRunner.Builder(this.engine, this).addSideEffect(DataLinkReader.class);
+                new SideEffectRunner.Builder(this.engine, this).addSideEffect(DataLinkReader.class);
 
         if (isMultiTenancyEnabled) {
             runnerBuilder.addSideEffect(OwnerCheck.class);
@@ -2373,11 +2358,10 @@ public class DBSerializer {
      * @throws AAIUnknownObjectException
      * @throws URISyntaxException
      */
-    public Introspector dbToObjectWithFilters(Introspector obj, Vertex vertex, Set<Vertex> seen, int depth, boolean nodeOnly,
-                                              List<String> filterCousinNodes, List<String> filterParentNodes)
-        throws AAIException, UnsupportedEncodingException {
-        return dbToObjectWithFilters(obj, vertex, seen, depth, nodeOnly,
-        filterCousinNodes, filterParentNodes, false);
+    public Introspector dbToObjectWithFilters(Introspector obj, Vertex vertex, Set<Vertex> seen, int depth,
+            boolean nodeOnly, List<String> filterCousinNodes, List<String> filterParentNodes)
+            throws AAIException, UnsupportedEncodingException {
+        return dbToObjectWithFilters(obj, vertex, seen, depth, nodeOnly, filterCousinNodes, filterParentNodes, false);
     }
 
     /**
@@ -2405,8 +2389,8 @@ public class DBSerializer {
      * @throws URISyntaxException
      */
     // TODO - See if you can merge the 2 dbToObjectWithFilters
-    public Introspector dbToObjectWithFilters(Introspector obj, Vertex vertexParam, Set<Vertex> seen, int depth, boolean nodeOnly,
-            List<String> filterCousinNodes, List<String> filterParentNodes, boolean isSkipRelatedTo)
+    public Introspector dbToObjectWithFilters(Introspector obj, Vertex vertexParam, Set<Vertex> seen, int depth,
+            boolean nodeOnly, List<String> filterCousinNodes, List<String> filterParentNodes, boolean isSkipRelatedTo)
             throws AAIException, UnsupportedEncodingException {
         String cleanUp = FALSE;
         if (depth < 0) {
@@ -2436,8 +2420,7 @@ public class DBSerializer {
                     } else if (property.equals("relationship-list") && !nodeOnly) {
                         /* relationships need to be handled correctly */
                         Introspector relationshipList = obj.newIntrospectorInstanceOfProperty(property);
-                        relationshipList =
-                            createFilteredRelationshipList(vertexParam, relationshipList, cleanUp,
+                        relationshipList = createFilteredRelationshipList(vertexParam, relationshipList, cleanUp,
                                 filterCousinNodes, isSkipRelatedTo);
                         if (relationshipList != null) {
                             obj.setValue(property, relationshipList.getUnderlyingObject());
@@ -2459,7 +2442,8 @@ public class DBSerializer {
                         boolean isThisParentRequired =
                                 filterParentNodes.parallelStream().anyMatch(childDbName::contains);
 
-                        EdgeRuleQuery query = new EdgeRuleQuery.Builder(vertexType, childDbName).edgeType(EdgeType.TREE).build();
+                        EdgeRuleQuery query =
+                                new EdgeRuleQuery.Builder(vertexType, childDbName).edgeType(EdgeType.TREE).build();
 
                         try {
                             rule = edgeRules.getRule(query);
@@ -2547,7 +2531,7 @@ public class DBSerializer {
         Iterator<Vertex> cousinVertices = allCousins.stream().filter(item -> {
             String node = (String) item.property(AAIProperties.NODE_TYPE).orElse("");
             return filterNodes.parallelStream().anyMatch(node::contains);
-          }).iterator();
+        }).iterator();
 
         List<Object> relationshipObjList = obj.getValue(RELATIONSHIP);
 
index 3a7c6d2..f7d97f3 100644 (file)
 
 package org.onap.aai.serialization.db;
 
+import java.util.concurrent.atomic.AtomicInteger;
+
 import org.janusgraph.core.JanusGraph;
 import org.onap.aai.dbmap.AAIGraph;
 
-import java.util.concurrent.atomic.AtomicInteger;
-
 /* This class simply calls AAIGraph under the covers for now */
 public class GraphSingleton {
 
index f8f057d..2c0a91c 100644 (file)
@@ -17,6 +17,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.serialization.db;
 
 import java.util.List;
@@ -57,7 +58,7 @@ public class ImpliedDelete implements AAIConfigProxy {
     private TransactionalGraphEngine engine;
     private DBSerializer serializer;
 
-    public ImpliedDelete(TransactionalGraphEngine engine, DBSerializer serializer){
+    public ImpliedDelete(TransactionalGraphEngine engine, DBSerializer serializer) {
         this.engine = engine;
         this.serializer = serializer;
     }
@@ -83,22 +84,21 @@ public class ImpliedDelete implements AAIConfigProxy {
      * @param dependentVertexes - list of children vertexes
      * @throws AAIException if the user is not allowed to implicitly delete children
      */
-    public List<Vertex> execute(Object id, String sot, String objectType, List<Vertex> dependentVertexes) throws AAIException {
-        if(dependentVertexes != null && !dependentVertexes.isEmpty()){
+    public List<Vertex> execute(Object id, String sot, String objectType, List<Vertex> dependentVertexes)
+            throws AAIException {
+        if (dependentVertexes != null && !dependentVertexes.isEmpty()) {
             // Find all the deletable vertices from the dependent vertices that should be deleted
             // So for each of the following dependent vertices,
             // we will use the edge properties and do the cascade delete
             QueryEngine queryEngine = this.engine.getQueryEngine();
             List<Vertex> impliedDeleteVertices = queryEngine.findDeletable(dependentVertexes);
-            if(this.allow(sot, objectType)){
+            if (this.allow(sot, objectType)) {
 
                 int impliedDeleteCount = impliedDeleteVertices.size();
 
                 LOGGER.warn(
-                    "For the vertex with id {}, doing an implicit delete on update will delete total of {} vertexes",
-                    id,
-                    impliedDeleteCount
-                );
+                        "For the vertex with id {}, doing an implicit delete on update will delete total of {} vertexes",
+                        id, impliedDeleteCount);
 
                 String impliedDeleteLogEnabled = get(AAIConstants.AAI_IMPLIED_DELETE_LOG_ENABLED, "true");
 
@@ -120,8 +120,8 @@ public class ImpliedDelete implements AAIConfigProxy {
                             }
                         } catch (Exception ex) {
                             LOGGER.warn(
-                                "Encountered an exception during retrieval of vertex properties with vertex-id {} -> {}",
-                                id, LogFormatTools.getStackTop(ex));
+                                    "Encountered an exception during retrieval of vertex properties with vertex-id {} -> {}",
+                                    id, LogFormatTools.getStackTop(ex));
                         }
                     }
                 }
@@ -136,11 +136,11 @@ public class ImpliedDelete implements AAIConfigProxy {
         }
     }
 
-    public void delete(List<Vertex> vertices){
-       // After all the appropriate logging, calling the serializer delete to delete the affected vertices
-       if(vertices != null && !vertices.isEmpty()){
-           serializer.delete(vertices);
-       }
+    public void delete(List<Vertex> vertices) {
+        // After all the appropriate logging, calling the serializer delete to delete the affected vertices
+        if (vertices != null && !vertices.isEmpty()) {
+            serializer.delete(vertices);
+        }
     }
 
     /**
@@ -157,13 +157,13 @@ public class ImpliedDelete implements AAIConfigProxy {
      * So in the above code, the expectation is for any of the following user:
      *
      * <ul>
-     *     <li>SDC</li>
-     *     <li>SDc</li>
-     *     <li>Sdc</li>
-     *     <li>sDc</li>
-     *     <li>SdC</li>
-     *     <li>sdC</li>
-     *     <li>sdc</li>
+     * <li>SDC</li>
+     * <li>SDc</li>
+     * <li>Sdc</li>
+     * <li>sDc</li>
+     * <li>SdC</li>
+     * <li>sdC</li>
+     * <li>sdc</li>
      * </ul>
      *
      * They are allowed to delete the children of pserver and vserver by implicit delete
@@ -175,28 +175,28 @@ public class ImpliedDelete implements AAIConfigProxy {
      * or loading into an set which is unnecessary and it could potentially be done for every request
      *
      * @param sourceOfTruth - the original requester that the request is coming from,
-     *                        derived from HTTP Header X-FromAppId
+     *        derived from HTTP Header X-FromAppId
      * @param parentObjectType - parent object in which they are trying to do the implicit delete against
      *
-     * @return true  - if the requester is allowed to implicit delete against the object type
+     * @return true - if the requester is allowed to implicit delete against the object type
      *         false - if they are not allowed
      */
-    private boolean allow(String sourceOfTruth, String parentObjectType){
+    private boolean allow(String sourceOfTruth, String parentObjectType) {
         Objects.requireNonNull(sourceOfTruth);
         Objects.requireNonNull(parentObjectType);
 
         String propertyName = AAIConstants.AAI_IMPLIED_DELETE_WHITELIST + sourceOfTruth.toLowerCase();
         String whitelist = get(propertyName, StringUtils.EMPTY);
 
-        if(whitelist.isEmpty()){
+        if (whitelist.isEmpty()) {
             return false;
         }
 
-        if(STAR.equals(whitelist)){
+        if (STAR.equals(whitelist)) {
             return true;
         }
 
-        if(whitelist.contains("'" + parentObjectType + "'")){
+        if (whitelist.contains("'" + parentObjectType + "'")) {
             return true;
         }
 
index 66509c9..e11b4ae 100644 (file)
 
 package org.onap.aai.serialization.engines;
 
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -32,10 +36,6 @@ import org.onap.aai.serialization.db.InMemoryGraphSingleton;
 import org.onap.aai.serialization.engines.query.GraphTraversalQueryEngine;
 import org.onap.aai.serialization.engines.query.QueryEngine;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
 public class InMemoryDBEngine extends TransactionalGraphEngine {
 
     /**
index 2a4511d..f2e40af 100644 (file)
 
 package org.onap.aai.serialization.engines;
 
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.onap.aai.introspection.Loader;
 import org.onap.aai.serialization.db.JanusGraphSingleton;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
 public class JanusGraphDBEngine extends TransactionalGraphEngine {
 
     /**
index b945db0..6327272 100644 (file)
@@ -20,6 +20,9 @@
 
 package org.onap.aai.serialization.engines;
 
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -32,9 +35,6 @@ import org.onap.aai.serialization.db.GraphSingleton;
 import org.onap.aai.serialization.engines.query.GraphTraversalQueryEngine;
 import org.onap.aai.serialization.engines.query.QueryEngine;
 
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
 public abstract class TransactionalGraphEngine {
 
     protected GraphSingleton singleton = null;
@@ -163,7 +163,7 @@ public abstract class TransactionalGraphEngine {
             throw new IllegalArgumentException("History Traversal needs history traversal source");
         } else if (style.equals(QueryStyle.HISTORY_GREMLIN_TRAVERSAL)) {
             throw new IllegalArgumentException("History Gremlin Traversal needs history traversal source");
-        }else {
+        } else {
             throw new IllegalArgumentException("Query Builder type not recognized");
         }
         return queryBuilder;
@@ -182,9 +182,9 @@ public abstract class TransactionalGraphEngine {
             return new TraversalURIOptimizedQuery<>(loader, source);
         } else if (style.equals(QueryStyle.HISTORY_TRAVERSAL)) {
             return new HistoryTraversalURIOptimizedQuery<>(loader, source);
-        }else if (style.equals(QueryStyle.HISTORY_GREMLIN_TRAVERSAL)) {
+        } else if (style.equals(QueryStyle.HISTORY_GREMLIN_TRAVERSAL)) {
             return new HistoryGremlinTraversal<>(loader, source);
-        }else {
+        } else {
             throw new IllegalArgumentException("Query Builder type not recognized");
         }
         return queryBuilder;
@@ -225,7 +225,7 @@ public abstract class TransactionalGraphEngine {
         if (this.tx() == null) {
             this.currentTx = this.getGraph().newTransaction();
             this.currentTraversal = this.tx().traversal();
-            this.readOnlyTraversal =this.tx().traversal().withStrategies(ReadOnlyStrategy.instance());
+            this.readOnlyTraversal = this.tx().traversal().withStrategies(ReadOnlyStrategy.instance());
         }
         return currentTx;
     }
index 376a279..c96e8d2 100644 (file)
 
 package org.onap.aai.serialization.engines.query;
 
+import static org.onap.aai.edges.enums.AAIDirection.*;
+import static org.onap.aai.edges.enums.EdgeField.PRIVATE;
+import static org.onap.aai.edges.enums.EdgeProperty.CONTAINS;
+import static org.onap.aai.edges.enums.EdgeProperty.DELETE_OTHER_V;
+
+import java.util.List;
+import java.util.Set;
+
 import org.apache.tinkerpop.gremlin.process.traversal.Order;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Path;
@@ -37,14 +45,6 @@ import org.onap.aai.edges.enums.EdgeProperty;
 import org.onap.aai.introspection.Loader;
 import org.onap.aai.logging.StopWatch;
 
-import java.util.List;
-import java.util.Set;
-
-import static org.onap.aai.edges.enums.AAIDirection.*;
-import static org.onap.aai.edges.enums.EdgeField.PRIVATE;
-import static org.onap.aai.edges.enums.EdgeProperty.CONTAINS;
-import static org.onap.aai.edges.enums.EdgeProperty.DELETE_OTHER_V;
-
 /*
  * This class needs some big explanation despite its compact size.
  * This controls all the queries performed by the CRUD API in A&AI.
@@ -257,13 +257,9 @@ public class GraphTraversalQueryEngine extends QueryEngine {
         return pipeline.toList();
     }
 
-    public List<Path> findCousinsAsPath(Vertex start){
-        return this.g.V(start).bothE().where(
-            __.and(
-                __.has(EdgeProperty.CONTAINS.toString(), NONE.toString()),
-                __.not(__.has(EdgeField.PRIVATE.toString(), true))
-            )
-        ).otherV().path().toList();
+    public List<Path> findCousinsAsPath(Vertex start) {
+        return this.g.V(start).bothE().where(__.and(__.has(EdgeProperty.CONTAINS.toString(), NONE.toString()),
+                __.not(__.has(EdgeField.PRIVATE.toString(), true)))).otherV().path().toList();
     }
 
     public double getDBTimeMsecs() {
index 9ce343f..2836282 100644 (file)
 
 package org.onap.aai.serialization.queryformats;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.google.gson.*;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Edge;
+
+import java.io.UnsupportedEncodingException;
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.onap.aai.db.props.AAIProperties;
@@ -40,11 +42,8 @@ import org.onap.aai.serialization.queryformats.params.AsTree;
 import org.onap.aai.serialization.queryformats.params.Depth;
 import org.onap.aai.serialization.queryformats.params.NodesOnly;
 import org.onap.aai.serialization.queryformats.utils.UrlBuilder;
-
-import java.io.UnsupportedEncodingException;
-import java.util.*;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class Aggregate extends MultiFormatMapper {
     private static final Logger LOGGER = LoggerFactory.getLogger(LifecycleFormat.class);
@@ -65,13 +64,14 @@ public class Aggregate extends MultiFormatMapper {
     }
 
     @Override
-    public Optional<JsonObject> getJsonFromVertex(Vertex v, Map<String, List<String>> selectedProps) throws AAIFormatVertexException{
+    public Optional<JsonObject> getJsonFromVertex(Vertex v, Map<String, List<String>> selectedProps)
+            throws AAIFormatVertexException {
         JsonObject json = new JsonObject();
         JsonObject outer = new JsonObject();
-        Optional<JsonObject> properties = this.createSelectedPropertiesObject(v,selectedProps);
+        Optional<JsonObject> properties = this.createSelectedPropertiesObject(v, selectedProps);
         if (properties.isPresent()) {
             json.add("properties", properties.get());
-            outer.add(this.urlBuilder.pathed(v),json.getAsJsonObject());
+            outer.add(this.urlBuilder.pathed(v), json.getAsJsonObject());
         } else {
             return Optional.empty();
         }
@@ -86,7 +86,7 @@ public class Aggregate extends MultiFormatMapper {
     public Optional<JsonObject> createPropertiesObject(Vertex v) throws AAIFormatVertexException {
         try {
             final Introspector obj =
-                loader.introspectorFromName(v.<String>property(AAIProperties.NODE_TYPE).orElse(null));
+                    loader.introspectorFromName(v.<String>property(AAIProperties.NODE_TYPE).orElse(null));
 
             final List<Vertex> wrapper = new ArrayList<>();
             wrapper.add(v);
@@ -95,7 +95,7 @@ public class Aggregate extends MultiFormatMapper {
                 serializer.dbToObject(wrapper, obj, 0, true, "false");
             } catch (AAIException | UnsupportedEncodingException e) {
                 throw new AAIFormatVertexException(
-                    "Failed to format vertex - error while serializing: " + e.getMessage(), e);
+                        "Failed to format vertex - error while serializing: " + e.getMessage(), e);
             }
 
             final String json = obj.marshal(false);
@@ -105,7 +105,8 @@ public class Aggregate extends MultiFormatMapper {
         }
     }
 
-    public Optional<JsonObject> createSelectedPropertiesObject(Vertex v, Map<String, List<String>> selectedProps) throws AAIFormatVertexException {
+    public Optional<JsonObject> createSelectedPropertiesObject(Vertex v, Map<String, List<String>> selectedProps)
+            throws AAIFormatVertexException {
         JsonObject json = new JsonObject();
         Set<String> propList = null;
         String nodeType = v.<String>value(AAIProperties.NODE_TYPE);
@@ -140,10 +141,9 @@ public class Aggregate extends MultiFormatMapper {
         return Optional.of(json);
     }
 
-    private Set<String> removeSingleQuotesForProperties(List<String> props){
+    private Set<String> removeSingleQuotesForProperties(List<String> props) {
         if (props != null && !props.isEmpty()) {
-            return props.stream().map(
-                e -> e.substring(1, e.length()-1)).collect(Collectors.toSet());
+            return props.stream().map(e -> e.substring(1, e.length() - 1)).collect(Collectors.toSet());
         } else {
             return Collections.emptySet();
         }
@@ -169,23 +169,21 @@ public class Aggregate extends MultiFormatMapper {
             }
 
             return Optional.<JsonObject>empty();
-        }).filter(Optional::isPresent)
-            .map(Optional::get)
-            .forEach(json -> {
-                if (isParallel) {
-                    synchronized (body) {
-                        body.add(json);
-                    }
-                } else {
+        }).filter(Optional::isPresent).map(Optional::get).forEach(json -> {
+            if (isParallel) {
+                synchronized (body) {
                     body.add(json);
                 }
-            });
+            } else {
+                body.add(json);
+            }
+        });
         return body;
     }
 
     @Override
     public Optional<JsonObject> formatObject(Object input, Map<String, List<String>> properties)
-        throws AAIFormatVertexException, AAIFormatQueryResultFormatNotSupported {
+            throws AAIFormatVertexException, AAIFormatQueryResultFormatNotSupported {
         JsonObject json = new JsonObject();
         if (input instanceof ArrayList) {
             Optional<JsonArray> ja = processInput(input, properties);
@@ -198,7 +196,7 @@ public class Aggregate extends MultiFormatMapper {
 
     private Optional<JsonArray> processInput(Object input, Map properties) throws AAIFormatVertexException {
         JsonArray json = new JsonArray();
-        for (Object l  : (ArrayList) input) {
+        for (Object l : (ArrayList) input) {
             if (l instanceof ArrayList) {
                 JsonArray inner = new JsonArray();
                 for (Vertex o : (ArrayList<Vertex>) l) {
@@ -213,8 +211,9 @@ public class Aggregate extends MultiFormatMapper {
                 }
                 json.add(inner);
             } else {
-                Optional<JsonObject> obj = this.getJsonFromVertex((Vertex)l, properties);
-                if(obj.isPresent()) json.add(obj.get());
+                Optional<JsonObject> obj = this.getJsonFromVertex((Vertex) l, properties);
+                if (obj.isPresent())
+                    json.add(obj.get());
             }
         }
         return Optional.of(json);
@@ -237,7 +236,9 @@ public class Aggregate extends MultiFormatMapper {
             this.urlBuilder = urlBuilder;
         }
 
-        protected boolean isTree() { return this.tree; }
+        protected boolean isTree() {
+            return this.tree;
+        }
 
         public Builder isTree(Boolean tree) {
             this.tree = tree;
@@ -293,7 +294,7 @@ public class Aggregate extends MultiFormatMapper {
         }
 
         public Aggregate build() {
-                return new Aggregate(this);
+            return new Aggregate(this);
         }
     }
 
index bbaed36..7caa1bd 100644 (file)
@@ -22,15 +22,16 @@ package org.onap.aai.serialization.queryformats;
 
 import com.google.gson.JsonArray;
 import com.google.gson.JsonObject;
+
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.onap.aai.config.SpringContextAware;
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
 
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-
 public class ChangesFormat extends MultiFormatMapper {
 
     private Long startTs = 0L;
@@ -39,9 +40,11 @@ public class ChangesFormat extends MultiFormatMapper {
         /*
          * StartTs = truncate time
          */
-        if (startTime == null || startTime.isEmpty() || "now".equals(startTime) || "0".equals(startTime) || "-1".equals(startTime)){
-           String historyTruncateDays = SpringContextAware.getApplicationContext().getEnvironment().getProperty("history.truncate.window.days", "365");
-           this.startTs = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(Long.parseLong(historyTruncateDays));
+        if (startTime == null || startTime.isEmpty() || "now".equals(startTime) || "0".equals(startTime)
+                || "-1".equals(startTime)) {
+            String historyTruncateDays = SpringContextAware.getApplicationContext().getEnvironment()
+                    .getProperty("history.truncate.window.days", "365");
+            this.startTs = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(Long.parseLong(historyTruncateDays));
         } else {
             this.startTs = Long.parseLong(startTime);
         }
@@ -50,29 +53,28 @@ public class ChangesFormat extends MultiFormatMapper {
     @Override
     protected Optional<JsonObject> getJsonFromVertex(Vertex v) {
         JsonObject json = new JsonObject();
-        if (!v.properties(AAIProperties.RESOURCE_VERSION).hasNext() ||
-            !v.properties(AAIProperties.NODE_TYPE).hasNext() ||
-            !v.properties(AAIProperties.AAI_URI).hasNext()) {
+        if (!v.properties(AAIProperties.RESOURCE_VERSION).hasNext() || !v.properties(AAIProperties.NODE_TYPE).hasNext()
+                || !v.properties(AAIProperties.AAI_URI).hasNext()) {
             return Optional.empty();
         }
         json.addProperty("node-type", v.<String>value(AAIProperties.NODE_TYPE));
         json.addProperty("uri", v.<String>value(AAIProperties.AAI_URI));
 
         final Set<Long> changes = new HashSet<>();
-        v.properties(AAIProperties.RESOURCE_VERSION).forEachRemaining(o->
-            o.properties(AAIProperties.START_TS, AAIProperties.END_TS)
-            .forEachRemaining(p -> {
-                Long val = (Long) p.value();
-                if(val >= startTs) {
-                    changes.add(val);
-                }
-            }
-            ));
+        v.properties(AAIProperties.RESOURCE_VERSION).forEachRemaining(
+                o -> o.properties(AAIProperties.START_TS, AAIProperties.END_TS).forEachRemaining(p -> {
+                    Long val = (Long) p.value();
+                    if (val >= startTs) {
+                        changes.add(val);
+                    }
+                }));
         v.edges(Direction.BOTH).forEachRemaining(e -> {
-            if(e.property(AAIProperties.START_TS).isPresent() && (Long)e.property(AAIProperties.START_TS).value() >= startTs) {
+            if (e.property(AAIProperties.START_TS).isPresent()
+                    && (Long) e.property(AAIProperties.START_TS).value() >= startTs) {
                 changes.add((Long) e.property(AAIProperties.START_TS).value());
             }
-            if(e.property(AAIProperties.END_TS).isPresent() && (Long)e.property(AAIProperties.END_TS).value() >= startTs) {
+            if (e.property(AAIProperties.END_TS).isPresent()
+                    && (Long) e.property(AAIProperties.END_TS).value() >= startTs) {
                 changes.add((Long) e.property(AAIProperties.END_TS).value());
             }
         });
@@ -88,7 +90,8 @@ public class ChangesFormat extends MultiFormatMapper {
     }
 
     @Override
-    protected Optional<JsonObject> getJsonFromVertex(Vertex input, Map<String, List<String>> properties) throws AAIFormatVertexException {
+    protected Optional<JsonObject> getJsonFromVertex(Vertex input, Map<String, List<String>> properties)
+            throws AAIFormatVertexException {
         return Optional.empty();
     }
 
index 7e230c3..0e7642c 100644 (file)
@@ -41,7 +41,8 @@ public class Console implements FormatMapper {
     }
 
     @Override
-    public Optional<JsonObject> formatObject(Object o, Map<String, List<String>> properties) throws AAIFormatVertexException, AAIFormatQueryResultFormatNotSupported {
+    public Optional<JsonObject> formatObject(Object o, Map<String, List<String>> properties)
+            throws AAIFormatVertexException, AAIFormatQueryResultFormatNotSupported {
         JsonObject json = new JsonObject();
         json.addProperty("result", o.toString());
         return Optional.of(json);
index 60a10c5..216d021 100644 (file)
@@ -52,7 +52,8 @@ public class Count implements FormatMapper {
     }
 
     @Override
-    public Optional<JsonObject> formatObject(Object o, Map<String, List<String>> properties) throws AAIFormatVertexException, AAIFormatQueryResultFormatNotSupported {
+    public Optional<JsonObject> formatObject(Object o, Map<String, List<String>> properties)
+            throws AAIFormatVertexException, AAIFormatQueryResultFormatNotSupported {
         return Optional.empty();
     }
 
index 50aa8dd..e102f1f 100644 (file)
@@ -20,6 +20,9 @@
 
 package org.onap.aai.serialization.queryformats;
 
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.Loader;
 import org.onap.aai.serialization.db.DBSerializer;
@@ -28,9 +31,6 @@ import org.onap.aai.serialization.queryformats.utils.QueryParamInjector;
 import org.onap.aai.serialization.queryformats.utils.UrlBuilder;
 import org.onap.aai.setup.SchemaVersions;
 
-import javax.ws.rs.core.MultivaluedHashMap;
-import javax.ws.rs.core.MultivaluedMap;
-
 public class FormatFactory {
 
     private final Loader loader;
@@ -46,8 +46,8 @@ public class FormatFactory {
         this.injector = QueryParamInjector.getInstance();
     }
 
-    public FormatFactory(Loader loader, DBSerializer serializer, SchemaVersions schemaVersions, String basePath, String serverBase)
-        throws AAIException {
+    public FormatFactory(Loader loader, DBSerializer serializer, SchemaVersions schemaVersions, String basePath,
+            String serverBase) throws AAIException {
         this.loader = loader;
         this.serializer = serializer;
         this.urlBuilder = new UrlBuilder(loader.getVersion(), serializer, serverBase, schemaVersions, basePath);
@@ -67,34 +67,43 @@ public class FormatFactory {
                 formatter = new Formatter(inject(new GraphSON(), params));
                 break;
             case pathed:
-                formatter = new Formatter(inject(new PathedURL.Builder(loader, serializer, urlBuilder), params).build(), params);
+                formatter = new Formatter(inject(new PathedURL.Builder(loader, serializer, urlBuilder), params).build(),
+                        params);
                 break;
             case pathed_resourceversion:
-                formatter = new Formatter(inject(new PathedURL.Builder(loader, serializer, urlBuilder).includeUrl(), params).build(), params);
+                formatter = new Formatter(
+                        inject(new PathedURL.Builder(loader, serializer, urlBuilder).includeUrl(), params).build(),
+                        params);
                 break;
             case id:
-                formatter = new Formatter(inject(new IdURL.Builder(loader, serializer, urlBuilder), params).build(), params);
+                formatter = new Formatter(inject(new IdURL.Builder(loader, serializer, urlBuilder), params).build(),
+                        params);
                 break;
             case resource:
-                formatter = new Formatter(inject(new Resource.Builder(loader, serializer, urlBuilder, params), params).build(), params);
+                formatter = new Formatter(
+                        inject(new Resource.Builder(loader, serializer, urlBuilder, params), params).build(), params);
                 break;
             case resource_and_url:
                 formatter = new Formatter(
-                        inject(new Resource.Builder(loader, serializer, urlBuilder, params).includeUrl(), params).build(), params);
+                        inject(new Resource.Builder(loader, serializer, urlBuilder, params).includeUrl(), params)
+                                .build(),
+                        params);
                 break;
             case raw:
-                formatter =
-                        new Formatter(inject(new RawFormat.Builder(loader, serializer, urlBuilder), params).build(), params);
+                formatter = new Formatter(inject(new RawFormat.Builder(loader, serializer, urlBuilder), params).build(),
+                        params);
                 break;
             case simple:
                 formatter = new Formatter(
                         inject(new RawFormat.Builder(loader, serializer, urlBuilder).depth(0).modelDriven(), params)
-                                .build(), params);
+                                .build(),
+                        params);
                 break;
             case aggregate:
                 formatter = new Formatter(
-                    inject(new Aggregate.Builder(loader, serializer, urlBuilder).depth(0).modelDriven(), params)
-                        .build(), params);
+                        inject(new Aggregate.Builder(loader, serializer, urlBuilder).depth(0).modelDriven(), params)
+                                .build(),
+                        params);
                 break;
             case console:
                 formatter = new Formatter(inject(new Console(), params));
@@ -107,20 +116,19 @@ public class FormatFactory {
                         inject(new ResourceWithSoT.Builder(loader, serializer, urlBuilder), params).build(), params);
                 break;
             case changes:
-                formatter =
-                    new Formatter(inject(new ChangesFormat(), params));
+                formatter = new Formatter(inject(new ChangesFormat(), params));
                 break;
             case state:
-                formatter =
-                    new Formatter(inject(new StateFormat.Builder(loader, serializer, urlBuilder), params).build(format));
+                formatter = new Formatter(
+                        inject(new StateFormat.Builder(loader, serializer, urlBuilder), params).build(format));
                 break;
             case lifecycle:
-                formatter =
-                    new Formatter(inject(new LifecycleFormat.Builder(loader, serializer, urlBuilder), params).build(format));
+                formatter = new Formatter(
+                        inject(new LifecycleFormat.Builder(loader, serializer, urlBuilder), params).build(format));
                 break;
             case tree:
-                formatter = new Formatter(
-                    inject(new TreeFormat.Builder(loader, serializer, urlBuilder), params).build());
+                formatter =
+                        new Formatter(inject(new TreeFormat.Builder(loader, serializer, urlBuilder), params).build());
                 break;
             default:
                 break;
index cf967f0..5369c06 100644 (file)
@@ -32,7 +32,9 @@ import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexExcepti
 public interface FormatMapper {
 
     Optional<JsonObject> formatObject(Object o) throws AAIFormatVertexException, AAIFormatQueryResultFormatNotSupported;
-    Optional<JsonObject> formatObject(Object o, Map<String, List<String>> properties) throws AAIFormatVertexException, AAIFormatQueryResultFormatNotSupported;
+
+    Optional<JsonObject> formatObject(Object o, Map<String, List<String>> properties)
+            throws AAIFormatVertexException, AAIFormatQueryResultFormatNotSupported;
 
     int parallelThreshold();
 }
index 0e15173..da5d542 100644 (file)
 
 package org.onap.aai.serialization.queryformats;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import org.json.JSONArray;
-import org.json.simple.JSONObject;
-import org.json.simple.parser.JSONParser;
-import org.onap.aai.logging.LogFormatTools;
-import org.onap.aai.serialization.queryformats.exceptions.AAIFormatQueryResultFormatNotSupported;
-import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
 
-import javax.ws.rs.core.MultivaluedMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.stream.Stream;
 
+import javax.ws.rs.core.MultivaluedMap;
+
+import org.onap.aai.logging.LogFormatTools;
+import org.onap.aai.serialization.queryformats.exceptions.AAIFormatQueryResultFormatNotSupported;
+import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class Formatter {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(Formatter.class);
@@ -94,7 +90,7 @@ public class Formatter {
 
             stream.map(o -> {
                 try {
-                    if (properties!= null && !properties.isEmpty()){
+                    if (properties != null && !properties.isEmpty()) {
                         return format.formatObject(o, properties);
                     } else {
                         return format.formatObject(o);
@@ -106,24 +102,21 @@ public class Formatter {
                 }
 
                 return Optional.<JsonObject>empty();
-            }).filter(Optional::isPresent)
-                .map(Optional::get)
-                .forEach(json -> {
-                    if (isParallel) {
-                        synchronized (body) {
-                            body.add(json);
-                        }
-                    } else {
+            }).filter(Optional::isPresent).map(Optional::get).forEach(json -> {
+                if (isParallel) {
+                    synchronized (body) {
                         body.add(json);
                     }
-                });
+                } else {
+                    body.add(json);
+                }
+            });
 
         }
 
-        if (params !=null && params.containsKey("as-tree")) {
+        if (params != null && params.containsKey("as-tree")) {
             String isAsTree = params.get("as-tree").get(0);
-            if (isAsTree != null && isAsTree.equalsIgnoreCase("true")
-                && body != null && body.size() != 0) {
+            if (isAsTree != null && isAsTree.equalsIgnoreCase("true") && body != null && body.size() != 0) {
                 JsonObject jsonObjectBody = body.get(0).getAsJsonObject();
                 if (jsonObjectBody != null && jsonObjectBody.size() > 0) {
                     return body.get(0).getAsJsonObject();
index e3c2989..fc3316d 100644 (file)
@@ -24,6 +24,7 @@ import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
+
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -31,6 +32,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
+
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
@@ -84,7 +86,7 @@ public class GraphSON implements FormatMapper {
 
     @Override
     public Optional<JsonObject> formatObject(Object obj, Map<String, List<String>> properties)
-        throws AAIFormatVertexException, AAIFormatQueryResultFormatNotSupported {
+            throws AAIFormatVertexException, AAIFormatQueryResultFormatNotSupported {
         return Optional.empty();
     }
 
index b11f14a..fccc17c 100644 (file)
 
 package org.onap.aai.serialization.queryformats;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.google.gson.Gson;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
 import org.apache.tinkerpop.gremlin.structure.*;
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.introspection.Loader;
@@ -36,12 +41,8 @@ import org.onap.aai.serialization.queryformats.params.EndTs;
 import org.onap.aai.serialization.queryformats.params.NodesOnly;
 import org.onap.aai.serialization.queryformats.params.StartTs;
 import org.onap.aai.serialization.queryformats.utils.UrlBuilder;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public abstract class HistoryFormat extends MultiFormatMapper {
 
@@ -69,8 +70,8 @@ public abstract class HistoryFormat extends MultiFormatMapper {
     protected long startTs;
     protected long endTs;
     protected static final Set<String> ignoredKeys =
-        Stream.of(AAIProperties.LAST_MOD_TS, AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, AAIProperties.CREATED_TS)
-        .collect(Collectors.toSet());
+            Stream.of(AAIProperties.LAST_MOD_TS, AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, AAIProperties.CREATED_TS)
+                    .collect(Collectors.toSet());
 
     protected HistoryFormat(Builder builder) {
         this.urlBuilder = builder.getUrlBuilder();
@@ -145,8 +146,6 @@ public abstract class HistoryFormat extends MultiFormatMapper {
 
     protected abstract JsonObject getRelatedObject(Edge e, Vertex related) throws AAIFormatVertexException;
 
-
-
     public static class Builder implements NodesOnly<Builder>, Depth<Builder>, StartTs<Builder>, EndTs<Builder> {
 
         protected final Loader loader;
@@ -197,7 +196,6 @@ public abstract class HistoryFormat extends MultiFormatMapper {
             return this;
         }
 
-
         public boolean isNodesOnly() {
             return this.nodesOnly;
         }
@@ -234,7 +232,7 @@ public abstract class HistoryFormat extends MultiFormatMapper {
 
         public HistoryFormat build(Format format) {
 
-            if(Format.state.equals(format)) {
+            if (Format.state.equals(format)) {
                 return new StateFormat(this);
             } else {
                 return new LifecycleFormat(this);
index c2c252a..10bba7f 100644 (file)
@@ -27,6 +27,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 
+import javax.ws.rs.core.MultivaluedMap;
+
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.exceptions.AAIException;
@@ -40,8 +42,6 @@ import org.onap.aai.serialization.queryformats.params.Depth;
 import org.onap.aai.serialization.queryformats.params.NodesOnly;
 import org.onap.aai.serialization.queryformats.utils.UrlBuilder;
 
-import javax.ws.rs.core.MultivaluedMap;
-
 public class IdURL extends MultiFormatMapper {
 
     private final UrlBuilder urlBuilder;
@@ -86,7 +86,8 @@ public class IdURL extends MultiFormatMapper {
     }
 
     @Override
-    protected Optional<JsonObject> getJsonFromVertex(Vertex input, Map<String, List<String>> properties) throws AAIFormatVertexException {
+    protected Optional<JsonObject> getJsonFromVertex(Vertex input, Map<String, List<String>> properties)
+            throws AAIFormatVertexException {
         return Optional.empty();
     }
 
@@ -107,7 +108,8 @@ public class IdURL extends MultiFormatMapper {
             this.urlBuilder = urlBuilder;
         }
 
-        public Builder(Loader loader, DBSerializer serializer, UrlBuilder urlBuilder, MultivaluedMap<String, String> params) {
+        public Builder(Loader loader, DBSerializer serializer, UrlBuilder urlBuilder,
+                MultivaluedMap<String, String> params) {
             this.loader = loader;
             this.serializer = serializer;
             this.urlBuilder = urlBuilder;
@@ -126,7 +128,9 @@ public class IdURL extends MultiFormatMapper {
             return this.urlBuilder;
         }
 
-        protected MultivaluedMap<String, String> getParams() { return this.params; }
+        protected MultivaluedMap<String, String> getParams() {
+            return this.params;
+        }
 
         public boolean isSkipRelatedTo() {
             if (params != null) {
@@ -143,7 +147,9 @@ public class IdURL extends MultiFormatMapper {
             return true;
         }
 
-        protected boolean isTree() { return this.tree; }
+        protected boolean isTree() {
+            return this.tree;
+        }
 
         public Builder isTree(Boolean tree) {
             this.tree = tree;
index 57bb17c..74742c9 100644 (file)
 
 package org.onap.aai.serialization.queryformats;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonObject;
+
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
@@ -31,14 +34,11 @@ import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.logging.LogFormatTools;
 import org.onap.aai.serialization.queryformats.exceptions.AAIFormatQueryResultFormatNotSupported;
 import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
 
-import java.util.*;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-
 public class LifecycleFormat extends HistoryFormat {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(LifecycleFormat.class);
@@ -52,11 +52,11 @@ public class LifecycleFormat extends HistoryFormat {
         Iterator<VertexProperty<Object>> iter = v.properties();
         List<JsonObject> jsonList = new ArrayList<>();
 
-        Map<String, Set<Long>> propStartTimes = new HashMap<>(); //vertex end
+        Map<String, Set<Long>> propStartTimes = new HashMap<>(); // vertex end
         while (iter.hasNext()) {
             JsonObject json = new JsonObject();
             VertexProperty<Object> prop = iter.next();
-            if(prop.key() != null && ignoredKeys.contains(prop.key())){
+            if (prop.key() != null && ignoredKeys.contains(prop.key())) {
                 continue;
             }
             if (!propStartTimes.containsKey(prop.key())) {
@@ -79,10 +79,9 @@ public class LifecycleFormat extends HistoryFormat {
                 jsonList.add(jo);
                 propStartTimes.get(prop.key()).add(metaProperties.get(AAIProperties.START_TS).getAsLong());
             }
-            if (!AAIProperties.RESOURCE_VERSION.equals(prop.key())
-                && metaProperties.has(AAIProperties.END_TS)
-                && isTsInRange(metaProperties.get(AAIProperties.END_TS).getAsLong())
-                && !propStartTimes.get(prop.key()).contains(metaProperties.get(AAIProperties.END_TS).getAsLong())) {
+            if (!AAIProperties.RESOURCE_VERSION.equals(prop.key()) && metaProperties.has(AAIProperties.END_TS)
+                    && isTsInRange(metaProperties.get(AAIProperties.END_TS).getAsLong())
+                    && !propStartTimes.get(prop.key()).contains(metaProperties.get(AAIProperties.END_TS).getAsLong())) {
                 JsonObject jo = new JsonObject();
                 jo.add(KEY, json.get(KEY));
                 jo.add(VALUE, null);
@@ -94,16 +93,17 @@ public class LifecycleFormat extends HistoryFormat {
 
         }
         jsonList.stream()
-            // remove all the null values that is the start time for another value
-            .filter(jo -> !jo.get(VALUE).isJsonNull() || !propStartTimes.get(jo.get(KEY).getAsString()).contains(jo.get(TIMESTAMP).getAsLong()))
-            // sort by ts in decreasing order
-            .sorted((o1, o2) -> {
-                if (o1.get(TIMESTAMP).getAsLong() == o2.get(TIMESTAMP).getAsLong()) {
-                    return o1.get(KEY).getAsString().compareTo(o2.get(KEY).getAsString());
-                } else {
-                    return Long.compare(o2.get(TIMESTAMP).getAsLong(), o1.get(TIMESTAMP).getAsLong());
-                }
-            }).forEach(jsonArray::add);
+                // remove all the null values that is the start time for another value
+                .filter(jo -> !jo.get(VALUE).isJsonNull()
+                        || !propStartTimes.get(jo.get(KEY).getAsString()).contains(jo.get(TIMESTAMP).getAsLong()))
+                // sort by ts in decreasing order
+                .sorted((o1, o2) -> {
+                    if (o1.get(TIMESTAMP).getAsLong() == o2.get(TIMESTAMP).getAsLong()) {
+                        return o1.get(KEY).getAsString().compareTo(o2.get(KEY).getAsString());
+                    } else {
+                        return Long.compare(o2.get(TIMESTAMP).getAsLong(), o1.get(TIMESTAMP).getAsLong());
+                    }
+                }).forEach(jsonArray::add);
 
         return jsonArray;
     }
@@ -112,7 +112,6 @@ public class LifecycleFormat extends HistoryFormat {
         return ts >= startTs && ts <= endTs;
     }
 
-
     @Override
     protected boolean isValidEdge(Edge e) {
         if (e.property(AAIProperties.END_TS).isPresent()) {
@@ -139,21 +138,27 @@ public class LifecycleFormat extends HistoryFormat {
             json.addProperty("uri", "NA");
         }
 
-        if(e.property(AAIProperties.START_TS).isPresent()) {
+        if (e.property(AAIProperties.START_TS).isPresent()) {
             long edgeStartTimestamp = e.<Long>value(AAIProperties.START_TS);
             if (isTsInRange(edgeStartTimestamp)) {
-                json.addProperty(TIMESTAMP,  e.property(AAIProperties.START_TS).isPresent()? e.<Long>value(AAIProperties.START_TS) : 0);
-                json.addProperty(SOT, e.property(AAIProperties.SOURCE_OF_TRUTH).isPresent()? e.value(AAIProperties.SOURCE_OF_TRUTH) : "");
-                json.addProperty(TX_ID, e.property(AAIProperties.START_TX_ID).isPresent()? e.value(AAIProperties.START_TX_ID) : "N/A");
+                json.addProperty(TIMESTAMP,
+                        e.property(AAIProperties.START_TS).isPresent() ? e.<Long>value(AAIProperties.START_TS) : 0);
+                json.addProperty(SOT,
+                        e.property(AAIProperties.SOURCE_OF_TRUTH).isPresent() ? e.value(AAIProperties.SOURCE_OF_TRUTH)
+                                : "");
+                json.addProperty(TX_ID,
+                        e.property(AAIProperties.START_TX_ID).isPresent() ? e.value(AAIProperties.START_TX_ID) : "N/A");
             }
         }
 
-        if(e.property(AAIProperties.END_TS).isPresent()) {
+        if (e.property(AAIProperties.END_TS).isPresent()) {
             long edgeEndTimestamp = e.<Long>value(AAIProperties.END_TS);
             if (isTsInRange(edgeEndTimestamp)) {
                 json.addProperty(END_TIMESTAMP, edgeEndTimestamp);
-                json.addProperty(END_SOT, e.property(AAIProperties.END_SOT).isPresent() ? e.value(AAIProperties.END_SOT) : "");
-                json.addProperty(END_TX_ID, e.property(AAIProperties.END_TX_ID).isPresent() ? e.value(AAIProperties.END_TX_ID) : "N/A");
+                json.addProperty(END_SOT,
+                        e.property(AAIProperties.END_SOT).isPresent() ? e.value(AAIProperties.END_SOT) : "");
+                json.addProperty(END_TX_ID,
+                        e.property(AAIProperties.END_TX_ID).isPresent() ? e.value(AAIProperties.END_TX_ID) : "N/A");
             }
         }
 
@@ -182,14 +187,14 @@ public class LifecycleFormat extends HistoryFormat {
         json.add(NODE_ACTIONS, getNodeActions(v, json));
 
         if (json.getAsJsonObject().get(PROPERTIES).getAsJsonArray().size() == 0
-            && json.getAsJsonObject().get(RELATED_TO).getAsJsonArray().size() == 0
-            && json.getAsJsonObject().get(NODE_ACTIONS).getAsJsonArray().size() == 0) {
+                && json.getAsJsonObject().get(RELATED_TO).getAsJsonArray().size() == 0
+                && json.getAsJsonObject().get(NODE_ACTIONS).getAsJsonArray().size() == 0) {
             return Optional.empty();
         } else if (json.getAsJsonObject().get(PROPERTIES).getAsJsonArray().size() == 1
-            && (json.getAsJsonObject().get(RELATED_TO).getAsJsonArray().size() > 0
-            || json.getAsJsonObject().get(NODE_ACTIONS).getAsJsonArray().size() > 0)) {
-            if (json.getAsJsonObject().get(PROPERTIES).getAsJsonArray()
-                .get(0).getAsJsonObject().get("key").getAsString().equals(AAIProperties.END_TS)) {
+                && (json.getAsJsonObject().get(RELATED_TO).getAsJsonArray().size() > 0
+                        || json.getAsJsonObject().get(NODE_ACTIONS).getAsJsonArray().size() > 0)) {
+            if (json.getAsJsonObject().get(PROPERTIES).getAsJsonArray().get(0).getAsJsonObject().get("key")
+                    .getAsString().equals(AAIProperties.END_TS)) {
                 json.getAsJsonObject().add(PROPERTIES, new JsonArray());
             }
         }
@@ -198,7 +203,8 @@ public class LifecycleFormat extends HistoryFormat {
     }
 
     @Override
-    protected Optional<JsonObject> getJsonFromVertex(Vertex input, Map<String, List<String>> properties) throws AAIFormatVertexException {
+    protected Optional<JsonObject> getJsonFromVertex(Vertex input, Map<String, List<String>> properties)
+            throws AAIFormatVertexException {
         return Optional.empty();
     }
 
@@ -212,7 +218,8 @@ public class LifecycleFormat extends HistoryFormat {
                 action.addProperty("action", "DELETED");
                 action.addProperty(TIMESTAMP, deletedTs);
                 if (v.property(AAIProperties.END_TS).property(AAIProperties.SOURCE_OF_TRUTH).isPresent()) {
-                    action.addProperty(SOT, v.property(AAIProperties.END_TS).<String>value(AAIProperties.SOURCE_OF_TRUTH));
+                    action.addProperty(SOT,
+                            v.property(AAIProperties.END_TS).<String>value(AAIProperties.SOURCE_OF_TRUTH));
                 }
                 if (v.property(AAIProperties.END_TS).property(AAIProperties.END_TX_ID).isPresent()) {
                     action.addProperty(TX_ID, v.property(AAIProperties.END_TS).<String>value(AAIProperties.END_TX_ID));
@@ -229,7 +236,8 @@ public class LifecycleFormat extends HistoryFormat {
             action.addProperty(TIMESTAMP, createdTs);
             action.addProperty(SOT, v.<String>value(AAIProperties.SOURCE_OF_TRUTH));
             if (v.property(AAIProperties.SOURCE_OF_TRUTH).property(AAIProperties.START_TX_ID).isPresent()) {
-                action.addProperty(TX_ID, v.property(AAIProperties.SOURCE_OF_TRUTH).<String>value(AAIProperties.START_TX_ID));
+                action.addProperty(TX_ID,
+                        v.property(AAIProperties.SOURCE_OF_TRUTH).<String>value(AAIProperties.START_TX_ID));
             } else {
                 action.addProperty(TX_ID, "N/A");
             }
@@ -259,17 +267,15 @@ public class LifecycleFormat extends HistoryFormat {
             }
 
             return Optional.<JsonObject>empty();
-        }).filter(Optional::isPresent)
-            .map(Optional::get)
-            .forEach(json -> {
-                if (isParallel) {
-                    synchronized (body) {
-                        body.add(json);
-                    }
-                } else {
+        }).filter(Optional::isPresent).map(Optional::get).forEach(json -> {
+            if (isParallel) {
+                synchronized (body) {
                     body.add(json);
                 }
-            });
+            } else {
+                body.add(json);
+            }
+        });
         JsonArray result = organizeBody(body);
         result.forEach(jsonElement -> jsonElement.getAsJsonObject().remove(TIMESTAMP));
         return result;
@@ -282,21 +288,23 @@ public class LifecycleFormat extends HistoryFormat {
             toBeMerged.add(body.get(i).getAsJsonObject().get("uri").getAsString(), i);
         }
 
-        final List<List<Integer>> dupes = toBeMerged.values().stream().filter(l -> l.size() > 1).collect(Collectors.toList());
+        final List<List<Integer>> dupes =
+                toBeMerged.values().stream().filter(l -> l.size() > 1).collect(Collectors.toList());
         if (dupes.isEmpty()) {
             return body;
         } else {
             Set<Integer> remove = new HashSet<>();
             for (List<Integer> dupe : dupes) {
-                dupe.sort((a,b) -> Long.compare(body.get(b).getAsJsonObject().get(TIMESTAMP).getAsLong(), body.get(a).getAsJsonObject().get(TIMESTAMP).getAsLong()));
+                dupe.sort((a, b) -> Long.compare(body.get(b).getAsJsonObject().get(TIMESTAMP).getAsLong(),
+                        body.get(a).getAsJsonObject().get(TIMESTAMP).getAsLong()));
                 int keep = dupe.remove(0);
                 for (Integer idx : dupe) {
                     body.get(keep).getAsJsonObject().getAsJsonArray(NODE_ACTIONS)
-                        .addAll(body.get(idx).getAsJsonObject().getAsJsonArray(NODE_ACTIONS));
+                            .addAll(body.get(idx).getAsJsonObject().getAsJsonArray(NODE_ACTIONS));
                     body.get(keep).getAsJsonObject().getAsJsonArray(PROPERTIES)
-                        .addAll(body.get(idx).getAsJsonObject().getAsJsonArray(PROPERTIES));
+                            .addAll(body.get(idx).getAsJsonObject().getAsJsonArray(PROPERTIES));
                     body.get(keep).getAsJsonObject().getAsJsonArray(RELATED_TO)
-                        .addAll(body.get(idx).getAsJsonObject().getAsJsonArray(RELATED_TO));
+                            .addAll(body.get(idx).getAsJsonObject().getAsJsonArray(RELATED_TO));
                     remove.add(idx);
                 }
             }
index 12e046b..186816e 100644 (file)
 
 package org.onap.aai.serialization.queryformats;
 
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -37,10 +41,6 @@ import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexExcepti
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-
 public abstract class MultiFormatMapper implements FormatMapper {
 
     private static final Logger logger = LoggerFactory.getLogger(MultiFormatMapper.class);
@@ -50,11 +50,11 @@ public abstract class MultiFormatMapper implements FormatMapper {
     protected static final String NODE_TYPE_KEY = "node-type";
 
     protected static final String RETURNED_EMPTY_JSONARRAY_MSG =
-        "Returned empty JsonArray - Could not populate nested json objects for wrapper: {}";
+            "Returned empty JsonArray - Could not populate nested json objects for wrapper: {}";
 
     @Override
     public Optional<JsonObject> formatObject(Object input)
-        throws AAIFormatVertexException, AAIFormatQueryResultFormatNotSupported {
+            throws AAIFormatVertexException, AAIFormatQueryResultFormatNotSupported {
         if (input instanceof Vertex) {
             logger.debug("Formatting vertex object");
             return this.getJsonFromVertex((Vertex) input);
@@ -75,7 +75,7 @@ public abstract class MultiFormatMapper implements FormatMapper {
 
     @Override
     public Optional<JsonObject> formatObject(Object input, Map<String, List<String>> properties)
-        throws AAIFormatVertexException, AAIFormatQueryResultFormatNotSupported {
+            throws AAIFormatVertexException, AAIFormatQueryResultFormatNotSupported {
         if (input instanceof Vertex) {
             logger.debug("Formatting vertex object with properties map filter");
             return this.getJsonFromVertex((Vertex) input, properties);
@@ -95,7 +95,9 @@ public abstract class MultiFormatMapper implements FormatMapper {
     }
 
     protected abstract Optional<JsonObject> getJsonFromVertex(Vertex input) throws AAIFormatVertexException;
-    protected abstract Optional<JsonObject> getJsonFromVertex(Vertex input, Map<String, List<String>> properties) throws AAIFormatVertexException;
+
+    protected abstract Optional<JsonObject> getJsonFromVertex(Vertex input, Map<String, List<String>> properties)
+            throws AAIFormatVertexException;
 
     protected Optional<JsonObject> getJsonFromPath(Path input) throws AAIFormatVertexException {
         List<Object> path = input.objects();
@@ -116,6 +118,7 @@ public abstract class MultiFormatMapper implements FormatMapper {
 
     /**
      * Returns an Optional<JsonObject> object using "nodes" as a wrapper to encapsulate json objects
+     * 
      * @param tree
      * @return
      * @throws AAIFormatVertexException
@@ -140,12 +143,14 @@ public abstract class MultiFormatMapper implements FormatMapper {
     /**
      * Returns an Optional<JsonObject> object using "related-nodes" to encapsulate nested json objects.
      * Primarily intended to be utilized by the "as-tree" query parameter feature
+     * 
      * @param tree
      * @param properties
      * @return
      * @throws AAIFormatVertexException
      */
-    protected Optional<JsonObject> getRelatedNodesFromTree(Tree<?> tree, Map<String, List<String>> properties) throws AAIFormatVertexException {
+    protected Optional<JsonObject> getRelatedNodesFromTree(Tree<?> tree, Map<String, List<String>> properties)
+            throws AAIFormatVertexException {
         if (tree.isEmpty()) {
             return Optional.of(new JsonObject());
         }
@@ -168,13 +173,15 @@ public abstract class MultiFormatMapper implements FormatMapper {
 
     /**
      * Returns JsonArray Object populated with nested json wrapped by the nodeIdentifier parameter
+     * 
      * @param tree
      * @param filterPropertiesMap
      * @param nodeIdentifier
      * @return
      * @throws AAIFormatVertexException
      */
-    protected JsonArray getNodesArray(Tree<?> tree, Map<String, Set<String>> filterPropertiesMap, String nodeIdentifier) throws AAIFormatVertexException {
+    protected JsonArray getNodesArray(Tree<?> tree, Map<String, Set<String>> filterPropertiesMap, String nodeIdentifier)
+            throws AAIFormatVertexException {
         JsonArray nodes = new JsonArray();
         for (Map.Entry<?, ? extends Tree<?>> entry : tree.entrySet()) {
             JsonObject me = new JsonObject();
@@ -199,6 +206,7 @@ public abstract class MultiFormatMapper implements FormatMapper {
 
     /**
      * Returns a Map<String, Set<String>> object through converting given map parameter
+     * 
      * @param properties
      * @return
      */
@@ -206,19 +214,16 @@ public abstract class MultiFormatMapper implements FormatMapper {
         if (properties == null)
             return new HashMap<>();
 
-        return properties.entrySet().stream()
-            .map(entry -> {
-                    Set<String> newSet = entry.getValue().stream()
-                        .map(this::truncateApostrophes)
-                        .collect(Collectors.toSet());
+        return properties.entrySet().stream().map(entry -> {
+            Set<String> newSet = entry.getValue().stream().map(this::truncateApostrophes).collect(Collectors.toSet());
 
-                    return Pair.of(entry.getKey(), newSet);
-                }
-            ).collect(Collectors.toMap(Pair::getKey, Pair::getValue));
+            return Pair.of(entry.getKey(), newSet);
+        }).collect(Collectors.toMap(Pair::getKey, Pair::getValue));
     }
 
     /**
      * Returns a string with it's apostrophes truncated at the start and end.
+     * 
      * @param s
      * @return
      */
@@ -235,40 +240,39 @@ public abstract class MultiFormatMapper implements FormatMapper {
     /**
      * Filters the given Optional<JsonObject> with the properties under a properties field
      * or the properties under its respective node type.
+     * 
      * @param obj
      * @param filterPropertiesMap
      * @return
      */
     protected JsonObject getPropertyFilteredObject(Optional<JsonObject> obj,
-        Map<String, Set<String>> filterPropertiesMap) {
-        return obj.map(
-            jsonObj -> {
-                if (filterPropertiesMap == null || filterPropertiesMap.isEmpty()) {
-                    return jsonObj;
-                } else {
-                    ImmutableTriple<JsonObject, Optional<String>, Optional<JsonObject>> triple =
+            Map<String, Set<String>> filterPropertiesMap) {
+        return obj.map(jsonObj -> {
+            if (filterPropertiesMap == null || filterPropertiesMap.isEmpty()) {
+                return jsonObj;
+            } else {
+                ImmutableTriple<JsonObject, Optional<String>, Optional<JsonObject>> triple =
                         cloneObjectAndExtractNodeTypeAndProperties(jsonObj);
 
-                    JsonObject result = triple.left;
-                    Optional<String> nodeType = triple.middle;
-                    Optional<JsonObject> properties = triple.right;
+                JsonObject result = triple.left;
+                Optional<String> nodeType = triple.middle;
+                Optional<JsonObject> properties = triple.right;
 
-                    // Filter current object based on it containing fields: "node-type" and "properties"
-                    if (nodeType.isPresent() && properties.isPresent()) {
-                        filterByNodeTypeAndProperties(result, nodeType.get(), properties.get(), filterPropertiesMap);
-                    } else {
-                        // filter current object based on the: key - nodeType & value - JsonObject of nodes properties
-                        filterByJsonObj(result, jsonObj, filterPropertiesMap);
-                    }
-
-                    return result;
+                // Filter current object based on it containing fields: "node-type" and "properties"
+                if (nodeType.isPresent() && properties.isPresent()) {
+                    filterByNodeTypeAndProperties(result, nodeType.get(), properties.get(), filterPropertiesMap);
+                } else {
+                    // filter current object based on the: key - nodeType & value - JsonObject of nodes properties
+                    filterByJsonObj(result, jsonObj, filterPropertiesMap);
                 }
+
+                return result;
             }
-        ).orElseGet(JsonObject::new);
+        }).orElseGet(JsonObject::new);
     }
 
     private ImmutableTriple<JsonObject, Optional<String>, Optional<JsonObject>> cloneObjectAndExtractNodeTypeAndProperties(
-        JsonObject jsonObj) {
+            JsonObject jsonObj) {
         JsonObject result = new JsonObject();
         Optional<String> nodeType = Optional.empty();
         Optional<JsonObject> properties = Optional.empty();
@@ -293,20 +297,25 @@ public abstract class MultiFormatMapper implements FormatMapper {
     /**
      * Returns a JsonObject with filtered properties using "node-type" and "properties"
      * Used for formats with payloads similar to simple and raw
+     * 
      * @param result
      * @param nodeType
      * @param properties
      * @param filterPropertiesMap
      * @return
      */
-    private JsonObject filterByNodeTypeAndProperties(JsonObject result, String nodeType, JsonObject properties, Map<String, Set<String>> filterPropertiesMap) {
-        if (result == null || nodeType == null || nodeType.isEmpty() || properties == null || filterPropertiesMap == null) {
+    private JsonObject filterByNodeTypeAndProperties(JsonObject result, String nodeType, JsonObject properties,
+            Map<String, Set<String>> filterPropertiesMap) {
+        if (result == null || nodeType == null || nodeType.isEmpty() || properties == null
+                || filterPropertiesMap == null) {
             return result;
         }
-        if (filterPropertiesMap.containsKey(nodeType)) {    // filterPropertiesMap keys are nodeTypes - keys are obtained from the incoming query request
+        if (filterPropertiesMap.containsKey(nodeType)) { // filterPropertiesMap keys are nodeTypes - keys are obtained
+                                                         // from the incoming query request
             Set<String> filterSet = filterPropertiesMap.get(nodeType);
             JsonObject filteredProperties = new JsonObject();
-            for (String property : filterSet) {             // Each nodeType should have a set of properties to be retained in the response
+            for (String property : filterSet) { // Each nodeType should have a set of properties to be retained in the
+                                                // response
                 if (properties.get(property) != null) {
                     filteredProperties.add(property, properties.get(property));
                 }
@@ -319,12 +328,14 @@ public abstract class MultiFormatMapper implements FormatMapper {
 
     /**
      * Returns a JsonObject with its properties filtered
+     * 
      * @param result
      * @param jsonObj
      * @param filterPropertiesMap
      * @return
      */
-    private JsonObject filterByJsonObj(JsonObject result, JsonObject jsonObj, Map<String, Set<String>> filterPropertiesMap) {
+    private JsonObject filterByJsonObj(JsonObject result, JsonObject jsonObj,
+            Map<String, Set<String>> filterPropertiesMap) {
         if (result == null || jsonObj == null || filterPropertiesMap == null) {
             return result;
         }
@@ -350,12 +361,13 @@ public abstract class MultiFormatMapper implements FormatMapper {
 
     /**
      * Returns a filtered JsonObject with properties contained in the parameter filterPropertiesMap
+     * 
      * @param properties
      * @param filterPropertiesMap
      * @return
      */
     protected JsonObject filterProperties(Optional<JsonObject> properties, String nodeType,
-        Map<String, Set<String>> filterPropertiesMap) {
+            Map<String, Set<String>> filterPropertiesMap) {
         return properties.map(jo -> {
             if (filterPropertiesMap == null || filterPropertiesMap.isEmpty()) {
                 return properties.get();
index e21be99..f052f77 100644 (file)
@@ -27,6 +27,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 
+import javax.ws.rs.core.MultivaluedMap;
+
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.exceptions.AAIException;
@@ -40,8 +42,6 @@ import org.onap.aai.serialization.queryformats.params.Depth;
 import org.onap.aai.serialization.queryformats.params.NodesOnly;
 import org.onap.aai.serialization.queryformats.utils.UrlBuilder;
 
-import javax.ws.rs.core.MultivaluedMap;
-
 public final class PathedURL extends MultiFormatMapper {
 
     private final UrlBuilder urlBuilder;
@@ -91,7 +91,8 @@ public final class PathedURL extends MultiFormatMapper {
     }
 
     @Override
-    protected Optional<JsonObject> getJsonFromVertex(Vertex input, Map<String, List<String>> properties) throws AAIFormatVertexException {
+    protected Optional<JsonObject> getJsonFromVertex(Vertex input, Map<String, List<String>> properties)
+            throws AAIFormatVertexException {
         return Optional.empty();
     }
 
@@ -112,7 +113,8 @@ public final class PathedURL extends MultiFormatMapper {
             this.urlBuilder = urlBuilder;
         }
 
-        public Builder(Loader loader, DBSerializer serializer, UrlBuilder urlBuilder, MultivaluedMap<String, String> params) {
+        public Builder(Loader loader, DBSerializer serializer, UrlBuilder urlBuilder,
+                MultivaluedMap<String, String> params) {
             this.loader = loader;
             this.serializer = serializer;
             this.urlBuilder = urlBuilder;
@@ -131,7 +133,9 @@ public final class PathedURL extends MultiFormatMapper {
             return this.urlBuilder;
         }
 
-        protected MultivaluedMap<String, String> getParams() { return this.params; }
+        protected MultivaluedMap<String, String> getParams() {
+            return this.params;
+        }
 
         public boolean isSkipRelatedTo() {
             if (params != null) {
@@ -148,7 +152,9 @@ public final class PathedURL extends MultiFormatMapper {
             return true;
         }
 
-        protected boolean isTree() { return this.tree; }
+        protected boolean isTree() {
+            return this.tree;
+        }
 
         public Builder isTree(Boolean tree) {
             this.tree = tree;
index a41ed2b..bd858f4 100644 (file)
@@ -24,6 +24,7 @@ import com.google.gson.Gson;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
+
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
@@ -31,6 +32,7 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
+
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -62,7 +64,8 @@ public class RawFormat extends MultiFormatMapper {
     }
 
     @Override
-    public Optional<JsonObject> getJsonFromVertex(Vertex v, Map<String, List<String>> selectedProps) throws AAIFormatVertexException {
+    public Optional<JsonObject> getJsonFromVertex(Vertex v, Map<String, List<String>> selectedProps)
+            throws AAIFormatVertexException {
         JsonObject json = new JsonObject();
         json.addProperty("id", v.id().toString());
         json.addProperty("node-type", v.<String>value(AAIProperties.NODE_TYPE));
@@ -110,7 +113,8 @@ public class RawFormat extends MultiFormatMapper {
         return Optional.of(json);
     }
 
-    public Optional<JsonObject> createSelectedPropertiesObject(Vertex v, Map<String, List<String>> selectedProps) throws AAIFormatVertexException {
+    public Optional<JsonObject> createSelectedPropertiesObject(Vertex v, Map<String, List<String>> selectedProps)
+            throws AAIFormatVertexException {
         JsonObject json = new JsonObject();
         String nodeType = v.<String>value(AAIProperties.NODE_TYPE);
         Set<String> propList = removeSingleQuotesForProperties(selectedProps.get(nodeType));
@@ -142,10 +146,9 @@ public class RawFormat extends MultiFormatMapper {
         return Optional.of(json);
     }
 
-    private Set<String> removeSingleQuotesForProperties(List<String> props){
+    private Set<String> removeSingleQuotesForProperties(List<String> props) {
         if (props != null && !props.isEmpty()) {
-            return props.stream().map(
-                e -> e.substring(1, e.length()-1)).collect(Collectors.toSet());
+            return props.stream().map(e -> e.substring(1, e.length() - 1)).collect(Collectors.toSet());
         } else {
             return Collections.emptySet();
         }
@@ -215,7 +218,9 @@ public class RawFormat extends MultiFormatMapper {
             return this.urlBuilder;
         }
 
-        protected boolean isTree() { return this.tree; }
+        protected boolean isTree() {
+            return this.tree;
+        }
 
         public Builder isTree(Boolean tree) {
             this.tree = tree;
index c4b7f57..f4fd921 100644 (file)
@@ -24,13 +24,16 @@ import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
+
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
+
 import javax.ws.rs.core.MultivaluedMap;
+
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.onap.aai.db.props.AAIProperties;
@@ -73,7 +76,8 @@ public class Resource extends MultiFormatMapper {
     }
 
     @Override
-    protected Optional<JsonObject> getRelatedNodesFromTree(Tree<?> tree, Map<String, List<String>> properties) throws AAIFormatVertexException {
+    protected Optional<JsonObject> getRelatedNodesFromTree(Tree<?> tree, Map<String, List<String>> properties)
+            throws AAIFormatVertexException {
         if (tree.isEmpty()) {
             return Optional.of(new JsonObject());
         }
@@ -81,7 +85,7 @@ public class Resource extends MultiFormatMapper {
         Map<String, Set<String>> filterPropertiesMap = createFilteredPropertyMap(properties);
 
         JsonObject t = new JsonObject();
-        JsonArray ja = this.getRelatedNodesArray(tree, filterPropertiesMap,"related-nodes");
+        JsonArray ja = this.getRelatedNodesArray(tree, filterPropertiesMap, "related-nodes");
         if (ja.size() > 0) {
             t.add("results", ja);
             return Optional.of(t);
@@ -90,7 +94,8 @@ public class Resource extends MultiFormatMapper {
         return Optional.empty();
     }
 
-    protected JsonArray getRelatedNodesArray(Tree<?> tree, Map<String, Set<String>> filterPropertiesMap, String nodeIdentifier) throws AAIFormatVertexException {
+    protected JsonArray getRelatedNodesArray(Tree<?> tree, Map<String, Set<String>> filterPropertiesMap,
+            String nodeIdentifier) throws AAIFormatVertexException {
         JsonArray nodes = new JsonArray();
         if (tree.isEmpty()) {
             return nodes;
@@ -114,7 +119,7 @@ public class Resource extends MultiFormatMapper {
                             value.getAsJsonObject().add(nodeIdentifier, ja);
                         }
                     }
-                } catch(Exception e) {
+                } catch (Exception e) {
                     logger.debug("Failed to add related-nodes array: {}", e.getMessage());
                     throw new AAIFormatVertexException("Failed to add related-nodes array: " + e.getMessage(), e);
                 }
@@ -142,7 +147,8 @@ public class Resource extends MultiFormatMapper {
     }
 
     @Override
-    protected Optional<JsonObject> getJsonFromVertex(Vertex v, Map<String, List<String>> properties) throws AAIFormatVertexException {
+    protected Optional<JsonObject> getJsonFromVertex(Vertex v, Map<String, List<String>> properties)
+            throws AAIFormatVertexException {
         JsonObject json = new JsonObject();
 
         if (this.includeUrl) {
@@ -151,7 +157,10 @@ public class Resource extends MultiFormatMapper {
         Optional<JsonObject> jsonObject = this.vertexToJsonObject(v);
         if (jsonObject.isPresent()) {
             String nodeType = v.<String>value(AAIProperties.NODE_TYPE);
-            Map<String, Set<String>> filterPropertiesMap = createFilteredPropertyMap(properties);       // this change is for resource_and_url with/out as-tree. and no as-tree req
+            Map<String, Set<String>> filterPropertiesMap = createFilteredPropertyMap(properties); // this change is for
+                                                                                                  // resource_and_url
+                                                                                                  // with/out as-tree.
+                                                                                                  // and no as-tree req
             JsonObject jo = filterProperties(jsonObject, nodeType, filterPropertiesMap);
             json.add(v.<String>property(AAIProperties.NODE_TYPE).orElse(null), jo);
         } else {
@@ -166,7 +175,7 @@ public class Resource extends MultiFormatMapper {
         }
         try {
             final Introspector obj =
-                getLoader().introspectorFromName(v.<String>property(AAIProperties.NODE_TYPE).orElse(null));
+                    getLoader().introspectorFromName(v.<String>property(AAIProperties.NODE_TYPE).orElse(null));
 
             final List<Vertex> wrapper = new ArrayList<>();
 
@@ -176,7 +185,7 @@ public class Resource extends MultiFormatMapper {
                 getSerializer().dbToObject(wrapper, obj, this.depth, this.nodesOnly, "false", isSkipRelatedTo);
             } catch (AAIException | UnsupportedEncodingException e) {
                 throw new AAIFormatVertexException(
-                    "Failed to format vertex - error while serializing: " + e.getMessage(), e);
+                        "Failed to format vertex - error while serializing: " + e.getMessage(), e);
             }
 
             final String json = obj.marshal(false);
@@ -221,7 +230,8 @@ public class Resource extends MultiFormatMapper {
             this.urlBuilder = urlBuilder;
         }
 
-        public Builder(Loader loader, DBSerializer serializer, UrlBuilder urlBuilder, MultivaluedMap<String, String> params) {
+        public Builder(Loader loader, DBSerializer serializer, UrlBuilder urlBuilder,
+                MultivaluedMap<String, String> params) {
             this.loader = loader;
             this.serializer = serializer;
             this.urlBuilder = urlBuilder;
@@ -240,7 +250,9 @@ public class Resource extends MultiFormatMapper {
             return this.urlBuilder;
         }
 
-        protected MultivaluedMap<String, String> getParams() { return this.params; }
+        protected MultivaluedMap<String, String> getParams() {
+            return this.params;
+        }
 
         public boolean isSkipRelatedTo() {
             if (params != null) {
@@ -257,14 +269,15 @@ public class Resource extends MultiFormatMapper {
             return true;
         }
 
-        protected boolean isTree() { return this.tree; }
+        protected boolean isTree() {
+            return this.tree;
+        }
 
         public Builder isTree(Boolean tree) {
             this.tree = tree;
             return this;
         }
 
-
         public Builder includeUrl() {
             this.includeUrl = true;
             return this;
index 1a56805..076f665 100644 (file)
@@ -22,9 +22,11 @@ package org.onap.aai.serialization.queryformats;
 
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
+
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
+
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.introspection.Loader;
@@ -92,7 +94,9 @@ public class ResourceWithSoT extends MultiFormatMapper {
             return this;
         }
 
-        protected boolean isTree() { return this.tree; }
+        protected boolean isTree() {
+            return this.tree;
+        }
 
         public Builder isTree(Boolean tree) {
             this.tree = tree;
@@ -185,7 +189,8 @@ public class ResourceWithSoT extends MultiFormatMapper {
     }
 
     @Override
-    protected Optional<JsonObject> getJsonFromVertex(Vertex input, Map<String, List<String>> properties) throws AAIFormatVertexException {
+    protected Optional<JsonObject> getJsonFromVertex(Vertex input, Map<String, List<String>> properties)
+            throws AAIFormatVertexException {
         return Optional.empty();
     }
 }
index b281347..2440595 100644 (file)
 
 package org.onap.aai.serialization.queryformats;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonObject;
+
+import java.util.*;
+
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexException;
-
-import java.util.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class StateFormat extends HistoryFormat {
 
@@ -102,18 +103,29 @@ public class StateFormat extends HistoryFormat {
             LOGGER.warn("Vertex {} is missing aai-uri", related.id());
             json.addProperty("uri", "NA");
         }
-        json.addProperty(TIMESTAMP,  e.property(AAIProperties.START_TS).isPresent()? e.value(AAIProperties.START_TS) : 0);
-        json.addProperty(SOT,   e.property(AAIProperties.SOURCE_OF_TRUTH).isPresent()? e.value(AAIProperties.SOURCE_OF_TRUTH) : "");
-        json.addProperty(TX_ID,   e.property(AAIProperties.START_TX_ID).isPresent()? e.value(AAIProperties.START_TX_ID) : "N/A");
+        json.addProperty(TIMESTAMP,
+                e.property(AAIProperties.START_TS).isPresent() ? e.value(AAIProperties.START_TS) : 0);
+        json.addProperty(SOT,
+                e.property(AAIProperties.SOURCE_OF_TRUTH).isPresent() ? e.value(AAIProperties.SOURCE_OF_TRUTH) : "");
+        json.addProperty(TX_ID,
+                e.property(AAIProperties.START_TX_ID).isPresent() ? e.value(AAIProperties.START_TX_ID) : "N/A");
 
         return json;
     }
 
-
     protected void addMetaProperties(JsonObject json, JsonObject metaProperties) {
-        json.addProperty(TIMESTAMP, metaProperties.get(AAIProperties.START_TS) != null ? metaProperties.get(AAIProperties.START_TS).getAsLong() : 0);
-        json.addProperty(SOT, metaProperties.get(AAIProperties.SOURCE_OF_TRUTH) != null ? metaProperties.get(AAIProperties.SOURCE_OF_TRUTH).getAsString() : "");
-        json.addProperty(TX_ID, metaProperties.get(AAIProperties.START_TX_ID) != null ? metaProperties.get(AAIProperties.START_TX_ID).getAsString() : "N/A");
+        json.addProperty(TIMESTAMP,
+                metaProperties.get(AAIProperties.START_TS) != null
+                        ? metaProperties.get(AAIProperties.START_TS).getAsLong()
+                        : 0);
+        json.addProperty(SOT,
+                metaProperties.get(AAIProperties.SOURCE_OF_TRUTH) != null
+                        ? metaProperties.get(AAIProperties.SOURCE_OF_TRUTH).getAsString()
+                        : "");
+        json.addProperty(TX_ID,
+                metaProperties.get(AAIProperties.START_TX_ID) != null
+                        ? metaProperties.get(AAIProperties.START_TX_ID).getAsString()
+                        : "N/A");
     }
 
     @Override
@@ -137,7 +149,8 @@ public class StateFormat extends HistoryFormat {
     }
 
     @Override
-    protected Optional<JsonObject> getJsonFromVertex(Vertex input, Map<String, List<String>> properties) throws AAIFormatVertexException {
+    protected Optional<JsonObject> getJsonFromVertex(Vertex input, Map<String, List<String>> properties)
+            throws AAIFormatVertexException {
         return Optional.empty();
     }
 
index d94c4b9..2e1cbf6 100644 (file)
@@ -26,7 +26,11 @@ import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
+
+import java.io.UnsupportedEncodingException;
+import java.util.*;
 import java.util.Map.Entry;
+
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -43,9 +47,6 @@ import org.onap.aai.serialization.queryformats.params.Depth;
 import org.onap.aai.serialization.queryformats.params.NodesOnly;
 import org.onap.aai.serialization.queryformats.utils.UrlBuilder;
 
-import java.io.UnsupportedEncodingException;
-import java.util.*;
-
 public class TreeFormat extends MultiFormatMapper {
     private static final EELFLogger TREE_FORMAT_LOGGER = EELFManager.getInstance().getLogger(TreeFormat.class);
     protected JsonParser parser = new JsonParser();
@@ -141,12 +142,13 @@ public class TreeFormat extends MultiFormatMapper {
         JsonArray body = new JsonArray();
         for (Object o : queryResults) {
             try {
-                return this.formatObjectToJsonArray(o, properties).orElseGet( () -> {
+                return this.formatObjectToJsonArray(o, properties).orElseGet(() -> {
                     TREE_FORMAT_LOGGER.warn("Empty Optional returned by 'formatObjectToJsonArray'");
                     return body;
                 });
             } catch (AAIFormatVertexException e) {
-                TREE_FORMAT_LOGGER.warn("Failed to format vertex, returning a partial list " + LogFormatTools.getStackTop(e));
+                TREE_FORMAT_LOGGER
+                        .warn("Failed to format vertex, returning a partial list " + LogFormatTools.getStackTop(e));
             } catch (AAIFormatQueryResultFormatNotSupported e) {
                 TREE_FORMAT_LOGGER.warn("Failed to format result type of the query " + LogFormatTools.getStackTop(e));
             }
@@ -155,7 +157,7 @@ public class TreeFormat extends MultiFormatMapper {
     }
 
     public Optional<JsonArray> formatObjectToJsonArray(Object input, Map<String, List<String>> properties)
-        throws AAIFormatVertexException, AAIFormatQueryResultFormatNotSupported {
+            throws AAIFormatVertexException, AAIFormatQueryResultFormatNotSupported {
         JsonArray json = new JsonArray();
         if (input == null)
             return Optional.of(json);
@@ -185,13 +187,11 @@ public class TreeFormat extends MultiFormatMapper {
                     if (obj.isPresent()) {
                         jsonObject = obj.get();
                         for (Map.Entry<String, JsonElement> mapEntry : jsonObject.entrySet()) {
-                            JsonElement jsonRootElementContents = mapEntry.getValue();        // getting everyObject inside
+                            JsonElement jsonRootElementContents = mapEntry.getValue(); // getting everyObject inside
                             if (jsonRootElementContents != null && jsonRootElementContents.isJsonObject()) {
                                 JsonObject relatedJsonNode = (JsonObject) jsonRootElementContents;
-                                addRelatedNodesToJsonObject(
-                                    jsonRootElementContents.getAsJsonObject(),
-                                    getRelatedNodes(relatedJsonNode)
-                                );
+                                addRelatedNodesToJsonObject(jsonRootElementContents.getAsJsonObject(),
+                                        getRelatedNodes(relatedJsonNode));
                             }
                         }
                         jsonArray.add(jsonObject);
@@ -206,9 +206,8 @@ public class TreeFormat extends MultiFormatMapper {
                     for (Map.Entry<String, JsonElement> mapEntry : jsonObject.entrySet()) {
                         JsonElement jsonRootElementContents = mapEntry.getValue();
                         if (jsonRootElementContents != null && jsonRootElementContents.isJsonObject()) {
-                            addRelatedNodesToJsonObject(
-                                jsonRootElementContents.getAsJsonObject(),
-                                getRelatedNodes(entry.getValue()));
+                            addRelatedNodesToJsonObject(jsonRootElementContents.getAsJsonObject(),
+                                    getRelatedNodes(entry.getValue()));
                         }
                     }
                     jsonArray.add(jsonObject);
@@ -225,10 +224,7 @@ public class TreeFormat extends MultiFormatMapper {
             JsonElement jsonRootElementContents = jsonObj.get(s);
             if (jsonRootElementContents != null && jsonRootElementContents.isJsonObject()) {
                 JsonObject relatedJsonNode = jsonRootElementContents.getAsJsonObject();
-                addRelatedNodesToJsonObject(
-                    relatedJsonNode,
-                    this.getRelatedNodes(relatedJsonNode)
-                );
+                addRelatedNodesToJsonObject(relatedJsonNode, this.getRelatedNodes(relatedJsonNode));
                 relatedNodes.add(relatedJsonNode);
             }
         }
@@ -248,25 +244,23 @@ public class TreeFormat extends MultiFormatMapper {
     }
 
     private void processVertex(JsonArray relatedNodes, Entry<Object, Tree<Object>> entry, Vertex o)
-        throws AAIFormatVertexException {
+            throws AAIFormatVertexException {
         Optional<JsonObject> obj = this.getJsonFromVertex(o);
         if (obj.isPresent()) {
             JsonObject jsonObj = obj.get();
             for (Entry<String, JsonElement> mapEntry : jsonObj.entrySet()) {
                 JsonElement jsonRootElementContents = mapEntry.getValue();
                 if (jsonRootElementContents != null && jsonRootElementContents.isJsonObject()) {
-                    JsonObject jsonObject = addRelatedNodesToJsonObject(
-                        jsonRootElementContents.getAsJsonObject(),
-                        getRelatedNodes(entry.getValue()));
+                    JsonObject jsonObject = addRelatedNodesToJsonObject(jsonRootElementContents.getAsJsonObject(),
+                            getRelatedNodes(entry.getValue()));
                     relatedNodes.add(jsonObject);
                 }
             }
         }
     }
 
-
     private static JsonObject addRelatedNodesToJsonObject(JsonObject jsonObject, Optional<JsonArray> relatedNodesOpt) {
-        relatedNodesOpt.ifPresent( relatedNodes -> {
+        relatedNodesOpt.ifPresent(relatedNodes -> {
             if (relatedNodes.size() > 0) {
                 jsonObject.add("related-nodes", relatedNodes);
             }
@@ -303,7 +297,7 @@ public class TreeFormat extends MultiFormatMapper {
     protected Optional<JsonObject> vertexToJsonObject(Vertex v) throws AAIFormatVertexException {
         try {
             final Introspector obj =
-                getLoader().introspectorFromName(v.<String>property(AAIProperties.NODE_TYPE).orElse(null));
+                    getLoader().introspectorFromName(v.<String>property(AAIProperties.NODE_TYPE).orElse(null));
 
             final List<Vertex> wrapper = new ArrayList<>();
 
@@ -313,7 +307,7 @@ public class TreeFormat extends MultiFormatMapper {
                 getSerializer().dbToObject(wrapper, obj, this.depth, this.nodesOnly, "false");
             } catch (AAIException | UnsupportedEncodingException e) {
                 throw new AAIFormatVertexException(
-                    "Failed to format vertex - error while serializing: " + e.getMessage(), e);
+                        "Failed to format vertex - error while serializing: " + e.getMessage(), e);
             }
 
             final String json = obj.marshal(false);
@@ -336,9 +330,9 @@ public class TreeFormat extends MultiFormatMapper {
         return parser;
     }
 
-
     @Override
-    protected Optional<JsonObject> getJsonFromVertex(Vertex input, Map<String, List<String>> properties) throws AAIFormatVertexException {
+    protected Optional<JsonObject> getJsonFromVertex(Vertex input, Map<String, List<String>> properties)
+            throws AAIFormatVertexException {
         return Optional.empty();
     }
 }
index f90907e..a0693a8 100644 (file)
 
 package org.onap.aai.serialization.queryformats.utils;
 
-import org.onap.aai.serialization.queryformats.exceptions.QueryParamInjectionException;
-import org.onap.aai.serialization.queryformats.params.*;
-
-import javax.ws.rs.core.MultivaluedMap;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
+import javax.ws.rs.core.MultivaluedMap;
+
+import org.onap.aai.serialization.queryformats.exceptions.QueryParamInjectionException;
+import org.onap.aai.serialization.queryformats.params.*;
+
 public class QueryParamInjector {
 
-    //TODO reimplement this using reflections.
-    private static final Class<?>[] PARAM_CLASSES = new Class[] {
-        AsTree.class,
-        Depth.class,
-        EndTs.class,
-        NodesOnly.class,
-        StartTs.class
-    };
+    // TODO reimplement this using reflections.
+    private static final Class<?>[] PARAM_CLASSES =
+            new Class[] {AsTree.class, Depth.class, EndTs.class, NodesOnly.class, StartTs.class};
 
     private static class Helper {
         private static final QueryParamInjector INSTANCE = new QueryParamInjector();
index 2d37f1b..3fcecf6 100644 (file)
@@ -57,8 +57,8 @@ public class UrlBuilder {
             String basePath) throws AAIException {
         this.serializer = serializer;
         this.version = version;
-        if(serverBase == null){
-           this.serverBase = getServerBase();
+        if (serverBase == null) {
+            this.serverBase = getServerBase();
         } else {
             this.serverBase = serverBase;
         }
index 6c57616..ca4666a 100644 (file)
 
 package org.onap.aai.service;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import javax.annotation.PostConstruct;
 
 import org.onap.aai.validation.nodes.NodeValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.context.annotation.PropertySource;
index 282d881..64d67c0 100644 (file)
@@ -53,7 +53,7 @@ public class ScheduledTasks {
     // configuration properties files
     @Scheduled(fixedRate = PROPERTY_READ_INTERVAL)
     public void loadAAIProperties() {
-        auditLog.logBefore("LoadAaiPropertiesTask", ONAPComponents.AAI.toString() );
+        auditLog.logBefore("LoadAaiPropertiesTask", ONAPComponents.AAI.toString());
         String dir = FilenameUtils.getFullPathNoEndSeparator(GlobalPropFileName);
         if (dir == null || dir.length() < 3) {
             dir = "/opt/aai/etc";
index ce7ead4..9ff146b 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.transforms;
 
 import com.bazaarvoice.jolt.Chainr;
 import com.bazaarvoice.jolt.JsonUtils;
+
+import java.util.List;
+
 import org.json.JSONObject;
 import org.json.XML;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.List;
-
 public class XmlFormatTransformer {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(XmlFormatTransformer.class);
@@ -39,19 +41,19 @@ public class XmlFormatTransformer {
 
     public XmlFormatTransformer() {
         List<Object> spec = JsonUtils.classpathToList("/specs/transform-related-to-node.json");
-        this.chainr       = Chainr.fromSpec(spec);
+        this.chainr = Chainr.fromSpec(spec);
     }
 
     public String transform(String input) {
 
         Object transformedOutput;
 
-        if(!input.contains(RESULT_WITH_QUOTES)){
+        if (!input.contains(RESULT_WITH_QUOTES)) {
             Object inputMap = JsonUtils.jsonToMap(input);
             transformedOutput = chainr.transform(inputMap);
 
             JSONObject jsonObject;
-            if(transformedOutput == null){
+            if (transformedOutput == null) {
                 LOGGER.debug("For the input {}, unable to transform it so returning null", input);
                 jsonObject = new JSONObject();
             } else {
index 4605414..52a78d3 100644 (file)
 
 package org.onap.aai.util;
 
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -31,13 +38,6 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
 @JsonInclude(JsonInclude.Include.NON_NULL)
 @Generated("org.jsonschema2pojo")
 @JsonPropertyOrder({"equipment-role", "action", "key-value-list", "self-link"})
index 375614b..e2bab6f 100644 (file)
 
 package org.onap.aai.util;
 
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -31,13 +38,6 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
 @JsonInclude(JsonInclude.Include.NON_NULL)
 @Generated("org.jsonschema2pojo")
 @JsonPropertyOrder({"entity"})
index 0cc3aef..f8f0b65 100644 (file)
@@ -26,6 +26,7 @@ import com.sun.jersey.api.client.config.ClientConfig;
 import com.sun.jersey.api.client.config.DefaultClientConfig;
 import com.sun.jersey.api.json.JSONConfiguration;
 import com.sun.jersey.client.urlconnection.HTTPSProperties;
+
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.security.KeyManagementException;
@@ -34,11 +35,13 @@ import java.security.KeyStoreException;
 import java.security.NoSuchAlgorithmException;
 import java.security.UnrecoverableKeyException;
 import java.security.cert.CertificateException;
+
 import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.HttpsURLConnection;
 import javax.net.ssl.KeyManagerFactory;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLSession;
+
 import org.onap.aai.aailog.filter.RestControllerClientLoggingInterceptor;
 import org.onap.aai.exceptions.AAIException;
 import org.slf4j.Logger;
@@ -71,6 +74,7 @@ public class HttpsAuthClient {
             logger.debug("HttpsAuthClient error : {}", e.getMessage());
         }
     }
+
     /**
      * Gets the client.
      *
@@ -81,7 +85,9 @@ public class HttpsAuthClient {
      * @return the client
      * @throws KeyManagementException the key management exception
      */
-    public static Client getClient(String truststorePath, String truststorePassword, String keystorePath, String keystorePassword) throws KeyManagementException, UnrecoverableKeyException, CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException {
+    public static Client getClient(String truststorePath, String truststorePassword, String keystorePath,
+            String keystorePassword) throws KeyManagementException, UnrecoverableKeyException, CertificateException,
+            NoSuchAlgorithmException, KeyStoreException, IOException {
 
         ClientConfig config = new DefaultClientConfig();
         config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
@@ -112,12 +118,12 @@ public class HttpsAuthClient {
 
             ctx.init(kmf.getKeyManagers(), null, null);
             config.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
-                new HTTPSProperties(new HostnameVerifier() {
-                    @Override
-                    public boolean verify(String s, SSLSession sslSession) {
-                        return true;
-                    }
-                }, ctx));
+                    new HTTPSProperties(new HostnameVerifier() {
+                        @Override
+                        public boolean verify(String s, SSLSession sslSession) {
+                            return true;
+                        }
+                    }, ctx));
         } catch (Exception e) {
             System.out.println("Error setting up config: exiting " + e.getMessage());
             throw e;
@@ -130,22 +136,22 @@ public class HttpsAuthClient {
 
         return client;
     }
+
     /**
      * Gets the client.
      *
      * @return the client
      * @throws KeyManagementException the key management exception
      */
-    public static Client getClient() throws KeyManagementException, AAIException, UnrecoverableKeyException, CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException {
+    public static Client getClient() throws KeyManagementException, AAIException, UnrecoverableKeyException,
+            CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException {
         String truststorePath = null;
         String truststorePassword = null;
         String keystorePath = null;
         String keystorePassword = null;
-        truststorePath =
-            AAIConstants.AAI_HOME_ETC_AUTH + AAIConfig.get(AAIConstants.AAI_TRUSTSTORE_FILENAME);
+        truststorePath = AAIConstants.AAI_HOME_ETC_AUTH + AAIConfig.get(AAIConstants.AAI_TRUSTSTORE_FILENAME);
         truststorePassword = AAIConfig.get(AAIConstants.AAI_TRUSTSTORE_PASSWD);
-        keystorePath =
-            AAIConstants.AAI_HOME_ETC_AUTH + AAIConfig.get(AAIConstants.AAI_KEYSTORE_FILENAME);
+        keystorePath = AAIConstants.AAI_HOME_ETC_AUTH + AAIConfig.get(AAIConstants.AAI_KEYSTORE_FILENAME);
         keystorePassword = AAIConfig.get(AAIConstants.AAI_KEYSTORE_PASSWD);
         return getClient(truststorePath, truststorePassword, keystorePath, keystorePassword);
     }
index c3382b2..8c9ea52 100644 (file)
 
 package org.onap.aai.util;
 
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
 import java.util.HashMap;
 import java.util.Map;
 
@@ -29,13 +36,6 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
 @JsonInclude(JsonInclude.Include.NON_NULL)
 @Generated("org.jsonschema2pojo")
 @JsonPropertyOrder({"key", "value"})
index d83c9ec..f974ba1 100644 (file)
 
 package org.onap.aai.util;
 
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.json.JsonMapper;
+import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
+import com.google.common.base.CaseFormat;
+import com.google.common.collect.Multimap;
+
 import java.io.IOException;
 import java.io.StringWriter;
 import java.lang.reflect.InvocationTargetException;
@@ -45,28 +56,17 @@ import org.eclipse.persistence.jaxb.MarshallerProperties;
 import org.onap.aai.domain.model.AAIResource;
 import org.onap.aai.exceptions.AAIException;
 
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.json.JsonMapper;
-import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
-import com.google.common.base.CaseFormat;
-import com.google.common.collect.Multimap;
-
 public class PojoUtils {
 
     /**
      * Gets the key value list.
      *
-     * @param <T>   the generic type
-     * @param e     the e
+     * @param <T> the generic type
+     * @param e the e
      * @param clazz the clazz
      * @return the key value list
-     * @throws IllegalAccessException    the illegal access exception
-     * @throws IllegalArgumentException  the illegal argument exception
+     * @throws IllegalAccessException the illegal access exception
+     * @throws IllegalArgumentException the illegal argument exception
      * @throws InvocationTargetException the invocation target exception
      */
     public <T> List<KeyValueList> getKeyValueList(Entity e, T clazz)
@@ -99,12 +99,12 @@ public class PojoUtils {
     /**
      * Gets the json from object.
      *
-     * @param <T>   the generic type
+     * @param <T> the generic type
      * @param clazz the clazz
      * @return the json from object
      * @throws JsonGenerationException the json generation exception
-     * @throws JsonMappingException    the json mapping exception
-     * @throws IOException             Signals that an I/O exception has occurred.
+     * @throws JsonMappingException the json mapping exception
+     * @throws IOException Signals that an I/O exception has occurred.
      */
     public <T> String getJsonFromObject(T clazz) throws JsonGenerationException, JsonMappingException, IOException {
         return getJsonFromObject(clazz, false, true);
@@ -113,26 +113,24 @@ public class PojoUtils {
     /**
      * Gets the json from object.
      *
-     * @param <T>      the generic type
-     * @param clazz    the clazz
+     * @param <T> the generic type
+     * @param clazz the clazz
      * @param wrapRoot the wrap root
-     * @param indent   the indent
+     * @param indent the indent
      * @return the json from object
      * @throws JsonGenerationException the json generation exception
-     * @throws JsonMappingException    the json mapping exception
-     * @throws IOException             Signals that an I/O exception has occurred.
+     * @throws JsonMappingException the json mapping exception
+     * @throws IOException Signals that an I/O exception has occurred.
      */
     public <T> String getJsonFromObject(T clazz, boolean wrapRoot, boolean indent)
             throws JsonGenerationException, JsonMappingException, IOException {
-        ObjectMapper mapper = JsonMapper.builder()
-        .serializationInclusion(JsonInclude.Include.NON_NULL)
-        .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
-        .configure(SerializationFeature.INDENT_OUTPUT, indent)
-        .configure(SerializationFeature.WRAP_ROOT_VALUE, wrapRoot)
-        .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
-        .configure(DeserializationFeature.UNWRAP_ROOT_VALUE, wrapRoot)
-        .addModule(new JaxbAnnotationModule())
-        .build();
+        ObjectMapper mapper = JsonMapper.builder().serializationInclusion(JsonInclude.Include.NON_NULL)
+                .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
+                .configure(SerializationFeature.INDENT_OUTPUT, indent)
+                .configure(SerializationFeature.WRAP_ROOT_VALUE, wrapRoot)
+                .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
+                .configure(DeserializationFeature.UNWRAP_ROOT_VALUE, wrapRoot).addModule(new JaxbAnnotationModule())
+                .build();
 
         return mapper.writeValueAsString(clazz);
     }
@@ -140,14 +138,14 @@ public class PojoUtils {
     /**
      * Gets the json from dynamic object.
      *
-     * @param ent         the ent
+     * @param ent the ent
      * @param jaxbContext the jaxb context
      * @param includeRoot the include root
      * @return the json from dynamic object
      * @throws JsonGenerationException the json generation exception
-     * @throws JsonMappingException    the json mapping exception
-     * @throws IOException             Signals that an I/O exception has occurred.
-     * @throws JAXBException           the JAXB exception
+     * @throws JsonMappingException the json mapping exception
+     * @throws IOException Signals that an I/O exception has occurred.
+     * @throws JAXBException the JAXB exception
      */
     public String getJsonFromDynamicObject(DynamicEntity ent, org.eclipse.persistence.jaxb.JAXBContext jaxbContext,
             boolean includeRoot) throws JsonGenerationException, JsonMappingException, IOException, JAXBException {
@@ -166,7 +164,7 @@ public class PojoUtils {
     /**
      * Gets the xml from object.
      *
-     * @param <T>   the generic type
+     * @param <T> the generic type
      * @param clazz the clazz
      * @return the xml from object
      * @throws JAXBException the JAXB exception
@@ -179,7 +177,7 @@ public class PojoUtils {
             Marshaller marshaller = jc.createMarshaller();
             marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
             marshaller.marshal(clazz, baos);
-            
+
             return baos.toString(Charset.defaultCharset());
         }
     }
@@ -187,9 +185,9 @@ public class PojoUtils {
     /**
      * Gets the lookup key.
      *
-     * @param baseKey    the base key
+     * @param baseKey the base key
      * @param lookupHash the lookup hash
-     * @param keyProps   the key props
+     * @param keyProps the key props
      * @return the lookup key
      */
     public String getLookupKey(String baseKey, HashMap<String, Object> lookupHash, Collection<String> keyProps) {
@@ -213,7 +211,7 @@ public class PojoUtils {
     /**
      * Gets the lookup keys.
      *
-     * @param lookupHashes         the lookup hashes
+     * @param lookupHashes the lookup hashes
      * @param _dbRulesNodeKeyProps the db rules node key props
      * @return the lookup keys
      */
@@ -237,16 +235,16 @@ public class PojoUtils {
     /**
      * Gets the example object.
      *
-     * @param <T>       the generic type
-     * @param clazz     the clazz
+     * @param <T> the generic type
+     * @param clazz the clazz
      * @param singleton the singleton
      * @return the example object
-     * @throws IllegalAccessException    the illegal access exception
-     * @throws IllegalArgumentException  the illegal argument exception
+     * @throws IllegalAccessException the illegal access exception
+     * @throws IllegalArgumentException the illegal argument exception
      * @throws InvocationTargetException the invocation target exception
-     * @throws NoSuchMethodException     the no such method exception
-     * @throws SecurityException         the security exception
-     * @throws AAIException              the AAI exception
+     * @throws NoSuchMethodException the no such method exception
+     * @throws SecurityException the security exception
+     * @throws AAIException the AAI exception
      */
     public <T> void getExampleObject(T clazz, boolean singleton)
             throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException,
@@ -304,8 +302,8 @@ public class PojoUtils {
      * Gets the dynamic example object.
      *
      * @param childObject the child object
-     * @param aaiRes      the aai res
-     * @param singleton   the singleton
+     * @param aaiRes the aai res
+     * @param singleton the singleton
      * @return the dynamic example object
      */
     public void getDynamicExampleObject(DynamicEntity childObject, AAIResource aaiRes, boolean singleton) {
index 890398d..c373738 100644 (file)
 
 package org.onap.aai.util;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URLEncoder;
-import java.nio.charset.StandardCharsets;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.aai.exceptions.AAIException;
-
 public class Request<T> {
 
     public static final String V14 = "v14";
index 433458a..6c57040 100644 (file)
@@ -20,8 +20,6 @@
 
 package org.onap.aai.util;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.type.TypeFactory;
 import com.sun.jersey.api.client.Client;
@@ -31,14 +29,16 @@ import com.sun.jersey.api.client.ClientResponse;
 import java.io.IOException;
 import java.security.KeyManagementException;
 import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
 import java.security.UnrecoverableKeyException;
 import java.security.cert.CertificateException;
-import java.security.NoSuchAlgorithmException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
 
 import org.onap.aai.exceptions.AAIException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class RestController implements RestControllerInterface {
 
@@ -85,15 +85,18 @@ public class RestController implements RestControllerInterface {
     public static final String REST_APIPATH_LOGICALLINKS = "network/logical-links/";
     public static final String REST_APIPATH_LOGICALLINK = "network/logical-links/logical-link/";
 
-    public RestController(String truststorePath, String truststorePassword, String keystorePath, String keystorePassword) throws AAIException {
+    public RestController(String truststorePath, String truststorePassword, String keystorePath,
+            String keystorePassword) throws AAIException {
         this.initRestClient(truststorePath, truststorePassword, keystorePath, keystorePassword);
     }
+
     /**
      * Inits the rest client.
      *
      * @throws AAIException the AAI exception
      */
-    public void initRestClient(String truststorePath, String truststorePassword, String keystorePath, String keystorePassword) throws AAIException {
+    public void initRestClient(String truststorePath, String truststorePassword, String keystorePath,
+            String keystorePassword) throws AAIException {
         if (client == null) {
             try {
                 client = getHttpsAuthClient(truststorePath, truststorePassword, keystorePath, keystorePassword);
@@ -104,13 +107,18 @@ public class RestController implements RestControllerInterface {
             }
         }
     }
-    public Client getHttpsAuthClient(String truststorePath, String truststorePassword, String keystorePath, String keystorePassword) throws KeyManagementException, UnrecoverableKeyException, CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException {
+
+    public Client getHttpsAuthClient(String truststorePath, String truststorePassword, String keystorePath,
+            String keystorePassword) throws KeyManagementException, UnrecoverableKeyException, CertificateException,
+            NoSuchAlgorithmException, KeyStoreException, IOException {
         return HttpsAuthClient.getClient(truststorePath, truststorePassword, keystorePath, keystorePassword);
     }
 
-    public Client getHttpsAuthClient() throws KeyManagementException, UnrecoverableKeyException, CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException, AAIException {
+    public Client getHttpsAuthClient() throws KeyManagementException, UnrecoverableKeyException, CertificateException,
+            NoSuchAlgorithmException, KeyStoreException, IOException, AAIException {
         return HttpsAuthClient.getClient();
     }
+
     /**
      * Sets the rest srvr base URL.
      *
@@ -335,7 +343,7 @@ public class RestController implements RestControllerInterface {
                     + cres.getEntity(String.class));
         }
     }
-    
+
     /**
      * Put.
      *
@@ -347,14 +355,13 @@ public class RestController implements RestControllerInterface {
      * @param apiVersion version number
      * @throws AAIException the AAI exception
      */
-    public <T> void Put(T t, String sourceID, String transId, String path, String apiVersion)
-            throws AAIException {
+    public <T> void Put(T t, String sourceID, String transId, String path, String apiVersion) throws AAIException {
         String methodName = "Put";
         String url = "";
         transId += ":" + UUID.randomUUID().toString();
 
         LOGGER.debug(methodName + " start");
-        
+
         url = AAIConfig.get(AAIConstants.AAI_SERVER_URL_BASE) + apiVersion + "/" + path;
 
         ClientResponse cres = client.resource(url).accept("application/json").header("X-TransactionId", transId)
index f5eed42..3304e9a 100644 (file)
@@ -21,7 +21,6 @@
 package org.onap.aai.util;
 
 import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.util.RestObject;
 
 public interface RestControllerInterface {
 
index 01d21ca..598ef23 100644 (file)
@@ -20,9 +20,6 @@
 
 package org.onap.aai.util;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.StringWriter;
 import java.util.Iterator;
 import java.util.UUID;
@@ -40,6 +37,8 @@ import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.Introspector;
 import org.onap.aai.introspection.Loader;
 import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.context.ApplicationContext;
 import org.springframework.core.env.Environment;
 
@@ -273,7 +272,7 @@ public class StoreNotificationEvent {
 
             if (eventHeader.getValue("sequence-number") == null) {
                 eventHeader.setValue("sequence-number",
-                    AAIConfig.get("aai.notificationEvent.default.sequenceNumber", "UNK"));
+                        AAIConfig.get("aai.notificationEvent.default.sequenceNumber", "UNK"));
             }
 
             if (eventHeader.getValue("severity") == null) {
@@ -286,7 +285,7 @@ public class StoreNotificationEvent {
 
             if (notificationEvent.getValue("cambria-partition") == null) {
                 notificationEvent.setValue("cambria-partition",
-                    AAIConfig.get("aai.notificationEvent.default.partition", AAIConstants.UEB_PUB_PARTITION_AAI));
+                        AAIConfig.get("aai.notificationEvent.default.partition", AAIConstants.UEB_PUB_PARTITION_AAI));
             }
 
             notificationEvent.setValue("event-header", eventHeader.getUnderlyingObject());
@@ -322,7 +321,8 @@ public class StoreNotificationEvent {
         }
     }
 
-    public String storeEventAndSendToJms(Loader loader, Introspector eventHeader, Introspector obj) throws AAIException {
+    public String storeEventAndSendToJms(Loader loader, Introspector eventHeader, Introspector obj)
+            throws AAIException {
         if (obj == null) {
             throw new AAIException("AAI_7350");
         }
index 1b1e49a..7db4e83 100644 (file)
 package org.onap.aai.util.delta;
 
 public enum DeltaAction {
-    CREATE,
-    UPDATE,
-    DELETE,
-    CREATE_REL,
-    DELETE_REL,
-    STATIC
+    CREATE, UPDATE, DELETE, CREATE_REL, DELETE_REL, STATIC
 }
index 138652a..10d47cd 100644 (file)
 
 package org.onap.aai.util.delta;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.google.gson.*;
-import org.onap.aai.db.props.AAIProperties;
-import org.onap.aai.dmaap.AAIDmaapEventJMSProducer;
-import org.onap.aai.dmaap.MessageProducer;
-import org.onap.aai.util.AAIConfig;
 
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Map;
 
+import org.onap.aai.db.props.AAIProperties;
+import org.onap.aai.dmaap.AAIDmaapEventJMSProducer;
+import org.onap.aai.dmaap.MessageProducer;
+import org.onap.aai.util.AAIConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class DeltaEvents {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(DeltaEvents.class);
 
-    private static final Gson gson = new GsonBuilder()
-        .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES)
-        .create();
+    private static final Gson gson =
+            new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES).create();
 
     private String transId;
     private String sourceName;
@@ -53,7 +53,8 @@ public class DeltaEvents {
         this(transId, sourceName, schemaVersion, objectDeltas, new AAIDmaapEventJMSProducer());
     }
 
-    public DeltaEvents(String transId, String sourceName, String schemaVersion, Map<String, ObjectDelta> objectDeltas, MessageProducer messageProducer) {
+    public DeltaEvents(String transId, String sourceName, String schemaVersion, Map<String, ObjectDelta> objectDeltas,
+            MessageProducer messageProducer) {
         this.transId = transId;
         this.sourceName = sourceName;
         this.schemaVersion = schemaVersion;
@@ -125,11 +126,12 @@ public class DeltaEvents {
 
     /**
      * Given Long timestamp convert to format YYYYMMdd-HH:mm:ss:SSS
+     * 
      * @param timestamp milliseconds since epoc
      * @return long timestamp in format YYYYMMdd-HH:mm:ss:SSS
      */
     private String getTimeStamp(long timestamp) {
-        //SimpleDateFormat is not thread safe new instance needed
+        // SimpleDateFormat is not thread safe new instance needed
         DateFormat df = new SimpleDateFormat("yyyyMMdd-HH:mm:ss:SSS");
         return df.format(new Date(timestamp));
     }
index 5ba99af..2347667 100644 (file)
@@ -20,6 +20,8 @@
 
 package org.onap.aai.util.delta;
 
+import com.google.gson.annotations.SerializedName;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -27,8 +29,6 @@ import java.util.Map;
 
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
-import com.google.gson.annotations.SerializedName;
-
 public class ObjectDelta {
 
     @SerializedName("uri")
@@ -64,7 +64,6 @@ public class ObjectDelta {
         relationshipDeltas.add(relationshipDelta);
     }
 
-
     public String getUri() {
         return uri;
     }
@@ -115,13 +114,8 @@ public class ObjectDelta {
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this)
-            .append("uri", uri)
-            .append("action", action)
-            .append("sourceOfTruth", sourceOfTruth)
-            .append("timestamp", timestamp)
-            .append("propertyDeltas", propertyDeltas)
-            .append("relationshipDeltas", relationshipDeltas)
-            .toString();
+        return new ToStringBuilder(this).append("uri", uri).append("action", action)
+                .append("sourceOfTruth", sourceOfTruth).append("timestamp", timestamp)
+                .append("propertyDeltas", propertyDeltas).append("relationshipDeltas", relationshipDeltas).toString();
     }
 }
index 3f4da75..98296d3 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-package org.onap.aai.util.delta;
 
-import org.apache.commons.lang3.builder.ToStringBuilder;
+package org.onap.aai.util.delta;
 
 import com.google.gson.annotations.SerializedName;
 
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
 public class PropertyDelta {
 
     @SerializedName("action")
@@ -34,7 +35,6 @@ public class PropertyDelta {
     @SerializedName("old-value")
     private Object oldValue;
 
-
     public PropertyDelta(DeltaAction action, Object value) {
         this.action = action;
         this.value = value;
@@ -71,10 +71,7 @@ public class PropertyDelta {
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this)
-            .append("action", action)
-            .append("value", value)
-            .append("oldValue", oldValue)
-            .toString();
+        return new ToStringBuilder(this).append("action", action).append("value", value).append("oldValue", oldValue)
+                .toString();
     }
 }
index 366d688..a6641c2 100644 (file)
@@ -23,12 +23,12 @@ package org.onap.aai.util.delta;
 public class PropertyDeltaFactory {
 
     public static PropertyDelta getDelta(DeltaAction action, Object value, Object oldValue) {
-        //TODO handle if action is not UPDATE
+        // TODO handle if action is not UPDATE
         return new PropertyDelta(action, value, oldValue);
     }
 
     public static PropertyDelta getDelta(DeltaAction action, Object value) {
-        //TODO handle if action is UPDATE
+        // TODO handle if action is UPDATE
         return new PropertyDelta(action, value);
     }
 }
index 75349ea..8d8f9c4 100644 (file)
 
 package org.onap.aai.util.delta;
 
+import com.google.gson.annotations.SerializedName;
+
 import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
-import com.google.gson.annotations.SerializedName;
-
 public class RelationshipDelta {
 
     @SerializedName("action")
@@ -50,7 +50,8 @@ public class RelationshipDelta {
     @SerializedName("props")
     private Map<String, Object> props = new HashMap<>();
 
-    public RelationshipDelta(DeltaAction action, String inVUUID, String outVUUID, String inVUri, String outVUri, String label) {
+    public RelationshipDelta(DeltaAction action, String inVUUID, String outVUUID, String inVUri, String outVUri,
+            String label) {
         this.action = action;
         this.inVUuid = inVUUID;
         this.outVUuid = outVUUID;
@@ -121,14 +122,8 @@ public class RelationshipDelta {
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this)
-            .append("action", action)
-            .append("inVUuid", inVUuid)
-            .append("outVUuid", outVUuid)
-            .append("inVUri", inVUri)
-            .append("outVUri", outVUri)
-            .append("label", label)
-            .append("props", props)
-            .toString();
+        return new ToStringBuilder(this).append("action", action).append("inVUuid", inVUuid)
+                .append("outVUuid", outVUuid).append("inVUri", inVUri).append("outVUri", outVUri).append("label", label)
+                .append("props", props).toString();
     }
 }
index ac9cba6..72d8273 100644 (file)
@@ -20,6 +20,8 @@
 
 package org.onap.aai;
 
+import java.util.Map;
+
 import org.junit.BeforeClass;
 import org.junit.ClassRule;
 import org.junit.Rule;
@@ -42,30 +44,14 @@ import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.junit4.rules.SpringClassRule;
 import org.springframework.test.context.junit4.rules.SpringMethodRule;
 
-import java.util.Map;
-
 @ContextConfiguration(
-    classes = {
-        ConfigConfiguration.class,
-        AAIConfigTranslator.class,
-        EdgeIngestor.class,
-        EdgeSerializer.class,
-        NodeIngestor.class,
-        SpringContextAware.class,
-        IntrospectionConfig.class,
-        RestBeanConfig.class,
-        XmlFormatTransformerConfiguration.class
-    }
-)
+        classes = {ConfigConfiguration.class, AAIConfigTranslator.class, EdgeIngestor.class, EdgeSerializer.class,
+                NodeIngestor.class, SpringContextAware.class, IntrospectionConfig.class, RestBeanConfig.class,
+                XmlFormatTransformerConfiguration.class})
 @TestPropertySource(
-    properties = {
-        "schema.uri.base.path = /aai",
-        "schema.xsd.maxoccurs = 5000",
-        "schema.translator.list=config",
-        "schema.nodes.location=src/test/resources/onap/oxm",
-        "schema.edges.location=src/test/resources/onap/dbedgerules"
-    }
-)
+        properties = {"schema.uri.base.path = /aai", "schema.xsd.maxoccurs = 5000", "schema.translator.list=config",
+                "schema.nodes.location=src/test/resources/onap/oxm",
+                "schema.edges.location=src/test/resources/onap/dbedgerules"})
 public abstract class AAISetup {
 
     @ClassRule
index 0718343..19b8220 100644 (file)
@@ -21,7 +21,6 @@
 package org.onap.aai;
 
 import java.io.File;
-import java.net.URL;
 import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
index 8a09366..b878204 100644 (file)
@@ -33,8 +33,6 @@ import org.onap.aai.nodes.NodeIngestor;
 import org.onap.aai.rest.db.HttpEntry;
 import org.onap.aai.serialization.db.EdgeSerializer;
 import org.onap.aai.serialization.queryformats.QueryFormatTestHelper;
-import org.onap.aai.setup.AAIConfigTranslator;
-import org.onap.aai.setup.SchemaLocationsBean;
 import org.onap.aai.setup.SchemaVersion;
 import org.onap.aai.setup.SchemaVersions;
 import org.onap.aai.testutils.TestUtilConfigTranslatorforDataLink;
index 588cbc9..9d406eb 100644 (file)
 
 package org.onap.aai;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.*;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.util.*;
+
+import javax.ws.rs.core.*;
+
 import org.javatuples.Pair;
 import org.mockito.Mockito;
 import org.onap.aai.config.SpringContextAware;
@@ -40,14 +47,8 @@ import org.onap.aai.serialization.engines.QueryStyle;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
 import org.onap.aai.setup.SchemaVersion;
 import org.onap.aai.setup.SchemaVersions;
-
-import javax.ws.rs.core.*;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.util.*;
-
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Mockito.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class HttpTestUtil extends RESTAPI {
 
@@ -91,7 +92,6 @@ public class HttpTestUtil extends RESTAPI {
         this.acceptType = acceptType;
     }
 
-
     public HttpTestUtil(QueryStyle qs, UEBNotification uebNotification, int notificationDepth) {
         this(qs, uebNotification, notificationDepth, "application/json");
     }
@@ -122,7 +122,7 @@ public class HttpTestUtil extends RESTAPI {
         headersMultiMap.add("aai-request-context", "");
 
         outputMediaTypes = new ArrayList<>();
-        if(acceptType.equals("application/json")){
+        if (acceptType.equals("application/json")) {
             outputMediaTypes.add(APPLICATION_JSON);
         } else {
             outputMediaTypes.add(APPLICATION_XML);
@@ -143,7 +143,7 @@ public class HttpTestUtil extends RESTAPI {
         when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON);
 
         try {
-            if(notification != null){
+            if (notification != null) {
                 doNothing().when(notification).triggerEvents();
             }
         } catch (AAIException e) {
@@ -167,7 +167,7 @@ public class HttpTestUtil extends RESTAPI {
         try {
 
             List<DBRequest> dbRequestList = new ArrayList<>();
-            for(Map.Entry<String, String> entry : uriPayload.entrySet()){
+            for (Map.Entry<String, String> entry : uriPayload.entrySet()) {
 
                 String uri = entry.getKey();
                 String payload = entry.getValue();
@@ -193,7 +193,7 @@ public class HttpTestUtil extends RESTAPI {
                 }
                 Mockito.when(uriInfo.getPath()).thenReturn(uri);
 
-                if(notification != null){
+                if (notification != null) {
                     traversalHttpEntry.setHttpEntryProperties(version, notification, notificationDepth);
                 } else {
                     traversalHttpEntry.setHttpEntryProperties(version);
@@ -213,23 +213,24 @@ public class HttpTestUtil extends RESTAPI {
                 HttpMethod httpMethod;
                 if (uri.contains("/relationship-list/relationship")) {
                     obj = loader.unmarshal("relationship", payload,
-                        org.onap.aai.restcore.MediaType.getEnum("application/json"));
+                            org.onap.aai.restcore.MediaType.getEnum("application/json"));
                     httpMethod = HttpMethod.PUT_EDGE;
                 } else {
-                    obj = loader.unmarshal(objType, payload, org.onap.aai.restcore.MediaType.getEnum("application/json"));
+                    obj = loader.unmarshal(objType, payload,
+                            org.onap.aai.restcore.MediaType.getEnum("application/json"));
                     httpMethod = HttpMethod.PUT;
                     this.validateIntrospector(obj, loader, uriObject, httpMethod);
                 }
 
                 DBRequest dbRequest = new DBRequest.Builder(httpMethod, uriObject, uriQuery, obj, httpHeaders, uriInfo,
-                    "JUNIT-TRANSACTION").rawRequestContent(payload).build();
+                        "JUNIT-TRANSACTION").rawRequestContent(payload).build();
 
                 dbRequestList.add(dbRequest);
 
             }
 
             Pair<Boolean, List<Pair<URI, Response>>> responsesTuple =
-                traversalHttpEntry.process(dbRequestList, "JUNIT");
+                    traversalHttpEntry.process(dbRequestList, "JUNIT");
             response = responsesTuple.getValue1().get(0).getValue1();
 
         } catch (AAIException e) {
@@ -244,7 +245,7 @@ public class HttpTestUtil extends RESTAPI {
                 if (response != null) {
                     if ((response.getStatus() / 100) == 2) {
                         logger.info("Successfully completed the PUT request with status {} and committing it to DB",
-                            response.getStatus());
+                                response.getStatus());
                     } else {
                         logFailure(HttpMethod.PUT, response);
                     }
@@ -292,7 +293,7 @@ public class HttpTestUtil extends RESTAPI {
             }
             Mockito.when(uriInfo.getPath()).thenReturn(uri);
 
-            if(notification != null){
+            if (notification != null) {
                 traversalHttpEntry.setHttpEntryProperties(version, notification, notificationDepth);
             } else {
                 traversalHttpEntry.setHttpEntryProperties(version);
@@ -315,13 +316,13 @@ public class HttpTestUtil extends RESTAPI {
             this.validateIntrospector(obj, loader, uriObject, httpMethod);
 
             DBRequest dbRequest = new DBRequest.Builder(httpMethod, uriObject, uriQuery, obj, httpHeaders, uriInfo,
-                "JUNIT-TRANSACTION").rawRequestContent(payload).build();
+                    "JUNIT-TRANSACTION").rawRequestContent(payload).build();
 
             List<DBRequest> dbRequestList = new ArrayList<>();
             dbRequestList.add(dbRequest);
 
             Pair<Boolean, List<Pair<URI, Response>>> responsesTuple =
-                traversalHttpEntry.process(dbRequestList, "JUNIT");
+                    traversalHttpEntry.process(dbRequestList, "JUNIT");
             response = responsesTuple.getValue1().get(0).getValue1();
 
         } catch (AAIException e) {
@@ -336,7 +337,7 @@ public class HttpTestUtil extends RESTAPI {
                 if (response != null) {
                     if ((response.getStatus() / 100) == 2) {
                         logger.info("Successfully completed the PUT request with status {} and committing it to DB",
-                            response.getStatus());
+                                response.getStatus());
                     } else {
                         logFailure(HttpMethod.PUT, response);
                     }
@@ -353,8 +354,8 @@ public class HttpTestUtil extends RESTAPI {
         return response;
     }
 
-    public Response doGet(String uri, String depth){
-       return doGet(uri, depth, null);
+    public Response doGet(String uri, String depth) {
+        return doGet(uri, depth, null);
     }
 
     public Response doGet(String uri, String depth, String format) {
@@ -387,7 +388,7 @@ public class HttpTestUtil extends RESTAPI {
                 version = schemaVersions.getDefaultVersion();
             }
 
-            if(notification != null){
+            if (notification != null) {
                 traversalHttpEntry.setHttpEntryProperties(version, notification, notificationDepth);
             } else {
                 traversalHttpEntry.setHttpEntryProperties(version);
@@ -401,7 +402,7 @@ public class HttpTestUtil extends RESTAPI {
                 queryParameters.add("depth", depth);
             }
 
-            if(format != null){
+            if (format != null) {
                 queryParameters.add("format", format);
             }
 
@@ -461,7 +462,7 @@ public class HttpTestUtil extends RESTAPI {
         return this.doGet(uri, "all");
     }
 
-    public Response doDelete(Map<String, Pair<String, String>> deletes){
+    public Response doDelete(Map<String, Pair<String, String>> deletes) {
 
         this.init();
         Response response = null;
@@ -476,7 +477,8 @@ public class HttpTestUtil extends RESTAPI {
                 String resourceVersion = delete.getValue().getValue0();
                 String content = delete.getValue().getValue1();
                 uri = uri.replaceAll("/aai/", "");
-                logger.info("Starting the delete request for the uri {} with resource version {}", uri, resourceVersion);
+                logger.info("Starting the delete request for the uri {} with resource version {}", uri,
+                        resourceVersion);
 
                 String[] arr = uri.split("/");
 
@@ -517,19 +519,20 @@ public class HttpTestUtil extends RESTAPI {
 
                 if (uri.contains("/relationship-list/relationship")) {
                     httpMethod = HttpMethod.DELETE_EDGE;
-                    obj = loader.unmarshal("relationship", content, org.onap.aai.restcore.MediaType.getEnum("application/json"));
+                    obj = loader.unmarshal("relationship", content,
+                            org.onap.aai.restcore.MediaType.getEnum("application/json"));
                 } else {
                     obj = loader.introspectorFromName(objType);
                     httpMethod = HttpMethod.DELETE;
                 }
 
-                DBRequest dbRequest = new DBRequest.Builder(httpMethod, uriObject, uriQuery, obj, httpHeaders, uriInfo, "JUNIT-TRANSACTION").build();
-
+                DBRequest dbRequest = new DBRequest.Builder(httpMethod, uriObject, uriQuery, obj, httpHeaders, uriInfo,
+                        "JUNIT-TRANSACTION").build();
 
                 dbRequestList.add(dbRequest);
             }
             Pair<Boolean, List<Pair<URI, Response>>> responsesTuple =
-                traversalHttpEntry.process(dbRequestList, "JUNIT");
+                    traversalHttpEntry.process(dbRequestList, "JUNIT");
             response = responsesTuple.getValue1().get(0).getValue1();
 
         } catch (AAIException e) {
@@ -544,7 +547,7 @@ public class HttpTestUtil extends RESTAPI {
                 if (response != null) {
                     if ((response.getStatus() / 100) == 2) {
                         logger.info("Successfully completed the DELETE request with status {} and committing it to DB",
-                            response.getStatus());
+                                response.getStatus());
                     } else {
                         logFailure(HttpMethod.DELETE, response);
                     }
@@ -562,6 +565,7 @@ public class HttpTestUtil extends RESTAPI {
     public Response doDelete(String uri, String resourceVersion) {
         return this.doDelete(uri, resourceVersion, null);
     }
+
     public Response doDelete(String uri, String resourceVersion, String content) {
         Map<String, Pair<String, String>> deletes = new HashMap<>();
         deletes.put(uri, new Pair<>(resourceVersion, content));
index 5d60673..f993ad2 100644 (file)
 
 package org.onap.aai.audit;
 
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -27,10 +31,6 @@ import org.onap.aai.AAISetup;
 import org.onap.aai.setup.SchemaVersion;
 import org.springframework.test.annotation.DirtiesContext;
 
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class ListEndpointsTest extends AAISetup {
 
index 0c3857a..df5c144 100644 (file)
@@ -22,11 +22,8 @@ package org.onap.aai.concurrent;
 
 import static org.junit.Assert.assertTrue;
 
-import java.lang.Object;
-
 import org.junit.Test;
 import org.onap.aai.AAISetup;
-import org.onap.aai.concurrent.AaiCallable;
 import org.slf4j.MDC;
 
 public class AaiCallableTest extends AAISetup {
index 6bea58f..16faa5f 100644 (file)
@@ -108,8 +108,10 @@ public class DbMethHelperTest extends AAISetup {
         dbser = new DBSerializer(version, dbEngine, introspectorFactoryType, "AAI-TEST");
         dbMethHelper = new DbMethHelper(loader, spy);
 
-        Vertex pserver1 = graph.addVertex("aai-node-type", "pserver", "hostname", "testSearchVertexByIdentityMap-pserver-hostname-01");
-        Vertex pserver2 = graph.addVertex("aai-node-type", "pserver", "hostname", "testSearchVertexByIdentityMap-pserver-hostname-02");
+        Vertex pserver1 = graph.addVertex("aai-node-type", "pserver", "hostname",
+                "testSearchVertexByIdentityMap-pserver-hostname-01");
+        Vertex pserver2 = graph.addVertex("aai-node-type", "pserver", "hostname",
+                "testSearchVertexByIdentityMap-pserver-hostname-02");
         Vertex genericVnf1 = graph.addVertex("aai-node-type", "generic-vnf", "vnf-id", "key1", "vnf-name", "vnfName1");
         Vertex complex1 = graph.addVertex("aai-node-type", "complex", "physical-location-id", "id1");
         GraphTraversalSource g = graph.traversal();
@@ -119,7 +121,7 @@ public class DbMethHelperTest extends AAISetup {
     }
 
     @Test
-    public void testSearchVertexByIdentityMap() throws Exception{
+    public void testSearchVertexByIdentityMap() throws Exception {
         String type = "pserver";
         Map<String, Object> map = new HashMap<>();
         map.put("pserver.hostname", "testSearchVertexByIdentityMap-pserver-hostname-01");
@@ -134,7 +136,8 @@ public class DbMethHelperTest extends AAISetup {
     }
 
     @Test(expected = AmbiguousMapAAIException.class)
-    public void testSearchVertexByIdentityMap_throwAmbiguousMapAAIException() throws AmbiguousMapAAIException, Exception {
+    public void testSearchVertexByIdentityMap_throwAmbiguousMapAAIException()
+            throws AmbiguousMapAAIException, Exception {
         String type = "pserver";
         Map<String, Object> map = new HashMap<>();
         map.put("pserver.hostname", "testSearchVertexByIdentityMap-pserver-hostname-01");
@@ -155,14 +158,16 @@ public class DbMethHelperTest extends AAISetup {
         Vertex complex2 = graph.addVertex("aai-node-type", "complex", "physical-location-id", "id2");
         map.put("physical-location-id", "id2");
         Optional<Vertex> optionalVertex = dbMethHelper.locateUniqueVertex(type, map);
-        Assert.assertEquals("vp[physical-location-id->id2]", optionalVertex.get().property("physical-location-id").toString());
+        Assert.assertEquals("vp[physical-location-id->id2]",
+                optionalVertex.get().property("physical-location-id").toString());
     }
 
     @Test(expected = AAIException.class)
     public void testLocateUniqueVertex_throwsException() throws AAIException, Exception {
         String type = "Pserver";
         Map<String, Object> map = new HashMap<>();
-        Introspector obj = loader.unmarshal("relationship", this.getJsonString("related-link-and-relationship-data.json"));
+        Introspector obj =
+                loader.unmarshal("relationship", this.getJsonString("related-link-and-relationship-data.json"));
         map.put("hostname", "testSearchVertexByIdentityMap-pserver-hostname-01");
         dbMethHelper.locateUniqueVertex(type, map);
     }
@@ -178,8 +183,9 @@ public class DbMethHelperTest extends AAISetup {
 
     @Test
     public void testGetVertexProperties() throws Exception {
-        Vertex pserver3 = graph.addVertex("aai-node-type", "pserver", "hostname", "testGetVertexProperties-pserver-hostname-01",
-            "ptnii-equip-name", "testGetVertexProperties-pserver-ptnii-equip-name-01");
+        Vertex pserver3 =
+                graph.addVertex("aai-node-type", "pserver", "hostname", "testGetVertexProperties-pserver-hostname-01",
+                        "ptnii-equip-name", "testGetVertexProperties-pserver-ptnii-equip-name-01");
         String type = "pserver";
         Map<String, Object> map = new HashMap<>();
         map.put("pserver.hostname", "testGetVertexProperties-pserver-hostname-01");
@@ -194,8 +200,10 @@ public class DbMethHelperTest extends AAISetup {
         Vertex v = optionalVertex.get();
         List<String> vertexProperties = dbMethHelper.getVertexProperties(v);
         Assert.assertTrue(vertexProperties.contains("Prop: [aai-node-type], val = [pserver] "));
-        Assert.assertTrue(vertexProperties.contains("Prop: [hostname], val = [testGetVertexProperties-pserver-hostname-01] "));
-        Assert.assertTrue(vertexProperties.contains("Prop: [ptnii-equip-name], val = [testGetVertexProperties-pserver-ptnii-equip-name-01] "));
+        Assert.assertTrue(
+                vertexProperties.contains("Prop: [hostname], val = [testGetVertexProperties-pserver-hostname-01] "));
+        Assert.assertTrue(vertexProperties
+                .contains("Prop: [ptnii-equip-name], val = [testGetVertexProperties-pserver-ptnii-equip-name-01] "));
     }
 
     @Test
index cc42001..05cb346 100644 (file)
 
 package org.onap.aai.dbmap;
 
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.Matchers.matchesPattern;
+import static org.junit.Assert.*;
+
+import java.io.FileNotFoundException;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+
 import org.janusgraph.core.JanusGraph;
 import org.janusgraph.core.JanusGraphFactory;
 import org.janusgraph.core.schema.JanusGraphIndex;
@@ -37,17 +48,6 @@ import org.onap.aai.schema.enums.PropertyMetadata;
 import org.onap.aai.setup.SchemaVersions;
 import org.onap.aai.util.AAIConstants;
 
-import java.io.FileNotFoundException;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.Matchers.matchesPattern;
-import static org.junit.Assert.*;
-
 public class AAIGraphTest extends AAISetup {
     @Before
     public void setup() {
@@ -67,7 +67,6 @@ public class AAIGraphTest extends AAISetup {
         graphMgt.rollback();
     }
 
-
     @Test
     public void janusGraphOpenNameTest() throws Exception {
         JanusGraph graph = JanusGraphFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG)
index 61e7607..3ef1bef 100644 (file)
@@ -22,15 +22,13 @@ package org.onap.aai.domain.model;
 
 import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.Multimap;
-import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MultiHashtable;
+
+import java.util.*;
+
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.aai.AAISetup;
-import org.onap.aai.audit.ListEndpoints;
-import org.onap.aai.setup.SchemaVersion;
-
-import java.util.*;
 
 public class AAIResourceTest extends AAISetup {
     private AAIResource aaiResource;
index 79a9289..20e3ab3 100644 (file)
 
 package org.onap.aai.domain.translog;
 
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.Multimap;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.aai.AAISetup;
-import org.onap.aai.domain.model.AAIResource;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
 public class TransactionLogEntriesTest extends AAISetup {
     private TransactionLogEntries transactionLogEntries;
index b692519..3d4256b 100644 (file)
 
 package org.onap.aai.domain.translog;
 
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.Multimap;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.aai.AAISetup;
-import org.onap.aai.domain.model.AAIResource;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
 public class TransactionLogEntryTest extends AAISetup {
     private TransactionLogEntry transactionLogEntry;
index 47fad98..8437456 100644 (file)
@@ -21,7 +21,6 @@
 package org.onap.aai.exceptions;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
 
 import org.junit.Test;
 import org.onap.aai.AAISetup;
index 7b15e8c..4982f1d 100644 (file)
@@ -20,6 +20,9 @@
 
 package org.onap.aai.introspection;
 
+import java.util.HashSet;
+import java.util.Set;
+
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
 import org.junit.Assert;
@@ -28,9 +31,6 @@ import org.junit.Ignore;
 import org.junit.Test;
 import org.onap.aai.AAISetup;
 
-import java.util.HashSet;
-import java.util.Set;
-
 @Ignore("Not a used/flushed out feature")
 public class JSONStrategyTest extends AAISetup {
     private JSONStrategy jsonStrategy;
@@ -69,14 +69,16 @@ public class JSONStrategyTest extends AAISetup {
         Assert.assertEquals(1024, jsonStrategy.getValue("ramInMegabytes"));
 
     }
+
     @Test
-    public void testGetMethods(){
-        Assert.assertEquals("pserver-type",jsonStrategy.getName());
-        Assert.assertEquals("pserver-type",jsonStrategy.getDbName());
-        Assert.assertEquals("",jsonStrategy.getGenericURI());
+    public void testGetMethods() {
+        Assert.assertEquals("pserver-type", jsonStrategy.getName());
+        Assert.assertEquals("pserver-type", jsonStrategy.getDbName());
+        Assert.assertEquals("", jsonStrategy.getGenericURI());
         Assert.assertNull(jsonStrategy.getChildName());
-        Assert.assertEquals("key",jsonStrategy.preProcessKey("key"));
+        Assert.assertEquals("key", jsonStrategy.preProcessKey("key"));
     }
+
     @Test
     public void getPropertiesTest() {
         Set<String> expected = new HashSet<>();
index 887f191..a83c41a 100644 (file)
@@ -20,9 +20,6 @@
 
 package org.onap.aai.introspection;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-
 import org.junit.Assert;
 import org.junit.Test;
 import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
index f68e6af..8003706 100644 (file)
@@ -29,6 +29,7 @@ import java.util.List;
 
 import org.junit.Before;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.mockito.Mockito;
 import org.onap.aai.AAISetup;
@@ -37,7 +38,6 @@ import org.onap.aai.introspection.Introspector;
 import org.onap.aai.introspection.Loader;
 import org.onap.aai.introspection.ModelType;
 import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
-import org.junit.Ignore;
 
 @Ignore
 public class CreateExampleTest extends AAISetup {
index bda268c..e83d3bd 100644 (file)
@@ -95,35 +95,22 @@ public class DataCopyTest extends AAISetup {
         System.setProperty("AJSC_HOME", ".");
         System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local");
 
-        graph.traversal()
-            .addV("model")
-            .property("aai-node-type", "model")
-            .property("model-invariant-id", "key1")
-            .property(AAIProperties.AAI_URI,"/service-design-and-creation/models/model/key1")
-            .as("v1")
-            .addV("model-ver")
-            .property("aai-node-type", "model-ver")
-            .property("model-ver", "myValue")
-            .property("model-version-id", "key2")
-            .property("model-version", "testValue")
-            .property(AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key1/model-vers/model-ver/key2")
-            .as("v2")
-            .addE("org.onap.relationships.inventory.BelongsTo").to("v1").from("v2")
-            .property(EdgeProperty.CONTAINS.toString(), true)
-            .addV("model")
-            .property("aai-node-type", "model")
-            .property("model-invariant-id", "key3")
-            .property(AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key3")
-            .as("v3")
-            .addV()
-            .property("aai-node-type", "model-ver")
-            .property("model-ver", "myValue")
-            .property("model-version-id", "key4")
-            .property(AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key3/model-vers/model-ver/key4")
-            .as("v4")
-            .addE("org.onap.relationships.inventory.BelongsTo").to("v3").from("v4")
-            .property(EdgeProperty.CONTAINS.toString(), true)
-            .next();
+        graph.traversal().addV("model").property("aai-node-type", "model").property("model-invariant-id", "key1")
+                .property(AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key1").as("v1")
+                .addV("model-ver").property("aai-node-type", "model-ver").property("model-ver", "myValue")
+                .property("model-version-id", "key2").property("model-version", "testValue")
+                .property(AAIProperties.AAI_URI,
+                        "/service-design-and-creation/models/model/key1/model-vers/model-ver/key2")
+                .as("v2").addE("org.onap.relationships.inventory.BelongsTo").to("v1").from("v2")
+                .property(EdgeProperty.CONTAINS.toString(), true).addV("model").property("aai-node-type", "model")
+                .property("model-invariant-id", "key3")
+                .property(AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key3").as("v3").addV()
+                .property("aai-node-type", "model-ver").property("model-ver", "myValue")
+                .property("model-version-id", "key4")
+                .property(AAIProperties.AAI_URI,
+                        "/service-design-and-creation/models/model/key3/model-vers/model-ver/key4")
+                .as("v4").addE("org.onap.relationships.inventory.BelongsTo").to("v3").from("v4")
+                .property(EdgeProperty.CONTAINS.toString(), true).next();
         graph.tx().commit();
     }
 
@@ -141,8 +128,8 @@ public class DataCopyTest extends AAISetup {
     }
 
     @Test
-    public void runPopulatePersonaModelVer() throws AAIException, UnsupportedEncodingException,
-            IllegalArgumentException, SecurityException {
+    public void runPopulatePersonaModelVer()
+            throws AAIException, UnsupportedEncodingException, IllegalArgumentException, SecurityException {
 
         final Loader loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion());
         final Introspector obj = loader.introspectorFromName("generic-vnf");
index 62c366c..440d279 100644 (file)
 
 package org.onap.aai.introspection.sideeffect;
 
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.not;
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -47,19 +60,6 @@ import org.onap.aai.serialization.engines.JanusGraphDBEngine;
 import org.onap.aai.serialization.engines.QueryStyle;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
 
-import java.io.UnsupportedEncodingException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
 @RunWith(value = Parameterized.class)
 public class DataLinkTest extends DataLinkSetup {
 
@@ -88,128 +88,74 @@ public class DataLinkTest extends DataLinkSetup {
     public static void setup() {
         graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open();
         JanusGraphManagement graphMgt = graph.openManagement();
-        graphMgt.makePropertyKey(AAIProperties.CREATED_TS).dataType(Long.class).cardinality(Cardinality.SINGLE)
-            .make();
-        graphMgt.makePropertyKey(AAIProperties.LAST_MOD_TS).dataType(Long.class).cardinality(Cardinality.SINGLE)
-            .make();
+        graphMgt.makePropertyKey(AAIProperties.CREATED_TS).dataType(Long.class).cardinality(Cardinality.SINGLE).make();
+        graphMgt.makePropertyKey(AAIProperties.LAST_MOD_TS).dataType(Long.class).cardinality(Cardinality.SINGLE).make();
         graphMgt.commit();
 
-        graph.traversal()
-            .addV()
-            .property("aai-node-type", "vpn-binding")
-            .property("vpn-id", "addKey")
-            .property(AAIProperties.AAI_URI, "/network/vpn-bindings/vpn-binding/addKey")
-            .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString())
-            .property(AAIProperties.CREATED_TS, 123)
-            .property(AAIProperties.SOURCE_OF_TRUTH, "sot")
-            .property(AAIProperties.RESOURCE_VERSION, "123")
-            .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot")
-            .property(AAIProperties.LAST_MOD_TS, 333)
-            .as("v1")
-            .addV()
-            .property("aai-node-type", "vpn-binding")
-            .property("vpn-id", "modifyKey")
-            .property(AAIProperties.AAI_URI, "/network/vpn-bindings/vpn-binding/modifyKey")
-            .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString())
-            .property(AAIProperties.CREATED_TS, 123)
-            .property(AAIProperties.SOURCE_OF_TRUTH, "sot")
-            .property(AAIProperties.RESOURCE_VERSION, "123")
-            .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot")
-            .property(AAIProperties.LAST_MOD_TS, 333)
-            .as("v2")
-            .addV()
-            .property("aai-node-type", "route-target")
-            .property("global-route-target", "modifyTargetKey")
-            .property("route-target-role", "modifyRoleKey")
-            .property("linked", true)
-            .property(AAIProperties.AAI_URI, "/network/vpn-bindings/vpn-binding/modifyKey/route-targets/route-target/modifyTargetKey/modifyRoleKey")
-            .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString())
-            .property(AAIProperties.CREATED_TS, 123)
-            .property(AAIProperties.SOURCE_OF_TRUTH, "sot")
-            .property(AAIProperties.RESOURCE_VERSION, "123")
-            .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot")
-            .property(AAIProperties.LAST_MOD_TS, 333)
-            .as("v3")
-            .addE("org.onap.relationships.inventory.BelongsTo").to("v2").from("v3")
-            .property(EdgeProperty.CONTAINS.toString(), true)
-            .addV()
-            .property("aai-node-type", "vpn-binding")
-            .property("vpn-id", "deleteKey")
-            .property(AAIProperties.AAI_URI, "/network/vpn-bindings/vpn-binding/deleteKey")
-            .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString())
-            .property(AAIProperties.CREATED_TS, 123)
-            .property(AAIProperties.SOURCE_OF_TRUTH, "sot")
-            .property(AAIProperties.RESOURCE_VERSION, "123")
-            .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot")
-            .property(AAIProperties.LAST_MOD_TS, 333)
-            .as("v4")
-            .addV()
-            .property("aai-node-type", "route-target")
-            .property("global-route-target", "deleteTargetKey")
-            .property("route-target-role", "deleteRoleKey")
-            .property("linked", true)
-            .property(AAIProperties.AAI_URI, "/network/vpn-bindings/vpn-binding/deleteKey/route-targets/route-target/deleteTargetKey/deleteRoleKey")
-            .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString())
-            .property(AAIProperties.CREATED_TS, 123)
-            .property(AAIProperties.SOURCE_OF_TRUTH, "sot")
-            .property(AAIProperties.RESOURCE_VERSION, "123")
-            .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot")
-            .property(AAIProperties.LAST_MOD_TS, 333)
-            .as("v5")
-            .addE("org.onap.relationships.inventory.BelongsTo").to("v4").from("v5")
-            .property(EdgeProperty.CONTAINS.toString(), true)
-            .addV()
-            .property("aai-node-type", "vpn-binding")
-            .property("vpn-id", "getKey")
-            .property(AAIProperties.AAI_URI, "/network/vpn-bindings/vpn-binding/getKey")
-            .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString())
-            .property(AAIProperties.CREATED_TS, 123)
-            .property(AAIProperties.SOURCE_OF_TRUTH, "sot")
-            .property(AAIProperties.RESOURCE_VERSION, "123")
-            .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot")
-            .property(AAIProperties.LAST_MOD_TS, 333)
-            .as("v6")
-            .addV()
-            .property("aai-node-type", "route-target")
-            .property("global-route-target", "getTargetKey")
-            .property("route-target-role", "getRoleKey")
-            .property("linked", true)
-            .property(AAIProperties.AAI_URI, "/network/vpn-bindings/vpn-binding/getKey/route-targets/route-target/getTargetKeyNoLink/getRoleKeyNoLink")
-            .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString())
-            .property(AAIProperties.CREATED_TS, 123)
-            .property(AAIProperties.SOURCE_OF_TRUTH, "sot")
-            .property(AAIProperties.RESOURCE_VERSION, "123")
-            .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot")
-            .property(AAIProperties.LAST_MOD_TS, 333)
-            .as("v7")
-            .addE("org.onap.relationships.inventory.BelongsTo").to("v6").from("v7")
-            .property(EdgeProperty.CONTAINS.toString(), true)
-            .addV()
-            .property("aai-node-type", "vpn-binding")
-            .property("vpn-id", "getKeyNoLink")
-            .property(AAIProperties.AAI_URI, "/network/vpn-bindings/vpn-binding/getKeyNoLink")
-            .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString())
-            .property(AAIProperties.CREATED_TS, 123)
-            .property(AAIProperties.SOURCE_OF_TRUTH, "sot")
-            .property(AAIProperties.RESOURCE_VERSION, "123")
-            .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot")
-            .property(AAIProperties.LAST_MOD_TS, 333)
-            .as("v8")
-            .addV()
-            .property("aai-node-type", "route-target")
-            .property("global-route-target", "getTargetKeyNoLink")
-            .property("route-target-role", "getRoleKeyNoLink")
-            .property(AAIProperties.AAI_URI, "/network/vpn-bindings/vpn-binding/getKeyNoLink/route-targets/route-target/getTargetKeyNoLink/getRoleKeyNoLink")
-            .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString())
-            .property(AAIProperties.CREATED_TS, 123)
-            .property(AAIProperties.SOURCE_OF_TRUTH, "sot")
-            .property(AAIProperties.RESOURCE_VERSION, "123")
-            .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot")
-            .property(AAIProperties.LAST_MOD_TS, 333)
-            .as("v9")
-            .addE("org.onap.relationships.inventory.BelongsTo").to("v8").from("v9")
-            .property(EdgeProperty.CONTAINS.toString(), true)
-                .next();
+        graph.traversal().addV().property("aai-node-type", "vpn-binding").property("vpn-id", "addKey")
+                .property(AAIProperties.AAI_URI, "/network/vpn-bindings/vpn-binding/addKey")
+                .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString()).property(AAIProperties.CREATED_TS, 123)
+                .property(AAIProperties.SOURCE_OF_TRUTH, "sot").property(AAIProperties.RESOURCE_VERSION, "123")
+                .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot").property(AAIProperties.LAST_MOD_TS, 333)
+                .as("v1").addV().property("aai-node-type", "vpn-binding").property("vpn-id", "modifyKey")
+                .property(AAIProperties.AAI_URI, "/network/vpn-bindings/vpn-binding/modifyKey")
+                .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString()).property(AAIProperties.CREATED_TS, 123)
+                .property(AAIProperties.SOURCE_OF_TRUTH, "sot").property(AAIProperties.RESOURCE_VERSION, "123")
+                .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot").property(AAIProperties.LAST_MOD_TS, 333)
+                .as("v2").addV().property("aai-node-type", "route-target")
+                .property("global-route-target", "modifyTargetKey").property("route-target-role", "modifyRoleKey")
+                .property("linked", true)
+                .property(AAIProperties.AAI_URI,
+                        "/network/vpn-bindings/vpn-binding/modifyKey/route-targets/route-target/modifyTargetKey/modifyRoleKey")
+                .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString()).property(AAIProperties.CREATED_TS, 123)
+                .property(AAIProperties.SOURCE_OF_TRUTH, "sot").property(AAIProperties.RESOURCE_VERSION, "123")
+                .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot").property(AAIProperties.LAST_MOD_TS, 333)
+                .as("v3").addE("org.onap.relationships.inventory.BelongsTo").to("v2").from("v3")
+                .property(EdgeProperty.CONTAINS.toString(), true).addV().property("aai-node-type", "vpn-binding")
+                .property("vpn-id", "deleteKey")
+                .property(AAIProperties.AAI_URI, "/network/vpn-bindings/vpn-binding/deleteKey")
+                .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString()).property(AAIProperties.CREATED_TS, 123)
+                .property(AAIProperties.SOURCE_OF_TRUTH, "sot").property(AAIProperties.RESOURCE_VERSION, "123")
+                .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot").property(AAIProperties.LAST_MOD_TS, 333)
+                .as("v4").addV().property("aai-node-type", "route-target")
+                .property("global-route-target", "deleteTargetKey").property("route-target-role", "deleteRoleKey")
+                .property("linked", true)
+                .property(AAIProperties.AAI_URI,
+                        "/network/vpn-bindings/vpn-binding/deleteKey/route-targets/route-target/deleteTargetKey/deleteRoleKey")
+                .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString()).property(AAIProperties.CREATED_TS, 123)
+                .property(AAIProperties.SOURCE_OF_TRUTH, "sot").property(AAIProperties.RESOURCE_VERSION, "123")
+                .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot").property(AAIProperties.LAST_MOD_TS, 333)
+                .as("v5").addE("org.onap.relationships.inventory.BelongsTo").to("v4").from("v5")
+                .property(EdgeProperty.CONTAINS.toString(), true).addV().property("aai-node-type", "vpn-binding")
+                .property("vpn-id", "getKey")
+                .property(AAIProperties.AAI_URI, "/network/vpn-bindings/vpn-binding/getKey")
+                .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString()).property(AAIProperties.CREATED_TS, 123)
+                .property(AAIProperties.SOURCE_OF_TRUTH, "sot").property(AAIProperties.RESOURCE_VERSION, "123")
+                .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot").property(AAIProperties.LAST_MOD_TS, 333)
+                .as("v6").addV().property("aai-node-type", "route-target")
+                .property("global-route-target", "getTargetKey").property("route-target-role", "getRoleKey")
+                .property("linked", true)
+                .property(AAIProperties.AAI_URI,
+                        "/network/vpn-bindings/vpn-binding/getKey/route-targets/route-target/getTargetKeyNoLink/getRoleKeyNoLink")
+                .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString()).property(AAIProperties.CREATED_TS, 123)
+                .property(AAIProperties.SOURCE_OF_TRUTH, "sot").property(AAIProperties.RESOURCE_VERSION, "123")
+                .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot").property(AAIProperties.LAST_MOD_TS, 333)
+                .as("v7").addE("org.onap.relationships.inventory.BelongsTo").to("v6").from("v7")
+                .property(EdgeProperty.CONTAINS.toString(), true).addV().property("aai-node-type", "vpn-binding")
+                .property("vpn-id", "getKeyNoLink")
+                .property(AAIProperties.AAI_URI, "/network/vpn-bindings/vpn-binding/getKeyNoLink")
+                .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString()).property(AAIProperties.CREATED_TS, 123)
+                .property(AAIProperties.SOURCE_OF_TRUTH, "sot").property(AAIProperties.RESOURCE_VERSION, "123")
+                .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot").property(AAIProperties.LAST_MOD_TS, 333)
+                .as("v8").addV().property("aai-node-type", "route-target")
+                .property("global-route-target", "getTargetKeyNoLink").property("route-target-role", "getRoleKeyNoLink")
+                .property(AAIProperties.AAI_URI,
+                        "/network/vpn-bindings/vpn-binding/getKeyNoLink/route-targets/route-target/getTargetKeyNoLink/getRoleKeyNoLink")
+                .property(AAIProperties.AAI_UUID, UUID.randomUUID().toString()).property(AAIProperties.CREATED_TS, 123)
+                .property(AAIProperties.SOURCE_OF_TRUTH, "sot").property(AAIProperties.RESOURCE_VERSION, "123")
+                .property(AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot").property(AAIProperties.LAST_MOD_TS, 333)
+                .as("v9").addE("org.onap.relationships.inventory.BelongsTo").to("v8").from("v9")
+                .property(EdgeProperty.CONTAINS.toString(), true).next();
         graph.tx().commit();
 
     }
@@ -228,8 +174,8 @@ public class DataLinkTest extends DataLinkSetup {
     }
 
     @Test
-    public void verifyCreationOfVertex() throws AAIException, UnsupportedEncodingException,
-            IllegalArgumentException, SecurityException {
+    public void verifyCreationOfVertex()
+            throws AAIException, UnsupportedEncodingException, IllegalArgumentException, SecurityException {
 
         final Loader loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDepthVersion());
         final Introspector obj = loader.introspectorFromName("vpn-binding");
@@ -252,14 +198,15 @@ public class DataLinkTest extends DataLinkSetup {
 
         runner.execute(obj, self);
 
-        assertTrue("route-target vertex found", traversal.V().has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "key1").has("route-target-role", "key2").has("linked", true).hasNext());
+        assertTrue("route-target vertex found", traversal.V().has(AAIProperties.NODE_TYPE, "route-target")
+                .has("global-route-target", "key1").has("route-target-role", "key2").has("linked", true).hasNext());
         g.tx().rollback();
 
     }
 
     @Test
-    public void verifyModificationOfVertex() throws AAIException, UnsupportedEncodingException,
-            IllegalArgumentException, SecurityException {
+    public void verifyModificationOfVertex()
+            throws AAIException, UnsupportedEncodingException, IllegalArgumentException, SecurityException {
 
         final Loader loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDepthVersion());
         final Introspector obj = loader.introspectorFromName("vpn-binding");
@@ -326,7 +273,9 @@ public class DataLinkTest extends DataLinkSetup {
 
         runner.execute(obj, self);
 
-        assertFalse("route-target vertex not found", traversal.V().has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "deleteTargetKey").has("route-target-role", "deleteRoleKey").has("linked", true).hasNext());
+        assertFalse("route-target vertex not found",
+                traversal.V().has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "deleteTargetKey")
+                        .has("route-target-role", "deleteRoleKey").has("linked", true).hasNext());
 
         g.tx().rollback();
 
@@ -354,14 +303,16 @@ public class DataLinkTest extends DataLinkSetup {
 
         runner.execute(obj, self);
 
-        assertTrue("both properties have been populated in target object", obj.getValue("global-route-target").equals("getTargetKey") && obj.getValue("route-target-role").equals("getRoleKey"));
+        assertTrue("both properties have been populated in target object",
+                obj.getValue("global-route-target").equals("getTargetKey")
+                        && obj.getValue("route-target-role").equals("getRoleKey"));
         g.tx().rollback();
 
     }
 
     @Test
-    public void verifyPropertyPopulationWithV10OnlyPut() throws AAIException,
-            UnsupportedEncodingException, IllegalArgumentException, SecurityException {
+    public void verifyPropertyPopulationWithV10OnlyPut()
+            throws AAIException, UnsupportedEncodingException, IllegalArgumentException, SecurityException {
         final Introspector obj = loader.introspectorFromName("vpn-binding");
         obj.setValue("vpn-id", "getKeyNoLink");
         final Introspector routeTargets = loader.introspectorFromName("route-targets");
index ee8ff77..a349f85 100644 (file)
@@ -27,6 +27,7 @@ import static org.mockito.Mockito.when;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -35,6 +36,7 @@ import org.janusgraph.core.JanusGraphFactory;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
@@ -52,7 +54,6 @@ import org.onap.aai.serialization.db.DBSerializer;
 import org.onap.aai.serialization.engines.JanusGraphDBEngine;
 import org.onap.aai.serialization.engines.QueryStyle;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
-import org.junit.Ignore;
 
 @RunWith(value = Parameterized.class)
 @Ignore
@@ -80,38 +81,22 @@ public class OwnerCheckTest extends AAISetup {
         System.setProperty("AJSC_HOME", ".");
         System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local");
 
-        graph.traversal()
-            .addV("pnf")
-            .property("aai-node-type", "pnf")
-            .property("pnf-name", "my-pnf")
-            .property("data-owner", "Operator")
-            .property(AAIProperties.AAI_URI, "/network/pnfs/pnf/my-pnf")
-            .property("model-invariant-id", "key1")
-            .as("v1")
-            .property(EdgeProperty.CONTAINS.toString(), true)
-            .addV("model-ver")
-            .property("aai-node-type", "model-ver")
-            .property("model-ver", "myValue")
-            .property("model-version-id", "key2")
-            .property("model-version", "testValue")
-            .property(AAIProperties.AAI_URI, "/network/pnfs/pnf/my-pnf/model-vers/model-ver/key2")
-            .as("v2")
-            .addE("org.onap.relationships.inventory.BelongsTo").to("v1").from("v2")
-            .property(EdgeProperty.CONTAINS.toString(), true)
-            .addV("model")
-            .property("aai-node-type", "model")
-            .property("model-invariant-id", "key3")
-            .property(AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key3")
-            .as("v3")
-            .addV()
-            .property("aai-node-type", "model-ver")
-            .property("model-ver", "myValue")
-            .property("model-version-id", "key4")
-            .property(AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key3/model-vers/model-ver/key4")
-            .as("v4")
-            .addE("org.onap.relationships.inventory.BelongsTo").to("v3").from("v4")
-            .property(EdgeProperty.CONTAINS.toString(), true)
-            .next();
+        graph.traversal().addV("pnf").property("aai-node-type", "pnf").property("pnf-name", "my-pnf")
+                .property("data-owner", "Operator").property(AAIProperties.AAI_URI, "/network/pnfs/pnf/my-pnf")
+                .property("model-invariant-id", "key1").as("v1").property(EdgeProperty.CONTAINS.toString(), true)
+                .addV("model-ver").property("aai-node-type", "model-ver").property("model-ver", "myValue")
+                .property("model-version-id", "key2").property("model-version", "testValue")
+                .property(AAIProperties.AAI_URI, "/network/pnfs/pnf/my-pnf/model-vers/model-ver/key2").as("v2")
+                .addE("org.onap.relationships.inventory.BelongsTo").to("v1").from("v2")
+                .property(EdgeProperty.CONTAINS.toString(), true).addV("model").property("aai-node-type", "model")
+                .property("model-invariant-id", "key3")
+                .property(AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key3").as("v3").addV()
+                .property("aai-node-type", "model-ver").property("model-ver", "myValue")
+                .property("model-version-id", "key4")
+                .property(AAIProperties.AAI_URI,
+                        "/service-design-and-creation/models/model/key3/model-vers/model-ver/key4")
+                .as("v4").addE("org.onap.relationships.inventory.BelongsTo").to("v3").from("v4")
+                .property(EdgeProperty.CONTAINS.toString(), true).next();
         graph.tx().commit();
     }
 
@@ -129,7 +114,7 @@ public class OwnerCheckTest extends AAISetup {
     }
 
     @Test
-    public void shouldFailIfGroupsNotContainsDataOwner() throws Exception  {
+    public void shouldFailIfGroupsNotContainsDataOwner() throws Exception {
 
         final Loader loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion());
         final Introspector obj = loader.introspectorFromName("pnf");
@@ -142,9 +127,7 @@ public class OwnerCheckTest extends AAISetup {
         GraphTraversalSource traversal = g.traversal();
         when(spy.asAdmin()).thenReturn(adminSpy);
         when(adminSpy.getTraversalSource()).thenReturn(traversal);
-        DBSerializer serializer =
-            new DBSerializer(schemaVersions.getDefaultVersion(),
-                spy, introspectorFactoryType,
+        DBSerializer serializer = new DBSerializer(schemaVersions.getDefaultVersion(), spy, introspectorFactoryType,
                 "AAI_TEST", new HashSet<>(Arrays.asList("OperatorI", "OperatorII")));
 
         Vertex selfV = g.traversal().V().has("aai-node-type", "pnf").next();
@@ -159,7 +142,7 @@ public class OwnerCheckTest extends AAISetup {
     }
 
     @Test
-    public void shouldPassIfGroupsContainsDataOwner() throws Exception  {
+    public void shouldPassIfGroupsContainsDataOwner() throws Exception {
 
         final Loader loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion());
         final Introspector obj = loader.introspectorFromName("pnf");
@@ -176,9 +159,7 @@ public class OwnerCheckTest extends AAISetup {
 
         Vertex selfV = g.traversal().V().has("aai-node-type", "pnf").next();
 
-        DBSerializer serializer =
-            new DBSerializer(schemaVersions.getDefaultVersion(),
-                spy, introspectorFactoryType,
+        DBSerializer serializer = new DBSerializer(schemaVersions.getDefaultVersion(), spy, introspectorFactoryType,
                 "AAI_TEST", new HashSet<>(Arrays.asList("OperatorIII", "Operator")));
 
         OwnerCheck ownerCheck = new OwnerCheck(obj, selfV, spy, serializer);
@@ -189,7 +170,7 @@ public class OwnerCheckTest extends AAISetup {
     }
 
     @Test
-    public void shouldPassIfGroupsIsEmpty() throws Exception  {
+    public void shouldPassIfGroupsIsEmpty() throws Exception {
 
         final Loader loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion());
         final Introspector obj = loader.introspectorFromName("pnf");
@@ -203,9 +184,7 @@ public class OwnerCheckTest extends AAISetup {
         when(spy.asAdmin()).thenReturn(adminSpy);
         when(adminSpy.getTraversalSource()).thenReturn(traversal);
         DBSerializer serializer =
-            new DBSerializer(schemaVersions.getDefaultVersion(),
-                spy, introspectorFactoryType,
-                "AAI_TEST");
+                new DBSerializer(schemaVersions.getDefaultVersion(), spy, introspectorFactoryType, "AAI_TEST");
 
         Vertex selfV = g.traversal().V().has("aai-node-type", "pnf").next();
 
@@ -217,7 +196,7 @@ public class OwnerCheckTest extends AAISetup {
     }
 
     @Test
-    public void shouldPassIfDataOwnerIsNull() throws Exception  {
+    public void shouldPassIfDataOwnerIsNull() throws Exception {
 
         final Loader loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion());
         final Introspector obj = loader.introspectorFromName("pnf");
@@ -232,9 +211,7 @@ public class OwnerCheckTest extends AAISetup {
         when(spy.asAdmin()).thenReturn(adminSpy);
         when(adminSpy.getTraversalSource()).thenReturn(traversal);
         DBSerializer serializer =
-            new DBSerializer(schemaVersions.getDefaultVersion(),
-                spy, introspectorFactoryType,
-                "AAI_TEST");
+                new DBSerializer(schemaVersions.getDefaultVersion(), spy, introspectorFactoryType, "AAI_TEST");
 
         Vertex selfV = g.traversal().V().has("aai-node-type", "pnf").next();
 
@@ -246,7 +223,7 @@ public class OwnerCheckTest extends AAISetup {
     }
 
     @Test
-    public void shouldPassIfDataOwnerIsEmpty() throws Exception  {
+    public void shouldPassIfDataOwnerIsEmpty() throws Exception {
 
         final Loader loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion());
         final Introspector obj = loader.introspectorFromName("pnf");
@@ -261,9 +238,7 @@ public class OwnerCheckTest extends AAISetup {
         when(spy.asAdmin()).thenReturn(adminSpy);
         when(adminSpy.getTraversalSource()).thenReturn(traversal);
         DBSerializer serializer =
-            new DBSerializer(schemaVersions.getDefaultVersion(),
-                spy, introspectorFactoryType,
-                "AAI_TEST");
+                new DBSerializer(schemaVersions.getDefaultVersion(), spy, introspectorFactoryType, "AAI_TEST");
 
         Vertex selfV = g.traversal().V().has("aai-node-type", "pnf").next();
 
index 6a7bfd3..edace19 100644 (file)
 
 package org.onap.aai.introspection.sideeffect;
 
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.not;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.StringContains.containsString;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -43,20 +57,6 @@ import org.onap.aai.serialization.engines.QueryStyle;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
 import org.springframework.test.annotation.DirtiesContext;
 
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.empty;
-import static org.hamcrest.Matchers.not;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.StringContains.containsString;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
 @RunWith(value = Parameterized.class)
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class PrivateEdgeTest extends AAISetup {
@@ -84,49 +84,30 @@ public class PrivateEdgeTest extends AAISetup {
         System.setProperty("AJSC_HOME", ".");
         System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local");
 
-        graph.traversal()
-            .addV()
-            .property("aai-node-type", "model")
-            .property("model-invariant-id", "key1")
-            .property(AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key1")
-            .as("v1")
-            .addV()
-            .property("aai-node-type", "model-ver")
-            .property("model-ver", "myValue")
-            .property("model-version-id", "key2")
-            .property("model-version", "testValue")
-            .property(AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key1/model-vers/model-ver/key2")
-            .as("v2")
-            .addE("org.onap.relationships.inventory.BelongsTo").to("v1").from("v2")
-            .property(EdgeProperty.CONTAINS.toString(), true)
-            .addV()
-            .property("aai-node-type", "model")
-            .property("model-invariant-id", "key100")
-            .property(AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key100")
-            .as("v3")
-            .addV()
-            .property("aai-node-type", "model-ver")
-            .property("model-ver", "myValue")
-            .property("model-version-id", "key200")
-            .property("model-version", "testValue")
-            .property(AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key100/model-vers/model-ver/key200")
-            .as("v4")
-            .addE("org.onap.relationships.inventory.BelongsTo").to("v3").from("v4")
-            .property(EdgeProperty.CONTAINS.toString(), true)
-            .addV()
-            .property("aai-node-type", "model")
-            .property("model-invariant-id", "key3")
-            .property(AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key3")
-            .as("v5")
-            .addV()
-            .property("aai-node-type", "model-ver")
-            .property("model-ver", "myValue")
-            .property("model-version-id", "key4")
-            .property(AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key3/model-vers/model-ver/key4")
-            .as("v6")
-            .addE("org.onap.relationships.inventory.BelongsTo").to("v5").from("v6")
-            .property(EdgeProperty.CONTAINS.toString(), true)
-            .next();
+        graph.traversal().addV().property("aai-node-type", "model").property("model-invariant-id", "key1")
+                .property(AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key1").as("v1").addV()
+                .property("aai-node-type", "model-ver").property("model-ver", "myValue")
+                .property("model-version-id", "key2").property("model-version", "testValue")
+                .property(AAIProperties.AAI_URI,
+                        "/service-design-and-creation/models/model/key1/model-vers/model-ver/key2")
+                .as("v2").addE("org.onap.relationships.inventory.BelongsTo").to("v1").from("v2")
+                .property(EdgeProperty.CONTAINS.toString(), true).addV().property("aai-node-type", "model")
+                .property("model-invariant-id", "key100")
+                .property(AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key100").as("v3").addV()
+                .property("aai-node-type", "model-ver").property("model-ver", "myValue")
+                .property("model-version-id", "key200").property("model-version", "testValue")
+                .property(AAIProperties.AAI_URI,
+                        "/service-design-and-creation/models/model/key100/model-vers/model-ver/key200")
+                .as("v4").addE("org.onap.relationships.inventory.BelongsTo").to("v3").from("v4")
+                .property(EdgeProperty.CONTAINS.toString(), true).addV().property("aai-node-type", "model")
+                .property("model-invariant-id", "key3")
+                .property(AAIProperties.AAI_URI, "/service-design-and-creation/models/model/key3").as("v5").addV()
+                .property("aai-node-type", "model-ver").property("model-ver", "myValue")
+                .property("model-version-id", "key4")
+                .property(AAIProperties.AAI_URI,
+                        "/service-design-and-creation/models/model/key3/model-vers/model-ver/key4")
+                .as("v6").addE("org.onap.relationships.inventory.BelongsTo").to("v5").from("v6")
+                .property(EdgeProperty.CONTAINS.toString(), true).next();
         graph.tx().commit();
     }
 
@@ -138,7 +119,8 @@ public class PrivateEdgeTest extends AAISetup {
 
     @Before
     public void initMock() {
-        Loader loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
+        Loader loader =
+                loaderFactory.createLoaderForVersion(introspectorFactoryType, schemaVersions.getDefaultVersion());
         MockitoAnnotations.initMocks(this);
         dbEngine = new JanusGraphDBEngine(queryStyle, loader);
     }
@@ -157,12 +139,8 @@ public class PrivateEdgeTest extends AAISetup {
         when(spy.asAdmin()).thenReturn(adminSpy);
         when(adminSpy.getTraversalSource()).thenReturn(traversal);
 
-        Vertex selfV = traversal.addV("generic-vnf")
-            .property("aai-node-type", "generic-vnf")
-            .property("vnf-id", "myId")
-            .property("aai-uri", obj.getURI())
-            .property("model-invariant-id", "key1")
-            .next();
+        Vertex selfV = traversal.addV("generic-vnf").property("aai-node-type", "generic-vnf").property("vnf-id", "myId")
+                .property("aai-uri", obj.getURI()).property("model-invariant-id", "key1").next();
 
         thrown.expectMessage(containsString("Cannot complete privateEdge uri"));
         DBSerializer serializer =
index 8b66d9a..bc222ec 100644 (file)
@@ -27,6 +27,7 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.util.List;
+
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
index 7bb3879..88e148f 100644 (file)
@@ -33,8 +33,6 @@ import org.onap.aai.introspection.*;
 import org.onap.aai.introspection.tools.IntrospectorValidator;
 import org.onap.aai.introspection.tools.Issue;
 import org.onap.aai.introspection.tools.IssueType;
-import org.onap.aai.serialization.queryformats.QueryFormatTestHelper;
-import org.onap.aai.util.AAIConstants;
 import org.springframework.beans.factory.annotation.Autowired;
 
 public class IntrospectorValidationTest extends AAISetup {
index 72b1150..e6f498d 100644 (file)
 
 package org.onap.aai.logging;
 
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.*;
+
 import ch.qos.logback.access.spi.IAccessEvent;
+
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.*;
-
 public class DME2RestFlagTest {
 
     IAccessEvent mockAccEvent;
index cbe5bc6..82522d5 100644 (file)
 
 package org.onap.aai.logging;
 
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
 import javax.ws.rs.core.Response.Status;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import org.junit.Test;
 
 public class ErrorObjectTest {
 
index 1f34731..b038b72 100644 (file)
@@ -46,7 +46,6 @@ import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
-import org.onap.aai.AAISetup;
 import org.onap.aai.DataLinkSetup;
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.exceptions.AAIException;
index e8ccddd..82ad294 100644 (file)
 
 package org.onap.aai.parsers.query;
 
+import static org.junit.Assert.assertEquals;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+
+import javax.ws.rs.core.UriBuilder;
+import javax.xml.bind.JAXBException;
+
 import org.junit.Ignore;
 import org.junit.Test;
 import org.onap.aai.AAISetup;
@@ -30,13 +38,6 @@ import org.onap.aai.serialization.engines.QueryStyle;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
 import org.onap.aai.setup.SchemaVersion;
 
-import javax.ws.rs.core.UriBuilder;
-import javax.xml.bind.JAXBException;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-
-import static org.junit.Assert.assertEquals;
-
 @Ignore
 public class LegacyQueryTest extends AAISetup {
 
index f19e268..f9055b1 100644 (file)
@@ -35,7 +35,6 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.onap.aai.AAISetup;
-import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.*;
 import org.onap.aai.parsers.exceptions.DoesNotStartWithValidNamespaceException;
index c28d5a7..52aa470 100644 (file)
@@ -37,11 +37,9 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.onap.aai.AAISetup;
-import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.*;
 import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
-import org.onap.aai.schema.enums.ObjectMetadata;
 import org.onap.aai.setup.SchemaVersion;
 import org.springframework.test.annotation.DirtiesContext;
 
index 8ff021e..7f6e561 100644 (file)
@@ -27,6 +27,8 @@ import static org.junit.Assert.assertThat;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.eq;
 
+import com.google.gson.Gson;
+
 import java.io.IOException;
 import java.net.ConnectException;
 import java.net.SocketTimeoutException;
@@ -44,8 +46,6 @@ import org.springframework.boot.test.rule.OutputCapture;
 import org.springframework.http.HttpMethod;
 import org.springframework.http.ResponseEntity;
 
-import com.google.gson.Gson;
-
 public class ValidationServiceTest {
 
     private RestClient restClient;
@@ -77,62 +77,48 @@ public class ValidationServiceTest {
     }
 
     @Test
-    public void testPreValidateWithSuccessRequestAndServiceIsDownAndShouldErrorWithConnectionRefused() throws IOException, AAIException {
+    public void testPreValidateWithSuccessRequestAndServiceIsDownAndShouldErrorWithConnectionRefused()
+            throws IOException, AAIException {
 
         String pserverRequest = PayloadUtil.getResourcePayload("prevalidation/success-request-with-no-violations.json");
 
-        Mockito
-            .when(
-                restClient.execute(
-                    eq(ValidationService.VALIDATION_ENDPOINT),
-                    eq(HttpMethod.POST),
-                    any(),
-                    eq(pserverRequest)
-                )
-            ).thenThrow(new RuntimeException(new ConnectException("Connection refused")));
+        Mockito.when(restClient.execute(eq(ValidationService.VALIDATION_ENDPOINT), eq(HttpMethod.POST), any(),
+                eq(pserverRequest))).thenThrow(new RuntimeException(new ConnectException("Connection refused")));
 
         validationService.preValidate(pserverRequest);
 
-        assertThat(capture.toString(), containsString("Connection refused to the validation microservice due to service unreachable"));
+        assertThat(capture.toString(),
+                containsString("Connection refused to the validation microservice due to service unreachable"));
     }
 
     @Test
-    public void testPreValidateWithSuccessRequestAndServiceIsUnreachableAndShouldErrorWithConnectionTimeout() throws IOException, AAIException {
+    public void testPreValidateWithSuccessRequestAndServiceIsUnreachableAndShouldErrorWithConnectionTimeout()
+            throws IOException, AAIException {
 
         String pserverRequest = PayloadUtil.getResourcePayload("prevalidation/success-request-with-no-violations.json");
 
-        Mockito
-            .when(
-                restClient.execute(
-                    eq(ValidationService.VALIDATION_ENDPOINT),
-                    eq(HttpMethod.POST),
-                    any(),
-                    eq(pserverRequest)
-                )
-            ).thenThrow(new RuntimeException(new ConnectTimeoutException("Connection timed out")));
+        Mockito.when(restClient.execute(eq(ValidationService.VALIDATION_ENDPOINT), eq(HttpMethod.POST), any(),
+                eq(pserverRequest)))
+                .thenThrow(new RuntimeException(new ConnectTimeoutException("Connection timed out")));
 
         validationService.preValidate(pserverRequest);
 
-        assertThat(capture.toString(), containsString("Connection timeout to the validation microservice as this could indicate the server is unable to reach port"));
+        assertThat(capture.toString(), containsString(
+                "Connection timeout to the validation microservice as this could indicate the server is unable to reach port"));
     }
 
     @Test
-    public void testPreValidateWithSuccessRequestAndRespondSuccessfullyWithinAllowedTime() throws IOException, AAIException {
+    public void testPreValidateWithSuccessRequestAndRespondSuccessfullyWithinAllowedTime()
+            throws IOException, AAIException {
 
         String pserverRequest = PayloadUtil.getResourcePayload("prevalidation/success-request-with-no-violations.json");
-        String validationResponse = PayloadUtil.getResourcePayload("prevalidation/success-response-with-empty-violations.json");
+        String validationResponse =
+                PayloadUtil.getResourcePayload("prevalidation/success-response-with-empty-violations.json");
 
         ResponseEntity responseEntity = Mockito.mock(ResponseEntity.class, Mockito.RETURNS_DEEP_STUBS);
 
-        Mockito
-            .when(
-                restClient.execute(
-                    eq(ValidationService.VALIDATION_ENDPOINT),
-                    eq(HttpMethod.POST),
-                    any(),
-                    eq(pserverRequest)
-                )
-            ).thenReturn(responseEntity);
+        Mockito.when(restClient.execute(eq(ValidationService.VALIDATION_ENDPOINT), eq(HttpMethod.POST), any(),
+                eq(pserverRequest))).thenReturn(responseEntity);
 
         Mockito.when(responseEntity.getStatusCodeValue()).thenReturn(200);
         Mockito.when(responseEntity.getBody()).thenReturn(validationResponse);
@@ -145,23 +131,20 @@ public class ValidationServiceTest {
     }
 
     @Test
-    public void testPreValidateWithSuccessRequestAndServiceIsAvailableAndRequestIsTakingTooLongAndClientShouldTimeout() throws IOException, AAIException {
+    public void testPreValidateWithSuccessRequestAndServiceIsAvailableAndRequestIsTakingTooLongAndClientShouldTimeout()
+            throws IOException, AAIException {
 
         String pserverRequest = PayloadUtil.getResourcePayload("prevalidation/success-request-with-no-violations.json");
 
-        Mockito
-            .when(
-                restClient.execute(
-                    eq(ValidationService.VALIDATION_ENDPOINT),
-                    eq(HttpMethod.POST),
-                    any(),
-                    eq(pserverRequest)
-                )
-            ).thenThrow(new RuntimeException(new SocketTimeoutException("Request timed out due to taking longer than client expected")));
+        Mockito.when(restClient.execute(eq(ValidationService.VALIDATION_ENDPOINT), eq(HttpMethod.POST), any(),
+                eq(pserverRequest)))
+                .thenThrow(new RuntimeException(
+                        new SocketTimeoutException("Request timed out due to taking longer than client expected")));
 
         validationService.preValidate(pserverRequest);
 
-        assertThat(capture.toString(), containsString("Request to validation service took longer than the currently set timeout"));
+        assertThat(capture.toString(),
+                containsString("Request to validation service took longer than the currently set timeout"));
     }
 
     @Test
@@ -173,13 +156,15 @@ public class ValidationServiceTest {
         List<String> errorMessages = validationService.extractViolations(validation);
         assertNotNull("Expected the error messages to be not null", errorMessages);
         assertThat(errorMessages.size(), is(1));
-        assertThat(errorMessages.get(0), is("Invalid nf values, check nf-type, nf-role, nf-function, and nf-naming-code"));
+        assertThat(errorMessages.get(0),
+                is("Invalid nf values, check nf-type, nf-role, nf-function, and nf-naming-code"));
     }
 
     @Test
     public void testErrorMessagesAreEmptyListWhenViolationsReturnEmptyList() throws IOException {
 
-        String genericVnfRequest = PayloadUtil.getResourcePayload("prevalidation/success-response-with-empty-violations.json");
+        String genericVnfRequest =
+                PayloadUtil.getResourcePayload("prevalidation/success-response-with-empty-violations.json");
 
         Validation validation = gson.fromJson(genericVnfRequest, Validation.class);
         List<String> errorMessages = validationService.extractViolations(validation);
@@ -190,7 +175,8 @@ public class ValidationServiceTest {
     @Test
     public void testErrorMessagesAreEmptyListWhenViolationsIsNotFoundInJson() throws IOException {
 
-        String genericVnfRequest = PayloadUtil.getResourcePayload("prevalidation/success-response-with-exclude-violations.json");
+        String genericVnfRequest =
+                PayloadUtil.getResourcePayload("prevalidation/success-response-with-exclude-violations.json");
 
         Validation validation = gson.fromJson(genericVnfRequest, Validation.class);
         List<String> errorMessages = validationService.extractViolations(validation);
index 2d6e229..c09c7b5 100644 (file)
@@ -33,7 +33,6 @@ import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.aai.AAISetup;
-import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.edges.enums.EdgeType;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.Loader;
index 6be9dc0..3803554 100644 (file)
@@ -24,7 +24,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.Path;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.introspection.ModelType;
 
 public class GremlinTraversalTest extends QueryBuilderTestAbstraction {
index 44d812c..6d10115 100644 (file)
 
 package org.onap.aai.query.builder;
 
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
 import org.apache.tinkerpop.gremlin.process.traversal.Path;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
@@ -54,19 +63,11 @@ import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
-import static org.junit.Assert.*;
-
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(
         classes = {ConfigConfiguration.class, QueryTestsConfigTranslator.class, NodeIngestor.class, EdgeIngestor.class,
-                EdgeSerializer.class, SpringContextAware.class, IntrospectionConfig.class, XmlFormatTransformerConfiguration.class})
+                EdgeSerializer.class, SpringContextAware.class, IntrospectionConfig.class,
+                XmlFormatTransformerConfiguration.class})
 @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
 @TestPropertySource(
         properties = {"schema.translator.list = config", "schema.nodes.location=src/test/resources/onap/oxm",
@@ -121,12 +122,12 @@ public abstract class QueryBuilderTestAbstraction {
     protected GraphTraversal<Vertex, Vertex> addVHelper(GraphTraversalSource gts, String label, Object... props) {
         for (int i = 0; i < props.length; i++) {
             if (props[i].equals(AAIProperties.NODE_TYPE)) {
-                label = props[i+1].toString();
+                label = props[i + 1].toString();
             }
         }
         GraphTraversal<Vertex, Vertex> v = gts.addV(label);
-        for (int i = 0; i < props.length; i+=2) {
-            v.property(props[i], props[i+1]);
+        for (int i = 0; i < props.length; i += 2) {
+            v.property(props[i], props[i + 1]);
         }
         return v;
     }
@@ -148,8 +149,10 @@ public abstract class QueryBuilderTestAbstraction {
     @Test
     public void createEdgeLinterfaceToLogicalLinkTraversal() throws AAIException {
 
-        Vertex lInterface = this.addVHelper(g, "vertex", "aai-node-type", "l-interface", "interface-name", "l-interface-a").next();
-        Vertex logicalLink = this.addVHelper(g, "vertex", "aai-node-type", "logical-link", "link-name", "logical-link-a").next();
+        Vertex lInterface =
+                this.addVHelper(g, "vertex", "aai-node-type", "l-interface", "interface-name", "l-interface-a").next();
+        Vertex logicalLink =
+                this.addVHelper(g, "vertex", "aai-node-type", "logical-link", "link-name", "logical-link-a").next();
         testEdgeSer.addEdge(g, lInterface, logicalLink, "sourceLInterface");
 
         QueryBuilder<Vertex> tQ = getNewVertexTraversalWithTestEdgeRules(lInterface);
@@ -164,8 +167,10 @@ public abstract class QueryBuilderTestAbstraction {
     @SuppressWarnings("rawtypes")
     @Test
     public void createEdgeLinterfaceToLogicalLinkTraversal_tree() throws AAIException {
-        Vertex lInterface = this.addVHelper(g, "vertex", "aai-node-type", "l-interface", "interface-name", "l-interface-a").next();
-        Vertex logicalLink = this.addVHelper(g, "vertex", "aai-node-type", "logical-link", "link-name", "logical-link-a").next();
+        Vertex lInterface =
+                this.addVHelper(g, "vertex", "aai-node-type", "l-interface", "interface-name", "l-interface-a").next();
+        Vertex logicalLink =
+                this.addVHelper(g, "vertex", "aai-node-type", "logical-link", "link-name", "logical-link-a").next();
         testEdgeSer.addEdge(g, lInterface, logicalLink, "sourceLInterface");
 
         QueryBuilder<Tree> tQ = getNewTreeTraversalWithTestEdgeRules(lInterface).createEdgeTraversal(EdgeType.COUSIN,
@@ -183,9 +188,12 @@ public abstract class QueryBuilderTestAbstraction {
     @SuppressWarnings("rawtypes")
     @Test
     public void createEdgeLinterfaceToLogicalLinkTraversal_Path() throws AAIException {
-        Vertex pInterface = this.addVHelper(g, "vertex", "aai-node-type", "p-interface", "interface-name", "p-interface-a").next();
-        Vertex lInterface = this.addVHelper(g, "vertex", "aai-node-type", "l-interface", "interface-name", "l-interface-a").next();
-        Vertex logicalLink = this.addVHelper(g, "vertex", "aai-node-type", "logical-link", "link-name", "logical-link-a").next();
+        Vertex pInterface =
+                this.addVHelper(g, "vertex", "aai-node-type", "p-interface", "interface-name", "p-interface-a").next();
+        Vertex lInterface =
+                this.addVHelper(g, "vertex", "aai-node-type", "l-interface", "interface-name", "l-interface-a").next();
+        Vertex logicalLink =
+                this.addVHelper(g, "vertex", "aai-node-type", "logical-link", "link-name", "logical-link-a").next();
         testEdgeSer.addEdge(g, lInterface, logicalLink);
         testEdgeSer.addTreeEdge(g, pInterface, lInterface);
 
@@ -203,8 +211,10 @@ public abstract class QueryBuilderTestAbstraction {
     @SuppressWarnings("rawtypes")
     @Test
     public void parentVertexTest() throws AAIException {
-        Vertex pInterface = this.addVHelper(g, "vertex", "aai-node-type", "p-interface", "interface-name", "p-interface-a").next();
-        Vertex lInterface = this.addVHelper(g, "vertex", "aai-node-type", "l-interface", "interface-name", "l-interface-a").next();
+        Vertex pInterface =
+                this.addVHelper(g, "vertex", "aai-node-type", "p-interface", "interface-name", "p-interface-a").next();
+        Vertex lInterface =
+                this.addVHelper(g, "vertex", "aai-node-type", "l-interface", "interface-name", "l-interface-a").next();
 
         testEdgeSer.addTreeEdge(g, pInterface, lInterface);
 
@@ -217,8 +227,10 @@ public abstract class QueryBuilderTestAbstraction {
     @Test
     public void createEdgeLinterfaceToLogicalLinkIntrospectorTraversal() throws AAIException {
 
-        Vertex lInterface = this.addVHelper(g, "vertex", "aai-node-type", "l-interface", "interface-name", "l-interface-a").next();
-        Vertex logicalLink = this.addVHelper(g, "vertex", "aai-node-type", "logical-link", "link-name", "logical-link-a").next();
+        Vertex lInterface =
+                this.addVHelper(g, "vertex", "aai-node-type", "l-interface", "interface-name", "l-interface-a").next();
+        Vertex logicalLink =
+                this.addVHelper(g, "vertex", "aai-node-type", "logical-link", "link-name", "logical-link-a").next();
         testEdgeSer.addEdge(g, lInterface, logicalLink, "sourceLInterface");
 
         QueryBuilder<Vertex> tQ = getNewVertexTraversalWithTestEdgeRules(lInterface);
@@ -234,8 +246,10 @@ public abstract class QueryBuilderTestAbstraction {
     @Test
     public void createEdgeLinterfaceToLogicalLinkVertexToIntrospectorTraversal() throws AAIException {
 
-        Vertex lInterface = this.addVHelper(g, "vertex", "aai-node-type", "l-interface", "interface-name", "l-interface-a").next();
-        Vertex logicalLink = this.addVHelper(g, "vertex", "aai-node-type", "logical-link", "link-name", "logical-link-a").next();
+        Vertex lInterface =
+                this.addVHelper(g, "vertex", "aai-node-type", "l-interface", "interface-name", "l-interface-a").next();
+        Vertex logicalLink =
+                this.addVHelper(g, "vertex", "aai-node-type", "logical-link", "link-name", "logical-link-a").next();
         testEdgeSer.addEdge(g, lInterface, logicalLink, "sourceLInterface");
 
         QueryBuilder<Vertex> tQ = getNewVertexTraversalWithTestEdgeRules(lInterface);
@@ -385,7 +399,7 @@ public abstract class QueryBuilderTestAbstraction {
         this.addVHelper(g, "vertex", "aai-node-type", "vnfc", "vnfc-name", "b-name").next();
 
         QueryBuilder<Vertex> tQ = new GremlinTraversal<>(loader, g);
-        tQ.getVerticesByCommaSeperatedValue("vnfc-name","a-name, b-name");
+        tQ.getVerticesByCommaSeperatedValue("vnfc-name", "a-name, b-name");
 
         List<Vertex> list = tQ.toList();
 
@@ -506,7 +520,8 @@ public abstract class QueryBuilderTestAbstraction {
     public void edgeToVertexMultiRuleInTraversalTest() throws AAIException {
 
         Vertex gvnf = this.addVHelper(g, "vertex", "aai-node-type", "generic-vnf", "vnf-id", "gvnf").next();
-        Vertex complex = this.addVHelper(g, "vertex", "aai-node-type", "complex", "physical-location-id", "a-name").next();
+        Vertex complex =
+                this.addVHelper(g, "vertex", "aai-node-type", "complex", "physical-location-id", "a-name").next();
 
         testEdgeSer.addEdge(g, gvnf, complex);
         testEdgeSer.addEdge(g, gvnf, complex, "complex-generic-vnf-B");
@@ -581,7 +596,8 @@ public abstract class QueryBuilderTestAbstraction {
     public void edgeTraversalMultiRuleInTraversalTest() throws AAIException {
 
         Vertex gvnf = this.addVHelper(g, "vertex", "aai-node-type", "generic-vnf", "vnf-id", "gvnf").next();
-        Vertex complex = this.addVHelper(g, "vertex", "aai-node-type", "complex", "physical-location-id", "a-name").next();
+        Vertex complex =
+                this.addVHelper(g, "vertex", "aai-node-type", "complex", "physical-location-id", "a-name").next();
 
         Edge e1 = testEdgeSer.addEdge(g, gvnf, complex);
         Edge e2 = testEdgeSer.addEdge(g, gvnf, complex, "complex-generic-vnf-B");
@@ -754,7 +770,8 @@ public abstract class QueryBuilderTestAbstraction {
         QueryBuilder<Edge> tQ = getNewEdgeTraversalWithTestEdgeRules(gvnf);
         tQ.createEdgeTraversal(EdgeType.COUSIN, "generic-vnf", "pserver");
 
-        List<Vertex> list = tQ.createEdgeTraversalIfParameterIsPresent(EdgeType.COUSIN, "pserver", "vce", "optional").toList();
+        List<Vertex> list =
+                tQ.createEdgeTraversalIfParameterIsPresent(EdgeType.COUSIN, "pserver", "vce", "optional").toList();
         assertEquals("Has 1 vertex ", 1, list.size());
         assertTrue("result has optional-vce vertex ", list.contains(optionalVce));
     }
@@ -775,14 +792,14 @@ public abstract class QueryBuilderTestAbstraction {
         tQ.createEdgeTraversal(EdgeType.COUSIN, "generic-vnf", "pserver");
         MissingOptionalParameter missingParameter = MissingOptionalParameter.getInstance();
 
-        List<Vertex> list = tQ.createEdgeTraversalIfParameterIsPresent(EdgeType.COUSIN, "pserver", "vce", missingParameter).toList();
+        List<Vertex> list = tQ
+                .createEdgeTraversalIfParameterIsPresent(EdgeType.COUSIN, "pserver", "vce", missingParameter).toList();
         assertEquals("Has 2 vertices ", 2, list.size());
         assertTrue("result has pserver-1 vertex ", list.contains(pserver1));
         assertTrue("result has pserver-2 vertex ", list.contains(pserver2));
         assertTrue("result does not have optional-vce vertex ", !list.contains(optionalVce));
     }
 
-
     protected abstract QueryBuilder<Edge> getNewEdgeTraversalWithTestEdgeRules(Vertex v);
 
     protected abstract QueryBuilder<Edge> getNewEdgeTraversalWithTestEdgeRules();
index 3661f3d..2a213f2 100644 (file)
@@ -26,7 +26,6 @@ import org.onap.aai.AbstractConfigTranslator;
 import org.onap.aai.setup.SchemaConfigVersions;
 import org.onap.aai.setup.SchemaLocationsBean;
 import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersions;
 
 /**
  * So the query tests can access their edge rule file
index 4eac35e..eca5c54 100644 (file)
 
 package org.onap.aai.query.builder;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+
 import org.apache.tinkerpop.gremlin.process.traversal.Path;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
@@ -32,14 +40,6 @@ import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.edges.enums.EdgeType;
 import org.onap.aai.exceptions.AAIException;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 public class TraversalQueryTest extends QueryBuilderTestAbstraction {
 
     @Override
@@ -242,7 +242,8 @@ public class TraversalQueryTest extends QueryBuilderTestAbstraction {
     public void abstractEdgeToVertexMultiRuleInTraversalTest() throws AAIException {
 
         Vertex gvnf = this.addVHelper(g, "vertex", "aai-node-type", "generic-vnf", "vnf-id", "gvnf").next();
-        Vertex complex = this.addVHelper(g, "vertex", "aai-node-type", "complex", "physical-location-id", "a-name").next();
+        Vertex complex =
+                this.addVHelper(g, "vertex", "aai-node-type", "complex", "physical-location-id", "a-name").next();
 
         testEdgeSer.addEdge(g, gvnf, complex);
         testEdgeSer.addEdge(g, gvnf, complex, "complex-generic-vnf-B");
index dcf11ba..f0486e4 100644 (file)
@@ -33,7 +33,6 @@ import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.aai.AAISetup;
-import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.edges.enums.EdgeType;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.Loader;
index b517ced..f90bb5f 100644 (file)
 
 package org.onap.aai.query.builder.optimization;
 
+import static org.junit.Assert.assertEquals;
+
 import com.google.common.base.CaseFormat;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -40,14 +49,6 @@ import org.onap.aai.serialization.engines.QueryStyle;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Random;
-
-import static org.junit.Assert.assertEquals;
-
 public abstract class AbstractGraphTraversalBuilderOptmizationTest extends AAISetup {
 
     protected static final List<String> RANDOM_VALUES = Arrays.asList("A", "B", "C", "D", "E");
@@ -104,12 +105,10 @@ public abstract class AbstractGraphTraversalBuilderOptmizationTest extends AAISe
         for (int crCtr = 0; crCtr < 3; crCtr++) {
             crUri = String.format(crUriPattern, prefix + "cloud-owner-" + crCtr, prefix + "cloud-region-id-" + crCtr);
             // System.out.println(crUri);
-            cr = g.addV(CLOUD_REGION)
-                .property(AAIProperties.NODE_TYPE, CLOUD_REGION)
-                .property(CLOUD_REGION_ID, prefix + "cloud-region-id-" + crCtr)
-                .property(CLOUD_OWNER, prefix + "cloud-owner-" + crCtr)
-                .property(AAIProperties.AAI_URI, crUri)
-                .next();
+            cr = g.addV(CLOUD_REGION).property(AAIProperties.NODE_TYPE, CLOUD_REGION)
+                    .property(CLOUD_REGION_ID, prefix + "cloud-region-id-" + crCtr)
+                    .property(CLOUD_OWNER, prefix + "cloud-owner-" + crCtr).property(AAIProperties.AAI_URI, crUri)
+                    .next();
             for (int i = 0; i < tenantNum; i++) {
                 Introspector intro = loader.introspectorFromName(TENANT);
                 tenant = dbser.createNewVertex(intro);
index 3447720..8cf112a 100644 (file)
@@ -22,8 +22,6 @@ package org.onap.aai.rest;
 
 import static org.junit.Assert.assertEquals;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.jayway.jsonpath.JsonPath;
 
 import java.util.*;
@@ -40,6 +38,8 @@ import org.onap.aai.HttpTestUtil;
 import org.onap.aai.PayloadUtil;
 import org.onap.aai.serialization.engines.QueryStyle;
 import org.skyscreamer.jsonassert.JSONAssert;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @Ignore
 @RunWith(AAIJunitRunner.class)
index 2b7a581..e6664e1 100644 (file)
 
 package org.onap.aai.rest;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.*;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.ws.rs.core.Response;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.janusgraph.core.JanusGraphTransaction;
 import org.json.JSONObject;
@@ -40,19 +50,10 @@ import org.onap.aai.rest.ueb.NotificationEvent;
 import org.onap.aai.rest.ueb.UEBNotification;
 import org.onap.aai.serialization.engines.QueryStyle;
 import org.skyscreamer.jsonassert.JSONAssert;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.test.annotation.DirtiesContext;
 
-import javax.ws.rs.core.Response;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNot.not;
-import static org.junit.Assert.*;
-
 @RunWith(value = Parameterized.class)
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class ImpliedDeleteIntegrationTest extends AAISetup {
@@ -64,10 +65,7 @@ public class ImpliedDeleteIntegrationTest extends AAISetup {
 
     @Parameterized.Parameters(name = "QueryStyle.{0}")
     public static Collection<Object[]> data() {
-        return Arrays.asList(new Object[][] {
-            { QueryStyle.TRAVERSAL },
-            { QueryStyle.TRAVERSAL_URI }
-        });
+        return Arrays.asList(new Object[][] {{QueryStyle.TRAVERSAL}, {QueryStyle.TRAVERSAL_URI}});
     }
 
     @Test
@@ -102,10 +100,8 @@ public class ImpliedDeleteIntegrationTest extends AAISetup {
         List<NotificationEvent> notificationEvents = notification.getEvents();
         assertThat(notificationEvents.size(), is(5));
 
-        List<String> notificationEventHeaders = notification.getEvents()
-            .stream()
-            .map(event -> event.getEventHeader().marshal(false))
-            .collect(Collectors.toList());
+        List<String> notificationEventHeaders = notification.getEvents().stream()
+                .map(event -> event.getEventHeader().marshal(false)).collect(Collectors.toList());
 
         Long deletedEventsCount = notificationEventHeaders.stream().filter(e -> e.contains("\"DELETE\"")).count();
 
index 1678318..cafca63 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.rest;
 
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.junit.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
+
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.*;
+
+import javax.ws.rs.core.Response;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.janusgraph.core.JanusGraph;
@@ -45,15 +57,6 @@ import org.onap.aai.serialization.engines.QueryStyle;
 import org.skyscreamer.jsonassert.JSONAssert;
 import org.springframework.test.annotation.DirtiesContext;
 
-import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.*;
-
-import static org.hamcrest.CoreMatchers.*;
-import static org.hamcrest.junit.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-
 @RunWith(value = Parameterized.class)
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class NotificationDmaapEventTest extends AAISetup {
@@ -63,14 +66,12 @@ public class NotificationDmaapEventTest extends AAISetup {
 
     @Parameterized.Parameters(name = "QueryStyle.{0}")
     public static Collection<Object[]> data() {
-        return Arrays.asList(new Object[][] {
-            { QueryStyle.TRAVERSAL },
-            { QueryStyle.TRAVERSAL_URI }
-        });
+        return Arrays.asList(new Object[][] {{QueryStyle.TRAVERSAL}, {QueryStyle.TRAVERSAL_URI}});
     }
 
     @Test
-    public void testCreateWithPserverWithAllChildrenAndVerifyMultipleNotificationsWhenNotificationDepthIsZero() throws IOException, AAIException {
+    public void testCreateWithPserverWithAllChildrenAndVerifyMultipleNotificationsWhenNotificationDepthIsZero()
+            throws IOException, AAIException {
 
         String uri = "/aai/v14/cloud-infrastructure/pservers/pserver/example-hostname-val-85598";
         UEBNotification notification = Mockito.spy(new UEBNotification(ModelType.MOXY, loaderFactory, schemaVersions));
@@ -93,15 +94,9 @@ public class NotificationDmaapEventTest extends AAISetup {
 
             String header = event.getEventHeader().marshal(false);
 
-            assertThat(
-                event.getEventHeader().marshal(false),
-                containsString("\"CREATE\"")
-            );
+            assertThat(event.getEventHeader().marshal(false), containsString("\"CREATE\""));
 
-            assertThat(
-                header,
-                containsString("\"top-entity-type\":\"pserver\"")
-            );
+            assertThat(header, containsString("\"top-entity-type\":\"pserver\""));
 
         });
 
@@ -111,7 +106,8 @@ public class NotificationDmaapEventTest extends AAISetup {
 
     // Test existing pserver create new pinterface check dmaap event for pinterface is CREATE
     @Test
-    public void testExistingPserverCreateNewChildPInterfaceAndCheckDmaapEventForPInterfaceIsCreateWhenNotificationDepthIsZero() throws IOException, AAIException {
+    public void testExistingPserverCreateNewChildPInterfaceAndCheckDmaapEventForPInterfaceIsCreateWhenNotificationDepthIsZero()
+            throws IOException, AAIException {
 
         String uri = "/aai/v14/cloud-infrastructure/pservers/pserver/example-hostname-val-85598";
         UEBNotification notification = Mockito.spy(new UEBNotification(ModelType.MOXY, loaderFactory, schemaVersions));
@@ -126,8 +122,7 @@ public class NotificationDmaapEventTest extends AAISetup {
         assertEquals("Expecting the pserver to be created", 201, response.getStatus());
         notification.clearEvents();
 
-
-        response = httpTestUtil.doGet(uri , "all");
+        response = httpTestUtil.doGet(uri, "all");
         assertEquals("Expecting the pserver to be found", 200, response.getStatus());
 
         JSONObject pserverJson = new JSONObject(response.getEntity().toString());
@@ -153,15 +148,18 @@ public class NotificationDmaapEventTest extends AAISetup {
         assertThat(notificationEventHeader, containsString("\"entity-type\":\"p-interface\""));
         assertThat(notificationEventHeader, containsString("\"top-entity-type\":\"pserver\""));
 
-        String expectedNotificationHeader = PayloadUtil.getResourcePayload("notification-dmaap-events/depth-zero/expected-notification-header-create-child-on-existing-obj.json");
-        String expectedNotificationBody = PayloadUtil.getResourcePayload("notification-dmaap-events/depth-zero/expected-notification-body-create-child-on-existing-obj.json");
+        String expectedNotificationHeader = PayloadUtil.getResourcePayload(
+                "notification-dmaap-events/depth-zero/expected-notification-header-create-child-on-existing-obj.json");
+        String expectedNotificationBody = PayloadUtil.getResourcePayload(
+                "notification-dmaap-events/depth-zero/expected-notification-body-create-child-on-existing-obj.json");
 
         JSONAssert.assertEquals(expectedNotificationHeader, notificationEventHeader, false);
         JSONAssert.assertEquals(expectedNotificationBody, notificationEventBody, false);
     }
 
     @Test
-    public void testExistingPserverCreateNewChildPInterfaceAndCheckDmaapEventForPserverIsSentWithNewPInterfaceWhenNotificationDepthIsAll() throws IOException, AAIException {
+    public void testExistingPserverCreateNewChildPInterfaceAndCheckDmaapEventForPserverIsSentWithNewPInterfaceWhenNotificationDepthIsAll()
+            throws IOException, AAIException {
 
         String uri = "/aai/v14/cloud-infrastructure/pservers/pserver/example-hostname-val-85598";
         UEBNotification notification = Mockito.spy(new UEBNotification(ModelType.MOXY, loaderFactory, schemaVersions));
@@ -175,7 +173,7 @@ public class NotificationDmaapEventTest extends AAISetup {
         response = httpTestUtil.doPut(uri, pserverResource);
         assertEquals("Expecting the pserver to be created", 201, response.getStatus());
 
-        response = httpTestUtil.doGet(uri , "all");
+        response = httpTestUtil.doGet(uri, "all");
         assertEquals("Expecting the pserver to be found", 200, response.getStatus());
 
         JSONObject pserverJson = new JSONObject(response.getEntity().toString());
@@ -203,8 +201,10 @@ public class NotificationDmaapEventTest extends AAISetup {
         assertThat(notificationEventHeader, containsString("\"entity-type\":\"pserver\""));
         assertThat(notificationEventHeader, containsString("\"top-entity-type\":\"pserver\""));
 
-        String expectedNotificationHeader = PayloadUtil.getResourcePayload("notification-dmaap-events/depth-all/expected-notification-header-create-child-on-existing-obj.json");
-        String expectedNotificationBody = PayloadUtil.getResourcePayload("notification-dmaap-events/depth-all/expected-notification-body-create-child-on-existing-obj.json");
+        String expectedNotificationHeader = PayloadUtil.getResourcePayload(
+                "notification-dmaap-events/depth-all/expected-notification-header-create-child-on-existing-obj.json");
+        String expectedNotificationBody = PayloadUtil.getResourcePayload(
+                "notification-dmaap-events/depth-all/expected-notification-body-create-child-on-existing-obj.json");
 
         JSONAssert.assertEquals(expectedNotificationHeader, notificationEventHeader, false);
         JSONAssert.assertEquals(expectedNotificationBody, notificationEventBody, false);
@@ -215,20 +215,19 @@ public class NotificationDmaapEventTest extends AAISetup {
 
         // After an pserver's p-interface is updated on the pserver, even though
         // the pserver nothing changed, expecting the pserver resource version to be changed
-        assertThat(
-            "Expecting the new pserver resource version and old resource version to be not same",
-            newPserverResourceVersion,
-            is(not(pserverResourceVersion))
-        );
+        assertThat("Expecting the new pserver resource version and old resource version to be not same",
+                newPserverResourceVersion, is(not(pserverResourceVersion)));
         assertEquals("Expecting the p-interface to be found", 200, response.getStatus());
     }
 
     // Test Bulk Scenario
     @Test
-    public void testBulkScenarioWhereMultipleCreatesAndEnsureNoDuplicationInDmaapEventsWhenNotificationDepthIsZero() throws UnsupportedEncodingException, AAIException {
+    public void testBulkScenarioWhereMultipleCreatesAndEnsureNoDuplicationInDmaapEventsWhenNotificationDepthIsZero()
+            throws UnsupportedEncodingException, AAIException {
 
         String pserverUri = "/aai/v14/cloud-infrastructure/pservers/pserver/random-pserver";
-        String cloudRegionUri = "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/random-cloud-region-owner/random-cloud-region-id";
+        String cloudRegionUri =
+                "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/random-cloud-region-owner/random-cloud-region-id";
 
         UEBNotification notification = Mockito.spy(new UEBNotification(ModelType.MOXY, loaderFactory, schemaVersions));
         HttpTestUtil httpTestUtil = new HttpTestUtil(queryStyle, notification, AAIProperties.MINIMUM_DEPTH);
@@ -252,12 +251,13 @@ public class NotificationDmaapEventTest extends AAISetup {
         });
     }
 
-
     @Test
-    public void testBulkScenarioWhereMultipleCreatesAndEnsureNoDuplicationInDmaapEventsWhenNotificationDepthIsAll() throws UnsupportedEncodingException, AAIException {
+    public void testBulkScenarioWhereMultipleCreatesAndEnsureNoDuplicationInDmaapEventsWhenNotificationDepthIsAll()
+            throws UnsupportedEncodingException, AAIException {
 
         String pserverUri = "/aai/v14/cloud-infrastructure/pservers/pserver/random-pserver";
-        String cloudRegionUri = "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/random-cloud-region-owner/random-cloud-region-id";
+        String cloudRegionUri =
+                "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/random-cloud-region-owner/random-cloud-region-id";
 
         UEBNotification notification = Mockito.spy(new UEBNotification(ModelType.MOXY, loaderFactory, schemaVersions));
         HttpTestUtil httpTestUtil = new HttpTestUtil(queryStyle, notification, AAIProperties.MAXIMUM_DEPTH);
@@ -282,7 +282,8 @@ public class NotificationDmaapEventTest extends AAISetup {
     }
 
     @Test
-    public void testDeleteOnExistingPserverAndCheckIfNotificationDepthIsZeroThatAllEventsHaveDeleteAndThatDepthIsZeroOnEachNotificationEvent() throws IOException, AAIException {
+    public void testDeleteOnExistingPserverAndCheckIfNotificationDepthIsZeroThatAllEventsHaveDeleteAndThatDepthIsZeroOnEachNotificationEvent()
+            throws IOException, AAIException {
         String uri = "/aai/v14/cloud-infrastructure/pservers/pserver/example-hostname-val-85598";
         UEBNotification notification = Mockito.spy(new UEBNotification(ModelType.MOXY, loaderFactory, schemaVersions));
         HttpTestUtil httpTestUtil = new HttpTestUtil(queryStyle);
@@ -295,7 +296,7 @@ public class NotificationDmaapEventTest extends AAISetup {
         response = httpTestUtil.doPut(uri, pserverResource);
         assertEquals("Expecting the pserver to be created", 201, response.getStatus());
 
-        response = httpTestUtil.doGet(uri , "all");
+        response = httpTestUtil.doGet(uri, "all");
         assertEquals("Expecting the pserver to be found", 200, response.getStatus());
 
         JSONObject pserverObject = new JSONObject(response.getEntity().toString());
@@ -312,19 +313,12 @@ public class NotificationDmaapEventTest extends AAISetup {
 
             String header = event.getEventHeader().marshal(false);
 
-            assertThat(
-                event.getEventHeader().marshal(false),
-                containsString("\"DELETE\"")
-            );
+            assertThat(event.getEventHeader().marshal(false), containsString("\"DELETE\""));
 
-            assertThat(
-                header,
-                containsString("\"top-entity-type\":\"pserver\"")
-            );
+            assertThat(header, containsString("\"top-entity-type\":\"pserver\""));
         });
     }
 
-
     @Test
     public void testDeleteOnExistingResourceVersionMismatchNoEventGenerated() throws IOException, AAIException {
         String uri = "/aai/v14/cloud-infrastructure/pservers/pserver/example-hostname-val-85598";
@@ -339,27 +333,27 @@ public class NotificationDmaapEventTest extends AAISetup {
         response = httpTestUtil.doPut(uri, pserverResource);
         assertEquals("Expecting the pserver to be created", 201, response.getStatus());
 
-        response = httpTestUtil.doGet(uri , "all");
+        response = httpTestUtil.doGet(uri, "all");
         assertEquals("Expecting the pserver to be found", 200, response.getStatus());
 
         JSONObject pserverObject = new JSONObject(response.getEntity().toString());
         String resourceVersion = pserverObject.getString("resource-version");
 
         httpTestUtil = new HttpTestUtil(queryStyle, notification, AAIProperties.MINIMUM_DEPTH);
-        response = httpTestUtil.doDelete(uri, resourceVersion+"123");
+        response = httpTestUtil.doDelete(uri, resourceVersion + "123");
         assertEquals("Resource version mismatch exception", 412, response.getStatus());
 
         List<NotificationEvent> notificationEvents = notification.getEvents();
         assertThat(notificationEvents.size(), is(0));
     }
 
-
     // Test notification depth set to all
     // Scenario for testing the creation of pserver with children, grandchildren
     // Default behaviour is for one event to be sent out
     // which includes all the children and grandchildren, etc
     @Test
-    public void testCreateWithPserverWithAllChildrenAndVerifyOneNotificationWhenNotificationDepthIsAll() throws IOException, AAIException {
+    public void testCreateWithPserverWithAllChildrenAndVerifyOneNotificationWhenNotificationDepthIsAll()
+            throws IOException, AAIException {
 
         String uri = "/aai/v14/cloud-infrastructure/pservers/pserver/example-hostname-val-85598";
         UEBNotification notification = Mockito.spy(new UEBNotification(ModelType.MOXY, loaderFactory, schemaVersions));
@@ -380,25 +374,13 @@ public class NotificationDmaapEventTest extends AAISetup {
         // Verify all the events are create since its a new PUT
         String header = notificationEvent.getEventHeader().marshal(false);
 
-        assertThat(
-            header,
-            containsString("\"CREATE\"")
-        );
+        assertThat(header, containsString("\"CREATE\""));
 
-        assertThat(
-            header,
-            containsString("\"entity-type\":\"pserver\"")
-        );
+        assertThat(header, containsString("\"entity-type\":\"pserver\""));
 
-        assertThat(
-            header,
-            containsString("\"top-entity-type\":\"pserver\"")
-        );
+        assertThat(header, containsString("\"top-entity-type\":\"pserver\""));
 
-        assertThat(
-            header,
-            containsString("\"entity-link\":\"" + uri +  "\"")
-        );
+        assertThat(header, containsString("\"entity-link\":\"" + uri + "\""));
 
         response = httpTestUtil.doGet(uri);
         assertEquals("Expecting the pserver to be found", 200, response.getStatus());
@@ -407,7 +389,8 @@ public class NotificationDmaapEventTest extends AAISetup {
     }
 
     @Test
-    public void testPatchExistingPserverWithChildrenAndModifyOnlyOneObjectAndVerifyThatOnlyOneNotificationEventNoChildrenWhenNotificationDepthIsZero() throws IOException, AAIException {
+    public void testPatchExistingPserverWithChildrenAndModifyOnlyOneObjectAndVerifyThatOnlyOneNotificationEventNoChildrenWhenNotificationDepthIsZero()
+            throws IOException, AAIException {
 
         String uri = "/aai/v14/cloud-infrastructure/pservers/pserver/example-hostname-val-85598";
         UEBNotification notification = Mockito.spy(new UEBNotification(ModelType.MOXY, loaderFactory, schemaVersions));
@@ -443,7 +426,8 @@ public class NotificationDmaapEventTest extends AAISetup {
     }
 
     @Test
-    public void testPatchExistingPserverWithChildrenAndModifyOnlyOneObjectAndVerifyThatOnlyOneNotificationEventIncludeChildrenWhenNotificationDepthIsAll() throws IOException, AAIException {
+    public void testPatchExistingPserverWithChildrenAndModifyOnlyOneObjectAndVerifyThatOnlyOneNotificationEventIncludeChildrenWhenNotificationDepthIsAll()
+            throws IOException, AAIException {
 
         String uri = "/aai/v14/cloud-infrastructure/pservers/pserver/example-hostname-val-85598";
         UEBNotification notification = Mockito.spy(new UEBNotification(ModelType.MOXY, loaderFactory, schemaVersions));
@@ -482,7 +466,8 @@ public class NotificationDmaapEventTest extends AAISetup {
     // Scenario where we are only updating one field in p-interface
     // Make sure the parent and children are included
     @Test
-    public void testUpdateExistingPserverWithChildrenAndModifyOnlyOneObjectAndVerifyThatOnlyOneNotificationEventIncludingChildrenWhenNotificationDepthIsAll() throws IOException, AAIException {
+    public void testUpdateExistingPserverWithChildrenAndModifyOnlyOneObjectAndVerifyThatOnlyOneNotificationEventIncludingChildrenWhenNotificationDepthIsAll()
+            throws IOException, AAIException {
 
         String uri = "/aai/v14/cloud-infrastructure/pservers/pserver/example-hostname-val-85598";
         UEBNotification notification = Mockito.spy(new UEBNotification(ModelType.MOXY, loaderFactory, schemaVersions));
@@ -506,7 +491,8 @@ public class NotificationDmaapEventTest extends AAISetup {
         pInterfaceObject.put("equipment-identifier", "new-equipment-identifier");
 
         httpTestUtil = new HttpTestUtil(queryStyle, notification, AAIProperties.MAXIMUM_DEPTH);
-        response = httpTestUtil.doPut(uri + "/p-interfaces/p-interface/example-interface-name-val-46147", pInterfaceObject.toString());
+        response = httpTestUtil.doPut(uri + "/p-interfaces/p-interface/example-interface-name-val-46147",
+                pInterfaceObject.toString());
         assertThat(response.getStatus(), is(200));
 
         // Get the parent uri as the notification event json has parent structure it makes it easy to compare
@@ -524,7 +510,8 @@ public class NotificationDmaapEventTest extends AAISetup {
     // Test notification depth set to 0
     // Scenario where we are only updating one field in p-interface
     @Test
-    public void testUpdateExistingPserverWithChildrenAndModifyOnlyPInterfaceAndVerifyThatOnlyOneNotificationForPInterfaceIsCreatedWhenNotificationDepthIsZero() throws IOException, AAIException {
+    public void testUpdateExistingPserverWithChildrenAndModifyOnlyPInterfaceAndVerifyThatOnlyOneNotificationForPInterfaceIsCreatedWhenNotificationDepthIsZero()
+            throws IOException, AAIException {
 
         String uri = "/aai/v14/cloud-infrastructure/pservers/pserver/example-hostname-val-85598";
         UEBNotification notification = Mockito.spy(new UEBNotification(ModelType.MOXY, loaderFactory, schemaVersions));
@@ -548,7 +535,8 @@ public class NotificationDmaapEventTest extends AAISetup {
         pInterfaceObject.put("equipment-identifier", "new-equipment-identifier");
 
         httpTestUtil = new HttpTestUtil(queryStyle, notification, AAIProperties.MINIMUM_DEPTH);
-        response = httpTestUtil.doPut(uri + "/p-interfaces/p-interface/example-interface-name-val-46147", pInterfaceObject.toString());
+        response = httpTestUtil.doPut(uri + "/p-interfaces/p-interface/example-interface-name-val-46147",
+                pInterfaceObject.toString());
         assertThat(response.getStatus(), is(200));
 
         response = httpTestUtil.doGet(uri);
@@ -562,7 +550,8 @@ public class NotificationDmaapEventTest extends AAISetup {
     }
 
     @Test
-    public void testExistingPserverWithChildAndGenericVnfAndCreateEdgeBetweenThemAndCheckNoChildWhenNotificationDepthIsZero() throws IOException, AAIException {
+    public void testExistingPserverWithChildAndGenericVnfAndCreateEdgeBetweenThemAndCheckNoChildWhenNotificationDepthIsZero()
+            throws IOException, AAIException {
 
         String hostname = "example-hostname-val-85598";
 
@@ -604,11 +593,14 @@ public class NotificationDmaapEventTest extends AAISetup {
         List<NotificationEvent> notificationEvents = notification.getEvents();
         assertThat(notificationEvents.size(), is(2));
 
-        String expectedNotificationHeader = PayloadUtil.getResourcePayload("notification-dmaap-events/depth-zero/expected-notification-header-create-edge-between-pserver-and-generic-vnf.json");
-        String expectedNotificationBody = PayloadUtil.getResourcePayload("notification-dmaap-events/depth-zero/expected-notification-body-create-edge-between-pserver-and-generic-vnf.json");
+        String expectedNotificationHeader = PayloadUtil.getResourcePayload(
+                "notification-dmaap-events/depth-zero/expected-notification-header-create-edge-between-pserver-and-generic-vnf.json");
+        String expectedNotificationBody = PayloadUtil.getResourcePayload(
+                "notification-dmaap-events/depth-zero/expected-notification-body-create-edge-between-pserver-and-generic-vnf.json");
 
-        JSONAssert.assertEquals(expectedNotificationHeader, notificationEvents.get(0).getEventHeader().marshal(false), false);
-        JSONAssert.assertEquals(expectedNotificationBody, notificationEvents.get(0).getObj().marshal(false),  false);
+        JSONAssert.assertEquals(expectedNotificationHeader, notificationEvents.get(0).getEventHeader().marshal(false),
+                false);
+        JSONAssert.assertEquals(expectedNotificationBody, notificationEvents.get(0).getObj().marshal(false), false);
 
         response = httpTestUtil.doGet(genericVnfUri);
 
@@ -617,7 +609,8 @@ public class NotificationDmaapEventTest extends AAISetup {
     }
 
     @Test
-    public void testExistingPserverWithChildAndGenericVnfAndCreateEdgeBetweenThemAndCheckChildrenIncludedWhenNotificationDepthIsAll() throws IOException, AAIException {
+    public void testExistingPserverWithChildAndGenericVnfAndCreateEdgeBetweenThemAndCheckChildrenIncludedWhenNotificationDepthIsAll()
+            throws IOException, AAIException {
 
         String hostname = "example-hostname-val-85598";
 
@@ -659,12 +652,15 @@ public class NotificationDmaapEventTest extends AAISetup {
         List<NotificationEvent> notificationEvents = notification.getEvents();
         assertThat(notificationEvents.size(), is(2));
 
-        String expectedNotificationHeader = PayloadUtil.getResourcePayload("notification-dmaap-events/depth-all/expected-notification-header-create-edge-between-pserver-and-generic-vnf.json");
-        String expectedNotificationBody   = PayloadUtil.getResourcePayload("notification-dmaap-events/depth-all/expected-notification-body-create-edge-between-pserver-and-generic-vnf.json");
+        String expectedNotificationHeader = PayloadUtil.getResourcePayload(
+                "notification-dmaap-events/depth-all/expected-notification-header-create-edge-between-pserver-and-generic-vnf.json");
+        String expectedNotificationBody = PayloadUtil.getResourcePayload(
+                "notification-dmaap-events/depth-all/expected-notification-body-create-edge-between-pserver-and-generic-vnf.json");
 
         System.out.println("Notification Body: " + notificationEvents.get(0).getObj().marshal(false));
-        JSONAssert.assertEquals(expectedNotificationHeader, notificationEvents.get(0).getEventHeader().marshal(false), false);
-        JSONAssert.assertEquals(expectedNotificationBody, notificationEvents.get(0).getObj().marshal(false),  false);
+        JSONAssert.assertEquals(expectedNotificationHeader, notificationEvents.get(0).getEventHeader().marshal(false),
+                false);
+        JSONAssert.assertEquals(expectedNotificationBody, notificationEvents.get(0).getObj().marshal(false), false);
 
         response = httpTestUtil.doGet(genericVnfUri);
 
@@ -673,7 +669,8 @@ public class NotificationDmaapEventTest extends AAISetup {
     }
 
     @Test
-    public void testExistingPserverWithChildAndGenericVnfAndExistingEdgeBetweenThemAndDeleteEdgeAndCheckNoChildWhenNotificationDepthIsZero() throws IOException, AAIException {
+    public void testExistingPserverWithChildAndGenericVnfAndExistingEdgeBetweenThemAndDeleteEdgeAndCheckNoChildWhenNotificationDepthIsZero()
+            throws IOException, AAIException {
 
         String hostname = "example-hostname-val-85598";
 
@@ -707,7 +704,6 @@ public class NotificationDmaapEventTest extends AAISetup {
         assertEquals("Expecting the generic-vnf to be found", 200, response.getStatus());
         assertThat(response.getEntity().toString(), not(containsString(hostname)));
 
-
         response = httpTestUtil.doPut(pserverUri + "/relationship-list/relationship", relationship);
         assertEquals("Expecting the pserver to generic-vnf relationship to be created", 200, response.getStatus());
 
@@ -734,16 +730,20 @@ public class NotificationDmaapEventTest extends AAISetup {
 
         assertThat(notificationEvents.size(), is(2));
 
-        String expectedNotificationHeader = PayloadUtil.getResourcePayload("notification-dmaap-events/depth-zero/expected-notification-header-delete-edge-between-pserver-and-generic-vnf.json");
-        String expectedNotificationBody = PayloadUtil.getResourcePayload("notification-dmaap-events/depth-zero/expected-notification-body-delete-edge-between-pserver-and-generic-vnf.json");
+        String expectedNotificationHeader = PayloadUtil.getResourcePayload(
+                "notification-dmaap-events/depth-zero/expected-notification-header-delete-edge-between-pserver-and-generic-vnf.json");
+        String expectedNotificationBody = PayloadUtil.getResourcePayload(
+                "notification-dmaap-events/depth-zero/expected-notification-body-delete-edge-between-pserver-and-generic-vnf.json");
 
-        JSONAssert.assertEquals(expectedNotificationHeader, notificationEvents.get(0).getEventHeader().marshal(false), false);
-        JSONAssert.assertEquals(expectedNotificationBody, notificationEvents.get(0).getObj().marshal(false),  false);
+        JSONAssert.assertEquals(expectedNotificationHeader, notificationEvents.get(0).getEventHeader().marshal(false),
+                false);
+        JSONAssert.assertEquals(expectedNotificationBody, notificationEvents.get(0).getObj().marshal(false), false);
 
     }
 
     @Test
-    public void testExistingPserverWithChildAndGenericVnfAndExistingEdgeBetweenThemAndDeleteEdgeAndCheckChildrenWhenNotificationDepthIsAll() throws IOException, AAIException {
+    public void testExistingPserverWithChildAndGenericVnfAndExistingEdgeBetweenThemAndDeleteEdgeAndCheckChildrenWhenNotificationDepthIsAll()
+            throws IOException, AAIException {
 
         String hostname = "example-hostname-val-85598";
 
@@ -777,7 +777,6 @@ public class NotificationDmaapEventTest extends AAISetup {
         assertEquals("Expecting the generic-vnf to be found", 200, response.getStatus());
         assertThat(response.getEntity().toString(), not(containsString(hostname)));
 
-
         response = httpTestUtil.doPut(pserverUri + "/relationship-list/relationship", relationship);
         assertEquals("Expecting the pserver to generic-vnf relationship to be created", 200, response.getStatus());
 
@@ -803,16 +802,20 @@ public class NotificationDmaapEventTest extends AAISetup {
         List<NotificationEvent> notificationEvents = notification.getEvents();
         assertThat(notificationEvents.size(), is(2));
 
-        String expectedNotificationHeader = PayloadUtil.getResourcePayload("notification-dmaap-events/depth-all/expected-notification-header-delete-edge-between-pserver-and-generic-vnf.json");
-        String expectedNotificationBody = PayloadUtil.getResourcePayload("notification-dmaap-events/depth-all/expected-notification-body-delete-edge-between-pserver-and-generic-vnf.json");
+        String expectedNotificationHeader = PayloadUtil.getResourcePayload(
+                "notification-dmaap-events/depth-all/expected-notification-header-delete-edge-between-pserver-and-generic-vnf.json");
+        String expectedNotificationBody = PayloadUtil.getResourcePayload(
+                "notification-dmaap-events/depth-all/expected-notification-body-delete-edge-between-pserver-and-generic-vnf.json");
 
-        JSONAssert.assertEquals(expectedNotificationHeader, notificationEvents.get(0).getEventHeader().marshal(false), false);
-        JSONAssert.assertEquals(expectedNotificationBody, notificationEvents.get(0).getObj().marshal(false),  false);
+        JSONAssert.assertEquals(expectedNotificationHeader, notificationEvents.get(0).getEventHeader().marshal(false),
+                false);
+        JSONAssert.assertEquals(expectedNotificationBody, notificationEvents.get(0).getObj().marshal(false), false);
 
     }
 
     @Test
-    public void testDeleteOnExistingResourceVersionMismatchNoEventGeneratedFullDepth() throws IOException, AAIException {
+    public void testDeleteOnExistingResourceVersionMismatchNoEventGeneratedFullDepth()
+            throws IOException, AAIException {
         String uri = "/aai/v14/cloud-infrastructure/pservers/pserver/example-hostname-val-85598";
         UEBNotification notification = Mockito.spy(new UEBNotification(ModelType.MOXY, loaderFactory, schemaVersions));
         HttpTestUtil httpTestUtil = new HttpTestUtil(queryStyle);
@@ -825,14 +828,14 @@ public class NotificationDmaapEventTest extends AAISetup {
         response = httpTestUtil.doPut(uri, pserverResource);
         assertEquals("Expecting the pserver to be created", 201, response.getStatus());
 
-        response = httpTestUtil.doGet(uri , "all");
+        response = httpTestUtil.doGet(uri, "all");
         assertEquals("Expecting the pserver to be found", 200, response.getStatus());
 
         JSONObject pserverObject = new JSONObject(response.getEntity().toString());
         String resourceVersion = pserverObject.getString("resource-version");
 
         httpTestUtil = new HttpTestUtil(queryStyle, notification, AAIProperties.MAXIMUM_DEPTH);
-        response = httpTestUtil.doDelete(uri, resourceVersion+"123");
+        response = httpTestUtil.doDelete(uri, resourceVersion + "123");
         assertEquals("Resource version mismatch exception", 412, response.getStatus());
 
         List<NotificationEvent> notificationEvents = notification.getEvents();
@@ -840,70 +843,74 @@ public class NotificationDmaapEventTest extends AAISetup {
     }
 
     @Test
-    public void testCreateVnfWithChildrenCreateCustomerWithChildrenAndCousinBetweenVlanAndServiceInstanceThenDeleteCustomerVerifyingVlanRV() throws IOException, AAIException {
+    public void testCreateVnfWithChildrenCreateCustomerWithChildrenAndCousinBetweenVlanAndServiceInstanceThenDeleteCustomerVerifyingVlanRV()
+            throws IOException, AAIException {
         UEBNotification notification = Mockito.spy(new UEBNotification(ModelType.MOXY, loaderFactory, schemaVersions));
         HttpTestUtil httpTestUtil = new HttpTestUtil(queryStyle);
 
-        JsonObject paylaods = new JsonParser().parse(
-            PayloadUtil.getResourcePayload("customer_with_children_and_generic-vnf_with_children_and_edge_between_service-instance_vlan.json"))
-            .getAsJsonObject();
+        JsonObject paylaods = new JsonParser().parse(PayloadUtil.getResourcePayload(
+                "customer_with_children_and_generic-vnf_with_children_and_edge_between_service-instance_vlan.json"))
+                .getAsJsonObject();
         String gvnfPaylaod = paylaods.get("generic-vnf").toString();
         String custPaylaod = paylaods.get("customer").toString();
         String gvnfUri = "/aai/v14/network/generic-vnfs/generic-vnf/gvnf";
         String custUri = "/aai/v14/business/customers/customer/cust";
         String vlanUri = "/aai/v14/network/generic-vnfs/generic-vnf/gvnf/l-interfaces/l-interface/lint/vlans/vlan/vlan";
 
-        //Setup generic vnf
+        // Setup generic vnf
         Response response = httpTestUtil.doGet(gvnfUri);
         assertEquals("Expecting the generic-vnf to be not found", 404, response.getStatus());
         response = httpTestUtil.doPut(gvnfUri, gvnfPaylaod);
         assertEquals("Expecting the generic-vnf to be created", 201, response.getStatus());
-        response = httpTestUtil.doGet(gvnfUri , "all");
+        response = httpTestUtil.doGet(gvnfUri, "all");
         assertEquals("Expecting the generic-vnf to be found", 200, response.getStatus());
-        response = httpTestUtil.doGet(vlanUri , "all");
+        response = httpTestUtil.doGet(vlanUri, "all");
         assertEquals("Expecting the vlan to be found", 200, response.getStatus());
         String vlanResourceVersion = new JSONObject(response.getEntity().toString()).getString("resource-version");
 
-        //Setup customer with service instance relation to vlan
+        // Setup customer with service instance relation to vlan
         response = httpTestUtil.doGet(custUri);
         assertEquals("Expecting the customer to be not found", 404, response.getStatus());
         response = httpTestUtil.doPut(custUri, custPaylaod);
         assertEquals("Expecting the customer to be created", 201, response.getStatus());
-        response = httpTestUtil.doGet(custUri , "all");
+        response = httpTestUtil.doGet(custUri, "all");
         assertEquals("Expecting the customer to be found", 200, response.getStatus());
         String custResourceVersion = new JSONObject(response.getEntity().toString()).getString("resource-version");
 
-        //Verify vlan rv was updated
-        response = httpTestUtil.doGet(vlanUri , "all");
+        // Verify vlan rv was updated
+        response = httpTestUtil.doGet(vlanUri, "all");
         assertEquals("Expecting the vlan to be found", 200, response.getStatus());
-        String vlanResourceVersionAfterCustPut = new JSONObject(response.getEntity().toString()).getString("resource-version");
-        assertThat("Expecting the vlan resource version to be updated", vlanResourceVersionAfterCustPut, not(is(vlanResourceVersion)));
+        String vlanResourceVersionAfterCustPut =
+                new JSONObject(response.getEntity().toString()).getString("resource-version");
+        assertThat("Expecting the vlan resource version to be updated", vlanResourceVersionAfterCustPut,
+                not(is(vlanResourceVersion)));
 
-        //Delete customer
+        // Delete customer
         notification.clearEvents();
         httpTestUtil = new HttpTestUtil(queryStyle, notification, AAIProperties.MAXIMUM_DEPTH);
         response = httpTestUtil.doDelete(custUri, custResourceVersion);
         assertEquals("Expecting customer to be deleted", 204, response.getStatus());
 
-        //Verify vlan rv was updated
-        response = httpTestUtil.doGet(vlanUri , "all");
+        // Verify vlan rv was updated
+        response = httpTestUtil.doGet(vlanUri, "all");
         assertEquals("Expecting the vlan to be found", 200, response.getStatus());
-        String vlanResourceVersionAfterDelete = new JSONObject(response.getEntity().toString()).getString("resource-version");
-        assertThat("Expecting the vlan resource version to be updated", vlanResourceVersionAfterDelete, not(is(vlanResourceVersionAfterCustPut)));
+        String vlanResourceVersionAfterDelete =
+                new JSONObject(response.getEntity().toString()).getString("resource-version");
+        assertThat("Expecting the vlan resource version to be updated", vlanResourceVersionAfterDelete,
+                not(is(vlanResourceVersionAfterCustPut)));
 
         List<NotificationEvent> notificationEvents = notification.getEvents();
-        assertThat("Expect the delete to generate 4 events customer, its children and vlan", notificationEvents.size(), is(4));
+        assertThat("Expect the delete to generate 4 events customer, its children and vlan", notificationEvents.size(),
+                is(4));
     }
 
-
     @Test
     public void testBulkCreateOfComplexAndPserverWithRelationshipThenBulkDeleteBoth() throws IOException, AAIException {
         UEBNotification notification = Mockito.spy(new UEBNotification(ModelType.MOXY, loaderFactory, schemaVersions));
         HttpTestUtil httpTestUtil = new HttpTestUtil(queryStyle, notification, AAIProperties.MAXIMUM_DEPTH);
 
-        JsonObject paylaods = new JsonParser().parse(
-            PayloadUtil.getResourcePayload("complex_pserver_with_relation.json"))
-            .getAsJsonObject();
+        JsonObject paylaods = new JsonParser()
+                .parse(PayloadUtil.getResourcePayload("complex_pserver_with_relation.json")).getAsJsonObject();
         String complexPaylaod = paylaods.get("complex").toString();
         String pserverPaylaod = paylaods.get("pserver").toString();
         String complexUri = "/aai/v14/cloud-infrastructure/complexes/complex/complex-1";
@@ -914,17 +921,17 @@ public class NotificationDmaapEventTest extends AAISetup {
         response = httpTestUtil.doGet(pserverUri);
         assertEquals("Expecting the pserver to be not found", 404, response.getStatus());
 
-        Map<String,String> puts = new LinkedHashMap<>();
+        Map<String, String> puts = new LinkedHashMap<>();
         puts.put(complexUri, complexPaylaod);
         puts.put(pserverUri, pserverPaylaod);
 
         response = httpTestUtil.doPut(puts);
         assertEquals("Expecting the puts request to succeed", 201, response.getStatus());
         assertEquals("Expect 2 messages to be created", 2, notification.getEvents().size());
-        response = httpTestUtil.doGet(complexUri , "all");
+        response = httpTestUtil.doGet(complexUri, "all");
         assertEquals("Expecting the complex to be found", 200, response.getStatus());
         String complexRV = new JSONObject(response.getEntity().toString()).getString("resource-version");
-        response = httpTestUtil.doGet(pserverUri , "all");
+        response = httpTestUtil.doGet(pserverUri, "all");
         assertEquals("Expecting the pserver to be found", 200, response.getStatus());
         String pserverRv = new JSONObject(response.getEntity().toString()).getString("resource-version");
         assertThat("Resource versions match", complexRV, is(pserverRv));
@@ -943,13 +950,14 @@ public class NotificationDmaapEventTest extends AAISetup {
     }
 
     @Test
-    public void testCreateVnfWithChildrenCreateCustomerWithChildrenAndCousinBetweenVlanAndServiceInstanceThenImplicitDeleteVlanVerifyingServiceInstanceRV() throws IOException, AAIException {
+    public void testCreateVnfWithChildrenCreateCustomerWithChildrenAndCousinBetweenVlanAndServiceInstanceThenImplicitDeleteVlanVerifyingServiceInstanceRV()
+            throws IOException, AAIException {
         UEBNotification notification = Mockito.spy(new UEBNotification(ModelType.MOXY, loaderFactory, schemaVersions));
         HttpTestUtil httpTestUtil = new HttpTestUtil(queryStyle);
 
-        JsonObject paylaods = new JsonParser().parse(
-            PayloadUtil.getResourcePayload("customer_with_children_and_generic-vnf_with_children_and_edge_between_service-instance_vlan.json"))
-            .getAsJsonObject();
+        JsonObject paylaods = new JsonParser().parse(PayloadUtil.getResourcePayload(
+                "customer_with_children_and_generic-vnf_with_children_and_edge_between_service-instance_vlan.json"))
+                .getAsJsonObject();
         String gvnfPaylaod = paylaods.get("generic-vnf").toString();
         String custPaylaod = paylaods.get("customer").toString();
         String custUri = "/aai/v14/business/customers/customer/cust";
@@ -959,36 +967,39 @@ public class NotificationDmaapEventTest extends AAISetup {
         String lintUri = gvnfUri + "/l-interfaces/l-interface/lint";
         String vlanUri = lintUri + "/vlans/vlan/vlan";
 
-        //Setup generic vnf
+        // Setup generic vnf
         Response response = httpTestUtil.doGet(gvnfUri);
         assertEquals("Expecting the generic-vnf to be not found", 404, response.getStatus());
         response = httpTestUtil.doPut(gvnfUri, gvnfPaylaod);
         assertEquals("Expecting the generic-vnf to be created", 201, response.getStatus());
-        response = httpTestUtil.doGet(gvnfUri , "all");
+        response = httpTestUtil.doGet(gvnfUri, "all");
         assertEquals("Expecting the generic-vnf to be found", 200, response.getStatus());
-        response = httpTestUtil.doGet(vlanUri , "all");
+        response = httpTestUtil.doGet(vlanUri, "all");
         assertEquals("Expecting the vlan to be found", 200, response.getStatus());
         String vlanResourceVersion = new JSONObject(response.getEntity().toString()).getString("resource-version");
 
-        //Setup customer with service instance relation to vlan
+        // Setup customer with service instance relation to vlan
         response = httpTestUtil.doGet(custUri);
         assertEquals("Expecting the customer to be not found", 404, response.getStatus());
         response = httpTestUtil.doPut(custUri, custPaylaod);
         assertEquals("Expecting the customer to be created", 201, response.getStatus());
-        response = httpTestUtil.doGet(custUri , "all");
+        response = httpTestUtil.doGet(custUri, "all");
         assertEquals("Expecting the customer to be found", 200, response.getStatus());
-        response = httpTestUtil.doGet(siUri , "all");
+        response = httpTestUtil.doGet(siUri, "all");
         assertEquals("Expecting the service-instance to be found", 200, response.getStatus());
-        String serviceInstanceResourceVersion = new JSONObject(response.getEntity().toString()).getString("resource-version");
+        String serviceInstanceResourceVersion =
+                new JSONObject(response.getEntity().toString()).getString("resource-version");
 
-        //Verify vlan rv was updated
-        response = httpTestUtil.doGet(vlanUri , "all");
+        // Verify vlan rv was updated
+        response = httpTestUtil.doGet(vlanUri, "all");
         assertEquals("Expecting the vlan to be found", 200, response.getStatus());
-        String vlanResourceVersionAfterCustPut = new JSONObject(response.getEntity().toString()).getString("resource-version");
-        assertThat("Expecting the vlan resource version to be updated", vlanResourceVersionAfterCustPut, not(is(vlanResourceVersion)));
+        String vlanResourceVersionAfterCustPut =
+                new JSONObject(response.getEntity().toString()).getString("resource-version");
+        assertThat("Expecting the vlan resource version to be updated", vlanResourceVersionAfterCustPut,
+                not(is(vlanResourceVersion)));
 
-        //Get linterface, replace vlans with empty json (implicit delete) and put triggering implicit delete
-        response = httpTestUtil.doGet(lintUri , "all");
+        // Get linterface, replace vlans with empty json (implicit delete) and put triggering implicit delete
+        response = httpTestUtil.doGet(lintUri, "all");
         assertEquals("Expecting the l-interface to be found", 200, response.getStatus());
         JSONObject lintJson = new JSONObject(response.getEntity().toString());
         lintJson.put("vlans", new JsonObject());
@@ -1000,15 +1011,15 @@ public class NotificationDmaapEventTest extends AAISetup {
         List<NotificationEvent> notificationEvents = notification.getEvents();
         assertThat("Expect the implied delete to generate 2", notificationEvents.size(), is(2));
 
-        //Verify vlan is no longer there anf get service-instance and compare rv
-        response = httpTestUtil.doGet(vlanUri , "all");
+        // Verify vlan is no longer there anf get service-instance and compare rv
+        response = httpTestUtil.doGet(vlanUri, "all");
         assertEquals("Expecting the vlan not to be found", 404, response.getStatus());
-        response = httpTestUtil.doGet(siUri , "all");
+        response = httpTestUtil.doGet(siUri, "all");
         assertEquals("Expecting the service-instance to be found", 200, response.getStatus());
-        String serviceInstanceResourceVersionAfterImplicitDelete = new JSONObject(response.getEntity().toString()).getString("resource-version");
+        String serviceInstanceResourceVersionAfterImplicitDelete =
+                new JSONObject(response.getEntity().toString()).getString("resource-version");
         assertThat("Expecting the service-instance resource version to be updated after implicit delete of vlan",
-            serviceInstanceResourceVersionAfterImplicitDelete,
-            not(is(serviceInstanceResourceVersion)));
+                serviceInstanceResourceVersionAfterImplicitDelete, not(is(serviceInstanceResourceVersion)));
     }
 
     @After
@@ -1019,9 +1030,7 @@ public class NotificationDmaapEventTest extends AAISetup {
 
         GraphTraversalSource g = transaction.traversal();
 
-        g.V()
-            .has(AAIProperties.SOURCE_OF_TRUTH, "JUNIT")
-            .forEachRemaining(Vertex::remove);
+        g.V().has(AAIProperties.SOURCE_OF_TRUTH, "JUNIT").forEachRemaining(Vertex::remove);
 
         transaction.commit();
     }
index 8753b1b..13611ab 100644 (file)
@@ -21,7 +21,6 @@
 package org.onap.aai.rest;
 
 import static junit.framework.TestCase.fail;
-
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.hamcrest.CoreMatchers.not;
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -30,8 +29,6 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.jayway.jsonpath.JsonPath;
 
 import java.util.*;
@@ -52,6 +49,8 @@ import org.onap.aai.PayloadUtil;
 import org.onap.aai.dbmap.AAIGraph;
 import org.onap.aai.serialization.engines.QueryStyle;
 import org.onap.aai.setup.SchemaVersion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.test.annotation.DirtiesContext;
 
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
index 5f23a27..2afa603 100644 (file)
@@ -32,7 +32,9 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
+
 import javax.ws.rs.core.Response;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.janusgraph.core.JanusGraph;
index 80ced5e..6e2c2ab 100644 (file)
 
 package org.onap.aai.rest;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import static junit.framework.TestCase.fail;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import com.jayway.jsonpath.JsonPath;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.core.Response;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.janusgraph.core.JanusGraphTransaction;
 import org.junit.After;
@@ -39,20 +51,10 @@ import org.onap.aai.introspection.Loader;
 import org.onap.aai.introspection.ModelType;
 import org.onap.aai.serialization.engines.QueryStyle;
 import org.skyscreamer.jsonassert.JSONAssert;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.test.annotation.DirtiesContext;
 
-import javax.ws.rs.core.Response;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import static junit.framework.TestCase.fail;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
 @RunWith(value = Parameterized.class)
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class PserverTest extends AAISetup {
@@ -79,7 +81,8 @@ public class PserverTest extends AAISetup {
     public void testPutPserverCreateGetInXmlForFormats() throws Exception {
         httpTestUtil = new HttpTestUtil(queryStyle, "application/xml");
         String pserverUri = "/aai/v12/cloud-infrastructure/pservers/pserver/test-pserver-xml";
-        String cloudRegionUri = "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/cloud-region-random1/cloud-region-random1-region";
+        String cloudRegionUri =
+                "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/cloud-region-random1/cloud-region-random1-region";
 
         Response response = httpTestUtil.doGet(pserverUri);
         assertNotNull("Expected the response to be not null", response);
@@ -102,10 +105,11 @@ public class PserverTest extends AAISetup {
         assertNotNull("Expected the response to be not null", response);
         assertEquals("Expecting the cloud-region to pserver relationship to be created", 200, response.getStatus());
 
-        response = httpTestUtil.doGet(pserverUri , "0", "raw");
+        response = httpTestUtil.doGet(pserverUri, "0", "raw");
         assertNotNull("Expected the response to be not null", response);
         assertEquals("Expecting the pserver to be created", 200, response.getStatus());
-        assertThat(response.getEntity().toString(), containsString("<related-to><node><relationship-label>org.onap.relationships.inventory.LocatedIn</relationship-label><node-type>cloud-region</node-type>"));
+        assertThat(response.getEntity().toString(), containsString(
+                "<related-to><node><relationship-label>org.onap.relationships.inventory.LocatedIn</relationship-label><node-type>cloud-region</node-type>"));
     }
 
     @Test
index 354b030..a88e7b6 100644 (file)
@@ -31,7 +31,6 @@ import java.util.Collection;
 import javax.ws.rs.core.Response;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
index ae61171..1bfc8b7 100644 (file)
 
 package org.onap.aai.rest;
 
+import static junit.framework.TestCase.fail;
+import static org.junit.Assert.assertEquals;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import javax.ws.rs.core.Response;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.janusgraph.core.JanusGraphTransaction;
 import org.junit.*;
@@ -35,13 +43,6 @@ import org.slf4j.LoggerFactory;
 import org.springframework.test.context.junit4.rules.SpringClassRule;
 import org.springframework.test.context.junit4.rules.SpringMethodRule;
 
-import javax.ws.rs.core.Response;
-import java.util.Arrays;
-import java.util.Collection;
-
-import static junit.framework.TestCase.fail;
-import static org.junit.Assert.assertEquals;
-
 @RunWith(value = Parameterized.class)
 public class VnfcRelationshipIssueTest extends AAISetup {
 
index 0adcbfe..1462485 100644 (file)
 
 package org.onap.aai.rest.db;
 
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.not;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.when;
+
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.util.*;
+
+import javax.ws.rs.core.*;
+
 import org.javatuples.Pair;
 import org.json.JSONArray;
 import org.json.JSONObject;
@@ -46,19 +61,6 @@ import org.onap.aai.serialization.engines.QueryStyle;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
 import org.onap.aai.util.AAIConfig;
 
-import javax.ws.rs.core.*;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.util.*;
-
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.not;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.when;
-
 @RunWith(value = Parameterized.class)
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class HttpEntryTest extends AAISetup {
@@ -376,7 +378,6 @@ public class HttpEntryTest extends AAISetup {
         doNothing().when(uebNotification).triggerEvents();
         Response response = doRequest(traversalHttpEntry, loader, dbEngine, HttpMethod.PUT_EDGE, uri, content);
 
-
         assertEquals("Expected the pserver relationship to be deleted", 200, response.getStatus());
         assertEquals("Two notifications", 2, uebNotification.getEvents().size());
         assertEquals("Notification generated for PUT edge", "UPDATE",
@@ -620,17 +621,15 @@ public class HttpEntryTest extends AAISetup {
         // Put complex
         uri = "/cloud-infrastructure/complexes/complex/httpEntryTest-complex-01";
         content =
-            "{\"physical-location-id\":\"httpEntryTest-complex-01\",\"physical-location-type\":\"AAIDefault\",\"street1\":\"AAIDefault\",\"city\":\"AAIDefault\",\"state\":\"NJ\",\"postal-code\":\"07748\",\"country\":\"USA\",\"region\":\"US\"}";
+                "{\"physical-location-id\":\"httpEntryTest-complex-01\",\"physical-location-type\":\"AAIDefault\",\"street1\":\"AAIDefault\",\"city\":\"AAIDefault\",\"state\":\"NJ\",\"postal-code\":\"07748\",\"country\":\"USA\",\"region\":\"US\"}";
         doRequest(traversalHttpEntry, loader, dbEngine, HttpMethod.PUT, uri, content);
 
         // Put Relationship
         uri = "/cloud-infrastructure/pservers/pserver/httpEntryTest-pserver-01/relationship-list/relationship";
         content = "{\"related-to\":\"complex\",\"related-link\":\"/aai/" + schemaVersions.getDefaultVersion().toString()
-            + "/cloud-infrastructure/complexes/complex/httpEntryTest-complex-01\",\"relationship-label\":\"org.onap.relationships.inventory.LocatedIn\"}" +
-            "\"relationship-daasSta\":[{" +
-            "\"relationship-key\":\"complex.physical-location-id\"," +
-            "\"relationship-value\":\"httpEntryTest-complex-01\"" +
-            "}]";
+                + "/cloud-infrastructure/complexes/complex/httpEntryTest-complex-01\",\"relationship-label\":\"org.onap.relationships.inventory.LocatedIn\"}"
+                + "\"relationship-daasSta\":[{" + "\"relationship-key\":\"complex.physical-location-id\","
+                + "\"relationship-value\":\"httpEntryTest-complex-01\"" + "}]";
         Response response = doRequest(traversalHttpEntry, loader, dbEngine, HttpMethod.PUT_EDGE, uri, content);
         assertEquals("Expected the pserver relationship to be created", 200, response.getStatus());
 
@@ -638,7 +637,8 @@ public class HttpEntryTest extends AAISetup {
         uri = "/cloud-infrastructure/pservers/pserver/httpEntryTest-pserver-01";
         content = "";
         response = doRequest(traversalHttpEntry, loader, dbEngine, HttpMethod.GET_RELATIONSHIP, uri, content);
-        String expected = "{\"relationship\":[{\"related-to\":\"complex\",\"relationship-label\":\"org.onap.relationships.inventory.LocatedIn\",\"related-link\":\"/aai/v14/cloud-infrastructure/complexes/complex/httpEntryTest-complex-01\",\"relationship-data\":[{\"relationship-key\":\"complex.physical-location-id\",\"relationship-value\":\"httpEntryTest-complex-01\"}]}]}";
+        String expected =
+                "{\"relationship\":[{\"related-to\":\"complex\",\"relationship-label\":\"org.onap.relationships.inventory.LocatedIn\",\"related-link\":\"/aai/v14/cloud-infrastructure/complexes/complex/httpEntryTest-complex-01\",\"relationship-data\":[{\"relationship-key\":\"complex.physical-location-id\",\"relationship-value\":\"httpEntryTest-complex-01\"}]}]}";
         Assert.assertEquals(expected, response.getEntity().toString());
 
         dbEngine.rollback();
@@ -657,17 +657,15 @@ public class HttpEntryTest extends AAISetup {
         // Put complex
         uri = "/cloud-infrastructure/complexes/complex/httpEntryTest-complex-01";
         content =
-            "{\"physical-location-id\":\"httpEntryTest-complex-01\",\"physical-location-type\":\"AAIDefault\",\"street1\":\"AAIDefault\",\"city\":\"AAIDefault\",\"state\":\"NJ\",\"postal-code\":\"07748\",\"country\":\"USA\",\"region\":\"US\"}";
+                "{\"physical-location-id\":\"httpEntryTest-complex-01\",\"physical-location-type\":\"AAIDefault\",\"street1\":\"AAIDefault\",\"city\":\"AAIDefault\",\"state\":\"NJ\",\"postal-code\":\"07748\",\"country\":\"USA\",\"region\":\"US\"}";
         doRequest(traversalHttpEntry, loader, dbEngine, HttpMethod.PUT, uri, content);
 
         // Put Relationship
         uri = "/cloud-infrastructure/pservers/pserver/httpEntryTest-pserver-01/relationship-list/relationship";
         content = "{\"related-to\":\"complex\",\"related-link\":\"/aai/" + schemaVersions.getDefaultVersion().toString()
-            + "/cloud-infrastructure/complexes/complex/httpEntryTest-complex-01\",\"relationship-label\":\"org.onap.relationships.inventory.LocatedIn\"}" +
-            "\"relationship-daasSta\":[{" +
-            "\"relationship-key\":\"complex.physical-location-id\"," +
-            "\"relationship-value\":\"httpEntryTest-complex-01\"" +
-            "}]";
+                + "/cloud-infrastructure/complexes/complex/httpEntryTest-complex-01\",\"relationship-label\":\"org.onap.relationships.inventory.LocatedIn\"}"
+                + "\"relationship-daasSta\":[{" + "\"relationship-key\":\"complex.physical-location-id\","
+                + "\"relationship-value\":\"httpEntryTest-complex-01\"" + "}]";
         Response response = doRequest(traversalHttpEntry, loader, dbEngine, HttpMethod.PUT_EDGE, uri, content);
         assertEquals("Expected the pserver relationship to be created", 200, response.getStatus());
 
@@ -690,14 +688,13 @@ public class HttpEntryTest extends AAISetup {
         JSONObject pserverResponseFields = new JSONObject(pserverResponse);
         String pserverResponseRelationshipList = pserverResponseFields.get("relationship-list").toString();
 
-        String expected = "{\"relationship\":[{\"related-to\":\"complex\",\"relationship-data\":[{\"relationship-value\":\"httpEntryTest-complex-01\",\"relationship-key\":\"complex.physical-location-id\"}],\"related-link\":\"/aai/v14/cloud-infrastructure/complexes/complex/httpEntryTest-complex-01\",\"relationship-label\":\"org.onap.relationships.inventory.LocatedIn\"}]}";
+        String expected =
+                "{\"relationship\":[{\"related-to\":\"complex\",\"relationship-data\":[{\"relationship-value\":\"httpEntryTest-complex-01\",\"relationship-key\":\"complex.physical-location-id\"}],\"related-link\":\"/aai/v14/cloud-infrastructure/complexes/complex/httpEntryTest-complex-01\",\"relationship-label\":\"org.onap.relationships.inventory.LocatedIn\"}]}";
         assertEquals(expected, pserverResponseRelationshipList);
-//        Assert.assertEquals(expected, response.getEntity().toString());
+        // Assert.assertEquals(expected, response.getEntity().toString());
         queryParameters.remove("format");
 
         dbEngine.rollback();
     }
 
-
-
 }
index 58b96e4..efa4325 100644 (file)
 
 package org.onap.aai.rest.ueb;
 
+import static org.junit.Assert.assertEquals;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.UUID;
+
+import javax.ws.rs.core.Response;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.aai.AAISetup;
@@ -34,15 +44,6 @@ import org.onap.aai.setup.SchemaVersion;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 
-import javax.ws.rs.core.Response;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.UUID;
-
-import static org.junit.Assert.assertEquals;
-
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class UEBNotificationTest extends AAISetup {
 
@@ -58,7 +59,6 @@ public class UEBNotificationTest extends AAISetup {
 
     public QueryStyle queryStyle = QueryStyle.TRAVERSAL_URI;
 
-
     @Before
     public void setup() throws Exception {
         version = schemaVersions.getDefaultVersion();
@@ -72,20 +72,13 @@ public class UEBNotificationTest extends AAISetup {
         pserver.setValue("hostname", "hn");
         URI uri = new URI("/cloud-infrastructure/pservers/pserver/hn");
         UEBNotification uebNotification = new UEBNotification(loader, loaderFactory, schemaVersions);
-        uebNotification.createNotificationEvent(
-            UUID.randomUUID().toString(),
-            "JUNIT-SOT",
-            Response.Status.CREATED,
-            uri,
-            pserver,
-            new HashMap<>(),
-            BASE_PATH);
+        uebNotification.createNotificationEvent(UUID.randomUUID().toString(), "JUNIT-SOT", Response.Status.CREATED, uri,
+                pserver, new HashMap<>(), BASE_PATH);
 
         assertEquals("One event created", 1, uebNotification.getEvents().size());
-        assertEquals(
-            "Uri is correct",
-            BASE_PATH + "/" + schemaVersions.getDefaultVersion() + "/cloud-infrastructure/pservers/pserver/hn",
-            uebNotification.getEvents().get(0).getEventHeader().getValue("entity-link").toString());
+        assertEquals("Uri is correct",
+                BASE_PATH + "/" + schemaVersions.getDefaultVersion() + "/cloud-infrastructure/pservers/pserver/hn",
+                uebNotification.getEvents().get(0).getEventHeader().getValue("entity-link").toString());
     }
 
     @Test
@@ -95,18 +88,12 @@ public class UEBNotificationTest extends AAISetup {
         pserver.setValue("hostname", "hn");
         URI uri = new URI(BASE_PATH + "/v12/cloud-infrastructure/pservers/pserver/hn");
         UEBNotification uebNotification = new UEBNotification(loader, loaderFactory, schemaVersions);
-        uebNotification.createNotificationEvent(
-            UUID.randomUUID().toString(),
-            "JUNIT-SOT",
-            Response.Status.CREATED,
-            uri,
-            pserver,
-            new HashMap<>(), BASE_PATH);
+        uebNotification.createNotificationEvent(UUID.randomUUID().toString(), "JUNIT-SOT", Response.Status.CREATED, uri,
+                pserver, new HashMap<>(), BASE_PATH);
 
         assertEquals("One event created", 1, uebNotification.getEvents().size());
-        assertEquals(
-            "Uri is correct",
-            BASE_PATH + "/" + schemaVersions.getDefaultVersion() + "/cloud-infrastructure/pservers/pserver/hn",
-            uebNotification.getEvents().get(0).getEventHeader().getValue("entity-link").toString());
+        assertEquals("Uri is correct",
+                BASE_PATH + "/" + schemaVersions.getDefaultVersion() + "/cloud-infrastructure/pservers/pserver/hn",
+                uebNotification.getEvents().get(0).getEventHeader().getValue("entity-link").toString());
     }
 }
index 5adf5b2..e6b1a7e 100644 (file)
@@ -31,20 +31,21 @@ public class JettyObfuscationConversionCommandLineUtilTest extends AAISetup {
     public void testMainObfuscation() {
         String[] args = {"-e", "[thisStringToObfuscate]"};
         jettyObfuscationConversionCommandLineUtil.main(args);
-        Assert.assertTrue(true);    // No exception was encountered
+        Assert.assertTrue(true); // No exception was encountered
     }
 
     @Test
     public void testMainDeobfuscation() {
-        String[] args = {"-d", "OBF:1pj11w261wmr1t3b1vgv1s9r1z7i1vuz1tae1qji1vg71mdb1vgn1qhs1ta01vub1z7k1sbj1vfz1t2v1wnf1w1c1pj5"};
+        String[] args = {"-d",
+                "OBF:1pj11w261wmr1t3b1vgv1s9r1z7i1vuz1tae1qji1vg71mdb1vgn1qhs1ta01vub1z7k1sbj1vfz1t2v1wnf1w1c1pj5"};
         jettyObfuscationConversionCommandLineUtil.main(args);
-        Assert.assertTrue(true);    // No exception was encountered
+        Assert.assertTrue(true); // No exception was encountered
     }
 
     @Test
     public void testMain_failedParseInput() {
         String[] args = {"-e [thisStringToObfuscate]"};
         jettyObfuscationConversionCommandLineUtil.main(args);
-        Assert.assertTrue(true);    // No exception was encountered
+        Assert.assertTrue(true); // No exception was encountered
     }
 }
index 6be45ff..3c099c7 100644 (file)
 
 package org.onap.aai.restcore;
 
-import com.google.common.collect.HashMultimap;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.aai.AAISetup;
-import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.parsers.exceptions.AmbiguousMapAAIException;
-
-import javax.ws.rs.core.*;
-
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 import java.util.concurrent.Callable;
 
+import javax.ws.rs.core.*;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.aai.AAISetup;
+import org.onap.aai.exceptions.AAIException;
+
 public class RESTAPITest extends AAISetup {
     private static RESTAPI restapi;
     private static HttpHeaders httpHeaders;
@@ -99,7 +95,8 @@ public class RESTAPITest extends AAISetup {
         when(httpHeaders.getRequestHeaders()).thenReturn(requestHeaders);
         when(callable.call()).thenReturn(response);
 
-        Response resp = restapi.runner(AAI_TIMEOUT_ENABLED, AAI_TIMEOUT_BY_APP, AAI_TIMEOUT_DEFAULT_LIMIT, httpHeaders, info, HttpMethod.GET, callable);
+        Response resp = restapi.runner(AAI_TIMEOUT_ENABLED, AAI_TIMEOUT_BY_APP, AAI_TIMEOUT_DEFAULT_LIMIT, httpHeaders,
+                info, HttpMethod.GET, callable);
         Assert.assertNotNull(resp);
     }
 }
index a49394f..3753b7f 100644 (file)
@@ -26,7 +26,6 @@ import org.onap.aai.AbstractConfigTranslator;
 import org.onap.aai.setup.SchemaConfigVersions;
 import org.onap.aai.setup.SchemaLocationsBean;
 import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersions;
 
 /**
  * Quick and dirty access to test schema files
index 24762d5..78cef07 100644 (file)
@@ -26,7 +26,6 @@ import org.onap.aai.AbstractConfigTranslator;
 import org.onap.aai.setup.SchemaConfigVersions;
 import org.onap.aai.setup.SchemaLocationsBean;
 import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersions;
 
 /**
  * Quick and dirty access to the real schema files for updating core tests
index 454aa21..bbbe6aa 100644 (file)
 
 package org.onap.aai.serialization.db;
 
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -44,18 +56,6 @@ import org.onap.aai.serialization.engines.TransactionalGraphEngine;
 import org.onap.aai.setup.SchemaVersion;
 import org.springframework.test.annotation.DirtiesContext;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
 @RunWith(value = Parameterized.class)
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class DbAliasTest extends DataLinkSetup {
@@ -90,7 +90,8 @@ public class DbAliasTest extends DataLinkSetup {
     }
 
     @Test
-    public void checkOnWrite() throws AAIException, UnsupportedEncodingException, URISyntaxException, SecurityException, IllegalArgumentException {
+    public void checkOnWrite() throws AAIException, UnsupportedEncodingException, URISyntaxException, SecurityException,
+            IllegalArgumentException {
         final String property = "persona-model-customization-id";
         String dbPropertyName = property;
         TransactionalGraphEngine spy = spy(this.dbEngine);
@@ -129,12 +130,14 @@ public class DbAliasTest extends DataLinkSetup {
     }
 
     @Test
-    public void checkOnRead() throws AAIException, UnsupportedEncodingException, SecurityException, IllegalArgumentException {
+    public void checkOnRead()
+            throws AAIException, UnsupportedEncodingException, SecurityException, IllegalArgumentException {
         final String property = "persona-model-customization-id";
 
         TransactionalGraphEngine spy = spy(dbEngine);
         TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
-        Vertex v = graph.traversal().addV().property("vnf-id", "key1").property("model-customization-id", "hello").next();
+        Vertex v =
+                graph.traversal().addV().property("vnf-id", "key1").property("model-customization-id", "hello").next();
         graph.tx().commit();
         Graph g = graph.newTransaction();
         GraphTraversalSource traversal = g.traversal();
index de8f222..b8d3f75 100644 (file)
 
 package org.onap.aai.serialization.db;
 
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.junit.Assert.*;
+
 import com.google.gson.FieldNamingPolicy;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.*;
+
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.janusgraph.core.JanusGraphFactory;
@@ -50,19 +59,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.TestPropertySource;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.*;
-
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.junit.Assert.*;
-
 @RunWith(value = Parameterized.class)
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
-@TestPropertySource(properties = {
-    "delta.events.enabled=true",
-    })
+@TestPropertySource(properties = {"delta.events.enabled=true",})
 public class DbSerializerDeltasTest extends AAISetup {
 
     // to use, set thrown.expect to whatever your test needs
@@ -110,27 +109,27 @@ public class DbSerializerDeltasTest extends AAISetup {
     public void createTopLevelThenUpdateTest() throws AAIException, UnsupportedEncodingException, URISyntaxException {
         engine.startTransaction();
 
-        DBSerializer dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
+        DBSerializer dbserLocal =
+                new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
         Introspector gvnf = loader.introspectorFromName("generic-vnf");
         Vertex gvnfVert = dbserLocal.createNewVertex(gvnf);
         QueryParser uriQuery =
-            dbEngine.getQueryBuilder().createQueryFromURI(new URI("/network/generic-vnfs/generic-vnf/myvnf"));
+                dbEngine.getQueryBuilder().createQueryFromURI(new URI("/network/generic-vnfs/generic-vnf/myvnf"));
 
         gvnf.setValue("vnf-id", "myvnf");
         gvnf.setValue("vnf-type", "typo");
         dbserLocal.serializeToDb(gvnf, gvnfVert, uriQuery, "generic-vnf", gvnf.marshal(false));
-        assertTrue("Original created vertex exists", engine.tx().traversal().V()
-            .has("aai-node-type", "generic-vnf")
-            .has("vnf-id", "myvnf")
-            .has("vnf-type", "typo")
-            .hasNext());
-
-
-        assertEquals(DeltaAction.CREATE, dbserLocal.getObjectDeltas().get("/network/generic-vnfs/generic-vnf/myvnf").getAction());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get("/network/generic-vnfs/generic-vnf/myvnf").getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
-        assertEquals(5L, dbserLocal.getObjectDeltas().get("/network/generic-vnfs/generic-vnf/myvnf").getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
+        assertTrue("Original created vertex exists", engine.tx().traversal().V().has("aai-node-type", "generic-vnf")
+                .has("vnf-id", "myvnf").has("vnf-type", "typo").hasNext());
+
+        assertEquals(DeltaAction.CREATE,
+                dbserLocal.getObjectDeltas().get("/network/generic-vnfs/generic-vnf/myvnf").getAction());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get("/network/generic-vnfs/generic-vnf/myvnf").getPropertyDeltas()
+                .values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
+        assertEquals(5L, dbserLocal.getObjectDeltas().get("/network/generic-vnfs/generic-vnf/myvnf").getPropertyDeltas()
+                .values().stream().filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
         dbserLocal.getObjectDeltas().values().forEach(od -> {
-            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID) ) {
+            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID)) {
                 fail(od.getUri() + " is missing " + AAIProperties.AAI_UUID);
             } else if (od.getPropertyDeltas().get(AAIProperties.AAI_UUID) == null) {
                 fail(od.getUri() + " " + AAIProperties.AAI_UUID + " is null");
@@ -141,20 +140,20 @@ public class DbSerializerDeltasTest extends AAISetup {
 
         gvnf = dbserLocal.getLatestVersionView(gvnfVert);
         gvnf.setValue("vnf-type", "new-typo");
-        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
+        dbserLocal =
+                new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
         dbserLocal.serializeToDb(gvnf, gvnfVert, uriQuery, "generic-vnf", gvnf.marshal(false));
-        assertTrue("Vertex is updated", engine.tx().traversal().V()
-            .has("aai-node-type", "generic-vnf")
-            .has("vnf-id", "myvnf")
-            .has("vnf-type", "new-typo")
-            .hasNext());
-
-
-        assertEquals(DeltaAction.UPDATE, dbserLocal.getObjectDeltas().get("/network/generic-vnfs/generic-vnf/myvnf").getAction());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get("/network/generic-vnfs/generic-vnf/myvnf").getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get("/network/generic-vnfs/generic-vnf/myvnf").getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.UPDATE)).count());
+        assertTrue("Vertex is updated", engine.tx().traversal().V().has("aai-node-type", "generic-vnf")
+                .has("vnf-id", "myvnf").has("vnf-type", "new-typo").hasNext());
+
+        assertEquals(DeltaAction.UPDATE,
+                dbserLocal.getObjectDeltas().get("/network/generic-vnfs/generic-vnf/myvnf").getAction());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get("/network/generic-vnfs/generic-vnf/myvnf").getPropertyDeltas()
+                .values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get("/network/generic-vnfs/generic-vnf/myvnf").getPropertyDeltas()
+                .values().stream().filter(d -> d.getAction().equals(DeltaAction.UPDATE)).count());
         dbserLocal.getObjectDeltas().values().forEach(od -> {
-            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID) ) {
+            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID)) {
                 fail(od.getUri() + " is missing " + AAIProperties.AAI_UUID);
             } else if (od.getPropertyDeltas().get(AAIProperties.AAI_UUID) == null) {
                 fail(od.getUri() + " " + AAIProperties.AAI_UUID + " is null");
@@ -165,31 +164,30 @@ public class DbSerializerDeltasTest extends AAISetup {
     }
 
     @Test
-    public void createTopLevelThenCreateChildTest() throws AAIException, UnsupportedEncodingException, URISyntaxException {
+    public void createTopLevelThenCreateChildTest()
+            throws AAIException, UnsupportedEncodingException, URISyntaxException {
         engine.startTransaction();
 
-        DBSerializer dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
+        DBSerializer dbserLocal =
+                new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
         Introspector gvnf = loader.introspectorFromName("generic-vnf");
         Vertex gvnfVert = dbserLocal.createNewVertex(gvnf);
         final String vnfUri = "/network/generic-vnfs/generic-vnf/myvnf";
-        QueryParser uriQuery =
-            dbEngine.getQueryBuilder().createQueryFromURI(new URI(vnfUri));
+        QueryParser uriQuery = dbEngine.getQueryBuilder().createQueryFromURI(new URI(vnfUri));
 
         gvnf.setValue("vnf-id", "myvnf");
         gvnf.setValue("vnf-type", "typo");
         dbserLocal.serializeToDb(gvnf, gvnfVert, uriQuery, "generic-vnf", gvnf.marshal(false));
-        assertTrue("Original created vertex exists", engine.tx().traversal().V()
-            .has("aai-node-type", "generic-vnf")
-            .has("vnf-id", "myvnf")
-            .has("vnf-type", "typo")
-            .hasNext());
-
+        assertTrue("Original created vertex exists", engine.tx().traversal().V().has("aai-node-type", "generic-vnf")
+                .has("vnf-id", "myvnf").has("vnf-type", "typo").hasNext());
 
         assertEquals(DeltaAction.CREATE, dbserLocal.getObjectDeltas().get(vnfUri).getAction());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get(vnfUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
-        assertEquals(5L, dbserLocal.getObjectDeltas().get(vnfUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(vnfUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
+        assertEquals(5L, dbserLocal.getObjectDeltas().get(vnfUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
         dbserLocal.getObjectDeltas().values().forEach(od -> {
-            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID) ) {
+            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID)) {
                 fail(od.getUri() + " is missing " + AAIProperties.AAI_UUID);
             } else if (od.getPropertyDeltas().get(AAIProperties.AAI_UUID) == null) {
                 fail(od.getUri() + " " + AAIProperties.AAI_UUID + " is null");
@@ -198,7 +196,8 @@ public class DbSerializerDeltasTest extends AAISetup {
             }
         });
 
-        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
+        dbserLocal =
+                new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
         Introspector vf = loader.introspectorFromName("vf-module");
         Vertex vfVertex = dbserLocal.createNewVertex(vf);
         final String vfUri = "/network/generic-vnfs/generic-vnf/myvnf/vf-modules/vf-module/myvf";
@@ -206,24 +205,19 @@ public class DbSerializerDeltasTest extends AAISetup {
 
         vf.setValue("vf-module-id", "myvf");
         dbserLocal.serializeToDb(vf, vfVertex, uriQuery, "vf-module", vf.marshal(false));
-        assertTrue("Vertex is creted", engine.tx().traversal().V()
-            .has("aai-node-type", "vf-module")
-            .has("vf-module-id", "myvf")
-            .hasNext());
-        assertTrue("Vf module has edge to gvnf", engine.tx().traversal().V()
-            .has("aai-node-type", "vf-module")
-            .has("vf-module-id", "myvf")
-            .both()
-            .has("aai-node-type", "generic-vnf")
-            .has("vnf-id", "myvnf")
-            .hasNext());
-
+        assertTrue("Vertex is creted",
+                engine.tx().traversal().V().has("aai-node-type", "vf-module").has("vf-module-id", "myvf").hasNext());
+        assertTrue("Vf module has edge to gvnf",
+                engine.tx().traversal().V().has("aai-node-type", "vf-module").has("vf-module-id", "myvf").both()
+                        .has("aai-node-type", "generic-vnf").has("vnf-id", "myvnf").hasNext());
 
         assertEquals(DeltaAction.CREATE, dbserLocal.getObjectDeltas().get(vfUri).getAction());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get(vfUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get(vfUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(vfUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(vfUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
         dbserLocal.getObjectDeltas().values().forEach(od -> {
-            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID) ) {
+            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID)) {
                 fail(od.getUri() + " is missing " + AAIProperties.AAI_UUID);
             } else if (od.getPropertyDeltas().get(AAIProperties.AAI_UUID) == null) {
                 fail(od.getUri() + " " + AAIProperties.AAI_UUID + " is null");
@@ -234,15 +228,16 @@ public class DbSerializerDeltasTest extends AAISetup {
     }
 
     @Test
-    public void createTopWithChildThenDeleteTopTest() throws AAIException, UnsupportedEncodingException, URISyntaxException {
+    public void createTopWithChildThenDeleteTopTest()
+            throws AAIException, UnsupportedEncodingException, URISyntaxException {
         engine.startTransaction();
 
-        DBSerializer dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
+        DBSerializer dbserLocal =
+                new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
         Introspector gvnf = loader.introspectorFromName("generic-vnf");
         Vertex gvnfVert = dbserLocal.createNewVertex(gvnf);
         final String vnfUri = "/network/generic-vnfs/generic-vnf/myvnf";
-        QueryParser uriQuery =
-            dbEngine.getQueryBuilder().createQueryFromURI(new URI(vnfUri));
+        QueryParser uriQuery = dbEngine.getQueryBuilder().createQueryFromURI(new URI(vnfUri));
 
         gvnf.setValue("vnf-id", "myvnf");
         gvnf.setValue("vnf-type", "typo");
@@ -260,32 +255,28 @@ public class DbSerializerDeltasTest extends AAISetup {
         Gson gson = new GsonBuilder().create();
         System.out.println(gson.toJsonTree(dbserLocal.getObjectDeltas().values()));
 
-        assertTrue("Original created vertex exists", engine.tx().traversal().V()
-            .has("aai-node-type", "generic-vnf")
-            .has("vnf-id", "myvnf")
-            .has("vnf-type", "typo")
-            .hasNext());
-        assertTrue("Vertex is creted", engine.tx().traversal().V()
-            .has("aai-node-type", "vf-module")
-            .has("vf-module-id", "myvf")
-            .hasNext());
-        assertTrue("Vf module has edge to gvnf", engine.tx().traversal().V()
-            .has("aai-node-type", "vf-module")
-            .has("vf-module-id", "myvf")
-            .both()
-            .has("aai-node-type", "generic-vnf")
-            .has("vnf-id", "myvnf")
-            .hasNext());
+        assertTrue("Original created vertex exists", engine.tx().traversal().V().has("aai-node-type", "generic-vnf")
+                .has("vnf-id", "myvnf").has("vnf-type", "typo").hasNext());
+        assertTrue("Vertex is creted",
+                engine.tx().traversal().V().has("aai-node-type", "vf-module").has("vf-module-id", "myvf").hasNext());
+        assertTrue("Vf module has edge to gvnf",
+                engine.tx().traversal().V().has("aai-node-type", "vf-module").has("vf-module-id", "myvf").both()
+                        .has("aai-node-type", "generic-vnf").has("vnf-id", "myvnf").hasNext());
 
         assertEquals(DeltaAction.CREATE, dbserLocal.getObjectDeltas().get(vnfUri).getAction());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get(vnfUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
-        assertEquals(5L, dbserLocal.getObjectDeltas().get(vnfUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(vnfUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
+        assertEquals(5L, dbserLocal.getObjectDeltas().get(vnfUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
         assertEquals(DeltaAction.CREATE, dbserLocal.getObjectDeltas().get(vfUri).getAction());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get(vfUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get(vfUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
-        assertEquals(1L, dbserLocal.getObjectDeltas().get(vfUri).getRelationshipDeltas().stream().filter(d -> d.getAction().equals(DeltaAction.CREATE_REL)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(vfUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(vfUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
+        assertEquals(1L, dbserLocal.getObjectDeltas().get(vfUri).getRelationshipDeltas().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.CREATE_REL)).count());
         dbserLocal.getObjectDeltas().values().forEach(od -> {
-            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID) ) {
+            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID)) {
                 fail(od.getUri() + " is missing " + AAIProperties.AAI_UUID);
             } else if (od.getPropertyDeltas().get(AAIProperties.AAI_UUID) == null) {
                 fail(od.getUri() + " " + AAIProperties.AAI_UUID + " is null");
@@ -294,36 +285,37 @@ public class DbSerializerDeltasTest extends AAISetup {
             }
         });
 
-        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
+        dbserLocal =
+                new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
         gvnf = dbserLocal.getLatestVersionView(gvnfVert);
         String rv = gvnf.getValue(AAIProperties.RESOURCE_VERSION);
         dbserLocal.delete(engine.tx().traversal().V(gvnfVert).next(), rv, true);
         System.out.println(gson.toJsonTree(dbserLocal.getObjectDeltas().values()));
 
-        assertFalse("generic-vnf no longer exists", engine.tx().traversal().V()
-            .has("aai-node-type", "generic-vnf")
-            .hasNext());
-        assertFalse("vf-module no longer exists", engine.tx().traversal().V()
-            .has("aai-node-type", "vf-module")
-            .hasNext());
+        assertFalse("generic-vnf no longer exists",
+                engine.tx().traversal().V().has("aai-node-type", "generic-vnf").hasNext());
+        assertFalse("vf-module no longer exists",
+                engine.tx().traversal().V().has("aai-node-type", "vf-module").hasNext());
 
         assertEquals(DeltaAction.DELETE, dbserLocal.getObjectDeltas().get(vnfUri).getAction());
-        assertEquals(12L, dbserLocal.getObjectDeltas().get(vnfUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.DELETE)).count());assertEquals(DeltaAction.DELETE, dbserLocal.getObjectDeltas().get(vfUri).getAction());
-        assertEquals(11L, dbserLocal.getObjectDeltas().get(vfUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.DELETE)).count());
+        assertEquals(12L, dbserLocal.getObjectDeltas().get(vnfUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.DELETE)).count());
+        assertEquals(DeltaAction.DELETE, dbserLocal.getObjectDeltas().get(vfUri).getAction());
+        assertEquals(11L, dbserLocal.getObjectDeltas().get(vfUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.DELETE)).count());
     }
 
-
-
     @Test
-    public void createComplexPserverWithRelDeleteRel() throws AAIException, UnsupportedEncodingException, URISyntaxException {
+    public void createComplexPserverWithRelDeleteRel()
+            throws AAIException, UnsupportedEncodingException, URISyntaxException {
         engine.startTransaction();
 
-        DBSerializer dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
+        DBSerializer dbserLocal =
+                new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
         Introspector complex = loader.introspectorFromName("complex");
         Vertex complexV = dbserLocal.createNewVertex(complex);
         final String complexUri = "/cloud-infrastructure/complexes/complex/c-id";
-        QueryParser uriQuery =
-            dbEngine.getQueryBuilder().createQueryFromURI(new URI(complexUri));
+        QueryParser uriQuery = dbEngine.getQueryBuilder().createQueryFromURI(new URI(complexUri));
 
         complex.setValue("physical-location-id", "c-id");
         complex.setValue("physical-location-type", "type");
@@ -333,17 +325,16 @@ public class DbSerializerDeltasTest extends AAISetup {
         complex.setValue("country", "abc");
         complex.setValue("region", "ef");
         dbserLocal.serializeToDb(complex, complexV, uriQuery, "complex", complex.marshal(false));
-        assertTrue("Complex created", engine.tx().traversal().V()
-            .has("aai-node-type", "complex")
-            .has("physical-location-id", "c-id")
-            .hasNext());
-
+        assertTrue("Complex created", engine.tx().traversal().V().has("aai-node-type", "complex")
+                .has("physical-location-id", "c-id").hasNext());
 
         assertEquals(DeltaAction.CREATE, dbserLocal.getObjectDeltas().get(complexUri).getAction());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get(complexUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
-        assertEquals(10L, dbserLocal.getObjectDeltas().get(complexUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(complexUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
+        assertEquals(10L, dbserLocal.getObjectDeltas().get(complexUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
         dbserLocal.getObjectDeltas().values().forEach(od -> {
-            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID) ) {
+            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID)) {
                 fail(od.getUri() + " is missing " + AAIProperties.AAI_UUID);
             } else if (od.getPropertyDeltas().get(AAIProperties.AAI_UUID) == null) {
                 fail(od.getUri() + " " + AAIProperties.AAI_UUID + " is null");
@@ -352,13 +343,12 @@ public class DbSerializerDeltasTest extends AAISetup {
             }
         });
 
-
-        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
+        dbserLocal =
+                new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
         Introspector pserver = loader.introspectorFromName("pserver");
         Vertex pserverV = dbserLocal.createNewVertex(pserver);
         final String pserverUri = "/cloud-infrastructure/pservers/pserver/ps";
-        uriQuery =
-            dbEngine.getQueryBuilder().createQueryFromURI(new URI(pserverUri));
+        uriQuery = dbEngine.getQueryBuilder().createQueryFromURI(new URI(pserverUri));
 
         Introspector relationship = loader.introspectorFromName("relationship");
         relationship.setValue("related-to", "complex");
@@ -372,25 +362,20 @@ public class DbSerializerDeltasTest extends AAISetup {
         System.out.println(pserver.marshal(true));
 
         dbserLocal.serializeToDb(pserver, pserverV, uriQuery, "pserver", pserver.marshal(false));
-        assertTrue("Pserver created", engine.tx().traversal().V()
-            .has("aai-node-type", "pserver")
-            .has("hostname", "ps")
-            .hasNext());
-        assertTrue("Pserver has edge to complex", engine.tx().traversal().V()
-            .has("aai-node-type", "pserver")
-            .has("hostname", "ps")
-            .bothE()
-            .otherV()
-            .has("aai-node-type", "complex")
-            .hasNext());
-
+        assertTrue("Pserver created",
+                engine.tx().traversal().V().has("aai-node-type", "pserver").has("hostname", "ps").hasNext());
+        assertTrue("Pserver has edge to complex", engine.tx().traversal().V().has("aai-node-type", "pserver")
+                .has("hostname", "ps").bothE().otherV().has("aai-node-type", "complex").hasNext());
 
         assertEquals(DeltaAction.CREATE, dbserLocal.getObjectDeltas().get(pserverUri).getAction());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
-        assertEquals(1L, dbserLocal.getObjectDeltas().get(pserverUri).getRelationshipDeltas().stream().filter(d -> d.getAction().equals(DeltaAction.CREATE_REL)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
+        assertEquals(1L, dbserLocal.getObjectDeltas().get(pserverUri).getRelationshipDeltas().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.CREATE_REL)).count());
         dbserLocal.getObjectDeltas().values().forEach(od -> {
-            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID) ) {
+            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID)) {
                 fail(od.getUri() + " is missing " + AAIProperties.AAI_UUID);
             } else if (od.getPropertyDeltas().get(AAIProperties.AAI_UUID) == null) {
                 fail(od.getUri() + " " + AAIProperties.AAI_UUID + " is null");
@@ -399,25 +384,22 @@ public class DbSerializerDeltasTest extends AAISetup {
             }
         });
 
-
-        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
+        dbserLocal =
+                new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST", AAIProperties.MINIMUM_DEPTH);
         dbserLocal.touchStandardVertexProperties(pserverV, false);
         dbserLocal.deleteEdge(relationship, pserverV);
-        assertFalse("Pserver no longer has edge to complex", engine.tx().traversal().V()
-            .has("aai-node-type", "pserver")
-            .has("hostname", "ps")
-            .bothE()
-            .otherV()
-            .has("aai-node-type", "complex")
-            .hasNext());
-
+        assertFalse("Pserver no longer has edge to complex", engine.tx().traversal().V().has("aai-node-type", "pserver")
+                .has("hostname", "ps").bothE().otherV().has("aai-node-type", "complex").hasNext());
 
         assertEquals(DeltaAction.UPDATE, dbserLocal.getObjectDeltas().get(pserverUri).getAction());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
-        assertEquals(3L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.UPDATE)).count());
-        assertEquals(1L, dbserLocal.getObjectDeltas().get(pserverUri).getRelationshipDeltas().stream().filter(d -> d.getAction().equals(DeltaAction.DELETE_REL)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
+        assertEquals(3L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.UPDATE)).count());
+        assertEquals(1L, dbserLocal.getObjectDeltas().get(pserverUri).getRelationshipDeltas().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.DELETE_REL)).count());
         dbserLocal.getObjectDeltas().values().forEach(od -> {
-            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID) ) {
+            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID)) {
                 fail(od.getUri() + " is missing " + AAIProperties.AAI_UUID);
             } else if (od.getPropertyDeltas().get(AAIProperties.AAI_UUID) == null) {
                 fail(od.getUri() + " " + AAIProperties.AAI_UUID + " is null");
@@ -428,19 +410,18 @@ public class DbSerializerDeltasTest extends AAISetup {
     }
 
     @Test
-    public void createComplexPserverWithRelUpdatePserverToDeleteRelAddPinterfaceThenDeleteComplex() throws AAIException, UnsupportedEncodingException, URISyntaxException {
+    public void createComplexPserverWithRelUpdatePserverToDeleteRelAddPinterfaceThenDeleteComplex()
+            throws AAIException, UnsupportedEncodingException, URISyntaxException {
         engine.startTransaction();
 
-        Gson gson = new GsonBuilder()
-            .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES)
-            .create();
+        Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES).create();
 
-        DBSerializer dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "create-complex", AAIProperties.MINIMUM_DEPTH);
+        DBSerializer dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "create-complex",
+                AAIProperties.MINIMUM_DEPTH);
         Introspector complex = loader.introspectorFromName("complex");
         Vertex complexV = dbserLocal.createNewVertex(complex);
         final String complexUri = "/cloud-infrastructure/complexes/complex/c-id-b";
-        QueryParser uriQuery =
-            dbEngine.getQueryBuilder().createQueryFromURI(new URI(complexUri));
+        QueryParser uriQuery = dbEngine.getQueryBuilder().createQueryFromURI(new URI(complexUri));
 
         complex.setValue("physical-location-id", "c-id-b");
         complex.setValue("physical-location-type", "type");
@@ -454,15 +435,15 @@ public class DbSerializerDeltasTest extends AAISetup {
         System.out.println("Create Complex");
         System.out.println(gson.toJsonTree(dbserLocal.getObjectDeltas().values()));
 
-        assertTrue("Complex created", engine.tx().traversal().V()
-            .has("aai-node-type", "complex")
-            .has("physical-location-id", "c-id-b")
-            .hasNext());
+        assertTrue("Complex created", engine.tx().traversal().V().has("aai-node-type", "complex")
+                .has("physical-location-id", "c-id-b").hasNext());
         assertEquals(DeltaAction.CREATE, dbserLocal.getObjectDeltas().get(complexUri).getAction());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get(complexUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
-        assertEquals(10L, dbserLocal.getObjectDeltas().get(complexUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(complexUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
+        assertEquals(10L, dbserLocal.getObjectDeltas().get(complexUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
         dbserLocal.getObjectDeltas().values().forEach(od -> {
-            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID) ) {
+            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID)) {
                 fail(od.getUri() + " is missing " + AAIProperties.AAI_UUID);
             } else if (od.getPropertyDeltas().get(AAIProperties.AAI_UUID) == null) {
                 fail(od.getUri() + " " + AAIProperties.AAI_UUID + " is null");
@@ -471,13 +452,12 @@ public class DbSerializerDeltasTest extends AAISetup {
             }
         });
 
-
-        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "create-pserver", AAIProperties.MINIMUM_DEPTH);
+        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "create-pserver",
+                AAIProperties.MINIMUM_DEPTH);
         Introspector pserver = loader.introspectorFromName("pserver");
         Vertex pserverV = dbserLocal.createNewVertex(pserver);
         final String pserverUri = "/cloud-infrastructure/pservers/pserver/ps-b";
-        uriQuery =
-            dbEngine.getQueryBuilder().createQueryFromURI(new URI(pserverUri));
+        uriQuery = dbEngine.getQueryBuilder().createQueryFromURI(new URI(pserverUri));
 
         Introspector relationship = loader.introspectorFromName("relationship");
         relationship.setValue("related-to", "complex");
@@ -502,35 +482,29 @@ public class DbSerializerDeltasTest extends AAISetup {
         System.out.println("Create Pserver with pinterface and relationship to complex ");
         System.out.println(gson.toJsonTree(dbserLocal.getObjectDeltas().values()));
 
-        assertTrue("Pserver created", engine.tx().traversal().V()
-            .has("aai-node-type", "pserver")
-            .has("hostname", "ps-b")
-            .hasNext());
-        assertTrue("Pserver has edge to complex", engine.tx().traversal().V()
-            .has("aai-node-type", "pserver")
-            .has("hostname", "ps-b")
-            .bothE()
-            .otherV()
-            .has("aai-node-type", "complex")
-            .hasNext());
-        assertTrue("Pserver has edge to pinterface", engine.tx().traversal().V()
-            .has("aai-node-type", "pserver")
-            .has("hostname", "ps-b")
-            .bothE()
-            .otherV()
-            .has("aai-node-type", "p-interface")
-            .hasNext());
+        assertTrue("Pserver created",
+                engine.tx().traversal().V().has("aai-node-type", "pserver").has("hostname", "ps-b").hasNext());
+        assertTrue("Pserver has edge to complex", engine.tx().traversal().V().has("aai-node-type", "pserver")
+                .has("hostname", "ps-b").bothE().otherV().has("aai-node-type", "complex").hasNext());
+        assertTrue("Pserver has edge to pinterface", engine.tx().traversal().V().has("aai-node-type", "pserver")
+                .has("hostname", "ps-b").bothE().otherV().has("aai-node-type", "p-interface").hasNext());
 
         assertEquals(DeltaAction.CREATE, dbserLocal.getObjectDeltas().get(pserverUri).getAction());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
-        assertEquals(5L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
-        assertEquals(1L, dbserLocal.getObjectDeltas().get(pserverUri).getRelationshipDeltas().stream().filter(d -> d.getAction().equals(DeltaAction.CREATE_REL)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
+        assertEquals(5L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
+        assertEquals(1L, dbserLocal.getObjectDeltas().get(pserverUri).getRelationshipDeltas().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.CREATE_REL)).count());
         assertEquals(DeltaAction.CREATE, dbserLocal.getObjectDeltas().get(pintUri).getAction());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get(pintUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get(pintUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
-        assertEquals(1L, dbserLocal.getObjectDeltas().get(pintUri).getRelationshipDeltas().stream().filter(d -> d.getAction().equals(DeltaAction.CREATE_REL)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(pintUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(pintUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
+        assertEquals(1L, dbserLocal.getObjectDeltas().get(pintUri).getRelationshipDeltas().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.CREATE_REL)).count());
         dbserLocal.getObjectDeltas().values().forEach(od -> {
-            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID) ) {
+            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID)) {
                 fail(od.getUri() + " is missing " + AAIProperties.AAI_UUID);
             } else if (od.getPropertyDeltas().get(AAIProperties.AAI_UUID) == null) {
                 fail(od.getUri() + " " + AAIProperties.AAI_UUID + " is null");
@@ -539,7 +513,8 @@ public class DbSerializerDeltasTest extends AAISetup {
             }
         });
 
-        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "update-pserver", AAIProperties.MINIMUM_DEPTH);
+        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "update-pserver",
+                AAIProperties.MINIMUM_DEPTH);
         pserver = dbserLocal.getLatestVersionView(pserverV);
         relationshipList = loader.introspectorFromName("relationship-list");
         relationshipList.setValue("relationship", Collections.emptyList());
@@ -552,21 +527,19 @@ public class DbSerializerDeltasTest extends AAISetup {
         System.out.println("Update pserver removing relationship to complex");
         System.out.println(gson.toJsonTree(dbserLocal.getObjectDeltas().values()));
 
-        assertFalse("Pserver no longer has edge to complex", engine.tx().traversal().V()
-            .has("aai-node-type", "pserver")
-            .has("hostname", "ps-b")
-            .bothE()
-            .otherV()
-            .has("aai-node-type", "complex")
-            .hasNext());
+        assertFalse("Pserver no longer has edge to complex", engine.tx().traversal().V().has("aai-node-type", "pserver")
+                .has("hostname", "ps-b").bothE().otherV().has("aai-node-type", "complex").hasNext());
 
         assertEquals(DeltaAction.UPDATE, dbserLocal.getObjectDeltas().get(pserverUri).getAction());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
-        assertEquals(4L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.UPDATE)).count());
-        assertEquals(1L, dbserLocal.getObjectDeltas().get(pserverUri).getRelationshipDeltas().stream().filter(d -> d.getAction().equals(DeltaAction.DELETE_REL)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.UPDATE)).count());
+        assertEquals(1L, dbserLocal.getObjectDeltas().get(pserverUri).getRelationshipDeltas().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.DELETE_REL)).count());
         assertFalse(dbserLocal.getObjectDeltas().containsKey(pintUri));
         dbserLocal.getObjectDeltas().values().forEach(od -> {
-            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID) ) {
+            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID)) {
                 fail(od.getUri() + " is missing " + AAIProperties.AAI_UUID);
             } else if (od.getPropertyDeltas().get(AAIProperties.AAI_UUID) == null) {
                 fail(od.getUri() + " " + AAIProperties.AAI_UUID + " is null");
@@ -575,7 +548,8 @@ public class DbSerializerDeltasTest extends AAISetup {
             }
         });
 
-        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "delete-pserver", AAIProperties.MINIMUM_DEPTH);
+        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "delete-pserver",
+                AAIProperties.MINIMUM_DEPTH);
         pserver = dbserLocal.getLatestVersionView(pserverV);
         String rv = pserver.getValue(AAIProperties.RESOURCE_VERSION);
         dbserLocal.delete(engine.tx().traversal().V(pserverV).next(), rv, true);
@@ -583,16 +557,16 @@ public class DbSerializerDeltasTest extends AAISetup {
         System.out.println("Delete pserver");
         System.out.println(gson.toJsonTree(dbserLocal.getObjectDeltas().values()));
 
-        assertFalse("pserver no longer exists", engine.tx().traversal().V()
-            .has("aai-node-type", "pserver")
-            .hasNext());
+        assertFalse("pserver no longer exists", engine.tx().traversal().V().has("aai-node-type", "pserver").hasNext());
 
         assertEquals(DeltaAction.DELETE, dbserLocal.getObjectDeltas().get(pserverUri).getAction());
-        assertEquals(12L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.DELETE)).count());
+        assertEquals(12L, dbserLocal.getObjectDeltas().get(pserverUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.DELETE)).count());
         assertEquals(DeltaAction.DELETE, dbserLocal.getObjectDeltas().get(pintUri).getAction());
-        assertEquals(10L, dbserLocal.getObjectDeltas().get(pintUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.DELETE)).count());
+        assertEquals(10L, dbserLocal.getObjectDeltas().get(pintUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.DELETE)).count());
         dbserLocal.getObjectDeltas().values().forEach(od -> {
-            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID) ) {
+            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID)) {
                 fail(od.getUri() + " is missing " + AAIProperties.AAI_UUID);
             } else if (od.getPropertyDeltas().get(AAIProperties.AAI_UUID) == null) {
                 fail(od.getUri() + " " + AAIProperties.AAI_UUID + " is null");
@@ -602,42 +576,37 @@ public class DbSerializerDeltasTest extends AAISetup {
         });
     }
 
-
     // /network/ipsec-configurations/ipsec-configuration/{ipsec-configuration-id}/vig-servers/vig-server/{vig-address-type}
     // ipaddress-v4-vig
     @Test
     public void createNodeWithListTest() throws AAIException, UnsupportedEncodingException, URISyntaxException {
-        Gson gson = new GsonBuilder()
-            .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES)
-            .create();
+        Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES).create();
 
         engine.startTransaction();
 
         /*
          * Create the parent ipsec-configuration
          */
-        DBSerializer dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "create-ipsec", AAIProperties.MINIMUM_DEPTH);
+        DBSerializer dbserLocal =
+                new DBSerializer(version, engine, introspectorFactoryType, "create-ipsec", AAIProperties.MINIMUM_DEPTH);
         Introspector ipsec = loader.introspectorFromName("ipsec-configuration");
         Vertex ipsecVert = dbserLocal.createNewVertex(ipsec);
         final String ipsecUri = "/network/ipsec-configurations/ipsec-configuration/ipsec";
-        QueryParser uriQuery =
-            dbEngine.getQueryBuilder().createQueryFromURI(new URI(ipsecUri));
+        QueryParser uriQuery = dbEngine.getQueryBuilder().createQueryFromURI(new URI(ipsecUri));
 
         ipsec.setValue("ipsec-configuration-id", "ipsec");
         dbserLocal.serializeToDb(ipsec, ipsecVert, uriQuery, "generic-vnf", ipsec.marshal(false));
         assertTrue("Original created vertex exists", engine.tx().traversal().V()
-            .has("aai-node-type", "ipsec-configuration")
-            .has("ipsec-configuration-id", "ipsec")
-            .hasNext());
+                .has("aai-node-type", "ipsec-configuration").has("ipsec-configuration-id", "ipsec").hasNext());
 
         System.out.println(gson.toJsonTree(dbserLocal.getObjectDeltas().values()));
         assertEquals(DeltaAction.CREATE, dbserLocal.getObjectDeltas().get(ipsecUri).getAction());
-        assertEquals(4L,
-            dbserLocal.getObjectDeltas().get(ipsecUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
-        assertEquals(4L,
-            dbserLocal.getObjectDeltas().get(ipsecUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(ipsecUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(ipsecUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
         dbserLocal.getObjectDeltas().values().forEach(od -> {
-            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID) ) {
+            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID)) {
                 fail(od.getUri() + " is missing " + AAIProperties.AAI_UUID);
             } else if (od.getPropertyDeltas().get(AAIProperties.AAI_UUID) == null) {
                 fail(od.getUri() + " " + AAIProperties.AAI_UUID + " is null");
@@ -649,7 +618,8 @@ public class DbSerializerDeltasTest extends AAISetup {
         /*
          * Create child vig-server with list property vig-address-type
          */
-        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "create-child-vig-server", AAIProperties.MINIMUM_DEPTH);
+        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "create-child-vig-server",
+                AAIProperties.MINIMUM_DEPTH);
         Introspector vig = loader.introspectorFromName("vig-server");
         Vertex vigVertex = dbserLocal.createNewVertex(vig);
         final String vigUri = "/network/ipsec-configurations/ipsec-configuration/ipsec/vig-servers/vig-server/vig";
@@ -661,27 +631,22 @@ public class DbSerializerDeltasTest extends AAISetup {
         list.add("address-2");
         vig.setValue("ipaddress-v4-vig", list);
         dbserLocal.serializeToDb(vig, vigVertex, uriQuery, "vf-module", vig.marshal(false));
-        assertTrue("Vertex is creted", engine.tx().traversal().V()
-            .has("aai-node-type", "vig-server")
-            .has("vig-address-type", "vig")
-            .hasNext());
-        assertTrue("Vf module has edge to gvnf", engine.tx().traversal().V()
-            .has("aai-node-type", "vig-server")
-            .has("vig-address-type", "vig")
-            .both()
-            .has("aai-node-type", "ipsec-configuration")
-            .has("ipsec-configuration-id", "ipsec")
-            .hasNext());
+        assertTrue("Vertex is creted", engine.tx().traversal().V().has("aai-node-type", "vig-server")
+                .has("vig-address-type", "vig").hasNext());
+        assertTrue("Vf module has edge to gvnf",
+                engine.tx().traversal().V().has("aai-node-type", "vig-server").has("vig-address-type", "vig").both()
+                        .has("aai-node-type", "ipsec-configuration").has("ipsec-configuration-id", "ipsec").hasNext());
 
         System.out.println(gson.toJsonTree(dbserLocal.getObjectDeltas().values()));
         assertEquals(DeltaAction.CREATE, dbserLocal.getObjectDeltas().get(vigUri).getAction());
-        assertEquals(4L,
-            dbserLocal.getObjectDeltas().get(vigUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
-        assertEquals(5L,
-            dbserLocal.getObjectDeltas().get(vigUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
-        assertThat(dbserLocal.getObjectDeltas().get(vigUri).getPropertyDeltas().get("ipaddress-v4-vig").getValue(), instanceOf(List.class));
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(vigUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
+        assertEquals(5L, dbserLocal.getObjectDeltas().get(vigUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.CREATE)).count());
+        assertThat(dbserLocal.getObjectDeltas().get(vigUri).getPropertyDeltas().get("ipaddress-v4-vig").getValue(),
+                instanceOf(List.class));
         dbserLocal.getObjectDeltas().values().forEach(od -> {
-            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID) ) {
+            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID)) {
                 fail(od.getUri() + " is missing " + AAIProperties.AAI_UUID);
             } else if (od.getPropertyDeltas().get(AAIProperties.AAI_UUID) == null) {
                 fail(od.getUri() + " " + AAIProperties.AAI_UUID + " is null");
@@ -693,7 +658,8 @@ public class DbSerializerDeltasTest extends AAISetup {
         /*
          * Update child vig-server with new list for vig-address-type
          */
-        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "update-child-vig-server", AAIProperties.MINIMUM_DEPTH);
+        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "update-child-vig-server",
+                AAIProperties.MINIMUM_DEPTH);
         vig = dbserLocal.getLatestVersionView(vigVertex);
         uriQuery = engine.getQueryBuilder(ipsecVert).createQueryFromURI(new URI(vigUri));
 
@@ -702,28 +668,24 @@ public class DbSerializerDeltasTest extends AAISetup {
         list.add("address-4");
         vig.setValue("ipaddress-v4-vig", list);
         dbserLocal.serializeToDb(vig, vigVertex, uriQuery, "vf-module", vig.marshal(false));
-        assertTrue("Vertex is still there", engine.tx().traversal().V()
-            .has("aai-node-type", "vig-server")
-            .has("vig-address-type", "vig")
-            .hasNext());
-        assertTrue("Vf module has edge to gvnf", engine.tx().traversal().V()
-            .has("aai-node-type", "vig-server")
-            .has("vig-address-type", "vig")
-            .both()
-            .has("aai-node-type", "ipsec-configuration")
-            .has("ipsec-configuration-id", "ipsec")
-            .hasNext());
+        assertTrue("Vertex is still there", engine.tx().traversal().V().has("aai-node-type", "vig-server")
+                .has("vig-address-type", "vig").hasNext());
+        assertTrue("Vf module has edge to gvnf",
+                engine.tx().traversal().V().has("aai-node-type", "vig-server").has("vig-address-type", "vig").both()
+                        .has("aai-node-type", "ipsec-configuration").has("ipsec-configuration-id", "ipsec").hasNext());
 
         System.out.println(gson.toJsonTree(dbserLocal.getObjectDeltas().values()));
         assertEquals(DeltaAction.UPDATE, dbserLocal.getObjectDeltas().get(vigUri).getAction());
-        assertEquals(4L,
-            dbserLocal.getObjectDeltas().get(vigUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
-        assertEquals(4L,
-            dbserLocal.getObjectDeltas().get(vigUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.UPDATE)).count());
-        assertThat(dbserLocal.getObjectDeltas().get(vigUri).getPropertyDeltas().get("ipaddress-v4-vig").getValue(), instanceOf(List.class));
-        assertThat(dbserLocal.getObjectDeltas().get(vigUri).getPropertyDeltas().get("ipaddress-v4-vig").getOldValue(), instanceOf(List.class));
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(vigUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.STATIC)).count());
+        assertEquals(4L, dbserLocal.getObjectDeltas().get(vigUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.UPDATE)).count());
+        assertThat(dbserLocal.getObjectDeltas().get(vigUri).getPropertyDeltas().get("ipaddress-v4-vig").getValue(),
+                instanceOf(List.class));
+        assertThat(dbserLocal.getObjectDeltas().get(vigUri).getPropertyDeltas().get("ipaddress-v4-vig").getOldValue(),
+                instanceOf(List.class));
         dbserLocal.getObjectDeltas().values().forEach(od -> {
-            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID) ) {
+            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID)) {
                 fail(od.getUri() + " is missing " + AAIProperties.AAI_UUID);
             } else if (od.getPropertyDeltas().get(AAIProperties.AAI_UUID) == null) {
                 fail(od.getUri() + " " + AAIProperties.AAI_UUID + " is null");
@@ -732,26 +694,28 @@ public class DbSerializerDeltasTest extends AAISetup {
             }
         });
         /*
-        * Delete top level
+         * Delete top level
          */
-        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "delete-ipsec", AAIProperties.MINIMUM_DEPTH);
+        dbserLocal =
+                new DBSerializer(version, engine, introspectorFactoryType, "delete-ipsec", AAIProperties.MINIMUM_DEPTH);
         ipsec = dbserLocal.getLatestVersionView(ipsecVert);
         String rv = ipsec.getValue(AAIProperties.RESOURCE_VERSION);
         dbserLocal.delete(engine.tx().traversal().V(ipsecVert).next(), rv, true);
         System.out.println(gson.toJsonTree(dbserLocal.getObjectDeltas().values()));
 
-        assertFalse("ipsec-configuration no longer exists", engine.tx().traversal().V()
-            .has("aai-node-type", "ipsec-configuration")
-            .hasNext());
-        assertFalse("vig-server no longer exists", engine.tx().traversal().V()
-            .has("aai-node-type", "vig-server")
-            .hasNext());
+        assertFalse("ipsec-configuration no longer exists",
+                engine.tx().traversal().V().has("aai-node-type", "ipsec-configuration").hasNext());
+        assertFalse("vig-server no longer exists",
+                engine.tx().traversal().V().has("aai-node-type", "vig-server").hasNext());
 
         assertEquals(DeltaAction.DELETE, dbserLocal.getObjectDeltas().get(ipsecUri).getAction());
-        assertEquals(9L, dbserLocal.getObjectDeltas().get(ipsecUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.DELETE)).count());assertEquals(DeltaAction.DELETE, dbserLocal.getObjectDeltas().get(vigUri).getAction());
-        assertEquals(10L, dbserLocal.getObjectDeltas().get(vigUri).getPropertyDeltas().values().stream().filter(d -> d.getAction().equals(DeltaAction.DELETE)).count());
+        assertEquals(9L, dbserLocal.getObjectDeltas().get(ipsecUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.DELETE)).count());
+        assertEquals(DeltaAction.DELETE, dbserLocal.getObjectDeltas().get(vigUri).getAction());
+        assertEquals(10L, dbserLocal.getObjectDeltas().get(vigUri).getPropertyDeltas().values().stream()
+                .filter(d -> d.getAction().equals(DeltaAction.DELETE)).count());
         dbserLocal.getObjectDeltas().values().forEach(od -> {
-            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID) ) {
+            if (!od.getPropertyDeltas().containsKey(AAIProperties.AAI_UUID)) {
                 fail(od.getUri() + " is missing " + AAIProperties.AAI_UUID);
             } else if (od.getPropertyDeltas().get(AAIProperties.AAI_UUID) == null) {
                 fail(od.getUri() + " " + AAIProperties.AAI_UUID + " is null");
index cc1fc03..4c4fc06 100644 (file)
 
 package org.onap.aai.serialization.db;
 
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.*;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.*;
+import java.util.stream.Collectors;
+
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.janusgraph.core.JanusGraphFactory;
@@ -45,15 +54,6 @@ import org.onap.aai.setup.SchemaVersion;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.*;
-import java.util.stream.Collectors;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
-
 @RunWith(value = Parameterized.class)
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class DbSerializerNotificationEventsTest extends AAISetup {
@@ -98,24 +98,25 @@ public class DbSerializerNotificationEventsTest extends AAISetup {
     }
 
     /*
-    Create Complex
-    Create Pserver with pinterface and relationship to complex
-    Update pserver removing relationship to complex
-    Update pserver adding a second p-interface
-    Add l-interface directly to the 2nd p-interface
-    Delete pserver
+     * Create Complex
+     * Create Pserver with pinterface and relationship to complex
+     * Update pserver removing relationship to complex
+     * Update pserver adding a second p-interface
+     * Add l-interface directly to the 2nd p-interface
+     * Delete pserver
      */
     @Test
-    public void createComplexPserverWithRelUpdatePserverToDeleteRelAddPinterfaceThenDeleteComplexCheckingUpdatedListTest() throws AAIException, UnsupportedEncodingException, URISyntaxException {
+    public void createComplexPserverWithRelUpdatePserverToDeleteRelAddPinterfaceThenDeleteComplexCheckingUpdatedListTest()
+            throws AAIException, UnsupportedEncodingException, URISyntaxException {
         engine.startTransaction();
 
         System.out.println("Create Complex");
-        DBSerializer dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "create-complex", AAIProperties.MINIMUM_DEPTH);
+        DBSerializer dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "create-complex",
+                AAIProperties.MINIMUM_DEPTH);
         Introspector complex = loader.introspectorFromName("complex");
         Vertex complexV = dbserLocal.createNewVertex(complex);
         final String complexUri = "/cloud-infrastructure/complexes/complex/c-id-b";
-        QueryParser uriQuery =
-            engine.getQueryBuilder().createQueryFromURI(new URI(complexUri));
+        QueryParser uriQuery = engine.getQueryBuilder().createQueryFromURI(new URI(complexUri));
 
         complex.setValue("physical-location-id", "c-id-b");
         complex.setValue("physical-location-type", "type");
@@ -126,30 +127,25 @@ public class DbSerializerNotificationEventsTest extends AAISetup {
         complex.setValue("region", "ef");
         dbserLocal.serializeToDb(complex, complexV, uriQuery, "complex", complex.marshal(false));
 
-        assertTrue("Complex created", engine.tx().traversal().V()
-            .has("aai-node-type", "complex")
-            .has("physical-location-id", "c-id-b")
-            .hasNext());
+        assertTrue("Complex created", engine.tx().traversal().V().has("aai-node-type", "complex")
+                .has("physical-location-id", "c-id-b").hasNext());
         Map<Vertex, Boolean> updated = getUpdatedVertexes(dbserLocal);
         assertEquals("Number of updated vertexes", 1, updated.size());
         assertThat("Only modified vertexes are in the updated set",
-            updated.keySet().stream().map(v -> v.<String>value(AAIProperties.AAI_URI)).collect(Collectors.toSet()),
-            is(Collections.singleton(complexUri)));
-        List<String> didNotUpdateStandardVertexProps = updated.entrySet().stream()
-            .filter(e -> !e.getValue())
-            .map(e -> e.getKey().<String>value(AAIProperties.AAI_URI)).collect(Collectors.toList());
-        assertThat("Vertexes should all have their standard props updated", didNotUpdateStandardVertexProps, is(Collections.emptyList()));
-
-
-
+                updated.keySet().stream().map(v -> v.<String>value(AAIProperties.AAI_URI)).collect(Collectors.toSet()),
+                is(Collections.singleton(complexUri)));
+        List<String> didNotUpdateStandardVertexProps = updated.entrySet().stream().filter(e -> !e.getValue())
+                .map(e -> e.getKey().<String>value(AAIProperties.AAI_URI)).collect(Collectors.toList());
+        assertThat("Vertexes should all have their standard props updated", didNotUpdateStandardVertexProps,
+                is(Collections.emptyList()));
 
         System.out.println("Create Pserver with pinterface and relationship to complex ");
-        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "create-pserver", AAIProperties.MINIMUM_DEPTH);
+        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "create-pserver",
+                AAIProperties.MINIMUM_DEPTH);
         Introspector pserver = loader.introspectorFromName("pserver");
         Vertex pserverV = dbserLocal.createNewVertex(pserver);
         final String pserverUri = "/cloud-infrastructure/pservers/pserver/ps-b";
-        uriQuery =
-            engine.getQueryBuilder().createQueryFromURI(new URI(pserverUri));
+        uriQuery = engine.getQueryBuilder().createQueryFromURI(new URI(pserverUri));
 
         Introspector relationship = loader.introspectorFromName("relationship");
         relationship.setValue("related-to", "complex");
@@ -170,37 +166,25 @@ public class DbSerializerNotificationEventsTest extends AAISetup {
         pserver.setValue("p-interfaces", pints.getUnderlyingObject());
         dbserLocal.serializeToDb(pserver, pserverV, uriQuery, "pserver", pserver.marshal(false));
 
-        assertTrue("Pserver created", engine.tx().traversal().V()
-            .has("aai-node-type", "pserver")
-            .has("hostname", "ps-b")
-            .hasNext());
-        assertTrue("Pserver has edge to complex", engine.tx().traversal().V()
-            .has("aai-node-type", "pserver")
-            .has("hostname", "ps-b")
-            .bothE()
-            .otherV()
-            .has("aai-node-type", "complex")
-            .hasNext());
-        assertTrue("Pserver has edge to pinterface", engine.tx().traversal().V()
-            .has("aai-node-type", "pserver")
-            .has("hostname", "ps-b")
-            .bothE()
-            .otherV()
-            .has("aai-node-type", "p-interface")
-            .hasNext());
+        assertTrue("Pserver created",
+                engine.tx().traversal().V().has("aai-node-type", "pserver").has("hostname", "ps-b").hasNext());
+        assertTrue("Pserver has edge to complex", engine.tx().traversal().V().has("aai-node-type", "pserver")
+                .has("hostname", "ps-b").bothE().otherV().has("aai-node-type", "complex").hasNext());
+        assertTrue("Pserver has edge to pinterface", engine.tx().traversal().V().has("aai-node-type", "pserver")
+                .has("hostname", "ps-b").bothE().otherV().has("aai-node-type", "p-interface").hasNext());
         updated = getUpdatedVertexes(dbserLocal);
         assertEquals("Number of updated vertexes", 3, updated.size());
         assertThat("Only modified vertexes are in the updated set",
-            updated.keySet().stream().map(v -> v.<String>value(AAIProperties.AAI_URI)).collect(Collectors.toSet()),
-            is(new HashSet<>(Arrays.asList(pserverUri, pintUri, complexUri))));
-        didNotUpdateStandardVertexProps = updated.entrySet().stream()
-            .filter(e -> !e.getValue())
-            .map(e -> e.getKey().<String>value(AAIProperties.AAI_URI)).collect(Collectors.toList());
-        assertThat("Vertexes should all have their standard props updated", didNotUpdateStandardVertexProps, is(Collections.emptyList()));
-
+                updated.keySet().stream().map(v -> v.<String>value(AAIProperties.AAI_URI)).collect(Collectors.toSet()),
+                is(new HashSet<>(Arrays.asList(pserverUri, pintUri, complexUri))));
+        didNotUpdateStandardVertexProps = updated.entrySet().stream().filter(e -> !e.getValue())
+                .map(e -> e.getKey().<String>value(AAIProperties.AAI_URI)).collect(Collectors.toList());
+        assertThat("Vertexes should all have their standard props updated", didNotUpdateStandardVertexProps,
+                is(Collections.emptyList()));
 
         System.out.println("Update pserver removing relationship to complex");
-        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "update-pserver", AAIProperties.MINIMUM_DEPTH);
+        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "update-pserver",
+                AAIProperties.MINIMUM_DEPTH);
         pserver = dbserLocal.getLatestVersionView(pserverV);
         relationshipList = loader.introspectorFromName("relationship-list");
         relationshipList.setValue("relationship", Collections.emptyList());
@@ -209,114 +193,89 @@ public class DbSerializerNotificationEventsTest extends AAISetup {
         pserver.setValue("number-of-cpus", 99);
         dbserLocal.serializeToDb(pserver, pserverV, uriQuery, "pserver", pserver.marshal(false));
 
-        assertFalse("Pserver no longer has edge to complex", engine.tx().traversal().V()
-            .has("aai-node-type", "pserver")
-            .has("hostname", "ps-b")
-            .bothE()
-            .otherV()
-            .has("aai-node-type", "complex")
-            .hasNext());
+        assertFalse("Pserver no longer has edge to complex", engine.tx().traversal().V().has("aai-node-type", "pserver")
+                .has("hostname", "ps-b").bothE().otherV().has("aai-node-type", "complex").hasNext());
         updated = getUpdatedVertexes(dbserLocal);
         assertEquals("Number of updated vertexes", 2, updated.size());
         assertThat("Only modified vertexes are in the updated set",
-            updated.keySet().stream().map(v -> v.<String>value(AAIProperties.AAI_URI)).collect(Collectors.toSet()),
-            is(new HashSet<>(Arrays.asList(pserverUri, complexUri))));
-        didNotUpdateStandardVertexProps = updated.entrySet().stream()
-            .filter(e -> !e.getValue())
-            .map(e -> e.getKey().<String>value(AAIProperties.AAI_URI)).collect(Collectors.toList());
-        assertThat("Vertexes should all have their standard props updated", didNotUpdateStandardVertexProps, is(Collections.emptyList()));
-
-
+                updated.keySet().stream().map(v -> v.<String>value(AAIProperties.AAI_URI)).collect(Collectors.toSet()),
+                is(new HashSet<>(Arrays.asList(pserverUri, complexUri))));
+        didNotUpdateStandardVertexProps = updated.entrySet().stream().filter(e -> !e.getValue())
+                .map(e -> e.getKey().<String>value(AAIProperties.AAI_URI)).collect(Collectors.toList());
+        assertThat("Vertexes should all have their standard props updated", didNotUpdateStandardVertexProps,
+                is(Collections.emptyList()));
 
         System.out.println("Update pserver adding a second p-interface");
-        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "update-pserver", AAIProperties.MINIMUM_DEPTH);
+        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "update-pserver",
+                AAIProperties.MINIMUM_DEPTH);
         pserver = dbserLocal.getLatestVersionView(pserverV);
         Introspector pint2 = loader.introspectorFromName("p-interface");
         pint2.setValue("interface-name", "pint-2");
         pints = pserver.getWrappedValue("p-interfaces");
-        List<Object> pintList = pserver.getWrappedValue("p-interfaces").getWrappedListValue("p-interface")
-            .stream().map(Introspector::getUnderlyingObject).collect(Collectors.toList());
+        List<Object> pintList = pserver.getWrappedValue("p-interfaces").getWrappedListValue("p-interface").stream()
+                .map(Introspector::getUnderlyingObject).collect(Collectors.toList());
         pintList.add(pint2.getUnderlyingObject());
         pints.setValue("p-interface", pintList);
         pserver.setValue("p-interfaces", pints.getUnderlyingObject());
         final String pint2Uri = pserverUri + "/p-interfaces/p-interface/pint-2";
         dbserLocal.serializeToDb(pserver, pserverV, uriQuery, "pserver", pserver.marshal(false));
 
-        assertTrue("Pserver has edge to pinterface 2", engine.tx().traversal().V()
-            .has("aai-node-type", "pserver")
-            .has("hostname", "ps-b")
-            .in()
-            .has("aai-node-type", "p-interface")
-            .has("interface-name","pint-2")
-            .hasNext());
-        assertTrue("p-interface 2 created", engine.tx().traversal().V()
-            .has("aai-node-type", "p-interface")
-            .has("interface-name", "pint-2")
-            .has(AAIProperties.AAI_URI, pint2Uri)
-            .hasNext());
+        assertTrue("Pserver has edge to pinterface 2",
+                engine.tx().traversal().V().has("aai-node-type", "pserver").has("hostname", "ps-b").in()
+                        .has("aai-node-type", "p-interface").has("interface-name", "pint-2").hasNext());
+        assertTrue("p-interface 2 created", engine.tx().traversal().V().has("aai-node-type", "p-interface")
+                .has("interface-name", "pint-2").has(AAIProperties.AAI_URI, pint2Uri).hasNext());
         updated = getUpdatedVertexes(dbserLocal);
         assertEquals("Number of updated vertexes", 1, updated.size());
         assertThat("Only modified vertexes are in the updated set",
-            updated.keySet().stream().map(v -> v.<String>value(AAIProperties.AAI_URI)).collect(Collectors.toSet()),
-            is(Collections.singleton(pint2Uri)));
-        didNotUpdateStandardVertexProps = updated.entrySet().stream()
-            .filter(e -> !e.getValue())
-            .map(e -> e.getKey().<String>value(AAIProperties.AAI_URI)).collect(Collectors.toList());
-        assertThat("Vertexes should all have their standard props updated", didNotUpdateStandardVertexProps, is(Collections.emptyList()));
-
+                updated.keySet().stream().map(v -> v.<String>value(AAIProperties.AAI_URI)).collect(Collectors.toSet()),
+                is(Collections.singleton(pint2Uri)));
+        didNotUpdateStandardVertexProps = updated.entrySet().stream().filter(e -> !e.getValue())
+                .map(e -> e.getKey().<String>value(AAIProperties.AAI_URI)).collect(Collectors.toList());
+        assertThat("Vertexes should all have their standard props updated", didNotUpdateStandardVertexProps,
+                is(Collections.emptyList()));
 
         System.out.println("Add l-interface directly to the 2nd p-interface");
-        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "create-pserver", AAIProperties.MINIMUM_DEPTH);
+        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "create-pserver",
+                AAIProperties.MINIMUM_DEPTH);
         Introspector lInt = loader.introspectorFromName("l-interface");
         Vertex lIntV = dbserLocal.createNewVertex(lInt);
         final String lIntUri = pint2Uri + "/l-interfaces/l-interface/lint-1";
-        uriQuery =
-            engine.getQueryBuilder().createQueryFromURI(new URI(lIntUri));
+        uriQuery = engine.getQueryBuilder().createQueryFromURI(new URI(lIntUri));
         lInt.setValue("interface-name", "lint-1");
         dbserLocal.serializeToDb(lInt, lIntV, uriQuery, "l-interface", lInt.marshal(false));
 
-        assertTrue("l-interface created", engine.tx().traversal().V()
-            .has("aai-node-type", "l-interface")
-            .has("interface-name", "lint-1")
-            .hasNext());
-
-        assertTrue("Pserver has edge to pinterface to l-interface", engine.tx().traversal().V()
-            .has("aai-node-type", "pserver")
-            .has("hostname", "ps-b")
-            .bothE()
-            .otherV()
-            .has("aai-node-type", "p-interface")
-            .bothE()
-            .otherV()
-            .has("aai-node-type", "l-interface")
-            .hasNext());
+        assertTrue("l-interface created", engine.tx().traversal().V().has("aai-node-type", "l-interface")
+                .has("interface-name", "lint-1").hasNext());
+
+        assertTrue("Pserver has edge to pinterface to l-interface",
+                engine.tx().traversal().V().has("aai-node-type", "pserver").has("hostname", "ps-b").bothE().otherV()
+                        .has("aai-node-type", "p-interface").bothE().otherV().has("aai-node-type", "l-interface")
+                        .hasNext());
         updated = getUpdatedVertexes(dbserLocal);
         assertEquals("Number of updated vertexes", 1, updated.size());
         assertThat("Only modified vertexes are in the updated set",
-            updated.keySet().stream().map(v -> v.<String>value(AAIProperties.AAI_URI)).collect(Collectors.toSet()),
-            is(new HashSet<>(Collections.singletonList(lIntUri))));
-        didNotUpdateStandardVertexProps = updated.entrySet().stream()
-            .filter(e -> !e.getValue())
-            .map(e -> e.getKey().<String>value(AAIProperties.AAI_URI)).collect(Collectors.toList());
-        assertThat("Vertexes should all have their standard props updated", didNotUpdateStandardVertexProps, is(Collections.emptyList()));
-
+                updated.keySet().stream().map(v -> v.<String>value(AAIProperties.AAI_URI)).collect(Collectors.toSet()),
+                is(new HashSet<>(Collections.singletonList(lIntUri))));
+        didNotUpdateStandardVertexProps = updated.entrySet().stream().filter(e -> !e.getValue())
+                .map(e -> e.getKey().<String>value(AAIProperties.AAI_URI)).collect(Collectors.toList());
+        assertThat("Vertexes should all have their standard props updated", didNotUpdateStandardVertexProps,
+                is(Collections.emptyList()));
 
         System.out.println("Delete pserver");
-        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "delete-pserver", AAIProperties.MINIMUM_DEPTH);
+        dbserLocal = new DBSerializer(version, engine, introspectorFactoryType, "delete-pserver",
+                AAIProperties.MINIMUM_DEPTH);
         pserver = dbserLocal.getLatestVersionView(pserverV);
         String rv = pserver.getValue(AAIProperties.RESOURCE_VERSION);
         dbserLocal.delete(engine.tx().traversal().V(pserverV).next(), rv, true);
 
-        assertFalse("pserver no longer exists", engine.tx().traversal().V()
-            .has("aai-node-type", "pserver")
-            .hasNext());
+        assertFalse("pserver no longer exists", engine.tx().traversal().V().has("aai-node-type", "pserver").hasNext());
         updated = getUpdatedVertexes(dbserLocal);
         assertEquals("Number of updated vertexes", 0, updated.size());
-        didNotUpdateStandardVertexProps = updated.entrySet().stream()
-            .filter(e -> !e.getValue())
-            .map(e -> e.getKey().<String>value(AAIProperties.AAI_URI)).collect(Collectors.toList());
-        assertThat("Vertexes should all have their standard props updated", didNotUpdateStandardVertexProps, is(Collections.emptyList()));
-
+        didNotUpdateStandardVertexProps = updated.entrySet().stream().filter(e -> !e.getValue())
+                .map(e -> e.getKey().<String>value(AAIProperties.AAI_URI)).collect(Collectors.toList());
+        assertThat("Vertexes should all have their standard props updated", didNotUpdateStandardVertexProps,
+                is(Collections.emptyList()));
 
     }
 
@@ -326,5 +285,4 @@ public class DbSerializerNotificationEventsTest extends AAISetup {
         return updated;
     }
 
-
 }
index 27d7731..282f645 100644 (file)
 
 package org.onap.aai.serialization.db;
 
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.*;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -48,16 +58,6 @@ import org.onap.aai.util.AAIConstants;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.*;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
 @RunWith(value = Parameterized.class)
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class DbSerializerTest extends AAISetup {
@@ -165,58 +165,42 @@ public class DbSerializerTest extends AAISetup {
          */
 
         Vertex l3interipv4addresslist_1 = graph.addVertex("aai-node-type", "l3-interface-ipv4-address-list",
-                "l3-interface-ipv4-address", "l3-interface-ipv4-address-1",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
-        Vertex subnet_2 = graph.addVertex("aai-node-type", "subnet", "subnet-id", "subnet-id-2",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+                "l3-interface-ipv4-address", "l3-interface-ipv4-address-1", AAIProperties.AAI_UUID,
+                UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot",
+                AAIProperties.RESOURCE_VERSION, "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
+                AAIProperties.LAST_MOD_TS, 333L);
+        Vertex subnet_2 = graph.addVertex("aai-node-type", "subnet", "subnet-id", "subnet-id-2", AAIProperties.AAI_UUID,
+                UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot",
+                AAIProperties.RESOURCE_VERSION, "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
+                AAIProperties.LAST_MOD_TS, 333L);
         Vertex l3interipv6addresslist_3 = graph.addVertex("aai-node-type", "l3-interface-ipv6-address-list",
-                "l3-interface-ipv6-address", "l3-interface-ipv6-address-3",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
-        Vertex subnet_4 = graph.addVertex("aai-node-type", "subnet", "subnet-id", "subnet-id-4",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
-        Vertex subnet_5 = graph.addVertex("aai-node-type", "subnet", "subnet-id", "subnet-id-5",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
-        Vertex l3network_6 = graph.addVertex("aai-node-type", "l3-network", "network-id", "network-id-6", "network-name", "network-name-6",
-                    AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-                    AAIProperties.CREATED_TS, 123L,
-                    AAIProperties.SOURCE_OF_TRUTH, "sot",
-                    AAIProperties.RESOURCE_VERSION, "123",
-                    AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-                    AAIProperties.LAST_MOD_TS, 333L);
+                "l3-interface-ipv6-address", "l3-interface-ipv6-address-3", AAIProperties.AAI_UUID,
+                UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot",
+                AAIProperties.RESOURCE_VERSION, "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
+                AAIProperties.LAST_MOD_TS, 333L);
+        Vertex subnet_4 = graph.addVertex("aai-node-type", "subnet", "subnet-id", "subnet-id-4", AAIProperties.AAI_UUID,
+                UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot",
+                AAIProperties.RESOURCE_VERSION, "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
+                AAIProperties.LAST_MOD_TS, 333L);
+        Vertex subnet_5 = graph.addVertex("aai-node-type", "subnet", "subnet-id", "subnet-id-5", AAIProperties.AAI_UUID,
+                UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot",
+                AAIProperties.RESOURCE_VERSION, "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
+                AAIProperties.LAST_MOD_TS, 333L);
+        Vertex l3network_6 = graph.addVertex("aai-node-type", "l3-network", "network-id", "network-id-6",
+                "network-name", "network-name-6", AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333L);
 
         GraphTraversalSource g = graph.traversal();
         edgeSer.addEdge(g, l3interipv4addresslist_1, subnet_2);
         edgeSer.addEdge(g, l3interipv6addresslist_3, subnet_4);
         edgeSer.addTreeEdge(g, subnet_5, l3network_6);
 
-        l3interipv4addresslist_1.property(AAIProperties.AAI_URI, dbser.getURIForVertex(l3interipv4addresslist_1).toString());
+        l3interipv4addresslist_1.property(AAIProperties.AAI_URI,
+                dbser.getURIForVertex(l3interipv4addresslist_1).toString());
         subnet_2.property(AAIProperties.AAI_URI, dbser.getURIForVertex(subnet_2).toString());
-        l3interipv6addresslist_3.property(AAIProperties.AAI_URI, dbser.getURIForVertex(l3interipv6addresslist_3).toString());
+        l3interipv6addresslist_3.property(AAIProperties.AAI_URI,
+                dbser.getURIForVertex(l3interipv6addresslist_3).toString());
         subnet_4.property(AAIProperties.AAI_URI, dbser.getURIForVertex(subnet_4).toString());
         subnet_5.property(AAIProperties.AAI_URI, dbser.getURIForVertex(subnet_5).toString());
         l3network_6.property(AAIProperties.AAI_URI, dbser.getURIForVertex(l3network_6).toString());
@@ -230,52 +214,31 @@ public class DbSerializerTest extends AAISetup {
          */
 
         Vertex l3network1 = graph.addVertex("aai-node-type", "l3-network", "network-id", "network-id-v1",
-                "network-name", "network-name-v1",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+                "network-name", "network-name-v1", AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333L);
         Vertex l3network2 = graph.addVertex("aai-node-type", "l3-network", "network-id", "network-id-v2",
-                "network-name", "network-name-v2",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
-        Vertex subnet1 = graph.addVertex("aai-node-type", "subnet", "subnet-id", "subnet-id-v1",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
-        Vertex subnet2 = graph.addVertex("aai-node-type", "subnet", "subnet-id", "subnet-id-v2",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+                "network-name", "network-name-v2", AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333L);
+        Vertex subnet1 = graph.addVertex("aai-node-type", "subnet", "subnet-id", "subnet-id-v1", AAIProperties.AAI_UUID,
+                UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot",
+                AAIProperties.RESOURCE_VERSION, "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
+                AAIProperties.LAST_MOD_TS, 333L);
+        Vertex subnet2 = graph.addVertex("aai-node-type", "subnet", "subnet-id", "subnet-id-v2", AAIProperties.AAI_UUID,
+                UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot",
+                AAIProperties.RESOURCE_VERSION, "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
+                AAIProperties.LAST_MOD_TS, 333L);
 
         Vertex l3interipv4addresslist_1 = graph.addVertex("aai-node-type", "l3-interface-ipv4-address-list",
-                "l3-interface-ipv4-address", "l3-intr-v1",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+                "l3-interface-ipv4-address", "l3-intr-v1", AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333L);
         Vertex l3interipv6addresslist_1 = graph.addVertex("aai-node-type", "l3-interface-ipv6-address-list",
-                "l3-interface-ipv6-address", "l3-interface-ipv6-v1",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+                "l3-interface-ipv6-address", "l3-interface-ipv6-v1", AAIProperties.AAI_UUID,
+                UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot",
+                AAIProperties.RESOURCE_VERSION, "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
+                AAIProperties.LAST_MOD_TS, 333L);
 
         GraphTraversalSource g = graph.traversal();
         edgeSer.addTreeEdge(g, subnet1, l3network1);
@@ -285,13 +248,12 @@ public class DbSerializerTest extends AAISetup {
         edgeSer.addTreeEdge(g, subnet2, l3network2);
 
         subnet1.property(AAIProperties.AAI_URI, dbser.getURIForVertex(subnet1).toString());
-        l3interipv4addresslist_1.property(AAIProperties.AAI_URI, dbser.getURIForVertex(l3interipv4addresslist_1).toString());
+        l3interipv4addresslist_1.property(AAIProperties.AAI_URI,
+                dbser.getURIForVertex(l3interipv4addresslist_1).toString());
         l3network1.property(AAIProperties.AAI_URI, dbser.getURIForVertex(l3network1).toString());
         subnet2.property(AAIProperties.AAI_URI, dbser.getURIForVertex(subnet2).toString());
         l3network2.property(AAIProperties.AAI_URI, dbser.getURIForVertex(l3network2).toString());
 
-
-
     }
 
     private void vserverSetup() throws AAIException, UnsupportedEncodingException {
@@ -300,61 +262,40 @@ public class DbSerializerTest extends AAISetup {
          * and edges
          */
 
-        Vertex vserver1 = graph.addVertex("aai-node-type", "vserver", "vserver-id", "vss1",
-            AAIProperties.AAI_URI, "/cloud-infrastructure/cloud-regions/cloud-region/me/123/tenants/tenant/453/vservers/vserver/vss1",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+        Vertex vserver1 = graph.addVertex("aai-node-type", "vserver", "vserver-id", "vss1", AAIProperties.AAI_URI,
+                "/cloud-infrastructure/cloud-regions/cloud-region/me/123/tenants/tenant/453/vservers/vserver/vss1",
+                AAIProperties.AAI_UUID, UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123L,
+                AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION, "123",
+                AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333L);
 
         Vertex lInterface1 = graph.addVertex("aai-node-type", "l-interface", "interface-name", "lIntr1",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+                AAIProperties.AAI_UUID, UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123L,
+                AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION, "123",
+                AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333L);
         Vertex lInterface2 = graph.addVertex("aai-node-type", "l-interface", "interface-name", "lIntr2",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+                AAIProperties.AAI_UUID, UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123L,
+                AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION, "123",
+                AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333L);
 
         Vertex logicalLink1 = graph.addVertex("aai-node-type", "logical-link", "link-name", "logLink1",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+                AAIProperties.AAI_UUID, UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123L,
+                AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION, "123",
+                AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333L);
         Vertex logicalLink2 = graph.addVertex("aai-node-type", "logical-link", "link-name", "logLink2",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+                AAIProperties.AAI_UUID, UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123L,
+                AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION, "123",
+                AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333L);
 
         Vertex l3interipv4addresslist_1 = graph.addVertex("aai-node-type", "l3-interface-ipv4-address-list",
-                "l3-interface-ipv4-address", "l3-intr-ipv4-address-1",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+                "l3-interface-ipv4-address", "l3-intr-ipv4-address-1", AAIProperties.AAI_UUID,
+                UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot",
+                AAIProperties.RESOURCE_VERSION, "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
+                AAIProperties.LAST_MOD_TS, 333L);
         Vertex l3interipv6addresslist_2 = graph.addVertex("aai-node-type", "l3-interface-ipv6-address-list",
-                "l3-interface-ipv4-address", "l3-intr-ipv6-address-1",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+                "l3-interface-ipv4-address", "l3-intr-ipv6-address-1", AAIProperties.AAI_UUID,
+                UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot",
+                AAIProperties.RESOURCE_VERSION, "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
+                AAIProperties.LAST_MOD_TS, 333L);
 
         GraphTraversalSource g = graph.traversal();
 
@@ -369,8 +310,10 @@ public class DbSerializerTest extends AAISetup {
         vserver1.property(AAIProperties.AAI_URI, dbser.getURIForVertex(vserver1).toString());
         lInterface1.property(AAIProperties.AAI_URI, dbser.getURIForVertex(lInterface1).toString());
         lInterface2.property(AAIProperties.AAI_URI, dbser.getURIForVertex(lInterface2).toString());
-        l3interipv4addresslist_1.property(AAIProperties.AAI_URI, dbser.getURIForVertex(l3interipv4addresslist_1).toString());
-        l3interipv6addresslist_2.property(AAIProperties.AAI_URI, dbser.getURIForVertex(l3interipv6addresslist_2).toString());
+        l3interipv4addresslist_1.property(AAIProperties.AAI_URI,
+                dbser.getURIForVertex(l3interipv4addresslist_1).toString());
+        l3interipv6addresslist_2.property(AAIProperties.AAI_URI,
+                dbser.getURIForVertex(l3interipv6addresslist_2).toString());
         logicalLink1.property(AAIProperties.AAI_URI, dbser.getURIForVertex(logicalLink1).toString());
         logicalLink2.property(AAIProperties.AAI_URI, dbser.getURIForVertex(logicalLink2).toString());
     }
@@ -617,21 +560,13 @@ public class DbSerializerTest extends AAISetup {
         engine.startTransaction();
 
         Vertex gvnf = engine.tx().addVertex("aai-node-type", "generic-vnf", "vnf-id", "myvnf", "aai-uri",
-            "/network/generic-vnfs/generic-vnf/myvnf",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+                "/network/generic-vnfs/generic-vnf/myvnf", AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333L);
         Vertex vnfc = engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "a-name", "aai-uri",
-            "/network/vnfcs/vnfc/a-name",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+                "/network/vnfcs/vnfc/a-name", AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333L);
 
         edgeSer.addEdge(engine.tx().traversal(), gvnf, vnfc);
 
@@ -663,21 +598,13 @@ public class DbSerializerTest extends AAISetup {
         engine.startTransaction();
 
         Vertex gvnf = engine.tx().addVertex("aai-node-type", "generic-vnf", "vnf-id", "myvnf", "aai-uri",
-                "/network/generic-vnfs/generic-vnf/myvnf",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+                "/network/generic-vnfs/generic-vnf/myvnf", AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333L);
         Vertex vnfc = engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "a-name", "aai-uri",
-                "/network/vnfcs/vnfc/a-name",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+                "/network/vnfcs/vnfc/a-name", AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333L);
 
         edgeSer.addEdge(engine.tx().traversal(), gvnf, vnfc);
 
@@ -850,19 +777,21 @@ public class DbSerializerTest extends AAISetup {
         Introspector obj = loader.introspectorFromName("generic-vnf");
         obj = dbser.dbToObject(Collections.singletonList(gvnf), obj, AAIProperties.MAXIMUM_DEPTH, false, "false");
 
-        assertFalse("Relationship does not contain edge-property", obj.getWrappedValue("relationship-list").getWrappedListValue("relationship").get(0).hasProperty("relationship-label"));
+        assertFalse("Relationship does not contain edge-property", obj.getWrappedValue("relationship-list")
+                .getWrappedListValue("relationship").get(0).hasProperty("relationship-label"));
 
     }
 
     @Test
-    public void createEdgeWithInvalidLabelTest() throws AAIException, UnsupportedEncodingException,
-            SecurityException, IllegalArgumentException {
+    public void createEdgeWithInvalidLabelTest()
+            throws AAIException, UnsupportedEncodingException, SecurityException, IllegalArgumentException {
 
         engine.startTransaction();
 
         Vertex gvnf = engine.tx().addVertex("aai-node-type", "generic-vnf", "vnf-id", "myvnf", "aai-uri",
                 "/network/generic-vnfs/generic-vnf/myvnf", "aai-uuid", "a");
-        engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "a-name", "aai-uri", "/network/vnfcs/vnfc/a-name", "aai-uuid", "b");
+        engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "a-name", "aai-uri", "/network/vnfcs/vnfc/a-name",
+                "aai-uuid", "b");
 
         Introspector relData = loader.introspectorFromName("relationship-data");
         relData.setValue("relationship-key", "vnfc.vnfc-name");
@@ -881,13 +810,15 @@ public class DbSerializerTest extends AAISetup {
     }
 
     @Test
-    public void createEdgeUsingIntrospectorTest() throws AAIException, UnsupportedEncodingException, SecurityException, IllegalArgumentException {
+    public void createEdgeUsingIntrospectorTest()
+            throws AAIException, UnsupportedEncodingException, SecurityException, IllegalArgumentException {
 
         engine.startTransaction();
 
         Vertex gvnf = engine.tx().addVertex("aai-node-type", "generic-vnf", "vnf-id", "myvnf", "aai-uri",
-            "/network/generic-vnfs/generic-vnf/myvnf", "aai-uuid", "a");
-        engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "a-name", "aai-uri", "/network/vnfcs/vnfc/a-name", "aai-uuid", "b");
+                "/network/generic-vnfs/generic-vnf/myvnf", "aai-uuid", "a");
+        engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "a-name", "aai-uri", "/network/vnfcs/vnfc/a-name",
+                "aai-uuid", "b");
 
         Introspector relData = loader.introspectorFromName("relationship-data");
         relData.setValue("relationship-key", "vnfc.vnfc-name");
@@ -979,22 +910,15 @@ public class DbSerializerTest extends AAISetup {
     public void deleteItemsWithTraversal() throws AAIException {
         DBSerializer dbser = new DBSerializer(version, engine, ModelType.MOXY, "AAI-TEST");
         engine.startTransaction();
-        Vertex gv = engine.tx().addVertex("aai-node-type", "generic-vnf", "vnf-id", "id1",
-            AAIProperties.AAI_URI, "/network/generic-vnfs/generic-vnf/id1",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+        Vertex gv = engine.tx().addVertex("aai-node-type", "generic-vnf", "vnf-id", "id1", AAIProperties.AAI_URI,
+                "/network/generic-vnfs/generic-vnf/id1", AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333L);
         Vertex lint = engine.tx().addVertex("aai-node-type", "l-interface", "interface-name", "name1",
-            AAIProperties.AAI_URI, "/network/generic-vnfs/generic-vnf/id1/l-interfaces/l-interface/name1",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+                AAIProperties.AAI_URI, "/network/generic-vnfs/generic-vnf/id1/l-interfaces/l-interface/name1",
+                AAIProperties.AAI_UUID, UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123L,
+                AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION, "123",
+                AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333L);
 
         assertTrue(engine.tx().traversal().V().has("vnf-id", "id1").hasNext());
         assertTrue(engine.tx().traversal().V().has("interface-name", "name1").hasNext());
@@ -1012,20 +936,12 @@ public class DbSerializerTest extends AAISetup {
         DBSerializer dbser = new DBSerializer(version, engine, ModelType.MOXY, "AAI-TEST");
         engine.startTransaction();
         Vertex gv = engine.tx().addVertex("aai-node-type", "generic-vnf", "vnf-id", "id1", "aai-uri",
-                "/network/generic-vnfs/generic-vnf/id1", "aai-uuid", "a",
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
-        Vertex lint = engine.tx().addVertex("aai-node-type", "l-interface",
-            "aai-uri", "abc",
-            "aai-uuid", "b",
-            AAIProperties.CREATED_TS, 123L,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333L);
+                "/network/generic-vnfs/generic-vnf/id1", "aai-uuid", "a", AAIProperties.CREATED_TS, 123L,
+                AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION, "123",
+                AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333L);
+        Vertex lint = engine.tx().addVertex("aai-node-type", "l-interface", "aai-uri", "abc", "aai-uuid", "b",
+                AAIProperties.CREATED_TS, 123L, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333L);
         edgeSer.addTreeEdge(engine.tx().traversal(), gv, lint);
 
         Introspector lintIntro = loader.introspectorFromName("l-interface");
index 9a78a43..ead8391 100644 (file)
 
 package org.onap.aai.serialization.db;
 
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -53,23 +65,12 @@ import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.UUID;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
 //@RunWith(value = Parameterized.class) TODO replace this functionality
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(
         classes = {ConfigConfiguration.class, AAICoreFakeEdgesConfigTranslator.class, NodeIngestor.class,
-                EdgeIngestor.class, EdgeSerializer.class, SpringContextAware.class, IntrospectionConfig.class, XmlFormatTransformerConfiguration.class})
+                EdgeIngestor.class, EdgeSerializer.class, SpringContextAware.class, IntrospectionConfig.class,
+                XmlFormatTransformerConfiguration.class})
 @TestPropertySource(
         properties = {"schema.translator.list = config", "schema.nodes.location=src/test/resources/onap/oxm",
                 "schema.edges.location=src/test/resources/onap/dbedgerules"})
@@ -146,7 +147,8 @@ public class DbSerializer_needsFakeRulesTest {
                 "l3-interface-ipv6-address", "l3-interface-ipv6-address-3");
         Vertex subnet_4 = graph.addVertex("aai-node-type", "subnet", "subnet-id", "subnet-id-4");
         Vertex subnet_5 = graph.addVertex("aai-node-type", "subnet", "subnet-id", "subnet-id-5");
-        Vertex l3network_6 = graph.addVertex("aai-node-type", "l3-network", "network-id", "network-id-6", "network-name", "network-name-6");
+        Vertex l3network_6 = graph.addVertex("aai-node-type", "l3-network", "network-id", "network-id-6",
+                "network-name", "network-name-6");
 
         GraphTraversalSource g = graph.traversal();
         edgeSer.addEdge(g, l3interipv4addresslist_1, subnet_2);
@@ -182,13 +184,9 @@ public class DbSerializer_needsFakeRulesTest {
         engine.startTransaction();
 
         engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "vnfc-" + testName, AAIProperties.AAI_URI,
-                "/network/vnfcs/vnfc/vnfc-" + testName,
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333);
+                "/network/vnfcs/vnfc/vnfc-" + testName, AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333);
 
         Introspector relationship = loader.introspectorFromName("relationship");
         relationship.setValue("related-to", "vnfc");
@@ -220,19 +218,13 @@ public class DbSerializer_needsFakeRulesTest {
         engine.startTransaction();
 
         Vertex gvnf = engine.tx().addVertex("aai-node-type", "generic-vnf", "vnf-id", "myvnf", "aai-uri",
-                "/network/generic-vnfs/generic-vnf/myvnf", "aai-uuid", "a",
-            AAIProperties.CREATED_TS, 123,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333);
+                "/network/generic-vnfs/generic-vnf/myvnf", "aai-uuid", "a", AAIProperties.CREATED_TS, 123,
+                AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION, "123",
+                AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333);
         Vertex vnfc = engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "a-name", "aai-uri",
-                "/network/vnfcs/vnfc/a-name", "aai-uuid", "b",
-            AAIProperties.CREATED_TS, 123,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333);
+                "/network/vnfcs/vnfc/a-name", "aai-uuid", "b", AAIProperties.CREATED_TS, 123,
+                AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION, "123",
+                AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333);
 
         // sunny day case
         Introspector relData = loader.introspectorFromName("relationship-data");
@@ -288,21 +280,13 @@ public class DbSerializer_needsFakeRulesTest {
         engine.startTransaction();
 
         Vertex gvnf = engine.tx().addVertex("aai-node-type", "generic-vnf", "vnf-id", "myvnf", "aai-uri",
-                "/network/generic-vnfs/generic-vnf/myvnf",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333);
+                "/network/generic-vnfs/generic-vnf/myvnf", AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333);
         Vertex vnfc = engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "a-name", "aai-uri",
-                "/network/vnfcs/vnfc/a-name",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333);
+                "/network/vnfcs/vnfc/a-name", AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333);
         edgeSer.addEdge(graph.traversal(), gvnf, vnfc, "uses");
 
         Introspector relData = loader.introspectorFromName("relationship-data");
@@ -337,21 +321,13 @@ public class DbSerializer_needsFakeRulesTest {
         engine.startTransaction();
 
         Vertex gvnf = engine.tx().addVertex("aai-node-type", "generic-vnf", "vnf-id", "myvnf", "aai-uri",
-                "/network/generic-vnfs/generic-vnf/myvnf",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333);
+                "/network/generic-vnfs/generic-vnf/myvnf", AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333);
         Vertex vnfc = engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "a-name", "aai-uri",
-                "/network/vnfcs/vnfc/a-name",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333);
+                "/network/vnfcs/vnfc/a-name", AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333);
 
         Introspector relData = loader.introspectorFromName("relationship-data");
         relData.setValue("relationship-key", "vnfc.vnfc-name");
@@ -380,21 +356,13 @@ public class DbSerializer_needsFakeRulesTest {
         engine.startTransaction();
 
         Vertex gvnf = engine.tx().addVertex("aai-node-type", "generic-vnf", "vnf-id", "myvnf", "aai-uri",
-                "/network/generic-vnfs/generic-vnf/myvnf",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333);
+                "/network/generic-vnfs/generic-vnf/myvnf", AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333);
         Vertex vnfc = engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "a-name", "aai-uri",
-                "/network/vnfcs/vnfc/a-name",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333);
+                "/network/vnfcs/vnfc/a-name", AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333);
         edgeSer.addEdge(graph.traversal(), gvnf, vnfc, "uses");
         edgeSer.addEdge(graph.traversal(), gvnf, vnfc, "re-uses");
         edgeSer.addEdge(graph.traversal(), gvnf, vnfc, "over-uses");
@@ -430,21 +398,13 @@ public class DbSerializer_needsFakeRulesTest {
         engine.startTransaction();
 
         Vertex gvnf = engine.tx().addVertex("aai-node-type", "generic-vnf", "vnf-id", "myvnf", "aai-uri",
-                "/network/generic-vnfs/generic-vnf/myvnf",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333);
+                "/network/generic-vnfs/generic-vnf/myvnf", AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333);
         Vertex vnfc = engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "a-name", "aai-uri",
-                "/network/vnfcs/vnfc/a-name",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333);
+                "/network/vnfcs/vnfc/a-name", AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
+                AAIProperties.CREATED_TS, 123, AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION,
+                "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333);
         edgeSer.addEdge(graph.traversal(), gvnf, vnfc, "uses");
         edgeSer.addEdge(graph.traversal(), gvnf, vnfc, "re-uses");
         edgeSer.addEdge(graph.traversal(), gvnf, vnfc, "over-uses");
@@ -512,12 +472,10 @@ public class DbSerializer_needsFakeRulesTest {
 
         engine.startTransaction();
 
-        engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "a-name", "aai-uri", "/network/vnfcs/vnfc/a-name", "aai-uuid", "b",
-            AAIProperties.CREATED_TS, 123,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333);
+        engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "a-name", "aai-uri", "/network/vnfcs/vnfc/a-name",
+                "aai-uuid", "b", AAIProperties.CREATED_TS, 123, AAIProperties.SOURCE_OF_TRUTH, "sot",
+                AAIProperties.RESOURCE_VERSION, "123", AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
+                AAIProperties.LAST_MOD_TS, 333);
 
         Introspector relationship = loader.introspectorFromName("relationship");
         relationship.setValue("related-to", "vnfc");
@@ -567,12 +525,9 @@ public class DbSerializer_needsFakeRulesTest {
         engine.startTransaction();
 
         engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "a-name", "aai-uri", "/network/vnfcs/vnfc/a-name",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333);
+                AAIProperties.AAI_UUID, UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123,
+                AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION, "123",
+                AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333);
 
         Introspector relationship = loader.introspectorFromName("relationship");
         relationship.setValue("related-to", "vnfc");
@@ -653,12 +608,9 @@ public class DbSerializer_needsFakeRulesTest {
 
         engine.startTransaction();
         engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "a-name", "aai-uri", "/network/vnfcs/vnfc/a-name",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333);
+                AAIProperties.AAI_UUID, UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123,
+                AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION, "123",
+                AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333);
 
         Introspector relationship;
         Introspector relationshipList;
@@ -726,12 +678,9 @@ public class DbSerializer_needsFakeRulesTest {
 
         engine.startTransaction();
         engine.tx().addVertex("aai-node-type", "vnfc", "vnfc-name", "a-name", "aai-uri", "/network/vnfcs/vnfc/a-name",
-            AAIProperties.AAI_UUID, UUID.randomUUID().toString(),
-            AAIProperties.CREATED_TS, 123,
-            AAIProperties.SOURCE_OF_TRUTH, "sot",
-            AAIProperties.RESOURCE_VERSION, "123",
-            AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot",
-            AAIProperties.LAST_MOD_TS, 333);
+                AAIProperties.AAI_UUID, UUID.randomUUID().toString(), AAIProperties.CREATED_TS, 123,
+                AAIProperties.SOURCE_OF_TRUTH, "sot", AAIProperties.RESOURCE_VERSION, "123",
+                AAIProperties.LAST_MOD_SOURCE_OF_TRUTH, "lmsot", AAIProperties.LAST_MOD_TS, 333);
 
         Introspector relationship;
         Introspector relationshipList;
index 69206a4..5dfa12b 100644 (file)
@@ -28,7 +28,6 @@ import static org.junit.Assert.assertEquals;
 import com.google.common.collect.Multimap;
 
 import java.util.*;
-import java.util.stream.Collectors;
 
 import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.junit.Rule;
index d00408e..cc0eb88 100644 (file)
 
 package org.onap.aai.serialization.db;
 
+import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasJsonPath;
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collections;
+
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.janusgraph.core.JanusGraphFactory;
@@ -40,16 +50,6 @@ import org.onap.aai.setup.SchemaVersion;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Collections;
-
-import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasJsonPath;
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class EdgerPairCanBeBothCousinAndParentChildTest extends AAISetup {
 
@@ -106,8 +106,8 @@ public class EdgerPairCanBeBothCousinAndParentChildTest extends AAISetup {
      */
     private void initData() throws UnsupportedEncodingException, AAIException, URISyntaxException {
         engine.startTransaction();
-        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
-
+        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH,
+                AAIProperties.MINIMUM_DEPTH);
 
         Introspector gvnf = loader.introspectorFromName("generic-vnf");
         gvnf.setValue("vnf-id", "gvnf-a" + SOURCE_OF_TRUTH);
@@ -127,23 +127,13 @@ public class EdgerPairCanBeBothCousinAndParentChildTest extends AAISetup {
         lagints.setValue("lag-interface", Collections.singletonList(lagInt.getUnderlyingObject()));
         gvnf.setValue("lag-interfaces", lagints.getUnderlyingObject());
 
-
-
         Vertex gvnfV = serializer.createNewVertex(gvnf);
         QueryParser uriQuery = engine.getQueryBuilder().createQueryFromURI(new URI(gvnfAUri));
         serializer.serializeToDb(gvnf, gvnfV, uriQuery, "generic-vnf", gvnf.marshal(false));
 
-        assertTrue("generic-vnf-a created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, gvnfAUri)
-            .hasNext());
-        assertTrue("lag-int-a created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, lagIntAUri)
-            .hasNext());
-        assertTrue("l-int created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, lintUri)
-            .hasNext());
-
-
+        assertTrue("generic-vnf-a created", engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfAUri).hasNext());
+        assertTrue("lag-int-a created", engine.tx().traversal().V().has(AAIProperties.AAI_URI, lagIntAUri).hasNext());
+        assertTrue("l-int created", engine.tx().traversal().V().has(AAIProperties.AAI_URI, lintUri).hasNext());
 
         gvnf = loader.introspectorFromName("generic-vnf");
         gvnf.setValue("vnf-id", "gvnf-b" + SOURCE_OF_TRUTH);
@@ -166,69 +156,43 @@ public class EdgerPairCanBeBothCousinAndParentChildTest extends AAISetup {
         serializer.serializeToDb(gvnf, gvnfV, uriQuery, "generic-vnf", gvnf.marshal(false));
 
         engine.tx().traversal().V().forEachRemaining(v -> System.out.println(v.<String>value(AAIProperties.AAI_URI)));
-        assertTrue("generic-vnf-b created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, gvnfBUri)
-            .hasNext());
-        assertTrue("lag-int-b created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, lagIntBUri)
-            .hasNext());
+        assertTrue("generic-vnf-b created", engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfBUri).hasNext());
+        assertTrue("lag-int-b created", engine.tx().traversal().V().has(AAIProperties.AAI_URI, lagIntBUri).hasNext());
         assertTrue("lag-interface relationship l-interface created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, lagIntBUri)
-            .both()
-            .has(AAIProperties.AAI_URI, lintUri)
-            .hasNext());
+                .has(AAIProperties.AAI_URI, lagIntBUri).both().has(AAIProperties.AAI_URI, lintUri).hasNext());
     }
 
-
     @Test
     public void verifyReadOfGenericVnfATest() throws AAIException, UnsupportedEncodingException {
-        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
+        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH,
+                AAIProperties.MINIMUM_DEPTH);
 
-        String gvnfALatestView = serializer.getLatestVersionView(
-            engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfAUri).next()).marshal(false);
+        String gvnfALatestView =
+                serializer.getLatestVersionView(engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfAUri).next())
+                        .marshal(false);
 
+        assertThat(gvnfALatestView, hasJsonPath("$.lag-interfaces.lag-interface[*]", hasSize(1)));
         assertThat(gvnfALatestView,
-            hasJsonPath(
-                "$.lag-interfaces.lag-interface[*]",
-                hasSize(1)
-            ));
-        assertThat(gvnfALatestView,
-            hasJsonPath(
-                "$.lag-interfaces.lag-interface[*].l-interfaces.l-interface[*]",
-                hasSize(1)
-            ));
-        assertThat(gvnfALatestView,
-            hasJsonPath(
+                hasJsonPath("$.lag-interfaces.lag-interface[*].l-interfaces.l-interface[*]", hasSize(1)));
+        assertThat(gvnfALatestView, hasJsonPath(
                 "$.lag-interfaces.lag-interface[*].l-interfaces.l-interface[*].relationship-list.relationship[*].related-link",
-                containsInAnyOrder(
-                    "/aai/" + schemaVersions.getDefaultVersion() + lagIntBUri
-                )
-            ));
+                containsInAnyOrder("/aai/" + schemaVersions.getDefaultVersion() + lagIntBUri)));
     }
 
     @Test
     public void verifyReadOfGenericVnfBTest() throws AAIException, UnsupportedEncodingException {
-        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
+        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH,
+                AAIProperties.MINIMUM_DEPTH);
 
-        String gvnfBLatestView = serializer.getLatestVersionView(
-            engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfBUri).next()).marshal(false);
+        String gvnfBLatestView =
+                serializer.getLatestVersionView(engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfBUri).next())
+                        .marshal(false);
 
+        assertThat(gvnfBLatestView, hasJsonPath("$.lag-interfaces.lag-interface[*]", hasSize(1)));
+        assertThat(gvnfBLatestView, not(hasJsonPath("$.lag-interfaces.lag-interface[*].l-interfaces.l-interface[*]")));
         assertThat(gvnfBLatestView,
-            hasJsonPath(
-                "$.lag-interfaces.lag-interface[*]",
-                hasSize(1)
-            ));
-        assertThat(gvnfBLatestView,
-            not(hasJsonPath(
-                "$.lag-interfaces.lag-interface[*].l-interfaces.l-interface[*]"
-            )));
-        assertThat(gvnfBLatestView,
-            hasJsonPath(
-                "$.lag-interfaces.lag-interface[*].relationship-list.relationship[*].related-link",
-                containsInAnyOrder(
-                    "/aai/" + schemaVersions.getDefaultVersion() + lintUri
-                )
-            ));
+                hasJsonPath("$.lag-interfaces.lag-interface[*].relationship-list.relationship[*].related-link",
+                        containsInAnyOrder("/aai/" + schemaVersions.getDefaultVersion() + lintUri)));
     }
 
 }
index 20e300a..44f8974 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.serialization.db;
 
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
 import org.hamcrest.CoreMatchers;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
-import org.mockito.Matchers;
 import org.mockito.Mockito;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.Introspector;
@@ -34,12 +38,6 @@ import org.onap.aai.serialization.engines.query.QueryEngine;
 import org.onap.aai.util.AAIConstants;
 import org.springframework.boot.test.rule.OutputCapture;
 
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.mockito.Matchers.eq;
-
 public class ImpliedDeleteUnitTest {
 
     private TransactionalGraphEngine mockEngine;
@@ -51,10 +49,10 @@ public class ImpliedDeleteUnitTest {
     public final OutputCapture outputCapture = new OutputCapture();
 
     @Before
-    public void setup(){
-        mockEngine     = Mockito.mock(TransactionalGraphEngine.class);
+    public void setup() {
+        mockEngine = Mockito.mock(TransactionalGraphEngine.class);
         mockSerializer = Mockito.mock(DBSerializer.class);
-        impliedDelete  = Mockito.spy(new ImpliedDelete(mockEngine, mockSerializer));
+        impliedDelete = Mockito.spy(new ImpliedDelete(mockEngine, mockSerializer));
     }
 
     // aai.implied.delete.whitelist.sdnc=*
@@ -63,10 +61,7 @@ public class ImpliedDeleteUnitTest {
 
         QueryEngine mockQueryEngine = Mockito.mock(QueryEngine.class);
 
-        Mockito
-            .doReturn("*")
-            .when(impliedDelete)
-            .get(AAIConstants.AAI_IMPLIED_DELETE_WHITELIST + "sdnc","");
+        Mockito.doReturn("*").when(impliedDelete).get(AAIConstants.AAI_IMPLIED_DELETE_WHITELIST + "sdnc", "");
 
         Mockito.when(mockEngine.getQueryEngine()).thenReturn(mockQueryEngine);
 
@@ -91,10 +86,7 @@ public class ImpliedDeleteUnitTest {
 
         QueryEngine mockQueryEngine = Mockito.mock(QueryEngine.class);
 
-        Mockito
-            .doReturn("'vserver'")
-            .when(impliedDelete)
-            .get(AAIConstants.AAI_IMPLIED_DELETE_WHITELIST + "sdnc","");
+        Mockito.doReturn("'vserver'").when(impliedDelete).get(AAIConstants.AAI_IMPLIED_DELETE_WHITELIST + "sdnc", "");
 
         Mockito.when(mockEngine.getQueryEngine()).thenReturn(mockQueryEngine);
 
@@ -118,10 +110,7 @@ public class ImpliedDeleteUnitTest {
 
         QueryEngine mockQueryEngine = Mockito.mock(QueryEngine.class);
 
-        Mockito
-            .doReturn("'vserver'")
-            .when(impliedDelete)
-            .get(AAIConstants.AAI_IMPLIED_DELETE_WHITELIST + "sdnc","");
+        Mockito.doReturn("'vserver'").when(impliedDelete).get(AAIConstants.AAI_IMPLIED_DELETE_WHITELIST + "sdnc", "");
 
         Mockito.when(mockEngine.getQueryEngine()).thenReturn(mockQueryEngine);
 
@@ -149,10 +138,8 @@ public class ImpliedDeleteUnitTest {
 
         QueryEngine mockQueryEngine = Mockito.mock(QueryEngine.class);
 
-        Mockito
-            .doReturn("'vce','pserver','vserver','cloud-region'")
-            .when(impliedDelete)
-            .get(AAIConstants.AAI_IMPLIED_DELETE_WHITELIST + "sdnc","");
+        Mockito.doReturn("'vce','pserver','vserver','cloud-region'").when(impliedDelete)
+                .get(AAIConstants.AAI_IMPLIED_DELETE_WHITELIST + "sdnc", "");
 
         Mockito.when(mockEngine.getQueryEngine()).thenReturn(mockQueryEngine);
 
@@ -173,17 +160,13 @@ public class ImpliedDeleteUnitTest {
     // aai.implied.delete.whitelist.sdnc='vserver','vce','pserver'
     @Test
     public void testImpliedDeleteWhenUserIsAllowedToInvokeMultipleMethodsAndDeletableReturnsMultipleVertexes()
-        throws AAIException, UnsupportedEncodingException {
+            throws AAIException, UnsupportedEncodingException {
 
         QueryEngine mockQueryEngine = Mockito.mock(QueryEngine.class);
 
         // On a spy the syntax should be doReturn => when => method to spy
         // On a mock the syntax should be when => thenReturn|thenAnswer
-        Mockito
-            .doReturn("'vserver'")
-            .when(impliedDelete)
-            .get(AAIConstants.AAI_IMPLIED_DELETE_WHITELIST + "sdnc","");
-
+        Mockito.doReturn("'vserver'").when(impliedDelete).get(AAIConstants.AAI_IMPLIED_DELETE_WHITELIST + "sdnc", "");
 
         Introspector mockIntrospector = Mockito.mock(Introspector.class);
 
@@ -213,20 +196,13 @@ public class ImpliedDeleteUnitTest {
         vertices.add(volume3);
         vertices.add(volume4);
 
-        Mockito
-            .when(mockQueryEngine.findDeletable(Mockito.anyList()))
-            .thenReturn(vertices);
+        Mockito.when(mockQueryEngine.findDeletable(Mockito.anyList())).thenReturn(vertices);
 
-        Mockito
-            .when(mockSerializer.getLatestVersionView(Mockito.anyObject()))
-            .thenReturn(mockIntrospector);
+        Mockito.when(mockSerializer.getLatestVersionView(Mockito.anyObject())).thenReturn(mockIntrospector);
 
-        Mockito
-            .when(mockIntrospector.marshal(false))
-            .thenReturn("{\"volume-id\":\"volume-1\"}")
-            .thenReturn("{\"volume-id\":\"volume-2\"}")
-            .thenReturn("{\"volume-id\":\"volume-3\"}")
-            .thenReturn("{\"volume-id\":\"volume-4\"}");
+        Mockito.when(mockIntrospector.marshal(false)).thenReturn("{\"volume-id\":\"volume-1\"}")
+                .thenReturn("{\"volume-id\":\"volume-2\"}").thenReturn("{\"volume-id\":\"volume-3\"}")
+                .thenReturn("{\"volume-id\":\"volume-4\"}");
 
         impliedDelete.execute(vserver.id(), "SDNC", "vserver", vertices);
     }
@@ -237,10 +213,7 @@ public class ImpliedDeleteUnitTest {
 
         QueryEngine mockQueryEngine = Mockito.mock(QueryEngine.class);
 
-        Mockito
-            .doReturn("")
-            .when(impliedDelete)
-            .get(AAIConstants.AAI_IMPLIED_DELETE_WHITELIST + "sdnc","");
+        Mockito.doReturn("").when(impliedDelete).get(AAIConstants.AAI_IMPLIED_DELETE_WHITELIST + "sdnc", "");
 
         Mockito.when(mockEngine.getQueryEngine()).thenReturn(mockQueryEngine);
 
@@ -260,14 +233,12 @@ public class ImpliedDeleteUnitTest {
 
     // aai.implied.delete.whitelist.sdnc='vce'
     @Test(expected = AAIException.class)
-    public void testImpliedDeleteWhenUserIsAllowedToDeleteVceChildrenButRequestedToDeleteVserverChildren() throws AAIException {
+    public void testImpliedDeleteWhenUserIsAllowedToDeleteVceChildrenButRequestedToDeleteVserverChildren()
+            throws AAIException {
 
         QueryEngine mockQueryEngine = Mockito.mock(QueryEngine.class);
 
-        Mockito
-            .doReturn("'vce'")
-            .when(impliedDelete)
-            .get(AAIConstants.AAI_IMPLIED_DELETE_WHITELIST + "sdnc","");
+        Mockito.doReturn("'vce'").when(impliedDelete).get(AAIConstants.AAI_IMPLIED_DELETE_WHITELIST + "sdnc", "");
 
         Mockito.when(mockEngine.getQueryEngine()).thenReturn(mockQueryEngine);
 
@@ -286,17 +257,14 @@ public class ImpliedDeleteUnitTest {
     }
 
     @Test
-    public void testImpliedDeleteWhenUserIsAllowedToDeleteAndPrintingDeletingVertexItThrowsExceptionVerifyLog() throws AAIException, UnsupportedEncodingException {
+    public void testImpliedDeleteWhenUserIsAllowedToDeleteAndPrintingDeletingVertexItThrowsExceptionVerifyLog()
+            throws AAIException, UnsupportedEncodingException {
 
         QueryEngine mockQueryEngine = Mockito.mock(QueryEngine.class);
 
         // On a spy the syntax should be doReturn => when => method to spy
         // On a mock the syntax should be when => thenReturn|thenAnswer
-        Mockito
-            .doReturn("'vserver'")
-            .when(impliedDelete)
-            .get(AAIConstants.AAI_IMPLIED_DELETE_WHITELIST + "sdnc","");
-
+        Mockito.doReturn("'vserver'").when(impliedDelete).get(AAIConstants.AAI_IMPLIED_DELETE_WHITELIST + "sdnc", "");
 
         Introspector mockIntrospector = Mockito.mock(Introspector.class);
 
@@ -314,18 +282,14 @@ public class ImpliedDeleteUnitTest {
 
         vertices.add(volume1);
 
-        Mockito
-            .when(mockQueryEngine.findDeletable(Mockito.anyList()))
-            .thenReturn(vertices);
+        Mockito.when(mockQueryEngine.findDeletable(Mockito.anyList())).thenReturn(vertices);
 
-        Mockito
-            .when(mockSerializer.getLatestVersionView(Mockito.anyObject()))
-            .thenThrow(new RuntimeException("Unable to find node"));
+        Mockito.when(mockSerializer.getLatestVersionView(Mockito.anyObject()))
+                .thenThrow(new RuntimeException("Unable to find node"));
 
         impliedDelete.execute(vserver.id(), "SDNC", "vserver", vertices);
 
-        outputCapture.expect(
-            CoreMatchers.containsString("Encountered an exception during retrieval of vertex properties with vertex-id " + vserver.id())
-        );
+        outputCapture.expect(CoreMatchers.containsString(
+                "Encountered an exception during retrieval of vertex properties with vertex-id " + vserver.id()));
     }
 }
index 0c90c73..16820d6 100644 (file)
 
 package org.onap.aai.serialization.db;
 
+import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasJsonPath;
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.*;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Arrays;
+import java.util.Collections;
+
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.janusgraph.core.JanusGraphFactory;
@@ -40,16 +50,6 @@ import org.onap.aai.setup.SchemaVersion;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Arrays;
-import java.util.Collections;
-
-import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasJsonPath;
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
-
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class OneToOneEdgeUpdateTest extends AAISetup {
 
@@ -108,8 +108,8 @@ public class OneToOneEdgeUpdateTest extends AAISetup {
      */
     private void initData() throws UnsupportedEncodingException, AAIException, URISyntaxException {
         engine.startTransaction();
-        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
-
+        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH,
+                AAIProperties.MINIMUM_DEPTH);
 
         Introspector gvnf = loader.introspectorFromName("generic-vnf");
         gvnf.setValue("vnf-id", "gvnf-a" + SOURCE_OF_TRUTH);
@@ -139,28 +139,16 @@ public class OneToOneEdgeUpdateTest extends AAISetup {
         lints.setValue("l-interface", Arrays.asList(lint.getUnderlyingObject(), lintA.getUnderlyingObject()));
         gvnf.setValue("l-interfaces", lints.getUnderlyingObject());
 
-
         System.out.println(gvnf.marshal(true));
         Vertex gvnfV = serializer.createNewVertex(gvnf);
         QueryParser uriQuery = engine.getQueryBuilder().createQueryFromURI(new URI(gvnfAUri));
         serializer.serializeToDb(gvnf, gvnfV, uriQuery, "generic-vnf", gvnf.marshal(false));
 
-        assertTrue("generic-vnf-a created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, gvnfAUri)
-            .hasNext());
-        assertTrue("l-int created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, lintUri)
-            .hasNext());
-        assertTrue("l-int-a created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, lintAUri)
-            .hasNext());
-        assertTrue("sriov-vf created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, sriovVfUri)
-            .hasNext());
-        assertTrue("sriov-vf-a created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, sriovVfAUri)
-            .hasNext());
-
+        assertTrue("generic-vnf-a created", engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfAUri).hasNext());
+        assertTrue("l-int created", engine.tx().traversal().V().has(AAIProperties.AAI_URI, lintUri).hasNext());
+        assertTrue("l-int-a created", engine.tx().traversal().V().has(AAIProperties.AAI_URI, lintAUri).hasNext());
+        assertTrue("sriov-vf created", engine.tx().traversal().V().has(AAIProperties.AAI_URI, sriovVfUri).hasNext());
+        assertTrue("sriov-vf-a created", engine.tx().traversal().V().has(AAIProperties.AAI_URI, sriovVfAUri).hasNext());
 
         gvnf = loader.introspectorFromName("generic-vnf");
         gvnf.setValue("vnf-id", "gvnf-b" + SOURCE_OF_TRUTH);
@@ -183,87 +171,57 @@ public class OneToOneEdgeUpdateTest extends AAISetup {
         serializer.serializeToDb(gvnf, gvnfV, uriQuery, "generic-vnf", gvnf.marshal(false));
 
         engine.tx().traversal().V().forEachRemaining(v -> System.out.println(v.<String>value(AAIProperties.AAI_URI)));
-        assertTrue("generic-vnf-b created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, gvnfBUri)
-            .hasNext());
-        assertTrue("l-int-b created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, lIntBUri)
-            .hasNext());
+        assertTrue("generic-vnf-b created", engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfBUri).hasNext());
+        assertTrue("l-int-b created", engine.tx().traversal().V().has(AAIProperties.AAI_URI, lIntBUri).hasNext());
         assertTrue("l-interface relationship sriov-vf created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, lIntBUri)
-            .both()
-            .has(AAIProperties.AAI_URI, sriovVfUri)
-            .hasNext());
+                .has(AAIProperties.AAI_URI, lIntBUri).both().has(AAIProperties.AAI_URI, sriovVfUri).hasNext());
 
     }
 
-
     @Test
     public void verifyReadOfGenericVnfATest() throws AAIException, UnsupportedEncodingException {
-        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
-
-        String gvnfALatestView = serializer.getLatestVersionView(
-            engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfAUri).next()).marshal(false);
-
-        assertThat(gvnfALatestView,
-            hasJsonPath(
-                "$.l-interfaces.l-interface[*]",
-                hasSize(2)
-            ));
-        assertThat(gvnfALatestView,
-            hasJsonPath(
-                "$.l-interfaces.l-interface[*].sriov-vfs.sriov-vf[*]",
-                hasSize(2)
-            ));
-        assertThat(gvnfALatestView,
-            hasJsonPath(
+        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH,
+                AAIProperties.MINIMUM_DEPTH);
+
+        String gvnfALatestView =
+                serializer.getLatestVersionView(engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfAUri).next())
+                        .marshal(false);
+
+        assertThat(gvnfALatestView, hasJsonPath("$.l-interfaces.l-interface[*]", hasSize(2)));
+        assertThat(gvnfALatestView, hasJsonPath("$.l-interfaces.l-interface[*].sriov-vfs.sriov-vf[*]", hasSize(2)));
+        assertThat(gvnfALatestView, hasJsonPath(
                 "$.l-interfaces.l-interface[*].sriov-vfs.sriov-vf[*].relationship-list.relationship[*].related-link",
-                containsInAnyOrder(
-                    "/aai/" + schemaVersions.getDefaultVersion() + lIntBUri
-                )
-            ));
+                containsInAnyOrder("/aai/" + schemaVersions.getDefaultVersion() + lIntBUri)));
     }
 
     @Test
     public void verifyReadOfGenericVnfBTest() throws AAIException, UnsupportedEncodingException {
-        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
+        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH,
+                AAIProperties.MINIMUM_DEPTH);
 
-        String gvnfBLatestView = serializer.getLatestVersionView(
-            engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfBUri).next()).marshal(false);
+        String gvnfBLatestView =
+                serializer.getLatestVersionView(engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfBUri).next())
+                        .marshal(false);
 
+        assertThat(gvnfBLatestView, hasJsonPath("$.l-interfaces.l-interface[*]", hasSize(1)));
+        assertThat(gvnfBLatestView, not(hasJsonPath("$.l-interfaces.l-interface[*].sriov-vfs.sriov-vf[*]")));
         assertThat(gvnfBLatestView,
-            hasJsonPath(
-                "$.l-interfaces.l-interface[*]",
-                hasSize(1)
-            ));
-        assertThat(gvnfBLatestView,
-            not(hasJsonPath(
-                "$.l-interfaces.l-interface[*].sriov-vfs.sriov-vf[*]"
-            )));
-        assertThat(gvnfBLatestView,
-            hasJsonPath(
-                "$.l-interfaces.l-interface[*].relationship-list.relationship[*].related-link",
-                containsInAnyOrder(
-                    "/aai/" + schemaVersions.getDefaultVersion() + sriovVfUri
-                )
-            ));
+                hasJsonPath("$.l-interfaces.l-interface[*].relationship-list.relationship[*].related-link",
+                        containsInAnyOrder("/aai/" + schemaVersions.getDefaultVersion() + sriovVfUri)));
     }
 
     @Test
-    public void replaceRelationshipToSriovVfTest() throws AAIException, UnsupportedEncodingException, URISyntaxException {
-        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
+    public void replaceRelationshipToSriovVfTest()
+            throws AAIException, UnsupportedEncodingException, URISyntaxException {
+        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH,
+                AAIProperties.MINIMUM_DEPTH);
 
-        Introspector lint = serializer.getLatestVersionView(
-            engine.tx().traversal().V().has(AAIProperties.AAI_URI, lIntBUri).next());
+        Introspector lint = serializer
+                .getLatestVersionView(engine.tx().traversal().V().has(AAIProperties.AAI_URI, lIntBUri).next());
         String lintView = lint.marshal(false);
 
-        assertThat(lintView,
-            hasJsonPath(
-                "$.relationship-list.relationship[*].related-link",
-                containsInAnyOrder(
-                    "/aai/" + schemaVersions.getDefaultVersion() + sriovVfUri
-                )
-            ));
+        assertThat(lintView, hasJsonPath("$.relationship-list.relationship[*].related-link",
+                containsInAnyOrder("/aai/" + schemaVersions.getDefaultVersion() + sriovVfUri)));
 
         Introspector relationship = loader.introspectorFromName("relationship");
         relationship.setValue("related-link", sriovVfAUri);
@@ -273,13 +231,14 @@ public class OneToOneEdgeUpdateTest extends AAISetup {
 
         QueryParser uriQuery = engine.getQueryBuilder().createQueryFromURI(new URI(lIntBUri));
         serializer.serializeToDb(lint, engine.tx().traversal().V().has(AAIProperties.AAI_URI, lIntBUri).next(),
-            uriQuery, "generic-vnf", lint.marshal(false));
+                uriQuery, "generic-vnf", lint.marshal(false));
     }
 
-
     @Test
-    public void createRelationshipForNonExistentRuleTest() throws AAIException, UnsupportedEncodingException, URISyntaxException {
-        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
+    public void createRelationshipForNonExistentRuleTest()
+            throws AAIException, UnsupportedEncodingException, URISyntaxException {
+        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH,
+                AAIProperties.MINIMUM_DEPTH);
 
         Vertex gvnfAV = engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfAUri).next();
         Introspector gvnfA = serializer.getLatestVersionView(gvnfAV);
index 8e77c54..1dcdccb 100644 (file)
 
 package org.onap.aai.serialization.db;
 
+import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasJsonPath;
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.janusgraph.core.JanusGraphFactory;
@@ -40,18 +52,6 @@ import org.onap.aai.setup.SchemaVersion;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasJsonPath;
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class VersionedScenariosTest extends AAISetup {
 
@@ -108,8 +108,8 @@ public class VersionedScenariosTest extends AAISetup {
      */
     private void initData() throws UnsupportedEncodingException, AAIException, URISyntaxException {
         engine.startTransaction();
-        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
-
+        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH,
+                AAIProperties.MINIMUM_DEPTH);
 
         Introspector gvnf = loader.introspectorFromName("generic-vnf");
         gvnf.setValue("vnf-id", "gvnf" + SOURCE_OF_TRUTH);
@@ -132,27 +132,20 @@ public class VersionedScenariosTest extends AAISetup {
         QueryParser uriQuery = engine.getQueryBuilder().createQueryFromURI(new URI(gvnfUri));
         serializer.serializeToDb(gvnf, gvnfV, uriQuery, "generic-vnf", gvnf.marshal(false));
 
-        assertTrue("generic-vnf created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, gvnfUri)
-            .hasNext());
-        assertTrue("source created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, lintSourceUri)
-            .hasNext());
-        assertTrue("destination created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, lintDestinationUri)
-            .hasNext());
-
-
+        assertTrue("generic-vnf created", engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfUri).hasNext());
+        assertTrue("source created", engine.tx().traversal().V().has(AAIProperties.AAI_URI, lintSourceUri).hasNext());
+        assertTrue("destination created",
+                engine.tx().traversal().V().has(AAIProperties.AAI_URI, lintDestinationUri).hasNext());
 
         Introspector llDefault = loader.introspectorFromName("logical-link");
         llDefault.setValue("link-name", "llDefault");
         List<Object> relList = new ArrayList<>();
         Introspector relationship = loader.introspectorFromName("relationship");
-        //relationship.setValue("related-to", "l-interface");
+        // relationship.setValue("related-to", "l-interface");
         relationship.setValue("related-link", lintSourceUri);
         relList.add(relationship.getUnderlyingObject());
         relationship = loader.introspectorFromName("relationship");
-        //relationship.setValue("related-to", "l-interface");
+        // relationship.setValue("related-to", "l-interface");
         relationship.setValue("related-link", lintDestinationUri);
         relList.add(relationship.getUnderlyingObject());
         Introspector relationshipList = loader.introspectorFromName("relationship-list");
@@ -163,20 +156,13 @@ public class VersionedScenariosTest extends AAISetup {
         uriQuery = engine.getQueryBuilder().createQueryFromURI(new URI(llDefaultUri));
         serializer.serializeToDb(llDefault, llDefaultV, uriQuery, "logical-link", llDefault.marshal(false));
 
-        assertTrue("logical-link created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, llDefaultUri)
-            .hasNext());
-        assertTrue("default source relationship created",engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, llDefaultUri)
-            .both()
-            .has(AAIProperties.AAI_URI, lintSourceUri)
-            .hasNext());
-        assertTrue("default destination relationship created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, llDefaultUri)
-            .both()
-            .has(AAIProperties.AAI_URI, lintDestinationUri)
-            .hasNext());
-
+        assertTrue("logical-link created",
+                engine.tx().traversal().V().has(AAIProperties.AAI_URI, llDefaultUri).hasNext());
+        assertTrue("default source relationship created", engine.tx().traversal().V()
+                .has(AAIProperties.AAI_URI, llDefaultUri).both().has(AAIProperties.AAI_URI, lintSourceUri).hasNext());
+        assertTrue("default destination relationship created",
+                engine.tx().traversal().V().has(AAIProperties.AAI_URI, llDefaultUri).both()
+                        .has(AAIProperties.AAI_URI, lintDestinationUri).hasNext());
 
         Introspector llLabeled = loader.introspectorFromName("logical-link");
         llLabeled.setValue("link-name", "llLabeled");
@@ -199,179 +185,122 @@ public class VersionedScenariosTest extends AAISetup {
         uriQuery = engine.getQueryBuilder().createQueryFromURI(new URI(llLabeledUri));
         serializer.serializeToDb(llLabeled, llLabeledV, uriQuery, "logical-link", llLabeled.marshal(false));
 
-        assertTrue("logical-link created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, llLabeledUri)
-            .hasNext());
-        assertTrue("labeled source relationship created",engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, llLabeledUri)
-            .both("org.onap.relationships.inventory.Source")
-            .has(AAIProperties.AAI_URI, lintSourceUri)
-            .hasNext());
-        assertTrue("labeled destination relationship created", engine.tx().traversal().V()
-            .has(AAIProperties.AAI_URI, llLabeledUri)
-            .both("org.onap.relationships.inventory.Destination")
-            .has(AAIProperties.AAI_URI, lintDestinationUri)
-            .hasNext());
+        assertTrue("logical-link created",
+                engine.tx().traversal().V().has(AAIProperties.AAI_URI, llLabeledUri).hasNext());
+        assertTrue("labeled source relationship created",
+                engine.tx().traversal().V().has(AAIProperties.AAI_URI, llLabeledUri)
+                        .both("org.onap.relationships.inventory.Source").has(AAIProperties.AAI_URI, lintSourceUri)
+                        .hasNext());
+        assertTrue("labeled destination relationship created",
+                engine.tx().traversal().V().has(AAIProperties.AAI_URI, llLabeledUri)
+                        .both("org.onap.relationships.inventory.Destination")
+                        .has(AAIProperties.AAI_URI, lintDestinationUri).hasNext());
     }
 
-
     @Test
     public void verifyRelsOfLatestViewOfGenericVnf() throws AAIException, UnsupportedEncodingException {
-        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
+        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH,
+                AAIProperties.MINIMUM_DEPTH);
 
-        String gvnfLatestView = serializer.getLatestVersionView(
-            engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfUri).next()).marshal(false);
+        String gvnfLatestView =
+                serializer.getLatestVersionView(engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfUri).next())
+                        .marshal(false);
         assertThat(gvnfLatestView,
-            hasJsonPath(
-                "$.l-interfaces.l-interface[*].relationship-list.relationship[*]",
-                hasSize(4)
-            ));
+                hasJsonPath("$.l-interfaces.l-interface[*].relationship-list.relationship[*]", hasSize(4)));
         assertThat(gvnfLatestView,
-            hasJsonPath(
-                "$.l-interfaces.l-interface[*].relationship-list.relationship[*].related-link",
-                containsInAnyOrder(
-                    "/aai/" + schemaVersions.getDefaultVersion() + llDefaultUri,
-                    "/aai/" + schemaVersions.getDefaultVersion() + llDefaultUri,
-                    "/aai/" + schemaVersions.getDefaultVersion() + llLabeledUri,
-                    "/aai/" + schemaVersions.getDefaultVersion() + llLabeledUri
-                )
-            ));
+                hasJsonPath("$.l-interfaces.l-interface[*].relationship-list.relationship[*].related-link",
+                        containsInAnyOrder("/aai/" + schemaVersions.getDefaultVersion() + llDefaultUri,
+                                "/aai/" + schemaVersions.getDefaultVersion() + llDefaultUri,
+                                "/aai/" + schemaVersions.getDefaultVersion() + llLabeledUri,
+                                "/aai/" + schemaVersions.getDefaultVersion() + llLabeledUri)));
         assertThat(gvnfLatestView,
-            hasJsonPath(
-                "$.l-interfaces.l-interface[*].relationship-list.relationship[*].relationship-label",
-                containsInAnyOrder(
-                    "tosca.relationships.network.LinksTo",
-                    "tosca.relationships.network.LinksTo",
-                    "org.onap.relationships.inventory.Source",
-                    "org.onap.relationships.inventory.Destination")
-            ));
+                hasJsonPath("$.l-interfaces.l-interface[*].relationship-list.relationship[*].relationship-label",
+                        containsInAnyOrder("tosca.relationships.network.LinksTo", "tosca.relationships.network.LinksTo",
+                                "org.onap.relationships.inventory.Source",
+                                "org.onap.relationships.inventory.Destination")));
     }
 
     @Test
     public void verifyRelsOfLatestViewOfLLDefault() throws AAIException, UnsupportedEncodingException {
-        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
+        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH,
+                AAIProperties.MINIMUM_DEPTH);
 
-        String llDefaultLatestView = serializer.getLatestVersionView(
-            engine.tx().traversal().V().has(AAIProperties.AAI_URI, llDefaultUri).next()).marshal(false);
-        assertThat(llDefaultLatestView,
-            hasJsonPath(
-                "$.relationship-list.relationship[*]",
-                hasSize(2)
-            ));
-        assertThat(llDefaultLatestView,
-            hasJsonPath(
-                "$.relationship-list.relationship[*].related-link",
-                containsInAnyOrder(
-                    "/aai/" + schemaVersions.getDefaultVersion() + lintSourceUri,
-                    "/aai/" + schemaVersions.getDefaultVersion() + lintDestinationUri
-                )
-            ));
+        String llDefaultLatestView = serializer
+                .getLatestVersionView(engine.tx().traversal().V().has(AAIProperties.AAI_URI, llDefaultUri).next())
+                .marshal(false);
+        assertThat(llDefaultLatestView, hasJsonPath("$.relationship-list.relationship[*]", hasSize(2)));
         assertThat(llDefaultLatestView,
-            hasJsonPath(
-                "$.relationship-list.relationship[*].relationship-label",
-                containsInAnyOrder("tosca.relationships.network.LinksTo","tosca.relationships.network.LinksTo")
-            ));
-        assertThat(llDefaultLatestView,
-            hasJsonPath(
-                "$.relationship-list.relationship[*].relationship-label",
-                not(contains("org.onap.relationships.inventory.Source", "org.onap.relationships.inventory.Destination"))
-            ));
+                hasJsonPath("$.relationship-list.relationship[*].related-link",
+                        containsInAnyOrder("/aai/" + schemaVersions.getDefaultVersion() + lintSourceUri,
+                                "/aai/" + schemaVersions.getDefaultVersion() + lintDestinationUri)));
+        assertThat(llDefaultLatestView, hasJsonPath("$.relationship-list.relationship[*].relationship-label",
+                containsInAnyOrder("tosca.relationships.network.LinksTo", "tosca.relationships.network.LinksTo")));
+        assertThat(llDefaultLatestView, hasJsonPath("$.relationship-list.relationship[*].relationship-label", not(
+                contains("org.onap.relationships.inventory.Source", "org.onap.relationships.inventory.Destination"))));
 
     }
 
     @Test
     public void verifyRelsOfLatestViewOfLLLabeled() throws AAIException, UnsupportedEncodingException {
-        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
+        DBSerializer serializer = new DBSerializer(version, engine, introspectorFactoryType, SOURCE_OF_TRUTH,
+                AAIProperties.MINIMUM_DEPTH);
 
-        String llLabeledLatestView = serializer.getLatestVersionView(
-            engine.tx().traversal().V().has(AAIProperties.AAI_URI, llLabeledUri).next()).marshal(false);
-        assertThat(llLabeledLatestView,
-            hasJsonPath(
-                "$.relationship-list.relationship[*]",
-                hasSize(2)
-            ));
+        String llLabeledLatestView = serializer
+                .getLatestVersionView(engine.tx().traversal().V().has(AAIProperties.AAI_URI, llLabeledUri).next())
+                .marshal(false);
+        assertThat(llLabeledLatestView, hasJsonPath("$.relationship-list.relationship[*]", hasSize(2)));
         assertThat(llLabeledLatestView,
-            hasJsonPath(
-                "$.relationship-list.relationship[*].related-link",
-                containsInAnyOrder(
-                    "/aai/" + schemaVersions.getDefaultVersion() + lintSourceUri,
-                    "/aai/" + schemaVersions.getDefaultVersion() + lintDestinationUri
-                )
-            ));
-        assertThat(llLabeledLatestView,
-            hasJsonPath(
-                "$.relationship-list.relationship[*].relationship-label",
-                not(containsInAnyOrder("tosca.relationships.network.LinksTo","tosca.relationships.network.LinksTo"))
-            ));
-        assertThat(llLabeledLatestView,
-            hasJsonPath(
-                "$.relationship-list.relationship[*].relationship-label",
-                contains("org.onap.relationships.inventory.Source", "org.onap.relationships.inventory.Destination")
-            ));
+                hasJsonPath("$.relationship-list.relationship[*].related-link",
+                        containsInAnyOrder("/aai/" + schemaVersions.getDefaultVersion() + lintSourceUri,
+                                "/aai/" + schemaVersions.getDefaultVersion() + lintDestinationUri)));
+        assertThat(llLabeledLatestView, hasJsonPath("$.relationship-list.relationship[*].relationship-label",
+                not(containsInAnyOrder("tosca.relationships.network.LinksTo", "tosca.relationships.network.LinksTo"))));
+        assertThat(llLabeledLatestView, hasJsonPath("$.relationship-list.relationship[*].relationship-label",
+                contains("org.onap.relationships.inventory.Source", "org.onap.relationships.inventory.Destination")));
 
     }
 
-
     @Test
     public void verifyRelsOfOldViewOfGenericVnf() throws AAIException, UnsupportedEncodingException {
         SchemaVersion oldVersion = new SchemaVersion("v11");
         Loader oldLoader = loaderFactory.getLoaderStrategy(introspectorFactoryType, oldVersion);
-        DBSerializer oldSerializer = new DBSerializer(oldVersion, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
-
-        String gvnfOldView = oldSerializer.dbToObject(
-            Collections.singletonList(engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfUri).next()),
-            oldLoader.introspectorFromName("generic-vnf"),
-            AAIProperties.MAXIMUM_DEPTH, false, "false")
-            .marshal(false);
+        DBSerializer oldSerializer = new DBSerializer(oldVersion, engine, introspectorFactoryType, SOURCE_OF_TRUTH,
+                AAIProperties.MINIMUM_DEPTH);
+
+        String gvnfOldView = oldSerializer
+                .dbToObject(
+                        Collections
+                                .singletonList(engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfUri).next()),
+                        oldLoader.introspectorFromName("generic-vnf"), AAIProperties.MAXIMUM_DEPTH, false, "false")
+                .marshal(false);
         assertThat(gvnfOldView,
-            hasJsonPath(
-                "$.l-interfaces.l-interface[*].relationship-list.relationship[*]",
-                hasSize(2)
-            ));
+                hasJsonPath("$.l-interfaces.l-interface[*].relationship-list.relationship[*]", hasSize(2)));
         assertThat(gvnfOldView,
-            hasJsonPath(
-                "$.l-interfaces.l-interface[*].relationship-list.relationship[*].relationship-label",
-                emptyCollectionOf(String.class)
-            ));
+                hasJsonPath("$.l-interfaces.l-interface[*].relationship-list.relationship[*].relationship-label",
+                        emptyCollectionOf(String.class)));
         assertThat(gvnfOldView,
-            hasJsonPath(
-                "$.l-interfaces.l-interface[*].relationship-list.relationship[*].related-link",
-                containsInAnyOrder(
-                    "/aai/" + oldVersion + llDefaultUri,
-                    "/aai/" + oldVersion + llDefaultUri
-                )
-            ));
+                hasJsonPath("$.l-interfaces.l-interface[*].relationship-list.relationship[*].related-link",
+                        containsInAnyOrder("/aai/" + oldVersion + llDefaultUri, "/aai/" + oldVersion + llDefaultUri)));
     }
 
     @Test
     public void verifyRelsOfOldViewOfLLDefault() throws AAIException, UnsupportedEncodingException {
         SchemaVersion oldVersion = new SchemaVersion("v11");
         Loader oldLoader = loaderFactory.getLoaderStrategy(introspectorFactoryType, oldVersion);
-        DBSerializer oldSerializer = new DBSerializer(oldVersion, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
-
-        String llDefaultOldView = oldSerializer.dbToObject(
-            Collections.singletonList(engine.tx().traversal().V().has(AAIProperties.AAI_URI, llDefaultUri).next()),
-            oldLoader.introspectorFromName("logical-link"),
-            AAIProperties.MAXIMUM_DEPTH, false, "false")
-            .marshal(false);
-        assertThat(llDefaultOldView,
-            hasJsonPath(
-                "$.relationship-list.relationship[*]",
-                hasSize(2)
-            ));
+        DBSerializer oldSerializer = new DBSerializer(oldVersion, engine, introspectorFactoryType, SOURCE_OF_TRUTH,
+                AAIProperties.MINIMUM_DEPTH);
+
+        String llDefaultOldView = oldSerializer
+                .dbToObject(
+                        Collections.singletonList(
+                                engine.tx().traversal().V().has(AAIProperties.AAI_URI, llDefaultUri).next()),
+                        oldLoader.introspectorFromName("logical-link"), AAIProperties.MAXIMUM_DEPTH, false, "false")
+                .marshal(false);
+        assertThat(llDefaultOldView, hasJsonPath("$.relationship-list.relationship[*]", hasSize(2)));
         assertThat(llDefaultOldView,
-            hasJsonPath(
-                "$.relationship-list.relationship[*].relationship-label",
-                emptyCollectionOf(String.class)
-            ));
-        assertThat(llDefaultOldView,
-            hasJsonPath(
-                "$.relationship-list.relationship[*].related-link",
-                containsInAnyOrder(
-                    "/aai/" + oldVersion + lintSourceUri,
-                    "/aai/" + oldVersion + lintDestinationUri
-                )
-            ));
+                hasJsonPath("$.relationship-list.relationship[*].relationship-label", emptyCollectionOf(String.class)));
+        assertThat(llDefaultOldView, hasJsonPath("$.relationship-list.relationship[*].related-link",
+                containsInAnyOrder("/aai/" + oldVersion + lintSourceUri, "/aai/" + oldVersion + lintDestinationUri)));
 
     }
 
@@ -379,39 +308,32 @@ public class VersionedScenariosTest extends AAISetup {
     public void verifyRelsOfOldViewOfLLLabeled() throws AAIException, UnsupportedEncodingException {
         SchemaVersion oldVersion = new SchemaVersion("v11");
         Loader oldLoader = loaderFactory.getLoaderStrategy(introspectorFactoryType, oldVersion);
-        DBSerializer oldSerializer = new DBSerializer(oldVersion, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
-
-        String llLabeledtOldView = oldSerializer.dbToObject(
-            Collections.singletonList(engine.tx().traversal().V().has(AAIProperties.AAI_URI, llLabeledUri).next()),
-            oldLoader.introspectorFromName("logical-link"),
-            AAIProperties.MAXIMUM_DEPTH, false, "false")
-            .marshal(false);
-        assertThat(llLabeledtOldView,
-            not(hasJsonPath(
-                "$.relationship-list.relationship[*]"
-            )));
+        DBSerializer oldSerializer = new DBSerializer(oldVersion, engine, introspectorFactoryType, SOURCE_OF_TRUTH,
+                AAIProperties.MINIMUM_DEPTH);
+
+        String llLabeledtOldView = oldSerializer
+                .dbToObject(
+                        Collections.singletonList(
+                                engine.tx().traversal().V().has(AAIProperties.AAI_URI, llLabeledUri).next()),
+                        oldLoader.introspectorFromName("logical-link"), AAIProperties.MAXIMUM_DEPTH, false, "false")
+                .marshal(false);
+        assertThat(llLabeledtOldView, not(hasJsonPath("$.relationship-list.relationship[*]")));
     }
 
-
     @Test
-    public void useOldVersionToUpdatedGenericVnfAndVerifyLatestVersionRels() throws AAIException, UnsupportedEncodingException, URISyntaxException {
+    public void useOldVersionToUpdatedGenericVnfAndVerifyLatestVersionRels()
+            throws AAIException, UnsupportedEncodingException, URISyntaxException {
         SchemaVersion oldVersion = new SchemaVersion("v11");
         Loader oldLoader = loaderFactory.getLoaderStrategy(introspectorFactoryType, oldVersion);
-        DBSerializer oldSerializer = new DBSerializer(oldVersion, engine, introspectorFactoryType, SOURCE_OF_TRUTH, AAIProperties.MINIMUM_DEPTH);
+        DBSerializer oldSerializer = new DBSerializer(oldVersion, engine, introspectorFactoryType, SOURCE_OF_TRUTH,
+                AAIProperties.MINIMUM_DEPTH);
 
         Vertex oldGvnfV = engine.tx().traversal().V().has(AAIProperties.AAI_URI, gvnfUri).next();
-        Introspector oldGvnf = oldSerializer.dbToObject(
-            Collections.singletonList(oldGvnfV),
-            oldLoader.introspectorFromName("generic-vnf"),
-            AAIProperties.MAXIMUM_DEPTH, false, "false");
+        Introspector oldGvnf = oldSerializer.dbToObject(Collections.singletonList(oldGvnfV),
+                oldLoader.introspectorFromName("generic-vnf"), AAIProperties.MAXIMUM_DEPTH, false, "false");
         assertThat(oldGvnf.marshal(false),
-            hasJsonPath(
-                "$.l-interfaces.l-interface[*].relationship-list.relationship[*].related-link",
-                containsInAnyOrder(
-                    "/aai/" + oldVersion + llDefaultUri,
-                    "/aai/" + oldVersion + llDefaultUri
-                )
-            ));
+                hasJsonPath("$.l-interfaces.l-interface[*].relationship-list.relationship[*].related-link",
+                        containsInAnyOrder("/aai/" + oldVersion + llDefaultUri, "/aai/" + oldVersion + llDefaultUri)));
         oldGvnf.setValue("in-maint", true);
         QueryParser uriQuery = engine.getQueryBuilder().createQueryFromURI(new URI(gvnfUri));
         oldSerializer.serializeToDb(oldGvnf, oldGvnfV, uriQuery, "generic-vnf", oldGvnf.marshal(false));
@@ -420,7 +342,4 @@ public class VersionedScenariosTest extends AAISetup {
         verifyRelsOfOldViewOfGenericVnf();
     }
 
-
-
-
 }
index 5201cc5..738953d 100644 (file)
@@ -26,9 +26,6 @@ import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 import static org.onap.aai.edges.enums.EdgeField.CONTAINS;
 
-import com.jayway.jsonpath.JsonPath;
-
-import java.io.InputStream;
 import java.util.*;
 
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
index 8c60355..6ae32f3 100644 (file)
@@ -38,8 +38,6 @@ import org.onap.aai.edges.EdgeIngestor;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.serialization.db.AAICoreFakeEdgesConfigTranslator;
 import org.onap.aai.serialization.db.EdgeSerializer;
-import org.onap.aai.setup.SchemaLocationsBean;
-import org.onap.aai.setup.SchemaVersions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.ContextConfiguration;
index 0b6ffd9..2b80fb1 100644 (file)
 
 package org.onap.aai.serialization.queryformats;
 
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
 import com.google.gson.JsonObject;
+
+import java.util.*;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -46,12 +53,6 @@ import org.onap.aai.setup.SchemaVersion;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 
-import java.util.*;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class AggregateFormatTest extends AAISetup {
 
@@ -126,8 +127,8 @@ public class AggregateFormatTest extends AAISetup {
         assertTrue(json.has("hostname"));
         assertFalse(json.has("node-type"));
         Map<String, List<String>> propMap = new HashMap<>();
-        List<String> selectedProps = new ArrayList<String>( Arrays.asList("'physical-location-id'"));
-        propMap.put("complex",selectedProps);
+        List<String> selectedProps = new ArrayList<String>(Arrays.asList("'physical-location-id'"));
+        propMap.put("complex", selectedProps);
         JsonObject json1 = aggregate.createSelectedPropertiesObject(complex, propMap).get();
         json1.entrySet().forEach((System.out::println));
         assertFalse(json1.has("country"));
index 33b2dab..daf7d47 100644 (file)
 
 package org.onap.aai.serialization.queryformats;
 
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
 import com.google.gson.JsonObject;
+
+import java.util.Arrays;
+import java.util.List;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -46,15 +54,6 @@ import org.onap.aai.setup.SchemaVersion;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 
-import java.util.Arrays;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-
-
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 
 public class CountQuerySupportTest extends AAISetup {
index 22b500f..04026b4 100644 (file)
@@ -26,8 +26,6 @@ import static org.hamcrest.core.IsNot.not;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonObject;
 
@@ -49,8 +47,8 @@ import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.serialization.db.AAICorePrivateEdgeTestConfigTranslator;
 import org.onap.aai.serialization.db.EdgeSerializer;
-import org.onap.aai.setup.SchemaLocationsBean;
-import org.onap.aai.setup.SchemaVersions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.ContextConfiguration;
index 0904ceb..1bfdf9c 100644 (file)
 
 package org.onap.aai.serialization.queryformats;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.*;
+
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
+
+import java.io.UnsupportedEncodingException;
+
+import javax.ws.rs.core.MultivaluedHashMap;
+
 import org.apache.tinkerpop.gremlin.process.traversal.Path;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
@@ -50,13 +59,6 @@ import org.onap.aai.setup.SchemaVersion;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 
-import javax.ws.rs.core.MultivaluedHashMap;
-import java.io.UnsupportedEncodingException;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Mockito.*;
-
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class MultiFormatTest extends AAISetup {
 
@@ -80,11 +82,12 @@ public class MultiFormatTest extends AAISetup {
             "{\"path\":[{\"resource-type\":\"generic-vnf\"},{\"resource-type\":\"vserver\"},{\"resource-type\":\"pserver\"},{\"resource-type\":\"complex\"}]}")
             .getAsJsonObject();
     private JsonObject expectedAsTreeWithResourceFormat = new JsonParser().parse(
-                "{\"results\":[{\"generic-vnf\":{\"vnf-id\":\"vnf-id-1\",\"vnf-name\":\"vnf-name-1\",\"related-nodes\":[{\"vserver\":{\"vserver-id\":\"vserver-id-1\",\"vserver-name\":\"vserver-name-1\",\"related-nodes\":[{\"pserver\":{\"hostname\":\"hostname-1\"}}]}},{\"pserver\":{\"hostname\":\"hostname-2\",\"related-nodes\":[{\"complex\":{\"physical-location-id\":\"physical-location-id-2\",\"country\":\"US\"}}]}}]}}]}")
+            "{\"results\":[{\"generic-vnf\":{\"vnf-id\":\"vnf-id-1\",\"vnf-name\":\"vnf-name-1\",\"related-nodes\":[{\"vserver\":{\"vserver-id\":\"vserver-id-1\",\"vserver-name\":\"vserver-name-1\",\"related-nodes\":[{\"pserver\":{\"hostname\":\"hostname-1\"}}]}},{\"pserver\":{\"hostname\":\"hostname-2\",\"related-nodes\":[{\"complex\":{\"physical-location-id\":\"physical-location-id-2\",\"country\":\"US\"}}]}}]}}]}")
             .getAsJsonObject();
     private JsonObject expectedAsTreeWithSimpleFormat = new JsonParser().parse(
-        "{\"results\":[{\"id\":\"0\",\"node-type\":\"generic-vnf\",\"url\":null,\"properties\":{\"vnf-id\":\"vnf-id-1\",\"vnf-name\":\"vnf-name-1\"},\"related-to\":[{\"id\":\"1\",\"relationship-label\":\"tosca.relationships.HostedOn\",\"node-type\":\"vserver\",\"url\":null},{\"id\":\"5\",\"relationship-label\":\"tosca.relationships.HostedOn\",\"node-type\":\"pserver\",\"url\":null}],\"related-nodes\":[{\"id\":\"1\",\"node-type\":\"vserver\",\"url\":null,\"properties\":{\"vserver-id\":\"vserver-id-1\",\"vserver-name\":\"vserver-name-1\"},\"related-to\":[{\"id\":\"0\",\"relationship-label\":\"tosca.relationships.HostedOn\",\"node-type\":\"generic-vnf\",\"url\":null},{\"id\":\"2\",\"relationship-label\":\"tosca.relationships.HostedOn\",\"node-type\":\"pserver\",\"url\":null}],\"related-nodes\":[{\"id\":\"2\",\"node-type\":\"pserver\",\"url\":null,\"properties\":{\"hostname\":\"hostname-1\"},\"related-to\":[{\"id\":\"1\",\"relationship-label\":\"tosca.relationships.HostedOn\",\"node-type\":\"vserver\",\"url\":null},{\"id\":\"3\",\"relationship-label\":\"org.onap.relationships.inventory.LocatedIn\",\"node-type\":\"complex\",\"url\":null}]}]},{\"id\":\"5\",\"node-type\":\"pserver\",\"url\":null,\"properties\":{\"hostname\":\"hostname-2\"},\"related-to\":[{\"id\":\"0\",\"relationship-label\":\"tosca.relationships.HostedOn\",\"node-type\":\"generic-vnf\",\"url\":null},{\"id\":\"6\",\"relationship-label\":\"org.onap.relationships.inventory.LocatedIn\",\"node-type\":\"complex\",\"url\":null}],\"related-nodes\":[{\"id\":\"6\",\"node-type\":\"complex\",\"url\":null,\"properties\":{\"physical-location-id\":\"physical-location-id-2\",\"country\":\"US\"},\"related-to\":[{\"id\":\"5\",\"relationship-label\":\"org.onap.relationships.inventory.LocatedIn\",\"node-type\":\"pserver\",\"url\":null}]}]}]}]}")
-        .getAsJsonObject();
+            "{\"results\":[{\"id\":\"0\",\"node-type\":\"generic-vnf\",\"url\":null,\"properties\":{\"vnf-id\":\"vnf-id-1\",\"vnf-name\":\"vnf-name-1\"},\"related-to\":[{\"id\":\"1\",\"relationship-label\":\"tosca.relationships.HostedOn\",\"node-type\":\"vserver\",\"url\":null},{\"id\":\"5\",\"relationship-label\":\"tosca.relationships.HostedOn\",\"node-type\":\"pserver\",\"url\":null}],\"related-nodes\":[{\"id\":\"1\",\"node-type\":\"vserver\",\"url\":null,\"properties\":{\"vserver-id\":\"vserver-id-1\",\"vserver-name\":\"vserver-name-1\"},\"related-to\":[{\"id\":\"0\",\"relationship-label\":\"tosca.relationships.HostedOn\",\"node-type\":\"generic-vnf\",\"url\":null},{\"id\":\"2\",\"relationship-label\":\"tosca.relationships.HostedOn\",\"node-type\":\"pserver\",\"url\":null}],\"related-nodes\":[{\"id\":\"2\",\"node-type\":\"pserver\",\"url\":null,\"properties\":{\"hostname\":\"hostname-1\"},\"related-to\":[{\"id\":\"1\",\"relationship-label\":\"tosca.relationships.HostedOn\",\"node-type\":\"vserver\",\"url\":null},{\"id\":\"3\",\"relationship-label\":\"org.onap.relationships.inventory.LocatedIn\",\"node-type\":\"complex\",\"url\":null}]}]},{\"id\":\"5\",\"node-type\":\"pserver\",\"url\":null,\"properties\":{\"hostname\":\"hostname-2\"},\"related-to\":[{\"id\":\"0\",\"relationship-label\":\"tosca.relationships.HostedOn\",\"node-type\":\"generic-vnf\",\"url\":null},{\"id\":\"6\",\"relationship-label\":\"org.onap.relationships.inventory.LocatedIn\",\"node-type\":\"complex\",\"url\":null}],\"related-nodes\":[{\"id\":\"6\",\"node-type\":\"complex\",\"url\":null,\"properties\":{\"physical-location-id\":\"physical-location-id-2\",\"country\":\"US\"},\"related-to\":[{\"id\":\"5\",\"relationship-label\":\"org.onap.relationships.inventory.LocatedIn\",\"node-type\":\"pserver\",\"url\":null}]}]}]}]}")
+            .getAsJsonObject();
+
     @Before
     public void setUp() throws Exception {
 
@@ -136,7 +139,7 @@ public class MultiFormatTest extends AAISetup {
 
     @Test
     public void testAsTreeParamAndSimpleFormat()
-        throws AAIFormatVertexException, AAIException, AAIFormatQueryResultFormatNotSupported {
+            throws AAIFormatVertexException, AAIException, AAIFormatQueryResultFormatNotSupported {
 
         createLoaderEngineSetup();
         DBSerializer serializer = new DBSerializer(version, dbEngine, factoryType, "Junit");
@@ -154,7 +157,7 @@ public class MultiFormatTest extends AAISetup {
 
     @Test
     public void testAsTreeParamAndResourceFormat()
-        throws AAIFormatVertexException, AAIException, AAIFormatQueryResultFormatNotSupported {
+            throws AAIFormatVertexException, AAIException, AAIFormatQueryResultFormatNotSupported {
 
         createLoaderEngineSetup();
         DBSerializer serializer = new DBSerializer(version, dbEngine, factoryType, "Junit");
@@ -169,7 +172,6 @@ public class MultiFormatTest extends AAISetup {
         assertEquals(this.expectedAsTreeWithResourceFormat, json);
     }
 
-
     @Test
     public void testPathResultQueryIdFormat()
             throws AAIFormatVertexException, AAIException, AAIFormatQueryResultFormatNotSupported {
index 199939e..b38b20a 100644 (file)
 
 package org.onap.aai.serialization.queryformats;
 
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
 import com.google.gson.JsonObject;
+
+import java.util.Optional;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -47,13 +55,6 @@ import org.onap.aai.setup.SchemaVersion;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 
-import java.util.Optional;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class PathedURLTest extends AAISetup {
 
@@ -83,17 +84,11 @@ public class PathedURLTest extends AAISetup {
 
         graph = TinkerGraph.open();
 
-        Vertex pserver1 =
-            graph.addVertex(
-                T.label, "pserver",
-                T.id, "2",
-                "aai-node-type", "pserver",
-                "hostname", "hostname-1",
-                "resource-version", System.currentTimeMillis()
-            );
+        Vertex pserver1 = graph.addVertex(T.label, "pserver", T.id, "2", "aai-node-type", "pserver", "hostname",
+                "hostname-1", "resource-version", System.currentTimeMillis());
 
         Vertex complex1 = graph.addVertex(T.label, "complex", T.id, "3", "aai-node-type", "complex",
-            "physical-location-id", "physical-location-id-1", "country", "US");
+                "physical-location-id", "physical-location-id-1", "country", "US");
 
         GraphTraversalSource g = graph.traversal();
         rules.addEdge(g, pserver1, complex1);
@@ -120,7 +115,7 @@ public class PathedURLTest extends AAISetup {
             when(dbEngine.asAdmin()).thenReturn(spyAdmin);
 
             when(spyAdmin.getReadOnlyTraversalSource())
-                .thenReturn(graph.traversal().withStrategies(ReadOnlyStrategy.instance()));
+                    .thenReturn(graph.traversal().withStrategies(ReadOnlyStrategy.instance()));
             when(spyAdmin.getTraversalSource()).thenReturn(graph.traversal());
         }
     }
@@ -132,7 +127,7 @@ public class PathedURLTest extends AAISetup {
         when(urlBuilder.pathed(pserver)).thenReturn("/aai/v14/cloud-infrastructure/pservers/pserver/hostname-1");
         Optional<JsonObject> jsonObjectOptional = pathedURL.getJsonFromVertex(pserver);
 
-        if(!jsonObjectOptional.isPresent()){
+        if (!jsonObjectOptional.isPresent()) {
             fail("Expecting an json object returned from pathed url but returned none");
         }
 
@@ -141,18 +136,21 @@ public class PathedURLTest extends AAISetup {
         assertNotNull("Expecting the pserver object to contain resource type", pserverObject.get("resource-type"));
         assertThat(pserverObject.get("resource-type").getAsString(), CoreMatchers.is("pserver"));
         assertNotNull("Expecting the pserver object to contain resource link", pserverObject.get("resource-link"));
-        assertThat(pserverObject.get("resource-link").getAsString(), CoreMatchers.is("/aai/v14/cloud-infrastructure/pservers/pserver/hostname-1"));
-        assertNotNull("Expecting the pserver object to contain resource version", pserverObject.get("resource-version"));
+        assertThat(pserverObject.get("resource-link").getAsString(),
+                CoreMatchers.is("/aai/v14/cloud-infrastructure/pservers/pserver/hostname-1"));
+        assertNotNull("Expecting the pserver object to contain resource version",
+                pserverObject.get("resource-version"));
     }
 
     @Test
-    public void testPathedUrlReturnsResourceVersionWhenIncludeUrlIsNotSet() throws AAIFormatVertexException, AAIException {
+    public void testPathedUrlReturnsResourceVersionWhenIncludeUrlIsNotSet()
+            throws AAIFormatVertexException, AAIException {
 
         pathedURL = new PathedURL.Builder(loader, serializer, urlBuilder).build();
         when(urlBuilder.pathed(pserver)).thenReturn("/aai/v14/cloud-infrastructure/pservers/pserver/hostname-1");
         Optional<JsonObject> jsonObjectOptional = pathedURL.getJsonFromVertex(pserver);
 
-        if(!jsonObjectOptional.isPresent()){
+        if (!jsonObjectOptional.isPresent()) {
             fail("Expecting an json object returned from pathed url but returned none");
         }
 
@@ -161,7 +159,9 @@ public class PathedURLTest extends AAISetup {
         assertNotNull("Expecting the pserver object to contain resource type", pserverObject.get("resource-type"));
         assertThat(pserverObject.get("resource-type").getAsString(), CoreMatchers.is("pserver"));
         assertNotNull("Expecting the pserver object to contain resource link", pserverObject.get("resource-link"));
-        assertThat(pserverObject.get("resource-link").getAsString(), CoreMatchers.is("/aai/v14/cloud-infrastructure/pservers/pserver/hostname-1"));
-        assertNull("Expecting the pserver object to not contain resource version", pserverObject.get("resource-version"));
+        assertThat(pserverObject.get("resource-link").getAsString(),
+                CoreMatchers.is("/aai/v14/cloud-infrastructure/pservers/pserver/hostname-1"));
+        assertNull("Expecting the pserver object to not contain resource version",
+                pserverObject.get("resource-version"));
     }
 }
index f88de4f..232e80b 100644 (file)
 
 package org.onap.aai.serialization.queryformats;
 
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
 import com.google.gson.JsonObject;
+
+import java.util.*;
+
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -46,12 +53,6 @@ import org.onap.aai.setup.SchemaVersion;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.annotation.DirtiesContext;
 
-import java.util.*;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class RawFormatTest extends AAISetup {
 
@@ -98,27 +99,27 @@ public class RawFormatTest extends AAISetup {
     }
 
     @Test
-    public void verifyPserverRelatedToHasEdgeLabel()
-            throws AAIFormatVertexException {
-        assertEquals("org.onap.relationships.inventory.LocatedIn", rawFormat.createRelationshipObject(pserver).get(0).getAsJsonObject().get("relationship-label").getAsString());
+    public void verifyPserverRelatedToHasEdgeLabel() throws AAIFormatVertexException {
+        assertEquals("org.onap.relationships.inventory.LocatedIn", rawFormat.createRelationshipObject(pserver).get(0)
+                .getAsJsonObject().get("relationship-label").getAsString());
     }
 
     @Test
-    public void verifyPserverRelatedToComplexLabel()
-            throws AAIFormatVertexException {
-        assertEquals("complex", rawFormat.createRelationshipObject(pserver).get(0).getAsJsonObject().get("node-type").getAsString());
+    public void verifyPserverRelatedToComplexLabel() throws AAIFormatVertexException {
+        assertEquals("complex",
+                rawFormat.createRelationshipObject(pserver).get(0).getAsJsonObject().get("node-type").getAsString());
     }
 
     @Test
-    public void verifyComplexRelatedToHasEdgeLabel()
-            throws AAIFormatVertexException {
-        assertEquals("org.onap.relationships.inventory.LocatedIn", rawFormat.createRelationshipObject(complex).get(0).getAsJsonObject().get("relationship-label").getAsString());
+    public void verifyComplexRelatedToHasEdgeLabel() throws AAIFormatVertexException {
+        assertEquals("org.onap.relationships.inventory.LocatedIn", rawFormat.createRelationshipObject(complex).get(0)
+                .getAsJsonObject().get("relationship-label").getAsString());
     }
 
     @Test
-    public void verifyComplexRelatedToPserverLabel()
-            throws AAIFormatVertexException {
-        assertEquals("pserver", rawFormat.createRelationshipObject(complex).get(0).getAsJsonObject().get("node-type").getAsString());
+    public void verifyComplexRelatedToPserverLabel() throws AAIFormatVertexException {
+        assertEquals("pserver",
+                rawFormat.createRelationshipObject(complex).get(0).getAsJsonObject().get("node-type").getAsString());
     }
 
     private void createLoaderEngineSetup() throws AAIException {
@@ -149,13 +150,12 @@ public class RawFormatTest extends AAISetup {
         json.entrySet().forEach((System.out::println));
         assertTrue(json.has("hostname"));
         Map<String, List<String>> propMap = new HashMap<>();
-        List<String> selectedProps = new ArrayList<String>( Arrays.asList("'physical-location-id'"));
-        propMap.put("complex",selectedProps);
+        List<String> selectedProps = new ArrayList<String>(Arrays.asList("'physical-location-id'"));
+        propMap.put("complex", selectedProps);
         JsonObject json1 = rawFormat.createSelectedPropertiesObject(complex, propMap).get();
         json1.entrySet().forEach((System.out::println));
         assertFalse(json1.has("aai-node-type"));
         assertTrue(json1.has("physical-location-id"));
     }
 
-
 }
index 781656e..1017893 100644 (file)
 
 package org.onap.aai.serialization.queryformats;
 
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
 import com.google.gson.JsonObject;
+
+import java.util.Arrays;
+
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.T;
@@ -42,14 +52,6 @@ import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexExcepti
 import org.onap.aai.serialization.queryformats.utils.UrlBuilder;
 import org.springframework.test.annotation.DirtiesContext;
 
-import javax.ws.rs.core.MultivaluedHashMap;
-import javax.ws.rs.core.MultivaluedMap;
-import java.util.Arrays;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class ResourceFormatTest extends AAISetup {
 
@@ -126,7 +128,8 @@ public class ResourceFormatTest extends AAISetup {
         createLoaderEngineSetup();
         serializer = new DBSerializer(schemaVersions.getAppRootVersion(), dbEngine, factoryType, "Junit");
 
-        FormatFactory ff = new FormatFactory(loader, serializer, schemaVersions, basePath, "https://localhost:8447/aai/");
+        FormatFactory ff =
+                new FormatFactory(loader, serializer, schemaVersions, basePath, "https://localhost:8447/aai/");
         MultivaluedMap mvm = new MultivaluedHashMap();
         mvm.add("depth", "0");
         Formatter formatter = ff.get(Format.resource, mvm);
index 57a2311..2bb3971 100644 (file)
 
 package org.onap.aai.serialization.queryformats;
 
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
 import com.google.gson.JsonObject;
+
 import java.util.Optional;
+
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -42,10 +48,6 @@ import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexExcepti
 import org.onap.aai.serialization.queryformats.utils.UrlBuilder;
 import org.onap.aai.setup.SchemaVersion;
 
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
 public class ResourceWithSoTTest extends AAISetup {
     @Mock
     private UrlBuilder urlBuilder;
@@ -115,7 +117,8 @@ public class ResourceWithSoTTest extends AAISetup {
     // This test is to simulate a PUT request
     @Test
     public void testGetJsonFromVertexWithCreateVertex() throws AAIFormatVertexException, AAIException {
-        if (putVertex == null) fail("The vertex used for this test is null. Fail immediately.");
+        if (putVertex == null)
+            fail("The vertex used for this test is null. Fail immediately.");
 
         JsonObject json = resourceWithSoT.getJsonFromVertex(putVertex).get();
         assertEquals(jsonPutObj, json);
@@ -124,8 +127,10 @@ public class ResourceWithSoTTest extends AAISetup {
     // This test is to simulate PATCH requests
     @Test
     public void testGetJsonFromVertexWithModifyVertex() throws AAIFormatVertexException, AAIException {
-        if (patchVertex1 == null) fail("The vertex 1 used for this test is null. Fail immediately.");
-        if (patchVertex2 == null) fail("The vertex 2 used for this test is null. Fail immediately.");
+        if (patchVertex1 == null)
+            fail("The vertex 1 used for this test is null. Fail immediately.");
+        if (patchVertex2 == null)
+            fail("The vertex 2 used for this test is null. Fail immediately.");
 
         // Differing Source of Truths will indicate that the action performed modified the vertex
         JsonObject json1 = resourceWithSoT.getJsonFromVertex(patchVertex1).get();
index bf8a1c9..279c3e8 100644 (file)
@@ -31,6 +31,8 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
+import com.google.gson.JsonObject;
+
 import java.io.UnsupportedEncodingException;
 import java.util.Arrays;
 
@@ -60,8 +62,6 @@ import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexExcepti
 import org.onap.aai.serialization.queryformats.utils.UrlBuilder;
 import org.springframework.test.annotation.DirtiesContext;
 
-import com.google.gson.JsonObject;
-
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class SimpleFormatTest extends AAISetup {
 
@@ -140,7 +140,8 @@ public class SimpleFormatTest extends AAISetup {
         createLoaderEngineSetup();
         serializer = new DBSerializer(schemaVersions.getRelatedLinkVersion(), dbEngine, factoryType, "Junit");
 
-        FormatFactory ff = new FormatFactory(loader, serializer, schemaVersions, basePath, "https://localhost:8447/aai/");
+        FormatFactory ff =
+                new FormatFactory(loader, serializer, schemaVersions, basePath, "https://localhost:8447/aai/");
         MultivaluedMap mvm = new MultivaluedHashMap();
         mvm.add("depth", "0");
         Formatter formatter = ff.get(Format.simple, mvm);
index c509ab4..b8c3ea9 100644 (file)
@@ -48,27 +48,21 @@ public class TreeBackedVertexTest {
     public void configure() {
         GraphTraversalSource g = graph.traversal();
 
-        startKey = g.addV("vserver").as("v1").property("test", "hello")
-                    .addV("vserver").as("v2")
-                    .addV("interface").property("name", "interface 1").as("v10")
-                    .addE("hasChild").from("v2").property(EdgeProperty.CONTAINS.toString(), true)
-                    .addV("pserver").property("name", "pserver 1").as("v4")
-                    .addE("runsOn").to("v1").property(EdgeProperty.CONTAINS.toString(), false)
-                    .addV("interface").property("name", "interface 2").as("v3")
-                    .addE("hasChild").from("v1").property(EdgeProperty.CONTAINS.toString(), true)
-                    .addV("address").property("name", "address 1")
-                    .addE("hasChild").from("v3").property(EdgeProperty.CONTAINS.toString(), true)
-                    .addV("address").property("name", "address 2")
-                    .addE("hasChild").from("v3").property(EdgeProperty.CONTAINS.toString(), true)
-                    .addV("complex").property("name", "complex 1")
-                    .addE("locatedIn").from("v4").property(EdgeProperty.CONTAINS.toString(), false)
-                    .addV("interface").property("name", "interface 3")
-                    .addE("hasChild").from("v4").property(EdgeProperty.CONTAINS.toString(), true)
-                    .addV("subnet").property("name", "subnet 1").as("v5")
-                    .addE("in").from("v3").property(EdgeProperty.CONTAINS.toString(), false)
-                    .addV("address").property("name", "address 3").as("v6")
-                    .addE("hasChild").from("v5").property(EdgeProperty.CONTAINS.toString(), true)
-                    .select("v1").next();
+        startKey = g.addV("vserver").as("v1").property("test", "hello").addV("vserver").as("v2").addV("interface")
+                .property("name", "interface 1").as("v10").addE("hasChild").from("v2")
+                .property(EdgeProperty.CONTAINS.toString(), true).addV("pserver").property("name", "pserver 1").as("v4")
+                .addE("runsOn").to("v1").property(EdgeProperty.CONTAINS.toString(), false).addV("interface")
+                .property("name", "interface 2").as("v3").addE("hasChild").from("v1")
+                .property(EdgeProperty.CONTAINS.toString(), true).addV("address").property("name", "address 1")
+                .addE("hasChild").from("v3").property(EdgeProperty.CONTAINS.toString(), true).addV("address")
+                .property("name", "address 2").addE("hasChild").from("v3")
+                .property(EdgeProperty.CONTAINS.toString(), true).addV("complex").property("name", "complex 1")
+                .addE("locatedIn").from("v4").property(EdgeProperty.CONTAINS.toString(), false).addV("interface")
+                .property("name", "interface 3").addE("hasChild").from("v4")
+                .property(EdgeProperty.CONTAINS.toString(), true).addV("subnet").property("name", "subnet 1").as("v5")
+                .addE("in").from("v3").property(EdgeProperty.CONTAINS.toString(), false).addV("address")
+                .property("name", "address 3").as("v6").addE("hasChild").from("v5")
+                .property(EdgeProperty.CONTAINS.toString(), true).select("v1").next();
 
         tree = new GraphTraversalQueryEngine(g).findSubGraph((Vertex) startKey);
         treeDepth1 = new GraphTraversalQueryEngine(g).findSubGraph((Vertex) startKey, 1, false);
index 90cda07..fb7ba40 100644 (file)
@@ -43,12 +43,12 @@ public class IndexStressTest extends AAISetup {
     private static final Logger LOGGER = LoggerFactory.getLogger(IndexStressTest.class);
 
     @Before
-    public void setup(){
+    public void setup() {
         AAIGraph.getInstance().getGraph();
     }
 
     @Test
-    public void testIndexStress(){
+    public void testIndexStress() {
         JanusGraphTransaction tx = AAIGraph.getInstance().getGraph().newTransaction();
 
         GraphTraversalSource g = tx.traversal();
@@ -58,18 +58,15 @@ public class IndexStressTest extends AAISetup {
 
         int TOTAL_LINKS = 101000;
 
-        for(int i = 0; i <TOTAL_LINKS; i++){
+        for (int i = 0; i < TOTAL_LINKS; i++) {
 
             String linkName = generateName(linkNameSet);
             aaiUriSet.add("/network/logical-links/logical-link/" + linkName);
 
-            Vertex v = g.addV()
-                .property("aai-node-type", "logical-link")
-                .property("link-name", linkName)
-                .property("aai-uri", "/network/logical-links/logical-link/" + linkName)
-                .next();
+            Vertex v = g.addV().property("aai-node-type", "logical-link").property("link-name", linkName)
+                    .property("aai-uri", "/network/logical-links/logical-link/" + linkName).next();
 
-            if(i % 1000 == 0){
+            if (i % 1000 == 0) {
                 LOGGER.debug("Committing up to index {}", i);
                 tx.commit();
                 tx = AAIGraph.getInstance().getGraph().newTransaction();
@@ -82,29 +79,29 @@ public class IndexStressTest extends AAISetup {
         tx = AAIGraph.getInstance().getGraph().newTransaction();
         g = tx.traversal();
 
-        int totalLinks= 0;
+        int totalLinks = 0;
         int totalLinksWithNodeType = 0;
         int totalLinksUsingUri = 0;
 
         int index = 0;
         for (String linkName : linkNameSet) {
 
-            if(g.V().has("aai-node-type", "logical-link").has("link-name", linkName).hasNext()){
-               totalLinksWithNodeType++;
+            if (g.V().has("aai-node-type", "logical-link").has("link-name", linkName).hasNext()) {
+                totalLinksWithNodeType++;
             }
 
-            if(g.V().has("link-name", linkName).hasNext()){
+            if (g.V().has("link-name", linkName).hasNext()) {
                 totalLinks++;
             }
 
-            if(g.V().has("aai-uri", "/network/logical-links/logical-link/" + linkName).hasNext()){
+            if (g.V().has("aai-uri", "/network/logical-links/logical-link/" + linkName).hasNext()) {
                 totalLinksUsingUri++;
             }
 
             index++;
 
-            if(index%1000 == 0){
-                LOGGER.debug("Processed {} many queries and has {} many to go", index, (TOTAL_LINKS-index));
+            if (index % 1000 == 0) {
+                LOGGER.debug("Processed {} many queries and has {} many to go", index, (TOTAL_LINKS - index));
                 LOGGER.debug("Total links using linkname found: {}", totalLinks);
                 LOGGER.debug("Total links using nodetype and linkname found: {}", totalLinksWithNodeType);
                 LOGGER.debug("Total links using uri found: {}", totalLinksUsingUri);
@@ -118,11 +115,11 @@ public class IndexStressTest extends AAISetup {
         LOGGER.debug("Total links using uri found: {}", totalLinksUsingUri);
     }
 
-    String generateName(Set<String> uniqueKeys){
+    String generateName(Set<String> uniqueKeys) {
 
-        while(true) {
+        while (true) {
             String data = RandomStringUtils.randomAlphabetic(20);
-            if (!uniqueKeys.contains(data)){
+            if (!uniqueKeys.contains(data)) {
                 uniqueKeys.add(data);
                 return data;
             }
index 6d6ae19..0169939 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.transforms;
 
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+import java.io.IOException;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.aai.PayloadUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.IOException;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
 public class XmlFormatTransformerTest {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(XmlFormatTransformerTest.class);
@@ -37,7 +38,7 @@ public class XmlFormatTransformerTest {
     private XmlFormatTransformer xmlFormatTransformer;
 
     @Before
-    public void setup(){
+    public void setup() {
         this.xmlFormatTransformer = new XmlFormatTransformer();
     }
 
index e11ff26..68f0196 100644 (file)
@@ -27,6 +27,7 @@ import static org.junit.Assert.assertTrue;
 import com.google.common.collect.ImmutableListMultimap;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Multimap;
+
 import java.io.IOException;
 import java.time.LocalDateTime;
 import java.time.Month;
@@ -35,7 +36,9 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
+
 import javax.xml.bind.JAXBException;
+
 import org.eclipse.persistence.dynamic.DynamicEntity;
 import org.eclipse.persistence.jaxb.JAXBContext;
 import org.eclipse.persistence.jaxb.JAXBMarshaller;
index c826df3..cddf953 100644 (file)
 
 package org.onap.aai.aailog.filter;
 
-import org.onap.aai.aailog.logs.ServiceName;
-import org.onap.logging.filter.base.AuditLogContainerFilter;
-import org.onap.logging.filter.base.Constants;
-import org.onap.logging.filter.base.SimpleMap;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.slf4j.MDC;
-
 import javax.annotation.Priority;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.container.ContainerRequestContext;
@@ -34,6 +27,13 @@ import javax.ws.rs.container.PreMatching;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.UriInfo;
 
+import org.onap.aai.aailog.logs.ServiceName;
+import org.onap.logging.filter.base.AuditLogContainerFilter;
+import org.onap.logging.filter.base.Constants;
+import org.onap.logging.filter.base.SimpleMap;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.slf4j.MDC;
+
 @PreMatching
 @Priority(1)
 public class AaiAuditLogContainerFilter extends AuditLogContainerFilter {
@@ -43,7 +43,7 @@ public class AaiAuditLogContainerFilter extends AuditLogContainerFilter {
         String partnerName = headers.get(ONAPLogConstants.Headers.PARTNER_NAME);
         if (partnerName == null || partnerName.isEmpty()) {
             logger.trace("No valid X-ONAP-PartnerName header value. Checking X-FromAppId header for partnerName.");
-            partnerName = headers.get (Constants.HttpHeaders.HEADER_FROM_APP_ID);
+            partnerName = headers.get(Constants.HttpHeaders.HEADER_FROM_APP_ID);
             if (partnerName == null || partnerName.isEmpty()) {
                 logger.trace("No valid X-FromAppId header value. Checking User-Agent header for partnerName.");
                 partnerName = headers.get(HttpHeaders.USER_AGENT);
@@ -59,6 +59,7 @@ public class AaiAuditLogContainerFilter extends AuditLogContainerFilter {
         }
         MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
     }
+
     @Override
     protected void setServiceName(ContainerRequestContext containerRequest) {
         UriInfo uriInfo = containerRequest.getUriInfo();
index 629587d..348aaa2 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.aailog.filter;
 
 import java.io.IOException;
 import java.util.List;
 import java.util.UUID;
+
 import org.onap.aai.aailog.logs.ServiceName;
 import org.onap.logging.filter.base.AbstractMetricLogFilter;
 import org.onap.logging.filter.base.Constants;
@@ -33,11 +35,11 @@ import org.springframework.http.client.ClientHttpRequestExecution;
 import org.springframework.http.client.ClientHttpRequestInterceptor;
 import org.springframework.http.client.ClientHttpResponse;
 
-public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRequest, ClientHttpResponse, HttpHeaders> implements ClientHttpRequestInterceptor {
+public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRequest, ClientHttpResponse, HttpHeaders>
+        implements ClientHttpRequestInterceptor {
     @Override
     public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
-        throws IOException
-    {
+            throws IOException {
         this.setInvocationId(request.getHeaders());
         pre(request, request.getHeaders());
         ClientHttpResponse resp = execution.execute(request, body);
@@ -45,6 +47,7 @@ public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRe
         return resp;
 
     }
+
     protected void pre(HttpRequest request, HttpHeaders requestHeaders) {
         try {
             setupMDC(request);
@@ -54,6 +57,7 @@ public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRe
             logger.warn("Error in RestClientLoggingInterceptor pre", e);
         }
     }
+
     protected void setupHeaders(HttpRequest clientRequest, HttpHeaders requestHeaders) {
         String requestId = extractRequestID(requestHeaders);
         addHeader(requestHeaders, ONAPLogConstants.Headers.REQUEST_ID, requestId);
@@ -69,6 +73,7 @@ public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRe
             addHeader(requestHeaders, ONAPLogConstants.Headers.PARTNER_NAME, pName);
         }
     }
+
     protected String extractRequestID(HttpHeaders requestHeaders) {
         String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
         if (requestId == null || requestId.isEmpty()) {
@@ -80,13 +85,14 @@ public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRe
         }
         return requestId;
     }
+
     public void setInvocationId(HttpHeaders headers) {
         String invocationId = null;
 
         List<String> headerList = headers.get(ONAPLogConstants.Headers.INVOCATION_ID);
         if (headerList != null && (!headerList.isEmpty())) {
             for (String h : headerList) {
-                if ( h != null && (!h.isEmpty()) ) {
+                if (h != null && (!h.isEmpty())) {
                     invocationId = h;
                     break;
                 }
@@ -98,6 +104,7 @@ public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRe
         }
         MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
     }
+
     @Override
     protected void addHeader(HttpHeaders requestHeaders, String headerName, String headerValue) {
         requestHeaders.add(headerName, headerValue);
@@ -106,18 +113,18 @@ public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRe
     protected String getTargetServiceName(HttpRequest request) {
         return (getServiceName(request));
     }
-    protected String getServiceName(HttpRequest request){
+
+    protected String getServiceName(HttpRequest request) {
         String path = request.getURI().getRawPath();
-        return(ServiceName.extractServiceName(path));
+        return (ServiceName.extractServiceName(path));
     }
 
     protected int getHttpStatusCode(ClientHttpResponse response) {
         int result = 0;
-        if (response != null ) {
+        if (response != null) {
             try {
                 result = response.getStatusCode().value();
-            }
-            catch (IOException e) {
+            } catch (IOException e) {
                 logger.warn("Error in RestClientLoggingInterceptor getHttpStatusCode {}", e.getMessage());
             }
         }
@@ -126,11 +133,10 @@ public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRe
 
     protected String getResponseCode(ClientHttpResponse response) {
         String result = "";
-        if (response != null ) {
+        if (response != null) {
             try {
                 result = response.getStatusCode().toString();
-            }
-            catch (IOException e) {
+            } catch (IOException e) {
                 logger.warn("Error in RestClientLoggingInterceptor getResponseCode {}", e.getMessage());
             }
         }
@@ -138,7 +144,7 @@ public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRe
     }
 
     protected String getTargetEntity(HttpRequest request) {
-        //TODO where do we get this from?
+        // TODO where do we get this from?
         return Constants.DefaultValues.UNKNOWN_TARGET_ENTITY;
     }
 }
index 7e332ec..c09023d 100644 (file)
@@ -17,6 +17,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.aailog.filter;
 
 import com.sun.jersey.api.client.ClientHandler;
@@ -24,25 +25,27 @@ import com.sun.jersey.api.client.ClientHandlerException;
 import com.sun.jersey.api.client.ClientRequest;
 import com.sun.jersey.api.client.ClientResponse;
 import com.sun.jersey.api.client.filter.ClientFilter;
-import org.onap.aai.aailog.logs.ServiceName;
-import org.onap.logging.filter.base.Constants;
-import org.onap.logging.filter.base.MDCSetup;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.slf4j.*;
 
-import javax.ws.rs.core.MultivaluedMap;
 import java.time.ZoneOffset;
 import java.time.ZonedDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.UUID;
 
+import javax.ws.rs.core.MultivaluedMap;
+
+import org.onap.aai.aailog.logs.ServiceName;
+import org.onap.logging.filter.base.Constants;
+import org.onap.logging.filter.base.MDCSetup;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.slf4j.*;
+
 public class RestControllerClientLoggingInterceptor extends ClientFilter {
     private static final Logger logger = LoggerFactory.getLogger(RestControllerClientLoggingInterceptor.class);
     private static final Marker INVOKE_RETURN = MarkerFactory.getMarker("INVOKE-RETURN");
     private final MDCSetup mdcSetup;
     private final String partnerName;
 
-    public RestControllerClientLoggingInterceptor () {
+    public RestControllerClientLoggingInterceptor() {
         mdcSetup = new MDCSetup();
         partnerName = getPartnerName();
     }
@@ -62,11 +65,11 @@ public class RestControllerClientLoggingInterceptor extends ClientFilter {
         return clientResponse;
     }
 
-    protected  String getTargetServiceName(ClientRequest clientRequest) {
+    protected String getTargetServiceName(ClientRequest clientRequest) {
         return getServiceName(clientRequest);
     }
 
-    protected  String getServiceName(ClientRequest clientRequest) {
+    protected String getServiceName(ClientRequest clientRequest) {
         String path = clientRequest.getURI().getRawPath();
         return ServiceName.extractServiceName(path);
     }
@@ -75,12 +78,11 @@ public class RestControllerClientLoggingInterceptor extends ClientFilter {
         return response.getStatus();
     }
 
-    protected  String getResponseCode(ClientResponse clientResponse) {
+    protected String getResponseCode(ClientResponse clientResponse) {
         return String.valueOf(clientResponse.getStatus());
     }
 
-
-    protected  String getTargetEntity(ClientRequest ClientRequest) {
+    protected String getTargetEntity(ClientRequest ClientRequest) {
         return Constants.DefaultValues.UNKNOWN_TARGET_ENTITY;
     };
 
@@ -94,12 +96,13 @@ public class RestControllerClientLoggingInterceptor extends ClientFilter {
             logger.warn("Error in RestControllerClientLoggingInterceptor pre", e.getMessage());
         }
     }
+
     public void setInvocationId(ClientRequest clientRequest) {
         String invocationId = null;
         MultivaluedMap<String, Object> requestHeaders = clientRequest.getHeaders();
         Object id = requestHeaders.get(ONAPLogConstants.Headers.INVOCATION_ID);
         if (id != null) {
-            invocationId = (String)id;
+            invocationId = (String) id;
         }
         requestHeaders.remove(ONAPLogConstants.Headers.INVOCATION_ID);
         if (invocationId == null) {
@@ -107,6 +110,7 @@ public class RestControllerClientLoggingInterceptor extends ClientFilter {
         }
         MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
     }
+
     protected void setupHeaders(ClientRequest clientRequest) {
         String requestId = extractRequestID(clientRequest);
         MultivaluedMap<String, Object> requestHeaders = clientRequest.getHeaders();
@@ -118,14 +122,14 @@ public class RestControllerClientLoggingInterceptor extends ClientFilter {
         }
         addHeader(requestHeaders, Constants.HttpHeaders.ECOMP_REQUEST_ID, requestId);
         addHeader(requestHeaders, ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID));
-        if (partnerName != null && (!partnerName.isEmpty())){
+        if (partnerName != null && (!partnerName.isEmpty())) {
             addHeader(requestHeaders, ONAPLogConstants.Headers.PARTNER_NAME, partnerName);
         }
     }
 
     protected void setupMDC(ClientRequest clientRequest) {
         MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP,
-            ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
+                ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
         MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, getTargetServiceName(clientRequest));
         MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
         mdcSetup.setInvocationIdFromMDC();
@@ -151,15 +155,15 @@ public class RestControllerClientLoggingInterceptor extends ClientFilter {
             MultivaluedMap<String, Object> requestHeaders = clientRequest.getHeaders();
             Object requestIdObj = requestHeaders.getFirst(Constants.HttpHeaders.TRANSACTION_ID);
             if (requestIdObj != null) {
-                requestId = (String)requestIdObj;
+                requestId = (String) requestIdObj;
             }
-            if ( requestId == null || requestId.isEmpty() ) {
+            if (requestId == null || requestId.isEmpty()) {
                 requestId = UUID.randomUUID().toString();
             }
             mdcSetup.setLogTimestamp();
             mdcSetup.setElapsedTimeInvokeTimestamp();
             logger.warn("No value found in MDC when checking key {} value will be set to {}",
-                ONAPLogConstants.MDCs.REQUEST_ID, requestId);
+                    ONAPLogConstants.MDCs.REQUEST_ID, requestId);
             MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
         }
         return requestId;
@@ -178,6 +182,7 @@ public class RestControllerClientLoggingInterceptor extends ClientFilter {
             logger.warn("Error in RestControllerClientLoggingInterceptor post", e.getMessage());
         }
     }
+
     protected String getPartnerName() {
         return mdcSetup.getProperty(Constants.Property.PARTNER_NAME);
     }
index 0269943..da5923d 100644 (file)
 
 package org.onap.aai.aailog.logs;
 
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+
 import org.onap.logging.filter.base.AbstractMetricLogFilter;
 import org.onap.logging.filter.base.ONAPComponents;
 import org.onap.logging.ref.slf4j.ONAPLogConstants;
 import org.slf4j.*;
 
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-
 public class AaiDBMetricLog
         extends AbstractMetricLogFilter<DBRequestWrapper, Response, MultivaluedMap<String, Object>> {
 
@@ -35,6 +35,7 @@ public class AaiDBMetricLog
     private final String partnerName;
     private static final Marker INVOKE_RETURN = MarkerFactory.getMarker("INVOKE-RETURN");
     private static final String TARGET_ENTITY = ONAPComponents.AAI.toString() + ".DB";
+
     public AaiDBMetricLog(String subcomponent) {
         partnerName = getPartnerName(subcomponent);
     }
@@ -85,6 +86,7 @@ public class AaiDBMetricLog
             logger.warn("Error in AaiDBMetricLog pre", e);
         }
     }
+
     public void post(DBRequestWrapper request, Response response) {
         try {
             setLogTimestamp();
@@ -98,13 +100,13 @@ public class AaiDBMetricLog
             logger.warn("Error in AaiDBMetricLog post", e);
         }
     }
+
     @Override
     public void setResponseStatusCode(int code) {
         String statusCode;
         if (code / 100 == 2) {
             statusCode = ONAPLogConstants.ResponseStatus.COMPLETE.toString();
-        }
-        else {
+        } else {
             statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString();
             setErrorCode(code);
             setErrorDesc(code);
index ef11f08..60d90a9 100644 (file)
 
 package org.onap.aai.aailog.logs;
 
+import java.util.UUID;
+
 import org.onap.logging.filter.base.MDCSetup;
 import org.onap.logging.ref.slf4j.ONAPLogConstants;
 import org.slf4j.MDC;
 
-import java.util.UUID;
-
 public class AaiDebugLog extends MDCSetup {
 
     public void setupMDC() {
index 35d206f..0d3a573 100644 (file)
 
 package org.onap.aai.aailog.logs;
 
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+
 import org.onap.aai.logging.AaiElsErrorCode;
 import org.onap.logging.filter.base.MDCSetup;
 import org.onap.logging.ref.slf4j.ONAPLogConstants;
 import org.slf4j.*;
 
-import java.time.ZoneOffset;
-import java.time.ZonedDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.regex.PatternSyntaxException;
-
 public class AaiDmaapMetricLog extends MDCSetup {
 
     protected static final Logger logger = LoggerFactory.getLogger(AaiDmaapMetricLog.class);
@@ -37,15 +36,16 @@ public class AaiDmaapMetricLog extends MDCSetup {
     private static final String TARGET_ENTITY = "DMaaP";
 
     public AaiDmaapMetricLog() {
-       if(MDC.get(ONAPLogConstants.MDCs.SERVER_FQDN) == null) {
-               setServerFQDN();
-       }
+        if (MDC.get(ONAPLogConstants.MDCs.SERVER_FQDN) == null) {
+            setServerFQDN();
+        }
     }
+
     public void pre(String targetServiceName, String event, String transactionId, String serviceName) {
 
         try {
             MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP,
-                ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
+                    ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
             setLogTimestamp();
             setElapsedTimeInvokeTimestamp();
             MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, targetServiceName);
@@ -58,7 +58,7 @@ public class AaiDmaapMetricLog extends MDCSetup {
                 MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, serviceName);
             }
             setInvocationIdFromMDC();
-            logger.info(ONAPLogConstants.Markers.INVOKE, event );
+            logger.info(ONAPLogConstants.Markers.INVOKE, event);
 
         } catch (Exception e) {
             logger.warn("Error in AaiDmaapMetricLog pre", e.getMessage());
@@ -82,8 +82,7 @@ public class AaiDmaapMetricLog extends MDCSetup {
         String statusCode;
         if (AaiElsErrorCode.SUCCESS.equals(aaiElsErrorCode)) {
             statusCode = ONAPLogConstants.ResponseStatus.COMPLETE.toString();
-        }
-        else {
+        } else {
             statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString();
             MDC.put(ONAPLogConstants.MDCs.ERROR_CODE, aaiElsErrorCode);
             MDC.put(ONAPLogConstants.MDCs.ERROR_DESC, errorDescription);
index 60460ff..75b602e 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.aailog.logs;
 
+import java.util.UUID;
+
+import javax.ws.rs.core.Response;
+
 import org.onap.logging.filter.base.MDCSetup;
 import org.onap.logging.ref.slf4j.ONAPLogConstants;
 import org.slf4j.Logger;
@@ -29,9 +34,6 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
 
-import javax.ws.rs.core.Response;
-import java.util.UUID;
-
 @Component
 @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
 public class AaiScheduledTaskAuditLog extends MDCSetup {
index 2b78613..19a1199 100644 (file)
@@ -17,7 +17,9 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.aailog.logs;
+
 import java.net.URI;
 
 public interface DBRequestWrapper {
index 97f042f..3f34081 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.aailog.logs;
 
 public class ServiceName {
     /**
      * Extract the service name from a URI path
      * Service name should be the URI path up to two levels down from the version or less
+     * 
      * @param path the URI path
      * @return the service name
      */
-    public static String extractServiceName (String path) {
+    public static String extractServiceName(String path) {
         StringBuilder sBuilder = new StringBuilder();
         String[] parts = path.split("/");
         String part = "";
@@ -38,8 +40,8 @@ public class ServiceName {
                 break;
             }
         }
-        if ((sBuilder.length() > 0) && (sBuilder.charAt(sBuilder.length()-1) == '/')) {
-            sBuilder.deleteCharAt(sBuilder.length()-1);
+        if ((sBuilder.length() > 0) && (sBuilder.charAt(sBuilder.length() - 1) == '/')) {
+            sBuilder.deleteCharAt(sBuilder.length() - 1);
         }
         String serviceName = sBuilder.toString();
         if (serviceName != null && (!serviceName.isEmpty())) {
index fe51ab0..f356275 100644 (file)
 
 package org.onap.aai.domain.restPolicyException;
 
-import javax.xml.bind.annotation.*;
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.xml.bind.annotation.*;
+
 /**
  * <p>
  * Java class for anonymous complex type.
index d7837f9..613c76d 100644 (file)
@@ -54,8 +54,9 @@ public class ObjectFactory {
     public ObjectFactory() {
     }
 
-    /**a
-     *      * Create an instance of {@link Fult }.
+    /**
+     * a
+     * * Create an instance of {@link Fult }.
      *
      * @return the fault
      */
index ae6b6da..16f52ef 100644 (file)
@@ -22,12 +22,13 @@ package org.onap.aai.domain.restPolicyException;
 
 import com.fasterxml.jackson.annotation.*;
 
-import javax.annotation.Generated;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.annotation.Generated;
+
 @JsonInclude(JsonInclude.Include.NON_NULL)
 @Generated("org.jsonschema2pojo")
 @JsonPropertyOrder({"messageId", "text", "variables"})
index e1df451..708a111 100644 (file)
@@ -22,10 +22,11 @@ package org.onap.aai.domain.restPolicyException;
 
 import com.fasterxml.jackson.annotation.*;
 
-import javax.annotation.Generated;
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.annotation.Generated;
+
 @JsonInclude(JsonInclude.Include.NON_NULL)
 @Generated("org.jsonschema2pojo")
 @JsonPropertyOrder({"requestError"})
index 2b04184..717c105 100644 (file)
@@ -22,10 +22,11 @@ package org.onap.aai.domain.restPolicyException;
 
 import com.fasterxml.jackson.annotation.*;
 
-import javax.annotation.Generated;
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.annotation.Generated;
+
 @JsonInclude(JsonInclude.Include.NON_NULL)
 @Generated("org.jsonschema2pojo")
 @JsonPropertyOrder({"policyException"})
index f4a4b47..3685e5a 100644 (file)
 
 package org.onap.aai.domain.restResponseInfo;
 
-import javax.xml.bind.annotation.*;
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.xml.bind.annotation.*;
+
 /**
  * <p>
  * Java class for anonymous complex type.
index 0955845..36a8cb7 100644 (file)
 
 package org.onap.aai.domain.restServiceException;
 
-import javax.xml.bind.annotation.*;
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.xml.bind.annotation.*;
+
 /**
  * <p>
  * Java class for anonymous complex type.
index d812c37..a068763 100644 (file)
@@ -22,10 +22,11 @@ package org.onap.aai.domain.restServiceException;
 
 import com.fasterxml.jackson.annotation.*;
 
-import javax.annotation.Generated;
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.annotation.Generated;
+
 @JsonInclude(JsonInclude.Include.NON_NULL)
 @Generated("org.jsonschema2pojo")
 @JsonPropertyOrder({"requestError"})
index 79fca83..cff5f69 100644 (file)
@@ -22,10 +22,11 @@ package org.onap.aai.domain.restServiceException;
 
 import com.fasterxml.jackson.annotation.*;
 
-import javax.annotation.Generated;
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.annotation.Generated;
+
 @JsonInclude(JsonInclude.Include.NON_NULL)
 @Generated("org.jsonschema2pojo")
 @JsonPropertyOrder({"serviceException"})
index f215bd5..e3339fa 100644 (file)
@@ -22,12 +22,13 @@ package org.onap.aai.domain.restServiceException;
 
 import com.fasterxml.jackson.annotation.*;
 
-import javax.annotation.Generated;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.annotation.Generated;
+
 @JsonInclude(JsonInclude.Include.NON_NULL)
 @Generated("org.jsonschema2pojo")
 @JsonPropertyOrder({"messageId", "text", "variables"})
index 24228e8..320d563 100644 (file)
 
 package org.onap.aai.exceptions;
 
+import java.util.Collection;
+import java.util.LinkedList;
+
 import org.onap.aai.logging.ErrorLogHelper;
 import org.onap.aai.logging.ErrorObject;
 import org.onap.aai.logging.ErrorObjectNotFoundException;
 
-import java.util.Collection;
-import java.util.LinkedList;
-
 public class AAIException extends Exception {
 
     private static final String UPDATE_ERROR_PROPERTIES_BEFORE_USING_THIS_EXCEPTION_CODE =
index 10e4782..bdf5346 100644 (file)
 
 package org.onap.aai.logging;
 
+import static java.util.Base64.getDecoder;
+
 import ch.qos.logback.access.pattern.AccessConverter;
 import ch.qos.logback.access.spi.IAccessEvent;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import java.security.cert.X509Certificate;
 
 import javax.security.auth.x500.X500Principal;
 import javax.servlet.http.HttpServletRequest;
-import java.security.cert.X509Certificate;
 
-import static java.util.Base64.getDecoder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class CNName extends AccessConverter {
     protected static final Logger LOGGER = LoggerFactory.getLogger(CNName.class);
index 1bc33f4..1cdee73 100644 (file)
@@ -69,6 +69,7 @@ public class ErrorLogHelper {
 
     /**
      * Load properties.
+     * 
      * @throws IOException the exception
      * @throws ErrorObjectFormatException
      */
@@ -78,9 +79,10 @@ public class ErrorLogHelper {
         final Properties properties = new Properties();
 
         try (final FileInputStream fis = new FileInputStream(filePath)) {
-            LOGGER.info("Found the error.properties in the following location: {}", AAIConstants.AAI_HOME_ETC_APP_PROPERTIES);
+            LOGGER.info("Found the error.properties in the following location: {}",
+                    AAIConstants.AAI_HOME_ETC_APP_PROPERTIES);
             properties.load(fis);
-        } catch(Exception ex){
+        } catch (Exception ex) {
             LOGGER.info("Unable to find the error.properties from filesystem so using file in jar");
             if (is != null) {
                 properties.load(is);
@@ -572,16 +574,16 @@ public class ErrorLogHelper {
     public static void logException(AAIException e) {
         final ErrorObject errorObject = e.getErrorObject();
         /*
-        String severityCode = errorObject.getSeverityCode(errorObject.getSeverity());
-
-        Severify should be left empty per Logging Specification 2019.11
-        if (!StringUtils.isEmpty(severityCode)) {
-            int sevCode = Integer.parseInt(severityCode);
-            if (sevCode > 0 && sevCode <= 3) {
-                LoggingContext.severity(sevCode);
-            }
-        }
-        */
+         * String severityCode = errorObject.getSeverityCode(errorObject.getSeverity());
+         * 
+         * Severify should be left empty per Logging Specification 2019.11
+         * if (!StringUtils.isEmpty(severityCode)) {
+         * int sevCode = Integer.parseInt(severityCode);
+         * if (sevCode > 0 && sevCode <= 3) {
+         * LoggingContext.severity(sevCode);
+         * }
+         * }
+         */
         String stackTrace = "";
         try {
             stackTrace = LogFormatTools.getStackTop(e);
index 2e849d2..20068e9 100644 (file)
@@ -75,6 +75,7 @@ public class ErrorObject {
 
     /**
      * Instantiates a new error object.
+     * 
      * @param severity the severity
      * @param errorCode the error code
      * @param errorText the error text
@@ -305,6 +306,7 @@ public class ErrorObject {
     public void setDetails(String details) {
         this.details = details == null ? "" : details;
     }
+
     /**
      * Sets the aai els error code.
      *
@@ -313,6 +315,7 @@ public class ErrorObject {
     public void setAaiElsErrorCode(String elsErrorCode) {
         aaiElsErrorCode = elsErrorCode;
     }
+
     /**
      * Gets the aai els error code.
      *
@@ -321,6 +324,7 @@ public class ErrorObject {
     public String getAaiElsErrorCode() {
         return (aaiElsErrorCode);
     }
+
     /**
      * Gets the error code string. This is also the string
      * configured in Nagios to alert on
index 13f324e..97288af 100644 (file)
 
 package org.onap.aai.logging;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+
 public class LoggingContext {
 
     private static final Logger logger = LoggerFactory.getLogger(LoggingContext.class);
@@ -43,7 +43,6 @@ public class LoggingContext {
 
     public static final Map<String, String> responseMap = new HashMap();
 
-
     // Specific Log Event Fields
     public static enum LoggingField {
         START_TIME("startTime"), REQUEST_ID("requestId"), SERVICE_INSTANCE_ID("serviceInstanceId"), SERVER_NAME(
index 9396979..a7a87dc 100644 (file)
@@ -88,7 +88,8 @@ public class AAIApplicationConfig {
             TRUSTSTORE_PASSWORD = retrieveTruststorePassword();
             KEYSTORE_PASSWORD = retrieveKeystorePassword();
         } catch (Exception fnfe) {
-            final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("application.properties");
+            final InputStream is =
+                    Thread.currentThread().getContextClassLoader().getResourceAsStream("application.properties");
             LOGGER.info("Unable to find the application.properties from filesystem so using file in jar");
             if (is != null) {
                 try {
@@ -108,7 +109,7 @@ public class AAIApplicationConfig {
     /**
      * Gets the key value
      *
-     * @param key          the key
+     * @param key the key
      * @param defaultValue the default value
      * @return the string
      */
@@ -165,6 +166,7 @@ public class AAIApplicationConfig {
     public static String getKeystore() throws AAIException {
         return (get(SERVER_SSL_KEYSTORE_PROP_NAME));
     }
+
     /**
      * Gets the PKCS12 keystore path
      *
@@ -174,6 +176,7 @@ public class AAIApplicationConfig {
     public static String getKeystorePkcs12() throws AAIException {
         return (get(SERVER_SSL_KEYSTORE_PKCS12_PROP_NAME));
     }
+
     /**
      * Gets the keystore path
      *
@@ -196,12 +199,12 @@ public class AAIApplicationConfig {
         }
         try {
             certPath = replaceProperties(certPath);
-        }
-        catch (AAIException e) {
+        } catch (AAIException e) {
             return null;
         }
         return (retrieveKeystorePasswordWithCertPath(certPath));
     }
+
     /**
      * Retrieve the keystore password
      *
@@ -236,6 +239,7 @@ public class AAIApplicationConfig {
         }
         return keystorePassword;
     }
+
     /**
      * Get the keystore password
      *
@@ -244,6 +248,7 @@ public class AAIApplicationConfig {
     public static String getKeystorePassword() {
         return (KEYSTORE_PASSWORD);
     }
+
     /**
      * Gets the truststore password
      *
@@ -258,7 +263,6 @@ public class AAIApplicationConfig {
             passphrasesFile = new File(certPath + PASSPHRASSES_FILENAME);
             passphrasesStream = new FileInputStream(passphrasesFile);
 
-
             Properties passphrasesProps = new Properties();
             passphrasesProps.load(passphrasesStream);
             truststorePassword = passphrasesProps.getProperty(TRUSTSTORE_PASSWORD_PROP_NAME);
@@ -281,6 +285,7 @@ public class AAIApplicationConfig {
 
         return truststorePassword;
     }
+
     /**
      * Gets the truststore password
      *
@@ -293,8 +298,7 @@ public class AAIApplicationConfig {
         }
         try {
             certPath = replaceProperties(certPath);
-        }
-        catch (AAIException e) {
+        } catch (AAIException e) {
             return null;
         }
         return (retrieveTruststorePasswordWithCertPath(certPath));
@@ -352,17 +356,19 @@ public class AAIApplicationConfig {
     private static String replaceProperties(String originalValue) throws AAIException {
         final Pattern p = Pattern.compile(PROPERTY_REGEX);
         Matcher m = p.matcher(originalValue);
-        /*if (!m.matches()) {
-            return originalValue;
-        }*/
+        /*
+         * if (!m.matches()) {
+         * return originalValue;
+         * }
+         */
         StringBuffer sb = new StringBuffer();
-        while(m.find()) {
+        while (m.find()) {
             String text = m.group(1);
             String replacement = get(text);
             m.appendReplacement(sb, replacement);
         }
         m.appendTail(sb);
-        return(sb.toString());
+        return (sb.toString());
     }
 
     public static Properties retrieveKeystoreProps() throws AAIException {
@@ -374,7 +380,7 @@ public class AAIApplicationConfig {
         String keystorePassword = System.getProperty(KEYSTORE_PASSWORD_NAME);
         String certLocation = System.getProperty(SERVER_CERTS_LOCATION_PROP_NAME);
 
-        if (truststorePath == null || truststorePath.isEmpty()){
+        if (truststorePath == null || truststorePath.isEmpty()) {
             truststorePath = AAIApplicationConfig.getTruststore();
         }
         if (truststorePath != null) {
@@ -383,8 +389,7 @@ public class AAIApplicationConfig {
         if (truststorePassword == null || truststorePassword.isEmpty()) {
             if (certLocation != null && (!certLocation.isEmpty())) {
                 truststorePassword = AAIApplicationConfig.retrieveTruststorePasswordWithCertPath(certLocation);
-            }
-            else {
+            } else {
                 truststorePassword = AAIApplicationConfig.getTruststorePassword();
             }
 
@@ -392,23 +397,22 @@ public class AAIApplicationConfig {
         if (truststorePassword != null) {
             props.setProperty(TRUSTSTORE_PASSWORD_NAME, truststorePassword);
         }
-        if (keystorePath == null || keystorePath.isEmpty()){
+        if (keystorePath == null || keystorePath.isEmpty()) {
             keystorePath = AAIApplicationConfig.getKeystorePkcs12();
         }
         if (keystorePath != null) {
             props.setProperty(SERVER_SSL_KEYSTORE_PKCS12_PROP_NAME, keystorePath);
         }
-        if (keystorePassword == null || keystorePassword.isEmpty()){
+        if (keystorePassword == null || keystorePassword.isEmpty()) {
             if (certLocation != null && (!certLocation.isEmpty())) {
                 keystorePassword = AAIApplicationConfig.retrieveKeystorePasswordWithCertPath(certLocation);
-            }
-            else {
+            } else {
                 keystorePassword = AAIApplicationConfig.getKeystorePassword();
             }
         }
         if (keystorePassword != null) {
             props.setProperty(KEYSTORE_PASSWORD_NAME, keystorePassword);
         }
-        return(props);
+        return (props);
     }
 }
index 2428f1e..106640d 100644 (file)
 
 package org.onap.aai.util;
 
-import org.eclipse.jetty.util.security.Password;
-import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.logging.ErrorLogHelper;
-
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.InetAddress;
 import java.util.Properties;
+
+import org.eclipse.jetty.util.security.Password;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.logging.ErrorLogHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -90,7 +90,8 @@ public class AAIConfig {
             propsInitialized = true;
             serverProps = newServerProps;
         } catch (Exception fnfe) {
-            final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("aaiconfig.properties");
+            final InputStream is =
+                    Thread.currentThread().getContextClassLoader().getResourceAsStream("aaiconfig.properties");
             LOGGER.info("Unable to find the aaiconfig.properties from filesystem so using file in jar");
             if (is != null) {
                 try {
index faacc52..e79bfec 100644 (file)
@@ -17,6 +17,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.util;
 
 /**
@@ -31,11 +32,11 @@ package org.onap.aai.util;
 // TODO - Find an better name for this interface name
 public interface AAIConfigProxy {
 
-    default String get(String key, String defaultValue){
+    default String get(String key, String defaultValue) {
         return AAIConfig.get(key, defaultValue);
     }
 
-    default int getInt(String key, String defaultValue){
+    default int getInt(String key, String defaultValue) {
         return AAIConfig.getInt(key, defaultValue);
     }
 }
index 95f9c1b..1708b8c 100644 (file)
@@ -27,7 +27,7 @@ package org.onap.aai.util;
  * as these keys are generated in a couple places, I made a class to contain that logic
  */
 public class HbaseSaltPrefixer {
-     // the number of hbase region servers per cluster
+    // the number of hbase region servers per cluster
     private static int NUM_REGION_BUCKETS = 3;
 
     private static class SingletonHolder {
index d856999..9373eb7 100644 (file)
@@ -27,6 +27,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializationFeature;
 import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
+
 import org.onap.aai.exceptions.AAIException;
 
 public class MapperUtil {
index ce2f448..222b98c 100644 (file)
@@ -21,6 +21,7 @@
 package org.onap.logging.filter.base;
 
 import javax.servlet.http.HttpServletRequest;
+
 import org.onap.logging.ref.slf4j.ONAPLogConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index ab1daab..dea496a 100644 (file)
@@ -24,6 +24,7 @@ import java.time.ZoneOffset;
 import java.time.ZonedDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.UUID;
+
 import org.onap.logging.ref.slf4j.ONAPLogConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index 28495c8..7f8017f 100644 (file)
@@ -21,6 +21,7 @@
 package org.onap.logging.filter.base;
 
 import java.util.Enumeration;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.ws.rs.core.HttpHeaders;
index a019485..530d53b 100644 (file)
 package org.onap.logging.filter.base;
 
 import java.io.IOException;
+
 import javax.annotation.Priority;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.container.*;
 import javax.ws.rs.core.Context;
-import javax.ws.rs.ext.Provider;
 import javax.ws.rs.ext.Providers;
+
 import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.slf4j.MDC;
 
 @Priority(1)
index a8f5eae..c2d8a96 100644 (file)
@@ -23,6 +23,7 @@
 package org.onap.logging.filter.base;
 
 import java.io.IOException;
+
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
@@ -31,6 +32,7 @@ import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
 import org.onap.logging.ref.slf4j.ONAPLogConstants;
 import org.slf4j.MDC;
 
index 369a9f2..9b2503b 100644 (file)
@@ -27,9 +27,11 @@ import java.time.ZonedDateTime;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.ChronoUnit;
 import java.util.UUID;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
+
 import org.onap.logging.ref.slf4j.ONAPLogConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -86,7 +88,7 @@ public class MDCSetup {
             return requestId;
         }
         if (requestId != null && !requestId.isEmpty()) {
-            //invalid
+            // invalid
             return UUID.randomUUID().toString();
         }
         logger.trace("No valid X-ONAP-RequestID header value. Checking X-RequestID header for requestId.");
@@ -95,7 +97,7 @@ public class MDCSetup {
             return requestId;
         }
         if (requestId != null && !requestId.isEmpty()) {
-            //invalid
+            // invalid
             return UUID.randomUUID().toString();
         }
         logger.trace("No valid X-RequestID header value. Checking X-TransactionID header for requestId.");
@@ -104,7 +106,7 @@ public class MDCSetup {
             return requestId;
         }
         if (requestId != null && !requestId.isEmpty()) {
-            //invalid
+            // invalid
             return UUID.randomUUID().toString();
         }
         logger.trace("No valid X-TransactionID header value. Checking X-ECOMP-RequestID header for requestId.");
@@ -113,11 +115,12 @@ public class MDCSetup {
             return requestId;
         }
         if (requestId != null && !requestId.isEmpty()) {
-            //invalid
+            // invalid
             return UUID.randomUUID().toString();
         }
         return requestId;
     }
+
     protected boolean isValidUUID(String transId) {
         try {
             UUID.fromString(transId);
@@ -126,6 +129,7 @@ public class MDCSetup {
         }
         return true;
     }
+
     public void setInvocationId(SimpleMap headers) {
         String invocationId = headers.get(ONAPLogConstants.Headers.INVOCATION_ID);
         if (invocationId == null || invocationId.isEmpty())
@@ -200,7 +204,7 @@ public class MDCSetup {
     }
 
     public void clearClientMDCs() {
-        //MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID);
+        // MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID);
         MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
         MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE);
         MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE);
@@ -230,7 +234,7 @@ public class MDCSetup {
             logger.info("System property was null or empty. Checking environment variable for: {}", property);
             propertyValue = System.getenv(property);
             if (propertyValue == null || propertyValue.isEmpty()) {
-                logger.info("Environment variable: {} was null or empty", property );
+                logger.info("Environment variable: {} was null or empty", property);
             }
         }
         return propertyValue;
index da4d982..986d189 100644 (file)
@@ -25,10 +25,8 @@ 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.container.PreMatching;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.ext.Provider;
 import javax.ws.rs.ext.Providers;
 
 @Priority(0)
index 06fbba9..5465b7c 100644 (file)
@@ -24,35 +24,7 @@ import java.util.EnumSet;
 import java.util.Set;
 
 public enum ONAPComponents implements ONAPComponentsList {
-    OPENSTACK_ADAPTER,
-    BPMN,
-    GRM,
-    AAI,
-    DMAAP,
-    POLICY,
-    CATALOG_DB,
-    REQUEST_DB,
-    SNIRO,
-    SDC,
-    EXTERNAL,
-    VNF_ADAPTER,
-    SDNC_ADAPTER,
-    MULTICLOUD,
-    CLAMP,
-    PORTAL,
-    VID,
-    APPC,
-    DCAE,
-    HOLMES,
-    SDNC,
-    SO,
-    VFC,
-    ESR,
-    DBC,
-    DR,
-    MR,
-    OPTF;
-
+    OPENSTACK_ADAPTER, BPMN, GRM, AAI, DMAAP, POLICY, CATALOG_DB, REQUEST_DB, SNIRO, SDC, EXTERNAL, VNF_ADAPTER, SDNC_ADAPTER, MULTICLOUD, CLAMP, PORTAL, VID, APPC, DCAE, HOLMES, SDNC, SO, VFC, ESR, DBC, DR, MR, OPTF;
 
     public static Set<ONAPComponents> getSOInternalComponents() {
         return EnumSet.of(OPENSTACK_ADAPTER, BPMN, CATALOG_DB, REQUEST_DB, VNF_ADAPTER, SDNC_ADAPTER);
index 88c95aa..1908d45 100644 (file)
@@ -28,6 +28,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
+
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.client.ClientRequestContext;
 import javax.ws.rs.client.ClientRequestFilter;
@@ -38,6 +39,7 @@ import javax.ws.rs.core.MultivaluedHashMap;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.WriterInterceptor;
 import javax.ws.rs.ext.WriterInterceptorContext;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
index fa8533a..cae4ebd 100644 (file)
@@ -30,6 +30,7 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.PrintWriter;
 import java.util.zip.GZIPInputStream;
+
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
index aafc74d..4670f50 100644 (file)
@@ -37,48 +37,56 @@ import org.slf4j.event.Level;
  * Extensible adapter for cheaply meeting ONAP logging obligations using
  * an SLF4J facade.
  *
- * <p>This can be used with any SLF4J-compatible logging provider, with
- * appropriate provider configuration.</p>
+ * <p>
+ * This can be used with any SLF4J-compatible logging provider, with
+ * appropriate provider configuration.
+ * </p>
  *
- * <p>The basics are that:
+ * <p>
+ * The basics are that:
  * <ul>
- *     <li>{@link #entering} sets all MDCs.</li>
- *     <li>{@link #exiting} unsets all MDCs *and* logs response information.</li>
- *     <li>{@link #invoke} logs and returns a UUID to passed during invocation,
- *     and optionally sets these for you on your downstream request by way of
- *     an adapter.</li>
- *     <li>Call {@link #getServiceDescriptor()} and its setters to set service-related MDCs.</li>
- *     <li>Call {@link #getResponseDescriptor()} and its setters to set response-related MDCs.</li>
+ * <li>{@link #entering} sets all MDCs.</li>
+ * <li>{@link #exiting} unsets all MDCs *and* logs response information.</li>
+ * <li>{@link #invoke} logs and returns a UUID to passed during invocation,
+ * and optionally sets these for you on your downstream request by way of
+ * an adapter.</li>
+ * <li>Call {@link #getServiceDescriptor()} and its setters to set service-related MDCs.</li>
+ * <li>Call {@link #getResponseDescriptor()} and its setters to set response-related MDCs.</li>
  * </ul>
  * </p>
  *
- * <p>Minimal usage is:
+ * <p>
+ * Minimal usage is:
  * <ol>
- *     <li>#entering(RequestAdapter)</li>
- *     <li>#invoke, #invoke, ...</li>
- *     <li>#getResponse + setters (or #setResponse)</li>
- *     <li>#exiting</li>
+ * <li>#entering(RequestAdapter)</li>
+ * <li>#invoke, #invoke, ...</li>
+ * <li>#getResponse + setters (or #setResponse)</li>
+ * <li>#exiting</li>
  * </ol>
  * </p>
  *
- * <p> ... if you're happy for service information to be automatically derived as follows:
+ * <p>
+ * ... if you're happy for service information to be automatically derived as follows:
  * <ul>
- *     <li><tt>ServiceName</tt> - from <tt>HttpServletRequest#getRequestURI()</tt></li>
- *     <li><tt>InstanceUUID</tt> - classloader-scope UUID.</li>
+ * <li><tt>ServiceName</tt> - from <tt>HttpServletRequest#getRequestURI()</tt></li>
+ * <li><tt>InstanceUUID</tt> - classloader-scope UUID.</li>
  * </ul>
  * </p>
  *
- * <p>... and if those defaults don't suit, then you can override using properties on
+ * <p>
+ * ... and if those defaults don't suit, then you can override using properties on
  * {@link #getServiceDescriptor()}, or by injecting your own adapter using
  * {@link #setServiceDescriptor(ServiceDescriptor)}, or by overriding
- * a <tt>protected</tt> methods like{@link #setEnteringMDCs}.</p>
+ * a <tt>protected</tt> methods like{@link #setEnteringMDCs}.
+ * </p>
  *
- * <p>For everything else:
+ * <p>
+ * For everything else:
  * <ul>
- *     <li>The underlying SLF4J {@link Logger} can be retrieved using {@link #unwrap}.
- *     Use this or create your own using the usual SLF4J factor.</li>
- *     <li>Set whatever MDCs you like.</li>
- *     <li>Log whatever else you like.</li>
+ * <li>The underlying SLF4J {@link Logger} can be retrieved using {@link #unwrap}.
+ * Use this or create your own using the usual SLF4J factor.</li>
+ * <li>Set whatever MDCs you like.</li>
+ * <li>Log whatever else you like.</li>
  * </ul>
  * </p>
  */
@@ -178,8 +186,7 @@ public class ONAPLogAdapter {
         try {
             this.mResponseDescriptor.setMDCs();
             this.mLogger.info(ONAPLogConstants.Markers.EXIT, EMPTY_MESSAGE);
-        }
-        finally {
+        } finally {
             MDC.clear();
         }
         return this;
@@ -188,8 +195,10 @@ public class ONAPLogAdapter {
     /**
      * Report pending invocation with <tt>INVOKE</tt> marker.
      *
-     * <p>If you call this variant, then YOU are assuming responsibility for
-     * setting the requisite ONAP headers.</p>
+     * <p>
+     * If you call this variant, then YOU are assuming responsibility for
+     * setting the requisite ONAP headers.
+     * </p>
      *
      * @param sync whether synchronous.
      * @return invocation ID to be passed with invocation.
@@ -218,8 +227,7 @@ public class ONAPLogAdapter {
      * @param sync whether synchronous, nullable.
      * @return invocation ID to be passed with invocation.
      */
-    public UUID invoke(final RequestBuilder builder,
-                       final ONAPLogConstants.InvocationMode sync) {
+    public UUID invoke(final RequestBuilder builder, final ONAPLogConstants.InvocationMode sync) {
 
         // Sync can be defaulted. Builder cannot.
 
@@ -233,8 +241,7 @@ public class ONAPLogAdapter {
 
         builder.setHeader(ONAPLogConstants.Headers.REQUEST_ID,
                 defaultToEmpty(MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)));
-        builder.setHeader(ONAPLogConstants.Headers.INVOCATION_ID,
-                defaultToEmpty(invocationID));
+        builder.setHeader(ONAPLogConstants.Headers.INVOCATION_ID, defaultToEmpty(invocationID));
         builder.setHeader(ONAPLogConstants.Headers.PARTNER_NAME,
                 defaultToEmpty(MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)));
 
@@ -245,15 +252,16 @@ public class ONAPLogAdapter {
      * Report vanilla <tt>INVOKE</tt> marker.
      *
      * @param builder builder for downstream requests, if you want the
-     *                standard ONAP headers to be added automatically.
+     *        standard ONAP headers to be added automatically.
      * @return invocation ID to be passed with invocation.
      */
     public UUID invoke(final RequestBuilder builder) {
-        return this.invoke(builder, (ONAPLogConstants.InvocationMode)null);
+        return this.invoke(builder, (ONAPLogConstants.InvocationMode) null);
     }
 
     /**
      * Get descriptor, for overriding service details.
+     * 
      * @return non-null descriptor.
      */
     public ServiceDescriptor getServiceDescriptor() {
@@ -262,6 +270,7 @@ public class ONAPLogAdapter {
 
     /**
      * Override {@link ServiceDescriptor}.
+     * 
      * @param d non-null override.
      * @return this.
      */
@@ -272,6 +281,7 @@ public class ONAPLogAdapter {
 
     /**
      * Get descriptor, for setting response details.
+     * 
      * @return non-null descriptor.
      */
     public ResponseDescriptor getResponseDescriptor() {
@@ -280,6 +290,7 @@ public class ONAPLogAdapter {
 
     /**
      * Override {@link ResponseDescriptor}.
+     * 
      * @param d non-null override.
      * @return this.
      */
@@ -297,9 +308,11 @@ public class ONAPLogAdapter {
     /**
      * Set MDCs that persist for the duration of an invocation.
      *
-     * <p>It would be better to roll this into {@link #entering}, like
+     * <p>
+     * It would be better to roll this into {@link #entering}, like
      * with {@link #exiting}. Then it would be easier to do, but it
-     * would mean more work. </p>
+     * would mean more work.
+     * </p>
      *
      * @param request incoming HTTP request.
      * @return this.
@@ -318,8 +331,7 @@ public class ONAPLogAdapter {
         // ServiceDescriptor to add them.
 
         MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP,
-                ZonedDateTime.now(ZoneOffset.UTC)
-                        .format(DateTimeFormatter.ISO_INSTANT));
+                ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
         MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestID);
         MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationID);
         MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
@@ -333,8 +345,8 @@ public class ONAPLogAdapter {
         // Default the service name to the requestURI, in the event that
         // no value has been provided.
 
-        if (MDC.get(ONAPLogConstants.MDCs.SERVICE_NAME) == null ||
-                MDC.get(ONAPLogConstants.MDCs.SERVICE_NAME).equalsIgnoreCase(EMPTY_MESSAGE)) {
+        if (MDC.get(ONAPLogConstants.MDCs.SERVICE_NAME) == null
+                || MDC.get(ONAPLogConstants.MDCs.SERVICE_NAME).equalsIgnoreCase(EMPTY_MESSAGE)) {
             MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI());
         }
 
@@ -390,7 +402,9 @@ public class ONAPLogAdapter {
     /**
      * Extensible descriptor for reporting service details.
      *
-     * <p>In most cases extension isn't required. </p>
+     * <p>
+     * In most cases extension isn't required.
+     * </p>
      */
     public static class ServiceDescriptor {
 
@@ -402,6 +416,7 @@ public class ONAPLogAdapter {
 
         /**
          * Set name.
+         * 
          * @param name <tt>ServiceName</tt>.
          * @return this.
          */
@@ -412,6 +427,7 @@ public class ONAPLogAdapter {
 
         /**
          * Set name.
+         * 
          * @param uuid <tt>InstanceUUID</tt>.
          * @return this.
          */
@@ -507,11 +523,15 @@ public class ONAPLogAdapter {
     /**
      * Adapter for reading information from an incoming HTTP request.
      *
-     * <p>Incoming is generally easy, because in most cases you'll be able to
-     * get your hands on the <tt>HttpServletRequest</tt>.</p>
+     * <p>
+     * Incoming is generally easy, because in most cases you'll be able to
+     * get your hands on the <tt>HttpServletRequest</tt>.
+     * </p>
      *
-     * <p>Perhaps should be generalized to refer to constants instead of
-     * requiring the implementation of specific methods.</p>
+     * <p>
+     * Perhaps should be generalized to refer to constants instead of
+     * requiring the implementation of specific methods.
+     * </p>
      *
      * @param <T> type, for chaining.
      */
@@ -519,6 +539,7 @@ public class ONAPLogAdapter {
 
         /**
          * Get header by name.
+         * 
          * @param name header name.
          * @return header value, or null.
          */
@@ -526,18 +547,21 @@ public class ONAPLogAdapter {
 
         /**
          * Get client address.
+         * 
          * @return address, if available.
          */
         String getClientAddress();
 
         /**
          * Get server address.
+         * 
          * @return address, if available.
          */
         String getServerAddress();
 
         /**
          * Get default service name, from service URI.
+         * 
          * @return service name default.
          */
         String getRequestURI();
@@ -554,6 +578,7 @@ public class ONAPLogAdapter {
 
         /**
          * Construct adapter for HTTP request.
+         * 
          * @param request to be wrapped;
          */
         public HttpServletRequestAdapter(final HttpServletRequest request) {
@@ -598,8 +623,10 @@ public class ONAPLogAdapter {
      * vary a lot from caller to caller, since they each get to choose their
      * own REST (or HTTP, or whatever) client APIs.
      *
-     * <p>No default implementation, because there's no HTTP client that's
-     * sufficiently ubiquitous to warrant incurring a mandatory dependency.</p>
+     * <p>
+     * No default implementation, because there's no HTTP client that's
+     * sufficiently ubiquitous to warrant incurring a mandatory dependency.
+     * </p>
      *
      * @param <T> type, for chaining.
      */
@@ -607,6 +634,7 @@ public class ONAPLogAdapter {
 
         /**
          * Set HTTP header.
+         * 
          * @param name header name.
          * @param value header value.
          * @return this.
index 77ca084..027a99d 100644 (file)
@@ -27,7 +27,9 @@ import org.slf4j.MarkerFactory;
 /**
  * Constants for standard ONAP headers, MDCs, etc.
  *
- * <p>See <tt>package-info.java</tt>.</p>
+ * <p>
+ * See <tt>package-info.java</tt>.
+ * </p>
  */
 public final class ONAPLogConstants {
 
@@ -57,7 +59,7 @@ public final class ONAPLogConstants {
 
         /** Marker reporting invocation. */
         public static final Marker INVOKE = MarkerFactory.getMarker("INVOKE");
-        
+
         /** Marker reporting invocation return. */
         public static final Marker INVOKE_RETURN = MarkerFactory.getMarker("INVOKE_RETURN");
 
@@ -75,6 +77,7 @@ public final class ONAPLogConstants {
 
         /**
          * Build nested, detached marker.
+         * 
          * @param m1 top token.
          * @param m2 sub-token.
          * @return detached Marker.
@@ -114,7 +117,7 @@ public final class ONAPLogConstants {
 
         /** MDC recording target service. */
         public static final String TARGET_SERVICE_NAME = "TargetServiceName";
-        
+
         /** MDC recording target entity. */
         public static final String TARGET_ENTITY = "TargetEntity";
 
@@ -124,7 +127,7 @@ public final class ONAPLogConstants {
         /** MDC recording current service instance id. */
         public static final String SERVICE_INSTANCE_ID = "ServiceInstanceID";
 
-        /** MDC recording current  instance id. */
+        /** MDC recording current instance id. */
         public static final String INSTANCE_UUID = "InstanceID";
 
         // Network. ////////////////////////////////////////////////////////////
@@ -148,14 +151,21 @@ public final class ONAPLogConstants {
          * MDC recording timestamp at the start of the current request,
          * with the same scope as {@link #REQUEST_ID}.
          *
-         * <p>Open issues:
+         * <p>
+         * Open issues:
+         * <ul>
          * <ul>
-         *     <ul>Easily confused with {@link #INVOKE_TIMESTAMP}.</ul>
-         *     <ul>No mechanism for propagation between components, e.g. via HTTP headers.</ul>
-         *     <ul>Whatever mechanism we define, it's going to be costly.</ul>
+         * Easily confused with {@link #INVOKE_TIMESTAMP}.
+         * </ul>
+         * <ul>
+         * No mechanism for propagation between components, e.g. via HTTP headers.
+         * </ul>
+         * <ul>
+         * Whatever mechanism we define, it's going to be costly.
+         * </ul>
          * </ul>
          * </p>
-         * */
+         */
         public static final String ENTRY_TIMESTAMP = "EntryTimestamp";
 
         /** MDC recording timestamp at the start of the current invocation. */
@@ -164,7 +174,7 @@ public final class ONAPLogConstants {
         /** MDC recording elapsed time. */
         public static final String ELAPSED_TIME = "ElapsedTime";
 
-        /** MDC recording log timestamp. */    
+        /** MDC recording log timestamp. */
         public static final String LOG_TIMESTAMP = "LogTimestamp";
 
         // Outcomes. ///////////////////////////////////////////////////////////
@@ -182,8 +192,8 @@ public final class ONAPLogConstants {
         public static final String RESPONSE_STATUS_CODE = "StatusCode";
 
         /** MDC recording error code. */
-        public static final String ERROR_CODE = "ErrorCode";       
-       
+        public static final String ERROR_CODE = "ErrorCode";
+
         /** MDC recording error description. */
         public static final String ERROR_DESC = "ErrorDesc";
 
@@ -235,7 +245,7 @@ public final class ONAPLogConstants {
 
         /** Not. */
         ERROR,
-        
+
         /** In Progress. */
         INPROGRESS
     }
index d9a6247..561cc94 100644 (file)
@@ -9,7 +9,7 @@
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *    http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
 package org.onap.logging.ref.slf4j;
 
 /**
- * <p>Code in here has potential application outside this reference
+ * <p>
+ * Code in here has potential application outside this reference
  * example, and accordingly:
  * <ul>
- *     <li>Packaged in <tt>common</tt>.</li>
- *     <li>Has minimal dependencies.</li>
+ * <li>Packaged in <tt>common</tt>.</li>
+ * <li>Has minimal dependencies.</li>
  * </ul>
  * </p>
- */
\ No newline at end of file
+ */
index 5f23e66..246586d 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.aailog.filter;
 
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+
+import java.net.URI;
+
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerResponseContext;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.UriInfo;
+
 import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -30,16 +42,6 @@ import org.onap.logging.filter.base.Constants;
 import org.onap.logging.ref.slf4j.ONAPLogConstants;
 import org.slf4j.MDC;
 
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerResponseContext;
-import javax.ws.rs.core.MultivaluedHashMap;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.UriInfo;
-import java.net.URI;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.when;
-
 @RunWith(MockitoJUnitRunner.class)
 public class AaiAuditLogContainerFilterTest {
     @Mock
@@ -59,6 +61,7 @@ public class AaiAuditLogContainerFilterTest {
     public void tearDown() {
         MDC.clear();
     }
+
     @Test
     public void partnerAndServiceNameValueTest() throws java.net.URISyntaxException {
 
@@ -69,8 +72,7 @@ public class AaiAuditLogContainerFilterTest {
         URI uri = null;
         try {
             uri = new URI("https://localhost:9999/onap/aai/network/logical-link");
-        }
-        catch (java.net.URISyntaxException e) {
+        } catch (java.net.URISyntaxException e) {
             throw e;
         }
         when(uriInfo.getAbsolutePath()).thenReturn(uri);
@@ -82,4 +84,3 @@ public class AaiAuditLogContainerFilterTest {
     }
 
 }
-
index 601a13b..f8d23f3 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.aailog.filter;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.doReturn;
+
+import java.net.InetAddress;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.UnknownHostException;
+
 import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -32,75 +42,66 @@ import org.slf4j.MDC;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpRequest;
 
-import java.net.InetAddress;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.UnknownHostException;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Mockito.doReturn;
-
 @RunWith(MockitoJUnitRunner.class)
 public class RestClientLoggingInterceptorTest {
 
-        @Mock
-        private HttpRequest httpRequest;
+    @Mock
+    private HttpRequest httpRequest;
 
-        @Spy
-        @InjectMocks
-        private RestClientLoggingInterceptor restClientLoggingInterceptor;
+    @Spy
+    @InjectMocks
+    private RestClientLoggingInterceptor restClientLoggingInterceptor;
 
-        @After
-        public void tearDown() {
-            MDC.clear();
-        }
+    @After
+    public void tearDown() {
+        MDC.clear();
+    }
 
-        @Test
-        public void setupHeadersTest() {
-            String transId="37b3ab2a-e57e-4fe8-8d8f-eee3019efce6";
-            HttpHeaders headers = new HttpHeaders();
-            headers.add(Constants.HttpHeaders.TRANSACTION_ID, transId);
-            restClientLoggingInterceptor.setupHeaders(httpRequest, headers);
+    @Test
+    public void setupHeadersTest() {
+        String transId = "37b3ab2a-e57e-4fe8-8d8f-eee3019efce6";
+        HttpHeaders headers = new HttpHeaders();
+        headers.add(Constants.HttpHeaders.TRANSACTION_ID, transId);
+        restClientLoggingInterceptor.setupHeaders(httpRequest, headers);
 
-            assertEquals(transId, headers.getFirst(Constants.HttpHeaders.TRANSACTION_ID));
-            assertEquals(transId, headers.getFirst(Constants.HttpHeaders.ECOMP_REQUEST_ID));
-            assertEquals(transId, headers.getFirst(ONAPLogConstants.Headers.REQUEST_ID));
-            assertEquals(transId, headers.getFirst(Constants.HttpHeaders.HEADER_REQUEST_ID));
-        }
+        assertEquals(transId, headers.getFirst(Constants.HttpHeaders.TRANSACTION_ID));
+        assertEquals(transId, headers.getFirst(Constants.HttpHeaders.ECOMP_REQUEST_ID));
+        assertEquals(transId, headers.getFirst(ONAPLogConstants.Headers.REQUEST_ID));
+        assertEquals(transId, headers.getFirst(Constants.HttpHeaders.HEADER_REQUEST_ID));
+    }
 
-        @Test
-        public void getServiceNameTest() throws URISyntaxException {
-            URI uri = null;
-            try {
-                uri = new URI("https://localhost:9999/aai/v1/cloud-infrastructure/complexes/complex/complex-1");
-            } catch (URISyntaxException e) {
-                throw e;
-            }
-            doReturn(uri).when(httpRequest).getURI();
-            String serviceName = restClientLoggingInterceptor.getServiceName(httpRequest);
-
-            assertEquals("/aai/v1/cloud-infrastructure/complexes", serviceName);
+    @Test
+    public void getServiceNameTest() throws URISyntaxException {
+        URI uri = null;
+        try {
+            uri = new URI("https://localhost:9999/aai/v1/cloud-infrastructure/complexes/complex/complex-1");
+        } catch (URISyntaxException e) {
+            throw e;
         }
+        doReturn(uri).when(httpRequest).getURI();
+        String serviceName = restClientLoggingInterceptor.getServiceName(httpRequest);
+
+        assertEquals("/aai/v1/cloud-infrastructure/complexes", serviceName);
+    }
 
-       @Test
-        public void setupMDCTest() throws URISyntaxException {
-           URI uri = new URI("https://localhost:9999/aai/v1/cloud-infrastructure/complexes/complex/complex-1");
-           doReturn(uri).when(httpRequest).getURI();
-           HttpHeaders headers = new HttpHeaders();
-           restClientLoggingInterceptor.pre(httpRequest, headers);
-           assertEquals("/aai/v1/cloud-infrastructure/complexes", MDC.get(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME) );
-           assertEquals("INPROGRESS", MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
-           String serverFQDN = "";
-           InetAddress addr = null;
-           try {
-               addr = InetAddress.getLocalHost();
-               serverFQDN = addr.getCanonicalHostName();
+    @Test
+    public void setupMDCTest() throws URISyntaxException {
+        URI uri = new URI("https://localhost:9999/aai/v1/cloud-infrastructure/complexes/complex/complex-1");
+        doReturn(uri).when(httpRequest).getURI();
+        HttpHeaders headers = new HttpHeaders();
+        restClientLoggingInterceptor.pre(httpRequest, headers);
+        assertEquals("/aai/v1/cloud-infrastructure/complexes", MDC.get(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME));
+        assertEquals("INPROGRESS", MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+        String serverFQDN = "";
+        InetAddress addr = null;
+        try {
+            addr = InetAddress.getLocalHost();
+            serverFQDN = addr.getCanonicalHostName();
 
-           } catch (UnknownHostException e) {
-               serverFQDN = "";
-           }
-           assertEquals(serverFQDN, MDC.get(ONAPLogConstants.MDCs.SERVER_FQDN));
-           assertNotNull(headers.getFirst(ONAPLogConstants.Headers.INVOCATION_ID));
+        } catch (UnknownHostException e) {
+            serverFQDN = "";
         }
+        assertEquals(serverFQDN, MDC.get(ONAPLogConstants.MDCs.SERVER_FQDN));
+        assertNotNull(headers.getFirst(ONAPLogConstants.Headers.INVOCATION_ID));
+    }
 }
index 48cb3ef..9c4b265 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.aailog.filter;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import com.sun.jersey.api.client.ClientRequest;
+
+import java.net.InetAddress;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.UnknownHostException;
+
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
-import org.mockito.Mock;
 import org.mockito.Spy;
 import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.logging.filter.base.Constants;
 import org.onap.logging.ref.slf4j.ONAPLogConstants;
 import org.slf4j.MDC;
 
-import javax.ws.rs.core.MultivaluedHashMap;
-import javax.ws.rs.core.MultivaluedMap;
-import java.net.InetAddress;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.UnknownHostException;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Mockito.doReturn;
-
 @RunWith(MockitoJUnitRunner.class)
 public class RestControllerClientLoggingInterceptorTest {
 
-        private ClientRequest clientRequest;
+    private ClientRequest clientRequest;
 
-        @Spy
-        @InjectMocks
-        private RestControllerClientLoggingInterceptor restControllerClientLoggingInterceptor;
+    @Spy
+    @InjectMocks
+    private RestControllerClientLoggingInterceptor restControllerClientLoggingInterceptor;
 
-        @Before
-        public void init() throws URISyntaxException {
-            System.setProperty("javax.ws.rs.ext.RuntimeDelegate", "com.sun.ws.rs.ext.RuntimeDelegateImpl");
-            clientRequest = ClientRequest.create().build(new URI("https://localhost:9999/aai/v1/cloud-infrastructure/complexes/complex/complex-1"),
-                "GET");
-        }
+    @Before
+    public void init() throws URISyntaxException {
+        System.setProperty("javax.ws.rs.ext.RuntimeDelegate", "com.sun.ws.rs.ext.RuntimeDelegateImpl");
+        clientRequest = ClientRequest.create().build(
+                new URI("https://localhost:9999/aai/v1/cloud-infrastructure/complexes/complex/complex-1"), "GET");
+    }
 
-        @After
-        public void tearDown() {
-            MDC.clear();
-        }
+    @After
+    public void tearDown() {
+        MDC.clear();
+    }
 
-        @Test
-        public void setupHeadersTest() throws java.net.URISyntaxException {
-
-            String transId="37b3ab2a-e57e-4fe8-8d8f-eee3019efce6";
-            MultivaluedMap<String, Object> requestHeaders = new MultivaluedHashMap<String, Object>();
-            requestHeaders.add(Constants.HttpHeaders.TRANSACTION_ID, transId);
-            clientRequest.getHeaders().putAll(requestHeaders);
-            restControllerClientLoggingInterceptor.pre(clientRequest);
-            MultivaluedMap<String, Object> headers = clientRequest.getHeaders();
-
-            assertEquals(transId, headers.getFirst(Constants.HttpHeaders.TRANSACTION_ID));
-            assertEquals(transId, headers.getFirst(Constants.HttpHeaders.ECOMP_REQUEST_ID));
-            assertEquals(transId, headers.getFirst(ONAPLogConstants.Headers.REQUEST_ID));
-            assertEquals(transId, headers.getFirst(Constants.HttpHeaders.HEADER_REQUEST_ID));
-            assertNotNull(headers.getFirst(ONAPLogConstants.Headers.INVOCATION_ID));
-        }
+    @Test
+    public void setupHeadersTest() throws java.net.URISyntaxException {
 
-        @Test
-        public void getServiceNameTest()  {
-            String serviceName = restControllerClientLoggingInterceptor.getServiceName(clientRequest);
-            assertEquals("/aai/v1/cloud-infrastructure/complexes", serviceName);
-        }
+        String transId = "37b3ab2a-e57e-4fe8-8d8f-eee3019efce6";
+        MultivaluedMap<String, Object> requestHeaders = new MultivaluedHashMap<String, Object>();
+        requestHeaders.add(Constants.HttpHeaders.TRANSACTION_ID, transId);
+        clientRequest.getHeaders().putAll(requestHeaders);
+        restControllerClientLoggingInterceptor.pre(clientRequest);
+        MultivaluedMap<String, Object> headers = clientRequest.getHeaders();
+
+        assertEquals(transId, headers.getFirst(Constants.HttpHeaders.TRANSACTION_ID));
+        assertEquals(transId, headers.getFirst(Constants.HttpHeaders.ECOMP_REQUEST_ID));
+        assertEquals(transId, headers.getFirst(ONAPLogConstants.Headers.REQUEST_ID));
+        assertEquals(transId, headers.getFirst(Constants.HttpHeaders.HEADER_REQUEST_ID));
+        assertNotNull(headers.getFirst(ONAPLogConstants.Headers.INVOCATION_ID));
+    }
+
+    @Test
+    public void getServiceNameTest() {
+        String serviceName = restControllerClientLoggingInterceptor.getServiceName(clientRequest);
+        assertEquals("/aai/v1/cloud-infrastructure/complexes", serviceName);
+    }
+
+    @Test
+    public void setupMDCTest() throws URISyntaxException {
+        restControllerClientLoggingInterceptor.pre(clientRequest);
+        assertEquals("/aai/v1/cloud-infrastructure/complexes", MDC.get(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME));
+        assertEquals("INPROGRESS", MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+        String serverFQDN = "";
+        InetAddress addr = null;
+        try {
+            addr = InetAddress.getLocalHost();
+            serverFQDN = addr.getCanonicalHostName();
 
-       @Test
-        public void setupMDCTest() throws URISyntaxException {
-           restControllerClientLoggingInterceptor.pre(clientRequest);
-           assertEquals("/aai/v1/cloud-infrastructure/complexes", MDC.get(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME) );
-           assertEquals("INPROGRESS", MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
-           String serverFQDN = "";
-           InetAddress addr = null;
-           try {
-               addr = InetAddress.getLocalHost();
-               serverFQDN = addr.getCanonicalHostName();
-
-           } catch (UnknownHostException e) {
-               serverFQDN = "";
-           }
-           assertEquals(serverFQDN, MDC.get(ONAPLogConstants.MDCs.SERVER_FQDN));
+        } catch (UnknownHostException e) {
+            serverFQDN = "";
         }
+        assertEquals(serverFQDN, MDC.get(ONAPLogConstants.MDCs.SERVER_FQDN));
+    }
 }
index 1d19e5b..6e1b0ea 100644 (file)
 
 package org.onap.aai.domain.restResponseInfo;
 
-import org.junit.Test;
+import static org.junit.Assert.assertTrue;
 
 import java.util.List;
 
-import static org.junit.Assert.assertTrue;
+import org.junit.Test;
 
 public class InfoTest {
     private Info info = new Info();
@@ -38,7 +38,8 @@ public class InfoTest {
     @Test
     public void infoTest() {
         Info.ResponseMessages responseMessages = info.getResponseMessages();
-        if (responseMessages == null) responseMessages = new Info.ResponseMessages();
+        if (responseMessages == null)
+            responseMessages = new Info.ResponseMessages();
 
         List<Info.ResponseMessages.ResponseMessage> list = responseMessages.getResponseMessage();
         Info.ResponseMessages.ResponseMessage respMsg = new Info.ResponseMessages.ResponseMessage();
index 5520579..fe95d18 100644 (file)
 
 package org.onap.aai.domain.restResponseInfo;
 
-import org.junit.Test;
-
 import static org.junit.Assert.assertNotNull;
 
+import org.junit.Test;
+
 public class ObjectFactoryTest {
     private ObjectFactory objectFactory = new ObjectFactory();
 
     @Test
     public void objectFactoryTest() {
-        Info.ResponseMessages.ResponseMessage.Variables variables = objectFactory.createInfoResponseMessagesResponseMessageVariables();
-        Info.ResponseMessages.ResponseMessage responseMessage = objectFactory.createInfoResponseMessagesResponseMessage();
+        Info.ResponseMessages.ResponseMessage.Variables variables =
+                objectFactory.createInfoResponseMessagesResponseMessageVariables();
+        Info.ResponseMessages.ResponseMessage responseMessage =
+                objectFactory.createInfoResponseMessagesResponseMessage();
         Info.ResponseMessages responseMessages = objectFactory.createInfoResponseMessages();
         Info info = objectFactory.createInfo();
 
index 4f08607..b489a0a 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.exceptions;
 
-import org.junit.Test;
-import org.onap.aai.logging.AaiElsErrorCode;
-import org.onap.aai.logging.ErrorObject;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
-import javax.ws.rs.core.Response;
 import java.io.IOException;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import javax.ws.rs.core.Response;
 
+import org.junit.Test;
+import org.onap.aai.logging.AaiElsErrorCode;
+import org.onap.aai.logging.ErrorObject;
 
 public class AAIExceptionTest {
     private AAIException aaiException;
 
     @Test
     public void defaultAAIExceptionTest() {
-        //AAI_4000=5:4:ERROR:4000:500:3002:Internal Error:900
+        // AAI_4000=5:4:ERROR:4000:500:3002:Internal Error:900
         aaiException = new AAIException();
         assertEquals(AAIException.DEFAULT_EXCEPTION_CODE, aaiException.getCode());
 
@@ -53,7 +54,8 @@ public class AAIExceptionTest {
 
     @Test
     public void aaiExceptionTest() {
-        //5:1:WARN:3303:403:3300:Too many objects would be returned by this request, please refine your request and retry:500
+        // 5:1:WARN:3303:403:3300:Too many objects would be returned by this request, please refine your request and
+        // retry:500
         aaiException = new AAIException("AAI_3303");
         assertEquals("AAI_3303", aaiException.getCode());
 
@@ -65,13 +67,15 @@ public class AAIExceptionTest {
         assertEquals(errorObject.getRESTErrorCode(), "3300");
         assertEquals(errorObject.getErrorCode(), "3303");
         assertEquals(errorObject.getAaiElsErrorCode(), AaiElsErrorCode.BUSINESS_PROCESS_ERROR);
-        assertEquals(errorObject.getErrorText(), "Too many objects would be returned by this request, please refine your request and retry");
+        assertEquals(errorObject.getErrorText(),
+                "Too many objects would be returned by this request, please refine your request and retry");
         assertNotNull(aaiException.getTemplateVars());
     }
 
     @Test
     public void aaiExceptionTestWithDetails() {
-        //5:1:WARN:3303:403:3300:Too many objects would be returned by this request, please refine your request and retry:500
+        // 5:1:WARN:3303:403:3300:Too many objects would be returned by this request, please refine your request and
+        // retry:500
         final String testDetails = "Test details";
         aaiException = new AAIException("AAI_3303", testDetails);
         assertEquals(testDetails, aaiException.getMessage());
@@ -98,4 +102,3 @@ public class AAIExceptionTest {
         assertNotNull(aaiException.getTemplateVars());
     }
 }
-
index dbfe60d..84284ec 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.exceptions;
 
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
 import java.io.IOException;
 import java.util.HashMap;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import org.junit.Test;
 
 public class AAIExceptionWithInfoTest {
 
@@ -36,7 +37,7 @@ public class AAIExceptionWithInfoTest {
     @Test
     public void aaiExceptionWithInfoTest() {
 
-        aaiException = new AAIExceptionWithInfo(new HashMap<String, Object>(), testInfo );
+        aaiException = new AAIExceptionWithInfo(new HashMap<String, Object>(), testInfo);
 
         assertEquals(testInfo, aaiException.getInfo());
         assertNotNull(aaiException.getInfoHash());
@@ -44,7 +45,7 @@ public class AAIExceptionWithInfoTest {
 
     @Test
     public void aaiExceptionWithCodeInfoTest() {
-        aaiException = new AAIExceptionWithInfo("AAI_3300", new HashMap<String, Object>(), testInfo );
+        aaiException = new AAIExceptionWithInfo("AAI_3300", new HashMap<String, Object>(), testInfo);
 
         assertEquals(testInfo, aaiException.getInfo());
         assertEquals("AAI_3300", aaiException.getCode());
@@ -54,7 +55,7 @@ public class AAIExceptionWithInfoTest {
     @Test
     public void aaiExceptionWithCodeDetailsInfoTest() {
 
-        aaiException = new AAIExceptionWithInfo("AAI_3300", testDetails, new HashMap<String, Object>(), testInfo );
+        aaiException = new AAIExceptionWithInfo("AAI_3300", testDetails, new HashMap<String, Object>(), testInfo);
 
         assertEquals(testInfo, aaiException.getInfo());
         assertEquals("AAI_3300", aaiException.getCode());
@@ -65,7 +66,8 @@ public class AAIExceptionWithInfoTest {
     @Test
     public void aaiExceptionWithCodeThrowableDetailsInfoTest() {
 
-        aaiException = new AAIExceptionWithInfo("AAI_3300", new IOException("File not found"), testDetails, new HashMap<String, Object>(), testInfo );
+        aaiException = new AAIExceptionWithInfo("AAI_3300", new IOException("File not found"), testDetails,
+                new HashMap<String, Object>(), testInfo);
 
         assertEquals(testInfo, aaiException.getInfo());
         assertEquals("AAI_3300", aaiException.getCode());
@@ -76,4 +78,3 @@ public class AAIExceptionWithInfoTest {
     }
 
 }
-
index 01b7bda..d95aefa 100644 (file)
 
 package org.onap.aai.logging;
 
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+
 import ch.qos.logback.access.spi.IAccessEvent;
+
+import java.security.cert.X509Certificate;
+
+import javax.security.auth.x500.X500Principal;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -30,12 +38,6 @@ import org.mockito.Spy;
 import org.mockito.junit.MockitoJUnitRunner;
 import org.springframework.mock.web.MockHttpServletRequest;
 
-import javax.security.auth.x500.X500Principal;
-import java.security.cert.X509Certificate;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.when;
-
 @RunWith(MockitoJUnitRunner.class)
 public class CNNameTest {
     @Mock
@@ -52,8 +54,9 @@ public class CNNameTest {
     public void setup() {
         when(cnName.isStarted()).thenReturn(true);
     }
+
     @Test
-    public void basicAuthTest(){
+    public void basicAuthTest() {
 
         MockHttpServletRequest https = new MockHttpServletRequest();
         https.addHeader("Authorization", "Basic dXNlcjpwYXNzd29yZA==");
@@ -64,8 +67,9 @@ public class CNNameTest {
         assertEquals("user", cnName.convert(accessEvent));
 
     }
+
     @Test
-    public void incorrectHeaderBasicAuthTest(){
+    public void incorrectHeaderBasicAuthTest() {
 
         MockHttpServletRequest https = new MockHttpServletRequest();
 
@@ -77,8 +81,9 @@ public class CNNameTest {
         assertEquals("-", cnName.convert(accessEvent));
 
     }
+
     @Test
-    public void noCipherSuiteTest(){
+    public void noCipherSuiteTest() {
 
         MockHttpServletRequest https = new MockHttpServletRequest();
 
@@ -90,17 +95,18 @@ public class CNNameTest {
         assertEquals("-", cnName.convert(accessEvent));
 
     }
+
     @Test
-    public void certificateTest(){
+    public void certificateTest() {
         String testSubject = "CN=TestName, OU=TestOU, O=TestOrg, C=Country";
-        X509Certificate[] certChain = { cert };
+        X509Certificate[] certChain = {cert};
         MockHttpServletRequest https = new MockHttpServletRequest();
 
         https.setAttribute("javax.servlet.request.cipher_suite", "");
-        https.setAttribute("javax.servlet.request.X509Certificate", certChain );
+        https.setAttribute("javax.servlet.request.X509Certificate", certChain);
 
         when(accessEvent.getRequest()).thenReturn(https);
-        when(cert.getSubjectX500Principal()).thenReturn(new X500Principal(testSubject) );
+        when(cert.getSubjectX500Principal()).thenReturn(new X500Principal(testSubject));
 
         assertEquals(testSubject, cnName.convert(accessEvent));
     }
index 71a07aa..28be0bf 100644 (file)
 
 package org.onap.aai.logging;
 
-import org.junit.Test;
-
 import static org.junit.Assert.assertEquals;
 
+import org.junit.Test;
+
 public class CustomLogPatternLayoutTest {
 
     private CustomLogPatternLayout customLogPatternLayout = new CustomLogPatternLayout();
 
     @Test
-    public void defaultConverterTest(){
+    public void defaultConverterTest() {
 
         assertEquals(customLogPatternLayout.getDefaultConverterMap().get("z"), CNName.class.getName());
         assertEquals(customLogPatternLayout.getDefaultConverterMap().get("y"), DME2RestFlag.class.getName());
index 737cb62..c29e29d 100644 (file)
 
 package org.onap.aai.logging;
 
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+
 import ch.qos.logback.access.spi.IAccessEvent;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -29,9 +33,6 @@ import org.mockito.Mock;
 import org.mockito.Spy;
 import org.mockito.junit.MockitoJUnitRunner;
 
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.when;
-
 @RunWith(MockitoJUnitRunner.class)
 public class DME2RestFlagTest {
 
@@ -46,8 +47,9 @@ public class DME2RestFlagTest {
     public void setup() {
         when(dme2RestFlag.isStarted()).thenReturn(true);
     }
+
     @Test
-    public void dme2Test(){
+    public void dme2Test() {
         String[] contextArray = {"a", "b", "c"};
         String[] routeOfferArray = {"d", "e", "f"};
         String[] versionArray = {"1", "2", "3"};
@@ -56,8 +58,9 @@ public class DME2RestFlagTest {
         when(accessEvent.getRequestParameter("version")).thenReturn(versionArray);
         assertEquals("DME2", dme2RestFlag.convert(accessEvent));
     }
+
     @Test
-    public void restTest(){
+    public void restTest() {
         String[] contextArray = {""};
         String[] routeOfferArray = {""};
         String[] versionArray = {""};
index ae17469..9952277 100644 (file)
 
 package org.onap.aai.logging;
 
+import static java.lang.Thread.sleep;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.ws.rs.core.MediaType;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -32,15 +42,6 @@ import org.onap.aai.util.LogFile;
 import org.onap.aai.util.MapperUtil;
 import org.slf4j.MDC;
 
-import javax.ws.rs.core.MediaType;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import static java.lang.Thread.sleep;
-import static org.junit.Assert.*;
-
 public class ErrorLogHelperTest {
 
     private static final String ErrorLogFileName = "error.log";
@@ -50,14 +51,16 @@ public class ErrorLogHelperTest {
         System.setProperty("AJSC_HOME", ".");
 
     }
+
     @After
-    public void cleanup() throws IOException{
+    public void cleanup() throws IOException {
         MDC.clear();
         LogFile.deleteContents(ErrorLogFileName);
     }
+
     @Test
     public void logErrorTest() throws IOException, InterruptedException {
-        //||main|UNKNOWN||||ERROR|500|Node cannot be deleted:3100:Bad Request:|ERR.5.4.6110
+        // ||main|UNKNOWN||||ERROR|500|Node cannot be deleted:3100:Bad Request:|ERR.5.4.6110
         ErrorLogHelper.logError("AAI_6110");
         sleep(5000);
         String logContents = LogFile.getContents(ErrorLogFileName);
@@ -66,15 +69,15 @@ public class ErrorLogHelperTest {
 
         String logContentParts[] = logContents.split("\\|");
 
-        assertTrue(logContentParts.length >= 11 );
-        assertEquals ("ERROR", logContentParts[7]);
-        assertEquals (AaiElsErrorCode.BUSINESS_PROCESS_ERROR, logContentParts[8]);
-        assertTrue (logContentParts[10].startsWith("ERR.5.4.6110"));
+        assertTrue(logContentParts.length >= 11);
+        assertEquals("ERROR", logContentParts[7]);
+        assertEquals(AaiElsErrorCode.BUSINESS_PROCESS_ERROR, logContentParts[8]);
+        assertTrue(logContentParts[10].startsWith("ERR.5.4.6110"));
     }
 
     @Test
     public void logErrorWithMessageTest() throws IOException, InterruptedException {
-        //||main|UNKNOWN||||ERROR|500|Node cannot be deleted:3100:Bad Request:|ERR.5.4.6110 message
+        // ||main|UNKNOWN||||ERROR|500|Node cannot be deleted:3100:Bad Request:|ERR.5.4.6110 message
         String errorMessage = "Object is referenced by additional objects";
         ErrorLogHelper.logError("AAI_6110", errorMessage);
         sleep(5000);
@@ -84,14 +87,14 @@ public class ErrorLogHelperTest {
 
         String logContentParts[] = logContents.split("\\|");
 
-        assertTrue(logContentParts.length >= 11 );
-        assertTrue (logContentParts[9].contains(errorMessage));
-        assertTrue (logContentParts[10].startsWith("ERR.5.4.6110"));
+        assertTrue(logContentParts.length >= 11);
+        assertTrue(logContentParts[9].contains(errorMessage));
+        assertTrue(logContentParts[10].startsWith("ERR.5.4.6110"));
     }
 
     @Test
-    public void getRESTAPIPolicyErrorResponseTest() throws AAIException{
-        //AAI_3002=5:1:WARN:3002:400:3002:Error writing output performing %1 on %2:300
+    public void getRESTAPIPolicyErrorResponseTest() throws AAIException {
+        // AAI_3002=5:1:WARN:3002:400:3002:Error writing output performing %1 on %2:300
         ArrayList<MediaType> headers = new ArrayList<MediaType>(Arrays.asList(MediaType.APPLICATION_JSON_TYPE));
         ArrayList<String> args = new ArrayList<String>(Arrays.asList("PUT", "resource"));
 
@@ -110,9 +113,10 @@ public class ErrorLogHelperTest {
         assertTrue(vars.contains("PUT"));
         assertTrue(vars.contains("resource"));
     }
+
     @Test
-    public void getRESTAPIServiceErrorResponseTest() throws AAIException{
-        //AAI_3009=5:6:WARN:3009:400:3009:Malformed URL:300
+    public void getRESTAPIServiceErrorResponseTest() throws AAIException {
+        // AAI_3009=5:6:WARN:3009:400:3009:Malformed URL:300
         ArrayList<MediaType> headers = new ArrayList<MediaType>(Arrays.asList(MediaType.APPLICATION_JSON_TYPE));
         ArrayList<String> args = new ArrayList<String>();
 
@@ -120,7 +124,8 @@ public class ErrorLogHelperTest {
         String errorResponse = ErrorLogHelper.getRESTAPIErrorResponse(headers, aaie, args);
         assertNotNull(errorResponse);
 
-        org.onap.aai.domain.restServiceException.RESTResponse resp = MapperUtil.readAsObjectOf(org.onap.aai.domain.restServiceException.RESTResponse.class, errorResponse);
+        org.onap.aai.domain.restServiceException.RESTResponse resp =
+                MapperUtil.readAsObjectOf(org.onap.aai.domain.restServiceException.RESTResponse.class, errorResponse);
         org.onap.aai.domain.restServiceException.RequestError requestError = resp.getRequestError();
         assertNotNull(requestError);
         ServiceException serviceException = requestError.getServiceException();
@@ -128,9 +133,10 @@ public class ErrorLogHelperTest {
         assertEquals("SVC3009", serviceException.getMessageId());
 
     }
+
     @Test
-    public void getRESTAPIServiceErrorResponseWithLoggingTest() throws IOException, InterruptedException{
-        //AAI_3009=5:6:WARN:3009:400:3009:Malformed URL:300
+    public void getRESTAPIServiceErrorResponseWithLoggingTest() throws IOException, InterruptedException {
+        // AAI_3009=5:6:WARN:3009:400:3009:Malformed URL:300
         ArrayList<MediaType> headers = new ArrayList<MediaType>(Arrays.asList(MediaType.APPLICATION_JSON_TYPE));
         ArrayList<String> args = new ArrayList<String>();
 
@@ -143,8 +149,8 @@ public class ErrorLogHelperTest {
         assertNotNull(logContents);
         String logContentParts[] = logContents.split("\\|");
 
-        assertTrue(logContentParts.length >= 11 );
-        assertTrue (logContentParts[10].startsWith("ERR.5.6.3009"));
+        assertTrue(logContentParts.length >= 11);
+        assertTrue(logContentParts[10].startsWith("ERR.5.6.3009"));
 
     }
 
index a5a8e49..9793472 100644 (file)
 
 package org.onap.aai.logging;
 
-import org.junit.Test;
-
 import static org.junit.Assert.assertTrue;
 
+import org.junit.Test;
+
 public class ErrorObjectFormatExceptionTest {
 
     @Test
index 8bffe4f..6be8942 100644 (file)
 
 package org.onap.aai.logging;
 
-import org.junit.Test;
+import static org.junit.Assert.*;
 
 import java.io.IOException;
 
-import static org.junit.Assert.*;
+import org.junit.Test;
 
 public class ErrorObjectNotFoundExceptionTest {
 
@@ -33,18 +33,21 @@ public class ErrorObjectNotFoundExceptionTest {
         ErrorObjectNotFoundException e = new ErrorObjectNotFoundException();
         assertTrue(e instanceof Exception);
     }
+
     @Test
     public void errorObjectNotFoundExceptionWithMessageTest() {
         ErrorObjectNotFoundException e = new ErrorObjectNotFoundException("Error Message");
         assertTrue(e instanceof Exception);
         assertEquals("Error Message", e.getMessage());
     }
+
     @Test
     public void errorObjectNotFoundExceptionWithCauseTest() {
         ErrorObjectNotFoundException e = new ErrorObjectNotFoundException(new ArithmeticException());
         assertTrue(e instanceof Exception);
         assertTrue(e.getCause() instanceof ArithmeticException);
     }
+
     @Test
     public void errorObjectNotFoundExceptionWithMsgCauseTest() {
         ErrorObjectNotFoundException e = new ErrorObjectNotFoundException("Error Message", new ArithmeticException());
@@ -52,10 +55,12 @@ public class ErrorObjectNotFoundExceptionTest {
         assertTrue(e.getCause() instanceof ArithmeticException);
         assertEquals("Error Message", e.getMessage());
     }
+
     @Test
     public void errorObjectNotFoundExceptionTest() {
 
-        ErrorObjectNotFoundException e = new ErrorObjectNotFoundException("Error Message", new ArithmeticException(), true, true);
+        ErrorObjectNotFoundException e =
+                new ErrorObjectNotFoundException("Error Message", new ArithmeticException(), true, true);
         assertTrue(e instanceof Exception);
         assertTrue(e.getCause() instanceof ArithmeticException);
         assertEquals("Error Message", e.getMessage());
@@ -63,7 +68,8 @@ public class ErrorObjectNotFoundExceptionTest {
         assertTrue((e.getSuppressed())[0] instanceof IOException);
         assertEquals("Test IO Exception", (e.getSuppressed())[0].getMessage());
 
-        ErrorObjectNotFoundException e1 = new ErrorObjectNotFoundException("Error Message", new ArithmeticException(), false, true);
+        ErrorObjectNotFoundException e1 =
+                new ErrorObjectNotFoundException("Error Message", new ArithmeticException(), false, true);
         e1.addSuppressed(new IOException("Test IO Exception"));
         assertTrue((e1.getSuppressed() == null) || e1.getSuppressed().length == 0);
 
@@ -72,29 +78,31 @@ public class ErrorObjectNotFoundExceptionTest {
     @Test
     public void errorObjectNotFoundExceptionStackTraceTest() {
 
-        ErrorObjectNotFoundException e1 = new ErrorObjectNotFoundException("Error Message", new ArithmeticException(), true, true);
+        ErrorObjectNotFoundException e1 =
+                new ErrorObjectNotFoundException("Error Message", new ArithmeticException(), true, true);
         try {
             throw e1;
-        }
-        catch (ErrorObjectNotFoundException e) {
+        } catch (ErrorObjectNotFoundException e) {
             StackTraceElement[] stackTrace = e.getStackTrace();
             assertNotNull(stackTrace);
             assertTrue(stackTrace.length > 0);
         }
 
-        ErrorObjectNotFoundException e2 = new ErrorObjectNotFoundException("Error Message", new ArithmeticException(), true, false);
+        ErrorObjectNotFoundException e2 =
+                new ErrorObjectNotFoundException("Error Message", new ArithmeticException(), true, false);
         try {
             throw e2;
-        }
-        catch (ErrorObjectNotFoundException e) {
+        } catch (ErrorObjectNotFoundException e) {
             StackTraceElement[] stackTrace = e.getStackTrace();
             assertTrue(stackTrace == null || stackTrace.length == 0);
         }
 
     }
-    /*public ErrorObjectNotFoundException(String message, Throwable cause, boolean enableSuppression,
-                                        boolean writableStackTrace) {
-        super(message, cause, enableSuppression, writableStackTrace);
-        // TODO Auto-generated constructor stub
-    }*/
+    /*
+     * public ErrorObjectNotFoundException(String message, Throwable cause, boolean enableSuppression,
+     * boolean writableStackTrace) {
+     * super(message, cause, enableSuppression, writableStackTrace);
+     * // TODO Auto-generated constructor stub
+     * }
+     */
 }
index ff20105..a0fcf65 100644 (file)
 
 package org.onap.aai.logging;
 
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
 
 import javax.ws.rs.core.Response;
 
-import static org.junit.Assert.assertEquals;
+import org.junit.Test;
 
 public class ErrorObjectTest {
     private ErrorObject errorObject;
@@ -37,18 +37,21 @@ public class ErrorObjectTest {
     private static final String ERROR_TEXT = "Test data error";
     private static final String ERROR_PATTERN = "ERR.5.4.4000";
     private static final String ERROR_SEVERITY_CODE = "2";
+
     @Test
     public void errorObjectDefaultConstructorTest() {
         errorObject = new ErrorObject();
         assertEquals("3002", errorObject.getRESTErrorCode());
-        assertEquals(Response.Status.fromStatusCode(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()), errorObject.getHTTPResponseCode());
-        assertEquals(AaiElsErrorCode.UNKNOWN_ERROR,errorObject.getAaiElsErrorCode());
+        assertEquals(Response.Status.fromStatusCode(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()),
+                errorObject.getHTTPResponseCode());
+        assertEquals(AaiElsErrorCode.UNKNOWN_ERROR, errorObject.getAaiElsErrorCode());
         assertEquals(ERROR_SEVERITY_CODE, errorObject.getSeverityCode(ERROR_SEVERITY));
     }
+
     @Test
     public void errorObjectConstructor7Test() {
         errorObject = new ErrorObject(ERROR_DISPOSITION, ERROR_CATEGORY, ERROR_SEVERITY, ERROR_HTTP_RESPONSE_CODE,
-            ERROR_REST_CODE, ERROR_CODE, ERROR_TEXT);
+                ERROR_REST_CODE, ERROR_CODE, ERROR_TEXT);
         assertEquals(ERROR_DISPOSITION, errorObject.getDisposition());
         assertEquals(ERROR_SEVERITY, errorObject.getSeverity());
         assertEquals(ERROR_CATEGORY, errorObject.getCategory());
@@ -56,7 +59,7 @@ public class ErrorObjectTest {
         assertEquals(ERROR_REST_CODE, errorObject.getRESTErrorCode());
         assertEquals(ERROR_CODE, errorObject.getErrorCode());
         assertEquals(ERROR_TEXT, errorObject.getErrorText());
-        assertEquals(AaiElsErrorCode.UNKNOWN_ERROR,errorObject.getAaiElsErrorCode());
+        assertEquals(AaiElsErrorCode.UNKNOWN_ERROR, errorObject.getAaiElsErrorCode());
         assertEquals(ERROR_SEVERITY_CODE, errorObject.getSeverityCode(ERROR_SEVERITY));
     }
 
@@ -66,18 +69,20 @@ public class ErrorObjectTest {
         assertEquals(ERROR_DISPOSITION, errorObject.getDisposition());
         assertEquals(ERROR_SEVERITY, errorObject.getSeverity());
         assertEquals(ERROR_CATEGORY, errorObject.getCategory());
-        assertEquals(Response.Status.fromStatusCode(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()), errorObject.getHTTPResponseCode());
+        assertEquals(Response.Status.fromStatusCode(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()),
+                errorObject.getHTTPResponseCode());
         assertEquals("3002", errorObject.getRESTErrorCode());
         assertEquals(ERROR_CODE, errorObject.getErrorCode());
         assertEquals(ERROR_TEXT, errorObject.getErrorText());
-        assertEquals(AaiElsErrorCode.UNKNOWN_ERROR,errorObject.getAaiElsErrorCode());
+        assertEquals(AaiElsErrorCode.UNKNOWN_ERROR, errorObject.getAaiElsErrorCode());
         assertEquals(ERROR_PATTERN, errorObject.getErrorCodeString());
         assertEquals(ERROR_SEVERITY_CODE, errorObject.getSeverityCode(ERROR_SEVERITY));
     }
 
     @Test
     public void errorObjectConstructor6Test() {
-        errorObject = new ErrorObject(ERROR_SEVERITY, ERROR_HTTP_RESPONSE_CODE, ERROR_CODE, ERROR_TEXT, ERROR_DISPOSITION, ERROR_CATEGORY);
+        errorObject = new ErrorObject(ERROR_SEVERITY, ERROR_HTTP_RESPONSE_CODE, ERROR_CODE, ERROR_TEXT,
+                ERROR_DISPOSITION, ERROR_CATEGORY);
         assertEquals(ERROR_DISPOSITION, errorObject.getDisposition());
         assertEquals(ERROR_SEVERITY, errorObject.getSeverity());
         assertEquals(ERROR_CATEGORY, errorObject.getCategory());
@@ -91,5 +96,4 @@ public class ErrorObjectTest {
 
     }
 
-
 }
index 695d7c0..b352cb1 100644 (file)
 
 package org.onap.aai.logging;
 
-import org.junit.Test;
-import org.onap.aai.exceptions.AAIException;
-
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import org.junit.Test;
+import org.onap.aai.exceptions.AAIException;
+
 public class LogFormatToolsTest {
 
     @Test
index 4fe6031..d793eb7 100644 (file)
 
 package org.onap.aai.logging;
 
-import org.junit.After;
-import org.junit.Test;
-import org.slf4j.MDC;
+import static org.junit.Assert.*;
 
 import java.util.concurrent.TimeUnit;
 
-import static org.junit.Assert.*;
+import org.junit.After;
+import org.junit.Test;
+import org.slf4j.MDC;
 
 public class LoggingContextTest {
 
     @After
-    public void cleanup(){
+    public void cleanup() {
         MDC.clear();
     }
+
     @Test
     public void elapsedTimeTest() {
         LoggingContext.elapsedTime(300, TimeUnit.MILLISECONDS);
@@ -41,6 +42,7 @@ public class LoggingContextTest {
         LoggingContext.init();
         assertNull(MDC.get(LoggingContext.LoggingField.ELAPSED_TIME.toString()));
     }
+
     @Test
     public void stopWatchTest() {
         LoggingContext.init();
@@ -53,6 +55,7 @@ public class LoggingContextTest {
         assertFalse(LoggingContext.isStopWatchStarted());
         assertTrue(elapsedTime > 0);
     }
+
     @Test
     public void putClearTest() {
         String testServiceName = "TEST-SVC-NAME";
index 8a4123f..2c9c52c 100644 (file)
 
 package org.onap.aai.logging;
 
-import org.junit.Test;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-public class StopWatchNotStartedExceptionTest {
+import org.junit.Test;
 
+public class StopWatchNotStartedExceptionTest {
 
     @Test
     public void stopWatchNotStartedExceptionTest() {
         StopWatchNotStartedException e = new StopWatchNotStartedException();
         assertTrue(e instanceof RuntimeException);
     }
+
     @Test
     public void stopWatchNotStartedExceptionWithMessageTest() {
         StopWatchNotStartedException e = new StopWatchNotStartedException("Error Message");
         assertTrue(e instanceof RuntimeException);
         assertEquals("Error Message", e.getMessage());
     }
+
     @Test
     public void stopWatchNotStartedExceptionWithCauseTest() {
         StopWatchNotStartedException e = new StopWatchNotStartedException(new ArithmeticException());
         assertTrue(e instanceof RuntimeException);
         assertTrue(e.getCause() instanceof ArithmeticException);
     }
+
     @Test
     public void stopWatchNotStartedExceptionWithMsgCauseTest() {
         StopWatchNotStartedException e = new StopWatchNotStartedException("Error Message", new ArithmeticException());
index 50a2d05..34aecd5 100644 (file)
 
 package org.onap.aai.logging;
 
+import static java.lang.Thread.sleep;
+import static org.junit.Assert.*;
+
 import org.junit.After;
 import org.junit.Test;
 import org.slf4j.MDC;
 
-import static java.lang.Thread.sleep;
-import static org.junit.Assert.*;
-
 public class StopWatchTest {
 
     @After
     public void cleanup() {
         MDC.clear();
     }
+
     @Test
     public void elapsedTimeTest() throws InterruptedException {
         StopWatch.start();
@@ -40,6 +41,7 @@ public class StopWatchTest {
         StopWatch.stop();
         assertTrue(Long.parseLong(MDC.get(LoggingContext.LoggingField.ELAPSED_TIME.toString())) >= 1000L);
     }
+
     @Test
     public void elapsedTimeConditionalTest() throws InterruptedException {
         StopWatch.conditionalStart();
@@ -49,12 +51,13 @@ public class StopWatchTest {
         long elapsedTime = Long.parseLong(elapsedTimeStr);
         assertTrue(elapsedTime >= 1000L);
     }
+
     @Test
     public void clearTest() throws InterruptedException {
         StopWatch.start();
         sleep(1010);
         StopWatch.stop();
-        assertNotNull( MDC.get(LoggingContext.LoggingField.ELAPSED_TIME.toString()));
+        assertNotNull(MDC.get(LoggingContext.LoggingField.ELAPSED_TIME.toString()));
 
         StopWatch.clear();
         assertNull(MDC.get(LoggingContext.LoggingField.STOP_WATCH_START.toString()));
index 24efee3..7d51ccc 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.util;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.aai.exceptions.AAIException;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 public class AAIApplicationConfigTest {
 
     @Before
@@ -39,6 +40,7 @@ public class AAIApplicationConfigTest {
     public void truststoreTest() throws AAIException {
         assertEquals("truststore.jks", AAIApplicationConfig.getTruststore());
     }
+
     @Test
     public void keystoreTest() throws AAIException {
         assertEquals("keystore.jks", AAIApplicationConfig.getKeystore());
@@ -58,6 +60,7 @@ public class AAIApplicationConfigTest {
     public void getValueTest() throws AAIException {
         assertEquals("certificates", AAIApplicationConfig.get("server.certs.location"));
     }
+
     @Test
     public void getIntValueTest() throws AAIException {
         assertTrue(8446 == AAIApplicationConfig.getInt("server.port"));
@@ -70,6 +73,7 @@ public class AAIApplicationConfigTest {
 
     @Test
     public void getValueWithReplacementTest() throws AAIException {
-        assertEquals("/opt/app/aai/etc/auth/aai-client-cert.p12", AAIApplicationConfig.get("schema.service.ssl.key-store"));
+        assertEquals("/opt/app/aai/etc/auth/aai-client-cert.p12",
+                AAIApplicationConfig.get("schema.service.ssl.key-store"));
     }
 }
index 86d6c20..dad8c35 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.util;
 
+import static org.junit.Assert.*;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.aai.exceptions.AAIException;
 
-import static org.junit.Assert.*;
-
 public class AAIConfigTest {
 
     @Before
@@ -43,6 +44,7 @@ public class AAIConfigTest {
     public void getValueTest() throws AAIException {
         assertEquals("10", AAIConfig.get("aai.logging.maxStackTraceEntries"));
     }
+
     @Test
     public void getIntValueTest() throws AAIException {
         assertTrue(10 == AAIConfig.getInt("aai.logging.maxStackTraceEntries"));
index 38ac5de..b1be62a 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.util;
 
+import static org.junit.Assert.assertNotNull;
+
 import org.junit.Test;
 import org.onap.aai.exceptions.AAIException;
 
-import static org.junit.Assert.assertNotNull;
-
 public class FormatDateTest {
     private FormatDate formatDate = null;
 
index b94686b..3ace6f0 100644 (file)
@@ -17,6 +17,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.util;
 
 import java.io.File;
@@ -31,7 +32,7 @@ import org.apache.commons.io.IOUtils;
  * Utility class to read/delete contents of log file
  */
 public class LogFile {
-       
+
     public static String getContents(String fileName) throws IOException {
 
         FileInputStream fileInputStream = null;
@@ -39,12 +40,13 @@ public class LogFile {
         try {
             fileInputStream = new FileInputStream("logs/" + fileName);
             contents = IOUtils.toString(fileInputStream, "UTF-8");
-        }
-        finally {
-            if (fileInputStream != null) fileInputStream.close();
+        } finally {
+            if (fileInputStream != null)
+                fileInputStream.close();
         }
         return contents;
     }
+
     public static void deleteContents(String fileName) throws IOException {
         FileUtils.write(new File("logs/" + fileName), "", Charset.defaultCharset());
     }
index 119bdf1..8ac9f12 100644 (file)
@@ -22,11 +22,13 @@ package org.onap.logging.filter.base;
 
 import static org.junit.Assert.assertEquals;
 import static org.mockito.Mockito.when;
+
 import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.container.ContainerResponseContext;
 import javax.ws.rs.core.MultivaluedHashMap;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.UriInfo;
+
 import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -61,7 +63,6 @@ public class AuditLogContainerFilterTest {
         MDC.clear();
     }
 
-
     @Test
     public void filterTest() {
         MultivaluedMap<String, String> headerMap = new MultivaluedHashMap<>();
index d3f0f9f..afdfe05 100644 (file)
 package org.onap.logging.filter.base;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
 import static org.mockito.Mockito.when;
+
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
 import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
index 4d1f102..6390c8e 100644 (file)
 package org.onap.logging.filter.base;
 
 import static org.junit.Assert.assertEquals;
+
 import javax.ws.rs.core.MultivaluedHashMap;
 import javax.ws.rs.core.MultivaluedMap;
+
 import org.junit.Test;
 import org.onap.logging.ref.slf4j.ONAPLogConstants;
 
index 9c89da5..e47db8c 100644 (file)
@@ -24,11 +24,14 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.mockito.Mockito.when;
+
 import java.util.HashMap;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MultivaluedHashMap;
 import javax.ws.rs.core.MultivaluedMap;
+
 import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
index 6f6a0ff..daa5762 100644 (file)
@@ -23,16 +23,17 @@ package org.onap.logging.filter.base;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.mockito.Mockito.doReturn;
+
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.time.ZoneOffset;
 import java.time.ZonedDateTime;
 import java.time.format.DateTimeFormatter;
-import java.util.HashMap;
-import java.util.Map;
+
 import javax.ws.rs.client.ClientRequestContext;
 import javax.ws.rs.core.MultivaluedHashMap;
 import javax.ws.rs.core.MultivaluedMap;
+
 import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
index c2446a3..61e7014 100644 (file)
@@ -22,11 +22,14 @@ package org.onap.logging.filter.base;
 
 import static org.junit.Assert.assertEquals;
 import static org.mockito.Mockito.when;
+
 import java.io.IOException;
 import java.net.URISyntaxException;
+
 import javax.ws.rs.client.ClientRequestContext;
 import javax.ws.rs.core.MultivaluedHashMap;
 import javax.ws.rs.core.MultivaluedMap;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
index e2c5da9..0ae919f 100644 (file)
 package org.onap.logging.filter.base;
 
 import static org.junit.Assert.assertEquals;
+
 import javax.ws.rs.core.MultivaluedHashMap;
 import javax.ws.rs.core.MultivaluedMap;
+
 import org.junit.Test;
 import org.onap.logging.ref.slf4j.ONAPLogConstants;
 
index fff6776..ccde000 100644 (file)
@@ -22,7 +22,9 @@ package org.onap.logging.filter.base;
 
 import static org.junit.Assert.assertEquals;
 import static org.mockito.Mockito.when;
+
 import javax.servlet.http.HttpServletRequest;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
index 9549eaa..f6ed961 100644 (file)
 
 package org.onap.logging.ref.slf4j;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.slf4j.event.Level;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-import javax.xml.bind.DatatypeConverter;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.core.Is.is;
 import static org.hamcrest.core.IsNot.not;
@@ -44,6 +30,21 @@ import static org.hamcrest.core.IsSame.sameInstance;
 import static org.hamcrest.core.StringEndsWith.endsWith;
 import static org.hamcrest.number.OrderingComparison.lessThan;
 
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.xml.bind.DatatypeConverter;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.slf4j.event.Level;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
 /**
  * Tests for {@link ONAPLogAdapter}.
  */
@@ -68,8 +69,7 @@ public class ONAPLogAdapterTest {
         try {
             ONAPLogAdapter.checkNotNull(null);
             Assert.fail("Should throw NullPointerException");
-        }
-        catch (final NullPointerException e) {
+        } catch (final NullPointerException e) {
 
         }
     }
@@ -126,12 +126,11 @@ public class ONAPLogAdapterTest {
             assertThat(invokeTimestampString, endsWith("Z"));
             final long invokeTimestamp = DatatypeConverter.parseDateTime(invokeTimestampString).getTimeInMillis();
             assertThat(Math.abs(System.currentTimeMillis() - invokeTimestamp), lessThan(5000L));
-        }
-        finally {
+        } finally {
             MDC.clear();
         }
     }
-    
+
     /**
      * Test ENTERING with an EMPTY_STRING serviceName.
      */
@@ -166,8 +165,7 @@ public class ONAPLogAdapterTest {
             assertThat(invokeTimestampString, endsWith("Z"));
             final long invokeTimestamp = DatatypeConverter.parseDateTime(invokeTimestampString).getTimeInMillis();
             assertThat(Math.abs(System.currentTimeMillis() - invokeTimestamp), lessThan(5000L));
-        }
-        finally {
+        } finally {
             MDC.clear();
         }
     }
@@ -217,8 +215,7 @@ public class ONAPLogAdapterTest {
             assertThat(MDC.get("somekey"), is("somevalue"));
             adapter.exiting();
             assertThat(MDC.get("somekey"), nullValue());
-        }
-        finally {
+        } finally {
             MDC.clear();
         }
     }
@@ -238,7 +235,7 @@ public class ONAPLogAdapterTest {
         final UUID asyncUUID = adapter.invoke(ONAPLogConstants.InvocationMode.SYNCHRONOUS);
         assertThat(asyncUUID, notNullValue());
 
-        final UUID agnosticUUID = adapter.invoke((ONAPLogConstants.InvocationMode)null);
+        final UUID agnosticUUID = adapter.invoke((ONAPLogConstants.InvocationMode) null);
         assertThat(agnosticUUID, notNullValue());
 
     }
@@ -253,13 +250,14 @@ public class ONAPLogAdapterTest {
         final ONAPLogAdapter adapter = new ONAPLogAdapter(logger);
 
         final Map<String, String> headers = new HashMap<>();
-        final ONAPLogAdapter.RequestBuilder builder = new ONAPLogAdapter.RequestBuilder<ONAPLogAdapter.RequestBuilder>() {
-            @Override
-            public ONAPLogAdapter.RequestBuilder setHeader(final String name, final String value) {
-                headers.put(name, value);
-                return this;
-            }
-        };
+        final ONAPLogAdapter.RequestBuilder builder =
+                new ONAPLogAdapter.RequestBuilder<ONAPLogAdapter.RequestBuilder>() {
+                    @Override
+                    public ONAPLogAdapter.RequestBuilder setHeader(final String name, final String value) {
+                        headers.put(name, value);
+                        return this;
+                    }
+                };
 
         try {
             final UUID uuid = adapter.invoke(builder, ONAPLogConstants.InvocationMode.SYNCHRONOUS);
@@ -267,8 +265,7 @@ public class ONAPLogAdapterTest {
             assertThat(headers.get(ONAPLogConstants.Headers.INVOCATION_ID), is(uuid.toString()));
             assertThat(headers.containsKey(ONAPLogConstants.Headers.PARTNER_NAME), is(true));
             assertThat(headers.containsKey(ONAPLogConstants.Headers.REQUEST_ID), is(true));
-        }
-        finally {
+        } finally {
             MDC.clear();
         }
     }
@@ -283,13 +280,14 @@ public class ONAPLogAdapterTest {
         final ONAPLogAdapter adapter = new ONAPLogAdapter(logger);
 
         final Map<String, String> headers = new HashMap<>();
-        final ONAPLogAdapter.RequestBuilder builder = new ONAPLogAdapter.RequestBuilder<ONAPLogAdapter.RequestBuilder>() {
-            @Override
-            public ONAPLogAdapter.RequestBuilder setHeader(final String name, final String value) {
-                headers.put(name, value);
-                return this;
-            }
-        };
+        final ONAPLogAdapter.RequestBuilder builder =
+                new ONAPLogAdapter.RequestBuilder<ONAPLogAdapter.RequestBuilder>() {
+                    @Override
+                    public ONAPLogAdapter.RequestBuilder setHeader(final String name, final String value) {
+                        headers.put(name, value);
+                        return this;
+                    }
+                };
 
         try {
             final UUID uuid = adapter.invoke(builder);
@@ -297,8 +295,7 @@ public class ONAPLogAdapterTest {
             assertThat(headers.get(ONAPLogConstants.Headers.INVOCATION_ID), is(uuid.toString()));
             assertThat(headers.containsKey(ONAPLogConstants.Headers.PARTNER_NAME), is(true));
             assertThat(headers.containsKey(ONAPLogConstants.Headers.REQUEST_ID), is(true));
-        }
-        finally {
+        } finally {
             MDC.clear();
         }
     }
@@ -312,8 +309,7 @@ public class ONAPLogAdapterTest {
         request.setRequestURI("/ctx0");
         request.setServerName("srv0");
 
-        final ONAPLogAdapter.HttpServletRequestAdapter adapter
-                = new ONAPLogAdapter.HttpServletRequestAdapter(request);
+        final ONAPLogAdapter.HttpServletRequestAdapter adapter = new ONAPLogAdapter.HttpServletRequestAdapter(request);
         assertThat(adapter.getHeader("uuid"), is(uuid.toString()));
         assertThat(adapter.getRequestURI(), is("/ctx0"));
         assertThat(adapter.getServerAddress(), is("srv0"));
@@ -323,8 +319,7 @@ public class ONAPLogAdapterTest {
     public void testServiceDescriptor() {
         final String uuid = UUID.randomUUID().toString();
 
-        final ONAPLogAdapter.ServiceDescriptor adapter
-                = new ONAPLogAdapter.ServiceDescriptor();
+        final ONAPLogAdapter.ServiceDescriptor adapter = new ONAPLogAdapter.ServiceDescriptor();
         adapter.setServiceUUID(uuid);
         adapter.setServiceName("name0");
 
@@ -341,8 +336,7 @@ public class ONAPLogAdapterTest {
     public void testResponseDescriptor() {
         final String uuid = UUID.randomUUID().toString();
 
-        final ONAPLogAdapter.ResponseDescriptor adapter
-                = new ONAPLogAdapter.ResponseDescriptor();
+        final ONAPLogAdapter.ResponseDescriptor adapter = new ONAPLogAdapter.ResponseDescriptor();
         adapter.setResponseCode("code0");
         adapter.setResponseDescription("desc0");
         adapter.setResponseSeverity(Level.INFO);
@@ -385,20 +379,17 @@ public class ONAPLogAdapterTest {
             // Generate (and log) an invocationID, then use it to
             // invoke another component.
 
-            final RESTClient client = new RESTClient();             // implements ONAPLogAdapter.RequestBuilder<RESTClient>.
+            final RESTClient client = new RESTClient(); // implements ONAPLogAdapter.RequestBuilder<RESTClient>.
             adapter.invoke(client, ONAPLogConstants.InvocationMode.SYNCHRONOUS);
-            final RESTRequest request = null;                       // TODO: build real request.
-            final RESTResponse response = client.execute(request);  // TODO: handle real response.
+            final RESTRequest request = null; // TODO: build real request.
+            final RESTResponse response = client.execute(request); // TODO: handle real response.
 
             // Set response details prior to #exiting.
             // (Obviously there'd be errorhandling, etc. IRL).
 
-            adapter.getResponseDescriptor()
-                    .setResponseCode((String)null)
-                    .setResponseSeverity(Level.INFO)
+            adapter.getResponseDescriptor().setResponseCode((String) null).setResponseSeverity(Level.INFO)
                     .setResponseStatus(ONAPLogConstants.ResponseStatus.COMPLETE);
-        }
-        finally {
+        } finally {
 
             // Return, logging EXIT marker, with response MDCs.
 
index 9a46f05..6dc5e59 100644 (file)
 
 package org.onap.logging.ref.slf4j;
 
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
+
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsInstanceOf.instanceOf;
-
 /**
  * Tests for {@link ONAPLogConstants}.
  */
@@ -51,8 +51,7 @@ public class ONAPLogConstantsTest {
             c.setAccessible(true);
             c.newInstance();
             Assert.fail("Should fail for hidden constructor.");
-        }
-        catch (final InvocationTargetException e) {
+        } catch (final InvocationTargetException e) {
             assertThat(e.getCause(), instanceOf(UnsupportedOperationException.class));
         }
     }
@@ -82,8 +81,7 @@ public class ONAPLogConstantsTest {
 
     @Test
     public void testInvocationModeToString() {
-        assertThat(ONAPLogConstants.InvocationMode.SYNCHRONOUS.toString(),
-                is("SYNCHRONOUS"));
+        assertThat(ONAPLogConstants.InvocationMode.SYNCHRONOUS.toString(), is("SYNCHRONOUS"));
     }
 
     @Test
@@ -114,8 +112,7 @@ public class ONAPLogConstantsTest {
         try {
             c.getDeclaredConstructors()[0].newInstance();
             Assert.fail("Should fail for hidden constructor.");
-        }
-        catch (final IllegalAccessException e) {
+        } catch (final IllegalAccessException e) {
 
         }
 
@@ -124,8 +121,7 @@ public class ONAPLogConstantsTest {
             constructor.setAccessible(true);
             constructor.newInstance();
             Assert.fail("Should fail even when invoked.");
-        }
-        catch (final InvocationTargetException e) {
+        } catch (final InvocationTargetException e) {
             assertThat(e.getCause(), instanceOf(UnsupportedOperationException.class));
         }
     }
index ee21d16..660cac9 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.failover;
 
+import java.util.Date;
+import java.util.concurrent.atomic.AtomicLong;
+
 import org.aspectj.lang.ProceedingJoinPoint;
 import org.aspectj.lang.annotation.Around;
 import org.aspectj.lang.annotation.Aspect;
@@ -27,9 +31,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 
-import java.util.Date;
-import java.util.concurrent.atomic.AtomicLong;
-
 @Aspect
 @Component
 public class FailoverAspect {
@@ -39,7 +40,7 @@ public class FailoverAspect {
     private final FailoverMonitor failoverMonitor;
     private final AtomicLong atomicLong;
 
-    public FailoverAspect(FailoverMonitor failoverMonitor){
+    public FailoverAspect(FailoverMonitor failoverMonitor) {
         this.failoverMonitor = failoverMonitor;
         this.atomicLong = new AtomicLong(1l);
     }
@@ -69,25 +70,22 @@ public class FailoverAspect {
     @Around("@annotation(org.springframework.scheduling.annotation.Scheduled)")
     public void preSchedule(ProceedingJoinPoint pointcut) throws Throwable {
 
-        Object target             = pointcut.getTarget();
+        Object target = pointcut.getTarget();
         MethodSignature signature = (MethodSignature) pointcut.getSignature();
-        String method             = signature.getMethod().getName();
+        String method = signature.getMethod().getName();
 
-        if(failoverMonitor.shouldRun()){
+        if (failoverMonitor.shouldRun()) {
             atomicLong.set(1l);
             pointcut.proceed();
         } else {
             long currentTime = new Date().getTime();
             long lastMessageTime = atomicLong.get();
 
-            if((currentTime - lastMessageTime) > 120000){
+            if ((currentTime - lastMessageTime) > 120000) {
                 atomicLong.compareAndSet(lastMessageTime, new Date().getTime());
                 LOGGER.debug("Not proceeding the task {}#{} due to is_primary set to false in failover.properties",
-                    target.getClass(),
-                    method
-                );
+                        target.getClass(), method);
             }
         }
     }
 }
-
index cadddc2..731abe7 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-package org.onap.aai.failover;
 
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
+package org.onap.aai.failover;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -29,6 +27,9 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Properties;
 
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
 @Component
 public class FailoverMonitor {
 
@@ -43,9 +44,9 @@ public class FailoverMonitor {
 
         Path failoverPath = Paths.get(failoverPropertiesPath);
 
-        if(Files.exists(failoverPath)){
+        if (Files.exists(failoverPath)) {
             Properties properties = new Properties();
-            try (InputStream is = Files.newInputStream(failoverPath)){
+            try (InputStream is = Files.newInputStream(failoverPath)) {
                 properties.load(is);
                 // If the property is_primary is missing then it should proceed
                 return TRUE.equals(properties.getProperty(IS_PRIMARY, DEFAULT_FOR_PRIMARY));
index 3470de9..05d5ec0 100644 (file)
 
 package org.onap.aai.restclient;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.util.Collections;
 import java.util.Map;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
index b11b033..b558546 100644 (file)
 
 package org.onap.aai.restclient;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import javax.annotation.PostConstruct;
+
 import org.apache.http.client.HttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.onap.aai.aailog.filter.RestClientLoggingInterceptor;
-import org.springframework.boot.web.client.RestTemplateBuilder;
-import org.springframework.http.client.ClientHttpRequestFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
 import org.springframework.web.client.RestTemplate;
 
-import javax.annotation.PostConstruct;
-
 public abstract class NoAuthRestClient extends RestClient {
 
     private static Logger logger = LoggerFactory.getLogger(NoAuthRestClient.class);
index 5c359e2..614f677 100644 (file)
 
 package org.onap.aai.restclient;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import javax.annotation.PostConstruct;
+import javax.net.ssl.SSLContext;
+
 import org.apache.http.client.HttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.ssl.SSLContextBuilder;
 import org.onap.aai.aailog.filter.RestClientLoggingInterceptor;
-import org.springframework.boot.web.client.RestTemplateBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
 import org.springframework.util.ResourceUtils;
 import org.springframework.web.client.RestTemplate;
 
-import javax.annotation.PostConstruct;
-import javax.net.ssl.SSLContext;
-
 public abstract class OneWaySSLRestClient extends RestClient {
 
     private static Logger logger = LoggerFactory.getLogger(OneWaySSLRestClient.class);
@@ -61,12 +60,11 @@ public abstract class OneWaySSLRestClient extends RestClient {
 
         String trustStore = getTruststorePath();
 
-        SSLContext sslContext =
-            SSLContextBuilder.create()
+        SSLContext sslContext = SSLContextBuilder.create()
                 .loadTrustMaterial(ResourceUtils.getFile(trustStore), trustStorePassword).build();
 
         HttpClient client =
-            HttpClients.custom().setSSLContext(sslContext).setSSLHostnameVerifier((s, sslSession) -> true).build();
+                HttpClients.custom().setSSLContext(sslContext).setSSLHostnameVerifier((s, sslSession) -> true).build();
 
         return client;
     }
index 47dd2f2..9ed35de 100644 (file)
@@ -17,6 +17,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.restclient;
 
 import java.io.File;
@@ -117,7 +118,8 @@ public class PropertyPasswordConfiguration implements ApplicationContextInitiali
             Map<String, Object> propertyOverrides = new LinkedHashMap<>();
             decodePasswords(propertySource, propertyOverrides);
             if (!propertyOverrides.isEmpty()) {
-                PropertySource<?> decodedProperties = new MapPropertySource("decoded "+ propertySource.getName(), propertyOverrides);
+                PropertySource<?> decodedProperties =
+                        new MapPropertySource("decoded " + propertySource.getName(), propertyOverrides);
                 environment.getPropertySources().addBefore(propertySource.getName(), decodedProperties);
             }
 
@@ -143,7 +145,8 @@ public class PropertyPasswordConfiguration implements ApplicationContextInitiali
     }
 
     private String decodePasswordsInString(String input) {
-        if (input == null) return null;
+        if (input == null)
+            return null;
         StringBuffer output = new StringBuffer();
         Matcher matcher = decodePasswordPattern.matcher(input);
         while (matcher.find()) {
index 67fb01e..6fd2ab6 100644 (file)
 
 package org.onap.aai.restclient;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.Map;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.core.io.Resource;
 import org.springframework.http.HttpEntity;
index 9945275..fdf1a1c 100644 (file)
 
 package org.onap.aai.restclient;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.IOException;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.client.ClientHttpResponse;
 import org.springframework.web.client.ResponseErrorHandler;
index f43d21c..5ea4fc3 100644 (file)
@@ -20,9 +20,6 @@
 
 package org.onap.aai.restclient;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
@@ -34,11 +31,12 @@ import javax.net.ssl.SSLContext;
 import org.apache.http.client.HttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.ssl.SSLContextBuilder;
-import org.springframework.boot.web.client.RestTemplateBuilder;
+import org.onap.aai.aailog.filter.RestClientLoggingInterceptor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
 import org.springframework.util.ResourceUtils;
 import org.springframework.web.client.RestTemplate;
-import org.onap.aai.aailog.filter.RestClientLoggingInterceptor;
 
 public abstract class TwoWaySSLRestClient extends RestClient {
 
@@ -69,11 +67,11 @@ public abstract class TwoWaySSLRestClient extends RestClient {
         String trustStore = getTruststorePath();
 
         SSLContext sslContext =
-            SSLContextBuilder.create().loadKeyMaterial(loadPfx(keyStore, keyStorePassword), keyStorePassword)
-                .loadTrustMaterial(ResourceUtils.getFile(trustStore), trustStorePassword).build();
+                SSLContextBuilder.create().loadKeyMaterial(loadPfx(keyStore, keyStorePassword), keyStorePassword)
+                        .loadTrustMaterial(ResourceUtils.getFile(trustStore), trustStorePassword).build();
 
         HttpClient client =
-            HttpClients.custom().setSSLContext(sslContext).setSSLHostnameVerifier((s, sslSession) -> true).build();
+                HttpClients.custom().setSSLContext(sslContext).setSSLHostnameVerifier((s, sslSession) -> true).build();
 
         return client;
     }
index 5aa8d68..2e93ef9 100644 (file)
 
 package org.onap.aai.schemaif;
 
-import org.onap.aai.schemaif.definitions.EdgeSchema;
-import org.onap.aai.schemaif.definitions.VertexSchema;
-
 import java.util.Map;
 import java.util.Set;
 
+import org.onap.aai.schemaif.definitions.EdgeSchema;
+import org.onap.aai.schemaif.definitions.VertexSchema;
+
 public interface SchemaProvider {
 
     /**
@@ -61,7 +61,8 @@ public interface SchemaProvider {
      *
      * @return The edge schema definition
      */
-    EdgeSchema getEdgeSchema(String edgeType, String sourceVertex, String targetVertex, String version) throws SchemaProviderException;
+    EdgeSchema getEdgeSchema(String edgeType, String sourceVertex, String targetVertex, String version)
+            throws SchemaProviderException;
 
     /**
      * Get the list of edge definitions which are adjacent to the given vertex
@@ -82,7 +83,8 @@ public interface SchemaProvider {
      *
      * @return The list of edge schema definitions
      */
-    Set<EdgeSchema> getEdgeSchemaForSourceTarget(String sourceType, String targetType, String version) throws SchemaProviderException;
+    Set<EdgeSchema> getEdgeSchemaForSourceTarget(String sourceType, String targetType, String version)
+            throws SchemaProviderException;
 
     /**
      * Get vertex map for a schema version
@@ -92,4 +94,4 @@ public interface SchemaProvider {
      * @return The list of vertex types
      */
     Map<String, VertexSchema> getVertexMap(String schemaVersion) throws SchemaProviderException;
- }
+}
index 9a95c33..4fb99f0 100644 (file)
 
 package org.onap.aai.schemaif;
 
-
 public class SchemaProviderException extends Exception {
 
     private static final long serialVersionUID = 8162385108397238865L;
 
-
-    public SchemaProviderException() {}
+    public SchemaProviderException() {
+    }
 
     public SchemaProviderException(String message) {
         super(message);
@@ -41,7 +40,8 @@ public class SchemaProviderException extends Exception {
         super(message, cause);
     }
 
-    public SchemaProviderException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+    public SchemaProviderException(String message, Throwable cause, boolean enableSuppression,
+            boolean writableStackTrace) {
         super(message, cause, enableSuppression, writableStackTrace);
     }
 }
index 9b2c151..b3b3257 100644 (file)
  * ECOMP and OpenECOMP are trademarks
  * and service marks of AT&T Intellectual Property.
  */
+
 package org.onap.aai.schemaif;
 
 import com.att.eelf.i18n.EELFResourceManager;
+
 import org.onap.aai.cl.eelf.LogMessageEnum;
 
 public enum SchemaProviderMsgs implements LogMessageEnum {
-    SCHEMA_LOAD_ERROR,
-    LOADED_SCHEMA_FILE,
-    LOADED_DB_RULE_FILE;
-    
+    SCHEMA_LOAD_ERROR, LOADED_SCHEMA_FILE, LOADED_DB_RULE_FILE;
+
     static {
         EELFResourceManager.loadMessageBundle("logging/SchemaProviderMsgs");
     }
index 5d25912..e2dbc09 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.schemaif.definitions;
 
 import java.util.Map;
 
-
 public class EdgeSchema {
     protected String name;
     protected String source;
     protected String target;
     protected Multiplicity multiplicity;
-    protected Map<String,String> annotations;
-    protected Map<String,PropertySchema> properties;
+    protected Map<String, String> annotations;
+    protected Map<String, PropertySchema> properties;
 
     public enum Multiplicity {
-        MANY_2_MANY,
-        MANY_2_ONE,
-        ONE_2_MANY,
-        ONE_2_ONE
+        MANY_2_MANY, MANY_2_ONE, ONE_2_MANY, ONE_2_ONE
     }
 
     public String getName() {
@@ -58,7 +55,7 @@ public class EdgeSchema {
         return properties.get(propName.toLowerCase());
     }
 
-    public Map<String,PropertySchema> getPropertySchemaList() {
+    public Map<String, PropertySchema> getPropertySchemaList() {
         return properties;
     }
 
@@ -66,7 +63,7 @@ public class EdgeSchema {
         return annotations.get(annotation.toLowerCase());
     }
 
-    public Map<String,String> getAnnotations() {
+    public Map<String, String> getAnnotations() {
         return annotations;
     }
 
@@ -88,9 +85,8 @@ public class EdgeSchema {
 
         EdgeSchema other = (EdgeSchema) obj;
 
-        return (source.equals(other.getSource()))
-            && (target.equals(other.getTarget()))
-            && (name.equals(other.getName()));
+        return (source.equals(other.getSource())) && (target.equals(other.getTarget()))
+                && (name.equals(other.getName()));
     }
 
     public String toString() {
index a512da0..c102118 100644 (file)
@@ -26,7 +26,6 @@ import java.util.Map;
 import org.onap.aai.schemaif.SchemaProviderException;
 import org.onap.aai.schemaif.definitions.types.DataType;
 
-
 public class PropertySchema {
     protected String name;
     protected DataType dataType;
@@ -34,7 +33,7 @@ public class PropertySchema {
     protected String defaultValue;
     protected Boolean unique;
     protected Boolean isReserved;
-    protected Map<String,String> annotations;
+    protected Map<String, String> annotations;
 
     public String getName() {
         return name;
@@ -47,11 +46,11 @@ public class PropertySchema {
     public Boolean isRequired() {
         return required;
     }
-    
+
     public Boolean isKey() {
         return (unique && required);
     }
-    
+
     public Boolean isUnique() {
         return unique;
     }
@@ -59,17 +58,17 @@ public class PropertySchema {
     public String getDefaultValue() {
         return defaultValue;
     }
-    
+
     public Boolean isReserved() {
         return isReserved;
     }
-    
+
     public String getAnnotationValue(String annotation) {
         return annotations.get(annotation.toLowerCase());
     }
-    
+
     public Map<String, String> getAnnotations() {
-      return annotations;
+        return annotations;
     }
 
     public Object validateValue(String value) throws SchemaProviderException {
@@ -77,10 +76,10 @@ public class PropertySchema {
         if (obj == null) {
             throw new SchemaProviderException("Invalid value for porperty '" + name + "': " + value);
         }
-        
-        return obj; 
+
+        return obj;
     }
-    
+
     public String toString() {
         StringBuilder sb = new StringBuilder();
         sb.append("    property: " + getName() + "\n");
@@ -90,11 +89,11 @@ public class PropertySchema {
         sb.append("      reserved: " + isReserved() + "\n");
         sb.append("      default: " + getDefaultValue() + "\n");
         sb.append("      annotations: " + "\n");
-        
+
         for (String annotation : annotations.keySet()) {
             sb.append("        " + annotation + ": " + annotations.get(annotation) + "\n");
         }
-                
+
         return sb.toString();
     }
 }
index 7ad1cfc..a31c70e 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.schemaif.definitions;
 
 import java.util.Map;
 
-
 public class VertexSchema {
     protected String name;
-    protected Map<String,PropertySchema> properties;
-    protected Map<String,String> annotations;
+    protected Map<String, PropertySchema> properties;
+    protected Map<String, String> annotations;
 
     public String getName() {
         return name;
@@ -36,14 +36,14 @@ public class VertexSchema {
         return properties.get(propName.toLowerCase());
     }
 
-    public Map<String,PropertySchema> getPropertySchemaList() {
+    public Map<String, PropertySchema> getPropertySchemaList() {
         return properties;
     }
 
-    public Map<String,String> getAnnotationSchemaList() {
-      return annotations;
+    public Map<String, String> getAnnotationSchemaList() {
+        return annotations;
     }
-    
+
     public String getAnnotationValue(String annotation) {
         return annotations.get(annotation.toLowerCase());
     }
index 52fb4ca..a1d3513 100644 (file)
@@ -21,8 +21,7 @@
 
 package org.onap.aai.schemaif.definitions.types;
 
-
-public class BooleanDataType extends DataType {    
+public class BooleanDataType extends DataType {
     public BooleanDataType() {
         super(Type.BOOL);
     }
@@ -32,7 +31,7 @@ public class BooleanDataType extends DataType {
         if (value.equalsIgnoreCase("true") || (value.equalsIgnoreCase("false"))) {
             return Boolean.parseBoolean(value);
         }
-        
+
         return null;
     }
 }
index e09c18f..98a74d8 100644 (file)
@@ -25,9 +25,9 @@ import java.util.List;
 
 import org.onap.aai.schemaif.definitions.PropertySchema;
 
-public class ComplexDataType extends DataType {    
+public class ComplexDataType extends DataType {
     private List<PropertySchema> subProperties;
-    
+
     public ComplexDataType(List<PropertySchema> subProperties) {
         super(Type.COMPLEX);
         this.subProperties = subProperties;
@@ -36,23 +36,23 @@ public class ComplexDataType extends DataType {
     public List<PropertySchema> getSubProperties() {
         return subProperties;
     }
-    
+
     @Override
     public Object validateValue(String value) {
         // TODO: Validate the complex type against the subProperties
         return value;
     }
-    
+
     public String toString() {
         StringBuilder sb = new StringBuilder();
         sb.append("COMPLEX[ ");
-        
+
         for (PropertySchema prop : getSubProperties()) {
             sb.append(prop.getDataType().toString() + " ");
         }
-        
+
         sb.append("]");
-        
+
         return sb.toString();
     }
 }
index 2e2884b..a51d70f 100644 (file)
@@ -23,14 +23,7 @@ package org.onap.aai.schemaif.definitions.types;
 
 public abstract class DataType {
     public enum Type {
-        STRING,
-        BOOL,
-        INT,
-        LONG,
-        FLOAT,
-        LIST,
-        MAP,
-        COMPLEX
+        STRING, BOOL, INT, LONG, FLOAT, LIST, MAP, COMPLEX
     }
 
     private final Type type;
index 17fb948..d40a984 100644 (file)
 
 package org.onap.aai.schemaif.definitions.types;
 
-public class FloatDataType extends DataType {    
+public class FloatDataType extends DataType {
     public FloatDataType() {
         super(Type.FLOAT);
     }
 
     @Override
     public Object validateValue(String value) {
-        // TODO:  In Tosca, you can impose constraints such as min/max value.
+        // TODO: In Tosca, you can impose constraints such as min/max value.
         // In future we can add this type of validation
         Float floatValue;
         try {
             floatValue = Float.parseFloat(value);
-        }
-        catch (NumberFormatException e) {
+        } catch (NumberFormatException e) {
             return null;
         }
-        
+
         return floatValue;
     }
 }
index 59eb788..0911c8a 100644 (file)
@@ -23,28 +23,26 @@ package org.onap.aai.schemaif.definitions.types;
 
 import java.text.DecimalFormat;
 
-public class IntDataType extends DataType {    
+public class IntDataType extends DataType {
     public IntDataType() {
         super(Type.INT);
     }
 
     @Override
     public Object validateValue(String value) {
-        // TODO:  In Tosca, you can impose constraints such as min/max value.
+        // TODO: In Tosca, you can impose constraints such as min/max value.
         // In future we can add this type of validation
         Integer intValue;
         try {
             intValue = Integer.parseInt(value);
-        }
-        catch (NumberFormatException e) {
+        } catch (NumberFormatException e) {
             // There is an edge case where an int value is stored as "x.0" in champ.
             // In that case, we just want to drop the ".0" and treat it as a proper
             // integer
             try {
                 DecimalFormat decimalFormat = new DecimalFormat("0.#");
                 intValue = Integer.parseInt(decimalFormat.format(Double.valueOf(value)));
-            }
-            catch (Exception ex)  {
+            } catch (Exception ex) {
                 return null;
             }
         }
index 84adefe..4169ba1 100644 (file)
@@ -23,7 +23,7 @@ package org.onap.aai.schemaif.definitions.types;
 
 public class ListDataType extends DataType {
     private DataType listType;
-    
+
     public ListDataType(DataType listType) {
         super(Type.LIST);
         this.listType = listType;
@@ -32,7 +32,7 @@ public class ListDataType extends DataType {
     public DataType getListType() {
         return listType;
     }
-    
+
     @Override
     public Object validateValue(String value) {
         // TODO: Break the string into a list and validate each element against the listType
index 38195f9..1c30054 100644 (file)
 
 package org.onap.aai.schemaif.definitions.types;
 
-public class LongDataType extends DataType {    
+public class LongDataType extends DataType {
     public LongDataType() {
         super(Type.LONG);
     }
 
     @Override
     public Object validateValue(String value) {
-        // TODO:  In Tosca, you can impose constraints such as min/max value.
+        // TODO: In Tosca, you can impose constraints such as min/max value.
         // In future we can add this type of validation
         Long longInt;
         try {
             longInt = Long.parseLong(value);
-        }
-        catch (NumberFormatException e) {
+        } catch (NumberFormatException e) {
             return null;
         }
-        
+
         return longInt;
     }
 }
index 443f460..b08cdb5 100644 (file)
@@ -23,7 +23,7 @@ package org.onap.aai.schemaif.definitions.types;
 
 public class MapDataType extends DataType {
     private DataType mapType;
-    
+
     public MapDataType(DataType mapType) {
         super(Type.MAP);
         this.mapType = mapType;
@@ -32,7 +32,7 @@ public class MapDataType extends DataType {
     public DataType getMapType() {
         return mapType;
     }
-    
+
     @Override
     public Object validateValue(String value) {
         // TODO: Break the string into a map and validate each element against the mapType
index 39487ea..787ccda 100644 (file)
 
 package org.onap.aai.schemaif.definitions.types;
 
-public class StringDataType extends DataType {    
+public class StringDataType extends DataType {
     public StringDataType() {
         super(Type.STRING);
     }
 
     @Override
     public Object validateValue(String value) {
-        // TODO:  In Tosca, you can impose constraints such as string length, regex matches, valid values, 
-        // string length maximums, etc.  In future we can add this type of validation
+        // TODO: In Tosca, you can impose constraints such as string length, regex matches, valid values,
+        // string length maximums, etc. In future we can add this type of validation
         return value;
     }
 }
index e3bc450..89a9eb8 100644 (file)
@@ -18,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.schemaif.json;
 
 import java.util.HashMap;
@@ -30,10 +31,10 @@ import org.onap.aai.schemaif.json.definitions.JsonEdgeSchema;
 
 public class FromJsonEdgeSchema extends EdgeSchema {
     public static final String WILDCARD_CHAR = "*";
-    
+
     public FromJsonEdgeSchema() {
     }
-    
+
     public FromJsonEdgeSchema(EdgeSchema other) {
         // A shallow copy should suffice, as edge definitions don't change.
         name = other.getName();
@@ -43,38 +44,38 @@ public class FromJsonEdgeSchema extends EdgeSchema {
         properties = other.getPropertySchemaList();
         annotations = other.getAnnotations();
     }
-    
+
     public void fromJson(JsonEdgeSchema jsonEdge) throws SchemaProviderException {
 
         name = jsonEdge.getLabel();
         source = jsonEdge.getFrom();
         target = jsonEdge.getTo();
-        
-        // TODO:  At present, multiplicity isn't described in the JSON schema.  By default, make everything
+
+        // TODO: At present, multiplicity isn't described in the JSON schema. By default, make everything
         // many-to-many
         multiplicity = Multiplicity.MANY_2_MANY;
-  
+
         // Populate annotation schema
-        annotations = new HashMap<String,String>();
+        annotations = new HashMap<String, String>();
         if (jsonEdge.getAnnotations() != null) {
-            for (Map.Entry<String,String> entry : jsonEdge.getAnnotations().entrySet()) {
+            for (Map.Entry<String, String> entry : jsonEdge.getAnnotations().entrySet()) {
                 annotations.put(entry.getKey().toLowerCase(), entry.getValue());
             }
         }
-        
+
         // Currently edge properties are not supported in the json schema
-        properties = new HashMap<String,PropertySchema>();
+        properties = new HashMap<String, PropertySchema>();
     }
 
     public void replaceWildcard(String vertexName) throws SchemaProviderException {
         if (source.equals(WILDCARD_CHAR) && target.equals(WILDCARD_CHAR)) {
             throw new SchemaProviderException("Edge definition with wildcard source and target: " + toString());
         }
-        
+
         if (source.equals(WILDCARD_CHAR)) {
             source = vertexName;
         }
-        
+
         if (target.equals(WILDCARD_CHAR)) {
             target = vertexName;
         }
index ea52219..ad1cec2 100644 (file)
@@ -18,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.schemaif.json;
 
 import java.util.ArrayList;
@@ -40,7 +41,8 @@ import org.onap.aai.schemaif.json.definitions.JsonPropertySchema;
 
 public class FromJsonPropertySchema extends PropertySchema {
 
-    public void fromJson(JsonPropertySchema pSchema, boolean reserved, List<DataTypeDefinition> dataTypes) throws SchemaProviderException {
+    public void fromJson(JsonPropertySchema pSchema, boolean reserved, List<DataTypeDefinition> dataTypes)
+            throws SchemaProviderException {
         name = pSchema.getName();
         defaultValue = pSchema.getDefaultValue() == null ? "" : pSchema.getDefaultValue();
         required = pSchema.getRequired() == null ? false : pSchema.getRequired();
@@ -49,68 +51,70 @@ public class FromJsonPropertySchema extends PropertySchema {
         dataType = resolveDataType(pSchema.getDataType(), dataTypes);
 
         // Populate annotations
-        annotations = new HashMap<String,String>();
+        annotations = new HashMap<String, String>();
         if (pSchema.getAnnotations() != null) {
-            for (Map.Entry<String,String> entry : pSchema.getAnnotations().entrySet()) {
+            for (Map.Entry<String, String> entry : pSchema.getAnnotations().entrySet()) {
                 annotations.put(entry.getKey().toLowerCase(), entry.getValue());
             }
         }
     }
-    
-    private DataType resolveDataType(String typeString, List<DataTypeDefinition> dataTypes) throws SchemaProviderException {
-        if (typeString.equalsIgnoreCase("string")) { 
+
+    private DataType resolveDataType(String typeString, List<DataTypeDefinition> dataTypes)
+            throws SchemaProviderException {
+        if (typeString.equalsIgnoreCase("string")) {
             return new StringDataType();
         }
-        
+
         if (typeString.equalsIgnoreCase("integer")) {
             return new IntDataType();
         }
 
         if (typeString.equalsIgnoreCase("long")) {
-          return new LongDataType();
+            return new LongDataType();
         }
-        
+
         if (typeString.equalsIgnoreCase("boolean")) {
             return new BooleanDataType();
         }
-        
+
         if (typeString.startsWith("list:")) {
             String segments[] = typeString.split(":");
             DataType subType = resolveDataType(segments[1], dataTypes);
             return new ListDataType(subType);
         }
-        
+
         if (typeString.startsWith("map:")) {
             String segments[] = typeString.split(":");
             DataType subType = resolveDataType(segments[1], dataTypes);
             return new MapDataType(subType);
         }
-        
+
         // Must be a complex type
         return resolveComplexDataType(typeString, dataTypes);
     }
-    
-    private DataType resolveComplexDataType(String typeString, List<DataTypeDefinition> dataTypes) throws SchemaProviderException {
+
+    private DataType resolveComplexDataType(String typeString, List<DataTypeDefinition> dataTypes)
+            throws SchemaProviderException {
         // It must be a custom/complex type.
         DataTypeDefinition dType = null;
         for (DataTypeDefinition d : dataTypes) {
-            if ( (d.getName().equals(typeString)) ) {
+            if ((d.getName().equals(typeString))) {
                 dType = d;
                 break;
             }
         }
-        
+
         if (dType == null) {
             throw new SchemaProviderException("Invalid data type: " + typeString);
         }
-        
+
         List<PropertySchema> propList = new ArrayList<PropertySchema>();
         for (JsonPropertySchema p : dType.getProperties()) {
             FromJsonPropertySchema pSchema = new FromJsonPropertySchema();
             pSchema.fromJson(p, false, dataTypes);
             propList.add(pSchema);
         }
-        
+
         return new ComplexDataType(propList);
     }
 }
index 7a3251f..5ce4b46 100644 (file)
@@ -18,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.schemaif.json;
 
 import java.util.HashMap;
@@ -31,12 +32,12 @@ import org.onap.aai.schemaif.json.definitions.DataTypeDefinition;
 import org.onap.aai.schemaif.json.definitions.JsonPropertySchema;
 import org.onap.aai.schemaif.json.definitions.JsonVertexSchema;
 
-
 public class FromJsonVertexSchema extends VertexSchema {
-    public void fromJson(JsonVertexSchema jsonVertex, List<DataTypeDefinition> dataTypes, List<JsonPropertySchema> commonProps) throws SchemaProviderException {
+    public void fromJson(JsonVertexSchema jsonVertex, List<DataTypeDefinition> dataTypes,
+            List<JsonPropertySchema> commonProps) throws SchemaProviderException {
         name = jsonVertex.getName();
-        properties = new HashMap<String,PropertySchema>();
-        annotations = new HashMap<String,String>();
+        properties = new HashMap<String, PropertySchema>();
+        annotations = new HashMap<String, String>();
 
         // Populate property schema
         if (jsonVertex.getProperties() != null) {
@@ -46,7 +47,7 @@ public class FromJsonVertexSchema extends VertexSchema {
                 properties.put(propSchema.getName().toLowerCase(), propSchema);
             }
         }
-        
+
         // Add common properties
         if (commonProps != null) {
             for (JsonPropertySchema pSchema : commonProps) {
@@ -54,40 +55,39 @@ public class FromJsonVertexSchema extends VertexSchema {
                 propSchema.fromJson(pSchema, true, dataTypes);
                 properties.put(propSchema.getName().toLowerCase(), propSchema);
             }
-        }
-        else {
-            // TODO:  This is a hack until the schema-service return the list of common props
+        } else {
+            // TODO: This is a hack until the schema-service return the list of common props
             addCommonProps();
         }
-        
+
         // Populate annotation schema
         if (jsonVertex.getAnnotations() != null) {
-            for (Map.Entry<String,String> entry : jsonVertex.getAnnotations().entrySet()) {
+            for (Map.Entry<String, String> entry : jsonVertex.getAnnotations().entrySet()) {
                 annotations.put(entry.getKey().toLowerCase(), entry.getValue());
             }
         }
-        
-        // The searchable and indexed annotations, need to grab these from the property annotations 
+
+        // The searchable and indexed annotations, need to grab these from the property annotations
         // and store them at the vertex level as well (backwards compatibility with OXM)
         StringBuilder searchableVal = new StringBuilder();
         StringBuilder indexedVal = new StringBuilder();
         for (PropertySchema pSchema : properties.values()) {
-            if ( (pSchema.getAnnotationValue("searchable") != null) 
-                    && (pSchema.getAnnotationValue("searchable").equalsIgnoreCase("true")) ) {
+            if ((pSchema.getAnnotationValue("searchable") != null)
+                    && (pSchema.getAnnotationValue("searchable").equalsIgnoreCase("true"))) {
                 if (searchableVal.length() > 0) {
                     searchableVal.append(",");
                 }
                 searchableVal.append(pSchema.getName());
             }
-            if ( (pSchema.getAnnotationValue("indexed") != null) 
-                    && (pSchema.getAnnotationValue("indexed").equalsIgnoreCase("true")) ) {
+            if ((pSchema.getAnnotationValue("indexed") != null)
+                    && (pSchema.getAnnotationValue("indexed").equalsIgnoreCase("true"))) {
                 if (indexedVal.length() > 0) {
                     indexedVal.append(",");
                 }
                 indexedVal.append(pSchema.getName());
             }
         }
-        
+
         if (searchableVal.length() > 0) {
             annotations.put("searchable", searchableVal.toString());
         }
@@ -105,10 +105,11 @@ public class FromJsonVertexSchema extends VertexSchema {
         addCommonProperty("aai-last-mod-ts", false, false, "string", "false");
         addCommonProperty("source-of-truth", false, false, "string", "false");
         addCommonProperty("aai-uri", false, false, "string", "false");
-        
+
     }
-    
-    private void addCommonProperty(String name, boolean req, boolean unique, String type, String indexed) throws SchemaProviderException {
+
+    private void addCommonProperty(String name, boolean req, boolean unique, String type, String indexed)
+            throws SchemaProviderException {
         JsonPropertySchema pSchema = new JsonPropertySchema();
         pSchema.setName(name);
         pSchema.setRequired(req);
@@ -116,14 +117,14 @@ public class FromJsonVertexSchema extends VertexSchema {
         pSchema.setDataType(type);
         pSchema.setDescription("");
         pSchema.setDefaultValue("");
-        
-        Map<String,String> propAnnotations = new HashMap<String,String>();
+
+        Map<String, String> propAnnotations = new HashMap<String, String>();
         propAnnotations.put("indexed", indexed);
         propAnnotations.put("searchable", "false");
         propAnnotations.put("source_of_truth_type", "AAI");
 
         pSchema.setAnnotations(propAnnotations);
-        
+
         FromJsonPropertySchema propSchema = new FromJsonPropertySchema();
         propSchema.fromJson(pSchema, true, null);
 
index 78ae6a6..637bbfe 100644 (file)
@@ -18,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.schemaif.json;
 
 import java.io.BufferedOutputStream;
@@ -50,13 +51,12 @@ import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.client.RestTemplate;
 
-
 public class JsonSchemaProvider implements SchemaProvider {
     // Logger logger = LoggerFactory.getInstance().getLogger(JsonSchemaProvider.class.getName());
     Logger logger = LoggerFactory.getInstance().getLogger(SchemaProvider.class);
 
     private JsonSchemaProviderConfig config;
-    private Map<String,SchemaInstance> schemaCache = new ConcurrentHashMap<>();
+    private Map<String, SchemaInstance> schemaCache = new ConcurrentHashMap<>();
     private RestTemplate restTemplate = null;
 
     public JsonSchemaProvider(JsonSchemaProviderConfig config) {
@@ -140,7 +140,6 @@ public class JsonSchemaProvider implements SchemaProvider {
             return;
         }
 
-
         String url = config.getSchemaServiceBaseUrl() + "/" + version;
 
         HttpHeaders headers = new HttpHeaders();
@@ -148,30 +147,28 @@ public class JsonSchemaProvider implements SchemaProvider {
         headers.put("X-TransactionId", Arrays.asList(java.util.UUID.randomUUID().toString()));
         headers.setAccept(Arrays.asList(org.springframework.http.MediaType.APPLICATION_OCTET_STREAM));
 
-        HttpEntity <String> entity = new HttpEntity<>(headers);
+        HttpEntity<String> entity = new HttpEntity<>(headers);
 
         ResponseEntity<byte[]> response = restTemplate.exchange(url, HttpMethod.GET, entity, byte[].class);
 
-
         if (response.getStatusCodeValue() == HttpStatus.NOT_FOUND.value()) {
             logger.warn(SchemaProviderMsgs.SCHEMA_LOAD_ERROR, "version " + version + " not found");
             throw new SchemaProviderException("Schema version " + version + " not found");
-        }
-        else if (response.getStatusCodeValue() != HttpStatus.OK.value()) {
-            logger.error(SchemaProviderMsgs.SCHEMA_LOAD_ERROR, "failed to load version " + version + ": " + response.getBody());
+        } else if (response.getStatusCodeValue() != HttpStatus.OK.value()) {
+            logger.error(SchemaProviderMsgs.SCHEMA_LOAD_ERROR,
+                    "failed to load version " + version + ": " + response.getBody());
             throw new SchemaProviderException("Error getting schema version " + version + ":" + response.getBody());
         }
 
         try {
             SchemaServiceResponse resp = SchemaServiceResponse.fromJson(unzipAndGetJSONString(response.getBody()));
             loadSchema(resp.getData().toJson(), version);
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
             ex.printStackTrace(printWriter);
-            logger.error(SchemaProviderMsgs.SCHEMA_LOAD_ERROR, "failed to load version " + version + ": "
-                    + response.getBody() + "\n" + writer.toString());
+            logger.error(SchemaProviderMsgs.SCHEMA_LOAD_ERROR,
+                    "failed to load version " + version + ": " + response.getBody() + "\n" + writer.toString());
             throw new SchemaProviderException("Error loading schema version " + version + ":" + ex.getMessage());
 
         }
@@ -181,14 +178,15 @@ public class JsonSchemaProvider implements SchemaProvider {
 
     static final int BUFFER = 512;
     static final long TOOBIG = 0x6400000; // Max size of unzipped data, 100MB
-    static final int TOOMANY = 1024;      // Max number of files
+    static final int TOOMANY = 1024; // Max number of files
 
     protected String unzipAndGetJSONString(byte[] inputData) throws java.io.IOException {
         ZipEntry entry;
         String result = "";
         int entries = 0;
         long total = 0;
-        try (ByteArrayInputStream bis = new ByteArrayInputStream(inputData); ZipInputStream zis = new ZipInputStream(bis)) {
+        try (ByteArrayInputStream bis = new ByteArrayInputStream(inputData);
+                ZipInputStream zis = new ZipInputStream(bis)) {
             while ((entry = zis.getNextEntry()) != null) {
                 int count;
                 byte[] data = new byte[BUFFER];
@@ -218,7 +216,7 @@ public class JsonSchemaProvider implements SchemaProvider {
     }
 
     private SchemaInstance getSchemaVersion(String version) throws SchemaProviderException {
-        // TODO:  For now, we are only supporting a single version of the schema.  Load that
+        // TODO: For now, we are only supporting a single version of the schema. Load that
         // version regardless of what the client asks for.
         String versionToLoad = getLatestSchemaVersion();
         SchemaInstance inst = schemaCache.get(versionToLoad);
@@ -236,7 +234,7 @@ public class JsonSchemaProvider implements SchemaProvider {
 
     @Override
     public Map<String, VertexSchema> getVertexMap(String schemaVersion) throws SchemaProviderException {
-      return getSchemaVersion(schemaVersion).getVertexMap();
+        return getSchemaVersion(schemaVersion).getVertexMap();
     }
 
 }
index 3a235f6..b5d85d8 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-package org.onap.aai.schemaif.json;
 
+package org.onap.aai.schemaif.json;
 
 public class JsonSchemaProviderConfig {
-    
+
     private String schemaServiceBaseUrl;
     private String schemaServiceCertFile;
     private String schemaServiceCertPwd;
     private String serviceName;
-    
+
     public String getSchemaServiceBaseUrl() {
         return schemaServiceBaseUrl;
     }
+
     public void setSchemaServiceBaseUrl(String schemaServiceBaseUrl) {
         this.schemaServiceBaseUrl = schemaServiceBaseUrl;
     }
-    
+
     public String getSchemaServiceCertFile() {
         return schemaServiceCertFile;
     }
+
     public void setSchemaServiceCertFile(String schemaServiceCertFile) {
         this.schemaServiceCertFile = schemaServiceCertFile;
     }
-    
+
     public String getSchemaServiceCertPwd() {
         return schemaServiceCertPwd;
     }
+
     public void setSchemaServiceCertPwd(String schemaServiceCertPwd) {
         this.schemaServiceCertPwd = schemaServiceCertPwd;
     }
-    
+
     public String getServiceName() {
         return serviceName;
     }
+
     public void setServiceName(String serviceName) {
         this.serviceName = serviceName;
     }
index 77a1c56..cfd9386 100644 (file)
@@ -33,49 +33,48 @@ import org.onap.aai.schemaif.definitions.VertexSchema;
 public class SchemaInstance {
     // vertex-name -> vertex-schema
     private Map<String, VertexSchema> vertexMap = new HashMap<>();
-    
+
     // source:target:type -> edge-schema
     private Map<String, EdgeSchema> edgeKeyMap = new HashMap<>();
-    
+
     // source:target -> edge-schema
     private Map<String, Set<EdgeSchema>> edgeSourceTargetMap = new HashMap<>();
-    
+
     // vertex-name -> edge-schema
     private Map<String, Set<EdgeSchema>> vertexEdgeMap = new HashMap<>();
-    
+
     public VertexSchema getVertexSchema(String vertexName) {
         return vertexMap.get(vertexName.toLowerCase());
     }
-    
+
     public EdgeSchema getEdgeSchema(String source, String target, String type) {
         return edgeKeyMap.get(generateEdgeKey(source, target, type));
     }
-    
+
     public Set<EdgeSchema> getEdgeSchemas(String source, String target) {
         return edgeSourceTargetMap.get(source.toLowerCase() + ":" + target.toLowerCase());
     }
-    
+
     public Set<EdgeSchema> getEdgeSchema(String vertexName) {
         return vertexEdgeMap.get(vertexName.toLowerCase());
     }
-    
+
     public void addVertex(VertexSchema v) {
         vertexMap.put(v.getName().toLowerCase(), v);
     }
-    
+
     public void addEdge(EdgeSchema e) throws SchemaProviderException {
-        if (e.getSource().equals(FromJsonEdgeSchema.WILDCARD_CHAR) || 
-                e.getTarget().equals(FromJsonEdgeSchema.WILDCARD_CHAR)) {
+        if (e.getSource().equals(FromJsonEdgeSchema.WILDCARD_CHAR)
+                || e.getTarget().equals(FromJsonEdgeSchema.WILDCARD_CHAR)) {
             // Handle wildcard edges
             for (VertexSchema vertex : vertexMap.values()) {
                 addWildcardEdge(e, vertex);
             }
-        }
-        else {
+        } else {
             addEdgeInternal(e);
         }
     }
-    
+
     private void addWildcardEdge(EdgeSchema e, VertexSchema vertex) throws SchemaProviderException {
         FromJsonEdgeSchema newEdge = new FromJsonEdgeSchema(e);
         newEdge.replaceWildcard(vertex.getName());
@@ -84,38 +83,38 @@ public class SchemaInstance {
 
     private void addEdgeInternal(EdgeSchema e) {
         edgeKeyMap.put(generateEdgeKey(e.getSource(), e.getTarget(), e.getName()), e);
-        
+
         Set<EdgeSchema> edgeListSource = vertexEdgeMap.get(e.getSource().toLowerCase());
         Set<EdgeSchema> edgeListTarget = vertexEdgeMap.get(e.getTarget().toLowerCase());
-        
+
         if (edgeListSource == null) {
             edgeListSource = new HashSet<EdgeSchema>();
         }
         if (edgeListTarget == null) {
             edgeListTarget = new HashSet<EdgeSchema>();
         }
-        
+
         edgeListSource.add(e);
         edgeListTarget.add(e);
         vertexEdgeMap.put(e.getSource().toLowerCase(), edgeListSource);
         vertexEdgeMap.put(e.getTarget().toLowerCase(), edgeListTarget);
-        
+
         String sourceTargetKey = e.getSource().toLowerCase() + ":" + e.getTarget().toLowerCase();
         Set<EdgeSchema> edgeList = edgeSourceTargetMap.get(sourceTargetKey);
         if (edgeList == null) {
             edgeList = new HashSet<EdgeSchema>();
         }
-        
+
         edgeList.add(e);
         edgeSourceTargetMap.put(sourceTargetKey, edgeList);
     }
-    
+
     private String generateEdgeKey(String source, String target, String type) {
         String key = source + ":" + target + ":" + type;
         return key.toLowerCase();
     }
 
     public Map<String, VertexSchema> getVertexMap() {
-      return vertexMap;
+        return vertexMap;
     }
 }
index 0bc1760..c5baf00 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.schemaif.json;
 
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.google.gson.annotations.SerializedName;
+
 import org.onap.aai.schemaif.SchemaProviderException;
 import org.onap.aai.schemaif.json.definitions.JsonSchema;
 
index 5be74c3..3f17c9b 100644 (file)
@@ -21,7 +21,6 @@
 
 package org.onap.aai.schemaif.json;
 
-
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.net.HttpURLConnection;
@@ -38,7 +37,6 @@ import javax.net.ssl.X509TrustManager;
 
 import org.springframework.http.client.SimpleClientHttpRequestFactory;
 
-
 public class SecureClientHttpRequestFactory extends SimpleClientHttpRequestFactory {
 
     private static final String SSL_PROTOCOL = "TLS";
@@ -46,18 +44,15 @@ public class SecureClientHttpRequestFactory extends SimpleClientHttpRequestFacto
     private static final String KEYSTORE_TYPE = "PKCS12";
     private JsonSchemaProviderConfig config;
 
-
-    public SecureClientHttpRequestFactory(JsonSchemaProviderConfig  config) {
+    public SecureClientHttpRequestFactory(JsonSchemaProviderConfig config) {
         super();
         this.config = config;
     }
 
     @Override
-    protected void prepareConnection(final HttpURLConnection connection, final String httpMethod)
-        throws IOException {
+    protected void prepareConnection(final HttpURLConnection connection, final String httpMethod) throws IOException {
         if (connection instanceof HttpsURLConnection) {
-            ((HttpsURLConnection) connection)
-                .setSSLSocketFactory(getSSLContext().getSocketFactory());
+            ((HttpsURLConnection) connection).setSSLSocketFactory(getSSLContext().getSocketFactory());
             ((HttpsURLConnection) connection).setHostnameVerifier(new HostnameVerifier() {
                 @Override
                 public boolean verify(String str, SSLSession sslSession) {
@@ -95,7 +90,7 @@ public class SecureClientHttpRequestFactory extends SimpleClientHttpRequestFacto
             KeyStore ks = KeyStore.getInstance(KEYSTORE_TYPE);
 
             char[] pwd = null;
-            if (config.getSchemaServiceCertPwd()!= null) {
+            if (config.getSchemaServiceCertPwd() != null) {
                 pwd = config.getSchemaServiceCertPwd().toCharArray();
             }
 
index 93c67bd..5968053 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.schemaif.json.definitions;
 
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
 import java.util.List;
 
 import org.onap.aai.schemaif.SchemaProviderException;
 
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
 public class DataTypeDefinition {
     private static final Gson gson = new GsonBuilder().create();
-    
+
     private String name;
     private String description;
     private List<JsonPropertySchema> properties;
-    
+
     public String getName() {
         return name;
     }
@@ -57,9 +58,9 @@ public class DataTypeDefinition {
     public void setProperties(List<JsonPropertySchema> properties) {
         this.properties = properties;
     }
-    
+
     public void validate() throws SchemaProviderException {
-        if ( (getName() == null) || (getName().isEmpty()) ) {
+        if ((getName() == null) || (getName().isEmpty())) {
             throw new SchemaProviderException("Type definition missing a name");
         }
 
@@ -69,19 +70,18 @@ public class DataTypeDefinition {
             }
         }
     }
-    
+
     public String toJson() {
         return gson.toJson(this);
     }
-    
+
     public static DataTypeDefinition fromJson(String json) {
         return gson.fromJson(json, DataTypeDefinition.class);
     }
 
     @Override
     public String toString() {
-        return "DataTypeDefinition [name=" + name + ", description=" + description + ", properties="
-            + properties + "]";
+        return "DataTypeDefinition [name=" + name + ", description=" + description + ", properties=" + properties + "]";
     }
 
     @Override
@@ -120,6 +120,5 @@ public class DataTypeDefinition {
             return false;
         return true;
     }
-    
-    
+
 }
index ffbc54d..b75f32d 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.schemaif.json.definitions;
 
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
 
 import java.util.Map;
 
 import org.onap.aai.schemaif.SchemaProviderException;
 
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
 public class JsonEdgeSchema {
     private static final Gson gson = new GsonBuilder().create();
-    
+
     private String from;
     private String to;
     private String label;
-    private Map<String,String> annotations;
-    
+    private Map<String, String> annotations;
+
     public String getFrom() {
         return from;
     }
+
     public void setFrom(String from) {
         this.from = from;
     }
-    
+
     public String getTo() {
         return to;
     }
+
     public void setTo(String to) {
         this.to = to;
     }
-    
+
     public String getLabel() {
         return label;
     }
+
     public void setLabel(String label) {
         this.label = label;
     }
-    
-    public Map<String,String> getAnnotations() {
+
+    public Map<String, String> getAnnotations() {
         return annotations;
     }
-    public void setAnnotations(Map<String,String> annotations) {
+
+    public void setAnnotations(Map<String, String> annotations) {
         this.annotations = annotations;
     }
-    
+
     public void validate() throws SchemaProviderException {
-        if ( (getTo() == null) || (getTo().isEmpty()) ) {
+        if ((getTo() == null) || (getTo().isEmpty())) {
             throw new SchemaProviderException("Edge definition missing 'to'");
         }
-        
-        if ( (getFrom() == null) || (getFrom().isEmpty()) ) {
+
+        if ((getFrom() == null) || (getFrom().isEmpty())) {
             throw new SchemaProviderException("Edge definition missing 'from'");
         }
-        
-        if ( (getLabel() == null) || (getLabel().isEmpty()) ) {
+
+        if ((getLabel() == null) || (getLabel().isEmpty())) {
             throw new SchemaProviderException("Edge definition missing 'label'");
         }
     }
-    
+
     public String toJson() {
         return gson.toJson(this);
     }
-    
+
     public static JsonEdgeSchema fromJson(String json) {
         return gson.fromJson(json, JsonEdgeSchema.class);
     }
+
     @Override
     public String toString() {
-        return "JsonEdgeSchema [from=" + from + ", to=" + to + ", label=" + label + ", annotations="
-            + annotations + "]";
+        return "JsonEdgeSchema [from=" + from + ", to=" + to + ", label=" + label + ", annotations=" + annotations
+                + "]";
     }
+
     @Override
     public int hashCode() {
         final int prime = 31;
@@ -100,6 +106,7 @@ public class JsonEdgeSchema {
         result = prime * result + ((to == null) ? 0 : to.hashCode());
         return result;
     }
+
     @Override
     public boolean equals(Object obj) {
         if (this == obj)
@@ -131,5 +138,5 @@ public class JsonEdgeSchema {
             return false;
         return true;
     }
-    
+
 }
index b6934eb..25cd0a8 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-package org.onap.aai.schemaif.json.definitions;
-
-import java.util.Map;
 
-import org.onap.aai.schemaif.SchemaProviderException;
+package org.onap.aai.schemaif.json.definitions;
 
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.google.gson.annotations.SerializedName;
 
+import java.util.Map;
+
+import org.onap.aai.schemaif.SchemaProviderException;
+
 public class JsonPropertySchema {
     private static final Gson gson = new GsonBuilder().create();
-    
+
     private String name;
     private Boolean required;
     private Boolean unique;
-    
+
     @SerializedName("type")
     private String dataType;
-    
+
     private String description;
-    
+
     @SerializedName("default")
     private String defaultValue;
-    
-    private Map<String,String> annotations;
-    
+
+    private Map<String, String> annotations;
+
     public String getName() {
         return name;
     }
@@ -76,7 +77,7 @@ public class JsonPropertySchema {
     public void setDataType(String dataType) {
         this.dataType = dataType;
     }
-    
+
     public String getDefaultValue() {
         return defaultValue;
     }
@@ -92,39 +93,38 @@ public class JsonPropertySchema {
     public void setDescription(String description) {
         this.description = description;
     }
-    
-    public Map<String,String> getAnnotations() {
+
+    public Map<String, String> getAnnotations() {
         return annotations;
     }
 
-    public void setAnnotations(Map<String,String> annotations) {
+    public void setAnnotations(Map<String, String> annotations) {
         this.annotations = annotations;
     }
 
     public void validate() throws SchemaProviderException {
-        if ( (getName() == null) || (getName().isEmpty()) ) {
+        if ((getName() == null) || (getName().isEmpty())) {
             throw new SchemaProviderException(getName() + " property has no name");
         }
 
-        if ( (getDataType() == null) || (getDataType().isEmpty()) ) {
+        if ((getDataType() == null) || (getDataType().isEmpty())) {
             throw new SchemaProviderException(getName() + " property has no type");
         }
     }
 
-
     public String toJson() {
         return gson.toJson(this);
     }
-    
+
     public static JsonVertexSchema fromJson(String json) {
         return gson.fromJson(json, JsonVertexSchema.class);
     }
 
     @Override
     public String toString() {
-        return "JsonPropertySchema [name=" + name + ", required=" + required + ", unique=" + unique
-            + ", dataType=" + dataType + ", description=" + description + ", defaultValue="
-            + defaultValue + ", annotations=" + annotations + "]";
+        return "JsonPropertySchema [name=" + name + ", required=" + required + ", unique=" + unique + ", dataType="
+                + dataType + ", description=" + description + ", defaultValue=" + defaultValue + ", annotations="
+                + annotations + "]";
     }
 
     @Override
@@ -187,6 +187,5 @@ public class JsonPropertySchema {
             return false;
         return true;
     }
-    
-    
+
 }
index b9cacb8..5d292bd 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-package org.onap.aai.schemaif.json.definitions;
-
-import java.util.List;
 
-import org.onap.aai.schemaif.SchemaProviderException;
+package org.onap.aai.schemaif.json.definitions;
 
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.google.gson.annotations.SerializedName;
 
+import java.util.List;
+
+import org.onap.aai.schemaif.SchemaProviderException;
+
 public class JsonSchema {
     private static final Gson gson = new GsonBuilder().create();
 
     @SerializedName("relationship_types")
     private List<JsonEdgeSchema> relationshipTypes;
-    
+
     @SerializedName("node_types")
     private List<JsonVertexSchema> nodeTypes;
-    
+
     @SerializedName("data_types")
     private List<DataTypeDefinition> dataTypes;
-    
+
     @SerializedName("common_node_properties")
     private List<JsonPropertySchema> commonNodeProps;
 
-    
     public void setRelationshipTypes(List<JsonEdgeSchema> relationshipTypes) {
-               this.relationshipTypes = relationshipTypes;
-       }
+        this.relationshipTypes = relationshipTypes;
+    }
 
-       public void setNodeTypes(List<JsonVertexSchema> nodeTypes) {
-               this.nodeTypes = nodeTypes;
-       }
+    public void setNodeTypes(List<JsonVertexSchema> nodeTypes) {
+        this.nodeTypes = nodeTypes;
+    }
 
-       public void setDataTypes(List<DataTypeDefinition> dataTypes) {
-               this.dataTypes = dataTypes;
-       }
+    public void setDataTypes(List<DataTypeDefinition> dataTypes) {
+        this.dataTypes = dataTypes;
+    }
 
-       public List<JsonEdgeSchema> getRelationshipTypes() {
+    public List<JsonEdgeSchema> getRelationshipTypes() {
         return relationshipTypes;
     }
-    
+
     public List<JsonVertexSchema> getNodeTypes() {
         return nodeTypes;
     }
-    
+
     public List<DataTypeDefinition> getDataTypes() {
         return dataTypes;
     }
-    
+
     public List<JsonPropertySchema> getCommonProperties() {
         return commonNodeProps;
     }
@@ -75,21 +75,21 @@ public class JsonSchema {
     public void setCommonProperties(List<JsonPropertySchema> properties) {
         this.commonNodeProps = properties;
     }
-    
+
     public void validate() throws SchemaProviderException {
         if (getNodeTypes() != null) {
             for (JsonVertexSchema vertexSchema : getNodeTypes()) {
                 vertexSchema.validate();
             }
         }
-        
+
         // Validate edges
         if (getRelationshipTypes() != null) {
             for (JsonEdgeSchema edgeSchema : getRelationshipTypes()) {
                 edgeSchema.validate();
             }
         }
-        
+
         // Validate data types
         if (getDataTypes() != null) {
             for (DataTypeDefinition typeSchema : getDataTypes()) {
@@ -97,7 +97,7 @@ public class JsonSchema {
             }
         }
     }
-    
+
     public String toJson() {
         return gson.toJson(this);
     }
@@ -107,7 +107,7 @@ public class JsonSchema {
             if (json == null || json.isEmpty()) {
                 throw new SchemaProviderException("Empty schema definition");
             }
-            
+
             return gson.fromJson(json, JsonSchema.class);
         } catch (Exception ex) {
             throw new SchemaProviderException("Invalid json: " + ex.getMessage());
@@ -116,8 +116,8 @@ public class JsonSchema {
 
     @Override
     public String toString() {
-        return "JsonSchema [relationshipTypes=" + relationshipTypes + ", nodeTypes=" + nodeTypes
-            + ", dataTypes=" + dataTypes + ", commonNodeProps=" + commonNodeProps + "]";
+        return "JsonSchema [relationshipTypes=" + relationshipTypes + ", nodeTypes=" + nodeTypes + ", dataTypes="
+                + dataTypes + ", commonNodeProps=" + commonNodeProps + "]";
     }
 
     @Override
@@ -163,5 +163,4 @@ public class JsonSchema {
         return true;
     }
 
-    
 }
index 87a1eac..2fc2c80 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.schemaif.json.definitions;
 
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
 import java.util.List;
 import java.util.Map;
 
 import org.onap.aai.schemaif.SchemaProviderException;
 
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
 public class JsonVertexSchema {
     private static final Gson gson = new GsonBuilder().create();
-    
+
     private String name;
     private String description;
     private List<JsonPropertySchema> properties;
-    private Map<String,String> annotations;
-    
+    private Map<String, String> annotations;
+
     public String getName() {
         return name;
     }
@@ -59,17 +60,17 @@ public class JsonVertexSchema {
     public void setProperties(List<JsonPropertySchema> properties) {
         this.properties = properties;
     }
-    
-    public Map<String,String> getAnnotations() {
+
+    public Map<String, String> getAnnotations() {
         return annotations;
     }
 
-    public void setAnnotations(Map<String,String> annotations) {
+    public void setAnnotations(Map<String, String> annotations) {
         this.annotations = annotations;
     }
 
     public void validate() throws SchemaProviderException {
-        if ( (getName() == null) || (getName().isEmpty()) ) {
+        if ((getName() == null) || (getName().isEmpty())) {
             throw new SchemaProviderException("Node definition missing a name");
         }
 
@@ -79,19 +80,19 @@ public class JsonVertexSchema {
             }
         }
     }
-    
+
     public String toJson() {
         return gson.toJson(this);
     }
-    
+
     public static JsonVertexSchema fromJson(String json) {
         return gson.fromJson(json, JsonVertexSchema.class);
     }
 
     @Override
     public String toString() {
-        return "JsonVertexSchema [name=" + name + ", description=" + description + ", properties="
-            + properties + ", annotations=" + annotations + "]";
+        return "JsonVertexSchema [name=" + name + ", description=" + description + ", properties=" + properties
+                + ", annotations=" + annotations + "]";
     }
 
     @Override
@@ -136,6 +137,5 @@ public class JsonVertexSchema {
             return false;
         return true;
     }
-    
-    
+
 }
index bd30e77..abe0c5c 100644 (file)
@@ -18,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.schemaif.oxm;
 
 import org.springframework.beans.factory.annotation.Value;
index 336b6d9..3958a62 100644 (file)
@@ -18,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.schemaif.oxm;
 
 import java.util.HashMap;
@@ -29,14 +30,13 @@ import org.onap.aai.schemaif.definitions.EdgeSchema;
 import org.onap.aai.schemaif.definitions.PropertySchema;
 import org.onap.aai.schemaif.definitions.types.DataType;
 
-
 public class FromOxmEdgeSchema extends EdgeSchema {
 
     public void fromEdgeRule(EdgeRule edgeRule) throws SchemaProviderException {
         name = edgeRule.getLabel();
         source = edgeRule.getFrom();
         target = edgeRule.getTo();
-        
+
         switch (edgeRule.getMultiplicityRule()) {
             case MANY2MANY:
                 multiplicity = Multiplicity.MANY_2_MANY;
@@ -52,22 +52,22 @@ public class FromOxmEdgeSchema extends EdgeSchema {
                 break;
         }
 
-        annotations = new HashMap<String,String>();
-        properties = new HashMap<String,PropertySchema>();
-        
-        // TODO:  For now these are hard-coded ... should read them from a config file or something
+        annotations = new HashMap<String, String>();
+        properties = new HashMap<String, PropertySchema>();
+
+        // TODO: For now these are hard-coded ... should read them from a config file or something
         annotations.put(EdgeProperty.CONTAINS.toString().toLowerCase(), edgeRule.getContains());
         annotations.put(EdgeProperty.DELETE_OTHER_V.toString().toLowerCase(), edgeRule.getDeleteOtherV());
         annotations.put(EdgeProperty.PREVENT_DELETE.toString().toLowerCase(), edgeRule.getPreventDelete());
-        
+
         FromOxmPropertySchema pSchema = new FromOxmPropertySchema();
         pSchema.fromRelationship(EdgeProperty.CONTAINS.toString(), DataType.Type.STRING);
         properties.put(EdgeProperty.CONTAINS.toString().toLowerCase(), pSchema);
-        
+
         pSchema = new FromOxmPropertySchema();
         pSchema.fromRelationship(EdgeProperty.DELETE_OTHER_V.toString(), DataType.Type.STRING);
         properties.put(EdgeProperty.DELETE_OTHER_V.toString().toLowerCase(), pSchema);
-        
+
         pSchema = new FromOxmPropertySchema();
         pSchema.fromRelationship(EdgeProperty.PREVENT_DELETE.toString(), DataType.Type.STRING);
         properties.put(EdgeProperty.PREVENT_DELETE.toString().toLowerCase(), pSchema);
index 2174bce..bb9f3d8 100644 (file)
@@ -18,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.schemaif.oxm;
 
 import java.util.HashMap;
@@ -37,7 +38,6 @@ import org.onap.aai.schemaif.definitions.types.IntDataType;
 import org.onap.aai.schemaif.definitions.types.LongDataType;
 import org.onap.aai.schemaif.definitions.types.StringDataType;
 
-
 public class FromOxmPropertySchema extends PropertySchema {
 
     // Handle vertex properties from OXM
@@ -55,8 +55,7 @@ public class FromOxmPropertySchema extends PropertySchema {
         if (isPrimaryKeyOxm(name, dynType)) {
             unique = true;
             required = true;
-        }
-        else {
+        } else {
             required = ((XMLField) field).isRequired();
             unique = false;
         }
@@ -82,13 +81,13 @@ public class FromOxmPropertySchema extends PropertySchema {
                 throw new SchemaProviderException("Invalid OXM property type: " + oxmType);
             }
         }
-        
+
         // Check annotations
-        annotations = new HashMap<String,String>();
+        annotations = new HashMap<String, String>();
         Map<String, Object> oxmProps = mapping.getProperties();
         for (Map.Entry<String, Object> entry : oxmProps.entrySet()) {
             if (entry.getValue() instanceof String) {
-                annotations.put(entry.getKey().toLowerCase(), (String)entry.getValue());
+                annotations.put(entry.getKey().toLowerCase(), (String) entry.getValue());
             }
         }
     }
@@ -99,8 +98,8 @@ public class FromOxmPropertySchema extends PropertySchema {
         required = false;
         defaultValue = "";
         unique = false;
-        annotations = new HashMap<String,String>();
-        
+        annotations = new HashMap<String, String>();
+
         switch (propDataType) {
             case STRING:
                 dataType = new StringDataType();
@@ -118,13 +117,13 @@ public class FromOxmPropertySchema extends PropertySchema {
                 dataType = new BooleanDataType();
                 break;
             default:
-                throw new SchemaProviderException("Invalid EdgeRule property type: " + propDataType);    
+                throw new SchemaProviderException("Invalid EdgeRule property type: " + propDataType);
         }
     }
-    
+
     private boolean isPrimaryKeyOxm(String propName, DynamicType dynType) {
         List<String> primaryKeyList = dynType.getDescriptor().getPrimaryKeyFieldNames();
-        if ( (primaryKeyList == null) || (primaryKeyList.size() == 0) ) {
+        if ((primaryKeyList == null) || (primaryKeyList.size() == 0)) {
             return false;
         }
 
index 6083429..95ed2f5 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.schemaif.oxm;
 
+import com.google.common.base.CaseFormat;
+
 import java.util.HashMap;
 import java.util.Map;
 
@@ -32,13 +35,12 @@ import org.onap.aai.schemaif.SchemaProviderException;
 import org.onap.aai.schemaif.definitions.PropertySchema;
 import org.onap.aai.schemaif.definitions.VertexSchema;
 
-import com.google.common.base.CaseFormat;
-
 public class FromOxmVertexSchema extends VertexSchema {
-    public void fromOxm(String vertexType, DynamicJAXBContext jaxbContext, HashMap<String, DynamicType> xmlElementLookup) throws SchemaProviderException {
+    public void fromOxm(String vertexType, DynamicJAXBContext jaxbContext,
+            HashMap<String, DynamicType> xmlElementLookup) throws SchemaProviderException {
         name = vertexType;
-        properties = new HashMap<String,PropertySchema>();
-        annotations = new HashMap<String,String>();
+        properties = new HashMap<String, PropertySchema>();
+        annotations = new HashMap<String, String>();
 
         String javaTypeName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, vertexType);
         DynamicType modelObjectType = jaxbContext.getDynamicType(javaTypeName);
@@ -62,21 +64,21 @@ public class FromOxmVertexSchema extends VertexSchema {
             // Vertex isn't found in the OXM
             throw new SchemaProviderException("Vertex " + vertexType + " not found in OXM");
         }
-        
+
         // Check annotations
         Map<String, Object> oxmProps = modelObjectType.getDescriptor().getProperties();
         for (Map.Entry<String, Object> entry : oxmProps.entrySet()) {
             if (entry.getValue() instanceof String) {
-                annotations.put(entry.getKey().toLowerCase(), (String)entry.getValue());
+                annotations.put(entry.getKey().toLowerCase(), (String) entry.getValue());
             }
         }
 
         // Regular props
         for (DatabaseMapping mapping : modelObjectType.getDescriptor().getMappings()) {
             if (mapping instanceof XMLAnyObjectMapping)
-              continue;
-            if(mapping instanceof XMLAnyCollectionMapping)
-              continue;
+                continue;
+            if (mapping instanceof XMLAnyCollectionMapping)
+                continue;
             FromOxmPropertySchema propSchema = new FromOxmPropertySchema();
             propSchema.fromOxm(mapping, modelObjectType, false);
             properties.put(propSchema.getName().toLowerCase(), propSchema);
@@ -90,6 +92,6 @@ public class FromOxmVertexSchema extends VertexSchema {
                 propSchema.fromOxm(mapping, reservedType, true);
                 properties.put(propSchema.getName().toLowerCase(), propSchema);
             }
-        } 
+        }
     }
 }
index 93508fc..b404ccf 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.schemaif.oxm;
 
+import com.google.common.collect.Multimap;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -45,8 +48,6 @@ import org.onap.aai.setup.Translator;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import com.google.common.collect.Multimap;
-
 @Component
 public class OxmEdgeRulesLoader {
 
@@ -63,10 +64,10 @@ public class OxmEdgeRulesLoader {
     final static Pattern propsFilePattern = Pattern.compile(propsPrefix + "(.*)" + propsSuffix);
     final static Pattern propsVersionPattern = Pattern.compile("(?i)v\\d*");
 
-    private static Logger logger =
-            LoggerFactory.getInstance().getLogger(OxmEdgeRulesLoader.class.getName());
+    private static Logger logger = LoggerFactory.getInstance().getLogger(OxmEdgeRulesLoader.class.getName());
 
-    private OxmEdgeRulesLoader() {}
+    private OxmEdgeRulesLoader() {
+    }
 
     /**
      * This constructor presents an awkward marrying of Spring bean creation and static method use. This
@@ -88,7 +89,7 @@ public class OxmEdgeRulesLoader {
      * Finds all DB Edge Rules and Edge Properties files for all OXM models.
      *
      * @throws SchemaProviderException
-     * @throws SchemaProviderException 
+     * @throws SchemaProviderException
      */
     public static synchronized void loadModels() throws SchemaProviderException {
         Map<String, File> propFiles = edgePropertyFiles(edgePropsConfiguration);
index b3708b1..84bde10 100644 (file)
@@ -18,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.schemaif.oxm;
 
 import java.io.IOException;
@@ -61,7 +62,8 @@ public class OxmSchemaLoader {
     private static org.onap.aai.cl.api.Logger logger =
             LoggerFactory.getInstance().getLogger(OxmSchemaLoader.class.getName());
 
-    private OxmSchemaLoader() {}
+    private OxmSchemaLoader() {
+    }
 
     /**
      * This constructor presents an awkward marrying of Spring bean creation and static method use. This
@@ -172,24 +174,24 @@ public class OxmSchemaLoader {
         }
         xmlElementLookup.put(version, types);
     }
-    
+
     private static void loadVertexLookupMap(String version, DynamicJAXBContext jaxbContext) {
 
-      @SuppressWarnings("rawtypes")
-      List<Descriptor> descriptorsList = jaxbContext.getXMLContext().getDescriptors();
-      HashMap<String, VertexSchema> vertexMap = new HashMap<String, VertexSchema>();
-
-      for (@SuppressWarnings("rawtypes")
-      Descriptor desc : descriptorsList) {
-        try {
-          FromOxmVertexSchema vs = new FromOxmVertexSchema();
-          vs.fromOxm(desc.getDefaultRootElement(), jaxbContext, getXmlLookupMap(version));
-          vertexMap.put(vs.getName(), vs);
-        } catch (SchemaProviderException e) {
-          continue;
+        @SuppressWarnings("rawtypes")
+        List<Descriptor> descriptorsList = jaxbContext.getXMLContext().getDescriptors();
+        HashMap<String, VertexSchema> vertexMap = new HashMap<String, VertexSchema>();
+
+        for (@SuppressWarnings("rawtypes")
+        Descriptor desc : descriptorsList) {
+            try {
+                FromOxmVertexSchema vs = new FromOxmVertexSchema();
+                vs.fromOxm(desc.getDefaultRootElement(), jaxbContext, getXmlLookupMap(version));
+                vertexMap.put(vs.getName(), vs);
+            } catch (SchemaProviderException e) {
+                continue;
+            }
         }
-      }
-      vertexLookup.put(version, vertexMap);
+        vertexLookup.put(version, vertexMap);
     }
 
     /**
@@ -223,14 +225,15 @@ public class OxmSchemaLoader {
         return xmlElementLookup.get(version);
     }
 
-    public static HashMap<String, VertexSchema> getVertexLookupForVersion(String version) throws SchemaProviderException {
-      // If we haven't already loaded in the available OXM models, then do so now.
-      if (vertexLookup == null || vertexLookup.isEmpty()) {
-          loadModels();
-      } else if (!vertexLookup.containsKey(version)) {
-          throw new SchemaProviderException("Error loading oxm model: " + version);
-      }
-      return vertexLookup.get(version);
+    public static HashMap<String, VertexSchema> getVertexLookupForVersion(String version)
+            throws SchemaProviderException {
+        // If we haven't already loaded in the available OXM models, then do so now.
+        if (vertexLookup == null || vertexLookup.isEmpty()) {
+            loadModels();
+        } else if (!vertexLookup.containsKey(version)) {
+            throw new SchemaProviderException("Error loading oxm model: " + version);
+        }
+        return vertexLookup.get(version);
     }
 
 }
index bced602..c8e6bea 100644 (file)
@@ -18,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.schemaif.oxm;
 
 import java.util.HashSet;
@@ -32,7 +33,6 @@ import org.onap.aai.schemaif.SchemaProviderException;
 import org.onap.aai.schemaif.definitions.EdgeSchema;
 import org.onap.aai.schemaif.definitions.VertexSchema;
 
-
 public class OxmSchemaProvider implements SchemaProvider {
 
     @Override
@@ -53,9 +53,8 @@ public class OxmSchemaProvider implements SchemaProvider {
 
         try {
             vs.fromOxm(vertexName, jaxbContext, OxmSchemaLoader.getXmlLookupMap(schemaVersion));
-        }
-        catch (SchemaProviderException ex) {
-            // Node doesn't exist in schema.  Return null.
+        } catch (SchemaProviderException ex) {
+            // Node doesn't exist in schema. Return null.
             return null;
         }
 
@@ -95,7 +94,8 @@ public class OxmSchemaProvider implements SchemaProvider {
     }
 
     @Override
-    public Set<EdgeSchema> getEdgeSchemaForSourceTarget(String sourceType, String targetType, String version) throws SchemaProviderException {
+    public Set<EdgeSchema> getEdgeSchemaForSourceTarget(String sourceType, String targetType, String version)
+            throws SchemaProviderException {
         RelationshipSchema relSchema = OxmEdgeRulesLoader.getSchemaForVersion(version);
         Set<EdgeSchema> edges = new HashSet<>();
         Set<String> relTypes = relSchema.getValidRelationTypes(sourceType, targetType);
@@ -112,6 +112,6 @@ public class OxmSchemaProvider implements SchemaProvider {
 
     @Override
     public Map<String, VertexSchema> getVertexMap(String schemaVersion) throws SchemaProviderException {
-      return OxmSchemaLoader.getVertexLookupForVersion(schemaVersion);
+        return OxmSchemaLoader.getVertexLookupForVersion(schemaVersion);
     }
 }
index fa4fe45..921cff3 100644 (file)
  *
  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
  */
+
 package org.onap.aai.schemaif.oxm;
 
+import com.google.common.collect.Multimap;
+
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -38,12 +41,8 @@ import org.onap.aai.edges.EdgeRule;
 import org.onap.aai.schemaif.SchemaProviderException;
 import org.onap.aai.schemaif.SchemaProviderMsgs;
 
-import com.google.common.collect.Multimap;
-
-
 public class RelationshipSchema {
 
-
     public static final String SCHEMA_SOURCE_NODE_TYPE = "from";
     public static final String SCHEMA_TARGET_NODE_TYPE = "to";
     public static final String SCHEMA_RELATIONSHIP_TYPE = "label";
@@ -62,19 +61,18 @@ public class RelationshipSchema {
     // A map storing the list of valid edge types for a source/target pair
     private Map<String, Set<String>> edgeTypesForNodePair = new HashMap<>();
 
-
-    public RelationshipSchema(Multimap<String, EdgeRule> rules, String props) throws SchemaProviderException, IOException {
+    public RelationshipSchema(Multimap<String, EdgeRule> rules, String props)
+            throws SchemaProviderException, IOException {
         HashMap<String, String> properties = new ObjectMapper().readValue(props, HashMap.class);
 
-        // hold the true values of the edge rules by key 
+        // hold the true values of the edge rules by key
         for (EdgeRule rule : rules.values()) {
             String nodePairKey = buildNodePairKey(rule.getFrom(), rule.getTo());
             if (edgeTypesForNodePair.get(nodePairKey) == null) {
                 Set<String> typeSet = new HashSet<String>();
                 typeSet.add(rule.getLabel());
                 edgeTypesForNodePair.put(nodePairKey, typeSet);
-            }
-            else {
+            } else {
                 edgeTypesForNodePair.get(nodePairKey).add(rule.getLabel());
             }
 
@@ -138,8 +136,6 @@ public class RelationshipSchema {
         });
     }
 
-
-
     public Map<String, Class<?>> lookupRelation(String key) {
         return this.relations.get(key);
     }
@@ -152,7 +148,6 @@ public class RelationshipSchema {
         return relationTypes.containsKey(type);
     }
 
-
     private String buildRelation(String source, String target, String relation) {
         return source + ":" + target + ":" + relation;
     }
@@ -171,7 +166,6 @@ public class RelationshipSchema {
         return source + ":" + target;
     }
 
-
     private Class<?> resolveClass(String type) throws SchemaProviderException, ClassNotFoundException {
         Class<?> clazz = Class.forName(type);
         validateClassTypes(clazz);
@@ -185,5 +179,3 @@ public class RelationshipSchema {
         }
     }
 }
-
-
index 332d667..9011dfa 100644 (file)
@@ -38,6 +38,7 @@ import java.util.List;
 import java.util.Set;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.aai.schemaif.SchemaProviderException;
@@ -54,7 +55,6 @@ import org.onap.aai.schemaif.json.definitions.JsonPropertySchema;
 import org.onap.aai.schemaif.json.definitions.JsonSchema;
 import org.onap.aai.schemaif.json.definitions.JsonVertexSchema;
 
-
 public class JsonSchemaProviderTest {
 
     JsonSchemaProviderConfig config = new JsonSchemaProviderConfig();
@@ -96,8 +96,8 @@ public class JsonSchemaProviderTest {
             // Test Edge Schema
             JsonEdgeSchema edgeSchema = null;
             for (JsonEdgeSchema edge : jsonSchema.getRelationshipTypes()) {
-                if ( (edge.getFrom().equals("onap.nodes.sdwan.uCPE"))
-                        && (edge.getTo().equals("onap.nodes.sdwan.service.SubscriberService")) ) {
+                if ((edge.getFrom().equals("onap.nodes.sdwan.uCPE"))
+                        && (edge.getTo().equals("onap.nodes.sdwan.service.SubscriberService"))) {
                     edgeSchema = edge;
                     break;
                 }
@@ -109,7 +109,7 @@ public class JsonSchemaProviderTest {
             // Test Node Schema
             JsonVertexSchema vertexSchema = null;
             for (JsonVertexSchema v : jsonSchema.getNodeTypes()) {
-                if ( (v.getName().equals("org.onap.resource.NetworkRules")) ) {
+                if ((v.getName().equals("org.onap.resource.NetworkRules"))) {
                     vertexSchema = v;
                     break;
                 }
@@ -120,7 +120,7 @@ public class JsonSchemaProviderTest {
 
             JsonPropertySchema propSchema = null;
             for (JsonPropertySchema p : vertexSchema.getProperties()) {
-                if ( (p.getName().equals("network_policy_entries")) ) {
+                if ((p.getName().equals("network_policy_entries"))) {
                     propSchema = p;
                     break;
                 }
@@ -136,7 +136,7 @@ public class JsonSchemaProviderTest {
             // Test DataType Schema
             DataTypeDefinition dataType = null;
             for (DataTypeDefinition d : jsonSchema.getDataTypes()) {
-                if ( (d.getName().equals("org.onap.datatypes.network.VlanRequirements")) ) {
+                if ((d.getName().equals("org.onap.datatypes.network.VlanRequirements"))) {
                     dataType = d;
                     break;
                 }
@@ -148,7 +148,7 @@ public class JsonSchemaProviderTest {
 
             propSchema = null;
             for (JsonPropertySchema p : dataType.getProperties()) {
-                if ( (p.getName().equals("vlan_type")) ) {
+                if ((p.getName().equals("vlan_type"))) {
                     propSchema = p;
                     break;
                 }
@@ -158,8 +158,7 @@ public class JsonSchemaProviderTest {
             assertEquals(false, propSchema.getRequired());
             assertEquals("string", propSchema.getDataType());
             assertEquals("", propSchema.getDefaultValue());
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
             ex.printStackTrace(printWriter);
@@ -175,9 +174,8 @@ public class JsonSchemaProviderTest {
             JsonSchemaProvider schemaProvider = new JsonSchemaProvider(config);
             schemaProvider.loadSchema(testSchema, schemaProvider.getLatestSchemaVersion());
 
-            VertexSchema vertSchema =
-                    schemaProvider.getVertexSchema("tosca.nodes.objectstorage",
-                            schemaProvider.getLatestSchemaVersion());
+            VertexSchema vertSchema = schemaProvider.getVertexSchema("tosca.nodes.objectstorage",
+                    schemaProvider.getLatestSchemaVersion());
             System.out.println(vertSchema.toString());
 
             // Validate vertex schema
@@ -204,8 +202,7 @@ public class JsonSchemaProviderTest {
             assertFalse(propSchema.isRequired());
             assertTrue(propSchema.isReserved());
             assertEquals(0, propSchema.getDataType().getType().compareTo(Type.STRING));
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
             ex.printStackTrace(printWriter);
@@ -222,8 +219,7 @@ public class JsonSchemaProviderTest {
             schemaProvider.loadSchema(testSchema, schemaProvider.getLatestSchemaVersion());
 
             EdgeSchema edgeSchema = schemaProvider.getEdgeSchema("tosca.relationships.hostedOn",
-                    "tosca.nodes.Softwarecomponent", "tosca.nodes.compute",
-                    schemaProvider.getLatestSchemaVersion());
+                    "tosca.nodes.Softwarecomponent", "tosca.nodes.compute", schemaProvider.getLatestSchemaVersion());
             System.out.println(edgeSchema.toString());
 
             // Validate edge schema
@@ -233,9 +229,7 @@ public class JsonSchemaProviderTest {
             assertEquals(edgeSchema.getMultiplicity(), EdgeSchema.Multiplicity.MANY_2_MANY);
             assertEquals("NONE", edgeSchema.getAnnotationValue("contains-other-v"));
 
-
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
             ex.printStackTrace(printWriter);
@@ -251,9 +245,8 @@ public class JsonSchemaProviderTest {
             JsonSchemaProvider schemaProvider = new JsonSchemaProvider(config);
             schemaProvider.loadSchema(testSchema, schemaProvider.getLatestSchemaVersion());
 
-            Set<EdgeSchema> edgeSchemaList =
-                    schemaProvider.getAdjacentEdgeSchema("tosca.nodes.Database",
-                            schemaProvider.getLatestSchemaVersion());
+            Set<EdgeSchema> edgeSchemaList = schemaProvider.getAdjacentEdgeSchema("tosca.nodes.Database",
+                    schemaProvider.getLatestSchemaVersion());
 
             // Validate edge schema
             assertEquals(3, edgeSchemaList.size());
@@ -277,8 +270,7 @@ public class JsonSchemaProviderTest {
                         break;
                 }
             }
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
             ex.printStackTrace(printWriter);
@@ -294,10 +286,8 @@ public class JsonSchemaProviderTest {
             JsonSchemaProvider schemaProvider = new JsonSchemaProvider(config);
             schemaProvider.loadSchema(testSchema, schemaProvider.getLatestSchemaVersion());
 
-            Set<EdgeSchema> edgeSchemaList =
-                    schemaProvider.getEdgeSchemaForSourceTarget("tosca.nodes.LoadBalancer",
-                            "tosca.nodes.Database",
-                            schemaProvider.getLatestSchemaVersion());
+            Set<EdgeSchema> edgeSchemaList = schemaProvider.getEdgeSchemaForSourceTarget("tosca.nodes.LoadBalancer",
+                    "tosca.nodes.Database", schemaProvider.getLatestSchemaVersion());
 
             // Validate edge schema
             assertEquals(2, edgeSchemaList.size());
@@ -308,18 +298,15 @@ public class JsonSchemaProviderTest {
                     assertEquals("tosca.nodes.LoadBalancer", es.getSource());
                     assertEquals("tosca.nodes.Database", es.getTarget());
                     assertEquals(es.getMultiplicity(), EdgeSchema.Multiplicity.MANY_2_MANY);
-                }
-                else if (es.getName().equals("tosca.relationships.RoutesTo")) {
+                } else if (es.getName().equals("tosca.relationships.RoutesTo")) {
                     assertEquals("tosca.nodes.LoadBalancer", es.getSource());
                     assertEquals("tosca.nodes.Database", es.getTarget());
                     assertEquals(es.getMultiplicity(), EdgeSchema.Multiplicity.MANY_2_MANY);
-                }
-                else {
+                } else {
                     fail();
                 }
             }
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
             ex.printStackTrace(printWriter);
@@ -335,9 +322,8 @@ public class JsonSchemaProviderTest {
             JsonSchemaProvider schemaProvider = new JsonSchemaProvider(config);
             schemaProvider.loadSchema(testSchema, schemaProvider.getLatestSchemaVersion());
 
-            EdgeSchema edgeSchema =
-                    schemaProvider.getEdgeSchema("amdocs.linkedTo", "service-instance",
-                            "onap.nodes.sdwan.ManagementDomain", schemaProvider.getLatestSchemaVersion());
+            EdgeSchema edgeSchema = schemaProvider.getEdgeSchema("amdocs.linkedTo", "service-instance",
+                    "onap.nodes.sdwan.ManagementDomain", schemaProvider.getLatestSchemaVersion());
 
             assertEquals("amdocs.linkedTo", edgeSchema.getName());
             assertEquals("service-instance", edgeSchema.getSource());
@@ -348,27 +334,22 @@ public class JsonSchemaProviderTest {
 
             assertNull(edgeSchema);
 
-
-            edgeSchema =
-                    schemaProvider.getEdgeSchema("amdocs.unknownRelationship", "unknown",
-                            "onap.nodes.sdwan.ManagementDomain", schemaProvider.getLatestSchemaVersion());
+            edgeSchema = schemaProvider.getEdgeSchema("amdocs.unknownRelationship", "unknown",
+                    "onap.nodes.sdwan.ManagementDomain", schemaProvider.getLatestSchemaVersion());
 
             assertEquals("amdocs.unknownRelationship", edgeSchema.getName());
             assertEquals("unknown", edgeSchema.getSource());
             assertEquals("onap.nodes.sdwan.ManagementDomain", edgeSchema.getTarget());
 
-            edgeSchema =
-                    schemaProvider.getEdgeSchema("amdocs.unknownRelationship", "onap.nodes.sdwan.ManagementDomain",
-                            "unknown", schemaProvider.getLatestSchemaVersion());
+            edgeSchema = schemaProvider.getEdgeSchema("amdocs.unknownRelationship", "onap.nodes.sdwan.ManagementDomain",
+                    "unknown", schemaProvider.getLatestSchemaVersion());
 
             assertEquals("amdocs.unknownRelationship", edgeSchema.getName());
             assertEquals("onap.nodes.sdwan.ManagementDomain", edgeSchema.getSource());
             assertEquals("unknown", edgeSchema.getTarget());
 
-            Set<EdgeSchema> edgeSchemaList =
-                    schemaProvider.getEdgeSchemaForSourceTarget("service-instance",
-                            "onap.nodes.sdwan.ManagementDomain",
-                            schemaProvider.getLatestSchemaVersion());
+            Set<EdgeSchema> edgeSchemaList = schemaProvider.getEdgeSchemaForSourceTarget("service-instance",
+                    "onap.nodes.sdwan.ManagementDomain", schemaProvider.getLatestSchemaVersion());
             assertEquals(1, edgeSchemaList.size());
 
             edgeSchemaList = schemaProvider.getEdgeSchemaForSourceTarget("unknown", "unknown",
@@ -379,12 +360,11 @@ public class JsonSchemaProviderTest {
                     schemaProvider.getLatestSchemaVersion());
             assertEquals(1, edgeSchemaList.size());
 
-
-            edgeSchemaList = schemaProvider.getAdjacentEdgeSchema("service-instance", schemaProvider.getLatestSchemaVersion());
+            edgeSchemaList =
+                    schemaProvider.getAdjacentEdgeSchema("service-instance", schemaProvider.getLatestSchemaVersion());
             System.out.println("EDGE LIST: \n\n" + edgeSchemaList);
             assertEquals(8, edgeSchemaList.size());
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
             ex.printStackTrace(printWriter);
@@ -408,12 +388,10 @@ public class JsonSchemaProviderTest {
                     "cloud-region", "bad-node", schemaProvider.getLatestSchemaVersion());
             assertNull(edgeSchema);
 
-            Set<EdgeSchema> edgeSchemaList =
-                    schemaProvider.getAdjacentEdgeSchema("org.onap.nodes.bad-node",
-                            schemaProvider.getLatestSchemaVersion());
+            Set<EdgeSchema> edgeSchemaList = schemaProvider.getAdjacentEdgeSchema("org.onap.nodes.bad-node",
+                    schemaProvider.getLatestSchemaVersion());
             assertTrue(edgeSchemaList.isEmpty());
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
             ex.printStackTrace(printWriter);
@@ -429,18 +407,16 @@ public class JsonSchemaProviderTest {
             JsonSchemaProvider schemaProvider = new JsonSchemaProvider(config);
             schemaProvider.loadSchema(testSchema, schemaProvider.getLatestSchemaVersion());
 
-            VertexSchema vertSchema =
-                    schemaProvider.getVertexSchema("onap.nodes.sdwan.ManagementDomain",
-                            schemaProvider.getLatestSchemaVersion());
+            VertexSchema vertSchema = schemaProvider.getVertexSchema("onap.nodes.sdwan.ManagementDomain",
+                    schemaProvider.getLatestSchemaVersion());
             System.out.println(vertSchema.toString());
 
             // Validate schema
             PropertySchema propSchema = vertSchema.getPropertySchema("controllers");
             assertEquals(0, propSchema.getDataType().getType().compareTo(Type.LIST));
-            ListDataType listType = (ListDataType)propSchema.getDataType();
+            ListDataType listType = (ListDataType) propSchema.getDataType();
             assertEquals(0, listType.getListType().getType().compareTo(Type.STRING));
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
             ex.printStackTrace(printWriter);
@@ -456,18 +432,16 @@ public class JsonSchemaProviderTest {
             JsonSchemaProvider schemaProvider = new JsonSchemaProvider(config);
             schemaProvider.loadSchema(testSchema, schemaProvider.getLatestSchemaVersion());
 
-            VertexSchema vertSchema =
-                    schemaProvider.getVertexSchema("onap.nodes.sdwan.ManagementDomain",
-                            schemaProvider.getLatestSchemaVersion());
+            VertexSchema vertSchema = schemaProvider.getVertexSchema("onap.nodes.sdwan.ManagementDomain",
+                    schemaProvider.getLatestSchemaVersion());
             System.out.println(vertSchema.toString());
 
             // Validate schema
             PropertySchema propSchema = vertSchema.getPropertySchema("analyticClusters");
             assertEquals(0, propSchema.getDataType().getType().compareTo(Type.MAP));
-            MapDataType mapType = (MapDataType)propSchema.getDataType();
+            MapDataType mapType = (MapDataType) propSchema.getDataType();
             assertEquals(0, mapType.getMapType().getType().compareTo(Type.STRING));
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
             ex.printStackTrace(printWriter);
@@ -483,9 +457,8 @@ public class JsonSchemaProviderTest {
             JsonSchemaProvider schemaProvider = new JsonSchemaProvider(config);
             schemaProvider.loadSchema(testSchema, schemaProvider.getLatestSchemaVersion());
 
-            VertexSchema vertSchema =
-                    schemaProvider.getVertexSchema("org.onap.resource.extContrailCP",
-                            schemaProvider.getLatestSchemaVersion());
+            VertexSchema vertSchema = schemaProvider.getVertexSchema("org.onap.resource.extContrailCP",
+                    schemaProvider.getLatestSchemaVersion());
             System.out.println(vertSchema.toString());
 
             System.out.println("\n\nSize: " + vertSchema.getPropertySchemaList().size());
@@ -495,7 +468,7 @@ public class JsonSchemaProviderTest {
             // Validate property schema
             PropertySchema propSchema = vertSchema.getPropertySchema("exCP_naming");
             assertEquals(0, propSchema.getDataType().getType().compareTo(Type.COMPLEX));
-            ComplexDataType complexType = (ComplexDataType)propSchema.getDataType();
+            ComplexDataType complexType = (ComplexDataType) propSchema.getDataType();
             List<PropertySchema> complexProps = complexType.getSubProperties();
             assertEquals(4, complexProps.size());
 
@@ -509,8 +482,7 @@ public class JsonSchemaProviderTest {
             assertNotNull(subProp);
             assertFalse(subProp.isRequired());
             assertEquals(0, subProp.getDataType().getType().compareTo(Type.STRING));
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
             ex.printStackTrace(printWriter);
@@ -532,8 +504,7 @@ public class JsonSchemaProviderTest {
             System.out.println(jsonSchema.toJson());
 
             assertEquals(1, jsonSchema.getDataTypes().size());
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
             ex.printStackTrace(printWriter);
@@ -548,8 +519,7 @@ public class JsonSchemaProviderTest {
             String testSchema = readFile("src/test/resources/json/schemaServiceResponse.json");
             SchemaServiceResponse schema = SchemaServiceResponse.fromJson(testSchema);
             schema.getData().validate();
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
             ex.printStackTrace(printWriter);
@@ -565,8 +535,7 @@ public class JsonSchemaProviderTest {
         try {
             String testSchema = readFile("src/test/resources/json/badEdgeSchema.json");
             schema = SchemaServiceResponse.fromJson(testSchema);
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             fail();
             return;
         }
@@ -581,8 +550,7 @@ public class JsonSchemaProviderTest {
         try {
             String testSchema = readFile("src/test/resources/json/badVertexSchema.json");
             schema = SchemaServiceResponse.fromJson(testSchema);
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             fail();
             return;
         }
@@ -599,8 +567,7 @@ public class JsonSchemaProviderTest {
         try {
             String testSchema = readFile("src/test/resources/json/badTypeSchema.json");
             schema = SchemaServiceResponse.fromJson(testSchema);
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             fail();
             return;
         }
@@ -615,8 +582,7 @@ public class JsonSchemaProviderTest {
         try {
             String testSchema = readFile("src/test/resources/json/badPropSchema.json");
             schema = SchemaServiceResponse.fromJson(testSchema);
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             fail();
             return;
         }
index 6cfb5a7..21ba985 100644 (file)
@@ -21,7 +21,6 @@
 
 package org.onap.aai.schemaif.oxm;
 
-
 import static org.junit.Assert.assertTrue;
 
 import java.io.PrintWriter;
@@ -46,7 +45,8 @@ public class OxmSchemaProviderTest extends OxmSchemaServiceSetup {
             OxmSchemaProvider schemaProvider = new OxmSchemaProvider();
             schemaProvider.loadSchema();
 
-            VertexSchema vertSchema = schemaProvider.getVertexSchema("pserver", schemaProvider.getLatestSchemaVersion());
+            VertexSchema vertSchema =
+                    schemaProvider.getVertexSchema("pserver", schemaProvider.getLatestSchemaVersion());
             System.out.println(vertSchema.toString());
 
             EdgeSchema edgeSchema = schemaProvider.getEdgeSchema("org.onap.relationships.inventory.LocatedIn",
@@ -80,7 +80,6 @@ public class OxmSchemaProviderTest extends OxmSchemaServiceSetup {
             assertTrue(obj instanceof Boolean);
             assertTrue(propSchema.getDataType().validateValue("badValue") == null);
 
-
             propSchema = vertSchema.getPropertySchema("aai-node-type");
             assertTrue(propSchema.getName().equals("aai-node-type"));
             assertTrue(propSchema.getDefaultValue().equals(""));
@@ -119,8 +118,7 @@ public class OxmSchemaProviderTest extends OxmSchemaServiceSetup {
             // Validate 'dependentOn' annotation
             vertSchema = schemaProvider.getVertexSchema("tenant", schemaProvider.getLatestSchemaVersion());
             assertTrue(vertSchema.getAnnotationValue("dependentOn").equals("cloud-region"));
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
             ex.printStackTrace(printWriter);
@@ -147,18 +145,15 @@ public class OxmSchemaProviderTest extends OxmSchemaServiceSetup {
                     assertTrue(es.getSource().equals("snapshot"));
                     assertTrue(es.getTarget().equals("cloud-region"));
                     assertTrue(es.getMultiplicity().equals(EdgeSchema.Multiplicity.MANY_2_ONE));
-                }
-                else if (es.getName().equals("org.onap.relationships.inventory.Uses")) {
+                } else if (es.getName().equals("org.onap.relationships.inventory.Uses")) {
                     assertTrue(es.getSource().equals("vserver"));
                     assertTrue(es.getTarget().equals("snapshot"));
                     assertTrue(es.getMultiplicity().equals(EdgeSchema.Multiplicity.ONE_2_ONE));
-                }
-                else {
+                } else {
                     assertTrue(false);
                 }
             }
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
             ex.printStackTrace(printWriter);
@@ -173,9 +168,8 @@ public class OxmSchemaProviderTest extends OxmSchemaServiceSetup {
             OxmSchemaProvider schemaProvider = new OxmSchemaProvider();
             schemaProvider.loadSchema();
 
-            Set<EdgeSchema> edgeSchemaList =
-                    schemaProvider.getEdgeSchemaForSourceTarget("service-instance", "customer",
-                            schemaProvider.getLatestSchemaVersion());
+            Set<EdgeSchema> edgeSchemaList = schemaProvider.getEdgeSchemaForSourceTarget("service-instance", "customer",
+                    schemaProvider.getLatestSchemaVersion());
 
             // Validate edge schema
             assertTrue(edgeSchemaList.size() == 1);
@@ -184,9 +178,8 @@ public class OxmSchemaProviderTest extends OxmSchemaServiceSetup {
             assertTrue(edgeSchemaList.iterator().next().getTarget().equals("customer"));
             assertTrue(edgeSchemaList.iterator().next().getMultiplicity().equals(EdgeSchema.Multiplicity.MANY_2_MANY));
 
-            edgeSchemaList =
-                    schemaProvider.getEdgeSchemaForSourceTarget("cloud-region", "complex",
-                            schemaProvider.getLatestSchemaVersion());
+            edgeSchemaList = schemaProvider.getEdgeSchemaForSourceTarget("cloud-region", "complex",
+                    schemaProvider.getLatestSchemaVersion());
 
             // Validate edge schema
             assertTrue(edgeSchemaList.size() == 2);
@@ -197,25 +190,21 @@ public class OxmSchemaProviderTest extends OxmSchemaServiceSetup {
                     assertTrue(es.getSource().equals("cloud-region"));
                     assertTrue(es.getTarget().equals("complex"));
                     assertTrue(es.getMultiplicity().equals(EdgeSchema.Multiplicity.MANY_2_MANY));
-                }
-                else if (es.getName().equals("org.onap.relationships.inventory.LocatedIn")) {
+                } else if (es.getName().equals("org.onap.relationships.inventory.LocatedIn")) {
                     assertTrue(es.getSource().equals("cloud-region"));
                     assertTrue(es.getTarget().equals("complex"));
                     assertTrue(es.getMultiplicity().equals(EdgeSchema.Multiplicity.MANY_2_ONE));
-                }
-                else {
+                } else {
                     assertTrue(false);
                 }
             }
 
-            edgeSchemaList =
-                    schemaProvider.getEdgeSchemaForSourceTarget("cloud-region", "bad-node",
-                            schemaProvider.getLatestSchemaVersion());
+            edgeSchemaList = schemaProvider.getEdgeSchemaForSourceTarget("cloud-region", "bad-node",
+                    schemaProvider.getLatestSchemaVersion());
 
             // Validate edge schema
             assertTrue(edgeSchemaList.size() == 0);
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
             ex.printStackTrace(printWriter);
@@ -238,12 +227,10 @@ public class OxmSchemaProviderTest extends OxmSchemaServiceSetup {
                     "cloud-region", "bad-node", schemaProvider.getLatestSchemaVersion());
             assertTrue(edgeSchema == null);
 
-            Set<EdgeSchema> edgeSchemaList =
-                    schemaProvider.getAdjacentEdgeSchema("org.onap.nodes.bad-node",
-                            schemaProvider.getLatestSchemaVersion());
+            Set<EdgeSchema> edgeSchemaList = schemaProvider.getAdjacentEdgeSchema("org.onap.nodes.bad-node",
+                    schemaProvider.getLatestSchemaVersion());
             assertTrue(edgeSchemaList.isEmpty());
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             StringWriter writer = new StringWriter();
             PrintWriter printWriter = new PrintWriter(writer);
             ex.printStackTrace(printWriter);
index b0b76a2..e7055a3 100644 (file)
@@ -26,6 +26,7 @@ import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+
 import org.junit.Before;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -34,9 +35,9 @@ import org.mockito.runners.MockitoJUnitRunner;
 import org.onap.aai.edges.EdgeIngestor;
 import org.onap.aai.nodes.NodeIngestor;
 import org.onap.aai.setup.AAIConfigTranslator;
+import org.onap.aai.setup.SchemaConfigVersions;
 import org.onap.aai.setup.SchemaLocationsBean;
 import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaConfigVersions;
 import org.onap.aai.setup.Translator;
 
 @RunWith(MockitoJUnitRunner.class)
@@ -65,7 +66,7 @@ public class OxmSchemaServiceSetup {
         Mockito.when(schemaLocationsBean.getNodeDirectory()).thenReturn("src/test/resources/oxm/oxm");
         Mockito.when(schemaLocationsBean.getEdgeDirectory()).thenReturn("src/test/resources/oxm/edge-rules");
 
-        AAIConfigTranslator aaiConfigTranslator = new AAIConfigTranslator(schemaLocationsBean,  schemaConfigVersions);
+        AAIConfigTranslator aaiConfigTranslator = new AAIConfigTranslator(schemaLocationsBean, schemaConfigVersions);
         Set<Translator> translators = new HashSet<>();
         translators.add(aaiConfigTranslator);
         NodeIngestor nodeIngestor = new NodeIngestor(translators);
index 2e6847d..c4f951a 100644 (file)
@@ -22,9 +22,6 @@
 
 package org.onap.aai.config;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
@@ -32,6 +29,8 @@ import java.util.Set;
 
 import org.onap.aai.nodes.NodeIngestor;
 import org.onap.aai.setup.Translator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
index 207f7e0..c322216 100644 (file)
@@ -23,8 +23,6 @@ package org.onap.aai.edges;
 import static com.jayway.jsonpath.Criteria.where;
 import static com.jayway.jsonpath.Filter.filter;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
@@ -51,6 +49,8 @@ import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
 import org.onap.aai.setup.SchemaVersion;
 import org.onap.aai.setup.SchemaVersions;
 import org.onap.aai.setup.Translator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
index 8861c5c..4076137 100644 (file)
 
 package org.onap.aai.edges;
 
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.onap.aai.edges.enums.*;
-
 import java.util.EnumMap;
 import java.util.Map;
 
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.onap.aai.edges.enums.*;
+
 /**
  * Container for A&AI edge rule information
  */
index 893ebad..f7a2b9a 100644 (file)
 
 package org.onap.aai.edges;
 
+import com.jayway.jsonpath.Criteria;
+import com.jayway.jsonpath.Filter;
+import com.jayway.jsonpath.Predicate;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
@@ -34,10 +38,6 @@ import org.onap.aai.edges.enums.EdgeProperty;
 import org.onap.aai.edges.enums.EdgeType;
 import org.onap.aai.setup.SchemaVersion;
 
-import com.jayway.jsonpath.Criteria;
-import com.jayway.jsonpath.Filter;
-import com.jayway.jsonpath.Predicate;
-
 /**
  * For querying the edge rules schema (not the database)
  *
@@ -57,7 +57,6 @@ public class EdgeRuleQuery {
 
     public static class Builder {
 
-
         // required
         private String nodeA;
 
@@ -244,9 +243,11 @@ public class EdgeRuleQuery {
 
     private Predicate addDirection(AAIDirection direction) {
         if (direction == AAIDirection.OUT) {
-            return Criteria.where(EdgeField.DIRECTION.toString()).in(AAIDirection.OUT.toString(), AAIDirection.BOTH.toString());
+            return Criteria.where(EdgeField.DIRECTION.toString()).in(AAIDirection.OUT.toString(),
+                    AAIDirection.BOTH.toString());
         } else if (direction == AAIDirection.IN) {
-            return Criteria.where(EdgeField.DIRECTION.toString()).in(AAIDirection.IN.toString(), AAIDirection.BOTH.toString());
+            return Criteria.where(EdgeField.DIRECTION.toString()).in(AAIDirection.IN.toString(),
+                    AAIDirection.BOTH.toString());
         } else if (direction == AAIDirection.BOTH) {
             return Criteria.where(EdgeField.DIRECTION.toString()).is(AAIDirection.BOTH.toString());
         } else if (direction == AAIDirection.NONE) {
@@ -333,7 +334,7 @@ public class EdgeRuleQuery {
     @Override
     public int hashCode() {
         return v.map(schemaVersion -> Objects.hash(schemaVersion, nodeA, nodeB, label, direction, type, isPrivate))
-            .orElseGet(() -> Objects.hash(nodeA, nodeB, label, direction, type, isPrivate));
+                .orElseGet(() -> Objects.hash(nodeA, nodeB, label, direction, type, isPrivate));
     }
 
 }
index 9b1f0bd..ec0e850 100644 (file)
@@ -20,8 +20,6 @@
 
 package org.onap.aai.edges;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.jayway.jsonpath.DocumentContext;
 import com.jayway.jsonpath.JsonPath;
 
@@ -35,6 +33,8 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 import org.onap.aai.setup.SchemaVersion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * JsonIngestor produces DocumentContexts from json files
index 014a444..a3d477e 100644 (file)
@@ -23,6 +23,7 @@
 package org.onap.aai.nodes;
 
 import com.google.common.base.CaseFormat;
+
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -34,12 +35,14 @@ import java.util.Map;
 import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+
 import javax.annotation.PostConstruct;
 import javax.xml.XMLConstants;
 import javax.xml.bind.JAXBException;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
+
 import org.eclipse.persistence.jaxb.JAXBContextProperties;
 import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
 import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory;
index a92005e..e764dda 100644 (file)
 
 package org.onap.aai.restclient;
 
+import java.util.Collections;
+import java.util.Map;
+import java.util.UUID;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
@@ -27,10 +31,6 @@ import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
 import org.springframework.util.MultiValueMap;
 
-import java.util.Collections;
-import java.util.Map;
-import java.util.UUID;
-
 public class SchemaServiceNoAuthClient extends NoAuthRestClient {
 
     private static Logger logger = LoggerFactory.getLogger(SchemaServiceNoAuthClient.class);
index 1ab0999..1f04bff 100644 (file)
 
 package org.onap.aai.restclient;
 
+import java.util.Collections;
+import java.util.Map;
+import java.util.UUID;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
@@ -27,10 +31,6 @@ import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
 import org.springframework.util.MultiValueMap;
 
-import java.util.Collections;
-import java.util.Map;
-import java.util.UUID;
-
 public class SchemaServiceOneWayClient extends OneWaySSLRestClient {
 
     private static Logger logger = LoggerFactory.getLogger(SchemaServiceOneWayClient.class);
index 62f4b68..f7bdf6d 100644 (file)
 
 package org.onap.aai.restclient;
 
+import java.util.Collections;
+import java.util.Map;
+import java.util.UUID;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
@@ -29,10 +33,6 @@ import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
 import org.springframework.util.MultiValueMap;
 
-import java.util.Collections;
-import java.util.Map;
-import java.util.UUID;
-
 public class SchemaServiceRestClient extends TwoWaySSLRestClient {
     private static Logger logger = LoggerFactory.getLogger(SchemaServiceRestClient.class);
 
index 10f1f54..27148a4 100644 (file)
@@ -26,6 +26,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
 import org.onap.aai.restclient.RestClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index 0094a16..1d140ea 100644 (file)
 package org.onap.aai.setup;
 
 import java.util.List;
-import java.util.stream.Collectors;
-
-import javax.annotation.PostConstruct;
 
 import org.onap.aai.validation.AAISchemaValidationException;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.PropertySource;
-import org.springframework.stereotype.Component;
 
 @PropertySource(value = "classpath:schema-ingest.properties", ignoreResourceNotFound = true)
 @PropertySource(value = "file:${schema.ingest.file}", ignoreResourceNotFound = true)
index 39efde5..3d415e6 100644 (file)
@@ -23,8 +23,6 @@ package org.onap.aai.setup;
 import java.io.*;
 import java.util.List;
 
-import org.springframework.beans.factory.annotation.Autowired;
-
 /**
  * Converts the contents of the schema config file
  * (which lists which schema files to be loaded) to
index e382657..6f896f8 100644 (file)
@@ -36,8 +36,6 @@ import org.onap.aai.edges.enums.AAIDirection;
 import org.onap.aai.edges.enums.MultiplicityRule;
 import org.onap.aai.edges.exceptions.AmbiguousRuleChoiceException;
 import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
-import org.onap.aai.restclient.MockProvider;
-import org.onap.aai.setup.SchemaLocationsBean;
 import org.onap.aai.setup.SchemaVersion;
 import org.onap.aai.testutils.TestUtilConfigTranslator;
 import org.springframework.beans.factory.annotation.Autowired;
index a9cd1f7..99693c1 100644 (file)
@@ -27,7 +27,6 @@ import com.google.common.collect.Multimap;
 import java.util.Collection;
 
 import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
@@ -38,7 +37,6 @@ import org.onap.aai.edges.enums.MultiplicityRule;
 import org.onap.aai.edges.exceptions.AmbiguousRuleChoiceException;
 import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
 import org.onap.aai.restclient.MockProvider;
-import org.onap.aai.restclient.MockRestClient;
 import org.onap.aai.setup.SchemaVersion;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -50,10 +48,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(classes = {MockProvider.class, EdgesConfiguration.class})
 @TestPropertySource(
-        properties = {
-            "schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test.properties",
-            "spring.main.allow-bean-definition-overriding=true"
-        })
+        properties = {"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-wiring-test.properties",
+                "spring.main.allow-bean-definition-overriding=true"})
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 @SpringBootTest
 public class EdgeIngestorTest {
index 0a6a3f0..543ce27 100644 (file)
@@ -24,13 +24,11 @@ import static org.junit.Assert.*;
 
 import com.google.common.collect.Multimap;
 
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.onap.aai.config.EdgesConfiguration;
 import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException;
 import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersionsBean;
 import org.onap.aai.testutils.ConfigTranslatorForWiringTest;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
index 83d7dc4..6e00eb7 100644 (file)
 
 package org.onap.aai.nodes;
 
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.*;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import javax.xml.bind.SchemaOutputResolver;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
 import org.eclipse.persistence.dynamic.DynamicEntity;
 import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
 import org.junit.Rule;
@@ -37,26 +58,6 @@ import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.junit4.SpringRunner;
 import org.w3c.dom.Document;
 
-import javax.xml.bind.SchemaOutputResolver;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Result;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
-
 @RunWith(SpringRunner.class)
 @TestPropertySource(
         properties = {
index b70b1bf..fff2211 100644 (file)
 
 package org.onap.aai.nodes;
 
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.*;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import javax.xml.bind.SchemaOutputResolver;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
 import org.eclipse.persistence.dynamic.DynamicEntity;
 import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
 import org.junit.Rule;
@@ -37,32 +58,10 @@ import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.w3c.dom.Document;
 
-import javax.xml.bind.SchemaOutputResolver;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Result;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
-
 @RunWith(SpringJUnit4ClassRunner.class)
 @TestPropertySource(
-        properties = {
-            "schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-ss-wiring-test.properties",
-            "spring.main.allow-bean-definition-overriding=true"
-        })
+        properties = {"schema.ingest.file = src/test/resources/forWiringTests/schema-ingest-ss-wiring-test.properties",
+                "spring.main.allow-bean-definition-overriding=true"})
 
 @ContextConfiguration(classes = {MockProvider.class, NodesConfiguration.class})
 @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
index d2412c0..7ae0a2c 100644 (file)
@@ -24,12 +24,10 @@ import static org.junit.Assert.*;
 
 import org.eclipse.persistence.dynamic.DynamicEntity;
 import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.onap.aai.config.NodesConfiguration;
 import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersionsBean;
 import org.onap.aai.testutils.ConfigTranslatorForWiringTest;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
index 09b8d3a..16af484 100644 (file)
@@ -20,7 +20,6 @@
 
 package org.onap.aai.restclient;
 
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.context.annotation.Bean;
index 8ce496e..74d254b 100644 (file)
@@ -26,6 +26,10 @@ import static org.springframework.test.web.client.match.MockRestRequestMatchers.
 import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
 import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
 
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
@@ -48,10 +52,6 @@ import org.springframework.test.web.client.MockRestServiceServer;
 import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
 
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-
 @Component
 public class MockRestClient extends RestClient {
 
index 5313407..cbbc63d 100644 (file)
@@ -26,7 +26,6 @@ import java.util.Map;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.onap.aai.restclient.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.http.HttpMethod;
index d285292..fa6d8ed 100644 (file)
@@ -23,7 +23,6 @@ package org.onap.aai.validation;
 import static org.junit.Assert.*;
 
 import org.junit.Test;
-import org.onap.aai.validation.CheckEverythingStrategy;
 
 public class CheckEverythingStrategyTest {
 
index ceced41..0dc68c4 100644 (file)
@@ -25,8 +25,6 @@ import static org.junit.Assert.*;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
-import org.onap.aai.validation.AAISchemaValidationException;
-import org.onap.aai.validation.FailFastStrategy;
 
 public class FailFastStrategyTest {
     @Rule
index 4bab99a..4c6882c 100644 (file)
@@ -22,13 +22,10 @@ package org.onap.aai.validation;
 
 import static org.junit.Assert.*;
 
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.onap.aai.config.NodesConfiguration;
-import org.onap.aai.nodes.NodeIngestor;
 import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersionsBean;
 import org.onap.aai.testutils.BadNodeConfigForValidationTest;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
index 2598928..a74f7ba 100644 (file)
@@ -22,12 +22,9 @@ package org.onap.aai.validation;
 
 import static org.junit.Assert.*;
 
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.onap.aai.config.NodesConfiguration;
-import org.onap.aai.nodes.NodeIngestor;
-import org.onap.aai.setup.SchemaVersionsBean;
 import org.onap.aai.testutils.GoodConfigForValidationTest;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
index 75b2771..b1bf314 100644 (file)
@@ -22,12 +22,9 @@ package org.onap.aai.validation.edges;
 
 import static org.junit.Assert.*;
 
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.onap.aai.config.NodesConfiguration;
-import org.onap.aai.nodes.NodeIngestor;
-import org.onap.aai.setup.SchemaVersionsBean;
 import org.onap.aai.testutils.BadEdgeConfigForValidationTest;
 import org.onap.aai.validation.CheckEverythingStrategy;
 import org.springframework.beans.factory.annotation.Autowired;
index ca6b317..6094321 100644 (file)
@@ -22,12 +22,9 @@ package org.onap.aai.validation.edges;
 
 import static org.junit.Assert.*;
 
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.onap.aai.config.NodesConfiguration;
-import org.onap.aai.nodes.NodeIngestor;
-import org.onap.aai.setup.SchemaVersionsBean;
 import org.onap.aai.testutils.GoodConfigForValidationTest;
 import org.onap.aai.validation.CheckEverythingStrategy;
 import org.springframework.beans.factory.annotation.Autowired;
index cc38915..e80e2fe 100644 (file)
@@ -25,13 +25,10 @@ import static org.junit.Assert.*;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.onap.aai.config.NodesConfiguration;
-import org.onap.aai.nodes.NodeIngestor;
 import org.onap.aai.setup.SchemaVersion;
-import org.onap.aai.setup.SchemaVersionsBean;
 import org.onap.aai.testutils.TestUtilConfigTranslator;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
index e164df0..93cb2ab 100644 (file)
@@ -27,8 +27,6 @@ import org.junit.runner.RunWith;
 import org.onap.aai.config.NodesConfiguration;
 import org.onap.aai.testutils.BadNodeConfigForValidationTest;
 import org.onap.aai.validation.CheckEverythingStrategy;
-import org.onap.aai.validation.nodes.DefaultDuplicateNodeDefinitionValidationModule;
-import org.onap.aai.validation.nodes.NodeValidator;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.annotation.DirtiesContext;
index 288913b..c2e7b7b 100644 (file)
@@ -41,10 +41,8 @@ import org.onap.aai.config.NodesConfiguration;
 import org.onap.aai.nodes.NodeIngestor;
 import org.onap.aai.setup.SchemaVersion;
 import org.onap.aai.testutils.SchemaIncompleteTranslator;
-import org.springframework.beans.factory.BeanCreationException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.context.annotation.Import;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
index 81b69e6..893dd04 100644 (file)
@@ -27,8 +27,6 @@ import org.junit.runner.RunWith;
 import org.onap.aai.config.NodesConfiguration;
 import org.onap.aai.testutils.GoodConfigForValidationTest;
 import org.onap.aai.validation.CheckEverythingStrategy;
-import org.onap.aai.validation.nodes.DefaultDuplicateNodeDefinitionValidationModule;
-import org.onap.aai.validation.nodes.NodeValidator;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.ContextConfiguration;
index f5494ba..61e8acf 100644 (file)
@@ -25,11 +25,9 @@ package org.onap.aaiutils.oxm;
 public class OxmModelLoaderConstants {
 
     public static final String AaiUtils_FILESEP =
-        (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator");
+            (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator");
 
-    public static final String AaiUtils_SPECIFIC_CONFIG =
-        System.getProperty("CONFIG_HOME") + AaiUtils_FILESEP;
+    public static final String AaiUtils_SPECIFIC_CONFIG = System.getProperty("CONFIG_HOME") + AaiUtils_FILESEP;
 
-    public static final String AaiUtils_HOME_MODEL =
-        AaiUtils_SPECIFIC_CONFIG + "model" + AaiUtils_FILESEP;
+    public static final String AaiUtils_HOME_MODEL = AaiUtils_SPECIFIC_CONFIG + "model" + AaiUtils_FILESEP;
 }
diff --git a/pom.xml b/pom.xml
index 5831dfd..bb14f04 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -99,6 +99,7 @@
                             <importOrder>
                                 <order>com,java,javax,org</order>
                             </importOrder>
+                            <removeUnusedImports/>
                         </java>
                     </configuration>
                     <!-- https://github.com/diffplug/spotless/tree/master/plugin-maven