aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVenkata Harish K Kajur <vk250x@att.com>2018-01-30 13:52:34 -0500
committerVenkata Harish K Kajur <vk250x@att.com>2018-02-28 11:36:08 -0500
commit4f13d6cc64eed0ef75a31ec5f490853267447ab1 (patch)
treecb7066e12fc39038cc99b74bbeba879c9eb6ca8c
parent73539cae6d24e352b84a6411e523da734fbc19e2 (diff)
Turn ajsc 2 to using ajsc 6 spring boot
Issue-ID: AAI-800 Change-Id: Id174ec5088ddea57f18e605d004c417bee8fbf33 Signed-off-by: Venkata Harish K Kajur <vk250x@att.com>
-rw-r--r--aai-resources/ajsc-shared-config/etc/basic-logback_root_logger_level_off.xml107
-rw-r--r--aai-resources/ajsc-shared-config/etc/csm-framework-app.properties11
-rw-r--r--aai-resources/antBuild/build.xml231
-rw-r--r--aai-resources/bundleconfig-local/README.txt10
-rw-r--r--aai-resources/bundleconfig-local/RELEASE_NOTES.txt1
-rw-r--r--aai-resources/bundleconfig-local/etc/appprops/aaiEventDMaaPPublisher.properties4
-rw-r--r--aai-resources/bundleconfig-local/etc/service-file-monitor.properties5
-rw-r--r--aai-resources/bundleconfig-local/etc/sysprops/sys-props.properties138
-rw-r--r--aai-resources/bundleconfig-local/etc/sysprops/template.sys-props.properties115
-rw-r--r--aai-resources/bundleconfig-local/symlinks.txt6
-rw-r--r--aai-resources/pom.xml926
-rw-r--r--aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/conf/FileMonitorBeans.xml20
-rw-r--r--aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/conf/jaxrsBeans.groovy29
-rw-r--r--aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/conf/serviceBeans.xml101
-rw-r--r--aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/docs/README.txt1
-rw-r--r--aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/lib/README.txt1
-rw-r--r--aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/props/module.props1
-rw-r--r--aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/routes/aai.route4
-rw-r--r--aai-resources/src/main/assemble/ajsc_module_assembly.xml66
-rw-r--r--aai-resources/src/main/assemble/ajsc_props_assembly.xml23
-rw-r--r--aai-resources/src/main/assemble/ajsc_runtime_assembly.xml44
-rw-r--r--aai-resources/src/main/assembly/descriptor.xml32
-rw-r--r--aai-resources/src/main/config/ajsc-jetty.xml164
-rw-r--r--aai-resources/src/main/config/ajsc-jolokia-override-web.xml46
-rw-r--r--aai-resources/src/main/config/ajsc-override-web.xml41
-rw-r--r--aai-resources/src/main/config/ajsc-request.xml49
-rw-r--r--aai-resources/src/main/config/hazelcast-client.properties25
-rw-r--r--aai-resources/src/main/config/jul-redirect.properties13
-rw-r--r--aai-resources/src/main/config/keyfile27
-rw-r--r--aai-resources/src/main/config/logback-migration.xml56
-rw-r--r--aai-resources/src/main/config/runner-web.xml106
-rw-r--r--aai-resources/src/main/docker/Dockerfile22
-rw-r--r--aai-resources/src/main/docker/aai.sh (renamed from aai-resources/src/main/resources/docker/aai.sh)0
-rw-r--r--aai-resources/src/main/docker/docker-entrypoint.sh110
-rw-r--r--aai-resources/src/main/java/org/onap/aai/Profiles.java (renamed from aai-resources/src/main/java/org/onap/aai/ajsc_aai/filemonitor/ServicePropertiesListener.java)20
-rw-r--r--aai-resources/src/main/java/org/onap/aai/ResourcesApp.java159
-rw-r--r--aai-resources/src/main/java/org/onap/aai/ajsc_aai/JaxrsErrorMessageLookupService.java99
-rw-r--r--aai-resources/src/main/java/org/onap/aai/ajsc_aai/filemonitor/ServicePropertiesMap.java127
-rw-r--r--aai-resources/src/main/java/org/onap/aai/ajsc_aai/filemonitor/ServicePropertyService.java219
-rw-r--r--aai-resources/src/main/java/org/onap/aai/config/JettyPasswordDecoder.java (renamed from aai-resources/src/main/java/org/onap/aai/config/DmaapConfig.java)24
-rw-r--r--aai-resources/src/main/java/org/onap/aai/config/PasswordDecoder.java27
-rw-r--r--aai-resources/src/main/java/org/onap/aai/config/PropertyPasswordConfiguration.java83
-rw-r--r--aai-resources/src/main/java/org/onap/aai/dbgen/DupeTool.java1900
-rw-r--r--aai-resources/src/main/java/org/onap/aai/dbgen/ForceDeleteTool.java109
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/AAIContainerFilter.java (renamed from aai-resources/src/main/java/org/onap/aai/ajsc_aai/util/ServicePropertiesMapBean.java)29
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/AAIHeaderProperties.java18
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/AAILogJAXRSInInterceptor.java285
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/AAILogJAXRSOutInterceptor.java303
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/PreAaiAjscInterceptor.java61
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/package-info.java38
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/post/AAIResponseFilterPriority.java34
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/post/ResetLoggingContext.java (renamed from aai-resources/src/main/java/org/onap/aai/interceptors/PostAaiAjscInterceptor.java)52
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/post/ResponseHeaderManipulation.java51
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/post/ResponseTransactionLogging.java127
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/pre/AAIRequestFilterPriority.java (renamed from aai-resources/src/main/java/org/onap/aai/ajsc_aai/JaxrsUserService.java)44
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/pre/HeaderValidation.java89
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestHeaderManipulation.java72
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestModification.java78
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java106
-rw-r--r--aai-resources/src/main/java/org/onap/aai/interceptors/pre/SetLoggingContext.java71
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java63
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkUriInfo.java20
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/retired/RetiredConsumer.java3
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/util/EchoResponse.java14
-rw-r--r--aai-resources/src/main/java/org/onap/aai/util/AAIAppServletContextListener.java120
-rw-r--r--aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java151
-rw-r--r--aai-resources/src/main/java/org/onap/aai/web/LocalHostAccessLog.java60
-rw-r--r--aai-resources/src/main/java/org/onap/aai/web/WebConfiguration.java48
-rw-r--r--aai-resources/src/main/jenkins/Jenkinsfile31
-rw-r--r--aai-resources/src/main/jenkins/build.groovy14
-rw-r--r--aai-resources/src/main/jenkins/checkout.groovy14
-rw-r--r--aai-resources/src/main/jenkins/deploy.groovy15
-rw-r--r--aai-resources/src/main/kubernetes/ajsc6configdemo-rc.yaml28
-rw-r--r--aai-resources/src/main/kubernetes/ajsc6configdemo-svc.yaml21
-rw-r--r--aai-resources/src/main/kubernetes/ajsc6configdemo.yaml8
-rw-r--r--aai-resources/src/main/kubernetes/kubectl.conf22
-rw-r--r--aai-resources/src/main/resources/application.properties70
-rw-r--r--aai-resources/src/main/resources/bootstrap.properties16
-rw-r--r--aai-resources/src/main/resources/docker/Dockerfile.ext76
-rw-r--r--aai-resources/src/main/resources/docker/commonLibs/README1
-rw-r--r--aai-resources/src/main/resources/docker/docker-entrypoint.sh104
-rw-r--r--aai-resources/src/main/resources/docker/init-chef.sh104
-rw-r--r--aai-resources/src/main/resources/etc/VNT-migration-data/VNT-migration-input.csv (renamed from aai-resources/bundleconfig-local/etc/VNT-migration-data/VNT-migration-input.csv)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/Introscope.properties (renamed from aai-resources/bundleconfig-local/etc/appprops/Introscope.properties)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/PostProcessorInterceptors.properties (renamed from aai-resources/bundleconfig-local/etc/appprops/PostProcessorInterceptors.properties)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/PreProcessorInterceptors.properties (renamed from aai-resources/bundleconfig-local/etc/appprops/PreProcessorInterceptors.properties)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/aaiconfig.properties (renamed from aai-resources/bundleconfig-local/etc/appprops/aaiconfig.properties)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/app-intercepts.properties (renamed from aai-resources/bundleconfig-local/etc/appprops/app-intercepts.properties)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/caet.properties (renamed from aai-resources/bundleconfig-local/etc/appprops/caet.properties)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/createDBSchema-logback.xml (renamed from aai-resources/bundleconfig-local/etc/appprops/createDBSchema-logback.xml)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/dataGrooming-logback.xml (renamed from aai-resources/bundleconfig-local/etc/appprops/dataGrooming-logback.xml)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/dataSnapshot-logback.xml (renamed from aai-resources/bundleconfig-local/etc/appprops/dataSnapshot-logback.xml)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/default-logback.xml (renamed from aai-resources/bundleconfig-local/etc/appprops/default-logback.xml)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/dupeTool-logback.xml62
-rw-r--r--aai-resources/src/main/resources/etc/appprops/dynamic.properties (renamed from aai-resources/bundleconfig-local/etc/appprops/dynamic.properties)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/dynamicPayloadGenerator-logback.xml (renamed from aai-resources/bundleconfig-local/etc/appprops/dynamicPayloadGenerator-logback.xml)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/error.properties (renamed from aai-resources/bundleconfig-local/etc/appprops/error.properties)1
-rw-r--r--aai-resources/src/main/resources/etc/appprops/forceDelete-logback.xml (renamed from aai-resources/bundleconfig-local/etc/appprops/forceDelete-logback.xml)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/getres-logback.xml (renamed from aai-resources/bundleconfig-local/etc/appprops/getres-logback.xml)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/loadDataForDHV-logback.xml (renamed from aai-resources/bundleconfig-local/etc/appprops/loadDataForDHV-logback.xml)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/logging.properties (renamed from aai-resources/bundleconfig-local/etc/appprops/logging.properties)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/methodMapper.properties (renamed from aai-resources/bundleconfig-local/etc/appprops/methodMapper.properties)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/migration-logback.xml (renamed from aai-resources/bundleconfig-local/etc/appprops/migration-logback.xml)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/preferredRoute.txt (renamed from aai-resources/bundleconfig-local/etc/appprops/preferredRoute.txt)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/pullInvData-logback.xml (renamed from aai-resources/bundleconfig-local/etc/appprops/pullInvData-logback.xml)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/schemaMod-logback.xml (renamed from aai-resources/bundleconfig-local/etc/appprops/schemaMod-logback.xml)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/titan-cached.properties (renamed from aai-resources/bundleconfig-local/etc/appprops/titan-cached.properties)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/titan-realtime.properties (renamed from aai-resources/bundleconfig-local/etc/appprops/titan-realtime.properties)0
-rw-r--r--aai-resources/src/main/resources/etc/appprops/uniquePropertyCheck-logback.xml (renamed from aai-resources/bundleconfig-local/etc/appprops/uniquePropertyCheck-logback.xml)0
-rw-r--r--aai-resources/src/main/resources/etc/auth/aai-client-cert.p12bin0 -> 5924 bytes
-rw-r--r--aai-resources/src/main/resources/etc/auth/aai_keystore (renamed from aai-resources/bundleconfig-local/etc/auth/aai_keystore)bin3811 -> 3811 bytes
-rw-r--r--aai-resources/src/main/resources/etc/auth/realm.properties (renamed from aai-resources/src/main/config/realm.properties)0
-rw-r--r--aai-resources/src/main/resources/etc/scriptdata/tenant_isolation/nodes.json (renamed from aai-resources/bundleconfig-local/etc/scriptdata/tenant_isolation/nodes.json)0
-rw-r--r--aai-resources/src/main/resources/etc/scriptdata/tenant_isolation/nodesAZCloud.json (renamed from aai-resources/bundleconfig-local/etc/scriptdata/tenant_isolation/nodesAZCloud.json)0
-rw-r--r--aai-resources/src/main/resources/etc/scriptdata/tenant_isolation/nodesNoAZ.json (renamed from aai-resources/bundleconfig-local/etc/scriptdata/tenant_isolation/nodesNoAZ.json)0
-rw-r--r--aai-resources/src/main/resources/etc/tmp-config/hbase-site.xml (renamed from aai-resources/bundleconfig-local/etc/tmp-config/hbase-site.xml)0
-rw-r--r--aai-resources/src/main/resources/etc/tosca-migration-data/edgeLabelMigration.csv (renamed from aai-resources/bundleconfig-local/etc/tosca-migration-data/edgeLabelMigration.csv)0
-rw-r--r--aai-resources/src/main/resources/localhost-access-logback.xml (renamed from aai-resources/ajsc-shared-config/etc/localhost-access-logback.xml)3
-rw-r--r--aai-resources/src/main/resources/logback.xml (renamed from aai-resources/ajsc-shared-config/etc/logback.xml)69
-rw-r--r--aai-resources/src/main/resources/logmessages.properties6
-rw-r--r--aai-resources/src/main/runtime/context/__module.ajsc.namespace.name__#__module.ajsc.namespace.version__.context1
-rw-r--r--aai-resources/src/main/runtime/context/default#0.context1
-rw-r--r--aai-resources/src/main/runtime/deploymentPackage/__module.ajsc.namespace.name__#__module.ajsc.namespace.version__.json1
-rw-r--r--aai-resources/src/main/runtime/shiroRole/ajscadmin.json1
-rw-r--r--aai-resources/src/main/runtime/shiroRole/contextadmin#__module.ajsc.namespace.name__.json1
-rw-r--r--aai-resources/src/main/runtime/shiroRole/contextadmin#default.json1
-rw-r--r--aai-resources/src/main/runtime/shiroUser/ajsc.json1
-rw-r--r--aai-resources/src/main/runtime/shiroUserRole/ajsc#ajscadmin.json1
-rw-r--r--aai-resources/src/main/runtime/shiroUserRole/ajsc#contextadmin#__module.ajsc.namespace.name__.json1
-rw-r--r--aai-resources/src/main/runtime/shiroUserRole/ajsc#contextadmin#default.json1
-rw-r--r--aai-resources/src/main/scripts/audit_schema.sh33
-rw-r--r--aai-resources/src/main/scripts/common_functions.sh56
-rw-r--r--aai-resources/src/main/scripts/createDBSchema.sh27
-rw-r--r--aai-resources/src/main/scripts/deleteTool.sh4
-rw-r--r--aai-resources/src/main/scripts/dupeTool.sh73
-rw-r--r--aai-resources/src/main/scripts/dynamicPayloadArchive.sh7
-rw-r--r--aai-resources/src/main/scripts/dynamicPayloadGenerator.sh42
-rw-r--r--aai-resources/src/main/scripts/edgeTagger.sh40
-rw-r--r--aai-resources/src/main/scripts/forceDeleteTool.sh32
-rw-r--r--aai-resources/src/main/scripts/getTool.sh6
-rw-r--r--aai-resources/src/main/scripts/install/addManualData.sh14
-rw-r--r--aai-resources/src/main/scripts/putTool.sh8
-rw-r--r--aai-resources/src/main/scripts/rshipTool.sh10
-rw-r--r--aai-resources/src/main/scripts/run_DbTestProcessBuilder.sh51
-rw-r--r--aai-resources/src/main/scripts/run_Migrations.sh81
-rw-r--r--aai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/docker-compose.template.yaml (renamed from aai-resources/src/main/scripts/run_FixXSD.sh)66
-rw-r--r--aai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/execTool.sh18
-rwxr-xr-xaai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/kill_resources.sh7
-rwxr-xr-xaai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/start_resources.sh6
-rwxr-xr-xaai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/stop_resources.sh6
-rw-r--r--aai-resources/src/main/swm/package/nix/install/postproc/post_proc4
-rw-r--r--aai-resources/src/main/swm/package/nix/install/preproc/pre_proc4
-rw-r--r--aai-resources/src/test/java/org/onap/aai/AAISetup.java6
-rw-r--r--aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java125
-rw-r--r--aai-resources/src/test/java/org/onap/aai/dbgen/DupeToolTest.java150
-rw-r--r--aai-resources/src/test/java/org/onap/aai/dbgen/ForceDeleteToolTest.java210
-rw-r--r--aai-resources/src/test/java/org/onap/aai/interceptors/AAILogJAXRSInInterceptorTest.java205
-rw-r--r--aai-resources/src/test/java/org/onap/aai/interceptors/AAILogJAXRSOutInterceptorTest.java112
-rw-r--r--aai-resources/src/test/java/org/onap/aai/interceptors/PostAaiAjscInterceptorTest.java77
-rw-r--r--aai-resources/src/test/java/org/onap/aai/interceptors/PreAaiAjscInterceptorTest.java63
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java4
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java28
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/PserverTest.java115
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java2
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java2
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/retired/RetiredConsumerTest.java3
-rw-r--r--aai-resources/src/test/java/org/onap/aai/schema/db/AuditOXMTest.java84
-rw-r--r--aai-resources/src/test/java/org/onap/aai/serialization/db/DBSerializerMaxRetryTest.java83
-rw-r--r--aai-resources/src/test/java/org/onap/aai/util/AAIAppServletContextListenerTest.java176
-rw-r--r--aai-resources/src/test/java/org/onap/aai/util/AAICSVWriterTest.java173
-rw-r--r--aai-resources/src/test/resources/application-test.properties70
-rw-r--r--aai-resources/src/test/resources/logback.xml350
-rwxr-xr-xdeploy.sh77
-rw-r--r--docker-compose.yml78
-rw-r--r--pom.xml438
175 files changed, 5749 insertions, 5391 deletions
diff --git a/aai-resources/ajsc-shared-config/etc/basic-logback_root_logger_level_off.xml b/aai-resources/ajsc-shared-config/etc/basic-logback_root_logger_level_off.xml
deleted file mode 100644
index 047da14..0000000
--- a/aai-resources/ajsc-shared-config/etc/basic-logback_root_logger_level_off.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-<!--
-
- ============LICENSE_START=======================================================
- org.onap.aai
- ================================================================================
- Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
-
- ECOMP is a trademark and service mark of AT&T Intellectual Property.
-
--->
-<configuration scan="true" scanPeriod="3 seconds" debug="true">
- <property name="logDirectory" value="${AJSC_HOME}/log" />
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>ERROR</level>
- </filter>
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n
- </pattern>
- </encoder>
- </appender>
-
- <appender name="INFO"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>DEBUG</level>
- </filter>
- <file>${logDirectory}/info_ajsc.log</file>
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${logDirectory}/info_ajsc.%i.log.zip
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>9</maxIndex>
- </rollingPolicy>
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>5MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern>
- </encoder>
- </appender>
- <appender name="ERROR"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>ERROR</level>
- </filter>
- <file>${logDirectory}/error_ajsc.log</file>
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${logDirectory}/error_ajsc.%i.log.zip
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>9</maxIndex>
- </rollingPolicy>
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>5MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n"</pattern> -->
- <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern>
- </encoder>
- </appender>
-
- <appender name="AJSC-AUDIT" class="ch.qos.logback.classic.net.SyslogAppender">
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>INFO</level>
- </filter>
- <syslogHost>localhost</syslogHost>
- <facility>USER</facility>
- <!-- Note the colon character below - it is important part of "TAG" message
- format You need a colon to determine where the TAG field ends and the CONTENT
- begins -->
- <suffixPattern>AJSC_AUDIT: [%thread] [%logger] %msg</suffixPattern>
- </appender>
- <appender name="CONTROLLER-AUDIT" class="ch.qos.logback.classic.net.SyslogAppender">
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>INFO</level>
- </filter>
- <syslogHost>localhost</syslogHost>
- <facility>USER</facility>
- <!-- Note the colon character below - it is important part of "TAG" message
- format You need a colon to determine where the TAG field ends and the CONTENT
- begins -->
- <suffixPattern>AJSC_AUDIT: [%thread] [%logger] mdc:[%mdc] %msg
- </suffixPattern>
- </appender>
-
- <root level="off">
- <appender-ref ref="ERROR" />
- <appender-ref ref="INFO" />
- <appender-ref ref="STDOUT" />
- </root>
-</configuration>
diff --git a/aai-resources/ajsc-shared-config/etc/csm-framework-app.properties b/aai-resources/ajsc-shared-config/etc/csm-framework-app.properties
deleted file mode 100644
index 140fde3..0000000
--- a/aai-resources/ajsc-shared-config/etc/csm-framework-app.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-# The csm-persist-to property identifies the file that the CSM Framework
-# will write the current configuration to whenever it is told to save it's
-# configuration.
-#
-#csm-persist-to=/opt/app/myapplication/csm.properties.persisted
-
-#Important . Please specify absolute path starting from the root directory for Property csm-persist-to
-#(Giving relative path may result in undesired results in case the applcation is restarted from a different directory than the original start directory )
-#In the following example , relative path is specfied since the directory structure varies on diff env
-
-csm-persist-to=/opt/app/q103csi1m8/DATA/${ChangeMe_RELEASE}/${ChangeMe_CLUSTER}_ACFS_csm.properties.persisted
diff --git a/aai-resources/antBuild/build.xml b/aai-resources/antBuild/build.xml
deleted file mode 100644
index 5875c06..0000000
--- a/aai-resources/antBuild/build.xml
+++ /dev/null
@@ -1,231 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2016 AT&T Intellectual Property. All rights reserved.
--->
-<project>
- <target name="runLocal">
- <java dir="${basedir}" fork="yes" newenvironment="true"
- failonerror="true" classname="com.att.ajsc.runner.Runner">
- <classpath
- path="${classpath}:${basedir}/ajsc-shared-config/etc:${runAjscHome}/lib/ajsc-runner-${ajscRuntimeVersion}.jar" />
-
- <!-- Windows Users may need to add a jvmarg arg to create a temp directory
- properly. -->
- <!-- <jvmarg value="-Djava.io.tmpdir=C:/yourTempDirectory"/> -->
-
- <!-- Uncomment the following 2 jvmarg values to enable Remote Debugging.
- -->
- <!-- <jvmarg value="-Xdebug" /> -->
- <!-- <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5432"
- /> -->
-
- <jvmarg value="-XX:MaxPermSize=512m" />
- <jvmarg value="-Xmx1024m" />
-
- <!-- Main ajsc Variables below (Variables necessary for proper startup
- of AJSC) -->
- <env key="AJSC_HOME" value="${runAjscHome}" />
- <sysproperty key="AJSC_HOME" value="${runAjscHome}" />
- <!-- you may specify any external location for AJSC_CONF_HOME where etc
- folder & all other configs can be found under it. If not specified, it will
- default to AJSC_HOME -->
- <sysproperty key="AJSC_CONF_HOME" value="${basedir}/bundleconfig-local" />
- <sysproperty key="AJSC_SHARED_CONFIG" value="${basedir}/ajsc-shared-config" />
-
- <!-- Location of logback.xml file used for logging configurations. Please,
- note, when deploying a service to either CSI or NON-CSI environment, this
- system property will be set in sys-props.properties file. We are setting
- it here for running locally due to the ease of use of maven variable for
- basedir. -->
- <sysproperty key="logback.configurationFile"
- value="${basedir}/ajsc-shared-config/etc/logback.xml" />
-
- <!-- Setting system properties for the AJSC external libs and properties
- folders below. When deploying to a node, these properties will be set within
- the bundleconfig/etc/sysprops/sys-props.properties file. However, when running
- locally, the ${basedir} substitution works more efficiently in this manner. -->
- <sysproperty key="AJSC_EXTERNAL_LIB_FOLDERS" value="${basedir}/target/commonLibs" />
- <sysproperty key="AJSC_EXTERNAL_PROPERTIES_FOLDERS"
- value="${basedir}/ajsc-shared-config/etc" />
-
- <!-- End of Main ajsc Variables below (Variables necessary for proper
- startup of AJSC) -->
-
- <!-- Uncomment the following line to add oauthentication to your Service -->
- <!-- <sysproperty key="spring.profiles.active" value="oauth" /> -->
-
- <!-- If using Cassandra as Database, Enter the ip/host and port below
- based on your known configuration -->
- <!-- <sysproperty key="cassandra.ip" value="hostname" /> -->
- <!-- <sysproperty key="cassandra.port" value="9042" /> -->
-
- <!-- The APP_SERVLET_URL_PATTERN variable is defaulted to "/services"
- within the initial configuration of the AJSC. If you are changing the CamelServlet
- Filter within the ajsc-override-web.xml, you should use that url-pattern
- here. This is necessary to properly register your service with dme2. An empty
- value, "", is used when NO value is wanted (url-pattern would be /* for CamelServlet
- Filter) -->
- <!-- As of 4.5.1, this property is no longer needed -->
- <!-- <sysproperty key="APP_SERVLET_URL_PATTERN" value="/services" /> -->
-
- <!-- GRM/DME2 System Properties below -->
- <sysproperty key="AJSC_SERVICE_NAMESPACE" value="${module.ajsc.namespace.name}" />
- <sysproperty key="AJSC_SERVICE_VERSION" value="${module.ajsc.namespace.version}" />
- <sysproperty key="SOACLOUD_SERVICE_VERSION" value="${project.version}" />
- <!-- End of GRM/DME2 System Property Variables -->
-
- <!-- The following server.port variable was necessary for the proper registration
- of the AJSC to dme2. This value may still need to be used if the Developer
- is hardcoding their port (example: 8080). Then, the server.port value="8080".
- The default functionality for the AJSC is to use EPHEMERAL ports. In this
- case, you do NOT need to set the server.port value. The AJSC will find the
- proper port value and register to dme2 correctly -->
- <!-- <sysproperty key="server.port" value="${serverPort}" /> -->
-
- <!-- Command Line Arguments to add to the java command. Here, you can
- specify the port as well as the Context you want your service to run in.
- Use context=/ to run in an unnamed Context (Root Context). The default configuration
- of the AJSC is to run under the /ajsc Context. Setting the port here can
- aid during the development phase of your service. However, you can leave
- this argument out entirely, and the AJSC will default to using an Ephemeral
- port. -->
- <arg line="context=/ port=${serverPort} sslport=${sslport}" />
- </java>
- </target>
- <target name="prep_home_directory_for_swm_pkgcreate">
-
-<!-- ********* GENERATE CADI KEY AND ENCRYPTED PASSWORD ***********
-
- Uncomment the following if your cadi key get corrupted , It would
- generate the Cadi key and password in the package phase and keep the key
- in the 'src/main/config/ajscKey' and password in the bottom of cadi.properties(you
- need to modify the 'aaf_pass' variable with this value . Plese modify the
- template.cadi.properties as well before uploading to SOA node
--->
-
-<!--
- <java jar="${basedir}/target/userjars/cadi-core-1.2.5.jar" fork="true">
- <arg value="keygen" /> <arg value="src/main/config/ajscKey" />
- </java>
-
- <echo>***Cadi Key file generated ****</echo>
-
- <java jar="${basedir}/target/userjars/cadi-core-1.2.5.jar"
- fork="true" append="true" output="${basedir}/src/main/config/cadi.properties">
- <arg value="digest" /> <arg value="ajscRocks!" /> <arg value="src/main/config/ajscKey"
- />
- </java>
-
--->
-
-
-
- <!-- These tasks are copying contents from the installHomeDirectory into
- the eventual $AJSC_HOME directory for running locally and soa cloud installation -->
- <echo message="ENTERING 'prep_home_directory_for_swm_pkgcreate' ant tasks" />
-
- <!-- Please, NOTE: The ajsc-archetype is setup for a default CSI Env deployment.
- If you are deploying to a CSI Env, you should NOT have to change anything
- within this build file. However, if you are NOT deploying to a CSI Env, you
- should comment OUT the CSI related portion of this build.xml. -->
-
- <!-- The following code snippet is copying the bundleconfig-csi directory
- to the proper installation/bundleconfig directory used in CSI envs. If you
- are NOT installing to a CSI node, you should comment out (or delete) the
- following snippet, and uncomment the NON-CSI copy task to copy EVERYTHING
- to the installation/bundleconfig directory. -->
-
- <!-- CSI related bundleconfig copy task. If you are NOT deploying to a
- CSI Env, please COMMENT OUT or delete the following copy task code snippet. -->
- <!--<copy toDir="${basedir}/target/swm/package/nix/dist_files${distFilesRoot}/bundleconfig"
- failonerror="true"> <fileset dir="${basedir}/bundleconfig-csi" /> </copy> -->
- <!-- End of CSI related bundleconfig copy task -->
-
- <!-- NOTE: If you are NOT deploying to CSI environment, and you are NOT
- using an AJSC_SHARED_CONFIG location on a node, you should go ahead and copy
- EVERYTHING from bundleconfig and ajsc-shared-config (logback.xml) directory
- to utilize proper logging from logback.xml. Simply, uncomment the following
- code snippet below to copy EVERYTHING and comment out the CSI related build
- script above. -->
- <!-- NON-CSI related build copy task. Please, uncomment the following code
- snippet to deploy the proper artifacts to a NON-CSI Env. -->
- <copy
- toDir="${basedir}/target/swm/package/nix/dist_files${distFilesRoot}/bundleconfig"
- failonerror="true">
- <fileset dir="${basedir}/bundleconfig-local" includes="**/**" />
- </copy>
- <copy
- toDir="${basedir}/target/swm/package/nix/dist_files${distFilesRoot}/bundleconfig/etc"
- failonerror="true">
- <fileset dir="${basedir}/ajsc-shared-config/etc" includes="**/**" />
- </copy>
- <!-- End of NON-CSI related build copy task. -->
-
- <!-- Copying any zips (deployment packages) to $AJSC_HOME/services for
- auto-deployment -->
- <copy
- toDir="${basedir}/target/swm/package/nix/dist_files${distFilesRoot}/services"
- failonerror="false">
- <fileset dir="${basedir}/services" includes="*.zip" />
- </copy>
-
- <!-- Copying runtimeEnvironment zip file to $AJSC_HOME/runtime and renaming
- runtimeEnvironment.zip for proper auto-deployment of ajsc services. -->
- <!-- <copy
- tofile="${basedir}/target/swm/package/nix/dist_files${distFilesRoot}/runtime/runtimeEnvironment.zip">
- <fileset dir="target" includes="*-runtimeEnvironment.zip" />
- </copy>
--->
- <!-- Copying dependencies from the service project (not provided by AJSC
- Container) to the $AJSC_HOME/extJars folder to be accessible on the classpath -->
- <copy
- toDir="${basedir}/target/swm/package/nix/dist_files${distFilesRoot}/extJars"
- failonerror="false">
- <fileset dir="target/userjars" includes="*" />
- </copy>
-
- <!-- extApps directory MUST be created for ajsc-runner to run correctly,
- even if empty. DO NOT REMOVE!!! -->
- <!-- extApps directory created to deploy other war files on startup or
- hot deploy War files after ajsc starts up. -->
- <mkdir
- dir="${basedir}/target/swm/package/nix/dist_files${distFilesRoot}/extApps" />
-
- <!-- Copying any extra wars to $AJSC_HOME/extApps to be deployed within
- AJSC -->
- <copy
- toDir="${basedir}/target/swm/package/nix/dist_files${distFilesRoot}/extApps"
- failonerror="false">
- <fileset dir="${basedir}/src/main/resources/extApps"
- includes="*" />
- </copy>
-
- <!-- staticContent folder is for serving static content within an ajsc
- service. Any static content to be served will be copyied to the ultimate
- $AJSC_HOME/staticContent folder and can be served with the
- camel component. -->
- <!-- Uncomment the following snippet to copy items from staticContent folder
- to ultimate $AJSC_HOME/staticConent -->
- <!-- <copy toDir="${basedir}/target/swm/package/nix/dist_files${distFilesRoot}/staticContent"
- failonerror="false"> <fileset dir="${basedir}/staticContent" includes="**/**"
- /> </copy> -->
-
- <!-- Copying extra jar files that have been labeled as dependencies in
- service project to /extJars folder to be made available on the classpath
- for your service -->
- <copy
- toDir="${basedir}/target/swm/package/nix/dist_files${distFilesRoot}/extJars"
- failonerror="false">
- <fileset dir="target" includes="*.jar" />
- </copy>
-
- <!-- Copying deployment packages created within the project to the $AJSC_HOME/services
- folder to be auto deployed. -->
- <copy
- toDir="${basedir}/target/swm/package/nix/dist_files${distFilesRoot}/services">
- <fileset dir="target" includes="*.zip" excludes="*-runtimeEnvironment.zip" />
- </copy>
-
- <echo message="EXITING 'prep_assembly_output_for_swm_plugin' ant tasks" />
- </target>
-</project>
diff --git a/aai-resources/bundleconfig-local/README.txt b/aai-resources/bundleconfig-local/README.txt
deleted file mode 100644
index 82a355f..0000000
--- a/aai-resources/bundleconfig-local/README.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-The bundleconfig-local directory contains the necessary configuration files to be used for running locally. When running
-locally, the "mvn -P runLocal" or the "mvn -P runAjsc" profiles will be using this bundleconfig-local directory as the AJSC_CONF
-directory. When deploying to a CSI env, the bundleconfig-csi directory will be copied to the ultimate installation/bundleconfig
-directory and will be used for your AJSC service once installed. If you are not deploying to a CSI env, please look at the
-antBuild/build.xml file for help in some simple copying of the appropriate folders/files for a NON-CSI env.
-
-
-The ajsc-shared-config directory houses the shared configurations that will be used in CSI envs. This includes the logging
-functionality of the logback.xml and some csm related artifacts that may be necessary to use while running locally.
-When running locally, the system property, "AJSC_SHARED_CONFIG", will point to this location to utilize the logback.xml.
diff --git a/aai-resources/bundleconfig-local/RELEASE_NOTES.txt b/aai-resources/bundleconfig-local/RELEASE_NOTES.txt
deleted file mode 100644
index a567d9b..0000000
--- a/aai-resources/bundleconfig-local/RELEASE_NOTES.txt
+++ /dev/null
@@ -1 +0,0 @@
-Place Release Notes here to provide updated Release information for CSTEM to better help manage your service in the CSI environment. \ No newline at end of file
diff --git a/aai-resources/bundleconfig-local/etc/appprops/aaiEventDMaaPPublisher.properties b/aai-resources/bundleconfig-local/etc/appprops/aaiEventDMaaPPublisher.properties
deleted file mode 100644
index 9981919..0000000
--- a/aai-resources/bundleconfig-local/etc/appprops/aaiEventDMaaPPublisher.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-Protocol=http
-contenttype=application/json
-host=localhost:3904
-topic=AAI-EVENT \ No newline at end of file
diff --git a/aai-resources/bundleconfig-local/etc/service-file-monitor.properties b/aai-resources/bundleconfig-local/etc/service-file-monitor.properties
deleted file mode 100644
index 4d9bee9..0000000
--- a/aai-resources/bundleconfig-local/etc/service-file-monitor.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-#This properties file is used for defining any file paths that you would like to have monitored.
-
-#user config file paths go here as (key-value) pairs. File extension will have to be either .properties or .json in order for it to be monitored.
-#file1=/opt/app/yourService/file.properties
-
diff --git a/aai-resources/bundleconfig-local/etc/sysprops/sys-props.properties b/aai-resources/bundleconfig-local/etc/sysprops/sys-props.properties
deleted file mode 100644
index 79b1f8e..0000000
--- a/aai-resources/bundleconfig-local/etc/sysprops/sys-props.properties
+++ /dev/null
@@ -1,138 +0,0 @@
-#This file is used for defining AJSC system properties for different configuration schemes and is necessary for the AJSC to run properly.
-#The sys-props.properties file is used for running locally. The template.sys-props.properties file will be used when deployed
-#to a SOA/CSI Cloud node.
-
-#AJSC System Properties. The following properties are required for ALL AJSC services. If you are adding System Properties for your
-#particular service, please add them AFTER all AJSC related System Properties.
-
-#For Cadi Authorization, use value="authentication-scheme-1
-CadiAuthN=authentication-scheme-1
-
-#For Basic Authorization, use value="authentication-scheme-1
-authN=authentication-scheme-2
-
-#Persistence used for AJSC meta-data storage. For most environments, "file" should be used.
-ajscPersistence=file
-
-# If using hawtio for local development, these properties will allow for faster server startup and usage for local development
-hawtio.authenticationEnabled=false
-hawtio.config.pullOnStartup=false
-
-#Removes the extraneous restlet console output
-org.restlet.engine.loggerFacadeClass=org.restlet.ext.slf4j.Slf4jLoggerFacade
-
-#server.host property to be enabled for local DME2 related testing
-#server.host=<Your network IP address>
-
-#Enable/disable SSL (values=true/false). This property also determines which protocol to use (https if true, http otherwise), to register services into GRM through DME2.
-enableSSL=false
-
-#Enable/disable csi logging (values=true/false). This can be disabled during local development
-csiEnable=false
-
-#Enable/disable EJB Container
-ENABLE_EJB=false
-
-#Enable/disable OSGI
-isOSGIEnable=false
-
-#Configure JMS Queue (WMQ/TIBCO)
-JMS_BROKER=WMQ
-
-#JMS properties needed for CSI Logging
-JMS_TIBCO_PROVIDER_URL=ONAPserverTBD
-JMS_LOGGER_USER_NAME=spm2
-JMS_LOGGER_PASSWORD=its4test
-JMS_LOGGER_AUDIT_QUEUE_BINDING=pub.m2e.audit.logger.queue
-JMS_LOGGER_PERF_QUEUE_BINDING=log.csi.performance02
-
-#WMQ connectivity
-JMS_WMQ_PROVIDER_URL=aftdsc://AFTUAT/34.07/-84.28
-JMS_WMQ_CONNECTION_FACTORY_NAME=aftdsc://AFTUAT/?service=CSILOG,version=1.0,bindingType=fusionBus,envContext=Q,Q25A=YES
-JMS_WMQ_INITIAL_CONNECTION_FACTORY_NAME=com.att.aft.jms.FusionCtxFactory
-JMS_WMQ_AUDIT_DESTINATION_NAME=queue:///CSILOGQL.M2E.DASHBOARD01.NOT.Q25A
-JMS_WMQ_PERF_DESTINATION_NAME=queue:///CSILOGQL.M2E.PERFORMANCE01.NOT.Q25A
-
-server.port=8087
-
-#CSI related variables for CSM framework
-csm.hostname=d1a-m2e-q112m2e1.edc.cingular.net
-
-#Enable/disable endpoint level logging (values=true/false). This can be disabled during local development
-endpointLogging=false
-
-#SOA_CLOUD_ENV is used to register your service with dme2 and can be turned off for local development (values=true/false).
-SOA_CLOUD_ENV=false
-
-#CONTINUE_ON_LISTENER_EXCEPTION will exit the application if there is a DME2 exception at the time of registration.
-CONTINUE_ON_LISTENER_EXCEPTION=false
-
-#Jetty Container ThreadCount Configuration Variables
-AJSC_JETTY_ThreadCount_MIN=10
-AJSC_JETTY_ThreadCount_MAX=500
-AJSC_JETTY_IDLETIME_MAX=60000
-AJSC_JETTY_BLOCKING_QUEUE_SIZE=100
-
-#Camel Context level default threadPool Profile configuration
-CAMEL_POOL_SIZE=10
-CAMEL_MAX_POOL_SIZE=20
-CAMEL_KEEP_ALIVE_TIME=60
-CAMEL_MAX_QUEUE_SIZE=1000
-
-#File Monitor configurations
-ssf_filemonitor_polling_interval=5
-ssf_filemonitor_threadpool_size=10
-
-#GRM/DME2 System Properties
-AFT_DME2_CONN_IDLE_TIMEOUTMS=5000
-AJSC_ENV=SOACLOUD
-
-SOACLOUD_NAMESPACE=com.att.ajsc
-SOACLOUD_ENV_CONTEXT=DEV
-SOACLOUD_PROTOCOL=https
-SOACLOUD_ROUTE_OFFER=DEFAULT
-
-AFT_LATITUDE=23.4
-AFT_LONGITUDE=33.6
-AFT_ENVIRONMENT=AFTUAT
-
-#Restlet Component Default Properties
-RESTLET_COMPONENT_CONTROLLER_DAEMON=true
-RESTLET_COMPONENT_CONTROLLER_SLEEP_TIME_MS=100
-RESTLET_COMPONENT_INBOUND_BUFFER_SIZE=8192
-RESTLET_COMPONENT_MIN_THREADS=1
-RESTLET_COMPONENT_MAX_THREADS=10
-RESTLET_COMPONENT_LOW_THREADS=8
-RESTLET_COMPONENT_MAX_QUEUED=0
-RESTLET_COMPONENT_MAX_CONNECTIONS_PER_HOST=-1
-RESTLET_COMPONENT_MAX_TOTAL_CONNECTIONS=-1
-RESTLET_COMPONENT_OUTBOUND_BUFFER_SIZE=8192
-RESTLET_COMPONENT_PERSISTING_CONNECTIONS=true
-RESTLET_COMPONENT_PIPELINING_CONNECTIONS=false
-RESTLET_COMPONENT_THREAD_MAX_IDLE_TIME_MS=60000
-RESTLET_COMPONENT_USE_FORWARDED_HEADER=false
-RESTLET_COMPONENT_REUSE_ADDRESS=true
-
-#Externalized jar and properties file location. In CSI environments, there are a few libs that have been externalized to aid
-#in CSTEM maintenance of the versions of these libs. The most important to the AJSC is the DME2 lib. Not only is this lib necessary
-#for proper registration of your AJSC service on a node, but it is also necessary for running locally as well. Another framework
-#used in CSI envs is the CSM framework. These 2 framework libs are shown as "provided" dependencies within the pom.xml. These
-#dependencies will be copied into the target/commonLibs folder with the normal "mvn clean package" goal of the AJSC. They will
-#then be added to the classpath via AJSC_EXTERNAL_LIB_FOLDERS system property. Any files (mainly property files) that need
-#to be on the classpath should be added to the AJSC_EXTERNAL_PROPERTIES_FOLDERS system property. The default scenario when
-#testing your AJSC service locally will utilize the target/commonLibs directory for DME2 and CSM related artifacts and 2
-#default csm properties files will be used for local testing with anything CSM knorelated.
-#NOTE: we are using maven-replacer-plugin to replace "(doubleUnderscore)basedir(doubleUnderscore)" with ${basedir} within the
-#target directory for running locally. Multiple folder locations can be separated by the pipe ("|") character.
-#Please, NOTE: for running locally, we are setting this system property in the antBuild/build.xml "runLocal" target and in the
-#"runAjsc" profile within the pom.xml. This is to most effectively use maven variables (${basedir}, most specifically. Therefore,
-#when running locally, the following 2 properties should be set within the profile(s) themselves.
-#Example: target/commonLibs|target/otherLibs
-#AJSC_EXTERNAL_LIB_FOLDERS=__basedir__/target/commonLibs
-#AJSC_EXTERNAL_PROPERTIES_FOLDERS=__basedir__/ajsc-shared-config/etc
-#End of AJSC System Properties
-
-#Service System Properties. Please, place any Service related System Properties below.
-KEY_STORE_PASSWORD=OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0
-KEY_MANAGER_PASSWORD=OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0
-AAI_CORE_VERSION=1.2.0-SNAPSHOT
diff --git a/aai-resources/bundleconfig-local/etc/sysprops/template.sys-props.properties b/aai-resources/bundleconfig-local/etc/sysprops/template.sys-props.properties
deleted file mode 100644
index a6720fe..0000000
--- a/aai-resources/bundleconfig-local/etc/sysprops/template.sys-props.properties
+++ /dev/null
@@ -1,115 +0,0 @@
-#This file is used for defining AJSC system properties for different configuration schemes and is necessary for the AJSC to run properly.
-#The sys-props.properties file is used for running locally.
-
-#For Cadi Authorization, use value="authentication-scheme-1"
-CadiAuthN=__AJSC_CADI_AUTHN__
-
-#For Basic Authorization, use value="authentication-scheme-1"
-authN=__AJSC_AUTH_SCHEME__
-
-#Persistence used for AJSC meta-data storage. For most environments, "file" should be used.
-ajscPersistence=__AJSC_PERSISTENCE__
-
-#Configure externalized logback location
-logback.configurationFile=__LOGBACK_CONFIG_FILE__
-
-# If using hawtio for local development, these properties will allow for faster server startup and usage for local development.
-# You may wish to deploy hawtio.war to dev/test environments to help debugging as well, but should not be used in PROD env.
-hawtio.authenticationEnabled=__HAWTIO_AUTHENTICATION_ENABLED__
-hawtio.config.pullOnStartup=__HAWTIO_CONFIG_PULLONSTARTUP__
-
-#Removes the extraneous restlet console output
-org.restlet.engine.loggerFacadeClass=org.restlet.ext.slf4j.Slf4jLoggerFacade
-
-#Enable/disable SSL (values=true/false).
-enableSSL=__AJSC_ENABLE_SSL__
-
-#Enable/disable csi logging (values=true/false).
-csiEnable=__CSI_ENABLE__
-
-#Enable/disable EJB Container
-ENABLE_EJB=__ENABLE_EJB__
-
-#Enable/disable OSGI
-isOSGIEnable=__OSGI_ENABLE__
-
-#Configure JMS Queue (WMQ/TIBCO)
-JMS_BROKER=WMQ
-
-#JMS properties needed for CSI Logging
-JMS_TIBCO_PROVIDER_URL=ONAPserverTBD
-JMS_LOGGER_USER_NAME=spm2
-JMS_LOGGER_PASSWORD=its4test
-JMS_LOGGER_AUDIT_QUEUE_BINDING=pub.m2e.audit.logger.queue
-JMS_LOGGER_PERF_QUEUE_BINDING=log.csi.performance02
-
-#WMQ connectivity
-JMS_WMQ_PROVIDER_URL=__JMS_WMQ_PROVIDER_URL__
-JMS_WMQ_CONNECTION_FACTORY_NAME=__JMS_WMQ_CONNECTION_FACTORY_NAME__
-JMS_WMQ_INITIAL_CONNECTION_FACTORY_NAME=__JMS_WMQ_INITIAL_CONNECTION_FACTORY_NAME__
-JMS_WMQ_AUDIT_DESTINATION_NAME=__JMS_WMQ_AUDIT_DESTINATION_NAME__
-JMS_WMQ_PERF_DESTINATION_NAME=__JMS_WMQ_PERF_DESTINATION_NAME__
-
-#CSI related variables for CSM framework
-csm.hostname=d1a-m2e-q112m2e1.edc.cingular.net
-
-#Enable/disable endpoint level logging (values=true/false).
-endpointLogging=__END_POINT_LEVEL_LOGGING__
-
-#SOA_CLOUD_ENV is used to register your service with dme2 (values=true/false).
-SOA_CLOUD_ENV=__SOA_CLOUD_ENV__
-
-#Jetty Container ThreadCount Configuration Variables
-AJSC_JETTY_ThreadCount_MAX=__AJSC_JETTY_ThreadCount_MAX__
-AJSC_JETTY_ThreadCount_MIN=__AJSC_JETTY_ThreadCount_MIN__
-AJSC_JETTY_IDLETIME_MAX=__AJSC_JETTY_IDLETIME_MAX__
-AJSC_SERVICE_NAMESPACE=__AJSC_SERVICE_NAMESPACE__
-AJSC_SERVICE_VERSION=__AJSC_SERVICE_VERSION__
-AJSC_JETTY_BLOCKING_QUEUE_SIZE=100
-
-#Camel Context level default threadPool Profile configuration
-CAMEL_POOL_SIZE=__CAMEL_POOL_SIZE__
-CAMEL_MAX_POOL_SIZE=__CAMEL_MAX_POOL_SIZE__
-CAMEL_KEEP_ALIVE_TIME=__CAMEL_KEEP_ALIVE_TIME__
-CAMEL_MAX_QUEUE_SIZE=__CAMEL_MAX_QUEUE_SIZE__
-
-#File Monitor configurations
-ssf_filemonitor_polling_interval=__AJSC_SSF_FILE_MONITOR_POLLING_INTERVAL__
-ssf_filemonitor_threadpool_size=__AJSC_SSF_FILE_MONITOR_THREAD_POOL_SIZE__
-
-#GRM/DME2 System Properties below
-AFT_DME2_CONN_IDLE_TIMEOUTMS=__AFT_DME2_CONN_IDLE_TIMEOUTMS__
-AJSC_ENV=__AJSC_ENV__
-SOACLOUD_NAMESPACE=__SOA_CLOUD_NAMESPACE__
-SOACLOUD_ENV_CONTEXT=__SCLD_ENV__
-SOACLOUD_PROTOCOL=https
-SOACLOUD_ROUTE_OFFER=__AAIENV__
-sslport=__AJSC_SSL_PORT__
-server.port=8087
-AFT_LATITUDE=__LATITUDE__
-AFT_LONGITUDE=__LONGITUDE__
-AFT_ENVIRONMENT=__AFT_ENVIRONMENT__
-
-#Restlet Component Properties
-RESTLET_COMPONENT_CONTROLLER_DAEMON=__RESTLET_COMPONENT_CONTROLLER_DAEMON__
-RESTLET_COMPONENT_CONTROLLER_SLEEP_TIME_MS=__RESTLET_COMPONENT_CONTROLLER_SLEEP_TIME_MS__
-RESTLET_COMPONENT_INBOUND_BUFFER_SIZE=__RESTLET_COMPONENT_INBOUND_BUFFER_SIZE__
-RESTLET_COMPONENT_MIN_THREADS=__RESTLET_COMPONENT_MIN_THREADS__
-RESTLET_COMPONENT_MAX_THREADS=__RESTLET_COMPONENT_MAX_THREADS__
-RESTLET_COMPONENT_LOW_THREADS=__RESTLET_COMPONENT_LOW_THREADS__
-RESTLET_COMPONENT_MAX_QUEUED=__RESTLET_COMPONENT_MAX_QUEUED__
-RESTLET_COMPONENT_MAX_CONNECTIONS_PER_HOST=__RESTLET_COMPONENT_MAX_CONNECTIONS_PER_HOST__
-RESTLET_COMPONENT_MAX_TOTAL_CONNECTIONS=__RESTLET_COMPONENT_MAX_TOTAL_CONNECTIONS__
-RESTLET_COMPONENT_OUTBOUND_BUFFER_SIZE=__RESTLET_COMPONENT_OUTBOUND_BUFFER_SIZE__
-RESTLET_COMPONENT_PERSISTING_CONNECTIONS=__RESTLET_COMPONENT_PERSISTING_CONNECTIONS__
-RESTLET_COMPONENT_PIPELINING_CONNECTIONS=__RESTLET_COMPONENT_PIPELINING_CONNECTIONS__
-RESTLET_COMPONENT_THREAD_MAX_IDLE_TIME_MS=__RESTLET_COMPONENT_THREAD_MAX_IDLE_TIME_MS__
-RESTLET_COMPONENT_USE_FORWARDED_HEADER=__RESTLET_COMPONENT_USE_FORWARDED_HEADER__
-RESTLET_COMPONENT_REUSE_ADDRESS=__RESTLET_COMPONENT_REUSE_ADDRESS__
-
-AJSC_EXTERNAL_LIB_FOLDERS=__CSM_LIB__|__DME2_LIB__|__AJSC_EXTERNAL_LIB_FOLDERS__
-AJSC_EXTERNAL_PROPERTIES_FOLDERS=__AJSC_SHARED_CONFIG__|__AJSC_EXTERNAL_PROPERTIES_FOLDERS__
-
-KEY_STORE_PASSWORD=__KEY_STORE_PASSWORD__
-KEY_MANAGER_PASSWORD=__KEY_MANAGER_PASSWORD__
-AAI_CORE_VERSION=1.2.0-SNAPSHOT
diff --git a/aai-resources/bundleconfig-local/symlinks.txt b/aai-resources/bundleconfig-local/symlinks.txt
deleted file mode 100644
index 70f2c0d..0000000
--- a/aai-resources/bundleconfig-local/symlinks.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-#This file provides the definitions of sym-links to CSTEM that will be used by your project once installed on a CSI node.
-
-link_jre=ajsc-shared-config
-link_csi-csm=ajsc-shared-config
-link_csi-dme=ajsc-shared-config
-link_introscope=ajsc-shared-config
diff --git a/aai-resources/pom.xml b/aai-resources/pom.xml
index b9ab825..e5e00f1 100644
--- a/aai-resources/pom.xml
+++ b/aai-resources/pom.xml
@@ -1,89 +1,298 @@
-<?xml version="1.0"?>
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <groupId>org.onap.aai.resources</groupId>
+ <artifactId>aai-resources</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+
<parent>
- <groupId>org.onap.aai.resources</groupId>
- <artifactId>resources</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <groupId>com.att.ajsc</groupId>
+ <artifactId>sdk-java-starter-parent</artifactId>
+ <version>6.1.0.4-oss</version>
</parent>
- <artifactId>aai-resources</artifactId>
- <name>aai-resources</name>
- <url>http://maven.apache.org</url>
+
<properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <swagger.directory>${basedir}/target/classes/META-INF/resources/swagger</swagger.directory>
+ <icd.file>service.json</icd.file>
+ <icd.package>com.att.ajsc.ajsc6configdemo.service.rs</icd.package>
+ <java.version>1.8</java.version>
+ <build.number>local</build.number>
+ <kube.namespace>org-onap-aai</kube.namespace>
+ <service.account>ajsc-svc-account</service.account>
+ <namespace>com.att.ajsc</namespace>
+ <start-class>org.onap.aai.ResourcesApp</start-class>
+
+ <aai-schema.version>1.2.1-SNAPSHOT</aai-schema.version>
+ <aai.core.version>1.2.1-SNAPSHOT</aai.core.version>
+ <aai.client.loadbalancer.version>1.2.1-SNAPSHOT</aai.client.loadbalancer.version>
+
<hbase.version>1.0.2</hbase.version>
- <!-- old version
- <hbase.version>0.98.4-hadoop2</hbase.version>
- -->
- <dockerLocation>${basedir}/target/swm/package/nix/dist_files/</dockerLocation>
- <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
- <docker.image.version>1.0.0</docker.image.version>
+
+ <!-- Start of the jacoco plugin properties -->
<sonar.language>java</sonar.language>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>
<sonar.jacoco.reportPath>${project.build.directory}/coverage-reports/jacoco.exec</sonar.jacoco.reportPath>
<sonar.jacoco.reportMissing.force.zero>false</sonar.jacoco.reportMissing.force.zero>
<sonar.projectVersion>${project.version}</sonar.projectVersion>
+ <!-- End of the jacoco plugin properties -->
+
+ <cxf.version>2.2.3</cxf.version>
+
+ <!-- Start SDK Dependencies Version -->
+ <sdk.java.rest.version>6.2.0.6-oss</sdk.java.rest.version>
+ <sdk.java.common.logging.version>0.0.1</sdk.java.common.logging.version>
+ <sdk.java.spring.cloud.version>0.0.9</sdk.java.spring.cloud.version>
+ <!-- End SDK Dependencies Version -->
+
+ <jolt.version>0.0.24</jolt.version>
+ <jopt.simple.version>4.9</jopt.simple.version>
+
+ <io.swagger.version>1.5.8</io.swagger.version>
+ <apache.log4j.version>1.2.17</apache.log4j.version>
+
+ <commons.beanutils.version>1.9.2</commons.beanutils.version>
+ <commons.compress.version>1.10</commons.compress.version>
+ <commons.configuration.version>1.9</commons.configuration.version>
+
+ <googlecode.diffutils.version>1.3.0</googlecode.diffutils.version>
+ <scamper.encryption.version>1.8.20</scamper.encryption.version>
+ <httpcomponents.httpmime.version>4.5.2</httpcomponents.httpmime.version>
+ <scamper.version>1.8.36</scamper.version>
+ <dom4j.version>1.6.1</dom4j.version>
+ <commons.lang.version>2.6</commons.lang.version>
+ <eelf.core.version>1.0.0</eelf.core.version>
+ <logback.version>1.1.7</logback.version>
+ <hamcrest.junit.version>2.0.0.0</hamcrest.junit.version>
+ <janino.version>2.7.8</janino.version>
+ <google.guava.version>16.0</google.guava.version>
+ <titan.version>1.0.0</titan.version>
+ <gremlin.driver.version>3.0.1-incubating</gremlin.driver.version>
+ <hbase.version>1.0.2</hbase.version>
+ <smack.version>3.0.4</smack.version>
+ <json.simple.version>1.1.1</json.simple.version>
+ <mockito.version>1.10.19</mockito.version>
+ <powermock.version>1.6.2</powermock.version>
+ <jcommander.version>1.48</jcommander.version>
+ <json.version>20090211</json.version>
+ <freemarker.version>2.3.14</freemarker.version>
+ <jaxb.version>2.2.11</jaxb.version>
+ <eclipse.persistence.version>2.6.2</eclipse.persistence.version>
+ <json.patch.version>1.9</json.patch.version>
+ <javatuples.version>1.2</javatuples.version>
+ <gson.version>2.7</gson.version>
+ <dmaap.client.version>0.2.12</dmaap.client.version>
+ <httpcore.version>4.4</httpcore.version>
+ <json.path.version>2.2.0</json.path.version>
+ <activemq.version>5.14.3</activemq.version>
+ <httpclient.version>4.5.1</httpclient.version>
+ <spring.jms.version>4.3.2.RELEASE</spring.jms.version>
+ <spotify.docker.version>0.4.11</spotify.docker.version>
+ <spring.security.version>1.0.3.RELEASE</spring.security.version>
+
+ <dme2.version>2.8.5</dme2.version>
+ <async.retry.version>0.0.7</async.retry.version>
+ <jsonassert.version>1.4.0</jsonassert.version>
+
+ <eclipse.jetty.version>9.4.1.v20170120</eclipse.jetty.version>
+
+ <docker.fabric.version>0.23.0</docker.fabric.version>
+ <!-- Default docker registry that maven fabric plugin will try to pull from -->
+ <docker.registry>docker.io</docker.registry>
+ <!-- Specifying the docker push registry where the image should be pushed -->
+ <!-- This value should be overwritten at runtime to wherever need to be pushed to -->
+ <docker.push.registry>localhost:5000</docker.push.registry>
+
+ <aai.docker.version>1.0.0</aai.docker.version>
+ <!--
+ Location where assembly of our scripts, resources and main jar will be held
+ Check the aai-resources/src/main/assembly/descriptor.xml for more info
+ -->
+ <aai.build.directory>${project.build.directory}/${project.artifactId}-${project.version}-build/</aai.build.directory>
+ <aai.docker.namespace>onap</aai.docker.namespace>
+ <maven.skip.tests>true</maven.skip.tests>
+
+ <spring.web.version>4.3.6.RELEASE</spring.web.version>
+ <aai.project.version>1.2.0</aai.project.version>
+ <aai.docker.version>1.2</aai.docker.version>
</properties>
+ <profiles>
+ <!-- Docker profile to be used for building docker image and pushing to nexus -->
+ <profile>
+ <id>docker</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>${docker.fabric.version}</version>
+ <configuration>
+ <verbose>true</verbose>
+ <apiVersion>1.23</apiVersion>
+ <images>
+ <image>
+ <name>${docker.push.registry}/${aai.docker.namespace}/aai-resources:%l</name>
+ <build>
+ <filter>@</filter>
+ <tags>
+ <tag>latest</tag>
+ <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
+ <tag>${aai.docker.version}-STAGING-latest</tag>
+ </tags>
+ <cleanup>try</cleanup>
+ <dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
+ <assembly>
+ <inline>
+ <fileSets>
+ <fileSet>
+ <directory>${aai.build.directory}</directory>
+ <outputDirectory>/${project.artifactId}</outputDirectory>
+ </fileSet>
+ </fileSets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <id>clean-images</id>
+ <phase>pre-clean</phase>
+ <goals>
+ <goal>remove</goal>
+ </goals>
+ <configuration>
+ <removeAll>true</removeAll>
+ </configuration>
+ </execution>
+ <execution>
+ <id>generate-images</id>
+ <phase>package</phase>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>push-images</id>
+ <phase>deploy</phase>
+ <goals>
+ <goal>push</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>runAjsc</id>
+ <properties>
+ <skipTests>${maven.skip.tests}</skipTests>
+ </properties>
+ <build>
+ <defaultGoal>pre-integration-test</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.6.0</version>
+ <executions>
+ <execution>
+ <id>run-spring-boot</id>
+ <phase>package</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <mainClass>${start-class}</mainClass>
+ <systemProperties>
+ <systemProperty>
+ <key>snapshot.location</key>
+ <value>${snapshot.file}</value>
+ </systemProperty>
+ </systemProperties>
+ <executable>java</executable>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
<dependencies>
- <!-- Scamper related dependencies -->
<dependency>
- <groupId>org.onap.aai.aai-common</groupId>
- <artifactId>aai-core</artifactId>
- <version>${aai.core.version}</version>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-jersey</artifactId>
<exclusions>
<exclusion>
- <artifactId>ajsc-runner</artifactId>
- <groupId>com.att.ajsc</groupId>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-servlet</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
- <groupId>org.onap.aai.aai-common</groupId>
- <artifactId>aai-schema</artifactId>
- <version>${aai.schema.version}</version>
+ <groupId>net.sf.jopt-simple</groupId>
+ <artifactId>jopt-simple</artifactId>
+ <version>${jopt.simple.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-core</artifactId>
+ <version>${io.swagger.version}</version>
<exclusions>
<exclusion>
- <artifactId>ajsc-runner</artifactId>
- <groupId>com.att.ajsc</groupId>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
- <groupId>com.rabbitmq</groupId>
- <artifactId>amqp-client</artifactId>
- <version>3.6.1</version>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>${io.swagger.version}</version>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>apache-log4j-extras</artifactId>
- <version>1.2.17</version>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-jersey-jaxrs</artifactId>
+ <version>${io.swagger.version}</version>
<exclusions>
<exclusion>
- <artifactId>log4j</artifactId>
- <groupId>log4j</groupId>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-multipart</artifactId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jersey-core</artifactId>
+ <groupId>com.sun.jersey</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jersey-json</artifactId>
+ <groupId>com.sun.jersey</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jersey-server</artifactId>
+ <groupId>com.sun.jersey</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jersey-client</artifactId>
+ <groupId>com.sun.jersey</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jsr311-api</artifactId>
+ <groupId>javax.ws.rs</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jersey-multipart</artifactId>
+ <groupId>com.sun.jersey.contribs</groupId>
</exclusion>
</exclusions>
</dependency>
-
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>1.9.2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-compress</artifactId>
- <version>1.10</version>
- </dependency>
-
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
- <version>1.9</version>
+ <version>${commons.configuration.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-lang</artifactId>
@@ -91,113 +300,38 @@
</exclusion>
</exclusions>
</dependency>
-
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-core-asl</artifactId>
- <version>1.9.13</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-mapper-asl</artifactId>
- <version>1.9.13</version>
- </dependency>
-
- <dependency>
- <groupId>com.thinkaurelius.titan</groupId>
- <artifactId>titan-cassandra</artifactId>
- <version>0.5.3</version>
- <exclusions>
- <exclusion>
- <artifactId>org.slf4j</artifactId>
- <groupId>slf4j-log4j12</groupId>
- </exclusion>
- </exclusions>
- </dependency>
-
-
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpmime</artifactId>
- <version>4.5.2</version>
- </dependency>
-
- <!-- AJSC related dependencies -->
- <dependency>
- <groupId>com.att.ajsc</groupId>
- <artifactId>ajsc-runner</artifactId>
- <version>${ajscRuntimeVersion}</version>
- </dependency>
- <dependency>
- <groupId>com.att.ajsc</groupId>
- <artifactId>ajsc-core</artifactId>
- <version>${ajscRuntimeVersion}</version>
- <scope>provided</scope>
- </dependency>
-
-
- <dependency>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- <version>1.6.1</version>
- </dependency>
-
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
- <version>2.6</version>
+ <version>${commons.lang.version}</version>
</dependency>
-
<!-- eelf dependency -->
<dependency>
<groupId>com.att.eelf</groupId>
<artifactId>eelf-core</artifactId>
- <version>1.0.0</version>
+ <version>${eelf.core.version}</version>
</dependency>
-
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
- <version>1.1.7</version>
+ <version>${logback.version}</version>
</dependency>
-
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <version>1.1.7</version>
+ <version>${logback.version}</version>
</dependency>
-
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-access</artifactId>
- <version>1.1.7</version>
+ <version>${logback.version}</version>
</dependency>
-
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-junit</artifactId>
- <version>2.0.0.0</version>
+ <version>${hamcrest.junit.version}</version>
</dependency>
<dependency>
- <groupId>org.codehaus.janino</groupId>
- <artifactId>janino</artifactId>
- <version>2.7.8</version>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- </dependency>
-
- <dependency>
- <groupId>jdk.tools</groupId>
- <artifactId>jdk.tools</artifactId>
- <version>1.8.0_101</version>
- <scope>system</scope>
- <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
- </dependency>
-
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
@@ -205,12 +339,12 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
- <version>16.0</version>
+ <version>${google.guava.version}</version>
</dependency>
<dependency>
<groupId>com.thinkaurelius.titan</groupId>
<artifactId>titan-core</artifactId>
- <version>1.0.0</version>
+ <version>${titan.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
@@ -221,7 +355,7 @@
<dependency>
<groupId>com.thinkaurelius.titan</groupId>
<artifactId>titan-cassandra</artifactId>
- <version>1.0.0</version>
+ <version>${titan.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
@@ -232,7 +366,7 @@
<dependency>
<groupId>com.thinkaurelius.titan</groupId>
<artifactId>titan-hbase</artifactId>
- <version>1.0.0</version>
+ <version>${titan.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
@@ -244,7 +378,7 @@
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-driver</artifactId>
- <version>3.0.1-incubating</version>
+ <version>${gremlin.driver.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
@@ -259,6 +393,22 @@
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
+ <exclusion>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-json</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-server</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.jersey.contribs</groupId>
+ <artifactId>jersey-guice</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -284,182 +434,298 @@
</exclusions>
</dependency>
<dependency>
- <groupId>com.opencsv</groupId>
- <artifactId>opencsv</artifactId>
- <version>3.1</version>
- </dependency>
- <dependency>
- <groupId>jivesoftware</groupId>
- <artifactId>smack</artifactId>
- <version>3.0.4</version>
- </dependency>
-
- <dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
- <version>2.1.4</version>
- </dependency>
- <dependency>
- <groupId>com.googlecode.json-simple</groupId>
- <artifactId>json-simple</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-client</artifactId>
- <version>1.18</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.ws</groupId>
- <artifactId>spring-ws</artifactId>
- <version>1.5.2</version>
- <!--<version>2.1.3-RELEASE</version> -->
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>4.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
- <version>1.10.19</version>
+ <version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
- <version>1.6.2</version>
+ <version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
- <version>1.6.2</version>
+ <version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
- <version>1.48</version>
+ <version>${jcommander.version}</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
- <version>20090211</version>
+ <version>${json.version}</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
- <version>2.3.14</version>
+ <version>${freemarker.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
- <version>2.2.11</version>
+ <version>${jaxb.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
- <version>2.2.11</version>
+ <version>${jaxb.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
- <version>2.2.11</version>
+ <version>${jaxb.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
- <version>2.2.11</version>
+ <version>${jaxb.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
- <version>2.6.2</version>
+ <version>${eclipse.persistence.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.moxy</artifactId>
- <version>2.6.2</version>
+ <version>${eclipse.persistence.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-javaagent</artifactId>
- <version>1.6.2</version>
+ <version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4-rule-agent</artifactId>
- <version>1.6.2</version>
+ <version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.fge</groupId>
<artifactId>json-patch</artifactId>
- <version>1.9</version>
+ <version>${json.patch.version}</version>
</dependency>
<dependency>
<groupId>org.javatuples</groupId>
<artifactId>javatuples</artifactId>
- <version>1.2</version>
+ <version>${javatuples.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
- <version>2.7</version>
+ <version>${gson.version}</version>
</dependency>
<dependency>
<groupId>com.att.nsa</groupId>
<artifactId>dmaapClient</artifactId>
- <version>0.2.12</version>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpcore</artifactId>
- <version>4.4</version>
+ <version>${dmaap.client.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.att.aft</groupId>
+ <artifactId>dme2</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>com.bazaarvoice.jolt</groupId>
<artifactId>jolt-complete</artifactId>
- <version>0.0.24</version>
+ <version>${jolt.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.jayway.jsonpath</groupId>
+ <artifactId>json-path</artifactId>
+ <version>${json.path.version}</version>
+ </dependency>
+ <!-- Do not use activemq-all because they force you to use a specific logging
+ and they shade it so you can't simply exclude it and when you deploy the
+ jar, you will notice failure -->
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-broker</artifactId>
+ <version>${activemq.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-client</artifactId>
+ <version>${activemq.version}</version>
</dependency>
<dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-json</artifactId>
- <version>1.18</version>
+ <groupId>org.onap.aai.aai-common</groupId>
+ <artifactId>aai-core</artifactId>
+ <version>${aai.core.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.aai.aai-common</groupId>
+ <artifactId>aai-schema</artifactId>
+ <version>${aai-schema.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jms</artifactId>
+ <version>${spring.jms.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!-- Do not use the jersey-client since jersey client 1.0 version clashes
+ with jersey 2 which we are using -->
+ <!-- Use this to make http requests instead of jersey 1.0 client -->
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>${httpclient.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
- <version>1.4.0</version>
+ <version>${jsonassert.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ <version>${eclipse.jetty.version}</version>
+ </dependency>
+ <!--
+ Explicitly stating the security spring framework and
+ exclude the bouncy castle since that is somehow overwriting
+ our p12 file decryption that's built into java security
+ This will cause the password is incorrect
+ This needs to be added back if org.bouncy castle dependency
+ sneaks backs in and causing issues with the two way ssl
+ -->
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-rsa</artifactId>
+ <version>${spring.security.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcpkix-jdk15on</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.aai.aai-common</groupId>
+ <artifactId>aai-client-loadbalancer</artifactId>
+ <version>${aai.client.loadbalancer.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-tomcat</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-jetty</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>${spring.web.version}</version>
+ </dependency>
</dependencies>
<build>
- <finalName>aai-resources</finalName>
+ <resources>
+ <resource>
+ <directory>${project.basedir}/src/main/swm</directory>
+ <targetPath>${project.build.directory}/swm</targetPath>
+ <filtering>false</filtering>
+ </resource>
+ <resource>
+ <directory>${project.basedir}/src/main/resources</directory>
+ <includes>
+ <include>application.properties</include>
+ <include>dme2.properties</include>
+ <include>logback.xml</include>
+ <include>localhost-access-logback.xml</include>
+ </includes>
+ <targetPath>${project.build.directory}/swm/package/nix/dist_files/opt/app/aai-resources/appconfig</targetPath>
+ <filtering>false</filtering>
+ </resource>
+ <resource>
+ <directory>${project.basedir}/src/main/resources</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ <resource>
+ <directory>${project.basedir}/src/main/resources/etc/appprops/</directory>
+ <includes>
+ <include>titan-realtime.properties</include>
+ <include>titan-cached.properties</include>
+ <include>aaiconfig.properties</include>
+ </includes>
+ <targetPath>${project.build.directory}/swm/package/nix/dist_files/opt/app/aai-resources/appconfig</targetPath>
+ <filtering>false</filtering>
+ </resource>
+ <resource>
+ <directory>${project.basedir}/src/main/resources/etc/auth/</directory>
+ <includes>
+ <include>aai-client-cert.p12</include>
+ <include>tomcat_keystore</include>
+ </includes>
+ <targetPath>${project.build.directory}/swm/package/nix/dist_files/opt/app/aai-resources/appconfig</targetPath>
+ <filtering>true</filtering>
+ </resource>
+ <resource>
+ <directory>${project.basedir}/src/main/resources/</directory>
+ <includes>
+ <include>logback.xml</include>
+ <include>localhost-access-logback.xml</include>
+ </includes>
+ <targetPath>${project.build.directory}/swm/package/nix/dist_files/opt/app/aai-resources/appconfig</targetPath>
+ <filtering>true</filtering>
+ </resource>
+ <resource>
+ <directory>${project.basedir}/src/main/docker</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <targetPath>${aai.build.directory}</targetPath>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
<pluginManagement>
<plugins>
<plugin>
- <groupId>org.jsonschema2pojo</groupId>
- <artifactId>jsonschema2pojo-maven-plugin</artifactId>
- <version>0.4.13</version>
- <configuration>
- <sourceType>jsonschema</sourceType>
- <sourceDirectory>src/main/resources/json</sourceDirectory>
- <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
- <annotationStyle>jackson2</annotationStyle>
- <generateBuilders>true</generateBuilders>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
@@ -485,7 +751,7 @@
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-schema</artifactId>
<version>${aai.core.version}</version>
- <outputDirectory>bundleconfig-local/etc</outputDirectory>
+ <outputDirectory>${project.basedir}/src/main/resources/etc</outputDirectory>
<includes>oxm/*.xml</includes>
</artifactItem>
</artifactItems>
@@ -493,19 +759,6 @@
</configuration>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.12.4</version>
- <configuration>
- <argLine>-noverify ${argLine}</argLine>
- <runOrder>alphabetical</runOrder>
- <systemPropertyVariables>
- <AJSC_HOME>.</AJSC_HOME>
- <BUNDLECONFIG_DIR>bundleconfig-local</BUNDLECONFIG_DIR>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<executions>
@@ -534,112 +787,61 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.7</version>
- <executions>
- <execution>
- <id>copy-docker-file</id>
- <phase>package</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${dockerLocation}</outputDirectory>
- <overwrite>true</overwrite>
- <resources>
- <resource>
- <directory>${basedir}/src/main/resources/docker</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*</include>
- </includes>
- </resource>
- </resources>
- </configuration>
- </execution>
- <execution>
- <id>copy-commonlibs-file</id>
- <phase>package</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${dockerLocation}/commonLibs</outputDirectory>
- <overwrite>true</overwrite>
- <resources>
- <resource>
- <directory>${basedir}/target/commonLibs</directory>
- <filtering>false</filtering>
- <includes>
- <include>*.jar</include>
- </includes>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>0.16.5</version>
- <configuration>
- <verbose>true</verbose>
- <apiVersion>1.23</apiVersion>
- <images>
- <image>
- <name>${docker.push.registry}/onap/aai-resources:%l</name>
- <build>
- <tags>
- <tag>latest</tag>
- <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
- <tag>${aai.docker.version}-STAGING-latest</tag>
- </tags>
- <cleanup>try</cleanup>
- <dockerFileDir>${dockerLocation}</dockerFileDir>
- <dockerFile>${dockerLocation}/Dockerfile</dockerFile>
- </build>
- </image>
- </images>
- </configuration>
- <executions>
- <execution>
- <id>clean-images</id>
- <phase>pre-clean</phase>
- <goals>
- <goal>remove</goal>
- </goals>
- <configuration>
- <removeAll>true</removeAll>
- <image>onap/aai-resources:%l</image>
- </configuration>
- </execution>
- <execution>
- <id>generate-images</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>build</goal>
- </goals>
- </execution>
- <execution>
- <id>push-images</id>
- <phase>deploy</phase>
- <goals>
- <goal>build</goal>
- <goal>push</goal>
- </goals>
- <configuration>
- <image>onap/aai-resources:%l</image>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>com.github.kongchen</groupId>
+ <artifactId>swagger-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>exec-maven-plugin</artifactId>
+ <groupId>org.codehaus.mojo</groupId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <additionalparam>-Xdoclint:none</additionalparam>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/descriptor.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id> <!-- this is used for inheritance merges -->
+ <phase>package</phase> <!-- bind to the packaging phase -->
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.12.4</version>
+ <configuration>
+ <argLine>-noverify ${argLine}</argLine>
+ <runOrder>alphabetical</runOrder>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.3</version>
@@ -662,6 +864,19 @@
<!-- <append>true</append> -->
</configuration>
</execution>
+ <execution>
+ <id>post-unit-test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <!-- Sets the path to the file which contains the execution data. -->
+ <dataFile>${project.build.directory}/coverage-reports/jacoco.exec</dataFile>
+ <!-- Sets the output directory for the code coverage report. -->
+ <outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
+ </configuration>
+ </execution>
</executions>
</plugin>
<plugin>
@@ -685,44 +900,23 @@
<serverId>ecomp-staging</serverId>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <configuration>
+ <mainClass>${start-class}</mainClass>
+ <layout>ZIP</layout>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
- <profiles>
- <!-- Use this profile to run the AJSC locally. This profile can be successfully
- shutdown WITHIN eclipse even in a Windows environment. Debugging is also
- available with this profile. -->
- <profile>
- <id>passwordGenerator</id>
- <build>
- <defaultGoal>initialize</defaultGoal>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>1.3.2</version>
- <executions>
- <execution>
- <phase>initialize</phase>
- <goals>
- <goal>java</goal>
- </goals>
- <configuration>
- <mainClass>org.eclipse.jetty.util.security.Password</mainClass>
- <arguments>
- <argument>user</argument>
- <argument>aaiDomain2</argument>
- </arguments>
- </configuration>
- </execution>
- </executions>
- <configuration>
- <executable>java</executable>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
<reporting>
<plugins>
<plugin>
diff --git a/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/conf/FileMonitorBeans.xml b/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/conf/FileMonitorBeans.xml
deleted file mode 100644
index 37e929d..0000000
--- a/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/conf/FileMonitorBeans.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
-
- <!--<bean-->
- <!--class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor" />-->
- <!---->
- <!--<bean id="ServicePropertiesListener" class="org.onap.aai.ajsc_aai.filemonitor.ServicePropertiesListener" />-->
- <!---->
- <!--<bean id="ServicePropertiesMap" class="org.onap.aai.ajsc_aai.filemonitor.ServicePropertiesMap" />-->
-
- <!--<bean id="ServicePropertyService" class="org.onap.aai.ajsc_aai.filemonitor.ServicePropertyService">-->
- <!--<property name="loadOnStartup" value="false" />-->
- <!--<property name="fileChangedListener" ref="ServicePropertiesListener" />-->
- <!--<property name="filePropertiesMap" ref="ServicePropertiesMap" />-->
- <!--<property name="ssfFileMonitorPollingInterval" value="15" />-->
- <!--<property name="ssfFileMonitorThreadpoolSize" value="10" />-->
- <!--</bean>-->
-</beans>
diff --git a/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/conf/jaxrsBeans.groovy b/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/conf/jaxrsBeans.groovy
deleted file mode 100644
index 0b036c6..0000000
--- a/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/conf/jaxrsBeans.groovy
+++ /dev/null
@@ -1,29 +0,0 @@
-beans{
- xmlns cxf: "http://camel.apache.org/schema/cxf"
- xmlns jaxrs: "http://cxf.apache.org/jaxrs"
- xmlns util: "http://www.springframework.org/schema/util"
-
- LegacyMoxyConsumer(org.onap.aai.rest.LegacyMoxyConsumer)
- URLFromVertexIdConsumer(org.onap.aai.rest.URLFromVertexIdConsumer)
- VertexIdConsumer(org.onap.aai.rest.VertexIdConsumer)
- BulkAddConsumer(org.onap.aai.rest.BulkAddConsumer)
- BulkProcessConsumer(org.onap.aai.rest.BulkProcessConsumer)
- ExampleConsumer(org.onap.aai.rest.ExampleConsumer)
- V3ThroughV7Consumer(org.onap.aai.rest.retired.V3ThroughV7Consumer)
- EchoResponse(org.onap.aai.rest.util.EchoResponse)
- ModelVersionTransformer(org.onap.aai.rest.tools.ModelVersionTransformer)
-
- util.list(id: 'jaxrsServices') {
-
- ref(bean:'ExampleConsumer')
- ref(bean:'LegacyMoxyConsumer')
- ref(bean:'VertexIdConsumer')
- ref(bean:'URLFromVertexIdConsumer')
- ref(bean:'BulkAddConsumer')
- ref(bean:'BulkProcessConsumer')
- ref(bean:'V3ThroughV7Consumer')
- ref(bean:'ModelVersionTransformer')
-
- ref(bean:'EchoResponse')
- }
-}
diff --git a/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/conf/serviceBeans.xml b/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/conf/serviceBeans.xml
deleted file mode 100644
index 578fa6f..0000000
--- a/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/conf/serviceBeans.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://cxf.apache.org/core"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:task="http://www.springframework.org/schema/task" xmlns:jms="http://www.springframework.org/schema/jms"
- xsi:schemaLocation="
- http://cxf.apache.org/core
- http://cxf.apache.org/schemas/core.xsd
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-2.5.xsd
- http://www.springframework.org/schema/task
- http://www.springframework.org/schema/task/spring-task-3.0.xsd
- http://www.springframework.org/schema/jms
- http://www.springframework.org/schema/jms/spring-jms-4.1.xsd">
-
- <!-- Your bean definitions goes here -->
- <!-- <bean id="performanceLog" name="performanceLog" class="com.att.ajsc.csi.logging.PerformanceTracking"
- /> -->
- <!-- <bean id="processRestletHeaders" name="processRestletHeaders" class="ajsc.restlet.ProcessRestletHeaders"
- /> -->
- <!--<bean id="servicePropsBean" name="servicePropsBean"-->
- <!--class="org.onap.aai.ajsc_aai.util.ServicePropertiesMapBean" />-->
- <bean id="jsonProvider" class="org.onap.aai.restcore.CustomJacksonJaxBJsonProvider" />
-
- <bean id="inInterceptor" class="org.onap.aai.interceptors.AAILogJAXRSInInterceptor" />
- <bean id="outInterceptor" class="org.onap.aai.interceptors.AAILogJAXRSOutInterceptor" />
- <!--<bean id="readInInterceptor" class="org.onap.aai.interceptors.AAICXFReadPhaseInterceptor" />-->
- <cxf:bus bus="cxfBus">
- <cxf:inInterceptors>
- <ref bean="inInterceptor" />
- <!--<ref bean="readInInterceptor" />-->
- </cxf:inInterceptors>
- <cxf:outInterceptors>
- <ref bean="outInterceptor" />
- </cxf:outInterceptors>
- </cxf:bus>
- <context:component-scan base-package="org.onap.aai.tasks" />
- <context:component-scan base-package="org.onap.aai.config" />
-
- <task:scheduler id="taskScheduler" pool-size="10" />
- <task:executor id="taskExecutor" pool-size="10"
- queue-capacity="5" />
- <task:annotation-driven executor="taskExecutor"
- scheduler="taskScheduler" />
-
- <bean id="jmsProperties"
- class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
- name="jmsProperties">
- <property name="order" value="99999" />
- <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
- <property name="ignoreUnresolvablePlaceholders" value="true" />
- <property name="properties">
- <value>
-
- <!-- JMS -->
- JMS.BROKER.URL=tcp://localhost:61447
- JMS.QUEUE.NAME=IN_QUEUE
-
- </value>
- </property>
- </bean>
-
- <!-- ActiveMQ connection factory -->
- <bean id="amqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
- <constructor-arg index="0" value="${JMS.BROKER.URL}" />
- </bean>
-
- <!-- ConnectionFactory Definition -->
- <bean id="connectionFactory"
- class="org.springframework.jms.connection.CachingConnectionFactory">
- <constructor-arg ref="amqConnectionFactory" />
- </bean>
-
- <!-- Destination Queue -->
- <bean id="destinationQueue" class="org.apache.activemq.command.ActiveMQQueue">
- <constructor-arg index="0" value="${JMS.QUEUE.NAME}" />
- </bean>
-
- <!-- JmsTemplate Definition -->
- <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
- <property name="connectionFactory" ref="connectionFactory" />
- <property name="defaultDestination" ref="destinationQueue" />
- </bean>
-
- <!-- Message Producer -->
- <bean id="messageProducer" class="org.onap.aai.dmaap.AAIDmaapEventJMSProducer" />
-
- <!-- Message Consumer from Default Destination -->
- <bean id="messageDefaultConsumer" class="org.onap.aai.dmaap.AAIDmaapEventJMSConsumer" />
-
- <!-- Message Consumer Container for Default Destination -->
- <bean
- class="org.springframework.jms.listener.DefaultMessageListenerContainer">
- <property name="connectionFactory" ref="connectionFactory" />
- <property name="destinationName" value="${JMS.QUEUE.NAME}" />
- <property name="messageListener" ref="messageDefaultConsumer" />
- </bean>
-
-
-</beans>
diff --git a/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/docs/README.txt b/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/docs/README.txt
deleted file mode 100644
index 3707179..0000000
--- a/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/docs/README.txt
+++ /dev/null
@@ -1 +0,0 @@
-Place any docs here that you want to access within the ajsc upon deployment of your service.
diff --git a/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/lib/README.txt b/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/lib/README.txt
deleted file mode 100644
index 639e21b..0000000
--- a/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/lib/README.txt
+++ /dev/null
@@ -1 +0,0 @@
-3rd party JAR's needed by your jars (if any) for a ajsc deployment package go here... \ No newline at end of file
diff --git a/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/props/module.props b/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/props/module.props
deleted file mode 100644
index 17ebc08..0000000
--- a/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/props/module.props
+++ /dev/null
@@ -1 +0,0 @@
-EXAMPLE.PROPERTY=EXAMLE_VALUE \ No newline at end of file
diff --git a/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/routes/aai.route b/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/routes/aai.route
deleted file mode 100644
index 6a86246..0000000
--- a/aai-resources/src/main/ajsc/ajsc-aai_v1/ajsc-aai/v1/routes/aai.route
+++ /dev/null
@@ -1,4 +0,0 @@
-<route xmlns="http://camel.apache.org/schema/spring" trace="true">
- <from uri="att-dme2-servlet:///aai?matchOnUriPrefix=true" />
- <to uri="cxfbean:jaxrsServices?providers=#jsonProvider&amp;bus=#cxfBus" />
-</route> \ No newline at end of file
diff --git a/aai-resources/src/main/assemble/ajsc_module_assembly.xml b/aai-resources/src/main/assemble/ajsc_module_assembly.xml
deleted file mode 100644
index 4ec4e28..0000000
--- a/aai-resources/src/main/assemble/ajsc_module_assembly.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<assembly
- xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
- <id>${version}</id>
- <includeBaseDirectory>false</includeBaseDirectory>
- <formats>
- <format>zip</format>
- </formats>
- <fileSets>
- <fileSet>
- <directory>${project.basedir}/target/versioned-ajsc/routes/</directory>
- <outputDirectory>${module.ajsc.namespace.name}/${module.ajsc.namespace.version}/routes/</outputDirectory>
- <includes>
- <include>*.route</include>
- </includes>
-
- </fileSet>
-
- <fileSet>
- <directory>${project.basedir}/target/versioned-ajsc/docs/</directory>
- <outputDirectory>${module.ajsc.namespace.name}/${module.ajsc.namespace.version}/docs/</outputDirectory>
- <includes>
- <include>*.*</include>
- <!-- <include>*.vm</include> -->
- </includes>
-
- </fileSet>
-
- <fileSet>
- <directory>${project.basedir}/target/versioned-ajsc/lib/</directory>
- <outputDirectory>${module.ajsc.namespace.name}/${module.ajsc.namespace.version}/lib/</outputDirectory>
- <includes>
- <include>*.jar</include>
- </includes>
-
- </fileSet>
- <fileSet>
- <directory>${project.basedir}/target/versioned-ajsc/extJars/</directory>
- <outputDirectory>${module.ajsc.namespace.name}/${module.ajsc.namespace.version}/extJars/</outputDirectory>
- <includes>
- <include>*.jar</include>
- </includes>
- </fileSet>
-
- <!-- also try to grab outputs from the "jar" plugin's package phase -->
- <fileSet>
- <directory>${project.basedir}/target/</directory>
- <outputDirectory>${module.ajsc.namespace.name}/${module.ajsc.namespace.version}/lib/</outputDirectory>
- <includes>
- <include>*.jar</include>
- </includes>
- </fileSet>
-
- <fileSet>
- <directory>${project.basedir}/target/versioned-ajsc/conf/</directory>
- <outputDirectory>${module.ajsc.namespace.name}/${module.ajsc.namespace.version}/conf/</outputDirectory>
- <includes>
- <include>*.*</include>
- </includes>
-
- </fileSet>
- </fileSets>
-
-</assembly>
-
diff --git a/aai-resources/src/main/assemble/ajsc_props_assembly.xml b/aai-resources/src/main/assemble/ajsc_props_assembly.xml
deleted file mode 100644
index 5b8a6fa..0000000
--- a/aai-resources/src/main/assemble/ajsc_props_assembly.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<assembly
- xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
- <id>${version}_properties</id>
- <includeBaseDirectory>false</includeBaseDirectory>
- <formats>
- <format>zip</format>
- </formats>
- <fileSets>
- <fileSet>
- <directory>${project.basedir}/target/versioned-ajsc/props</directory>
- <outputDirectory>${module.ajsc.namespace.name}/${module.ajsc.namespace.version}/props/</outputDirectory>
- <includes>
- <include>*.props</include>
- </includes>
-
- </fileSet>
-
- </fileSets>
-
-</assembly>
-
diff --git a/aai-resources/src/main/assemble/ajsc_runtime_assembly.xml b/aai-resources/src/main/assemble/ajsc_runtime_assembly.xml
deleted file mode 100644
index e37d366..0000000
--- a/aai-resources/src/main/assemble/ajsc_runtime_assembly.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<assembly
- xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
- <id>runtimeEnvironment</id>
- <includeBaseDirectory>false</includeBaseDirectory>
- <formats>
- <format>zip</format>
- </formats>
- <fileSets>
- <fileSet>
- <directory>${project.basedir}/target/versioned-runtime/context/</directory>
- <outputDirectory>runtime/context/</outputDirectory>
- <includes>
- <include>*.context</include>
- </includes>
- </fileSet>
- <fileSet>
- <directory>${project.basedir}/target/versioned-runtime/serviceProperties/</directory>
- <outputDirectory>runtime/serviceProperties/</outputDirectory>
- <includes>
- <include>*.props</include>
- </includes>
- </fileSet><fileSet>
- <directory>${project.basedir}/target/versioned-runtime/shiroRole</directory>
- <outputDirectory>runtime/shiroRole/</outputDirectory>
- <includes>
- <include>*.json</include>
- </includes>
- </fileSet><fileSet>
- <directory>${project.basedir}/target/versioned-runtime/shiroUser</directory>
- <outputDirectory>runtime/shiroUser/</outputDirectory>
- <includes>
- <include>*.json</include>
- </includes>
- </fileSet><fileSet>
- <directory>${project.basedir}/target/versioned-runtime/shiroUserRole</directory>
- <outputDirectory>runtime/shiroUserRole</outputDirectory>
- <includes>
- <include>*.json</include>
- </includes>
- </fileSet>
- </fileSets>
-</assembly> \ No newline at end of file
diff --git a/aai-resources/src/main/assembly/descriptor.xml b/aai-resources/src/main/assembly/descriptor.xml
new file mode 100644
index 0000000..b3a8ab0
--- /dev/null
+++ b/aai-resources/src/main/assembly/descriptor.xml
@@ -0,0 +1,32 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <id>build</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>${project.basedir}/src/main/resources</directory>
+ <outputDirectory>/resources</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/src/main/scripts</directory>
+ <outputDirectory>/bin</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.build.directory}</directory>
+ <outputDirectory>/lib</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
diff --git a/aai-resources/src/main/config/ajsc-jetty.xml b/aai-resources/src/main/config/ajsc-jetty.xml
deleted file mode 100644
index de31867..0000000
--- a/aai-resources/src/main/config/ajsc-jetty.xml
+++ /dev/null
@@ -1,164 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
-<Configure id="ajsc-server" class="org.eclipse.jetty.server.Server">
- <!-- DO NOT REMOVE!!!! This is setting up the AJSC Context -->
- <New id="ajscContext" class="org.eclipse.jetty.webapp.WebAppContext">
- <Set name="contextPath"><SystemProperty name="AJSC_CONTEXT_PATH" /></Set>
- <Set name="extractWAR">true</Set>
- <Set name="tempDirectory"><SystemProperty name="AJSC_TEMP_DIR" /></Set>
- <Set name="war"><SystemProperty name="AJSC_WAR_PATH" /></Set>
- <Set name="descriptor"><SystemProperty name="AJSC_HOME" />/etc/runner-web.xml</Set>
- <Set name="overrideDescriptor"><SystemProperty name="AJSC_HOME" />/etc/ajsc-override-web.xml</Set>
- <Set name="throwUnavailableOnStartupException">true</Set>
- <Set name="servletHandler">
- <New class="org.eclipse.jetty.servlet.ServletHandler">
- <Set name="startWithUnavailable">false</Set>
- </New>
- </Set>
- <Set name="extraClasspath">
- <SystemProperty name="AJSC_HOME" />/extJars/aai-core-<SystemProperty name="aai-core.version" />.jar,
- <SystemProperty name="AJSC_HOME" />/extJars/aai-resources.jar,
- <SystemProperty name="AJSC_HOME" />/extJars/logback-core-1.1.7.jar,
- <SystemProperty name="AJSC_HOME" />/extJars/logback-access-1.1.7.jar,
- <SystemProperty name="AJSC_HOME" />/extJars/eelf-core-1.0.0.jar,
- <SystemProperty name="AJSC_HOME" />/extJars/slf4j-api-1.7.21.jar
- </Set>
- </New>
-
- <Set name="handler">
- <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
- <Set name="handlers">
- <Array type="org.eclipse.jetty.server.Handler">
- <Item>
- <New id="Contexts"
- class="org.eclipse.jetty.server.handler.ContextHandlerCollection">
- <Set name="Handlers">
- <Array type="org.eclipse.jetty.webapp.WebAppContext">
- <Item>
- <Ref refid="ajscContext" />
- </Item>
- </Array>
- </Set>
- </New>
- </Item>
- <!-- add a RequestLogHandler -->
- <Item>
- <New id="RequestLogHandler" class="org.eclipse.jetty.server.handler.RequestLogHandler">
- <Set name="requestLog">
- <New id="requestLogImpl" class="ch.qos.logback.access.jetty.RequestLogImpl">
- <Set name="fileName"><SystemProperty name="AJSC_HOME" />/bundleconfig/etc/localhost-access-logback.xml</Set>
- </New>
- </Set>
- </New>
- </Item>
- </Array>
- </Set>
- </New>
- </Set>
-
- <Call name="addBean">
- <Arg>
- <New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
- <Set name="contexts">
- <Ref refid="Contexts" />
- </Set>
- <Call id="extAppHotDeployProvider" name="addAppProvider">
- <Arg>
- <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
- <Set name="monitoredDirName"><SystemProperty name="AJSC_HOME" />/extApps</Set>
- <Set name="scanInterval">10</Set>
- <Set name="extractWars">true</Set>
- </New>
- </Arg>
- </Call>
- </New>
- </Arg>
- </Call>
-
- <!--<Call name="addConnector">
- <Arg>
- <New class="org.eclipse.jetty.server.ServerConnector">
- <Arg name="server">
- <Ref refid="ajsc-server" />
- </Arg>
- <Set name="port"><SystemProperty name="AJSC_HTTP_PORT" default="8087" /></Set>
- </New>
- </Arg>
- </Call>-->
-
- <Call id="sslConnector" name="addConnector">
- <Arg>
- <New class="org.eclipse.jetty.server.ServerConnector">
- <Arg name="server">
- <Ref refid="ajsc-server" />
- </Arg>
- <Arg name="factories">
- <Array type="org.eclipse.jetty.server.ConnectionFactory">
- <Item>
- <New class="org.eclipse.jetty.server.SslConnectionFactory">
- <Arg name="next">http/1.1</Arg>
- <Arg name="sslContextFactory">
- <New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
- <Set name="KeyStorePath">file:<SystemProperty name="AJSC_HOME" />/bundleconfig/etc/auth/aai_keystore</Set>
- <Set name="KeyStorePassword">
- <Call class="org.eclipse.jetty.util.security.Password" name="deobfuscate">
- <Arg><SystemProperty name="KEY_STORE_PASSWORD" /></Arg>
- </Call>
- </Set>
- <Set name="KeyManagerPassword">
- <Call class="org.eclipse.jetty.util.security.Password" name="deobfuscate">
- <Arg><SystemProperty name="KEY_MANAGER_PASSWORD" /></Arg>
- </Call>
- </Set>
- <Set name="needClientAuth">false</Set>
- <Set name="ExcludeProtocols">
- <Array type="java.lang.String">
- <Item>SSL</Item>
- <Item>SSLv2</Item>
- <Item>SSLv2Hello</Item>
- <Item>SSLv3</Item>
- <Item>TLSv1</Item>
- </Array>
- </Set>
- </New>
- </Arg>
- </New>
- </Item>
- <Item>
- <New class="org.eclipse.jetty.server.HttpConnectionFactory">
- <Arg name="config">
- <New class="org.eclipse.jetty.server.HttpConfiguration">
- <Call name="addCustomizer">
- <Arg>
- <New class="org.eclipse.jetty.server.SecureRequestCustomizer" />
- </Arg>
- </Call>
- </New>
- </Arg>
- </New>
- </Item>
- </Array>
- </Arg>
- <Set name="port"><SystemProperty name="AJSC_HTTPS_PORT" default="8447" /></Set>
- <Set name="idleTimeout">30000</Set>
- </New>
- </Arg>
- </Call>
-
- <Get name="ThreadPool">
- <Set name="minThreads"><SystemProperty name="AJSC_JETTY_ThreadCount_MIN" /></Set>
- <Set name="maxThreads"><SystemProperty name="AJSC_JETTY_ThreadCount_MAX" /></Set>
- <Set name="idleTimeout"><SystemProperty name="AJSC_JETTY_IDLETIME_MAX" /></Set>
- <Set name="detailedDump">false</Set>
- </Get>
- <Call name="addBean">
- <Arg>
- <New class="org.eclipse.jetty.security.HashLoginService">
- <Set name="name">Test Realm</Set>
- <Set name="config"><SystemProperty name="AJSC_HOME" />/etc/realm.properties</Set>
- <Set name="refreshInterval">5</Set>
- <Call name="start"></Call>
- </New>
- </Arg>
- </Call>
-</Configure>
diff --git a/aai-resources/src/main/config/ajsc-jolokia-override-web.xml b/aai-resources/src/main/config/ajsc-jolokia-override-web.xml
deleted file mode 100644
index b242129..0000000
--- a/aai-resources/src/main/config/ajsc-jolokia-override-web.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
- metadata-complete="false" version="3.0">
-
- <filter-mapping>
- <filter-name>InterceptorFilter</filter-name>
- <url-pattern>/services/*</url-pattern>
- </filter-mapping>
- <filter-mapping>
- <filter-name>InterceptorFilter</filter-name>
- <url-pattern>/rest/*</url-pattern>
- </filter-mapping>
-
- <filter-mapping>
- <filter-name>springSecurityFilterChain</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
- <servlet-mapping>
- <servlet-name>ManagementServlet</servlet-name>
- <url-pattern>/mgmt</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>RestletServlet</servlet-name>
- <url-pattern>/rest/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>CamelServlet</servlet-name>
- <url-pattern>/services/*</url-pattern>
- </servlet-mapping>
-
- <servlet>
- <servlet-name>jolokia-agent</servlet-name>
- <servlet-class>org.jolokia.http.AgentServlet</servlet-class>
- <load-on-startup>2</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>jolokia-agent</servlet-name>
- <url-pattern>/jolokia/*</url-pattern>
- </servlet-mapping>
-
-</web-app> \ No newline at end of file
diff --git a/aai-resources/src/main/config/ajsc-override-web.xml b/aai-resources/src/main/config/ajsc-override-web.xml
deleted file mode 100644
index 61e2836..0000000
--- a/aai-resources/src/main/config/ajsc-override-web.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
- metadata-complete="false" version="3.0">
-
- <filter-mapping>
- <filter-name>WriteableRequestFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- <filter-mapping>
- <filter-name>InterceptorFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- <filter-mapping>
- <filter-name>InterceptorFilter</filter-name>
- <url-pattern>/rest/*</url-pattern>
- </filter-mapping>
-
- <filter-mapping>
- <filter-name>springSecurityFilterChain</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
- <servlet-mapping>
- <servlet-name>ManagementServlet</servlet-name>
- <url-pattern>/mgmt</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>RestletServlet</servlet-name>
- <url-pattern>/rest/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>CamelServlet</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
-
-
-
-</web-app> \ No newline at end of file
diff --git a/aai-resources/src/main/config/ajsc-request.xml b/aai-resources/src/main/config/ajsc-request.xml
deleted file mode 100644
index 5d09b7a..0000000
--- a/aai-resources/src/main/config/ajsc-request.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ns1:ErrorTranslationRequest
- xsi:schemaLocation="http://csi.cingular.com/CSI/Namespaces/Types/Private/ErrorTranslationRequest.xsd ErrorTranslationRequest.xsd"
- xmlns:ns1="http://csi.cingular.com/CSI/Namespaces/Types/Private/ErrorTranslationRequest.xsd"
- xmlns:th="http://csi.cingular.com/CSI/Namespaces/Types/Private/Implementation/TransactionHeader.xsd"
- xmlns:err="http://csi.cingular.com/CSI/Namespaces/Types/Public/ErrorResponse.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <ns1:TransactionHeader>
- <th:applicationId></th:applicationId>
- <th:MessageQualifier>
- <th:messageQualifier></th:messageQualifier>
- </th:MessageQualifier>
- <th:activityCode></th:activityCode>
- <th:sequenceNumber></th:sequenceNumber>
- <th:extendedSequenceNumber></th:extendedSequenceNumber>
- <th:creationDate></th:creationDate>
- <th:transactionDate></th:transactionDate>
- <th:timeToLive></th:timeToLive>
- <th:reasonCode></th:reasonCode>
- <th:systemId></th:systemId>
- <th:operatorId></th:operatorId>
- <th:reference></th:reference>
- <th:replyToAddress></th:replyToAddress>
- <th:originatorId></th:originatorId>
- <th:atlasMessageId></th:atlasMessageId>
- </ns1:TransactionHeader>
- <ns1:operation></ns1:operation>
- <ns1:ServiceEntityFault>
- <err:reportingServiceEntity></err:reportingServiceEntity>
- <err:faultDate></err:faultDate>
- <err:faultSequenceNumber></err:faultSequenceNumber>
- <err:faultLevel></err:faultLevel>
- <err:faultCode></err:faultCode>
- <err:faultDescription></err:faultDescription>
- <err:ServiceProviderRawError>
- <err:code></err:code>
- <err:description></err:description>
- <err:BISError>
- <err:code></err:code>
- <err:description></err:description>
- <err:origination></err:origination>
- <err:severity></err:severity>
- </err:BISError>
- </err:ServiceProviderRawError>
- </ns1:ServiceEntityFault>
- <ns1:conversationID></ns1:conversationID>
- <ns1:partnerName></ns1:partnerName>
- <ns1:isRESTService></ns1:isRESTService>
-</ns1:ErrorTranslationRequest> \ No newline at end of file
diff --git a/aai-resources/src/main/config/hazelcast-client.properties b/aai-resources/src/main/config/hazelcast-client.properties
deleted file mode 100644
index 2624d3f..0000000
--- a/aai-resources/src/main/config/hazelcast-client.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-hazelcast.client.group.name = ajsc
-hazelcast.client.group.pass = ajscpass
-hazelcast.client.connection.timeout = 30000
-hazelcast.client.connection.attempts.limit = 3
-hazelcast.client.reconnection.timeout = 5000
-hazelcast.client.reconnection.attempts.limit= 5
-hazelcast.client.shuffle.addresses = false
-hazelcast.client.update.automatic = true
-hazelcast.client.addresses = localhost, 127.0.0.1 \ No newline at end of file
diff --git a/aai-resources/src/main/config/jul-redirect.properties b/aai-resources/src/main/config/jul-redirect.properties
deleted file mode 100644
index 8b6624d..0000000
--- a/aai-resources/src/main/config/jul-redirect.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-
-# Bridge JUL->slf4j Logging Configuration File
-#
-# This file bridges the JUL logging infrastructure into
-# SLF4J so JUL logs go to logback implementation provided
-# in this project. SLF4J also captures log4j and has
-# other framework options as well providing a common
-# logging infrastructure for capturing all logs from different
-# libraries using different frameworks in one place.
-
-# Global properties
-handlers=org.slf4j.bridge.SLF4JBridgeHandler
-.level= ALL
diff --git a/aai-resources/src/main/config/keyfile b/aai-resources/src/main/config/keyfile
deleted file mode 100644
index 6a1657e..0000000
--- a/aai-resources/src/main/config/keyfile
+++ /dev/null
@@ -1,27 +0,0 @@
-ctRt8XTd7N57kcm0npZOWSDF5I69w9K97cQS_ep0AgxgHmYB0WtYblsrMGuHfyS1o4697zLiIeoS
-Nn5kE1kedl4c4HevfuwfoJpWyiugYusNOqbTGQJ1MHOwqiBEJnjXepZEoz1btaW_hDO7uz-BoD4t
-SxwNRwVQpcg0_CmBX-yIW2YCIECoxZH9_X_8fcXYHP2VgFxxBpvjgycNQlyN15_VSuLwn3Wj0W8_
-8chRxGURyhp8iEBSb4tIdN5jXkhCma7AP7wreMufFQqXjdfWqIisJPfIpS3znl5IiTOZP22XhHay
-gq2KFwABVqjM71m5czEz1ojGkbFEAGImrY-VFHuug2u4ss4VW7TGeJst0z7I5vrn5M6i9Eb6xiGh
-jNUebRCV3cYGrtD9SlvjJBVVeP_3OrkxlD4oktx-JTRJzYtXADB5if2gtpYxy84kqrz7ltr5rXUH
-zSG7ujKCXOOE_Wk6vQPSjYPnum6R_mxOorCNCvtf6ne85Xd81DZlJM-CleVNdOU7g1xie-gBZPAX
-bOvWf6p_pVNmH76v-m4XLAAUqEzt-9PvNmirODiDiY5bNz6l-1ejw8IyQYb37e_3sN_LjF7A9HgB
-Dia7kNjsfB7_2vB7R4qjwNLsmTMnQCDANnNpl9VpotZ4blPhhOWhB1Tg3lxc-z-VRV7GBbl_2eQd
-3eYUT1Z5Li184W4-pft_TCaDJ1NyaJd1CQxQEuIORdq5B6Q2L9SMmmOOh82Czu5_Ro80IGikHXHp
-Lqf2fIaceY_IBAeGp2iPjtXdkghV24vIT49oRfqf6sBKAPy-88xILnMWM6M5bMCETKn7UvM1kV5y
-ZQYlsi-36n73ETZyiFs1PLqe8D6dRURrcBG_B9i1MafNiWa-elG6E0X0pSK9CadchSA0KRMaKtfE
-6-iyUqE-bx-0ELTbV2y7gLdu5MVtjRmQB5ozoaBq8ik4-jAWAsKpTv4DfWoMp9DkRENlKeauayuT
-j_VAGhqy07pIntQKtbK9EP0tndSKtF3WLwHel1I5C3lthhkxxfzpxURBxO1ZJMFJZ6rLu1Ku03zw
-LJ7nFFR_YfJ7tnGZE4PEt7MOZNiNoD3__9PthO5HmZdk1gPMrKlojU1hyR3IlbVShUst6rA3MkWk
-MD-zlw9mhNgaV3xvPJ945pYPe4C6qIwxXoiXGHyhv_0MpcvuMW-pUuAZXfkuiqNwQnpUTLBD0YJw
-uwMbE7sN40e6-BSxEiMOab7s2gShbaK9JjCMQUH_vAuQSZjU4sn53jsS7U4DHntzgxVYttIwGZaU
-b-1R7jYphNJnCI8rPB_xjJ0OMssNKT7lYRgG_ZuKvifYvJWt-NwD0z2qoePcRGExXuioRDNR4SlB
--RN33dYhp6vRsHKT1oLpl-UJB6dqJlZ2dCsfc7vT1Vs0SYidRYXCUJNBSePI4-1LMlHKOqGASBcg
-pl589601-EtO7ch3RoaL26rNXzA-umUWYRPQPZ76wcgK2j4k5Ndub5dWK9jI6UW3RbF6ixe0Yw2j
-_Pipt4EX8R6-sb87D69JOOnZlFVB6EcCO07Q7j6DavpUNHlLmDmPgArqODh002scvW1ryMxBR2XE
-m3kGQh2IFh5Qru8duxblEYE-lmHGxXVgDtKiKgHwPTkaxcquEtZTEJxaIJIgoKj7SgMzdfbeLlJM
-RwbdvExmnRT9ivFImeIV7ACPnfBP3URd82kTG8FyiMvSpdCLL16FWOd9gjZuMstqZrmIVF8tO2WT
-COMIx-jqvQD2zS1Ul5p0szJaf-CxBjy7-cJIaAyEToR1T5bBFtQt4sEFxG7XG0cCoXShqclL70TV
-W13X5pY55YwHkCR4mRjc0o0ZKStY3OADVLFom1bC9AmMBqU4PsKNAX29LT37WE-I23tQgzid0Ix9
-JuVzlbOTvi19uLYbltrHavU3UbVhYxNNI7Y7tM02xfq3LhGqZG5EPS-WAB9bBixHQqw78cd9iqIr
-hHlZW80l1kgs1ezMqgxfwDuiFOZIu9UWQ6vSnTAvfhwJhcr77gSk5Gu957uxzleaS4gVwTYU
diff --git a/aai-resources/src/main/config/logback-migration.xml b/aai-resources/src/main/config/logback-migration.xml
deleted file mode 100644
index 88ade33..0000000
--- a/aai-resources/src/main/config/logback-migration.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- org.onap.aai
- ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ============LICENSE_END=========================================================
- -->
-
-<configuration>
- <appender name="MIGRATION_FILE_LOG"
- class="ch.qos.logback.core.FileAppender">
- <append>true</append>
- <file>logs/migrationAic3.log</file>
- <encoder class="org.onap.aai.logging.CustomLogPatternLayoutEncoder">
- <Pattern>%a %u %z [%t] "%m %U" %s %b</Pattern>
- </encoder>
- </appender>
- <root level="DEBUG">
- <appender-ref ref="MIGRATION_FILE_LOG" />
- </root>
-</configuration>
-
-<!--
-%a - Remote IP address
-%A - Local IP address
-%b - Bytes sent, excluding HTTP headers, or '-' if no bytes were sent
-%B - Bytes sent, excluding HTTP headers
-%h - Remote host name
-%H - Request protocol
-%l - Remote logical username from identd (always returns '-')
-%m - Request method
-%p - Local port
-%q - Query string (prepended with a '?' if it exists, otherwise an empty string
-%r - First line of the request
-%s - HTTP status code of the response
-%S - User session ID
-%t - Date and time, in Common Log Format format
-%u - Remote user that was authenticated
-%U - Requested URL path
-%v - Local server name
-%I - current request thread name (can compare later with stacktraces)
-
-%z - Custom pattern that parses the cert for the subject
- -->
diff --git a/aai-resources/src/main/config/runner-web.xml b/aai-resources/src/main/config/runner-web.xml
deleted file mode 100644
index 95d663c..0000000
--- a/aai-resources/src/main/config/runner-web.xml
+++ /dev/null
@@ -1,106 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
- metadata-complete="false" version="3.0">
-
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>/WEB-INF/spring-servlet.xml,
- classpath:applicationContext.xml
- </param-value>
- </context-param>
-
- <context-param>
- <param-name>spring.profiles.default</param-name>
- <param-value>nooauth</param-value>
- </context-param>
-
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
-
- <servlet>
- <servlet-name>ManagementServlet</servlet-name>
- <servlet-class>ajsc.ManagementServlet</servlet-class>
- </servlet>
-
- <filter>
- <filter-name>WriteableRequestFilter</filter-name>
- <filter-class>com.att.ajsc.csi.writeablerequestfilter.WriteableRequestFilter</filter-class>
- </filter>
-
- <filter>
- <filter-name>InterceptorFilter</filter-name>
- <filter-class>ajsc.filters.InterceptorFilter</filter-class>
- <init-param>
- <param-name>preProcessor_interceptor_config_file</param-name>
- <param-value>/etc/PreProcessorInterceptors.properties</param-value>
- </init-param>
- <init-param>
- <param-name>postProcessor_interceptor_config_file</param-name>
- <param-value>/etc/PostProcessorInterceptors.properties</param-value>
- </init-param>
-
- </filter>
-
- <servlet>
- <servlet-name>RestletServlet</servlet-name>
- <servlet-class>ajsc.restlet.RestletSpringServlet</servlet-class>
- <init-param>
- <param-name>org.restlet.component</param-name>
- <param-value>restletComponent</param-value>
- </init-param>
- </servlet>
-
- <servlet>
- <servlet-name>CamelServlet</servlet-name>
- <servlet-class>ajsc.servlet.AjscCamelServlet</servlet-class>
- </servlet>
-
-
- <filter>
- <filter-name>springSecurityFilterChain</filter-name>
- <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
- </filter>
-
- <servlet>
- <servlet-name>spring</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
-
-
- <servlet-mapping>
- <servlet-name>spring</servlet-name>
- <url-pattern>/</url-pattern>
- </servlet-mapping>
-
- <listener>
- <listener-class>
- org.onap.aai.util.AAIAppServletContextListener
- </listener-class>
- </listener>
-
- <security-constraint>
- <web-resource-collection>
- <web-resource-name>Open Source</web-resource-name>
- <url-pattern>/aai/*</url-pattern>
- </web-resource-collection>
- <auth-constraint>
- <role-name>admin</role-name>
- </auth-constraint>
- <user-data-constraint>
- <transport-guarantee>CONFIDENTIAL</transport-guarantee>
- </user-data-constraint>
- </security-constraint>
-
- <login-config>
- <auth-method>BASIC</auth-method>
- <realm-name>Test Realm</realm-name>
- </login-config>
-
- <security-role>
- <role-name>admin</role-name>
- </security-role>
-</web-app>
diff --git a/aai-resources/src/main/docker/Dockerfile b/aai-resources/src/main/docker/Dockerfile
new file mode 100644
index 0000000..be8af9c
--- /dev/null
+++ b/aai-resources/src/main/docker/Dockerfile
@@ -0,0 +1,22 @@
+FROM aaionap/aai-common:1.2.0
+
+
+# Add the proper files into the docker image from your build
+WORKDIR /opt/app/aai-resources
+
+# Expose the ports for outside linux to use
+# 8447 is the important one to be used
+EXPOSE 8447
+
+
+HEALTHCHECK --interval=40s --timeout=10s --retries=3 CMD nc -z -v localhost 8447 || exit 1
+
+ENTRYPOINT ["/bin/bash", "/opt/app/aai-resources/docker-entrypoint.sh"]
+
+RUN mkdir -p /opt/aaihome/aaiadmin /opt/aai/logroot/AAI-RES
+
+VOLUME /opt/aai/logroot/AAI-RES
+
+COPY /maven/aai-resources/ .
+
+ENV AAI_BUILD_VERSION @aai.docker.version@
diff --git a/aai-resources/src/main/resources/docker/aai.sh b/aai-resources/src/main/docker/aai.sh
index 2e2c35f..2e2c35f 100644
--- a/aai-resources/src/main/resources/docker/aai.sh
+++ b/aai-resources/src/main/docker/aai.sh
diff --git a/aai-resources/src/main/docker/docker-entrypoint.sh b/aai-resources/src/main/docker/docker-entrypoint.sh
new file mode 100644
index 0000000..05abc71
--- /dev/null
+++ b/aai-resources/src/main/docker/docker-entrypoint.sh
@@ -0,0 +1,110 @@
+###
+# ============LICENSE_START=======================================================
+# org.onap.aai
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+APP_HOME=$(pwd);
+RESOURCES_HOME=${APP_HOME}/resources/;
+
+export CHEF_CONFIG_REPO=${CHEF_CONFIG_REPO:-aai-config};
+export CHEF_GIT_URL=${CHEF_GIT_URL:-http://gerrit.onap.org/r/aai};
+export CHEF_CONFIG_GIT_URL=${CHEF_CONFIG_GIT_URL:-$CHEF_GIT_URL};
+export CHEF_DATA_GIT_URL=${CHEF_DATA_GIT_URL:-$CHEF_GIT_URL};
+
+export SERVER_PORT=${SERVER_PORT:-8447};
+
+USER_ID=${LOCAL_USER_ID:-9001}
+GROUP_ID=${LOCAL_GROUP_ID:-9001}
+
+ln -s bin scripts
+ln -s /opt/aai/logroot/AAI-RES logs
+
+echo "Project Build Version: ${aai.build.version}";
+
+if [ $(cat /etc/passwd | grep aaiadmin | wc -l) -eq 0 ]; then
+ groupadd aaiadmin -g ${GROUP_ID} || {
+ echo "Unable to create the group id for ${GROUP_ID}";
+ exit 1;
+ }
+ useradd --shell=/bin/bash -u ${USER_ID} -g ${GROUP_ID} -o -c "" -m aaiadmin || {
+ echo "Unable to create the user id for ${USER_ID}";
+ exit 1;
+ }
+fi;
+
+chown -R aaiadmin:aaiadmin /opt/app /opt/aai/logroot /var/chef
+find /opt/app/ -name "*.sh" -exec chmod +x {} +
+
+if [ -f ${APP_HOME}/aai.sh ]; then
+ mv ${APP_HOME}/aai.sh /etc/profile.d/aai.sh
+ chmod 755 /etc/profile.d/aai.sh
+
+ gosu aaiadmin /opt/app/aai-resources/scripts/createDBSchema.sh || exit 1
+fi;
+
+JAVA_CMD="exec gosu aaiadmin java";
+
+JVM_OPTS="${PRE_JVM_OPTS} -XX:+UnlockDiagnosticVMOptions";
+JVM_OPTS="${JVM_OPTS} -XX:+UnsyncloadClass";
+JVM_OPTS="${JVM_OPTS} -XX:+UseConcMarkSweepGC";
+JVM_OPTS="${JVM_OPTS} -XX:+CMSParallelRemarkEnabled";
+JVM_OPTS="${JVM_OPTS} -XX:+UseCMSInitiatingOccupancyOnly";
+JVM_OPTS="${JVM_OPTS} -XX:CMSInitiatingOccupancyFraction=70";
+JVM_OPTS="${JVM_OPTS} -XX:+ScavengeBeforeFullGC";
+JVM_OPTS="${JVM_OPTS} -XX:+CMSScavengeBeforeRemark";
+JVM_OPTS="${JVM_OPTS} -XX:-HeapDumpOnOutOfMemoryError";
+JVM_OPTS="${JVM_OPTS} -XX:+UseParNewGC";
+JVM_OPTS="${JVM_OPTS} -verbose:gc";
+JVM_OPTS="${JVM_OPTS} -XX:+PrintGCDetails";
+JVM_OPTS="${JVM_OPTS} -XX:+PrintGCTimeStamps";
+JVM_OPTS="${JVM_OPTS} -XX:MaxPermSize=512M";
+JVM_OPTS="${JVM_OPTS} -XX:PermSize=512M";
+JVM_OPTS="${JVM_OPTS} -server";
+JVM_OPTS="${JVM_OPTS} -XX:NewSize=512m";
+JVM_OPTS="${JVM_OPTS} -XX:MaxNewSize=512m";
+JVM_OPTS="${JVM_OPTS} -XX:SurvivorRatio=8";
+JVM_OPTS="${JVM_OPTS} -XX:+DisableExplicitGC";
+JVM_OPTS="${JVM_OPTS} -verbose:gc";
+JVM_OPTS="${JVM_OPTS} -XX:+UseParNewGC";
+JVM_OPTS="${JVM_OPTS} -XX:+CMSParallelRemarkEnabled";
+JVM_OPTS="${JVM_OPTS} -XX:+CMSClassUnloadingEnabled";
+JVM_OPTS="${JVM_OPTS} -XX:+UseConcMarkSweepGC";
+JVM_OPTS="${JVM_OPTS} -XX:-UseBiasedLocking";
+JVM_OPTS="${JVM_OPTS} -XX:ParallelGCThreads=4";
+JVM_OPTS="${JVM_OPTS} -XX:LargePageSizeInBytes=128m";
+JVM_OPTS="${JVM_OPTS} -XX:+PrintGCDetails";
+JVM_OPTS="${JVM_OPTS} -XX:+PrintGCTimeStamps";
+JVM_OPTS="${JVM_OPTS} -Xloggc:/opt/app/aai-resources/logs/ajsc-jetty/gc/aai_gc.log";
+JVM_OPTS="${JVM_OPTS} -Dsun.net.inetaddr.ttl=180";
+JVM_OPTS="${JVM_OPTS} -XX:+HeapDumpOnOutOfMemoryError";
+JVM_OPTS="${JVM_OPTS} -XX:HeapDumpPath=/opt/app/aai-resources/logs/ajsc-jetty/heap-dump";
+JVM_OPTS="${JVM_OPTS} ${POST_JVM_OPTS}";
+
+JAVA_OPTS="${PRE_JAVA_OPTS} -DAJSC_HOME=$APP_HOME";
+JAVA_OPTS="${JAVA_OPTS} -Dserver.port=${SERVER_PORT}";
+JAVA_OPTS="${JAVA_OPTS} -DBUNDLECONFIG_DIR=./resources";
+JAVA_OPTS="${JAVA_OPTS} -Dserver.local.startpath=${RESOURCES_HOME}";
+JAVA_OPTS="${JAVA_OPTS} -DAAI_CHEF_ENV=${AAI_CHEF_ENV}";
+JAVA_OPTS="${JAVA_OPTS} -DSCLD_ENV=${SCLD_ENV}";
+JAVA_OPTS="${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom";
+JAVA_OPTS="${JAVA_OPTS} -Dloader.path=$APP_HOME/resources";
+JAVA_OPTS="${JAVA_OPTS} ${POST_JAVA_OPTS}";
+
+JAVA_MAIN_JAR=$(ls lib/aai-resources*.jar);
+
+${JAVA_CMD} ${JVM_OPTS} ${JAVA_OPTS} -jar ${JAVA_MAIN_JAR};
diff --git a/aai-resources/src/main/java/org/onap/aai/ajsc_aai/filemonitor/ServicePropertiesListener.java b/aai-resources/src/main/java/org/onap/aai/Profiles.java
index 38ea8c6..9f00466 100644
--- a/aai-resources/src/main/java/org/onap/aai/ajsc_aai/filemonitor/ServicePropertiesListener.java
+++ b/aai-resources/src/main/java/org/onap/aai/Profiles.java
@@ -19,20 +19,14 @@
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-package org.onap.aai.ajsc_aai.filemonitor;
+package org.onap.aai;
-import java.io.File;
+public final class Profiles {
-//import com.att.ssf.filemonitor.FileChangedListener;
+ public static final String DMAAP = "dmaap";
-//public class ServicePropertiesListener implements FileChangedListener {
+ public static final String ONE_WAY_SSL = "one-way-ssl";
+ public static final String TWO_WAY_SSL = "two-way-ssl";
- /**
- * {@inheritDoc}
- */
- //@Override
- //public void update(File file) throws Exception
- //{
- //ServicePropertiesMap.refresh(file);
- //}
-//}
+ private Profiles(){}
+}
diff --git a/aai-resources/src/main/java/org/onap/aai/ResourcesApp.java b/aai-resources/src/main/java/org/onap/aai/ResourcesApp.java
new file mode 100644
index 0000000..c435053
--- /dev/null
+++ b/aai-resources/src/main/java/org/onap/aai/ResourcesApp.java
@@ -0,0 +1,159 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.onap.aai.config.PropertyPasswordConfiguration;
+import org.onap.aai.dbmap.AAIGraph;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.introspection.ModelInjestor;
+import org.onap.aai.logging.LoggingContext;
+import org.onap.aai.migration.MigrationControllerInternal;
+import org.onap.aai.util.AAIConfig;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
+import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
+import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
+import org.springframework.cloud.netflix.ribbon.RibbonClient;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.core.env.Environment;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import java.util.UUID;
+
+@SpringBootApplication
+// Component Scan provides a way to look for spring beans
+// It only searches beans in the following packages
+// Any method annotated with @Bean annotation or any class
+// with @Component, @Configuration, @Service will be picked up
+@ComponentScan(basePackages = {
+ "org.onap.aai.config",
+ "org.onap.aai.web",
+ "org.onap.aai.tasks",
+ "org.onap.aai.rest"
+})
+@EnableAutoConfiguration(exclude = {
+ DataSourceAutoConfiguration.class,
+ DataSourceTransactionManagerAutoConfiguration.class,
+ HibernateJpaAutoConfiguration.class
+})
+@RibbonClient(name = "dmaap", configuration = AAIRibbonConfiguration.class)
+public class ResourcesApp {
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(ResourcesApp.class.getName());
+
+ private static final String APP_NAME = "aai-resources";
+
+ @Autowired
+ private Environment env;
+
+ @PostConstruct
+ private void init() throws AAIException {
+ System.setProperty("org.onap.aai.serverStarted", "false");
+ setDefaultProps();
+
+ LoggingContext.save();
+ LoggingContext.component("init");
+ LoggingContext.partnerName("NA");
+ LoggingContext.targetEntity(APP_NAME);
+ LoggingContext.requestId(UUID.randomUUID().toString());
+ LoggingContext.serviceName(APP_NAME);
+ LoggingContext.targetServiceName("contextInitialized");
+
+ logger.info("AAI Server initialization started...");
+
+ // Setting this property to allow for encoded slash (/) in the path parameter
+ // This is only needed for tomcat keeping this as temporary
+ System.setProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "true");
+
+ logger.info("Starting AAIGraph connections and the ModelInjestor");
+
+ if(env.acceptsProfiles(Profiles.TWO_WAY_SSL) && env.acceptsProfiles(Profiles.ONE_WAY_SSL)){
+ logger.warn("You have seriously misconfigured your application");
+ }
+
+ AAIConfig.init();
+ ModelInjestor.getInstance();
+ AAIGraph.getInstance();
+ }
+
+ @PreDestroy
+ public void cleanup(){
+ logger.info("Shutting down both realtime and cached connections");
+ AAIGraph.getInstance().graphShutdown();
+ }
+
+ public static void main(String[] args) {
+
+ setDefaultProps();
+ SpringApplication app = new SpringApplication(ResourcesApp.class);
+ app.setRegisterShutdownHook(true);
+ app.addInitializers(new PropertyPasswordConfiguration());
+ Environment env = app.run(args).getEnvironment();
+
+ logger.info(
+ "Application '{}' is running on {}!" ,
+ env.getProperty("spring.application.name"),
+ env.getProperty("server.port")
+ );
+
+ if ("true".equals(AAIConfig.get("aai.run.migrations", "false"))) {
+ MigrationControllerInternal migrations = new MigrationControllerInternal();
+ migrations.run(new String[]{"--commit"});
+ }
+
+ logger.info("Resources MicroService Started");
+ logger.error("Resources MicroService Started");
+ logger.debug("Resources MicroService Started");
+ System.out.println("Resources Microservice Started");
+ }
+
+ public static void setDefaultProps(){
+
+ if (System.getProperty("file.separator") == null) {
+ System.setProperty("file.separator", "/");
+ }
+
+ String currentDirectory = System.getProperty("user.dir");
+
+ if (System.getProperty("AJSC_HOME") == null) {
+ System.setProperty("AJSC_HOME", ".");
+ }
+
+ if(currentDirectory.contains(APP_NAME)){
+ if (System.getProperty("BUNDLECONFIG_DIR") == null) {
+ System.setProperty("BUNDLECONFIG_DIR", "src/main/resources");
+ }
+ } else {
+ if (System.getProperty("BUNDLECONFIG_DIR") == null) {
+ System.setProperty("BUNDLECONFIG_DIR", "aai-resources/src/main/resources");
+ }
+ }
+
+ }
+}
diff --git a/aai-resources/src/main/java/org/onap/aai/ajsc_aai/JaxrsErrorMessageLookupService.java b/aai-resources/src/main/java/org/onap/aai/ajsc_aai/JaxrsErrorMessageLookupService.java
deleted file mode 100644
index f7b08d9..0000000
--- a/aai-resources/src/main/java/org/onap/aai/ajsc_aai/JaxrsErrorMessageLookupService.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.aai.ajsc_aai;
-
-//import java.util.HashMap;
-//import java.util.Map;
-
-//import javax.ws.rs.GET;
-//import javax.ws.rs.HeaderParam;
-//import javax.ws.rs.Path;
-//import javax.ws.rs.PathParam;
-//import javax.ws.rs.Produces;
-
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//import org.springframework.web.context.ContextLoader;
-//import org.springframework.web.context.WebApplicationContext;
-
-//import ajsc.ErrorMessageLookupService;
-
-//@Path("/errormessage")
-//public class JaxrsErrorMessageLookupService {
-
- //private final static Logger logger = LoggerFactory
- //.getLogger(ErrorMessageLookupService.class);
-
- /**
- * Gets the message.
- *
- * @param input the input
- * @param errorCode the error code
- * @param appId the app id
- * @param operation the operation
- * @param messageText the message text
- * @param isRESTService the is REST service
- * @param faultEntity the fault entity
- * @param ConvID the conv ID
- * @return the message
- */
- //@GET
- //@Path("/emls")
- //@Produces("text/plain")
- //public String getMessage(@PathParam("input") String input,
- //@HeaderParam("errorCode") String errorCode,
- //@HeaderParam("appId") String appId,
- //@HeaderParam("operation") String operation,
- //@HeaderParam("messageText") String messageText,
- //@HeaderParam("isRESTService") String isRESTService,
- //@HeaderParam("faultEntity") String faultEntity,
- //@HeaderParam("ConvID") String ConvID) {
-
- //Map<String, String> headers = new HashMap<String, String>();
- //headers.put(errorCode, errorCode);
- //headers.put(appId, appId);
- //headers.put(operation, operation);
- //headers.put(messageText, messageText);
- //headers.put(isRESTService, isRESTService);
- //headers.put(faultEntity, faultEntity);
- //headers.put(ConvID, ConvID);
-
- //WebApplicationContext applicationContext = ContextLoader
- //.getCurrentWebApplicationContext();
-
- //ErrorMessageLookupService e = (ErrorMessageLookupService) applicationContext
- //.getBean("errorMessageLookupService");
-
- //String message = e.getExceptionDetails(appId, operation, errorCode,
- //messageText,isRESTService, faultEntity, ConvID);
-
- //System.out.println("Error code = " + errorCode);
- //System.out.println("appId = " + appId);
- //System.out.println("operation = " + operation);
- //System.out.println("messageText = " + messageText);
- //System.out.println("isRESTService = " + isRESTService);
- //System.out.println("faultEntity = " + faultEntity);
- //System.out.println("ConvID = " + ConvID);
- //return "The exception message is:\n " + message;
- //}
-
-//}
diff --git a/aai-resources/src/main/java/org/onap/aai/ajsc_aai/filemonitor/ServicePropertiesMap.java b/aai-resources/src/main/java/org/onap/aai/ajsc_aai/filemonitor/ServicePropertiesMap.java
deleted file mode 100644
index 7274c61..0000000
--- a/aai-resources/src/main/java/org/onap/aai/ajsc_aai/filemonitor/ServicePropertiesMap.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.aai.ajsc_aai.filemonitor;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class ServicePropertiesMap
-{
- private static HashMap<String, HashMap<String, String>> mapOfMaps = new HashMap<String, HashMap<String, String>>();
- private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(ServicePropertiesMap.class);
-
- /**
- * Refresh.
- *
- * @param file the file
- * @throws Exception the exception
- */
- public static void refresh(File file) throws Exception
- {
- try
- {
- LOGGER.info("Loading properties - " + (file != null?file.getName():""));
-
- //Store .json & .properties files into map of maps
- String filePath = file.getPath();
-
- if(filePath.lastIndexOf(".json")>0){
-
- ObjectMapper om = new ObjectMapper();
- TypeReference<HashMap<String, String>> typeRef = new TypeReference<HashMap<String, String>>() {};
- HashMap<String, String> propMap = om.readValue(file, typeRef);
- HashMap<String, String> lcasePropMap = new HashMap<String, String>();
- for (String key : propMap.keySet() )
- {
- String lcaseKey = ifNullThenEmpty(key);
- lcasePropMap.put(lcaseKey, propMap.get(key));
- }
-
- mapOfMaps.put(file.getName(), lcasePropMap);
-
-
- }else if(filePath.lastIndexOf(".properties")>0){
- Properties prop = new Properties();
- FileInputStream fis = new FileInputStream(file);
- prop.load(fis);
-
- @SuppressWarnings("unchecked")
- HashMap<String, String> propMap = new HashMap<String, String>((Map)prop);
-
- mapOfMaps.put(file.getName(), propMap);
- }
-
- LOGGER.info("File - " + file.getName() + " is loaded into the map and the corresponding system properties have been refreshed");
- }
- catch (Exception e)
- {
- LOGGER.error("File " + (file != null?file.getName():"") + " cannot be loaded into the map ", e);
- throw new Exception("Error reading map file " + (file != null?file.getName():""), e);
- }
- }
-
- /**
- * Gets the property.
- *
- * @param fileName the file name
- * @param propertyKey the property key
- * @return the property
- */
- public static String getProperty(String fileName, String propertyKey)
- {
- HashMap<String, String> propMap = mapOfMaps.get(fileName);
- return propMap!=null?propMap.get(ifNullThenEmpty(propertyKey)):"";
- }
-
- /**
- * Gets the properties.
- *
- * @param fileName the file name
- * @return the properties
- */
- public static HashMap<String, String> getProperties(String fileName){
- return mapOfMaps.get(fileName);
- }
-
- /**
- * If null then empty.
- *
- * @param key the key
- * @return the string
- */
- private static String ifNullThenEmpty(String key) {
- if (key == null) {
- return "";
- } else {
- return key;
- }
- }
-
-}
diff --git a/aai-resources/src/main/java/org/onap/aai/ajsc_aai/filemonitor/ServicePropertyService.java b/aai-resources/src/main/java/org/onap/aai/ajsc_aai/filemonitor/ServicePropertyService.java
deleted file mode 100644
index 956d0e4..0000000
--- a/aai-resources/src/main/java/org/onap/aai/ajsc_aai/filemonitor/ServicePropertyService.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.aai.ajsc_aai.filemonitor;
-
-//import java.io.File;
-//import java.io.FileInputStream;
-//import java.io.IOException;
-//import java.lang.reflect.Method;
-//import java.util.ArrayList;
-//import java.util.List;
-//import java.util.Properties;
-
-//import javax.annotation.PostConstruct;
-
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-
-//import com.att.ssf.filemonitor.FileChangedListener;
-//import com.att.ssf.filemonitor.FileMonitor;
-
-//public class ServicePropertyService {
- //private boolean loadOnStartup;
- //private ServicePropertiesListener fileChangedListener;
- //private ServicePropertiesMap filePropertiesMap;
- //private String ssfFileMonitorPollingInterval;
- //private String ssfFileMonitorThreadpoolSize;
- //private List<File> fileList;
- //private static final String FILE_CHANGE_LISTENER_LOC = System
- //.getProperty("AJSC_CONF_HOME") + "/etc";
- //private static final String USER_CONFIG_FILE = "service-file-monitor.properties";
- //static final Logger logger = LoggerFactory
- //.getLogger(ServicePropertyService.class);
-
- //// do not remove the postConstruct annotation, init method will not be
- //// called after constructor
- /**
- * Inits the.
- *
- * @throws Exception the exception
- */
- //@PostConstruct
- //public void init() throws Exception {
-
- //try {
- //getFileList(FILE_CHANGE_LISTENER_LOC);
-
- //for (File file : fileList) {
- //try {
- //FileChangedListener fileChangedListener = this.fileChangedListener;
- //Object filePropertiesMap = this.filePropertiesMap;
- //Method m = filePropertiesMap.getClass().getMethod(
- //"refresh", File.class);
- //m.invoke(filePropertiesMap, file);
- //FileMonitor fm = FileMonitor.getInstance();
- //fm.addFileChangedListener(file, fileChangedListener,
- //loadOnStartup);
- //} catch (Exception ioe) {
- //logger.error("Error in the file monitor block", ioe);
- //}
- //}
- //} catch (Exception ex) {
- //logger.error("Error creating property map ", ex);
- //}
-
- //}
-
- /**
- * Gets the file list.
- *
- * @param dirName the dir name
- * @return the file list
- * @throws IOException Signals that an I/O exception has occurred.
- */
- //private void getFileList(String dirName) throws IOException {
- //File directory = new File(dirName);
- //FileInputStream fis = null;
-
- //if (fileList == null)
- //fileList = new ArrayList<File>();
-
- //// get all the files that are ".json" or ".properties", from a directory
- //// & it's sub-directories
- //File[] fList = directory.listFiles();
-
- //for (File file : fList) {
- //// read service property files from the configuration file
- //if (file.isFile() && file.getPath().endsWith(USER_CONFIG_FILE)) {
- //try {
- //fis = new FileInputStream(file);
- //Properties prop = new Properties();
- //prop.load(fis);
-
- //for (String filePath : prop.stringPropertyNames()) {
- //fileList.add(new File(prop.getProperty(filePath)));
- //}
- //} catch (Exception ioe) {
- //logger.error("Error reading the file stream ", ioe);
- //} finally {
- //fis.close();
- //}
- //} else if (file.isDirectory()) {
- //getFileList(file.getPath());
- //}
- //}
-
- //}
-
- /**
- * Sets the load on startup.
- *
- * @param loadOnStartup the new load on startup
- */
- //public void setLoadOnStartup(boolean loadOnStartup) {
- //this.loadOnStartup = loadOnStartup;
- //}
-
- /**
- * Sets the ssf file monitor polling interval.
- *
- * @param ssfFileMonitorPollingInterval the new ssf file monitor polling interval
- */
- //public void setSsfFileMonitorPollingInterval(
- //String ssfFileMonitorPollingInterval) {
- //this.ssfFileMonitorPollingInterval = ssfFileMonitorPollingInterval;
- //}
-
- /**
- * Sets the ssf file monitor threadpool size.
- *
- * @param ssfFileMonitorThreadpoolSize the new ssf file monitor threadpool size
- */
- //public void setSsfFileMonitorThreadpoolSize(
- //String ssfFileMonitorThreadpoolSize) {
- //this.ssfFileMonitorThreadpoolSize = ssfFileMonitorThreadpoolSize;
- //}
-
- /**
- * Gets the load on startup.
- *
- * @return the load on startup
- */
- //public boolean getLoadOnStartup() {
- //return loadOnStartup;
- //}
-
- /**
- * Gets the ssf file monitor polling interval.
- *
- * @return the ssf file monitor polling interval
- */
- //public String getSsfFileMonitorPollingInterval() {
- //return ssfFileMonitorPollingInterval;
- //}
-
- /**
- * Gets the ssf file monitor threadpool size.
- *
- * @return the ssf file monitor threadpool size
- */
- //public String getSsfFileMonitorThreadpoolSize() {
- //return ssfFileMonitorThreadpoolSize;
- //}
-
- /**
- * Gets the file changed listener.
- *
- * @return the file changed listener
- */
- //public ServicePropertiesListener getFileChangedListener() {
- //return fileChangedListener;
- //}
-
- /**
- * Sets the file changed listener.
- *
- * @param fileChangedListener the new file changed listener
- */
- //public void setFileChangedListener(
- //ServicePropertiesListener fileChangedListener) {
- //this.fileChangedListener = fileChangedListener;
- //}
-
- /**
- * Gets the file properties map.
- *
- * @return the file properties map
- */
- //public ServicePropertiesMap getFilePropertiesMap() {
- //return filePropertiesMap;
- //}
-
- /**
- * Sets the file properties map.
- *
- * @param filePropertiesMap the new file properties map
- */
- //public void setFilePropertiesMap(ServicePropertiesMap filePropertiesMap) {
- //this.filePropertiesMap = filePropertiesMap;
- //}
-//}
diff --git a/aai-resources/src/main/java/org/onap/aai/config/DmaapConfig.java b/aai-resources/src/main/java/org/onap/aai/config/JettyPasswordDecoder.java
index c34ae0a..5aef2eb 100644
--- a/aai-resources/src/main/java/org/onap/aai/config/DmaapConfig.java
+++ b/aai-resources/src/main/java/org/onap/aai/config/JettyPasswordDecoder.java
@@ -21,23 +21,15 @@
*/
package org.onap.aai.config;
-import org.apache.activemq.broker.BrokerService;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
+import org.eclipse.jetty.util.security.Password;
-@Configuration
-public class DmaapConfig {
+public class JettyPasswordDecoder implements PasswordDecoder {
- @Bean(destroyMethod = "stop")
- public BrokerService brokerService() throws Exception {
-
- BrokerService broker = new BrokerService();
- broker.addConnector("tcp://localhost:61447");
- broker.setPersistent(false);
- broker.setUseJmx(false);
- broker.setSchedulerSupport(false);
- broker.start();
-
- return broker;
+ @Override
+ public String decode(String input) {
+ if (input.startsWith("OBF:")) {
+ return Password.deobfuscate(input);
+ }
+ return Password.deobfuscate("OBF:" + input);
}
}
diff --git a/aai-resources/src/main/java/org/onap/aai/config/PasswordDecoder.java b/aai-resources/src/main/java/org/onap/aai/config/PasswordDecoder.java
new file mode 100644
index 0000000..8c199eb
--- /dev/null
+++ b/aai-resources/src/main/java/org/onap/aai/config/PasswordDecoder.java
@@ -0,0 +1,27 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.config;
+
+public interface PasswordDecoder {
+
+ String decode(String input);
+}
diff --git a/aai-resources/src/main/java/org/onap/aai/config/PropertyPasswordConfiguration.java b/aai-resources/src/main/java/org/onap/aai/config/PropertyPasswordConfiguration.java
new file mode 100644
index 0000000..623c7e9
--- /dev/null
+++ b/aai-resources/src/main/java/org/onap/aai/config/PropertyPasswordConfiguration.java
@@ -0,0 +1,83 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.config;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Optional;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.springframework.context.ApplicationContextInitializer;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.core.env.CompositePropertySource;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.EnumerablePropertySource;
+import org.springframework.core.env.MapPropertySource;
+import org.springframework.core.env.PropertySource;
+import org.springframework.stereotype.Component;
+
+public class PropertyPasswordConfiguration implements ApplicationContextInitializer<ConfigurableApplicationContext> {
+
+ private static final Pattern decodePasswordPattern = Pattern.compile("password\\((.*?)\\)");
+
+ private PasswordDecoder passwordDecoder = new JettyPasswordDecoder();
+
+ @Override
+ public void initialize(ConfigurableApplicationContext applicationContext) {
+ ConfigurableEnvironment environment = applicationContext.getEnvironment();
+ for (PropertySource<?> propertySource : environment.getPropertySources()) {
+ Map<String, Object> propertyOverrides = new LinkedHashMap<>();
+ decodePasswords(propertySource, propertyOverrides);
+ if (!propertyOverrides.isEmpty()) {
+ PropertySource<?> decodedProperties = new MapPropertySource("decoded "+ propertySource.getName(), propertyOverrides);
+ environment.getPropertySources().addBefore(propertySource.getName(), decodedProperties);
+ }
+ }
+ }
+
+ private void decodePasswords(PropertySource<?> source, Map<String, Object> propertyOverrides) {
+ if (source instanceof EnumerablePropertySource) {
+ EnumerablePropertySource<?> enumerablePropertySource = (EnumerablePropertySource<?>) source;
+ for (String key : enumerablePropertySource.getPropertyNames()) {
+ Object rawValue = source.getProperty(key);
+ if (rawValue instanceof String) {
+ String decodedValue = decodePasswordsInString((String) rawValue);
+ propertyOverrides.put(key, decodedValue);
+ }
+ }
+ }
+ }
+
+ private String decodePasswordsInString(String input) {
+ if (input == null) return null;
+ StringBuffer output = new StringBuffer();
+ Matcher matcher = decodePasswordPattern.matcher(input);
+ while (matcher.find()) {
+ String replacement = passwordDecoder.decode(matcher.group(1));
+ matcher.appendReplacement(output, replacement);
+ }
+ matcher.appendTail(output);
+ return output.toString();
+ }
+
+}
diff --git a/aai-resources/src/main/java/org/onap/aai/dbgen/DupeTool.java b/aai-resources/src/main/java/org/onap/aai/dbgen/DupeTool.java
new file mode 100644
index 0000000..a19bc8e
--- /dev/null
+++ b/aai-resources/src/main/java/org/onap/aai/dbgen/DupeTool.java
@@ -0,0 +1,1900 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.dbgen;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.*;
+import java.util.Map.Entry;
+
+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.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+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.dbmap.AAIGraphConfig;
+import org.onap.aai.dbmap.AAIGraph;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.introspection.Introspector;
+import org.onap.aai.introspection.Loader;
+import org.onap.aai.introspection.LoaderFactory;
+import org.onap.aai.introspection.ModelType;
+import org.onap.aai.logging.ErrorLogHelper;
+import org.onap.aai.logging.LogFormatTools;
+import org.onap.aai.logging.LoggingContext;
+import org.onap.aai.logging.LoggingContext.StatusCode;
+import org.onap.aai.util.AAIConfig;
+import org.onap.aai.util.AAIConstants;
+import org.slf4j.MDC;
+
+import com.att.eelf.configuration.Configuration;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+
+
+
+public class DupeTool {
+
+ private static final String FROMAPPID = "AAI-DB";
+ private static final String TRANSID = UUID.randomUUID().toString();
+
+ private static String graphType = "realdb";
+
+ public static boolean SHOULD_EXIT_VM = true;
+
+ public static int EXIT_VM_STATUS_CODE = -1;
+
+ public static void exit(int statusCode){
+ if(SHOULD_EXIT_VM){
+ System.exit(1);
+ }
+ EXIT_VM_STATUS_CODE = statusCode;
+ }
+
+
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
+ public static void main(String[] args) {
+ System.setProperty("aai.service.name", DupeTool.class.getSimpleName());
+ // Set the logging file properties to be used by EELFManager
+ Properties props = System.getProperties();
+ props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, "dupeTool-logback.xml");
+ props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_ETC_APP_PROPERTIES);
+ EELFLogger logger = EELFManager.getInstance().getLogger(DupeTool.class.getSimpleName());
+ MDC.put("logFilenameAppender", DupeTool.class.getSimpleName());
+
+ LoggingContext.init();
+ LoggingContext.partnerName(FROMAPPID);
+ LoggingContext.serviceName(AAIConstants.AAI_RESOURCES_MS);
+ LoggingContext.component("dupeTool");
+ LoggingContext.targetEntity(AAIConstants.AAI_RESOURCES_MS);
+ LoggingContext.targetServiceName("main");
+ LoggingContext.requestId(TRANSID);
+ LoggingContext.statusCode(StatusCode.COMPLETE);
+ LoggingContext.responseCode(LoggingContext.SUCCESS);
+
+ String defVersion = "v9";
+ try {
+ defVersion = AAIConfig.get(AAIConstants.AAI_DEFAULT_API_VERSION_PROP);
+ }
+ catch ( AAIException ae ){
+ String emsg = "Error trying to get default API Version property \n";
+ System.out.println(emsg);
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.DATA_ERROR);
+ logger.error(emsg);
+ exit(0);
+ }
+
+ Loader loader= null;
+ try {
+ loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, AAIProperties.LATEST);
+
+ }
+ catch (Exception ex){
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.UNKNOWN_ERROR);
+ logger.error("ERROR - Could not do the moxyMod.init() " + LogFormatTools.getStackTop(ex));
+ exit(1);
+ }
+ TitanGraph graph1 = null;
+ TitanGraph graph2 = null;
+ Graph gt1 = null;
+ Graph gt2 = null;
+
+ boolean specialTenantRule = false;
+
+ try {
+ AAIConfig.init();
+ int maxRecordsToFix = AAIConstants.AAI_DUPETOOL_DEFAULT_MAX_FIX;
+ int sleepMinutes = AAIConstants.AAI_DUPETOOL_DEFAULT_SLEEP_MINUTES;
+ int timeWindowMinutes = 0; // A value of 0 means that we will not have a time-window -- we will look
+ // at all nodes of the passed-in nodeType.
+ long windowStartTime = 0; // Translation of the window into a starting timestamp
+
+ try {
+ String maxFixStr = AAIConfig.get("aai.dupeTool.default.max.fix");
+ if( maxFixStr != null && !maxFixStr.equals("") ){
+ maxRecordsToFix = Integer.parseInt(maxFixStr);
+ }
+ String sleepStr = AAIConfig.get("aai.dupeTool.default.sleep.minutes");
+ if( sleepStr != null && !sleepStr.equals("") ){
+ sleepMinutes = Integer.parseInt(sleepStr);
+ }
+ }
+ catch ( Exception e ){
+ // Don't worry, we'll just use the defaults that we got from AAIConstants
+ logger.warn("WARNING - could not pick up aai.dupeTool values from aaiconfig.properties file. Will use defaults. ");
+ }
+
+ String nodeTypeVal = "";
+ String userIdVal = "";
+ String filterParams = "";
+ Boolean skipHostCheck = false;
+ Boolean autoFix = false;
+ String argStr4Msg = "";
+ Introspector obj = null;
+
+ if (args != null && args.length > 0) {
+ // They passed some arguments in that will affect processing
+ for (int i = 0; i < args.length; i++) {
+ String thisArg = args[i];
+ argStr4Msg = argStr4Msg + " " + thisArg;
+
+ if (thisArg.equals("-nodeType")) {
+ i++;
+ if (i >= args.length) {
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
+ logger.error(" No value passed with -nodeType option. ");
+ exit(0);
+ }
+ nodeTypeVal = args[i];
+ argStr4Msg = argStr4Msg + " " + nodeTypeVal;
+ }
+ else if (thisArg.equals("-sleepMinutes")) {
+ i++;
+ if (i >= args.length) {
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
+ logger.error("No value passed with -sleepMinutes option.");
+ exit(0);
+ }
+ String nextArg = args[i];
+ try {
+ sleepMinutes = Integer.parseInt(nextArg);
+ } catch (Exception e) {
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
+ logger.error("Bad value passed with -sleepMinutes option: ["
+ + nextArg + "]");
+ exit(0);
+ }
+ argStr4Msg = argStr4Msg + " " + sleepMinutes;
+ }
+ else if (thisArg.equals("-maxFix")) {
+ i++;
+ if (i >= args.length) {
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
+ logger.error("No value passed with -maxFix option.");
+ exit(0);
+ }
+ String nextArg = args[i];
+ try {
+ maxRecordsToFix = Integer.parseInt(nextArg);
+ } catch (Exception e) {
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
+ logger.error("Bad value passed with -maxFix option: ["
+ + nextArg + "]");
+ exit(0);
+ }
+ argStr4Msg = argStr4Msg + " " + maxRecordsToFix;
+ }
+ else if (thisArg.equals("-timeWindowMinutes")) {
+ i++;
+ if (i >= args.length) {
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
+ logger.error("No value passed with -timeWindowMinutes option.");
+ exit(0);
+ }
+ String nextArg = args[i];
+ try {
+ timeWindowMinutes = Integer.parseInt(nextArg);
+ } catch (Exception e) {
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
+ logger.error("Bad value passed with -timeWindowMinutes option: ["
+ + nextArg + "]");
+ exit(0);
+ }
+ argStr4Msg = argStr4Msg + " " + timeWindowMinutes;
+ }
+ else if (thisArg.equals("-skipHostCheck")) {
+ skipHostCheck = true;
+ }
+ else if (thisArg.equals("-specialTenantRule")) {
+ specialTenantRule = true;
+ }
+ else if (thisArg.equals("-autoFix")) {
+ autoFix = true;
+ }
+ else if (thisArg.equals("-userId")) {
+ i++;
+ if (i >= args.length) {
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
+ logger.error(" No value passed with -userId option. ");
+ exit(0);
+ }
+ userIdVal = args[i];
+ argStr4Msg = argStr4Msg + " " + userIdVal;
+ }
+ else if (thisArg.equals("-params4Collect")) {
+ i++;
+ if (i >= args.length) {
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
+ logger.error(" No value passed with -params4Collect option. ");
+ exit(0);
+ }
+ filterParams = args[i];
+ argStr4Msg = argStr4Msg + " " + filterParams;
+ }
+ else {
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
+ logger.error(" Unrecognized argument passed to DupeTool: ["
+ + thisArg + "]. ");
+ logger.error(" Valid values are: -action -userId -vertexId -edgeId -overRideProtection ");
+ exit(0);
+ }
+ }
+ }
+
+ userIdVal = userIdVal.trim();
+ if( (userIdVal.length() < 6) || userIdVal.toUpperCase().equals("AAIADMIN") ){
+ String emsg = "userId parameter is required. [" + userIdVal + "] passed to DupeTool(). userId must be not empty and not aaiadmin \n";
+ System.out.println(emsg);
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
+ logger.error(emsg);
+ exit(0);
+ }
+
+ nodeTypeVal = nodeTypeVal.trim();
+ if( nodeTypeVal.equals("") ){
+ String emsg = " nodeType is a required parameter for DupeTool().\n";
+ System.out.println(emsg);
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
+ logger.error(emsg);
+ exit(0);
+ } else {
+ obj = loader.introspectorFromName(nodeTypeVal);
+ }
+
+ if (skipHostCheck) {
+ logger.info(" We will skip the HostCheck as requested. ");
+ }
+
+ if( timeWindowMinutes > 0 ){
+ // Translate the window value (ie. 30 minutes) into a unix timestamp like
+ // we use in the db - so we can select data created after that time.
+ windowStartTime = figureWindowStartTime( timeWindowMinutes );
+ }
+
+ String msg = "";
+ msg = "DupeTool called with these params: [" + argStr4Msg + "]";
+ System.out.println(msg);
+ logger.info(msg);
+
+ // Determine what the key fields are for this nodeType (and we want them ordered)
+ ArrayList <String> keyPropNamesArr = new ArrayList<String>(obj.getKeys());
+
+ // Determine what kinds of nodes (if any) this nodeType is dependent on for uniqueness
+ ArrayList<String> depNodeTypeList = new ArrayList<String>();
+ Collection<String> depNTColl = obj.getDependentOn();
+ Iterator<String> ntItr = depNTColl.iterator();
+ while( ntItr.hasNext() ){
+ depNodeTypeList.add(ntItr.next());
+ }
+
+ // Based on the nodeType, window and filterData, figure out the vertices that we will be checking
+ System.out.println(" ---- NOTE --- about to open graph (takes a little while)--------\n");
+ graph1 = setupGraph(logger);
+ gt1 = getGraphTransaction( graph1, logger );
+ ArrayList<Vertex> verts2Check = new ArrayList<Vertex>();
+ try {
+ verts2Check = figureOutNodes2Check( TRANSID, FROMAPPID, gt1,
+ nodeTypeVal, windowStartTime, filterParams, logger );
+ }
+ catch ( AAIException ae ){
+ String emsg = "Error trying to get initial set of nodes to check. \n";
+ System.out.println(emsg);
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.DATA_ERROR);
+ logger.error(emsg);
+ exit(0);
+ }
+
+ if( verts2Check == null || verts2Check.size() == 0 ){
+ msg = " No vertices found to check. Used nodeType = [" + nodeTypeVal
+ + "], windowMinutes = " + timeWindowMinutes
+ + ", filterData = [" + filterParams + "].";
+ logger.info( msg );
+ System.out.println( msg );
+ exit(0);
+ }
+ else {
+ msg = " Found " + verts2Check.size() + " nodes of type " + nodeTypeVal
+ + " to check using passed filterParams and windowStartTime. ";
+ logger.info( msg );
+ System.out.println( msg );
+ }
+
+ ArrayList <String> firstPassDupeSets = new ArrayList <String>();
+ ArrayList <String> secondPassDupeSets = new ArrayList <String>();
+ Boolean isDependentOnParent = false;
+ if( !obj.getDependentOn().isEmpty() ){
+ isDependentOnParent = true;
+ }
+
+ if( isDependentOnParent ){
+ firstPassDupeSets = getDupeSets4DependentNodes( TRANSID, FROMAPPID, gt1,
+ defVersion, nodeTypeVal, verts2Check, keyPropNamesArr, loader,
+ specialTenantRule, logger );
+ }
+ else {
+ firstPassDupeSets = getDupeSets4NonDepNodes( TRANSID, FROMAPPID, gt1,
+ defVersion, nodeTypeVal, verts2Check, keyPropNamesArr,
+ specialTenantRule, loader, logger );
+ }
+
+ msg = " Found " + firstPassDupeSets.size() + " sets of duplicates for this request. ";
+ logger.info( msg );
+ System.out.println( msg );
+ if( firstPassDupeSets.size() > 0 ){
+ msg = " Here is what they look like: ";
+ logger.info( msg );
+ System.out.println( msg );
+ for( int x = 0; x < firstPassDupeSets.size(); x++ ){
+ msg = " Set " + x + ": [" + firstPassDupeSets.get(x) +"] ";
+ logger.info( msg );
+ System.out.println( msg );
+ showNodeDetailsForADupeSet(gt1, firstPassDupeSets.get(x), logger);
+ }
+ }
+
+ boolean didSomeDeletesFlag = false;
+ ArrayList <String> dupeSetsToFix = new ArrayList <String> ();
+ if( autoFix && firstPassDupeSets.size() == 0 ){
+ msg = "AutoFix option is on, but no dupes were found on the first pass. Nothing to fix.";
+ logger.info( msg );
+ System.out.println( msg );
+ }
+ else if( autoFix ){
+ // We will try to fix any dupes that we can - but only after sleeping for a
+ // time and re-checking the list of duplicates using a seperate transaction.
+ try {
+ msg = "\n\n----------- About to sleep for " + sleepMinutes + " minutes."
+ + " -----------\n\n";
+ logger.info( msg );
+ System.out.println( msg );
+ int sleepMsec = sleepMinutes * 60 * 1000;
+ Thread.sleep(sleepMsec);
+ } catch (InterruptedException ie) {
+ msg = "\n >>> Sleep Thread has been Interrupted <<< ";
+ logger.info( msg );
+ System.out.println( msg );
+ exit(0);
+ }
+
+ graph2 = setupGraph(logger);
+ gt2 = getGraphTransaction( graph2, logger );
+ if( isDependentOnParent ){
+ secondPassDupeSets = getDupeSets4DependentNodes( TRANSID, FROMAPPID, gt2,
+ defVersion, nodeTypeVal, verts2Check, keyPropNamesArr, loader,
+ specialTenantRule, logger );
+ }
+ else {
+ secondPassDupeSets = getDupeSets4NonDepNodes( TRANSID, FROMAPPID, gt2,
+ defVersion, nodeTypeVal, verts2Check, keyPropNamesArr,
+ specialTenantRule, loader, logger );
+ }
+
+ dupeSetsToFix = figureWhichDupesStillNeedFixing( firstPassDupeSets, secondPassDupeSets, logger );
+ msg = "\nAfter running a second pass, there were " + dupeSetsToFix.size()
+ + " sets of duplicates that we think can be deleted. ";
+ logger.info( msg );
+ System.out.println( msg );
+ if( dupeSetsToFix.size() > 0 ){
+ msg = " Here is what the sets look like: ";
+ logger.info( msg );
+ System.out.println( msg );
+ for( int x = 0; x < dupeSetsToFix.size(); x++ ){
+ msg = " Set " + x + ": [" + dupeSetsToFix.get(x) +"] ";
+ logger.info( msg );
+ System.out.println( msg );
+ showNodeDetailsForADupeSet(gt2, dupeSetsToFix.get(x), logger);
+ }
+ }
+
+ if( dupeSetsToFix.size() > 0 ){
+ if( dupeSetsToFix.size() > maxRecordsToFix ){
+ String infMsg = " >> WARNING >> Dupe list size ("
+ + dupeSetsToFix.size()
+ + ") is too big. The maxFix we are using is: "
+ + maxRecordsToFix
+ + ". No nodes will be deleted. (use the"
+ + " -maxFix option to override this limit.)";
+ System.out.println(infMsg);
+ logger.info(infMsg);
+ }
+ else {
+ // Call the routine that fixes known dupes
+ didSomeDeletesFlag = deleteNonKeepers( gt2, dupeSetsToFix, logger );
+ }
+ }
+ if( didSomeDeletesFlag ){
+ gt2.tx().commit();
+ }
+ }
+
+ } catch (AAIException e) {
+ logger.error("Caught AAIException while running the dupeTool: " + LogFormatTools.getStackTop(e));
+ ErrorLogHelper.logException(e);
+ } catch (Exception ex) {
+ logger.error("Caught exception while running the dupeTool: "+ LogFormatTools.getStackTop(ex));
+ ErrorLogHelper.logError("AAI_6128", ex.getMessage() + ", resolve and rerun the dupeTool. ");
+ } finally {
+ if (gt1 != null && gt1.tx().isOpen()) {
+ // We don't change any data with gt1 - so just roll it back so it knows we're done.
+ try {
+ gt1.tx().rollback();
+ }
+ catch (Exception ex) {
+ // Don't throw anything because Titan sometimes is just saying that the graph is already closed
+ logger.warn("WARNING from final gt1.rollback() " + LogFormatTools.getStackTop(ex));
+ }
+ }
+
+ if (gt2 != null && gt2.tx().isOpen()) {
+ // Any changes that worked correctly should have already done
+ // their commits.
+ try {
+ gt2.tx().rollback();
+ } catch (Exception ex) {
+ // Don't throw anything because Titan sometimes is just saying that the graph is already closed
+ logger.warn("WARNING from final gt2.rollback() " + LogFormatTools.getStackTop(ex));
+ }
+ }
+
+ try {
+ if( graph1 != null && graph1.isOpen() ){
+ closeGraph(graph1, logger);
+ }
+ } catch (Exception ex) {
+ // Don't throw anything because Titan sometimes is just saying that the graph is already closed{
+ logger.warn("WARNING from final graph1.shutdown() " + LogFormatTools.getStackTop(ex));
+ }
+
+ try {
+ if( graph2 != null && graph2.isOpen() ){
+ closeGraph(graph2, logger);
+ }
+ } catch (Exception ex) {
+ // Don't throw anything because Titan sometimes is just saying that the graph is already closed{
+ logger.warn("WARNING from final graph2.shutdown() " + LogFormatTools.getStackTop(ex));
+ }
+ }
+
+ exit(0);
+
+ }// end of main()
+
+
+ /**
+ * Collect Duplicate Sets for nodes that are NOT dependent on parent nodes.
+ *
+ * @param transId the trans id
+ * @param fromAppId the from app id
+ * @param g the g
+ * @param version the version
+ * @param nType the n type
+ * @param passedVertList the passed vert list
+ * @param dbMaps the db maps
+ * @return the array list
+ */
+ private static ArrayList<String> getDupeSets4NonDepNodes( String transId,
+ String fromAppId, Graph g, String version, String nType,
+ ArrayList<Vertex> passedVertList,
+ ArrayList <String> keyPropNamesArr,
+ Boolean specialTenantRule, Loader loader, EELFLogger logger ) {
+
+ ArrayList<String> returnList = new ArrayList<String>();
+
+ // We've been passed a set of nodes that we want to check.
+ // They are all NON-DEPENDENT nodes meaning that they should be
+ // unique in the DB based on their KEY DATA alone. So, if
+ // we group them by their key data - if any key has more than one
+ // vertex mapped to it, those vertices are dupes.
+ //
+ // When we find duplicates, we return then as a String (there can be
+ // more than one duplicate for one set of key data):
+ // Each element in the returned arrayList might look like this:
+ // "1234|5678|keepVid=UNDETERMINED" (if there were 2 dupes, and we
+ // couldn't figure out which one to keep)
+ // or, "100017|200027|30037|keepVid=30037" (if there were 3 dupes and we
+ // thought the third one was the one that should survive)
+
+ HashMap <String, ArrayList<String>> keyVals2VidHash = new HashMap <String, ArrayList<String>>();
+ HashMap <String,Vertex> vtxHash = new HashMap <String,Vertex>();
+ Iterator<Vertex> pItr = passedVertList.iterator();
+ while (pItr.hasNext()) {
+ try {
+ Vertex tvx = pItr.next();
+ String thisVid = tvx.id().toString();
+ vtxHash.put(thisVid, tvx);
+
+ // if there are more than one vertexId mapping to the same keyProps -- they are dupes
+ String hKey = getNodeKeyValString( tvx, keyPropNamesArr, logger );
+ if( keyVals2VidHash.containsKey(hKey) ){
+ // We've already seen this key
+ ArrayList <String> tmpVL = (ArrayList <String>)keyVals2VidHash.get(hKey);
+ tmpVL.add(thisVid);
+ keyVals2VidHash.put(hKey, tmpVL);
+ }
+ else {
+ // First time for this key
+ ArrayList <String> tmpVL = new ArrayList <String>();
+ tmpVL.add(thisVid);
+ keyVals2VidHash.put(hKey, tmpVL);
+ }
+ }
+ catch (Exception e) {
+ logger.warn(" >>> Threw an error in getDupeSets4NonDepNodes - just absorb this error and move on. " + LogFormatTools.getStackTop(e));
+ }
+ }
+
+ for( Map.Entry<String, ArrayList<String>> entry : keyVals2VidHash.entrySet() ){
+ ArrayList <String> vidList = entry.getValue();
+ try {
+ if( !vidList.isEmpty() && vidList.size() > 1 ){
+ // There are more than one vertex id's using the same key info
+ String dupesStr = "";
+ ArrayList <Vertex> vertList = new ArrayList <Vertex> ();
+ for (int i = 0; i < vidList.size(); i++) {
+ String tmpVid = vidList.get(i);
+ dupesStr = dupesStr + tmpVid + "|";
+ vertList.add(vtxHash.get(tmpVid));
+ }
+
+ if (dupesStr != "") {
+ Vertex prefV = getPreferredDupe(transId, fromAppId,
+ g, vertList, version, specialTenantRule, loader, logger);
+ if (prefV == null) {
+ // We could not determine which duplicate to keep
+ dupesStr = dupesStr + "KeepVid=UNDETERMINED";
+ returnList.add(dupesStr);
+ } else {
+ dupesStr = dupesStr + "KeepVid=" + prefV.id();
+ returnList.add(dupesStr);
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ logger.warn(" >>> Threw an error in getDupeSets4NonDepNodes - just absorb this error and move on. " + LogFormatTools.getStackTop(e));
+ }
+
+ }
+ return returnList;
+
+ }// End of getDupeSets4NonDepNodes()
+
+
+ /**
+ * Collect Duplicate Sets for nodes that are dependent on parent nodes.
+ *
+ * @param transId the trans id
+ * @param fromAppId the from app id
+ * @param g the g
+ * @param version the version
+ * @param nType the n type
+ * @param passedVertList the passed vert list
+ * @param dbMaps the db maps
+ * @param keyPropNamesArr Array (ordered) of keyProperty names
+ * @param specialTenantRule flag
+ * @param EELFLogger the logger
+ * @return the array list
+ */
+ private static ArrayList<String> getDupeSets4DependentNodes( String transId,
+ String fromAppId, Graph g, String version, String nType,
+ ArrayList<Vertex> passedVertList,
+ ArrayList <String> keyPropNamesArr, Loader loader,
+ Boolean specialTenantRule, EELFLogger logger ) {
+
+ // This is for nodeTypes that DEPEND ON A PARENT NODE FOR UNIQUNESS
+
+ ArrayList<String> returnList = new ArrayList<String>();
+ ArrayList<String> alreadyFoundDupeVidArr = new ArrayList<String>();
+
+ // We've been passed a set of nodes that we want to check. These are
+ // all nodes that ARE DEPENDENT on a PARENT Node for uniqueness.
+ // The first thing to do is to identify the key properties for the node-type
+ // and pull from the db just using those properties.
+ // Then, we'll check those nodes with their parent nodes to see if there
+ // are any duplicates.
+ //
+ // When we find duplicates, we return then as a String (there can be
+ // more than one duplicate for one set of key data):
+ // Each element in the returned arrayList might look like this:
+ // "1234|5678|keepVid=UNDETERMINED" (if there were 2 dupes, and we
+ // couldn't figure out which one to keep)
+ // or, "100017|200027|30037|keepVid=30037" (if there were 3 dupes and we
+ // thought the third one was the one that should survive)
+ HashMap <String, Object> checkVertHash = new HashMap <String,Object> ();
+ try {
+ Iterator<Vertex> pItr = passedVertList.iterator();
+ while (pItr.hasNext()) {
+ Vertex tvx = pItr.next();
+ String passedId = tvx.id().toString();
+ if( !alreadyFoundDupeVidArr.contains(passedId) ){
+ // We haven't seen this one before - so we should check it.
+ HashMap <String,Object> keyPropValsHash = getNodeKeyVals( tvx, keyPropNamesArr, logger );
+ ArrayList <Vertex> tmpVertList = getNodeJustUsingKeyParams( transId, fromAppId, g,
+ nType, keyPropValsHash, version, logger );
+
+ if( tmpVertList.size() <= 1 ){
+ // Even without a parent node, this thing is unique so don't worry about it.
+ }
+ else {
+ for( int i = 0; i < tmpVertList.size(); i++ ){
+ Vertex tmpVtx = (tmpVertList.get(i));
+ String tmpVid = tmpVtx.id().toString();
+ alreadyFoundDupeVidArr.add(tmpVid);
+
+ String hKey = getNodeKeyValString( tmpVtx, keyPropNamesArr, logger );
+ if( checkVertHash.containsKey(hKey) ){
+ // add it to an existing list
+ ArrayList <Vertex> tmpVL = (ArrayList <Vertex>)checkVertHash.get(hKey);
+ tmpVL.add(tmpVtx);
+ checkVertHash.put(hKey, tmpVL);
+ }
+ else {
+ // First time for this key
+ ArrayList <Vertex> tmpVL = new ArrayList <Vertex>();
+ tmpVL.add(tmpVtx);
+ checkVertHash.put(hKey, tmpVL);
+ }
+ }
+ }
+ }
+ }
+
+ // More than one node have the same key fields since they may
+ // depend on a parent node for uniqueness. Since we're finding
+ // more than one, we want to check to see if any of the
+ // vertices that have this set of keys are also pointing at the
+ // same 'parent' node.
+ // Note: for a given set of key data, it is possible that there
+ // could be more than one set of duplicates.
+ for (Entry<String, Object> lentry : checkVertHash.entrySet()) {
+ ArrayList <Vertex> thisIdSetList = (ArrayList <Vertex>)lentry.getValue();
+ if (thisIdSetList == null || thisIdSetList.size() < 2) {
+ // Nothing to check for this set.
+ continue;
+ }
+
+ HashMap<String, ArrayList<Vertex>> vertsGroupedByParentHash = groupVertsByDepNodes(
+ transId, fromAppId, g, version, nType,
+ thisIdSetList, loader);
+ for (Map.Entry<String, ArrayList<Vertex>> entry : vertsGroupedByParentHash
+ .entrySet()) {
+ ArrayList<Vertex> thisParentsVertList = entry
+ .getValue();
+ if (thisParentsVertList.size() > 1) {
+ // More than one vertex found with the same key info
+ // hanging off the same parent/dependent node
+ String dupesStr = "";
+ for (int i = 0; i < thisParentsVertList.size(); i++) {
+ dupesStr = dupesStr
+ + ( (thisParentsVertList
+ .get(i))).id() + "|";
+ }
+ if (dupesStr != "") {
+ Vertex prefV = getPreferredDupe(transId,
+ fromAppId, g, thisParentsVertList,
+ version, specialTenantRule, loader, logger);
+
+ if (prefV == null) {
+ // We could not determine which duplicate to keep
+ dupesStr = dupesStr + "KeepVid=UNDETERMINED";
+ returnList.add(dupesStr);
+ }
+ else {
+ dupesStr = dupesStr + "KeepVid="
+ + prefV.id().toString();
+ returnList.add(dupesStr);
+ }
+ }
+ }
+ }
+ }
+
+ } catch (Exception e) {
+ logger.warn(" >>> Threw an error in checkAndProcessDupes - just absorb this error and move on. " + LogFormatTools.getStackTop(e));
+ }
+
+ return returnList;
+
+ }// End of getDupeSets4DependentNodes()
+
+
+ private static Graph getGraphTransaction(TitanGraph graph, EELFLogger logger){
+
+ Graph gt = null;
+ try {
+ if( graph == null ){
+ String emsg = "could not get graph object in DupeTool. \n";
+ System.out.println(emsg);
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.AVAILABILITY_TIMEOUT_ERROR);
+ logger.error(emsg);
+ exit(0);
+ }
+ gt = graph.newTransaction();
+ if (gt == null) {
+ String emsg = "null graphTransaction object in DupeTool. \n";
+ throw new AAIException("AAI_6101", emsg);
+ }
+
+ }
+ catch (AAIException e1) {
+ String msg = e1.getErrorObject().toString();
+ System.out.println(msg);
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.DATA_ERROR);
+ logger.error(msg);
+ exit(0);
+ }
+ catch (Exception e2) {
+ String msg = e2.toString();
+ System.out.println(msg);
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.UNKNOWN_ERROR);
+ logger.error(msg);
+ exit(0);
+ }
+
+ return gt;
+
+ }// End of getGraphTransaction()
+
+
+
+ public static void showNodeInfo(EELFLogger logger, Vertex tVert, Boolean displayAllVidsFlag ){
+
+ try {
+ Iterator<VertexProperty<Object>> pI = tVert.properties();
+ String infStr = ">>> Found Vertex with VertexId = " + tVert.id() + ", properties: ";
+ System.out.println( infStr );
+ logger.info(infStr);
+ while( pI.hasNext() ){
+ VertexProperty<Object> tp = pI.next();
+ infStr = " [" + tp.key() + "|" + tp.value() + "] ";
+ System.out.println( infStr );
+ logger.info(infStr);
+ }
+
+ ArrayList <String> retArr = collectEdgeInfoForNode( logger, tVert, displayAllVidsFlag );
+ for( String infoStr : retArr ){
+ System.out.println( infoStr );
+ logger.info(infoStr);
+ }
+ }
+ catch (Exception e){
+ String warnMsg = " -- Error -- trying to display edge info. [" + e.getMessage() + "]";
+ System.out.println( warnMsg );
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.UNKNOWN_ERROR);
+ logger.warn(warnMsg);
+ LoggingContext.statusCode(StatusCode.COMPLETE);
+ LoggingContext.responseCode(LoggingContext.SUCCESS);
+ }
+
+ }// End of showNodeInfo()
+
+
+ public static ArrayList <String> collectEdgeInfoForNode( EELFLogger logger, Vertex tVert, boolean displayAllVidsFlag ){
+ ArrayList <String> retArr = new ArrayList <String> ();
+ Direction dir = Direction.OUT;
+ for ( int i = 0; i <= 1; i++ ){
+ if( i == 1 ){
+ // Second time through we'll look at the IN edges.
+ dir = Direction.IN;
+ }
+ Iterator <Edge> eI = tVert.edges(dir);
+ if( ! eI.hasNext() ){
+ retArr.add("No " + dir + " edges were found for this vertex. ");
+ }
+ while( eI.hasNext() ){
+ Edge ed = eI.next();
+ String lab = ed.label();
+ Vertex vtx = null;
+ if( dir == Direction.OUT ){
+ // get the vtx on the "other" side
+ vtx = ed.inVertex();
+ }
+ else {
+ // get the vtx on the "other" side
+ vtx = ed.outVertex();
+ }
+ if( vtx == null ){
+ retArr.add(" >>> COULD NOT FIND VERTEX on the other side of this edge edgeId = " + ed.id() + " <<< ");
+ }
+ else {
+ String nType = vtx.<String>property("aai-node-type").orElse(null);
+ if( displayAllVidsFlag ){
+ // This should rarely be needed
+ String vid = vtx.id().toString();
+ retArr.add("Found an " + dir + " edge (" + lab + ") between this vertex and a [" + nType + "] node with VtxId = " + vid );
+ }
+ else {
+ // This is the normal case
+ retArr.add("Found an " + dir + " edge (" + lab + ") between this vertex and a [" + nType + "] node. ");
+ }
+ }
+ }
+ }
+ return retArr;
+
+ }// end of collectEdgeInfoForNode()
+
+
+ private static long figureWindowStartTime( int timeWindowMinutes ){
+ // Given a window size, calculate what the start-timestamp would be.
+
+ if( timeWindowMinutes <= 0 ){
+ // This just means that there is no window...
+ return 0;
+ }
+ long unixTimeNow = System.currentTimeMillis();
+ long windowInMillis = timeWindowMinutes * 60 * 1000;
+
+ long startTimeStamp = unixTimeNow - windowInMillis;
+
+ return startTimeStamp;
+ } // End of figureWindowStartTime()
+
+
+
+ /**
+ * Gets the node(s) just using key params.
+ *
+ * @param transId the trans id
+ * @param fromAppId the from app id
+ * @param graph the graph
+ * @param nodeType the node type
+ * @param keyPropsHash the key props hash
+ * @param apiVersion the api version
+ * @return the node just using key params
+ * @throws AAIException the AAI exception
+ */
+ public static ArrayList <Vertex> getNodeJustUsingKeyParams( String transId, String fromAppId, Graph graph, String nodeType,
+ HashMap<String,Object> keyPropsHash, String apiVersion, EELFLogger logger ) throws AAIException{
+
+ ArrayList <Vertex> retVertList = new ArrayList <Vertex> ();
+
+ // We assume that all NodeTypes have at least one key-property defined.
+ // Note - instead of key-properties (the primary key properties), a user could pass
+ // alternate-key values if they are defined for the nodeType.
+ ArrayList<String> kName = new ArrayList<String>();
+ ArrayList<Object> kVal = new ArrayList<Object>();
+ if( keyPropsHash == null || keyPropsHash.isEmpty() ) {
+ throw new AAIException("AAI_6120", " NO key properties passed for this getNodeJustUsingKeyParams() request. NodeType = [" + nodeType + "]. ");
+ }
+
+ int i = -1;
+ for( Map.Entry<String, Object> entry : keyPropsHash.entrySet() ){
+ i++;
+ kName.add(i, entry.getKey());
+ kVal.add(i, entry.getValue());
+ }
+ int topPropIndex = i;
+ Vertex tiV = null;
+ String propsAndValuesForMsg = "";
+ Iterator<Vertex> verts = null;
+ GraphTraversalSource g = graph.traversal();
+ try {
+ if( topPropIndex == 0 ){
+ propsAndValuesForMsg = " (" + kName.get(0) + " = " + kVal.get(0) + ") ";
+ verts= g.V().has(kName.get(0),kVal.get(0)).has("aai-node-type",nodeType);
+ }
+ else if( topPropIndex == 1 ){
+ propsAndValuesForMsg = " (" + kName.get(0) + " = " + kVal.get(0) + ", "
+ + kName.get(1) + " = " + kVal.get(1) + ") ";
+ verts = g.V().has(kName.get(0),kVal.get(0)).has(kName.get(1),kVal.get(1)).has("aai-node-type",nodeType);
+ }
+ else if( topPropIndex == 2 ){
+ propsAndValuesForMsg = " (" + kName.get(0) + " = " + kVal.get(0) + ", "
+ + kName.get(1) + " = " + kVal.get(1) + ", "
+ + kName.get(2) + " = " + kVal.get(2) + ") ";
+ verts= g.V().has(kName.get(0),kVal.get(0)).has(kName.get(1),kVal.get(1)).has(kName.get(2),kVal.get(2)).has("aai-node-type",nodeType);
+ }
+ else if( topPropIndex == 3 ){
+ propsAndValuesForMsg = " (" + kName.get(0) + " = " + kVal.get(0) + ", "
+ + kName.get(1) + " = " + kVal.get(1) + ", "
+ + kName.get(2) + " = " + kVal.get(2) + ", "
+ + kName.get(3) + " = " + kVal.get(3) + ") ";
+ verts= g.V().has(kName.get(0),kVal.get(0)).has(kName.get(1),kVal.get(1)).has(kName.get(2),kVal.get(2)).has(kName.get(3),kVal.get(3)).has("aai-node-type",nodeType);
+ }
+ else {
+ throw new AAIException("AAI_6114", " We only support 4 keys per nodeType for now \n");
+ }
+ }
+ catch( Exception ex ){
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.DATA_ERROR);
+ logger.error( " ERROR trying to get node for: [" + propsAndValuesForMsg + "] " + LogFormatTools.getStackTop(ex));
+ LoggingContext.statusCode(StatusCode.COMPLETE);
+ LoggingContext.responseCode(LoggingContext.SUCCESS);
+ }
+
+ if( verts != null ){
+ while( verts.hasNext() ){
+ tiV = verts.next();
+ retVertList.add(tiV);
+ }
+ }
+
+ if( retVertList.size() == 0 ){
+ logger.debug("DEBUG No node found for nodeType = [" + nodeType +
+ "], propsAndVal = " + propsAndValuesForMsg );
+ }
+
+ return retVertList;
+
+ }// End of getNodeJustUsingKeyParams()
+
+
+
+ /**
+ * Gets the node(s) just using key params.
+ *
+ * @param transId the trans id
+ * @param fromAppId the from app id
+ * @param graph the graph
+ * @param nodeType the node type
+ * @param windowStartTime the window start time
+ * @param propsHash the props hash
+ * @param apiVersion the api version
+ * @return the nodes
+ * @throws AAIException the AAI exception
+ */
+ public static ArrayList <Vertex> figureOutNodes2Check( String transId, String fromAppId,
+ Graph graph, String nodeType, long windowStartTime,
+ String propsString, EELFLogger logger ) throws AAIException{
+
+ ArrayList <Vertex> retVertList = new ArrayList <Vertex> ();
+ String msg = "";
+ GraphTraversal<Vertex,Vertex> tgQ = graph.traversal().V().has("aai-node-type",nodeType);
+ String qStringForMsg = "graph.traversal().V().has(\"aai-node-type\"," + nodeType + ")";
+
+ if( propsString != null && !propsString.trim().equals("") ){
+ propsString = propsString.trim();
+ int firstPipeLoc = propsString.indexOf("|");
+ if( firstPipeLoc <= 0 ){
+ msg = "Bad props4Collect passed: [" + propsString + "]. \n Expecting a format like, 'propName1|propVal1,propName2|propVal2'";
+ System.out.println(msg);
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.DATA_ERROR);
+ logger.error(msg);
+ exit(0);
+ }
+
+ // Note - if they're only passing on parameter, there won't be any commas
+ String [] paramArr = propsString.split(",");
+ for( int i = 0; i < paramArr.length; i++ ){
+ int pipeLoc = paramArr[i].indexOf("|");
+ if( pipeLoc <= 0 ){
+ msg = "Bad propsString passed: [" + propsString + "]. \n Expecting a format like, 'propName1|propVal1,propName2|propVal2'";
+ System.out.println(msg);
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.DATA_ERROR);
+ logger.error(msg);
+ exit(0);
+ }
+ else {
+ String propName = paramArr[i].substring(0,pipeLoc);
+ String propVal = paramArr[i].substring(pipeLoc + 1);
+ tgQ = tgQ.has(propName,propVal);
+ qStringForMsg = qStringForMsg + ".has(" + propName + "," + propVal + ")";
+ }
+ }
+ }
+
+ if(tgQ == null){
+ msg = "Bad TitanGraphQuery object. ";
+ System.out.println(msg);
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.AVAILABILITY_TIMEOUT_ERROR);
+ logger.error(msg);
+ exit(0);
+ }
+ else {
+ Iterator<Vertex> vertItor = tgQ;
+ while( vertItor.hasNext() ){
+ Vertex tiV = vertItor.next();
+ if( windowStartTime <= 0 ){
+ // We're not applying a time-window
+ retVertList.add(tiV);
+ }
+ else {
+ Object objTimeStamp = tiV.property("aai-created-ts").orElse(null);
+ if( objTimeStamp == null ){
+ // No timestamp - so just take it
+ retVertList.add(tiV);
+ }
+ else {
+ long thisNodeCreateTime = (long)objTimeStamp;
+ if( thisNodeCreateTime > windowStartTime ){
+ // It is in our window, so we can take it
+ retVertList.add(tiV);
+ }
+ }
+ }
+ }
+ }
+
+ if( retVertList.size() == 0 ){
+ logger.debug("DEBUG No node found for: [" + qStringForMsg + ", with aai-created-ts > " + windowStartTime );
+ }
+
+ return retVertList;
+
+ }// End of figureOutNodes2Check()
+
+
+ /**
+ * Gets the preferred dupe.
+ *
+ * @param transId the trans id
+ * @param fromAppId the from app id
+ * @param g the g
+ * @param dupeVertexList the dupe vertex list
+ * @param ver the ver
+ * @param EELFLogger the logger
+ * @return Vertex
+ * @throws AAIException the AAI exception
+ */
+ public static Vertex getPreferredDupe( String transId,
+ String fromAppId, Graph g,
+ ArrayList<Vertex> dupeVertexList, String ver,
+ Boolean specialTenantRule, Loader loader, EELFLogger logger )
+ throws AAIException {
+
+ // This method assumes that it is being passed a List of vertex objects
+ // which violate our uniqueness constraints.
+
+ Vertex nullVtx = null;
+
+ if (dupeVertexList == null) {
+ return nullVtx;
+ }
+ int listSize = dupeVertexList.size();
+ if (listSize == 0) {
+ return nullVtx;
+ }
+ if (listSize == 1) {
+ return ( dupeVertexList.get(0));
+ }
+
+ Vertex vtxPreferred = null;
+ Vertex currentFaveVtx = dupeVertexList.get(0);
+ for (int i = 1; i < listSize; i++) {
+ Vertex vtxB = dupeVertexList.get(i);
+ vtxPreferred = pickOneOfTwoDupes(transId, fromAppId, g,
+ currentFaveVtx, vtxB, ver, specialTenantRule, loader, logger);
+ if (vtxPreferred == null) {
+ // We couldn't choose one
+ return nullVtx;
+ } else {
+ currentFaveVtx = vtxPreferred;
+ }
+ }
+
+ return (currentFaveVtx);
+
+ } // end of getPreferredDupe()
+
+
+ /**
+ * Pick one of two dupes.
+ *
+ * @param transId the trans id
+ * @param fromAppId the from app id
+ * @param g the g
+ * @param vtxA the vtx A
+ * @param vtxB the vtx B
+ * @param ver the ver
+ * @param boolean specialTenantRuleFlag flag
+ * @param EELFLogger the logger
+ * @return Vertex
+ * @throws AAIException the AAI exception
+ */
+ public static Vertex pickOneOfTwoDupes(String transId,
+ String fromAppId, Graph g, Vertex vtxA,
+ Vertex vtxB, String ver, Boolean specialTenantRule, Loader loader, EELFLogger logger) throws AAIException {
+
+ Vertex nullVtx = null;
+ Vertex preferredVtx = null;
+
+ Long vidA = new Long(vtxA.id().toString());
+ Long vidB = new Long(vtxB.id().toString());
+
+ String vtxANodeType = "";
+ String vtxBNodeType = "";
+ Object obj = vtxA.<Object>property("aai-node-type").orElse(null);
+ if (obj != null) {
+ vtxANodeType = obj.toString();
+ }
+ obj = vtxB.<Object>property("aai-node-type").orElse(null);
+ if (obj != null) {
+ vtxBNodeType = obj.toString();
+ }
+
+ if (vtxANodeType.equals("") || (!vtxANodeType.equals(vtxBNodeType))) {
+ // Either they're not really dupes or there's some bad data - so
+ // don't pick one
+ return nullVtx;
+ }
+
+ // Check that node A and B both have the same key values (or else they
+ // are not dupes)
+ // (We'll check dep-node later)
+ Collection<String> keyProps = loader.introspectorFromName(vtxANodeType).getKeys();
+ Iterator<String> keyPropI = keyProps.iterator();
+ while (keyPropI.hasNext()) {
+ String propName = keyPropI.next();
+ String vtxAKeyPropVal = "";
+ obj = vtxA.<Object>property(propName).orElse(null);
+ if (obj != null) {
+ vtxAKeyPropVal = obj.toString();
+ }
+ String vtxBKeyPropVal = "";
+ obj = vtxB.<Object>property(propName).orElse(null);
+ if (obj != null) {
+ vtxBKeyPropVal = obj.toString();
+ }
+
+ if (vtxAKeyPropVal.equals("")
+ || (!vtxAKeyPropVal.equals(vtxBKeyPropVal))) {
+ // Either they're not really dupes or they are missing some key
+ // data - so don't pick one
+ return nullVtx;
+ }
+ }
+
+ // Collect the vid's and aai-node-types of the vertices that each vertex
+ // (A and B) is connected to.
+ ArrayList<String> vtxIdsConn2A = new ArrayList<String>();
+ ArrayList<String> vtxIdsConn2B = new ArrayList<String>();
+ HashMap<String, String> nodeTypesConn2A = new HashMap<String, String>();
+ HashMap<String, String> nodeTypesConn2B = new HashMap<String, String>();
+
+ ArrayList <String> retArr = new ArrayList <String> ();
+ Iterator <Edge> eAI = vtxA.edges(Direction.BOTH);
+ while( eAI.hasNext() ){
+ Edge ed = eAI.next();
+ Vertex tmpVtx;
+ if (vtxA.equals(ed.inVertex())) {
+ tmpVtx = ed.outVertex();
+ } else {
+ tmpVtx = ed.inVertex();
+ }
+ if( tmpVtx == null ){
+ retArr.add(" >>> COULD NOT FIND VERTEX on the other side of this edge edgeId = " + ed.id() + " <<< ");
+ }
+ else {
+ String conVid = tmpVtx.id().toString();
+ String nt = "";
+ obj = tmpVtx.<Object>property("aai-node-type").orElse(null);
+ if (obj != null) {
+ nt = obj.toString();
+ }
+ nodeTypesConn2A.put(nt, conVid);
+ vtxIdsConn2A.add(conVid);
+ }
+ }
+
+ Iterator <Edge> eBI = vtxB.edges(Direction.BOTH);
+ while( eBI.hasNext() ){
+ Edge ed = eBI.next();
+ Vertex tmpVtx;
+
+ if (vtxB.equals(ed.inVertex())) {
+ tmpVtx = ed.outVertex();
+ } else {
+ tmpVtx = ed.inVertex();
+ }
+ if( tmpVtx == null ){
+ retArr.add(" >>> COULD NOT FIND VERTEX on the other side of this edge edgeId = " + ed.id() + " <<< ");
+ }
+ else {
+ String conVid = tmpVtx.id().toString();
+ String nt = "";
+ obj = tmpVtx.<Object>property("aai-node-type").orElse(null);
+ if (obj != null) {
+ nt = obj.toString();
+ }
+ nodeTypesConn2B.put(nt, conVid);
+ vtxIdsConn2B.add(conVid);
+ }
+ }
+
+ // 1 - If this kind of node needs a dependent node for uniqueness, then
+ // verify that they both nodes point to the same dependent
+ // node (otherwise they're not really duplicates)
+ // Note - there are sometimes more than one dependent node type since
+ // one nodeType can be used in different ways. But for a
+ // particular node, it will only have one dependent node that
+ // it's connected to.
+ Collection<String> depNodeTypes = loader.introspectorFromName(vtxANodeType).getDependentOn();
+ if (depNodeTypes.isEmpty()) {
+ // This kind of node is not dependent on any other. That is ok.
+ } else {
+ String depNodeVtxId4A = "";
+ String depNodeVtxId4B = "";
+ Iterator<String> iter = depNodeTypes.iterator();
+ while (iter.hasNext()) {
+ String depNodeType = iter.next();
+ if (nodeTypesConn2A.containsKey(depNodeType)) {
+ // This is the dependent node type that vertex A is using
+ depNodeVtxId4A = nodeTypesConn2A.get(depNodeType);
+ }
+ if (nodeTypesConn2B.containsKey(depNodeType)) {
+ // This is the dependent node type that vertex B is using
+ depNodeVtxId4B = nodeTypesConn2B.get(depNodeType);
+ }
+ }
+ if (depNodeVtxId4A.equals("")
+ || (!depNodeVtxId4A.equals(depNodeVtxId4B))) {
+ // Either they're not really dupes or there's some bad data - so
+ // don't pick either one
+ return nullVtx;
+ }
+ }
+
+ if (vtxIdsConn2A.size() == vtxIdsConn2B.size()) {
+ // 2 - If they both have edges to all the same vertices, then return
+ // the one with the lower vertexId.
+
+ // OR (2b)-- if this is the SPECIAL case -- of
+ // "tenant|vserver vs. tenant|service-subscription"
+ // then we pick/prefer the one that's connected to
+ // the service-subscription. AAI-8172
+ boolean allTheSame = true;
+ Iterator<String> iter = vtxIdsConn2A.iterator();
+ while (iter.hasNext()) {
+ String vtxIdConn2A = iter.next();
+ if (!vtxIdsConn2B.contains(vtxIdConn2A)) {
+ allTheSame = false;
+ break;
+ }
+ }
+
+ if (allTheSame) {
+ if (vidA < vidB) {
+ preferredVtx = vtxA;
+ } else {
+ preferredVtx = vtxB;
+ }
+ }
+ else if ( specialTenantRule ){
+ // They asked us to apply a special rule if it applies
+ if(vtxIdsConn2A.size() == 2 && vtxANodeType.equals("tenant") ){
+ // We're dealing with two tenant nodes which each just have
+ // two connections. One must be the parent (cloud-region)
+ // which we check in step 1 above. If one connects to
+ // a vserver and the other connects to a service-subscription,
+ // our special rule is to keep the one connected
+ // to the
+ if( nodeTypesConn2A.containsKey("vserver") && nodeTypesConn2B.containsKey("service-subscription") ){
+ String infMsg = " WARNING >>> we are using the special tenant rule to choose to " +
+ " delete tenant vtxId = " + vidA + ", and keep tenant vtxId = " + vidB ;
+ System.out.println(infMsg);
+ logger.info( infMsg );
+ preferredVtx = vtxB;
+ }
+ else if( nodeTypesConn2B.containsKey("vserver") && nodeTypesConn2A.containsKey("service-subscription") ){
+ String infMsg = " WARNING >>> we are using the special tenant rule to choose to " +
+ " delete tenant vtxId = " + vidB + ", and keep tenant vtxId = " + vidA ;
+ System.out.println(infMsg);
+ logger.info( infMsg );
+ preferredVtx = vtxA;
+ }
+ }
+ }
+ } else if (vtxIdsConn2A.size() > vtxIdsConn2B.size()) {
+ // 3 - VertexA is connected to more things than vtxB.
+ // We'll pick VtxA if its edges are a superset of vtxB's edges.
+ boolean missingOne = false;
+ Iterator<String> iter = vtxIdsConn2B.iterator();
+ while (iter.hasNext()) {
+ String vtxIdConn2B = iter.next();
+ if (!vtxIdsConn2A.contains(vtxIdConn2B)) {
+ missingOne = true;
+ break;
+ }
+ }
+ if (!missingOne) {
+ preferredVtx = vtxA;
+ }
+ } else if (vtxIdsConn2B.size() > vtxIdsConn2A.size()) {
+ // 4 - VertexB is connected to more things than vtxA.
+ // We'll pick VtxB if its edges are a superset of vtxA's edges.
+ boolean missingOne = false;
+ Iterator<String> iter = vtxIdsConn2A.iterator();
+ while (iter.hasNext()) {
+ String vtxIdConn2A = iter.next();
+ if (!vtxIdsConn2B.contains(vtxIdConn2A)) {
+ missingOne = true;
+ break;
+ }
+ }
+ if (!missingOne) {
+ preferredVtx = vtxB;
+ }
+ } else {
+ preferredVtx = nullVtx;
+ }
+
+ return (preferredVtx);
+
+ } // end of pickOneOfTwoDupes()
+
+
+ /**
+ * Group verts by dep nodes.
+ *
+ * @param transId the trans id
+ * @param fromAppId the from app id
+ * @param g the g
+ * @param version the version
+ * @param nType the n type
+ * @param passedVertList the passed vert list
+ * @param dbMaps the db maps
+ * @return the hash map
+ * @throws AAIException the AAI exception
+ */
+ private static HashMap<String, ArrayList<Vertex>> groupVertsByDepNodes(
+ String transId, String fromAppId, Graph g, String version,
+ String nType, ArrayList<Vertex> passedVertList, Loader loader)
+ throws AAIException {
+
+ // Given a list of Titan Vertices, group them together by dependent
+ // nodes. Ie. if given a list of ip address nodes (assumed to all
+ // have the same key info) they might sit under several different
+ // parent vertices.
+ // Under Normal conditions, there would only be one per parent -- but
+ // we're trying to find duplicates - so we allow for the case
+ // where more than one is under the same parent node.
+
+ HashMap<String, ArrayList<Vertex>> retHash = new HashMap<String, ArrayList<Vertex>>();
+
+ // Find out what types of nodes the passed in nodes can depend on
+ ArrayList<String> depNodeTypeL = new ArrayList<String>();
+ Collection<String> depNTColl = loader.introspectorFromName(nType).getDependentOn();
+ Iterator<String> ntItr = depNTColl.iterator();
+ while (ntItr.hasNext()) {
+ depNodeTypeL.add(ntItr.next());
+ }
+ // For each vertex they passed us, we want find the vertex it
+ // is dependent on so we can keep track of who-all is connected
+ // to that parent.
+ if (passedVertList != null) {
+ Iterator<Vertex> iter = passedVertList.iterator();
+ while (iter.hasNext()) {
+ Vertex thisVert = iter.next();
+ Iterator <String> depNtItr = depNTColl.iterator();
+ while (depNtItr.hasNext()) {
+ GraphTraversal<Vertex, Vertex> modPipe = null;
+ // NOTE -- if we change the direction of parent/child edges, we will need
+ // the "in" below to become "out"
+ modPipe = g.traversal().V(thisVert).in().has("aai-node-type", depNtItr.next() );
+ if( modPipe == null || !modPipe.hasNext() ){
+ //System.out.println("DEBUG - didn't find any [" + targetStep + "] connected to this guy (which is ok)");
+ }
+ else {
+ while( modPipe.hasNext() ){
+ Vertex depVert = modPipe.next();
+ String parentVid = depVert.id().toString();
+ if (retHash.containsKey(parentVid)) {
+ // add this vert to the list for this parent key
+ retHash.get(parentVid).add(thisVert);
+ } else {
+ // This is the first one we found on this parent
+ ArrayList<Vertex> vList = new ArrayList<Vertex>();
+ vList.add(thisVert);
+ retHash.put(parentVid, vList);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return retHash;
+
+ }// end of groupVertsByDepNodes()
+
+
+ /**
+ * Delete non keepers if appropriate.
+ *
+ * @param g the g
+ * @param dupeInfoList the dupe info string
+ * @param logger the EELFLogger
+ * @return the boolean
+ */
+ private static Boolean deleteNonKeepers(Graph g,
+ ArrayList<String> dupeInfoList, EELFLogger logger ) {
+
+ // This assumes that each dupeInfoString is in the format of
+ // pipe-delimited vid's followed by either "keepVid=xyz" or "keepVid=UNDETERMINED"
+ // ie. "3456|9880|keepVid=3456"
+
+ boolean didADelFlag = false;
+ for( int n = 0; n < dupeInfoList.size(); n++ ){
+ String dupeInfoString = dupeInfoList.get(n);
+ boolean tmpFlag = deleteNonKeeperForOneSet( g, dupeInfoString, logger );
+ didADelFlag = tmpFlag | didADelFlag;
+ }
+
+ return didADelFlag;
+
+ }// end of deleteNonKeepers()
+
+
+ /**
+ * Delete non keepers if appropriate.
+ *
+ * @param g the g
+ * @param dupeSetStr the dupe string
+ * @param logger the EELFLogger
+ * @return the boolean
+ */
+ private static Boolean deleteNonKeeperForOneSet(Graph g,
+ String dupeInfoString, EELFLogger logger ) {
+
+ Boolean deletedSomething = false;
+ // This assumes that each dupeInfoString is in the format of
+ // pipe-delimited vid's followed by either "keepVid=xyz" or "keepVid=UNDETERMINED"
+ // ie. "3456|9880|keepVid=3456"
+
+
+ String[] dupeArr = dupeInfoString.split("\\|");
+ ArrayList<String> idArr = new ArrayList<String>();
+ int lastIndex = dupeArr.length - 1;
+ for (int i = 0; i <= lastIndex; i++) {
+ if (i < lastIndex) {
+ // This is not the last entry, it is one of the dupes,
+ String vidString = dupeArr[i];
+ idArr.add(vidString);
+ } else {
+ // This is the last entry which should tell us if we have a
+ // preferred keeper
+ String prefString = dupeArr[i];
+ if (prefString.equals("KeepVid=UNDETERMINED")) {
+ // They sent us a bad string -- nothing should be deleted if
+ // no dupe could be tagged as preferred.
+ return false;
+ } else {
+ // If we know which to keep, then the prefString should look
+ // like, "KeepVid=12345"
+ String[] prefArr = prefString.split("=");
+ if (prefArr.length != 2 || (!prefArr[0].equals("KeepVid"))) {
+ String emsg = "Bad format. Expecting KeepVid=999999";
+ System.out.println(emsg);
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.DATA_ERROR);
+ logger.error(emsg);
+ LoggingContext.statusCode(StatusCode.COMPLETE);
+ LoggingContext.responseCode(LoggingContext.SUCCESS);
+ return false;
+ } else {
+ String keepVidStr = prefArr[1];
+ if (idArr.contains(keepVidStr)) {
+ idArr.remove(keepVidStr);
+ // So now, the idArr should just contain the vid's
+ // that we want to remove.
+ for (int x = 0; x < idArr.size(); x++) {
+ boolean okFlag = true;
+ String thisVid = idArr.get(x);
+ try {
+ long longVertId = Long.parseLong(thisVid);
+ Vertex vtx = g.traversal().V(longVertId).next();
+ String msg = "--->>> We will delete node with VID = " + thisVid + " <<<---";
+ System.out.println(msg);
+ logger.info(msg);
+ vtx.remove();
+ }
+ catch (Exception e) {
+ okFlag = false;
+ String emsg = "ERROR trying to delete VID = " + thisVid + ", [" + e + "]";
+ System.out.println(emsg);
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.DATA_ERROR);
+ logger.error(emsg);
+ LoggingContext.statusCode(StatusCode.COMPLETE);
+ LoggingContext.responseCode(LoggingContext.SUCCESS);
+ }
+ if (okFlag) {
+ String infMsg = " DELETED VID = " + thisVid;
+ logger.info(infMsg);
+ System.out.println(infMsg);
+ deletedSomething = true;
+ }
+ }
+ } else {
+ String emsg = "ERROR - Vertex Id to keep not found in list of dupes. dupeInfoString = ["
+ + dupeInfoString + "]";
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.DATA_ERROR);
+ logger.error(emsg);
+ LoggingContext.statusCode(StatusCode.COMPLETE);
+ LoggingContext.responseCode(LoggingContext.SUCCESS);
+ System.out.println(emsg);
+ return false;
+ }
+ }
+ }// else we know which one to keep
+ }// else last entry
+ }// for each vertex in a group
+
+ return deletedSomething;
+
+ }// end of deleteNonKeeperForOneSet()
+
+
+ /**
+ * Get values of the key properties for a node.
+ *
+ * @param tvx the vertex to pull the properties from
+ * @param keyPropertyNames ArrayList (ordered) of key prop names
+ * @param logger the EELFLogger
+ * @return a hashMap of the propertyNames/values
+ */
+ private static HashMap <String,Object> getNodeKeyVals( Vertex tvx,
+ ArrayList <String> keyPropNamesArr, EELFLogger logger ) {
+
+ HashMap <String,Object> retHash = new HashMap <String,Object>();
+ Iterator <String> propItr = keyPropNamesArr.iterator();
+ while( propItr.hasNext() ){
+ String propName = propItr.next();
+ if( tvx != null ){
+ Object propValObj = tvx.property(propName).orElse(null);
+ retHash.put(propName, propValObj);
+ }
+ }
+ return retHash;
+
+ }// End of getNodeKeyVals()
+
+
+ /**
+ * Get values of the key properties for a node as a single string
+ *
+ * @param tvx the vertex to pull the properties from
+ * @param keyPropertyNames collection of key prop names
+ * @param logger the EELFLogger
+ * @return a String of concatenated values
+ */
+ private static String getNodeKeyValString( Vertex tvx,
+ ArrayList <String> keyPropNamesArr, EELFLogger logger ) {
+
+ // -- NOTE -- for what we're using this for, we would need to
+ // guarantee that the properties are always in the same order
+
+ String retString = "";
+ Iterator <String> propItr = keyPropNamesArr.iterator();
+ while( propItr.hasNext() ){
+ String propName = propItr.next();
+ if( tvx != null ){
+ Object propValObj = tvx.property(propName).orElse(null);
+ retString = " " + retString + propValObj.toString();
+ }
+ }
+ return retString;
+
+ }// End of getNodeKeyValString()
+
+
+ /**
+ * Find duplicate sets from two dupe runs.
+ *
+ * @param firstPassDupeSets from the first pass
+ * @param secondPassDupeSets from the second pass
+ * @param EELFLogger logger
+ * @return commonDupeSets that are common to both passes and have a determined keeper
+ */
+ private static ArrayList <String> figureWhichDupesStillNeedFixing( ArrayList <String>firstPassDupeSets,
+ ArrayList <String> secondPassDupeSets, EELFLogger logger ){
+
+ ArrayList <String> common2BothSet = new ArrayList <String> ();
+
+ // We just want to look for entries from the first set which have identical (almost)
+ // entries in the secondary set. I say "almost" because the order of the
+ // vid's to delete may be in a different order, but we only want to use it if
+ // they have all the same values. Note also - we're just looking for
+ // the sets where we have a candidate to delete.
+
+ // The duplicate-set Strings are in this format:
+ // "1234|5678|keepVid=UNDETERMINED" (if there were 2 dupes, and we
+ // couldn't figure out which one to keep)
+ // or, "100017|200027|30037|keepVid=30037" (if there were 3 dupes and we
+ // thought the third one was the one that should survive)
+
+ if( firstPassDupeSets == null || firstPassDupeSets.isEmpty()
+ || secondPassDupeSets == null || secondPassDupeSets.isEmpty() ){
+ // If either set is empty, then our return list has to be empty too
+ return common2BothSet;
+ }
+
+ boolean needToParse = false;
+ for( int x = 0; x < secondPassDupeSets.size(); x++ ){
+ String secPassDupeSetStr = secondPassDupeSets.get(x);
+ if( secPassDupeSetStr.endsWith("UNDETERMINED") ){
+ // This is a set of dupes where we could not pick one
+ // to delete - so don't include it on our list for
+ // fixing.
+ }
+ else if( firstPassDupeSets.contains(secPassDupeSetStr) ){
+ // We have lucked out and do not even need to parse this since
+ // it was in the other array with any dupes listed in the same order
+ // This is actually the most common scenario since there is
+ // usually only one dupe, so order doesn't matter.
+ common2BothSet.add(secPassDupeSetStr);
+ }
+ else {
+ // We'll need to do some parsing to check this one
+ needToParse = true;
+ }
+ }
+
+ if( needToParse ){
+ // Make a hash from the first and second Pass data
+ // where the key is the vid to KEEP and the value is an
+ // array of (String) vids that would get deleted.
+ HashMap <String,ArrayList<String>> firstPassHash = makeKeeperHashOfDupeStrings( firstPassDupeSets, common2BothSet, logger );
+
+ HashMap <String,ArrayList<String>> secPassHash = makeKeeperHashOfDupeStrings( secondPassDupeSets, common2BothSet, logger );
+
+ // Loop through the secondPass data and keep the ones
+ // that check out against the firstPass set.
+ for( Map.Entry<String, ArrayList<String>> entry : secPassHash.entrySet() ){
+ boolean skipThisOne = false;
+ String secKey = entry.getKey();
+ ArrayList <String> secList = entry.getValue();
+ if( !firstPassHash.containsKey(secKey) ){
+ // The second pass found this delete candidate, but not the first pass
+ skipThisOne = true;
+ }
+ else {
+ // They both think they should keep this VID, check the associated deletes for it.
+ ArrayList <String> firstList = firstPassHash.get(secKey);
+ for( int z = 0; z < secList.size(); z++ ){
+ if( !firstList.contains(secList.get(z)) ){
+ // The first pass did not think this needed to be deleted
+ skipThisOne = true;
+ }
+ }
+ }
+ if( !skipThisOne ){
+ // Put the string back together and pass it back
+ // Not beautiful, but no time to make it nice right now...
+ // Put it back in the format: "3456|9880|keepVid=3456"
+ String thisDelSetStr = "";
+ for( int z = 0; z < secList.size(); z++ ){
+ if( z == 0 ){
+ thisDelSetStr = secList.get(z);
+ }
+ else {
+ thisDelSetStr = thisDelSetStr + "|" + secList.get(z);
+ }
+ }
+ thisDelSetStr = thisDelSetStr + "|keepVid=" + secKey;
+ common2BothSet.add(thisDelSetStr);
+ }
+ }
+
+ }
+ return common2BothSet;
+
+ }// figureWhichDupesStillNeedFixing
+
+
+ private static HashMap <String, ArrayList <String>> makeKeeperHashOfDupeStrings( ArrayList <String> dupeSets,
+ ArrayList <String> excludeSets, EELFLogger logger ){
+
+ HashMap <String,ArrayList<String>> keeperHash = new HashMap <String, ArrayList<String>>();
+
+ for( int x = 0; x < dupeSets.size(); x++ ){
+ String tmpSetStr = dupeSets.get(x);
+ if( excludeSets.contains(tmpSetStr) ){
+ // This isn't one of the ones we needed to parse.
+ continue;
+ }
+
+ String[] dupeArr = tmpSetStr.split("\\|");
+ ArrayList<String> delIdArr = new ArrayList<String>();
+ int lastIndex = dupeArr.length - 1;
+ for (int i = 0; i <= lastIndex; i++) {
+ if (i < lastIndex) {
+ // This is not the last entry, it is one of the dupes
+ delIdArr.add(dupeArr[i]);
+ }
+ else {
+ // This is the last entry which should tell us if we
+ // have a preferred keeper and how many dupes we had
+ String prefString = dupeArr[i];
+ if( i == 1 ){
+ // There was only one dupe, so if we were gonna find
+ // it, we would have found it above with no parsing.
+ }
+ else if (prefString.equals("KeepVid=UNDETERMINED")) {
+ // This one had no determined keeper, so we don't
+ // want it.
+ }
+ else {
+ // If we know which to keep, then the prefString
+ // should look like, "KeepVid=12345"
+ String[] prefArr = prefString.split("=");
+ if( prefArr.length != 2
+ || (!prefArr[0].equals("KeepVid")) ) {
+ String infMsg = "Bad format in figureWhichDupesStillNeedFixing(). Expecting " +
+ " KeepVid=999999 but string looks like: [" + tmpSetStr + "]";
+ System.out.println(infMsg);
+ logger.info(infMsg);
+ }
+ else {
+ keeperHash.put(prefArr[0], delIdArr);
+ }
+ }
+ }
+ }
+ }
+
+ return keeperHash;
+
+ }// End makeHashOfDupeStrings()
+
+
+ /**
+ * Get values of the key properties for a node.
+ *
+ * @param g the g
+ * @param dupeInfoString
+ * @param logger the EELFLogger
+ * @return void
+ */
+ static private void showNodeDetailsForADupeSet(Graph g, String dupeInfoString, EELFLogger logger) {
+
+ // dang... parsing this string once again...
+
+ String[] dupeArr = dupeInfoString.split("\\|");
+ int lastIndex = dupeArr.length - 1;
+ for (int i = 0; i <= lastIndex; i++) {
+ if (i < lastIndex) {
+ // This is not the last entry, it is one of the dupes,
+ String vidString = dupeArr[i];
+ long longVertId = Long.parseLong(vidString);
+ Vertex vtx = g.traversal().V(longVertId).next();
+ showNodeInfo(logger, vtx, false);
+ } else {
+ // This is the last entry which should tell us if we have a
+ // preferred keeper
+ String prefString = dupeArr[i];
+ if (prefString.equals("KeepVid=UNDETERMINED")) {
+ String msg = " Our algorithm cannot choose from among these, so they will all be kept. -------\n";
+ System.out.println(msg);
+ logger.info(msg);
+ } else {
+ // If we know which to keep, then the prefString should look
+ // like, "KeepVid=12345"
+ String[] prefArr = prefString.split("=");
+ if (prefArr.length != 2 || (!prefArr[0].equals("KeepVid"))) {
+ String emsg = "Bad format. Expecting KeepVid=999999";
+ System.out.println(emsg);
+ LoggingContext.statusCode(StatusCode.ERROR);
+ LoggingContext.responseCode(LoggingContext.DATA_ERROR);
+ logger.error(emsg);
+ LoggingContext.statusCode(StatusCode.COMPLETE);
+ LoggingContext.responseCode(LoggingContext.SUCCESS);
+ } else {
+ String keepVidStr = prefArr[1];
+ String msg = " vid = " + keepVidStr + " is the one that we would KEEP. ------\n";
+ System.out.println(msg);
+ logger.info(msg);
+ }
+ }
+ }
+ }
+
+ }// End of showNodeDetailsForADupeSet()
+
+ private static int graphIndex = 1;
+
+ public static TitanGraph setupGraph(EELFLogger logger){
+
+ TitanGraph titanGraph = null;
+
+
+ try (InputStream inputStream = new FileInputStream(AAIConstants.REALTIME_DB_CONFIG);){
+
+ Properties properties = new Properties();
+ properties.load(inputStream);
+
+ if("inmemory".equals(properties.get("storage.backend"))){
+ titanGraph = AAIGraph.getInstance().getGraph();
+ graphType = "inmemory";
+ } else {
+ titanGraph = TitanFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(DupeTool.class.getSimpleName()).withGraphType("realtime" + graphIndex).buildConfiguration());
+ graphIndex++;
+ }
+ } catch (Exception e) {
+ logger.error("Unable to open the graph", LogFormatTools.getStackTop(e));
+ }
+
+ return titanGraph;
+ }
+
+ public static void closeGraph(TitanGraph graph, EELFLogger logger){
+
+ try {
+ if("inmemory".equals(graphType)) {
+ return;
+ }
+ if( graph != null && graph.isOpen() ){
+ graph.tx().close();
+ graph.close();
+ }
+ } catch (Exception ex) {
+ // Don't throw anything because Titan sometimes is just saying that the graph is already closed{
+ logger.warn("WARNING from final graph.shutdown()", ex);
+ }
+ }
+}
+
+
diff --git a/aai-resources/src/main/java/org/onap/aai/dbgen/ForceDeleteTool.java b/aai-resources/src/main/java/org/onap/aai/dbgen/ForceDeleteTool.java
index 9a7fc39..7dc43d7 100644
--- a/aai-resources/src/main/java/org/onap/aai/dbgen/ForceDeleteTool.java
+++ b/aai-resources/src/main/java/org/onap/aai/dbgen/ForceDeleteTool.java
@@ -20,12 +20,16 @@
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.dbgen;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Properties;
import java.util.Scanner;
import java.util.UUID;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.structure.Direction;
@@ -33,7 +37,9 @@ 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.dbmap.AAIGraphConfig;
+import org.onap.aai.dbmap.AAIGraph;
import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.logging.LogFormatTools;
import org.onap.aai.logging.LoggingContext;
import org.onap.aai.logging.LoggingContext.StatusCode;
import org.onap.aai.serialization.db.AAIDirection;
@@ -53,6 +59,20 @@ import com.thinkaurelius.titan.core.TitanGraph;
public class ForceDeleteTool {
private static final String FROMAPPID = "AAI-DB";
private static final String TRANSID = UUID.randomUUID().toString();
+
+ private static String graphType = "realdb";
+
+ public static boolean SHOULD_EXIT_VM = true;
+
+ public static int EXIT_VM_STATUS_CODE = -1;
+
+ public static void exit(int statusCode){
+ if(SHOULD_EXIT_VM){
+ System.exit(1);
+ }
+ EXIT_VM_STATUS_CODE = statusCode;
+ }
+
/*
* The main method.
*
@@ -101,7 +121,7 @@ public class ForceDeleteTool {
LoggingContext.statusCode(StatusCode.ERROR);
LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
logger.error(" No value passed with -action option. ");
- System.exit(0);
+ exit(0);
}
actionVal = args[i];
argStr4Msg = argStr4Msg + " " + actionVal;
@@ -112,7 +132,7 @@ public class ForceDeleteTool {
LoggingContext.statusCode(StatusCode.ERROR);
LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
logger.error(" No value passed with -userId option. ");
- System.exit(0);
+ exit(0);
}
userIdVal = args[i];
argStr4Msg = argStr4Msg + " " + userIdVal;
@@ -129,7 +149,7 @@ public class ForceDeleteTool {
LoggingContext.statusCode(StatusCode.ERROR);
LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
logger.error(" No value passed with -vertexId option. ");
- System.exit(0);
+ exit(0);
}
String nextArg = args[i];
argStr4Msg = argStr4Msg + " " + nextArg;
@@ -140,7 +160,7 @@ public class ForceDeleteTool {
LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
logger.error("Bad value passed with -vertexId option: ["
+ nextArg + "]");
- System.exit(0);
+ exit(0);
}
}
else if (thisArg.equals("-params4Collect")) {
@@ -149,7 +169,7 @@ public class ForceDeleteTool {
LoggingContext.statusCode(StatusCode.ERROR);
LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
logger.error(" No value passed with -params4Collect option. ");
- System.exit(0);
+ exit(0);
}
dataString = args[i];
argStr4Msg = argStr4Msg + " " + dataString;
@@ -160,7 +180,7 @@ public class ForceDeleteTool {
LoggingContext.statusCode(StatusCode.ERROR);
LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
logger.error(" No value passed with -edgeId option. ");
- System.exit(0);
+ exit(0);
}
String nextArg = args[i];
argStr4Msg = argStr4Msg + " " + nextArg;
@@ -172,7 +192,7 @@ public class ForceDeleteTool {
logger.error(" Unrecognized argument passed to ForceDeleteTool: ["
+ thisArg + "]. ");
logger.error(" Valid values are: -action -userId -vertexId -edgeId -overRideProtection -params4Collect -DISPLAY_ALL_VIDS");
- System.exit(0);
+ exit(0);
}
}
}
@@ -183,7 +203,7 @@ public class ForceDeleteTool {
LoggingContext.statusCode(StatusCode.ERROR);
LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
logger.error(emsg);
- System.exit(0);
+ exit(0);
}
if( actionVal.equals("DELETE_NODE") && vertexIdLong == 0 ){
@@ -192,7 +212,7 @@ public class ForceDeleteTool {
LoggingContext.statusCode(StatusCode.ERROR);
LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
logger.error(emsg);
- System.exit(0);
+ exit(0);
}
else if( actionVal.equals("DELETE_EDGE") && edgeIdStr.equals("")){
String emsg = "ERROR: No edge ID passed on DELETE_EDGE request. \n";
@@ -200,7 +220,7 @@ public class ForceDeleteTool {
LoggingContext.statusCode(StatusCode.ERROR);
LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
logger.error(emsg);
- System.exit(0);
+ exit(0);
}
@@ -211,7 +231,7 @@ public class ForceDeleteTool {
LoggingContext.statusCode(StatusCode.ERROR);
LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
logger.error(emsg);
- System.exit(0);
+ exit(0);
}
String msg = "";
@@ -219,14 +239,14 @@ public class ForceDeleteTool {
try {
AAIConfig.init();
System.out.println(" ---- NOTE --- about to open graph (takes a little while)--------\n");
- graph = TitanFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(ForceDelete.class.getSimpleName()).withGraphType("realtime1").buildConfiguration());
+ graph = setupGraph(logger);
if( graph == null ){
String emsg = "could not get graph object in ForceDeleteTool() \n";
System.out.println(emsg);
LoggingContext.statusCode(StatusCode.ERROR);
LoggingContext.responseCode(LoggingContext.AVAILABILITY_TIMEOUT_ERROR);
logger.error(emsg);
- System.exit(0);
+ exit(0);
}
}
catch (AAIException e1) {
@@ -235,7 +255,7 @@ public class ForceDeleteTool {
LoggingContext.statusCode(StatusCode.ERROR);
LoggingContext.responseCode(LoggingContext.UNKNOWN_ERROR);
logger.error(msg);
- System.exit(0);
+ exit(0);
}
catch (Exception e2) {
msg = e2.toString();
@@ -243,7 +263,7 @@ public class ForceDeleteTool {
LoggingContext.statusCode(StatusCode.ERROR);
LoggingContext.responseCode(LoggingContext.UNKNOWN_ERROR);
logger.error(msg);
- System.exit(0);
+ exit(0);
}
msg = "ForceDelete called by: userId [" + userIdVal + "] with these params: [" + argStr4Msg + "]";
@@ -265,7 +285,7 @@ public class ForceDeleteTool {
LoggingContext.statusCode(StatusCode.ERROR);
LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
logger.error(msg);
- System.exit(0);
+ exit(0);
}
GraphTraversal<Vertex, Vertex> g = graph.traversal().V();
String qStringForMsg = " graph.traversal().V()";
@@ -279,7 +299,7 @@ public class ForceDeleteTool {
LoggingContext.statusCode(StatusCode.ERROR);
LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
logger.error(msg);
- System.exit(0);
+ exit(0);
}
else {
String propName = paramArr[i].substring(0,pipeLoc);
@@ -306,7 +326,7 @@ public class ForceDeleteTool {
LoggingContext.statusCode(StatusCode.ERROR);
LoggingContext.responseCode(LoggingContext.DATA_ERROR);
logger.error(msg);
- System.exit(0);
+ exit(0);
}
String infMsg = "\n\n Found: " + resCount + " nodes for this query: [" + qStringForMsg + "]\n";
@@ -360,7 +380,7 @@ public class ForceDeleteTool {
String infMsg = ">>>>>>>>>> Edge with edgeId = " + edgeIdStr + " not found.";
logger.info( infMsg );
System.out.println(infMsg);
- System.exit(0);
+ exit(0);
}
if( fd.getEdgeDelConfirmation(logger, userIdVal, thisEdge, overRideProtection) ){
@@ -375,16 +395,17 @@ public class ForceDeleteTool {
System.out.println(infMsg);
logger.info( infMsg );
}
- System.exit(0);
+ exit(0);
}
else {
String emsg = "Unknown action parameter [" + actionVal + "] passed to ForceDeleteTool(). Valid values = COLLECT_DATA, DELETE_NODE or DELETE_EDGE \n";
System.out.println(emsg);
logger.info( emsg );
- System.exit(0);
+ exit(0);
}
- System.exit(0);
+ closeGraph(graph, logger);
+ exit(0);
}// end of main()
@@ -792,7 +813,49 @@ public class ForceDeleteTool {
} // End of getNodeDelConfirmation()
}
-
+
+ public static TitanGraph setupGraph(EELFLogger logger){
+
+ TitanGraph titanGraph = null;
+
+ try (InputStream inputStream = new FileInputStream(AAIConstants.REALTIME_DB_CONFIG);){
+
+ Properties properties = new Properties();
+ properties.load(inputStream);
+
+ if("inmemory".equals(properties.get("storage.backend"))){
+ titanGraph = AAIGraph.getInstance().getGraph();
+ graphType = "inmemory";
+ } else {
+ titanGraph = TitanFactory.open(
+ new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG)
+ .forService(ForceDeleteTool.class.getSimpleName())
+ .withGraphType("realtime1")
+ .buildConfiguration()
+ );
+ }
+ } catch (Exception e) {
+ logger.error("Unable to open the graph", LogFormatTools.getStackTop(e));
+ }
+
+ return titanGraph;
+ }
+
+ public static void closeGraph(TitanGraph graph, EELFLogger logger){
+
+ try {
+ if("inmemory".equals(graphType)) {
+ return;
+ }
+ if( graph != null && graph.isOpen() ){
+ graph.tx().close();
+ graph.close();
+ }
+ } catch (Exception ex) {
+ // Don't throw anything because Titan sometimes is just saying that the graph is already closed{
+ logger.warn("WARNING from final graph.shutdown()", ex);
+ }
+ }
}
diff --git a/aai-resources/src/main/java/org/onap/aai/ajsc_aai/util/ServicePropertiesMapBean.java b/aai-resources/src/main/java/org/onap/aai/interceptors/AAIContainerFilter.java
index 71c290b..fdd3edb 100644
--- a/aai-resources/src/main/java/org/onap/aai/ajsc_aai/util/ServicePropertiesMapBean.java
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/AAIContainerFilter.java
@@ -19,20 +19,25 @@
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-package org.onap.aai.ajsc_aai.util;
+package org.onap.aai.interceptors;
-import org.onap.aai.ajsc_aai.filemonitor.ServicePropertiesMap;
+import java.util.UUID;
-public class ServicePropertiesMapBean {
+import org.onap.aai.util.FormatDate;
- /**
- * Gets the property.
- *
- * @param propFileName the prop file name
- * @param propertyKey the property key
- * @return the property
- */
- public static String getProperty(String propFileName, String propertyKey) {
- return ServicePropertiesMap.getProperty(propFileName, propertyKey);
+public abstract class AAIContainerFilter {
+
+ protected String genDate() {
+ FormatDate fd = new FormatDate("YYMMdd-HH:mm:ss:SSS");
+ return fd.getDateTime();
+ }
+
+ protected boolean isValidUUID(String transId) {
+ try {
+ UUID.fromString(transId);
+ } catch (IllegalArgumentException e) {
+ return false;
+ }
+ return true;
}
}
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/AAIHeaderProperties.java b/aai-resources/src/main/java/org/onap/aai/interceptors/AAIHeaderProperties.java
index 733383a..8eca9b6 100644
--- a/aai-resources/src/main/java/org/onap/aai/interceptors/AAIHeaderProperties.java
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/AAIHeaderProperties.java
@@ -21,7 +21,21 @@
*/
package org.onap.aai.interceptors;
-public class AAIHeaderProperties {
-
+public final class AAIHeaderProperties {
+
+ private AAIHeaderProperties(){}
+
public static final String REQUEST_CONTEXT = "aai-request-context";
+
+ public static final String HTTP_METHOD_OVERRIDE = "X-HTTP-Method-Override";
+
+ public static final String TRANSACTION_ID = "X-TransactionId";
+
+ public static final String FROM_APP_ID = "X-FromAppId";
+
+ public static final String AAI_TX_ID = "X-AAI-TXID";
+
+ public static final String AAI_REQUEST = "X-REQUEST";
+
+ public static final String AAI_REQUEST_TS = "X-REQUEST-TS";
}
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/AAILogJAXRSInInterceptor.java b/aai-resources/src/main/java/org/onap/aai/interceptors/AAILogJAXRSInInterceptor.java
deleted file mode 100644
index 7d8112d..0000000
--- a/aai-resources/src/main/java/org/onap/aai/interceptors/AAILogJAXRSInInterceptor.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.aai.interceptors;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.ws.rs.core.MediaType;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.interceptor.LoggingMessage;
-import org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor;
-import org.apache.cxf.message.Message;
-import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.logging.ErrorLogHelper;
-import org.onap.aai.rest.util.EchoResponse;
-import org.onap.aai.util.AAIConfig;
-import org.onap.aai.util.AAIConstants;
-import org.onap.aai.util.FormatDate;
-import org.onap.aai.util.HbaseSaltPrefixer;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.slf4j.MDC;
-
-public class AAILogJAXRSInInterceptor extends JAXRSInInterceptor {
-
- protected final String COMPONENT = "aairest";
- protected final String CAMEL_REQUEST ="CamelHttpUrl";
- private static final Pattern uuidPattern = Pattern.compile("^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$");
- private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(AAILogJAXRSInInterceptor.class);
-
- /**
- * {@inheritDoc}
- */
- public void handleMessage(Message message) {
-
- boolean go = false;
- String uri = null;
- String query = null;
- try {
-
- uri = (String)message.get(CAMEL_REQUEST);
- if (uri != null) {
- query = (String)message.get(Message.QUERY_STRING);
- }
-
- if (AAIConfig.get(AAIConstants.AAI_LOGGING_HBASE_INTERCEPTOR).equalsIgnoreCase("true") &&
- AAIConfig.get(AAIConstants.AAI_LOGGING_HBASE_ENABLED).equalsIgnoreCase("true")) {
- go = true;
- message.getExchange().put("AAI_LOGGING_HBASE_ENABLED", 1);
- if (AAIConfig.get(AAIConstants.AAI_LOGGING_HBASE_LOGREQUEST).equalsIgnoreCase("true") ) {
- message.getExchange().put("AAI_LOGGING_HBASE_LOGREQUEST", 1);
- }
- if (AAIConfig.get(AAIConstants.AAI_LOGGING_HBASE_LOGRESPONSE).equalsIgnoreCase("true") ) {
- message.getExchange().put("AAI_LOGGING_HBASE_LOGRESPONSE", 1);
- }
- }
- if (AAIConfig.get(AAIConstants.AAI_LOGGING_TRACE_ENABLED).equalsIgnoreCase("true") ) {
- go = true;
- message.getExchange().put("AAI_LOGGING_TRACE_ENABLED", 1);
- if (AAIConfig.get(AAIConstants.AAI_LOGGING_TRACE_LOGREQUEST).equalsIgnoreCase("true") ) {
- message.getExchange().put("AAI_LOGGING_TRACE_LOGREQUEST", 1);
- }
- if (AAIConfig.get(AAIConstants.AAI_LOGGING_TRACE_LOGRESPONSE).equalsIgnoreCase("true") ) {
- message.getExchange().put("AAI_LOGGING_TRACE_LOGRESPONSE", 1);
- }
- }
- } catch (AAIException e1) {
- ErrorLogHelper.logException(e1);
- }
-
- if (uri.contains(EchoResponse.echoPath)) {
- // if it's a health check, we don't want to log ANYTHING if it's a lightweight one
- if (query == null) {
- if (message.getExchange().containsKey("AAI_LOGGING_HBASE_ENABLED")) {
- message.getExchange().remove("AAI_LOGGING_HBASE_ENABLED");
- }
- if (message.getExchange().containsKey("AAI_LOGGING_TRACE_ENABLED")) {
- message.getExchange().remove("AAI_LOGGING_TRACE_ENABLED");
- }
- go = false;
- }
- }
- else if (uri.contains("/translog/")) {
- // if it's a translog query, we don't want to log the responses
- if (message.getExchange().containsKey("AAI_LOGGING_HBASE_LOGRESPONSE")) {
- message.getExchange().remove("AAI_LOGGING_HBASE_LOGRESPONSE");
- }
- if (message.getExchange().containsKey("AAI_LOGGING_TRACE_LOGRESPONSE")) {
- message.getExchange().remove("AAI_LOGGING_TRACE_LOGRESPONSE");
- }
- }
-
- if (go == false) { // there's nothing to do
- return;
- }
-
- // DONE: get a TXID based on hostname, time (YYYYMMDDHHMMSSMILLIS, and LoggingMessage.nextId(); 20150326145301-1
- String now = genDate();
-
- message.getExchange().put("AAI_RQST_TM", now);
-
- String id = (String)message.getExchange().get(LoggingMessage.ID_KEY);
-
- String fullId = null;
- try {
- if (id == null) {
- id = LoggingMessage.nextId();
- }
- fullId = AAIConfig.get(AAIConstants.AAI_NODENAME) + "-" + now + "-" + id;
- fullId = HbaseSaltPrefixer.getInstance().prependSalt(fullId);
- message.getExchange().put(LoggingMessage.ID_KEY, fullId);
- } catch (AAIException e1) {
- LOGGER.debug("config problem", e1);
- }
-
- if (fullId == null) {
- fullId = now + "-" + id;
- fullId = HbaseSaltPrefixer.getInstance().prependSalt(fullId);
- }
- message.put(LoggingMessage.ID_KEY, fullId);
- final LoggingMessage buffer = new LoggingMessage("Message", fullId);
-
- Integer responseCode = (Integer)message.get(Message.RESPONSE_CODE);
- if (responseCode != null) {
- buffer.getResponseCode().append(responseCode);
- }
-
- String encoding = (String)message.get(Message.ENCODING);
-
- if (encoding != null) {
- buffer.getEncoding().append(encoding);
- }
- String httpMethod = (String)message.get(Message.HTTP_REQUEST_METHOD);
- if (httpMethod != null) {
- buffer.getHttpMethod().append(httpMethod);
- }
-
- String ct = (String)message.get(Message.CONTENT_TYPE);
- if (ct != null) {
- if ("*/*".equals(ct)) {
- message.put(Message.CONTENT_TYPE, MediaType.APPLICATION_JSON);
- ct = MediaType.APPLICATION_JSON;
- }
- buffer.getContentType().append(ct);
-
- }
- Object headers = message.get(Message.PROTOCOL_HEADERS);
- if (headers != null) {
- buffer.getHeader().append(headers);
-
- Map<String, List<String>> headersList = CastUtils.cast((Map<?, ?>)message.get(Message.PROTOCOL_HEADERS));
- String transId = "";
- List<String> xt = headersList.get("X-TransactionId");
- String newTransId = transId;
- boolean missingTransId = false;
- boolean replacedTransId = false;
- String logMsg = null;
- if (xt != null) {
- for (String transIdValue : xt) {
- transId = transIdValue;
- }
- Matcher matcher = uuidPattern.matcher(transId);
- if (!matcher.find()) {
- replacedTransId = true;
- // check if there's a colon, and check the first group?
- if (transId.contains(":")) {
- String[] uuidParts = transId.split(":");
- Matcher matcher2 = uuidPattern.matcher(uuidParts[0]);
- if (matcher2.find()) {
- newTransId = uuidParts[0];
- } else {
- // punt, we tried to find it, it has a colon but no UUID-1
- newTransId = UUID.randomUUID().toString();
- }
- } else {
- newTransId = UUID.randomUUID().toString();
- }
- }
- } else {
- newTransId = UUID.randomUUID().toString();
- missingTransId = true;
- }
-
- if (missingTransId || replacedTransId) {
- List<String> txList = new ArrayList<String>();
- txList.add(newTransId);
- headersList.put("X-TransactionId", txList);
- if (missingTransId) {
- logMsg = "Missing requestID. Assigned " + newTransId;
- } else if (replacedTransId) {
- logMsg = "Replaced invalid requestID of " + transId + " Assigned " + newTransId;
- }
- MDC.put("RequestId",newTransId);
- }
- else {
- MDC.put("RequestId",transId);
- }
-
- List<String> fromAppIdList = headersList.get("X-FromAppId");
- if (fromAppIdList != null) {
- String fromAppId = null;
- for (String fromAppIdValue : fromAppIdList) {
- fromAppId = fromAppIdValue;
- }
- MDC.put("PartnerName",fromAppId);
- }
-
- List<String> contentType = headersList.get("Content-Type");
- if (contentType == null) {
- ct = (String)message.get(Message.CONTENT_TYPE);
- headersList.put(Message.CONTENT_TYPE, Collections.singletonList(ct));
- }
-
- LOGGER.auditEvent("REST " + httpMethod + " " + ((query != null)? uri+"?"+query : uri) + " HbaseTxId=" + fullId);
- LOGGER.info(logMsg);
- }
-
-
- if (uri != null) {
- buffer.getAddress().append(uri);
- if (query != null) {
- buffer.getAddress().append("?").append(query);
- }
- }
-
- InputStream is = message.getContent(InputStream.class);
- if (is != null) {
- try {
- String currentPayload = IOUtils.toString(is, "UTF-8");
- IOUtils.closeQuietly(is);
- buffer.getPayload().append(currentPayload);
- is = IOUtils.toInputStream(currentPayload, "UTF-8");
- message.setContent(InputStream.class, is);
- IOUtils.closeQuietly(is);
- } catch (Exception e) {
- // It's ok to not have request input content
- // throw new Fault(e);
- }
- }
-
- // this will be saved in the message exchange, and can be pulled out later...
- message.getExchange().put(fullId + "_REQUEST", buffer.toString());
- }
-
- /**
- * Gen date.
- *
- * @param aaiLogger the aai logger
- * @param logline the logline
- * @return the string
- */
- protected String genDate() {
- FormatDate fd = new FormatDate( "YYMMdd-HH:mm:ss:SSS");
- return fd.getDateTime();
- }
-
-}
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/AAILogJAXRSOutInterceptor.java b/aai-resources/src/main/java/org/onap/aai/interceptors/AAILogJAXRSOutInterceptor.java
deleted file mode 100644
index 3b1f50c..0000000
--- a/aai-resources/src/main/java/org/onap/aai/interceptors/AAILogJAXRSOutInterceptor.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.aai.interceptors;
-
-import java.io.OutputStream;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.interceptor.LoggingMessage;
-import org.apache.cxf.io.CacheAndWriteOutputStream;
-import org.apache.cxf.io.CachedOutputStream;
-import org.apache.cxf.io.CachedOutputStreamCallback;
-import org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor;
-import org.apache.cxf.message.Message;
-import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.logging.ErrorLogHelper;
-import org.onap.aai.util.AAIConfig;
-import org.onap.aai.util.AAIConstants;
-import org.onap.aai.util.FormatDate;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-// right after the request is complete, there may be content
-public class AAILogJAXRSOutInterceptor extends JAXRSOutInterceptor {
-
- private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(AAILogJAXRSOutInterceptor.class);
-
- protected final String COMPONENT = "aairest";
- protected final String CAMEL_REQUEST = "CamelHttpUrl";
-
- /**
- * {@inheritDoc}
- */
- public void handleMessage(Message message) {
-
- String fullId = (String) message.getExchange().get(LoggingMessage.ID_KEY);
-
- Map<String, List<String>> headers = CastUtils.cast((Map<?, ?>) message.get(Message.PROTOCOL_HEADERS));
- if (headers == null) {
- headers = new HashMap<String, List<String>>();
- }
-
- headers.put("X-AAI-TXID", Collections.singletonList(fullId));
- message.put(Message.PROTOCOL_HEADERS, headers);
-
- Message outMessage = message.getExchange().getOutMessage();
- final OutputStream os = outMessage.getContent(OutputStream.class);
- if (os == null) {
- return;
- }
-
- // we only want to register the callback if there is good reason for it.
- if (message.getExchange().containsKey("AAI_LOGGING_HBASE_ENABLED") || message.getExchange().containsKey("AAI_LOGGING_TRACE_ENABLED")) {
-
- final CacheAndWriteOutputStream newOut = new CacheAndWriteOutputStream(os);
- message.setContent(OutputStream.class, newOut);
- newOut.registerCallback(new LoggingCallback(message, os));
- }
-
- }
-
- class LoggingCallback implements CachedOutputStreamCallback {
-
- private final Message message;
- private final OutputStream origStream;
-
- public LoggingCallback(final Message msg, final OutputStream os) {
- this.message = msg;
- this.origStream = os;
- }
-
- public void onFlush(CachedOutputStream cos) {
-
- }
-
- public void onClose(CachedOutputStream cos) {
-
- String getValue = "";
- String postValue = "";
- String logValue = "";
-
- try {
- logValue = AAIConfig.get("aai.transaction.logging");
- getValue = AAIConfig.get("aai.transaction.logging.get");
- postValue = AAIConfig.get("aai.transaction.logging.post");
- } catch (AAIException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- if (!message.getExchange().containsKey("AAI_LOGGING_HBASE_ENABLED") && !message.getExchange().containsKey("AAI_LOGGING_TRACE_ENABLED")) {
- return;
- }
-
- String fullId = (String) message.getExchange().get(LoggingMessage.ID_KEY);
-
- Message inMessage = message.getExchange().getInMessage();
- String transId = null;
- String fromAppId = null;
-
- Map<String, List<String>> headersList = CastUtils.cast((Map<?, ?>) inMessage.get(Message.PROTOCOL_HEADERS));
- if (headersList != null) {
- List<String> xt = headersList.get("X-TransactionId");
- if (xt != null) {
- for (String transIdValue : xt) {
- transId = transIdValue;
- }
- }
- List<String> fa = headersList.get("X-FromAppId");
- if (fa != null) {
- for (String fromAppIdValue : fa) {
-
- fromAppId = fromAppIdValue;
- }
- }
- }
-
- String httpMethod = (String) inMessage.get(Message.HTTP_REQUEST_METHOD);
-
- String uri = (String) inMessage.get(CAMEL_REQUEST);
- String fullUri = uri;
- if (uri != null) {
- String query = (String) message.get(Message.QUERY_STRING);
- if (query != null) {
- fullUri = uri + "?" + query;
- }
- }
-
- String request = (String) message.getExchange().get(fullId + "_REQUEST");
-
- Message outMessage = message.getExchange().getOutMessage();
-
- final LoggingMessage buffer = new LoggingMessage("OUTMessage", fullId);
-
- // should we check this, and make sure it's not an error?
- Integer responseCode = (Integer) outMessage.get(Message.RESPONSE_CODE);
- if (responseCode == null) {
- responseCode = 200; // this should never happen, but just in
- // case we don't get one
- }
- buffer.getResponseCode().append(responseCode);
-
- String encoding = (String) outMessage.get(Message.ENCODING);
-
- if (encoding != null) {
- buffer.getEncoding().append(encoding);
- }
-
- String ct = (String) outMessage.get(Message.CONTENT_TYPE);
- if (ct != null) {
- buffer.getContentType().append(ct);
- }
-
- Object headers = outMessage.get(Message.PROTOCOL_HEADERS);
- if (headers != null) {
- buffer.getHeader().append(headers);
- }
-
- Boolean ss = false;
- if (responseCode >= 200 && responseCode <= 299) {
- ss = true;
- }
- String response = buffer.toString();
-
- // this should have been set by the in interceptor
- String rqstTm = (String) message.getExchange().get("AAI_RQST_TM");
-
- // just in case it wasn't, we'll put this here. not great, but it'll
- // have a val.
- if (rqstTm == null) {
- rqstTm = genDate();
- }
-
-
- String respTm = genDate();
-
- try {
- String actualRequest = request;
- StringBuilder builder = new StringBuilder();
- cos.writeCacheTo(builder, 100000);
- // here comes my xml:
- String payload = builder.toString();
-
- String actualResponse = response;
- if (payload == null) {
-
- } else {
- actualResponse = response + payload;
- }
-
- // we only log to AAI log if it's eanbled in the config props
- // file
- if (message.getExchange().containsKey("AAI_LOGGING_TRACE_ENABLED")) {
-
- if (message.getExchange().containsKey("AAI_LOGGING_TRACE_LOGREQUEST")) {
-
- // strip newlines from request
- String traceRequest = actualRequest;
- traceRequest = traceRequest.replace("\n", " ");
- traceRequest = traceRequest.replace("\r", "");
- traceRequest = traceRequest.replace("\t", "");
- LOGGER.debug(traceRequest);
- }
- if (message.getExchange().containsKey("AAI_LOGGING_TRACE_LOGRESPONSE")) {
- // strip newlines from response
- String traceResponse = actualResponse;
- traceResponse = traceResponse.replace("\n", " ");
- traceResponse = traceResponse.replace("\r", "");
- traceResponse = traceResponse.replace("\t", "");
-
- LOGGER.debug(traceResponse);
- }
- }
-
- // we only log to HBASE if it's enabled in the config props file
- // TODO: pretty print XML/JSON. we might need to get the payload
- // and envelope seperately
- if (message.getExchange().containsKey("AAI_LOGGING_HBASE_ENABLED")) {
- if (!message.getExchange().containsKey("AAI_LOGGING_HBASE_LOGREQUEST")) {
- actualRequest = "loggingDisabled";
- }
- if (!message.getExchange().containsKey("AAI_LOGGING_HBASE_LOGRESPONSE")) {
- actualResponse = "loggingDisabled";
- }
-
- LOGGER.debug("action={}, urlin={}, HbTransId={}", httpMethod, fullUri, fullId);
-
- if (logValue.equals("false")) {
- } else if (getValue.equals("false") && httpMethod.equals("GET")) {
- } else if (postValue.equals("false") && httpMethod.equals("POST")) {
- } else {
- putTransaction(transId, responseCode.toString(), rqstTm, respTm, fromAppId + ":" + transId, fullUri, httpMethod, request, response, actualResponse);
-
- }
- }
- } catch (Exception ex) {
- // ignore
- }
-
- message.setContent(OutputStream.class, origStream);
-
- LOGGER.auditEvent("HTTP Response Code: {}", responseCode.toString());
- }
-
- }
-
- protected String genDate() {
- FormatDate fd = new FormatDate( "YYMMdd-HH:mm:ss:SSS");
- return fd.getDateTime();
- }
-
- public String putTransaction(String tid, String status, String rqstTm, String respTm, String srcId, String rsrcId, String rsrcType, String rqstBuf, String respBuf, String actualResponse) {
- String tm = null;
-
- if (tid == null || "".equals(tid)) {
- tm = this.genDate();
- tid = tm + "-";
- }
-
- String htid = tid;
-
- if (rqstTm == null || "".equals(rqstTm)) {
- rqstTm = tm;
- }
-
- if (respTm == null || "".equals(respTm)) {
- respTm = tm;
- }
-
- try {
- LOGGER.debug(" transactionId:" + tid + " status: " + status + " rqstDate: " + rqstTm + " respDate: " + respTm + " sourceId: " + srcId + " resourceId: "
- + rsrcId + " resourceType: " + rsrcType + " payload rqstBuf: " + rqstBuf + " payload respBuf: " + respBuf + " Payload Error Messages: " + actualResponse);
- return htid;
- } catch (Exception e) {
- ErrorLogHelper.logError("AAI_4000", "Exception updating HBase:");
- return htid;
- }
-
- }
-}
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/PreAaiAjscInterceptor.java b/aai-resources/src/main/java/org/onap/aai/interceptors/PreAaiAjscInterceptor.java
deleted file mode 100644
index 360ebe4..0000000
--- a/aai-resources/src/main/java/org/onap/aai/interceptors/PreAaiAjscInterceptor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.aai.interceptors;
-
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.onap.aai.logging.LoggingContext;
-
-import ajsc.beans.interceptors.AjscInterceptor;
-
-public class PreAaiAjscInterceptor implements AjscInterceptor {
- private final static String TARGET_ENTITY = "aai-resources";
- private static class LazyAaiAjscInterceptor {
- public static final PreAaiAjscInterceptor INSTANCE = new PreAaiAjscInterceptor();
- }
-
- public static PreAaiAjscInterceptor getInstance() {
- return LazyAaiAjscInterceptor.INSTANCE;
- }
-
- @Override
- public boolean allowOrReject(HttpServletRequest req, HttpServletResponse resp, Map<?, ?> paramMap)
- throws Exception {
-
- LoggingContext.init();
- String serviceName = req.getMethod() + " " + req.getRequestURI().toString();
- String queryStr = req.getQueryString();
- if ( queryStr != null ) {
- serviceName = serviceName + "?" + queryStr;
- }
- LoggingContext.partnerName(req.getHeader("X-FromAppId"));
- LoggingContext.serviceName(serviceName);
- LoggingContext.targetEntity(TARGET_ENTITY);
- LoggingContext.targetServiceName(serviceName);
- LoggingContext.requestId(req.getHeader("X-TransactionId"));
-
- return true;
- }
-}
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/package-info.java b/aai-resources/src/main/java/org/onap/aai/interceptors/package-info.java
new file mode 100644
index 0000000..0af4afd
--- /dev/null
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/package-info.java
@@ -0,0 +1,38 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+/**
+ * <b>Interceptors</b> package is subdivided to pre and post interceptors
+ * If you want to add an additional interceptor you would need to add
+ * the priority level to AAIRequestFilterPriority or AAIResponsePriority
+ * to give a value which indicates the order in which the interceptor
+ * will be triggered and also you will add that value like here
+ *
+ * <pre>
+ * <code>
+ * @Priority(AAIRequestFilterPriority.YOUR_PRIORITY)
+ * public class YourInterceptor extends AAIContainerFilter implements ContainerRequestFilter {
+ *
+ * }
+ * </code>
+ * </pre>
+ */
+package org.onap.aai.interceptors;
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/post/AAIResponseFilterPriority.java b/aai-resources/src/main/java/org/onap/aai/interceptors/post/AAIResponseFilterPriority.java
new file mode 100644
index 0000000..db05b30
--- /dev/null
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/post/AAIResponseFilterPriority.java
@@ -0,0 +1,34 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.interceptors.post;
+
+public final class AAIResponseFilterPriority {
+
+ private AAIResponseFilterPriority() {}
+
+ public static final int HEADER_MANIPULATION = 1000;
+
+ public static final int RESPONSE_TRANS_LOGGING = 2000;
+
+ public static final int RESET_LOGGING_CONTEXT = 3000;
+
+}
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/PostAaiAjscInterceptor.java b/aai-resources/src/main/java/org/onap/aai/interceptors/post/ResetLoggingContext.java
index 2a34774..592c3fc 100644
--- a/aai-resources/src/main/java/org/onap/aai/interceptors/PostAaiAjscInterceptor.java
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/post/ResetLoggingContext.java
@@ -19,47 +19,53 @@
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-package org.onap.aai.interceptors;
+package org.onap.aai.interceptors.post;
-import java.util.Map;
+import java.io.IOException;
+import javax.annotation.Priority;
import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerResponseContext;
+import javax.ws.rs.container.ContainerResponseFilter;
+import org.onap.aai.interceptors.AAIContainerFilter;
import org.onap.aai.logging.LoggingContext;
import org.onap.aai.logging.LoggingContext.StatusCode;
+import org.springframework.beans.factory.annotation.Autowired;
+
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import ajsc.beans.interceptors.AjscInterceptor;
+@Priority(AAIResponseFilterPriority.RESET_LOGGING_CONTEXT)
+public class ResetLoggingContext extends AAIContainerFilter implements ContainerResponseFilter {
+
+ private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(ResetLoggingContext.class);
-public class PostAaiAjscInterceptor implements AjscInterceptor {
+ @Autowired
+ private HttpServletRequest httpServletRequest;
+
+ @Override
+ public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
+ throws IOException {
- private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(PostAaiAjscInterceptor.class);
+ this.cleanLoggingContext();
- private static class LazyAaiAjscInterceptor {
- public static final PostAaiAjscInterceptor INSTANCE = new PostAaiAjscInterceptor();
}
- public static PostAaiAjscInterceptor getInstance() {
- return LazyAaiAjscInterceptor.INSTANCE;
- }
+ private void cleanLoggingContext() {
+ final String responseCode = LoggingContext.responseCode();
+ String url = httpServletRequest.getRequestURL().toString();
- @Override
- public boolean allowOrReject(HttpServletRequest req, HttpServletResponse resp, Map<?, ?> paramMap)
- throws Exception {
-
- final int httpStatusCode = resp.getStatus();
- LoggingContext.responseCode(Integer.toString(httpStatusCode));
- if ( httpStatusCode < 200 || httpStatusCode > 299 ) {
+ if (responseCode != null && responseCode.startsWith("ERR.")) {
LoggingContext.statusCode(StatusCode.ERROR);
- LOGGER.error(req.getRequestURL() + " call failed with responseCode=" + httpStatusCode);
- }
- else {
+ LOGGER.error(url + " call failed with responseCode=" + responseCode);
+ } else {
LoggingContext.statusCode(StatusCode.COMPLETE);
- LOGGER.info(req.getRequestURL() + " call succeeded");
+ LOGGER.info(url + " call succeeded");
}
+
LoggingContext.clear();
- return true;
}
+
}
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/post/ResponseHeaderManipulation.java b/aai-resources/src/main/java/org/onap/aai/interceptors/post/ResponseHeaderManipulation.java
new file mode 100644
index 0000000..e3cb35b
--- /dev/null
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/post/ResponseHeaderManipulation.java
@@ -0,0 +1,51 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.interceptors.post;
+
+import java.io.IOException;
+
+import javax.annotation.Priority;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerResponseContext;
+import javax.ws.rs.container.ContainerResponseFilter;
+
+import org.onap.aai.interceptors.AAIContainerFilter;
+import org.onap.aai.interceptors.AAIHeaderProperties;
+
+@Priority(AAIResponseFilterPriority.HEADER_MANIPULATION)
+public class ResponseHeaderManipulation extends AAIContainerFilter implements ContainerResponseFilter {
+
+
+ @Override
+ public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
+ throws IOException {
+
+ updateResponseHeaders(requestContext, responseContext);
+
+ }
+
+ private void updateResponseHeaders(ContainerRequestContext requestContext,
+ ContainerResponseContext responseContext) {
+ responseContext.getHeaders().add(AAIHeaderProperties.AAI_TX_ID, requestContext.getProperty(AAIHeaderProperties.AAI_TX_ID));
+ }
+
+}
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/post/ResponseTransactionLogging.java b/aai-resources/src/main/java/org/onap/aai/interceptors/post/ResponseTransactionLogging.java
new file mode 100644
index 0000000..964c436
--- /dev/null
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/post/ResponseTransactionLogging.java
@@ -0,0 +1,127 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.interceptors.post;
+
+import java.io.IOException;
+import java.util.Objects;
+import java.util.Optional;
+
+import javax.annotation.Priority;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerResponseContext;
+import javax.ws.rs.container.ContainerResponseFilter;
+
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.interceptors.AAIContainerFilter;
+import org.onap.aai.interceptors.AAIHeaderProperties;
+import org.onap.aai.logging.ErrorLogHelper;
+import org.onap.aai.util.AAIConfig;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.google.gson.JsonObject;
+
+@Priority(AAIResponseFilterPriority.RESPONSE_TRANS_LOGGING)
+public class ResponseTransactionLogging extends AAIContainerFilter implements ContainerResponseFilter {
+
+ private static final EELFLogger TRANSACTION_LOGGER = EELFManager.getInstance().getLogger(ResponseTransactionLogging.class);
+
+ @Autowired
+ private HttpServletResponse httpServletResponse;
+
+ @Override
+ public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
+ throws IOException {
+
+ this.transLogging(requestContext, responseContext);
+
+ }
+
+ private void transLogging(ContainerRequestContext requestContext, ContainerResponseContext responseContext) {
+
+ String logValue;
+ String getValue;
+ String postValue;
+
+ try {
+ logValue = AAIConfig.get("aai.transaction.logging");
+ getValue = AAIConfig.get("aai.transaction.logging.get");
+ postValue = AAIConfig.get("aai.transaction.logging.post");
+ } catch (AAIException e) {
+ return;
+ }
+
+ String transId = requestContext.getHeaderString(AAIHeaderProperties.TRANSACTION_ID);
+ String fromAppId = requestContext.getHeaderString(AAIHeaderProperties.FROM_APP_ID);
+ String fullUri = requestContext.getUriInfo().getRequestUri().toString();
+ String requestTs = (String)requestContext.getProperty(AAIHeaderProperties.AAI_REQUEST_TS);
+
+ String httpMethod = requestContext.getMethod();
+
+ String status = Integer.toString(responseContext.getStatus());
+
+ String request = (String)requestContext.getProperty(AAIHeaderProperties.AAI_REQUEST);
+ String response = this.getResponseString(responseContext);
+
+ if (!Boolean.parseBoolean(logValue)) {
+ } else if (!Boolean.parseBoolean(getValue) && "GET".equals(httpMethod)) {
+ } else if (!Boolean.parseBoolean(postValue) && "POST".equals(httpMethod)) {
+ } else {
+
+ JsonObject logEntry = new JsonObject();
+ logEntry.addProperty("transactionId", transId);
+ logEntry.addProperty("status", status);
+ logEntry.addProperty("rqstDate", requestTs);
+ logEntry.addProperty("respDate", this.genDate());
+ logEntry.addProperty("sourceId", fromAppId + ":" + transId);
+ logEntry.addProperty("resourceId", fullUri);
+ logEntry.addProperty("resourceType", httpMethod);
+ logEntry.addProperty("rqstBuf", Objects.toString(request, ""));
+ logEntry.addProperty("respBuf", Objects.toString(response, ""));
+
+ try {
+ TRANSACTION_LOGGER.debug(logEntry.toString());
+ } catch (Exception e) {
+ ErrorLogHelper.logError("AAI_4000", "Exception writing transaction log.");
+ }
+ }
+
+ }
+
+ private String getResponseString(ContainerResponseContext responseContext) {
+ JsonObject response = new JsonObject();
+ response.addProperty("ID", responseContext.getHeaderString(AAIHeaderProperties.AAI_TX_ID));
+ response.addProperty("Content-Type", this.httpServletResponse.getContentType());
+ response.addProperty("Response-Code", responseContext.getStatus());
+ response.addProperty("Headers", responseContext.getHeaders().toString());
+ Optional<Object> entityOptional = Optional.ofNullable(responseContext.getEntity());
+ if(entityOptional.isPresent()){
+ response.addProperty("Entity", entityOptional.get().toString());
+ } else {
+ response.addProperty("Entity", "");
+ }
+ return response.toString();
+ }
+
+}
diff --git a/aai-resources/src/main/java/org/onap/aai/ajsc_aai/JaxrsUserService.java b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/AAIRequestFilterPriority.java
index a1cc2ca..823a5e6 100644
--- a/aai-resources/src/main/java/org/onap/aai/ajsc_aai/JaxrsUserService.java
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/AAIRequestFilterPriority.java
@@ -19,37 +19,21 @@
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-package org.onap.aai.ajsc_aai;
+package org.onap.aai.interceptors.pre;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import java.util.Map;
-import java.util.HashMap;
-
-@Path("/user")
-public class JaxrsUserService {
+public final class AAIRequestFilterPriority {
+
+ private AAIRequestFilterPriority() {}
- private static final Map<String,String> userIdToNameMap;
- static {
- userIdToNameMap = new HashMap<String,String>();
- userIdToNameMap.put("userID1","Name1");
- userIdToNameMap.put("userID2","Name2");
- }
+ public static final int REQUEST_TRANS_LOGGING = 1000;
- /**
- * Lookup user.
- *
- * @param userId the user id
- * @return the string
- */
- @GET
- @Path("/{userId}")
- @Produces("text/plain")
- public String lookupUser(@PathParam("userId") String userId) {
- String name = userIdToNameMap.get(userId);
- return name != null ? name : "unknown id";
- }
-
+ public static final int HEADER_VALIDATION = 2000;
+
+ public static final int SET_LOGGING_CONTEXT = 3000;
+
+ public static final int AUTHORIZATION = 4000;
+
+ public static final int HEADER_MANIPULATION = 5000;
+
+ public static final int REQUEST_MODIFICATION = 6000;
}
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/HeaderValidation.java b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/HeaderValidation.java
new file mode 100644
index 0000000..4a7e10a
--- /dev/null
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/HeaderValidation.java
@@ -0,0 +1,89 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.interceptors.pre;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.UUID;
+
+import javax.annotation.Priority;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.PreMatching;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.interceptors.AAIContainerFilter;
+import org.onap.aai.interceptors.AAIHeaderProperties;
+import org.onap.aai.logging.ErrorLogHelper;
+
+@PreMatching
+@Priority(AAIRequestFilterPriority.HEADER_VALIDATION)
+public class HeaderValidation extends AAIContainerFilter implements ContainerRequestFilter {
+
+ @Override
+ public void filter(ContainerRequestContext requestContext) throws IOException {
+
+ Optional<Response> oResp;
+
+ String transId = requestContext.getHeaderString(AAIHeaderProperties.TRANSACTION_ID);
+ String fromAppId = requestContext.getHeaderString(AAIHeaderProperties.FROM_APP_ID);
+
+ List<MediaType> acceptHeaderValues = requestContext.getAcceptableMediaTypes();
+
+ oResp = this.validateHeaderValuePresence(fromAppId, "AAI_4009", acceptHeaderValues);
+ if (oResp.isPresent()) {
+ requestContext.abortWith(oResp.get());
+ return;
+ }
+ oResp = this.validateHeaderValuePresence(transId, "AAI_4010", acceptHeaderValues);
+ if (oResp.isPresent()) {
+ requestContext.abortWith(oResp.get());
+ return;
+ }
+
+ if (!this.isValidUUID(transId)) {
+ transId = UUID.randomUUID().toString();
+ requestContext.getHeaders().get(AAIHeaderProperties.TRANSACTION_ID).clear();
+ requestContext.getHeaders().add(AAIHeaderProperties.TRANSACTION_ID, transId);
+ }
+
+ }
+
+ private Optional<Response> validateHeaderValuePresence(String value, String errorCode,
+ List<MediaType> acceptHeaderValues) {
+ Response response = null;
+ AAIException aaie;
+ if (value == null) {
+ aaie = new AAIException(errorCode);
+ return Optional.of(Response.status(aaie.getErrorObject().getHTTPResponseCode())
+ .entity(ErrorLogHelper.getRESTAPIErrorResponse(acceptHeaderValues, aaie, new ArrayList<>()))
+ .build());
+ }
+
+ return Optional.ofNullable(response);
+ }
+
+}
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestHeaderManipulation.java b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestHeaderManipulation.java
new file mode 100644
index 0000000..3d3e6e0
--- /dev/null
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestHeaderManipulation.java
@@ -0,0 +1,72 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.interceptors.pre;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.annotation.Priority;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.PreMatching;
+import javax.ws.rs.core.MultivaluedMap;
+
+import org.onap.aai.interceptors.AAIContainerFilter;
+import org.onap.aai.interceptors.AAIHeaderProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+
+@PreMatching
+@Priority(AAIRequestFilterPriority.HEADER_MANIPULATION)
+public class RequestHeaderManipulation extends AAIContainerFilter implements ContainerRequestFilter {
+
+ @Autowired
+ private HttpServletRequest httpServletRequest;
+
+ private static final Pattern versionedEndpoint = Pattern.compile("^/aai/(v\\d+)");
+
+ @Override
+ public void filter(ContainerRequestContext requestContext) throws IOException {
+
+ String uri = httpServletRequest.getRequestURI();
+ this.addRequestContext(uri, requestContext.getHeaders());
+
+ }
+
+ private void addRequestContext(String uri, MultivaluedMap<String, String> requestHeaders) {
+
+ String rc = "";
+
+ Matcher match = versionedEndpoint.matcher(uri);
+ if (match.find()) {
+ rc = match.group(1);
+ }
+
+ if (requestHeaders.containsKey(AAIHeaderProperties.REQUEST_CONTEXT)) {
+ requestHeaders.remove(AAIHeaderProperties.REQUEST_CONTEXT);
+ }
+ requestHeaders.put(AAIHeaderProperties.REQUEST_CONTEXT, Collections.singletonList(rc));
+ }
+
+}
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestModification.java b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestModification.java
new file mode 100644
index 0000000..812bf1b
--- /dev/null
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestModification.java
@@ -0,0 +1,78 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.interceptors.pre;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import javax.annotation.Priority;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.PreMatching;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.UriBuilder;
+
+import org.onap.aai.interceptors.AAIContainerFilter;
+
+@PreMatching
+@Priority(AAIRequestFilterPriority.HEADER_VALIDATION)
+public class RequestModification extends AAIContainerFilter implements ContainerRequestFilter {
+
+ @Override
+ public void filter(ContainerRequestContext requestContext) throws IOException {
+
+ this.cleanDME2QueryParams(requestContext);
+
+ }
+
+ private void cleanDME2QueryParams(ContainerRequestContext request) {
+ UriBuilder builder = request.getUriInfo().getRequestUriBuilder();
+ MultivaluedMap<String, String> queries = request.getUriInfo().getQueryParameters();
+
+ String[] blacklist = { "version", "envContext", "routeOffer" };
+ Set<String> blacklistSet = Arrays.stream(blacklist).collect(Collectors.toSet());
+
+ boolean remove = true;
+
+ for (String param : blacklistSet) {
+ if (!queries.containsKey(param)) {
+ remove = false;
+ break;
+ }
+ }
+
+ if (remove) {
+ for (Map.Entry<String, List<String>> query : queries.entrySet()) {
+ String key = query.getKey();
+ if (blacklistSet.contains(key)) {
+ builder.replaceQueryParam(key);
+ }
+ }
+ }
+ request.setRequestUri(builder.build());
+ }
+
+}
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java
new file mode 100644
index 0000000..75103f5
--- /dev/null
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java
@@ -0,0 +1,106 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.interceptors.pre;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Random;
+import java.util.UUID;
+
+import javax.annotation.Priority;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.PreMatching;
+
+import org.glassfish.jersey.message.internal.ReaderWriter;
+import org.glassfish.jersey.server.ContainerException;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.interceptors.AAIContainerFilter;
+import org.onap.aai.interceptors.AAIHeaderProperties;
+import org.onap.aai.util.AAIConfig;
+import org.onap.aai.util.AAIConstants;
+import org.onap.aai.util.HbaseSaltPrefixer;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.google.gson.JsonObject;
+
+@PreMatching
+@Priority(AAIRequestFilterPriority.REQUEST_TRANS_LOGGING)
+public class RequestTransactionLogging extends AAIContainerFilter implements ContainerRequestFilter {
+
+ @Autowired
+ private HttpServletRequest httpServletRequest;
+
+ @Override
+ public void filter(ContainerRequestContext requestContext) throws IOException {
+
+ String currentTimeStamp = genDate();
+ String fullId = this.getAAITxIdToHeader(currentTimeStamp);
+ this.addToRequestContext(requestContext, AAIHeaderProperties.AAI_TX_ID, fullId);
+ this.addToRequestContext(requestContext, AAIHeaderProperties.AAI_REQUEST, this.getRequest(requestContext, fullId));
+ this.addToRequestContext(requestContext, AAIHeaderProperties.AAI_REQUEST_TS, currentTimeStamp);
+ }
+
+ private void addToRequestContext(ContainerRequestContext requestContext, String name, String aaiTxIdToHeader) {
+ requestContext.setProperty(name, aaiTxIdToHeader);
+ }
+
+ private String getAAITxIdToHeader(String currentTimeStamp) {
+ String txId = UUID.randomUUID().toString();
+ try {
+ txId = HbaseSaltPrefixer.getInstance().prependSalt(AAIConfig.get(AAIConstants.AAI_NODENAME) + "-"
+ + currentTimeStamp + "-" + new Random(System.currentTimeMillis()).nextInt(99999));
+ } catch (AAIException e) {
+ }
+
+ return txId;
+ }
+
+ private String getRequest(ContainerRequestContext requestContext, String fullId) {
+
+ JsonObject request = new JsonObject();
+ request.addProperty("ID", fullId);
+ request.addProperty("Http-Method", requestContext.getMethod());
+ request.addProperty("Content-Type", httpServletRequest.getContentType());
+ request.addProperty("Headers", requestContext.getHeaders().toString());
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ InputStream in = requestContext.getEntityStream();
+
+ try {
+ if (in.available() > 0) {
+ ReaderWriter.writeTo(in, out);
+ byte[] requestEntity = out.toByteArray();
+ request.addProperty("Payload", new String(requestEntity, "UTF-8"));
+ requestContext.setEntityStream(new ByteArrayInputStream(requestEntity));
+ }
+ } catch (IOException ex) {
+ throw new ContainerException(ex);
+ }
+
+ return request.toString();
+ }
+
+}
diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/SetLoggingContext.java b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/SetLoggingContext.java
new file mode 100644
index 0000000..5c6a5e0
--- /dev/null
+++ b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/SetLoggingContext.java
@@ -0,0 +1,71 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.interceptors.pre;
+
+import java.io.IOException;
+
+import javax.annotation.Priority;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.PreMatching;
+
+import org.onap.aai.interceptors.AAIContainerFilter;
+import org.onap.aai.interceptors.AAIHeaderProperties;
+import org.onap.aai.logging.LoggingContext;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+
+@PreMatching
+@Priority(AAIRequestFilterPriority.SET_LOGGING_CONTEXT)
+public class SetLoggingContext extends AAIContainerFilter implements ContainerRequestFilter {
+
+ @Autowired
+ private Environment environment;
+
+ @Autowired
+ private HttpServletRequest httpServletRequest;
+
+ @Override
+ public void filter(ContainerRequestContext requestContext) throws IOException {
+
+ String uri = httpServletRequest.getRequestURI();
+ String queryString = httpServletRequest.getQueryString();
+
+ if(queryString != null && !queryString.isEmpty()){
+ uri = uri + "?" + queryString;
+ }
+
+ String httpMethod = requestContext.getMethod();
+ String transId = requestContext.getHeaderString(AAIHeaderProperties.TRANSACTION_ID);
+ String fromAppId = requestContext.getHeaderString(AAIHeaderProperties.FROM_APP_ID);
+
+ LoggingContext.init();
+ LoggingContext.requestId(transId);
+ LoggingContext.partnerName(fromAppId);
+ LoggingContext.targetEntity(environment.getProperty("spring.application.name"));
+ LoggingContext.component(fromAppId);
+ LoggingContext.serviceName(httpMethod + " " + uri);
+ LoggingContext.targetServiceName(httpMethod + " " + uri);
+ }
+
+}
diff --git a/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java
index 0c2ef9c..fbfa59e 100644
--- a/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java
+++ b/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java
@@ -24,9 +24,12 @@ package org.onap.aai.rest;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
+import java.util.Map.Entry;
import java.util.Set;
+import java.util.stream.Collectors;
import java.util.concurrent.Callable;
import javax.servlet.http.HttpServletRequest;
@@ -43,12 +46,13 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
-import org.apache.cxf.jaxrs.ext.PATCH;
+import io.swagger.jaxrs.PATCH;
import org.javatuples.Pair;
import org.onap.aai.dbmap.DBConnectionType;
import org.onap.aai.exceptions.AAIException;
@@ -240,7 +244,7 @@ public class LegacyMoxyConsumer extends RESTAPI {
@Path("/{uri: .+}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
- public Response getLegacy (String content, @PathParam("version")String versionParam, @PathParam("uri") @Encoded String uri, @DefaultValue("all") @QueryParam("depth") String depthParam, @DefaultValue("false") @QueryParam("cleanup") String cleanUp, @Context HttpHeaders headers, @Context UriInfo info, @Context HttpServletRequest req) {
+ public Response getLegacy (String content, @DefaultValue("-1") @QueryParam("resultIndex") String resultIndex, @DefaultValue("-1") @QueryParam("resultSize") String resultSize, @PathParam("version")String versionParam, @PathParam("uri") @Encoded String uri, @DefaultValue("all") @QueryParam("depth") String depthParam, @DefaultValue("false") @QueryParam("cleanup") String cleanUp, @Context HttpHeaders headers, @Context UriInfo info, @Context HttpServletRequest req) {
return runner(AAIConstants.AAI_CRUD_TIMEOUT_ENABLED,
AAIConstants.AAI_CRUD_TIMEOUT_APP,
AAIConstants.AAI_CRUD_TIMEOUT_LIMIT,
@@ -250,7 +254,7 @@ public class LegacyMoxyConsumer extends RESTAPI {
new Callable<Response>() {
@Override
public Response call() {
- return getLegacy(content, versionParam, uri, depthParam, cleanUp, headers, info, req, new HashSet<String>());
+ return getLegacy(content, versionParam, uri, depthParam, cleanUp, headers, info, req, new HashSet<String>(), resultIndex, resultSize);
}
}
);
@@ -270,7 +274,7 @@ public class LegacyMoxyConsumer extends RESTAPI {
* @param removeQueryParams
* @return
*/
- public Response getLegacy(String content, String versionParam, String uri, String depthParam, String cleanUp, HttpHeaders headers, UriInfo info, HttpServletRequest req, Set<String> removeQueryParams) {
+ public Response getLegacy(String content, String versionParam, String uri, String depthParam, String cleanUp, HttpHeaders headers, UriInfo info, HttpServletRequest req, Set<String> removeQueryParams, String resultIndex, String resultSize) {
String sourceOfTruth = headers.getRequestHeaders().getFirst("X-FromAppId");
String transId = headers.getRequestHeaders().getFirst("X-TransactionId");
String realTime = headers.getRequestHeaders().getFirst("Real-Time");
@@ -288,7 +292,7 @@ public class LegacyMoxyConsumer extends RESTAPI {
LoggingContext.serviceName(serviceName);
LoggingContext.targetEntity(TARGET_ENTITY);
LoggingContext.targetServiceName(serviceName);
-
+
try {
validateRequest(info);
Version version = Version.valueOf(versionParam);
@@ -298,37 +302,27 @@ public class LegacyMoxyConsumer extends RESTAPI {
loader = httpEntry.getLoader();
MultivaluedMap<String, String> params = info.getQueryParameters();
- RemoveDME2QueryParams dme2Workaround = new RemoveDME2QueryParams();
- //clear out all params not used for filtering
- params.remove("depth");
- params.remove("cleanup");
- params.remove("nodes-only");
- for (String queryParam : removeQueryParams) {
- params.remove(queryParam);
- }
- if (dme2Workaround.shouldRemoveQueryParams(params)) {
- dme2Workaround.removeQueryParams(params);
- }
+ params = removeNonFilterableParams(params);
uri = uri.split("\\?")[0];
-
+
URI uriObject = UriBuilder.fromPath(uri).build();
QueryParser uriQuery = dbEngine.getQueryBuilder().createQueryFromURI(uriObject, params);
String objType = "";
- if (!uriQuery.getContainerType().equals("")) {
- objType = uriQuery.getContainerType();
- } else {
- objType = uriQuery.getResultType();
- }
- Introspector obj = loader.introspectorFromName(objType);
- DBRequest request =
+ if (!uriQuery.getContainerType().equals("")) {
+ objType = uriQuery.getContainerType();
+ } else {
+ objType = uriQuery.getResultType();
+ }
+ Introspector obj = loader.introspectorFromName(objType);
+ DBRequest request =
new DBRequest.Builder(HttpMethod.GET, uriObject, uriQuery, obj, headers, info, transId).build();
List<DBRequest> requests = new ArrayList<>();
requests.add(request);
- Pair<Boolean, List<Pair<URI, Response>>> responsesTuple = httpEntry.process(requests, sourceOfTruth);
-
+ Pair<Boolean, List<Pair<URI, Response>>> responsesTuple = httpEntry.process(requests, sourceOfTruth);
+
response = responsesTuple.getValue1().get(0).getValue1();
} catch (AAIException e) {
@@ -349,6 +343,21 @@ public class LegacyMoxyConsumer extends RESTAPI {
return response;
}
+
+ private MultivaluedMap<String, String> removeNonFilterableParams(MultivaluedMap<String, String> params) {
+
+ String[] toRemove = { "depth", "cleanup", "nodes-only", "format", "resultIndex", "resultSize"};
+ Set<String> toRemoveSet = Arrays.stream(toRemove).collect(Collectors.toSet());
+
+ MultivaluedMap<String, String> cleanedParams = new MultivaluedHashMap<>();
+ params.keySet().stream().forEach(k -> {
+ if (!toRemoveSet.contains(k)) {
+ cleanedParams.addAll(k, params.get(k));
+ }
+ });
+
+ return cleanedParams;
+ }
/**
* Delete.
*
@@ -584,7 +593,7 @@ public class LegacyMoxyConsumer extends RESTAPI {
LoggingContext.requestId(transId);
LoggingContext.partnerName(sourceOfTruth);
LoggingContext.targetEntity(TARGET_ENTITY);
-
+
try {
validateRequest(info);
diff --git a/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkUriInfo.java b/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkUriInfo.java
index 2bff084..3153a1c 100644
--- a/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkUriInfo.java
+++ b/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkUriInfo.java
@@ -3,16 +3,12 @@ package org.onap.aai.rest.bulk;
import java.net.URI;
import java.util.List;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.PathSegment;
-import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.core.*;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
public class BulkUriInfo implements UriInfo {
- private MultivaluedMap<String, String> queryParams= new MultivaluedMapImpl();
+ private MultivaluedMap<String, String> queryParams= new MultivaluedHashMap<>();
@Override
public String getPath() {
@@ -98,7 +94,17 @@ public class BulkUriInfo implements UriInfo {
public List<Object> getMatchedResources() {
return null;
}
-
+
+ @Override
+ public URI resolve(URI uri) {
+ return null;
+ }
+
+ @Override
+ public URI relativize(URI uri) {
+ return null;
+ }
+
public void addParams(String key, List<String> list) {
this.queryParams.put(key, list);
}
diff --git a/aai-resources/src/main/java/org/onap/aai/rest/retired/RetiredConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/retired/RetiredConsumer.java
index 0188142..6a3b0a5 100644
--- a/aai-resources/src/main/java/org/onap/aai/rest/retired/RetiredConsumer.java
+++ b/aai-resources/src/main/java/org/onap/aai/rest/retired/RetiredConsumer.java
@@ -35,8 +35,7 @@ import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
-import org.apache.cxf.jaxrs.ext.PATCH;
-
+import io.swagger.jaxrs.PATCH;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.logging.ErrorLogHelper;
import org.onap.aai.restcore.RESTAPI;
diff --git a/aai-resources/src/main/java/org/onap/aai/rest/util/EchoResponse.java b/aai-resources/src/main/java/org/onap/aai/rest/util/EchoResponse.java
index 55a07e4..b1e156c 100644
--- a/aai-resources/src/main/java/org/onap/aai/rest/util/EchoResponse.java
+++ b/aai-resources/src/main/java/org/onap/aai/rest/util/EchoResponse.java
@@ -21,8 +21,9 @@
*/
package org.onap.aai.rest.util;
-import java.util.ArrayList;
-import java.util.HashMap;
+import org.onap.aai.exceptions.AAIException;
+import org.onap.aai.logging.ErrorLogHelper;
+import org.onap.aai.restcore.RESTAPI;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
@@ -34,14 +35,13 @@ import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
-
-import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.logging.ErrorLogHelper;
-import org.onap.aai.restcore.RESTAPI;
+import java.util.ArrayList;
+import java.util.HashMap;
/**
* The Class EchoResponse.
*/
+@Path("/util")
public class EchoResponse extends RESTAPI {
protected static String authPolicyFunctionName = "util";
@@ -60,7 +60,7 @@ public class EchoResponse extends RESTAPI {
*/
@GET
@Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Path(echoPath)
+ @Path("/echo")
public Response echoResult(@Context HttpHeaders headers, @Context HttpServletRequest req,
@QueryParam("action") String myAction) {
Response response = null;
diff --git a/aai-resources/src/main/java/org/onap/aai/util/AAIAppServletContextListener.java b/aai-resources/src/main/java/org/onap/aai/util/AAIAppServletContextListener.java
deleted file mode 100644
index 0fcce0b..0000000
--- a/aai-resources/src/main/java/org/onap/aai/util/AAIAppServletContextListener.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.aai.util;
-
-import java.io.IOException;
-import java.util.UUID;
-
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-
-import org.onap.aai.dbmap.AAIGraph;
-import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.introspection.ModelInjestor;
-import org.onap.aai.logging.ErrorLogHelper;
-import org.onap.aai.logging.LogFormatTools;
-import org.onap.aai.logging.LoggingContext;
-import org.onap.aai.logging.LoggingContext.StatusCode;
-import org.onap.aai.migration.MigrationControllerInternal;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class AAIAppServletContextListener implements ServletContextListener {
-
- private static final String ACTIVEMQ_TCP_URL = "tcp://localhost:61447";
-
- private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(AAIAppServletContextListener.class.getName());
-
- /**
- * Destroys Context
- *
- * @param arg0 the ServletContextEvent
- */
- public void contextDestroyed(ServletContextEvent arg0) {
- }
-
- /**
- * Initializes Context
- *
- * @param arg0 the ServletContextEvent
- */
- public void contextInitialized(ServletContextEvent arg0) {
- System.setProperty("org.onap.aai.serverStarted", "false");
- System.setProperty("aai.service.name", "resources");
-
- LoggingContext.save();
- LoggingContext.component("init");
- LoggingContext.partnerName("NA");
- LoggingContext.targetEntity("aai-resources");
- LoggingContext.requestId(UUID.randomUUID().toString());
- LoggingContext.serviceName("aai-resources");
- LoggingContext.targetServiceName("contextInitialized");
- LoggingContext.statusCode(StatusCode.COMPLETE);
-
- LOGGER.info("AAI Server initialization started...");
- try {
- LOGGER.info("Loading aaiconfig.properties");
- AAIConfig.init();
-
- LOGGER.info("Loading error.properties");
- ErrorLogHelper.loadProperties();
-
- LOGGER.info("Loading graph database");
-
- AAIGraph.getInstance();
- ModelInjestor.getInstance();
-
- // Jsm internal broker for aai events
-
- LOGGER.info("A&AI Server initialization succcessful.");
- System.setProperty("activemq.tcp.url", ACTIVEMQ_TCP_URL);
- System.setProperty("org.onap.aai.serverStarted", "true");
- if ("true".equals(AAIConfig.get("aai.run.migrations", "false"))) {
- MigrationControllerInternal migrations = new MigrationControllerInternal();
- migrations.run(new String[]{"--commit"});
- }
-
- Runtime.getRuntime().addShutdownHook(new Thread() {
- public void run() {
- LOGGER.info("AAIGraph shutting down");
- AAIGraph.getInstance().graphShutdown();
- LOGGER.info("AAIGraph shutdown");
- System.out.println("Shutdown hook triggered.");
- }
- });
-
- } catch (AAIException e) {
- ErrorLogHelper.logException(e);
- throw new RuntimeException("AAIException caught while initializing A&AI server", e);
- } catch (IOException e) {
- ErrorLogHelper.logError("AAI_4000", e.getMessage());
- throw new RuntimeException("IOException caught while initializing A&AI server", e);
- } catch (Exception e) {
- LOGGER.error("Unknown failure while initializing A&AI Server " + LogFormatTools.getStackTop(e));
- throw new RuntimeException("Unknown failure while initializing A&AI server", e);
- }
-
- LOGGER.info("Resources MicroService Started");
- LOGGER.debug("Resources MicroService Started");
- LoggingContext.restore();
- }
-}
diff --git a/aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java b/aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java
new file mode 100644
index 0000000..8863d79
--- /dev/null
+++ b/aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java
@@ -0,0 +1,151 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.web;
+
+import org.glassfish.jersey.filter.LoggingFilter;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.servlet.ServletProperties;
+import org.onap.aai.rest.*;
+import org.onap.aai.rest.retired.V7V8Models;
+import org.onap.aai.rest.retired.V7V8NamedQueries;
+import org.onap.aai.rest.tools.ModelVersionTransformer;
+import org.onap.aai.rest.util.EchoResponse;
+import org.reflections.Reflections;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Profile;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Priority;
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.ContainerResponseFilter;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Logger;
+import java.util.stream.Collectors;
+
+@Component
+@ApplicationPath("/aai")
+public class JerseyConfiguration extends ResourceConfig {
+
+ private static final Logger log = Logger.getLogger(JerseyConfiguration.class.getName());
+
+ private Environment env;
+
+ @Autowired
+ public JerseyConfiguration(Environment env) {
+
+ this.env = env;
+
+ register(EchoResponse.class);
+ register(VertexIdConsumer.class);
+ register(ExampleConsumer.class);
+ register(BulkAddConsumer.class);
+ register(BulkProcessConsumer.class);
+ register(LegacyMoxyConsumer.class);
+ register(URLFromVertexIdConsumer.class);
+ register(V7V8Models.class);
+ register(V7V8NamedQueries.class);
+ register(ModelVersionTransformer.class);
+
+ //Request Filters
+ registerFiltersForRequests();
+ // Response Filters
+ registerFiltersForResponses();
+
+ property(ServletProperties.FILTER_FORWARD_ON_404, true);
+
+ // Following registers the request headers and response headers
+ // If the LoggingFilter second argument is set to true, it will print response value as well
+ if ("true".equalsIgnoreCase(env.getProperty("aai.request.logging.enabled"))) {
+ register(new LoggingFilter(log, false));
+ }
+ }
+
+ public void registerFiltersForRequests() {
+
+ // Find all the classes within the interceptors package
+ Reflections reflections = new Reflections("org.onap.aai.interceptors");
+ // Filter them based on the clazz that was passed in
+ Set<Class<? extends ContainerRequestFilter>> filters = reflections.getSubTypesOf(ContainerRequestFilter.class);
+
+
+ // Check to ensure that each of the filter has the @Priority annotation and if not throw exception
+ for (Class filterClass : filters) {
+ if (filterClass.getAnnotation(Priority.class) == null) {
+ throw new RuntimeException("Container filter " + filterClass.getName() + " does not have @Priority annotation");
+ }
+ }
+
+ // Turn the set back into a list
+ List<Class<? extends ContainerRequestFilter>> filtersList = filters
+ .stream()
+ .filter(f -> {
+ if (f.isAnnotationPresent(Profile.class)
+ && !env.acceptsProfiles(f.getAnnotation(Profile.class).value())) {
+ return false;
+ }
+ return true;
+ })
+ .collect(Collectors.toList());
+
+ // Sort them by their priority levels value
+ filtersList.sort((c1, c2) -> Integer.valueOf(c1.getAnnotation(Priority.class).value()).compareTo(c2.getAnnotation(Priority.class).value()));
+
+ // Then register this to the jersey application
+ filtersList.forEach(this::register);
+ }
+
+ public void registerFiltersForResponses() {
+
+ // Find all the classes within the interceptors package
+ Reflections reflections = new Reflections("org.onap.aai.interceptors");
+ // Filter them based on the clazz that was passed in
+ Set<Class<? extends ContainerResponseFilter>> filters = reflections.getSubTypesOf(ContainerResponseFilter.class);
+
+
+ // Check to ensure that each of the filter has the @Priority annotation and if not throw exception
+ for (Class filterClass : filters) {
+ if (filterClass.getAnnotation(Priority.class) == null) {
+ throw new RuntimeException("Container filter " + filterClass.getName() + " does not have @Priority annotation");
+ }
+ }
+
+ // Turn the set back into a list
+ List<Class<? extends ContainerResponseFilter>> filtersList = filters.stream()
+ .filter(f -> {
+ if (f.isAnnotationPresent(Profile.class)
+ && !env.acceptsProfiles(f.getAnnotation(Profile.class).value())) {
+ return false;
+ }
+ return true;
+ })
+ .collect(Collectors.toList());
+
+ // Sort them by their priority levels value
+ filtersList.sort((c1, c2) -> Integer.valueOf(c1.getAnnotation(Priority.class).value()).compareTo(c2.getAnnotation(Priority.class).value()));
+
+ // Then register this to the jersey application
+ filtersList.forEach(this::register);
+ }
+}
diff --git a/aai-resources/src/main/java/org/onap/aai/web/LocalHostAccessLog.java b/aai-resources/src/main/java/org/onap/aai/web/LocalHostAccessLog.java
new file mode 100644
index 0000000..4201a79
--- /dev/null
+++ b/aai-resources/src/main/java/org/onap/aai/web/LocalHostAccessLog.java
@@ -0,0 +1,60 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.web;
+
+import ch.qos.logback.access.jetty.RequestLogImpl;
+import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.server.handler.RequestLogHandler;
+import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
+import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
+import org.springframework.boot.context.embedded.jetty.JettyServerCustomizer;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.Arrays;
+
+@Configuration
+public class LocalHostAccessLog {
+
+ @Bean
+ public EmbeddedServletContainerFactory jettyConfigBean(){
+ JettyEmbeddedServletContainerFactory jef = new JettyEmbeddedServletContainerFactory();
+ jef.addServerCustomizers((JettyServerCustomizer) server -> {
+
+ HandlerCollection handlers = new HandlerCollection();
+
+ Arrays.stream(server.getHandlers()).forEach(handlers::addHandler);
+
+ RequestLogHandler requestLogHandler = new RequestLogHandler();
+ requestLogHandler.setServer(server);
+
+ RequestLogImpl requestLogImpl = new RequestLogImpl();
+ requestLogImpl.setResource("/localhost-access-logback.xml");
+ requestLogImpl.start();
+
+ requestLogHandler.setRequestLog(requestLogImpl);
+ handlers.addHandler(requestLogHandler);
+ server.setHandler(handlers);
+ });
+ return jef;
+ }
+}
diff --git a/aai-resources/src/main/java/org/onap/aai/web/WebConfiguration.java b/aai-resources/src/main/java/org/onap/aai/web/WebConfiguration.java
new file mode 100644
index 0000000..aaa3998
--- /dev/null
+++ b/aai-resources/src/main/java/org/onap/aai/web/WebConfiguration.java
@@ -0,0 +1,48 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.web;
+
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.context.annotation.Configuration;
+//import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+//import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+//
+//@Configuration
+//public class WebConfiguration {
+//
+// @Bean
+// public WebMvcConfigurerAdapter forwardToIndex() {
+// return new WebMvcConfigurerAdapter() {
+// @Override
+// public void addViewControllers(ViewControllerRegistry registry) {
+// registry.addViewController("/swagger").setViewName(
+// "redirect:/swagger/index.html");
+// registry.addViewController("/swagger/").setViewName(
+// "redirect:/swagger/index.html");
+// registry.addViewController("/docs").setViewName(
+// "redirect:/docs/html/index.html");
+// registry.addViewController("/docs/").setViewName(
+// "redirect:/docs/html/index.html");
+// }
+// };
+// }
+//}
diff --git a/aai-resources/src/main/jenkins/Jenkinsfile b/aai-resources/src/main/jenkins/Jenkinsfile
new file mode 100644
index 0000000..c74d439
--- /dev/null
+++ b/aai-resources/src/main/jenkins/Jenkinsfile
@@ -0,0 +1,31 @@
+node ("${BUILD_SLAVE}") {
+ // get the jenkinsfile root directory
+ def rootDir = pwd()
+
+ def JAVA_HOME = tool 'jdk180'
+ env.PATH = "${JAVA_HOME}/bin:${env.PATH}"
+ sh 'which java'
+ sh 'java -version'
+
+ env.DOCKER_HOST="tcp://localhost:4243"
+
+ // load external groovy scripts
+ def build
+ def checkout
+ def deploy
+ dir('tmp') {
+ git url: "${GIT_URL}", branch: "${GIT_BRANCH}"
+ checkout = load 'src/main/jenkins/checkout.groovy'
+ build = load 'src/main/jenkins/build.groovy'
+ deploy = load 'src/main/jenkins/deploy.groovy'
+ }
+
+ // check out code from git
+ checkout.gitCheckout()
+
+ // build the git project
+ build.buildProject()
+
+ deploy.deployService()
+
+} \ No newline at end of file
diff --git a/aai-resources/src/main/jenkins/build.groovy b/aai-resources/src/main/jenkins/build.groovy
new file mode 100644
index 0000000..3170510
--- /dev/null
+++ b/aai-resources/src/main/jenkins/build.groovy
@@ -0,0 +1,14 @@
+
+
+def buildProject() {
+ stage 'Build Git Project'
+ wrap([$class: 'ConfigFileBuildWrapper', managedFiles: [[fileId: 'eb0c7cc1-e851-4bc2-9401-2680c225f88c', targetLocation: '', variable: 'MAVEN_SETTINGS']]]) {
+ mvn '-s $MAVEN_SETTINGS -f pom.xml'
+}
+}
+
+def mvn(args) {
+ sh "${tool 'maven3'}/bin/mvn ${args} ${MAVEN_GOALS}"
+}
+
+return this \ No newline at end of file
diff --git a/aai-resources/src/main/jenkins/checkout.groovy b/aai-resources/src/main/jenkins/checkout.groovy
new file mode 100644
index 0000000..ed439ec
--- /dev/null
+++ b/aai-resources/src/main/jenkins/checkout.groovy
@@ -0,0 +1,14 @@
+
+def gitCheckout() {
+ stage 'Checkout GIT'
+ //different ways to checkout
+ //checkout from master
+ //git "url: ${GIT_URL}, branch: ${GIT_BRANCH}"
+ //checkout from branch hardcoding"
+ //git branch: 'jenkins_deploy_test', credentialsId: 'b9bbafe5-53ce-4d2c-8b84-09137f75c592', url: 'https://codecloud.web.att.com/scm/st_ocnp/sdk-java-starter.git'
+ //checkout from branch parameters with credentials
+ //git branch: "${GIT_BRANCH}", credentialsId: 'b9bbafe5-53ce-4d2c-8b84-09137f75c592', url: "${GIT_URL}"
+ //checkout from branch parameters with no credentials
+ git branch: "${GIT_BRANCH}", url: "${GIT_URL}"
+}
+return this \ No newline at end of file
diff --git a/aai-resources/src/main/jenkins/deploy.groovy b/aai-resources/src/main/jenkins/deploy.groovy
new file mode 100644
index 0000000..1a000e3
--- /dev/null
+++ b/aai-resources/src/main/jenkins/deploy.groovy
@@ -0,0 +1,15 @@
+def deployService(){
+ stage 'Deploying Service'
+
+ // get the jenkinsfile root directory
+ def ROOT_DIR = pwd()
+ ROOT_DIR = "${ROOT_DIR}"+'/src/main/kubernetes'
+ echo "ROOTDIR : ${ROOT_DIR}"
+ sh "/opt/app/kubernetes/v1.3.4/bin/kubectl --kubeconfig=${ROOT_DIR}/kubectl.conf replace --force --cascade -f ${ROOT_DIR}/${artifactId}-svc.yaml"
+ sh "/opt/app/kubernetes/v1.3.4/bin/kubectl --kubeconfig=${ROOT_DIR}/kubectl.conf replace --force --cascade -f ${ROOT_DIR}/${artifactId}-rc.yaml"
+}
+return this
+
+
+
+
diff --git a/aai-resources/src/main/kubernetes/ajsc6configdemo-rc.yaml b/aai-resources/src/main/kubernetes/ajsc6configdemo-rc.yaml
new file mode 100644
index 0000000..9addfe3
--- /dev/null
+++ b/aai-resources/src/main/kubernetes/ajsc6configdemo-rc.yaml
@@ -0,0 +1,28 @@
+apiVersion: v1
+kind: ReplicationController
+metadata:
+ name: ajsc6configdemo
+ namespace: org-onap-aai
+spec:
+ replicas: 5
+ selector:
+ app: ajsc6configdemo
+ template:
+ metadata:
+ labels:
+ app: ajsc6configdemo
+ spec:
+ serviceAccount: ajsc-svc-account
+ containers:
+ - name: ajsc6configdemo
+ volumeMounts:
+ - name: myservice-properties-volume
+ mountPath: /etc/config/dynamic
+ image: zlp11313.vci.att.com:5100/com.att.ajsc/ajsc6configdemo:latest
+ imagePullPolicy: Always
+ ports:
+ - containerPort: 8080
+ volumes:
+ - name: myservice-properties-volume
+ configMap:
+ name: ajsc6configdemo-dynamic-properties \ No newline at end of file
diff --git a/aai-resources/src/main/kubernetes/ajsc6configdemo-svc.yaml b/aai-resources/src/main/kubernetes/ajsc6configdemo-svc.yaml
new file mode 100644
index 0000000..f20e5b9
--- /dev/null
+++ b/aai-resources/src/main/kubernetes/ajsc6configdemo-svc.yaml
@@ -0,0 +1,21 @@
+{
+ "kind": "Service",
+ "apiVersion": "v1",
+ "metadata": {
+ "name": "ajsc6configdemo",
+ "namespace": "org-onap-aai"
+ },
+ "spec": {
+ "selector": {
+ "app": "ajsc6configdemo"
+ },
+ "ports": [
+ {
+ "protocol": "TCP",
+ "port": 80,
+ "targetPort": 8080
+ }
+ ],
+ "type": "NodePort"
+ }
+}
diff --git a/aai-resources/src/main/kubernetes/ajsc6configdemo.yaml b/aai-resources/src/main/kubernetes/ajsc6configdemo.yaml
new file mode 100644
index 0000000..545d7f6
--- /dev/null
+++ b/aai-resources/src/main/kubernetes/ajsc6configdemo.yaml
@@ -0,0 +1,8 @@
+apiVersion: v1
+data:
+ dynamic.properties: |
+ my.property.name=prod
+kind: ConfigMap
+metadata:
+ name: ajsc6configdemo-dynamic-properties
+ namespace: org-onap-aai \ No newline at end of file
diff --git a/aai-resources/src/main/kubernetes/kubectl.conf b/aai-resources/src/main/kubernetes/kubectl.conf
new file mode 100644
index 0000000..da4da58
--- /dev/null
+++ b/aai-resources/src/main/kubernetes/kubectl.conf
@@ -0,0 +1,22 @@
+current-context: baremetal-ajsc-01
+apiVersion: v1
+clusters:
+- cluster:
+ api-version: v1
+ server: https://hlxkvm022.vtil.att.com
+ insecure-skip-tls-verify: true
+ name: baremetal-ajsc-01
+contexts:
+- context:
+ cluster: baremetal-ajsc-01
+ namespace: org-onap-aai
+ user: m93659@ajsc.att.com
+ name: baremetal-ajsc-01
+kind: Config
+preferences:
+ colors: true
+users:
+- name: m93659@ajsc.att.com
+ user:
+ username: kube
+ password: F75I2d9bb16s
diff --git a/aai-resources/src/main/resources/application.properties b/aai-resources/src/main/resources/application.properties
new file mode 100644
index 0000000..05611c2
--- /dev/null
+++ b/aai-resources/src/main/resources/application.properties
@@ -0,0 +1,70 @@
+# The following info parameters are being referenced by ajsc6
+info.build.artifact=aai-resources
+info.build.name=resources
+info.build.description=Resources Microservice
+info.build.version=1.1.0
+
+spring.application.name=aai-resources
+spring.jersey.type=filter
+
+server.contextPath=/
+spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
+
+spring.profiles.active=production
+#The max number of active threads in this pool
+server.tomcat.max-threads=200
+#The minimum number of threads always kept alive
+server.tomcat.min-Spare-Threads=25
+#The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads
+server.tomcat.max-idle-time=60000
+
+
+#Add this properties only if you want to change the URL, AJSC Framework interceptors will intercept
+#com.att.ajsc.common.interceptors.PreInterceptor.url=/**
+#com.att.ajsc.common.interceptors.PostInterceptor.url=/**
+
+#Servlet context parameters
+server.context_parameters.p-name=value #context parameter with p-name as key and value as value.
+kubernetes.namespace=org-onap-aai
+
+# If you get an application startup failure that the port is already taken
+# If thats not it, please check if the key-store file path makes sense
+server.local.startpath=aai-resources/src/main/resources/
+server.basic.auth.location=${server.local.startpath}etc/auth/realm.properties
+
+server.port=8447
+server.ssl.enabled-protocols=TLSv1.1,TLSv1.2
+server.ssl.key-store=${server.local.startpath}etc/auth/aai_keystore
+server.ssl.key-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
+server.ssl.trust-store=${server.local.startpath}etc/auth/aai_keystore
+server.ssl.trust-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
+server.ssl.client-auth=want
+server.ssl.key-store-type=JKS
+
+# JMS bind address host port
+jms.bind.address=tcp://localhost:61647
+dmaap.ribbon.eureka.enabled=false
+dmaap.ribbon.listOfServers=localhost:3904
+# Number of milliseconds to wait before making ping requests again
+dmaap.ribbon.ServerListRefreshInterval=75000
+dmaap.ribbon.NFLoadBalancerPingInterval=75000
+dmaap.ribbon.NFLoadBalancerRuleClassName=com.netflix.loadbalancer.AvailabilityFilteringRule
+dmaap.ribbon.NFLoadBalancerPingClassName=org.onap.aai.config.HttpPingImpl
+dmaap.ribbon.EnableMarkingServerDownOnReachingFailureLimit=true
+dmaap.ribbon.ServerDownFailureLimit=1
+# This needs to be verified but it seems that adding this property should automatically
+# Make the dmaap client change the url from http to https depending on the server
+dmaap.ribbon.securePorts=3905
+
+# Custom Dmaap Specific Configuration
+dmaap.ribbon.health.endpoint=/topics/AAI-EVENT
+# Number of seconds to wait for the ping to work and might need to increase this if the pings are all failing
+dmaap.ribbon.pingport.timeout=3
+
+niws.loadbalancer.dmaap.filterCircuitTripped=true
+niws.loadbalancer.dmaap.connectionFailureCountThreshold=3
+niws.loadbalancer.dmaap.circuitTripMaxTimeoutSeconds=180
+#dmaap.ribbon.retryableStatusCodes=404,503
+#dmaap.ribbon.retryableStatusCodes.MaxAutoRetriesNextServer=2
+#dmaap.ribbon.retryableStatusCodes.MaxAutoRetries=2
+#dmaap.ribbon.retryableStatusCodes.OkToRetryOnAllOperations=true
diff --git a/aai-resources/src/main/resources/bootstrap.properties b/aai-resources/src/main/resources/bootstrap.properties
new file mode 100644
index 0000000..65a28ac
--- /dev/null
+++ b/aai-resources/src/main/resources/bootstrap.properties
@@ -0,0 +1,16 @@
+# Activate Spring Cloud Config Server functionality, these should remain false while using the file based implementation to prevent conflicts with properties pulled from a remote server.
+spring.cloud.config.discovery.enabled=false
+spring.cloud.config.enabled=false
+
+# Allow Spring Cloud properties configuration to override properties set from System Properties and ENV Properties
+spring.cloud.config.overrideSystemProperties=true
+
+# Path to the file containing the dynamic properties
+com.att.ajsc.dynamic.properties.path=/etc/config/dynamic/dynamic.properties
+
+
+# Path to the file containing the dynamic logger levels
+com.att.ajsc.dynamic.logging.path=/etc/config/logging/logging.properties
+
+# File watcher polling frequency in milliseconds
+com.att.ajsc.dynamic.watcher.delay=5000 \ No newline at end of file
diff --git a/aai-resources/src/main/resources/docker/Dockerfile.ext b/aai-resources/src/main/resources/docker/Dockerfile.ext
deleted file mode 100644
index 6beaf58..0000000
--- a/aai-resources/src/main/resources/docker/Dockerfile.ext
+++ /dev/null
@@ -1,76 +0,0 @@
-FROM ubuntu:14.04
-
-ENV DEBIAN_FRONTEND noninteractive
-
-RUN apt-get update && apt-get install -y software-properties-common
-
-# sudo -E is required to preserve the environment
-# If you remove that line, it will most like freeze at this step
-
-RUN sudo -E add-apt-repository ppa:openjdk-r/ppa && \
- apt-get update && \
- apt-get -qq install -y openjdk-8-jre-headless git curl ksh
-
-# Setup JAVA_HOME, this is useful for docker commandline
-ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
-
-# Install Chef
-RUN curl -LO https://packages.chef.io/stable/ubuntu/14.04/chefdk_0.17.17-1_amd64.deb
-RUN dpkg -i chefdk_0.17.17-1_amd64.deb
-RUN rm chefdk_0.17.17-1_amd64.deb
-
-# Add the application folder and common libs to /opt inside container
-# Add the chef script and startup script to docker container
-# Change the permissions to enable execute access
-
-ADD ./opt/app /opt/app
-ADD ./commonLibs/ /opt/app/commonLibs/
-
-ADD init-chef.sh /init-chef.sh
-ADD startup.sh /startup.sh
-ADD aai.sh /etc/profile.d/aai.sh
-
-RUN chmod 755 /init-chef.sh /startup.sh
-RUN chmod 644 /etc/profile.d/aai.sh
-
-# When the container is started this is the entrypoint script
-# that docker will run. Make sure this script doesn't end abruptly
-# If you want the container running even if the main application stops
-# You can run a ever lasting process like tail -f /dev/null
-# Or something like that at the end of the startup script
-# So if the main application you are planning on running fails
-# the docker container keeps on running forever
-
-ENTRYPOINT ./startup.sh
-
-# Expose the ports for outside linux to use
-# 8443 is the important one to be used
-
-EXPOSE 8443
-EXPOSE 8080
-
-# Create the directory structure of aai application resembling the development server
-# hard-coding path to match ajsc version
-
-RUN mkdir /opt/aaihome && \
- useradd -ms /bin/bash -d /opt/aaihome/aaiadmin aaiadmin && \
- ln -s /opt/app/${project.artifactId}/${project.version} /opt/app/aai && \
- chown aaiadmin:aaiadmin /opt/app/aai && \
- chown -R aaiadmin:aaiadmin /opt/app/${project.artifactId}/${project.version} && \
- mkdir -p /opt/aai/logroot && \
- chown -R aaiadmin:aaiadmin /opt/aai/logroot && \
- ln -s /opt/app/aai/bin scripts && \
- mkdir /opt/app/aai/extApps && chown -R aaiadmin:aaiadmin /opt/app/aai/extApps && \
- find /opt/app/aai/bin -name "*.sh" -exec chmod 755 {} +
-
-WORKDIR /var/chef
-
-RUN chown aaiadmin:aaiadmin /startup.sh && \
- chown -R aaiadmin:aaiadmin /var/chef
-
-RUN mkdir /opt/aai/logroot/AAI && chown aaiadmin:aaiadmin /opt/aai/logroot/AAI
-VOLUME /opt/aai/logroot/AAI
-
-WORKDIR /
-
-USER aaiadmin
diff --git a/aai-resources/src/main/resources/docker/commonLibs/README b/aai-resources/src/main/resources/docker/commonLibs/README
deleted file mode 100644
index 00e36c0..0000000
--- a/aai-resources/src/main/resources/docker/commonLibs/README
+++ /dev/null
@@ -1 +0,0 @@
-// this file's presence ensures commonLibs folder is present when image is created \ No newline at end of file
diff --git a/aai-resources/src/main/resources/docker/docker-entrypoint.sh b/aai-resources/src/main/resources/docker/docker-entrypoint.sh
deleted file mode 100644
index 695d515..0000000
--- a/aai-resources/src/main/resources/docker/docker-entrypoint.sh
+++ /dev/null
@@ -1,104 +0,0 @@
-#
-# ============LICENSE_START=======================================================
-# org.onap.aai
-# ================================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ============LICENSE_END=========================================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
-
-# Set the current path to be the application home and common libs home
-APP_HOME=$(pwd);
-COMMONLIBS_HOME="/opt/app/commonLibs";
-
-export CHEF_CONFIG_REPO=${CHEF_CONFIG_REPO:-aai-config};
-export CHEF_GIT_URL=${CHEF_GIT_URL:-http://gerrit.onap.org/r/aai};
-export CHEF_CONFIG_GIT_URL=${CHEF_CONFIG_GIT_URL:-$CHEF_GIT_URL};
-export CHEF_DATA_GIT_URL=${CHEF_DATA_GIT_URL:-$CHEF_GIT_URL};
-
-USER_ID=${LOCAL_USER_ID:-9001}
-
-if [ $(cat /etc/passwd | grep aaiadmin | wc -l) -eq 0 ]; then
- useradd --shell=/bin/bash -u ${USER_ID} -o -c "" -m aaiadmin || {
- echo "Unable to create the user id for ${USER_ID}";
- exit 1;
- }
-fi;
-
-chown -R aaiadmin:aaiadmin /opt/app /var/chef /opt/aai/logroot
-
-gosu aaiadmin ./init-chef.sh || {
- echo "Unable to run init chef script, please check logs";
- exit 1;
-}
-
-httpPort=8087;
-httpsPort=8447;
-
-AAI_CORE_JAR=$(ls ${APP_HOME}/extJars/aai-core*.jar);
-
-# Get the basename of the aai-core-X.Y.Z-SNAPSHOT.jar
-# Then extract the X.Y.Z-SNAPSHOT part
-AAI_CORE_VERSION=$(basename ${AAI_CORE_JAR} | grep -o '[0-9]*\.[0-9]*\.[0-9]*[^.]*');
-
-cd ${APP_HOME};
-
-CP=${COMMONLIBS_HOME}/*;
-CP="$CP":${APP_HOME}/etc;
-CP="$CP":${APP_HOME}/lib/*;
-CP="$CP":${APP_HOME}/extJars/logback-access-1.1.7.jar;
-CP="$CP":${APP_HOME}/extJars/logback-core-1.1.7.jar;
-CP="$CP":${AAI_CORE_JAR};
-
-# You can add additional jvm options by adding environment variable JVM_PRE_OPTS
-# If you need to add more jvm options at the end then you can use JVM_POST_OPTS
-JVM_OPTS="${JVM_PRE_OPTS} ${JVM_OPTS}";
-JVM_OPTS="${JVM_OPTS} -server -XX:NewSize=512m -XX:MaxNewSize=512m";
-JVM_OPTS="${JVM_OPTS} -XX:SurvivorRatio=8";
-JVM_OPTS="${JVM_OPTS} -XX:+DisableExplicitGC -verbose:gc -XX:+UseParNewGC";
-JVM_OPTS="${JVM_OPTS} -XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled";
-JVM_OPTS="${JVM_OPTS} -XX:+UseConcMarkSweepGC -XX:-UseBiasedLocking";
-JVM_OPTS="${JVM_OPTS} -XX:ParallelGCThreads=4";
-JVM_OPTS="${JVM_OPTS} -XX:LargePageSizeInBytes=128m ";
-JVM_OPTS="${JVM_OPTS} -XX:+PrintGCDetails -XX:+PrintGCTimeStamps";
-JVM_OPTS="${JVM_OPTS} -Xloggc:${APP_HOME}/logs/gc/graph-query_gc.log";
-JVM_OPTS="${JVM_OPTS} -XX:+HeapDumpOnOutOfMemoryError";
-JVM_OPTS="${JVM_OPTS} ${JVM_POST_OPTS}";
-
-# You can add additional java options by adding environment variable JAVA_PRE_OPTS
-# If you need to add more jvm options at the end then you can use JAVA_POST_OPTS
-JAVA_OPTS="${JAVA_PRE_OPTS} ${JAVA_OPTS}";
-JAVA_OPTS="${JAVA_OPTS} -Dsun.net.inetaddr.ttl=180";
-JAVA_OPTS="${JAVA_OPTS} -Dhttps.protocols=TLSv1.1,TLSv1.2";
-JAVA_OPTS="${JAVA_OPTS} -DSOACLOUD_SERVICE_VERSION=1.0.1";
-JAVA_OPTS="${JAVA_OPTS} -DAJSC_HOME=${APP_HOME}";
-JAVA_OPTS="${JAVA_OPTS} -DAJSC_CONF_HOME=${APP_HOME}/bundleconfig";
-JAVA_OPTS="${JAVA_OPTS} -DAJSC_SHARED_CONFIG=${APP_HOME}/bundleconfig";
-JAVA_OPTS="${JAVA_OPTS} -DAFT_HOME=${APP_HOME}";
-JAVA_OPTS="${JAVA_OPTS} -DAAI_CORE_VERSION=${AAI_CORE_VERSION}";
-JAVA_OPTS="${JAVA_OPTS} -Daai-core.version=${AAI_CORE_VERSION}";
-JAVA_OPTS="${JAVA_OPTS} -Dlogback.configurationFile=${APP_HOME}/bundleconfig/etc/logback.xml";
-JAVA_OPTS="${JAVA_OPTS} ${JAVA_POST_OPTS}";
-
-JAVA_ARGS="${JAVA_PRE_ARGS} ${JAVA_ARGS}";
-JAVA_ARGS="${JAVA_ARGS} context=/";
-JAVA_ARGS="${JAVA_ARGS} port=$httpPort";
-JAVA_ARGS="${JAVA_ARGS} sslport=$httpsPort";
-JAVA_ARGS="${JAVA_ARGS} ${JAVA_POST_ARGS}";
-
-JAVA_CMD="exec gosu aaiadmin java";
-# Run the following command as aai-admin using gosu and make that process main
-${JAVA_CMD} -cp ${CLASSPATH}:${CP} ${JVM_OPTS} ${JAVA_OPTS} com.att.ajsc.runner.Runner ${JAVA_ARGS} "$@"
diff --git a/aai-resources/src/main/resources/docker/init-chef.sh b/aai-resources/src/main/resources/docker/init-chef.sh
deleted file mode 100644
index 416c25f..0000000
--- a/aai-resources/src/main/resources/docker/init-chef.sh
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/bin/bash
-#
-# ============LICENSE_START=======================================================
-# org.onap.aai
-# ================================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ============LICENSE_END=========================================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
-
-##############################################################################
-# Script to initialize the chef-repo branch and.chef
-#
-##############################################################################
-
-cd /var/chef;
-
-if [ ! -d "aai-config" ]; then
-
- git clone --depth 1 -b ${CHEF_BRANCH} --single-branch ${CHEF_CONFIG_GIT_URL}/${CHEF_CONFIG_REPO}.git aai-config || {
- echo "Error: Unable to clone the aai-config repo with url: ${CHEF_GIT_URL}/${CHEF_CONFIG_REPO}.git";
- exit 1;
- }
-
-fi
-
-if [ -d "aai-config/cookbooks/aai-resources" ]; then
-
- (cd aai-config/cookbooks/aai-resources/ && \
- for f in $(ls); do mv $f ../; done && \
- cd ../ && rmdir aai-resources);
-
-fi;
-
-if [ ! -d "aai-data" ]; then
-
- git clone --depth 1 -b ${CHEF_BRANCH} --single-branch ${CHEF_DATA_GIT_URL}/aai-data.git aai-data || {
- echo "Error: Unable to clone the aai-data repo with url: ${CHEF_GIT_URL}";
- exit 1;
- }
-
-fi
-
-chef-solo \
- -c /var/chef/aai-data/chef-config/dev/.knife/solo.rb \
- -j /var/chef/aai-config/cookbooks/runlist-aai-resources.json \
- -E ${AAI_CHEF_ENV};
-
-TITAN_REALTIME="/opt/app/aai-resources/bundleconfig/etc/appprops/titan-realtime.properties";
-
-if [ ! -f ${TITAN_REALTIME} ]; then
- echo "Unable to find the titan realtime file";
- exit 1;
-fi
-
-HBASE_HOSTNAME=$(grep "storage.hostname" ${TITAN_REALTIME} | cut -d"=" -f2-);
-HBASE_PORT="${HBASE_PORT:-2181}";
-NUM_OF_RETRIES=${NUM_OF_RETRIES:-200};
-retry=0;
-
-# Tries to connect to hbase on port 2181 until success
-# or until the number of retries by default 500 times
-# with each time giving a sleep of 5 seconds between
-# each time it pings the port on that host
-
-while ! nc -z ${HBASE_HOSTNAME} ${HBASE_PORT} ;
-do
- if [ $retry -eq $NUM_OF_RETRIES ]; then
- echo "Unable to connect to hbase after $NUM_OF_RETRIES retries, please check if hbase server is properly configured and be able to connect";
- exit 1;
- fi;
-
- echo "Waiting for hbase to be up";
- sleep 5;
-
- retry=$((retry + 1));
-done
-
-HBASE_STARTUP_ARTIFICIAL_DELAY=${HBASE_STARTUP_ARTIFICIAL_DELAY:-50};
-
-# By default the artificial delay will be introduced
-# the user can override it by set DISABLE_HBASE_STARTUP_ARTIFICIAL_DELAY to some string
-
-if [ -z "${DISABLE_HBASE_STARTUP_ARTIFICIAL_DELAY}" ]; then
- sleep ${HBASE_STARTUP_ARTIFICIAL_DELAY};
-fi;
-
-/opt/app/aai-resources/bin/createDBSchema.sh || {
- echo "Error: Unable to create the db schema, please check if the hbase host is configured and up";
- exit 1;
-}
diff --git a/aai-resources/bundleconfig-local/etc/VNT-migration-data/VNT-migration-input.csv b/aai-resources/src/main/resources/etc/VNT-migration-data/VNT-migration-input.csv
index 916dced..916dced 100644
--- a/aai-resources/bundleconfig-local/etc/VNT-migration-data/VNT-migration-input.csv
+++ b/aai-resources/src/main/resources/etc/VNT-migration-data/VNT-migration-input.csv
diff --git a/aai-resources/bundleconfig-local/etc/appprops/Introscope.properties b/aai-resources/src/main/resources/etc/appprops/Introscope.properties
index 319381e..319381e 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/Introscope.properties
+++ b/aai-resources/src/main/resources/etc/appprops/Introscope.properties
diff --git a/aai-resources/bundleconfig-local/etc/appprops/PostProcessorInterceptors.properties b/aai-resources/src/main/resources/etc/appprops/PostProcessorInterceptors.properties
index ca31a26..ca31a26 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/PostProcessorInterceptors.properties
+++ b/aai-resources/src/main/resources/etc/appprops/PostProcessorInterceptors.properties
diff --git a/aai-resources/bundleconfig-local/etc/appprops/PreProcessorInterceptors.properties b/aai-resources/src/main/resources/etc/appprops/PreProcessorInterceptors.properties
index 1620bea..1620bea 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/PreProcessorInterceptors.properties
+++ b/aai-resources/src/main/resources/etc/appprops/PreProcessorInterceptors.properties
diff --git a/aai-resources/bundleconfig-local/etc/appprops/aaiconfig.properties b/aai-resources/src/main/resources/etc/appprops/aaiconfig.properties
index 84072f9..84072f9 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/aaiconfig.properties
+++ b/aai-resources/src/main/resources/etc/appprops/aaiconfig.properties
diff --git a/aai-resources/bundleconfig-local/etc/appprops/app-intercepts.properties b/aai-resources/src/main/resources/etc/appprops/app-intercepts.properties
index 3230921..3230921 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/app-intercepts.properties
+++ b/aai-resources/src/main/resources/etc/appprops/app-intercepts.properties
diff --git a/aai-resources/bundleconfig-local/etc/appprops/caet.properties b/aai-resources/src/main/resources/etc/appprops/caet.properties
index ac4960c..ac4960c 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/caet.properties
+++ b/aai-resources/src/main/resources/etc/appprops/caet.properties
diff --git a/aai-resources/bundleconfig-local/etc/appprops/createDBSchema-logback.xml b/aai-resources/src/main/resources/etc/appprops/createDBSchema-logback.xml
index 5fcdf9b..5fcdf9b 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/createDBSchema-logback.xml
+++ b/aai-resources/src/main/resources/etc/appprops/createDBSchema-logback.xml
diff --git a/aai-resources/bundleconfig-local/etc/appprops/dataGrooming-logback.xml b/aai-resources/src/main/resources/etc/appprops/dataGrooming-logback.xml
index d899d90..d899d90 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/dataGrooming-logback.xml
+++ b/aai-resources/src/main/resources/etc/appprops/dataGrooming-logback.xml
diff --git a/aai-resources/bundleconfig-local/etc/appprops/dataSnapshot-logback.xml b/aai-resources/src/main/resources/etc/appprops/dataSnapshot-logback.xml
index 9633971..9633971 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/dataSnapshot-logback.xml
+++ b/aai-resources/src/main/resources/etc/appprops/dataSnapshot-logback.xml
diff --git a/aai-resources/bundleconfig-local/etc/appprops/default-logback.xml b/aai-resources/src/main/resources/etc/appprops/default-logback.xml
index 655157b..655157b 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/default-logback.xml
+++ b/aai-resources/src/main/resources/etc/appprops/default-logback.xml
diff --git a/aai-resources/src/main/resources/etc/appprops/dupeTool-logback.xml b/aai-resources/src/main/resources/etc/appprops/dupeTool-logback.xml
new file mode 100644
index 0000000..8c3e977
--- /dev/null
+++ b/aai-resources/src/main/resources/etc/appprops/dupeTool-logback.xml
@@ -0,0 +1,62 @@
+<configuration>
+ <property name="logDirectory" value="${AJSC_HOME}/logs" />
+
+ <appender name="dupeToollog" class="ch.qos.logback.classic.sift.SiftingAppender">
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
+ <level>INFO</level>
+ <onMatch>ACCEPT</onMatch>
+ <onMismatch>DENY</onMismatch>
+ </filter>
+ <!-- This is MDC value -->
+ <!-- We will assign a value to 'logFilenameAppender' via Java code -->
+ <discriminator>
+ <key>logFilenameAppender</key>
+ <defaultValue>undefined</defaultValue>
+ </discriminator>
+ <sift>
+ <!-- A standard RollingFileAppender, the log file is based on 'logFileName'
+ at runtime -->
+ <appender name="FILE-${logFilenameAppender}"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/dupeTool/${logFilenameAppender}.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${logDirectory}/dupeTool/${logFilenameAppender}.log.%d{yyyy-MM-dd}
+ </fileNamePattern>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%m%n</pattern>
+ </encoder>
+ </appender>
+ </sift>
+ </appender>
+
+ <logger name="org.reflections" level="ERROR" additivity="false">
+ <appender-ref ref="dupeToollog" />
+ </logger>
+ <logger name="org.apache.zookeeper" level="ERROR" additivity="false">
+ <appender-ref ref="dupeToollog" />
+ </logger>
+ <logger name="org.apache.hadoop" level="ERROR" additivity="false">
+ <appender-ref ref="dupeToollog" />
+ </logger>
+ <logger name="com.thinkaurelius" level="ERROR" additivity="false">
+ <appender-ref ref="dupeToollog" />
+ </logger>
+ <logger name="ch.qos.logback.classic" level="ERROR" additivity="false">
+ <appender-ref ref="dupeToollog" />
+ </logger>
+ <logger name="ch.qos.logback.core" level="ERROR" additivity="false">
+ <appender-ref ref="dupeToollog" />
+ </logger>
+ <logger name="com.att.eelf" level="ERROR" additivity="false">
+ <appender-ref ref="dupeToollog" />
+ </logger>
+ <logger name="org.onap.aai" level="ERROR" additivity="false">
+ <appender-ref ref="dupeToollog" />
+ </logger>
+
+
+ <root level="INFO">
+ <appender-ref ref="dupeToollog" />
+ </root>
+</configuration> \ No newline at end of file
diff --git a/aai-resources/bundleconfig-local/etc/appprops/dynamic.properties b/aai-resources/src/main/resources/etc/appprops/dynamic.properties
index e8f9a90..e8f9a90 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/dynamic.properties
+++ b/aai-resources/src/main/resources/etc/appprops/dynamic.properties
diff --git a/aai-resources/bundleconfig-local/etc/appprops/dynamicPayloadGenerator-logback.xml b/aai-resources/src/main/resources/etc/appprops/dynamicPayloadGenerator-logback.xml
index 025b49b..025b49b 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/dynamicPayloadGenerator-logback.xml
+++ b/aai-resources/src/main/resources/etc/appprops/dynamicPayloadGenerator-logback.xml
diff --git a/aai-resources/bundleconfig-local/etc/appprops/error.properties b/aai-resources/src/main/resources/etc/appprops/error.properties
index ba71275..d3dbf9f 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/error.properties
+++ b/aai-resources/src/main/resources/etc/appprops/error.properties
@@ -166,6 +166,7 @@ AAI_9101=5:0:WARN:9101:403:3300:User is not authorized to perform function
#AAI_9106=5:0:WARN:9106:403:3300:Invalid AppId
#AAI_9107=5:0:WARN:9107:403:3300:No Username in Request
AAI_9107=5:0:WARN:9107:403:3300:SSL is not provided in request, please contact admin
+AAI_9108=5:0:WARN:9107:403:3300:Basic auth credentials is not provided in the request
#--- aaiinstar: 9201-9299
#AAI_9201=5:4:ERROR:9201:500:3002:Unable to send notification
diff --git a/aai-resources/bundleconfig-local/etc/appprops/forceDelete-logback.xml b/aai-resources/src/main/resources/etc/appprops/forceDelete-logback.xml
index 16ea13c..16ea13c 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/forceDelete-logback.xml
+++ b/aai-resources/src/main/resources/etc/appprops/forceDelete-logback.xml
diff --git a/aai-resources/bundleconfig-local/etc/appprops/getres-logback.xml b/aai-resources/src/main/resources/etc/appprops/getres-logback.xml
index 2a71a22..2a71a22 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/getres-logback.xml
+++ b/aai-resources/src/main/resources/etc/appprops/getres-logback.xml
diff --git a/aai-resources/bundleconfig-local/etc/appprops/loadDataForDHV-logback.xml b/aai-resources/src/main/resources/etc/appprops/loadDataForDHV-logback.xml
index cced385..cced385 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/loadDataForDHV-logback.xml
+++ b/aai-resources/src/main/resources/etc/appprops/loadDataForDHV-logback.xml
diff --git a/aai-resources/bundleconfig-local/etc/appprops/logging.properties b/aai-resources/src/main/resources/etc/appprops/logging.properties
index e029cc4..e029cc4 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/logging.properties
+++ b/aai-resources/src/main/resources/etc/appprops/logging.properties
diff --git a/aai-resources/bundleconfig-local/etc/appprops/methodMapper.properties b/aai-resources/src/main/resources/etc/appprops/methodMapper.properties
index bcacfa6..bcacfa6 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/methodMapper.properties
+++ b/aai-resources/src/main/resources/etc/appprops/methodMapper.properties
diff --git a/aai-resources/bundleconfig-local/etc/appprops/migration-logback.xml b/aai-resources/src/main/resources/etc/appprops/migration-logback.xml
index 74d3d04..74d3d04 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/migration-logback.xml
+++ b/aai-resources/src/main/resources/etc/appprops/migration-logback.xml
diff --git a/aai-resources/bundleconfig-local/etc/appprops/preferredRoute.txt b/aai-resources/src/main/resources/etc/appprops/preferredRoute.txt
index 662b0aa..662b0aa 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/preferredRoute.txt
+++ b/aai-resources/src/main/resources/etc/appprops/preferredRoute.txt
diff --git a/aai-resources/bundleconfig-local/etc/appprops/pullInvData-logback.xml b/aai-resources/src/main/resources/etc/appprops/pullInvData-logback.xml
index 098e1e7..098e1e7 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/pullInvData-logback.xml
+++ b/aai-resources/src/main/resources/etc/appprops/pullInvData-logback.xml
diff --git a/aai-resources/bundleconfig-local/etc/appprops/schemaMod-logback.xml b/aai-resources/src/main/resources/etc/appprops/schemaMod-logback.xml
index 0762ee1..0762ee1 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/schemaMod-logback.xml
+++ b/aai-resources/src/main/resources/etc/appprops/schemaMod-logback.xml
diff --git a/aai-resources/bundleconfig-local/etc/appprops/titan-cached.properties b/aai-resources/src/main/resources/etc/appprops/titan-cached.properties
index 3465453..3465453 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/titan-cached.properties
+++ b/aai-resources/src/main/resources/etc/appprops/titan-cached.properties
diff --git a/aai-resources/bundleconfig-local/etc/appprops/titan-realtime.properties b/aai-resources/src/main/resources/etc/appprops/titan-realtime.properties
index 869872c..869872c 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/titan-realtime.properties
+++ b/aai-resources/src/main/resources/etc/appprops/titan-realtime.properties
diff --git a/aai-resources/bundleconfig-local/etc/appprops/uniquePropertyCheck-logback.xml b/aai-resources/src/main/resources/etc/appprops/uniquePropertyCheck-logback.xml
index 5f44b1b..5f44b1b 100644
--- a/aai-resources/bundleconfig-local/etc/appprops/uniquePropertyCheck-logback.xml
+++ b/aai-resources/src/main/resources/etc/appprops/uniquePropertyCheck-logback.xml
diff --git a/aai-resources/src/main/resources/etc/auth/aai-client-cert.p12 b/aai-resources/src/main/resources/etc/auth/aai-client-cert.p12
new file mode 100644
index 0000000..9f2acc9
--- /dev/null
+++ b/aai-resources/src/main/resources/etc/auth/aai-client-cert.p12
Binary files differ
diff --git a/aai-resources/bundleconfig-local/etc/auth/aai_keystore b/aai-resources/src/main/resources/etc/auth/aai_keystore
index 1ddef0c..1ddef0c 100644
--- a/aai-resources/bundleconfig-local/etc/auth/aai_keystore
+++ b/aai-resources/src/main/resources/etc/auth/aai_keystore
Binary files differ
diff --git a/aai-resources/src/main/config/realm.properties b/aai-resources/src/main/resources/etc/auth/realm.properties
index fb692cc..fb692cc 100644
--- a/aai-resources/src/main/config/realm.properties
+++ b/aai-resources/src/main/resources/etc/auth/realm.properties
diff --git a/aai-resources/bundleconfig-local/etc/scriptdata/tenant_isolation/nodes.json b/aai-resources/src/main/resources/etc/scriptdata/tenant_isolation/nodes.json
index 5c28c8b..5c28c8b 100644
--- a/aai-resources/bundleconfig-local/etc/scriptdata/tenant_isolation/nodes.json
+++ b/aai-resources/src/main/resources/etc/scriptdata/tenant_isolation/nodes.json
diff --git a/aai-resources/bundleconfig-local/etc/scriptdata/tenant_isolation/nodesAZCloud.json b/aai-resources/src/main/resources/etc/scriptdata/tenant_isolation/nodesAZCloud.json
index b955757..b955757 100644
--- a/aai-resources/bundleconfig-local/etc/scriptdata/tenant_isolation/nodesAZCloud.json
+++ b/aai-resources/src/main/resources/etc/scriptdata/tenant_isolation/nodesAZCloud.json
diff --git a/aai-resources/bundleconfig-local/etc/scriptdata/tenant_isolation/nodesNoAZ.json b/aai-resources/src/main/resources/etc/scriptdata/tenant_isolation/nodesNoAZ.json
index a0dfae5..a0dfae5 100644
--- a/aai-resources/bundleconfig-local/etc/scriptdata/tenant_isolation/nodesNoAZ.json
+++ b/aai-resources/src/main/resources/etc/scriptdata/tenant_isolation/nodesNoAZ.json
diff --git a/aai-resources/bundleconfig-local/etc/tmp-config/hbase-site.xml b/aai-resources/src/main/resources/etc/tmp-config/hbase-site.xml
index a2fcca6..a2fcca6 100644
--- a/aai-resources/bundleconfig-local/etc/tmp-config/hbase-site.xml
+++ b/aai-resources/src/main/resources/etc/tmp-config/hbase-site.xml
diff --git a/aai-resources/bundleconfig-local/etc/tosca-migration-data/edgeLabelMigration.csv b/aai-resources/src/main/resources/etc/tosca-migration-data/edgeLabelMigration.csv
index 53639e5..53639e5 100644
--- a/aai-resources/bundleconfig-local/etc/tosca-migration-data/edgeLabelMigration.csv
+++ b/aai-resources/src/main/resources/etc/tosca-migration-data/edgeLabelMigration.csv
diff --git a/aai-resources/ajsc-shared-config/etc/localhost-access-logback.xml b/aai-resources/src/main/resources/localhost-access-logback.xml
index 875a00a..a318796 100644
--- a/aai-resources/ajsc-shared-config/etc/localhost-access-logback.xml
+++ b/aai-resources/src/main/resources/localhost-access-logback.xml
@@ -22,6 +22,7 @@
-->
<configuration>
+ <property name="AJSC_HOME" value="${AJSC_HOME:-.}" />
<appender name="ACCESS"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${AJSC_HOME}/logs/ajsc-jetty/localhost_access.log</file>
@@ -58,4 +59,4 @@
%z - Custom pattern that parses the cert for the subject
%y - Custom pattern determines rest or dme2
- -->
+ --> \ No newline at end of file
diff --git a/aai-resources/ajsc-shared-config/etc/logback.xml b/aai-resources/src/main/resources/logback.xml
index 48fbb3e..ee7ee61 100644
--- a/aai-resources/ajsc-shared-config/etc/logback.xml
+++ b/aai-resources/src/main/resources/logback.xml
@@ -22,7 +22,13 @@
-->
<configuration scan="true" scanPeriod="60 seconds" debug="false">
- <contextName>${module.ajsc.namespace.name}</contextName>
+ <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
+
+ <property resource="application.properties" />
+
+ <property name="namespace" value="aai-resources"/>
+
+ <property name="AJSC_HOME" value="${AJSC_HOME:-.}" />
<jmxConfigurator />
<property name="logDirectory" value="${AJSC_HOME}/logs" />
<property name="eelfLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/>
@@ -30,14 +36,15 @@
<property name="eelfMetricLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{targetVirtualEntity}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/>
<!-- <property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n|\r\n', '^'}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> -->
<property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%ecompResponseCode|%ecompResponseDescription|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/>
+ <property name="eelfTransLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{partnerName}:%m%n"/>
+
+ <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
+ <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
+ <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <filter class="ch.qos.logback.classic.filter.LevelFilter">
- <level>ERROR</level>
- <onMatch>ACCEPT</onMatch>
- <onMismatch>DENY</onMismatch>
- </filter>
<encoder>
- <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n
+ <pattern>
+ %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}
</pattern>
</encoder>
</appender>
@@ -156,7 +163,7 @@
</fileNamePattern>
</rollingPolicy>
<encoder class="org.onap.aai.logging.EcompEncoder">
- <pattern>${eelfLogPattern}</pattern>
+ <pattern>${eelfTransLogPattern}</pattern>
</encoder>
</appender>
@@ -264,7 +271,9 @@
<logger name="com.att.ajsc" level="WARN" />
<logger name="com.att.ajsc.csi.logging" level="WARN" />
<logger name="com.att.ajsc.filemonitor" level="WARN" />
- <logger name="com.att.ajsc.runner" level="WARN" />
+ <logger name="com.netflix.loadbalancer" level="WARN" />
+
+ <logger name="org.apache.zookeeper" level="OFF" />
<!-- Other Loggers that may help troubleshoot -->
<logger name="net.sf" level="WARN" />
@@ -283,18 +292,24 @@
<logger name="org.restlet" level="WARN" />
<logger name="org.apache.camel.component.restlet" level="WARN" />
+ <logger name="org.hibernate.validator" level="WARN" />
+ <logger name="org.hibernate" level="WARN" />
+ <logger name="org.hibernate.ejb" level="OFF" />
+
<!-- logback internals logging -->
<logger name="ch.qos.logback.classic" level="WARN" />
<logger name="ch.qos.logback.core" level="WARN" />
+ <logger name="org.eclipse.jetty" level="WARN" />
+
<!-- logback jms appenders & loggers definition starts here -->
<appender name="auditLogs"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter" />
- <file>${logDirectory}/perf-audit/Audit.log
+ <file>${logDirectory}/perf-audit/Audit-${lrmRVer}-${lrmRO}-${Pid}.log
</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${logDirectory}/perf-audit/Audit.%i.log.zip
+ <fileNamePattern>${logDirectory}/perf-audit/Audit-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip
</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>9</maxIndex>
@@ -310,10 +325,10 @@
<appender name="perfLogs"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter" />
- <file>${logDirectory}/perf-audit/Perform.log
+ <file>${logDirectory}/perf-audit/Perform-${lrmRVer}-${lrmRO}-${Pid}.log
</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${logDirectory}/perf-audit/Perform.%i.log.zip
+ <fileNamePattern>${logDirectory}/perf-audit/Perform-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip
</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>9</maxIndex>
@@ -326,42 +341,27 @@
<pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern>
</encoder>
</appender>
- <appender name="ASYNC-audit" class="ch.qos.logback.classic.AsyncAppender">
- <queueSize>1000</queueSize>
- <includeCallerData>true</includeCallerData>
- <discardingThreshold>0</discardingThreshold>
- <appender-ref ref="Audit-Record-Queue" />
- </appender>
- <appender name="ASYNC-perf" class="ch.qos.logback.classic.AsyncAppender">
- <queueSize>1000</queueSize>
- <includeCallerData>true</includeCallerData>
- <discardingThreshold>0</discardingThreshold>
- <appender-ref ref="Performance-Tracker-Queue" />
- </appender>
<logger name="AuditRecord" level="INFO" additivity="false">
- <appender-ref ref="ASYNC-audit" />
<appender-ref ref="auditLogs" />
</logger>
<logger name="AuditRecord_DirectCall" level="INFO" additivity="false">
- <appender-ref ref="ASYNC-audit" />
<appender-ref ref="auditLogs" />
</logger>
<logger name="PerfTrackerRecord" level="INFO" additivity="false">
- <appender-ref ref="ASYNC-perf" />
<appender-ref ref="perfLogs" />
</logger>
<!-- logback jms appenders & loggers definition ends here -->
- <logger name="org.onap.aai.interceptors" level="DEBUG"
- additivity="false">
+ <logger name="org.onap.aai.interceptors.post" level="DEBUG"
+ additivity="false">
<appender-ref ref="asynctranslog" />
</logger>
- <logger name="org.onap.aai.interceptors.PreAaiAjscInterceptor" level="DEBUG">
+ <logger name="org.onap.aai.interceptors.pre.SetLoggingContext" level="DEBUG">
<appender-ref ref="asyncAUDIT"/>
</logger>
- <logger name="org.onap.aai.interceptors.PostAaiAjscInterceptor" level="DEBUG">
+ <logger name="org.onap.aai.interceptors.post.ResetLoggingContext" level="DEBUG">
<appender-ref ref="asyncAUDIT"/>
</logger>
@@ -371,9 +371,10 @@
<appender-ref ref="dmaapAAIEventConsumerMetric" />
</logger>
- <logger name="org.apache" level="WARN" />
- <logger name="org.zookeeper" level="WARN" />
+ <logger name="org.apache" level="OFF" />
+ <logger name="org.zookeeper" level="OFF" />
<logger name="com.thinkaurelius" level="WARN" />
+ <logger name="com.att.aft.dme2" level="WARN" />
<!-- ============================================================================ -->
<!-- General EELF logger -->
diff --git a/aai-resources/src/main/resources/logmessages.properties b/aai-resources/src/main/resources/logmessages.properties
new file mode 100644
index 0000000..59684e4
--- /dev/null
+++ b/aai-resources/src/main/resources/logmessages.properties
@@ -0,0 +1,6 @@
+RESTSERVICE_HELLO=SERVICE0001I|Get a quick hello|No resolution needed|No action is required
+RESTSERVICE_HELLO_NAME=SERVICE0002I|Get a quick hello for {0}|No resolution needed|No action is required
+SPRINSERVICE_HELLO=SERVICE0003I|Say a quick hello|No resolution needed|No action is required
+SPRINSERVICE_HELLO_NAME=SERVICE0004I|Say a quick hello for {0}|No resolution needed|No action is required
+SPRINSERVICE_HELLO_MESSAGE=SERVICE0005I|Say hello message: {0}|No resolution needed|No action is required
+SPRINSERVICE_HELLO_MESSAGE_NAME=SERVICE0006I|Say hello message object:{0}|No resolution needed|No action is required
diff --git a/aai-resources/src/main/runtime/context/__module.ajsc.namespace.name__#__module.ajsc.namespace.version__.context b/aai-resources/src/main/runtime/context/__module.ajsc.namespace.name__#__module.ajsc.namespace.version__.context
deleted file mode 100644
index 8514196..0000000
--- a/aai-resources/src/main/runtime/context/__module.ajsc.namespace.name__#__module.ajsc.namespace.version__.context
+++ /dev/null
@@ -1 +0,0 @@
-{"context":{"contextClass":"ajsc.Context","contextId":"__module_ajsc_namespace_name__:__module_ajsc_namespace_version__","contextName":"__module_ajsc_namespace_name__","contextVersion":"__module_ajsc_namespace_version__","description":"__module_ajsc_namespace_name__ Context"}} \ No newline at end of file
diff --git a/aai-resources/src/main/runtime/context/default#0.context b/aai-resources/src/main/runtime/context/default#0.context
deleted file mode 100644
index d1b5ab4..0000000
--- a/aai-resources/src/main/runtime/context/default#0.context
+++ /dev/null
@@ -1 +0,0 @@
-{"context":{"contextClass":"ajsc.Context","contextId":"default:0","contextName":"default","contextVersion":"0","description":"Default Context"}} \ No newline at end of file
diff --git a/aai-resources/src/main/runtime/deploymentPackage/__module.ajsc.namespace.name__#__module.ajsc.namespace.version__.json b/aai-resources/src/main/runtime/deploymentPackage/__module.ajsc.namespace.name__#__module.ajsc.namespace.version__.json
deleted file mode 100644
index d0954cf..0000000
--- a/aai-resources/src/main/runtime/deploymentPackage/__module.ajsc.namespace.name__#__module.ajsc.namespace.version__.json
+++ /dev/null
@@ -1 +0,0 @@
-{"deploymentPackage":{"Class":"ajsc.DeploymentPackage","Id":"__module.ajsc.namespace.name__:__module_ajsc_namespace_version__","namespace":"__module_ajsc_namespace_name__","namespaceVersion":"__module_ajsc_namespace_version__","description":"__module_ajsc_namespace_name__ __module_ajsc_namespace_version__ - default description","userId":"ajsc"}} \ No newline at end of file
diff --git a/aai-resources/src/main/runtime/shiroRole/ajscadmin.json b/aai-resources/src/main/runtime/shiroRole/ajscadmin.json
deleted file mode 100644
index f5e981e..0000000
--- a/aai-resources/src/main/runtime/shiroRole/ajscadmin.json
+++ /dev/null
@@ -1 +0,0 @@
-{"shiroRoleClass":"ajsc.auth.ShiroRole","shiroRoleId":"ajscadmin","name":"ajscadmin","permissions":"[ajscadmin:*, ajsc:*]"} \ No newline at end of file
diff --git a/aai-resources/src/main/runtime/shiroRole/contextadmin#__module.ajsc.namespace.name__.json b/aai-resources/src/main/runtime/shiroRole/contextadmin#__module.ajsc.namespace.name__.json
deleted file mode 100644
index 2dae9f5..0000000
--- a/aai-resources/src/main/runtime/shiroRole/contextadmin#__module.ajsc.namespace.name__.json
+++ /dev/null
@@ -1 +0,0 @@
-{"shiroRoleClass":"ajsc.auth.ShiroRole","shiroRoleId":"contextadmin:__module_ajsc_namespace_name__","name":"contextadmin:__module_ajsc_namespace_name__","permissions":"[]"} \ No newline at end of file
diff --git a/aai-resources/src/main/runtime/shiroRole/contextadmin#default.json b/aai-resources/src/main/runtime/shiroRole/contextadmin#default.json
deleted file mode 100644
index 5de814e..0000000
--- a/aai-resources/src/main/runtime/shiroRole/contextadmin#default.json
+++ /dev/null
@@ -1 +0,0 @@
-{"shiroRoleClass":"ajsc.auth.ShiroRole","shiroRoleId":"contextadmin:default","name":"contextadmin:default","permissions":"[]"} \ No newline at end of file
diff --git a/aai-resources/src/main/runtime/shiroUser/ajsc.json b/aai-resources/src/main/runtime/shiroUser/ajsc.json
deleted file mode 100644
index f4c7855..0000000
--- a/aai-resources/src/main/runtime/shiroUser/ajsc.json
+++ /dev/null
@@ -1 +0,0 @@
-{"shiroUserClass":"ajsc.auth.ShiroUser","shiroUserId":"ajsc","passwordHash":"9471697417008c880720ba54c6038791ad7e98f3b88136fe34f4d31a462dd27a","permissions":"[*:*]","username":"ajsc"} \ No newline at end of file
diff --git a/aai-resources/src/main/runtime/shiroUserRole/ajsc#ajscadmin.json b/aai-resources/src/main/runtime/shiroUserRole/ajsc#ajscadmin.json
deleted file mode 100644
index cb8d483..0000000
--- a/aai-resources/src/main/runtime/shiroUserRole/ajsc#ajscadmin.json
+++ /dev/null
@@ -1 +0,0 @@
-{"shiroUserRoleClass":"ajsc.auth.ShiroUserRole","shiroUserRoleId":"ajsc:ajscadmin","roleId":"ajscadmin","userId":"ajsc"} \ No newline at end of file
diff --git a/aai-resources/src/main/runtime/shiroUserRole/ajsc#contextadmin#__module.ajsc.namespace.name__.json b/aai-resources/src/main/runtime/shiroUserRole/ajsc#contextadmin#__module.ajsc.namespace.name__.json
deleted file mode 100644
index 95d2361..0000000
--- a/aai-resources/src/main/runtime/shiroUserRole/ajsc#contextadmin#__module.ajsc.namespace.name__.json
+++ /dev/null
@@ -1 +0,0 @@
-{"shiroUserRoleClass":"ajsc.auth.ShiroUserRole","shiroUserRoleId":"ajsc:contextadmin:__module_ajsc_namespace_name__","roleId":"contextadmin:__module_ajsc_namespace_name__","userId":"ajsc"} \ No newline at end of file
diff --git a/aai-resources/src/main/runtime/shiroUserRole/ajsc#contextadmin#default.json b/aai-resources/src/main/runtime/shiroUserRole/ajsc#contextadmin#default.json
deleted file mode 100644
index 2bd5063..0000000
--- a/aai-resources/src/main/runtime/shiroUserRole/ajsc#contextadmin#default.json
+++ /dev/null
@@ -1 +0,0 @@
-{"shiroUserRoleClass":"ajsc.auth.ShiroUserRole","shiroUserRoleId":"ajsc:contextadmin:default","roleId":"contextadmin:default","userId":"ajsc"} \ No newline at end of file
diff --git a/aai-resources/src/main/scripts/audit_schema.sh b/aai-resources/src/main/scripts/audit_schema.sh
index e0d0143..70aa535 100644
--- a/aai-resources/src/main/scripts/audit_schema.sh
+++ b/aai-resources/src/main/scripts/audit_schema.sh
@@ -21,29 +21,12 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
-if [ "${userid}" != "aaiadmin" ]; then
- echo "You must be aaiadmin to run $0. The id used $userid."
- exit 1
-fi
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
-if [ -f "/etc/profile.d/aai.sh" ]; then
- source /etc/profile.d/aai.sh
-else
- echo "File not found: /etc/profile.d/aai.sh";
- exit
-fi
-
-JAVA=$JAVA_HOME/bin/java
-
-for JAR in `ls $PROJECT_HOME/extJars/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-for JAR in `ls $PROJECT_HOME/lib/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-$JAVA -Dhttps.protocols=TLSv1.1,TLSv1.2 -DAJSC_HOME=$PROJECT_HOME -Daai.home=$PROJECT_HOME -cp $CLASSPATH org.onap.aai.db.schema.ScriptDriver $@
+start_date;
+check_user;
+source_profile;
+execute_spring_jar org.onap.aai.db.schema.ScriptDriver "" "$@"
+end_date;
+exit 0
diff --git a/aai-resources/src/main/scripts/common_functions.sh b/aai-resources/src/main/scripts/common_functions.sh
new file mode 100644
index 0000000..853941c
--- /dev/null
+++ b/aai-resources/src/main/scripts/common_functions.sh
@@ -0,0 +1,56 @@
+#!/bin/ksh
+
+# Common functions that can be used throughout multiple scripts
+# In order to call these functions, this file needs to be sourced
+
+# Checks if the user that is currently running is aaiadmin
+check_user(){
+
+ userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
+
+ if [ "${userid}" != "aaiadmin" ]; then
+ echo "You must be aaiadmin to run $0. The id used $userid."
+ exit 1
+ fi
+}
+
+# Sources the profile and sets the project home
+source_profile(){
+ . /etc/profile.d/aai.sh
+ PROJECT_HOME=/opt/app/aai-resources
+}
+
+# Runs the spring boot jar based on which main class
+# to execute and which logback file to use for that class
+execute_spring_jar(){
+
+ className=$1;
+ logbackFile=$2;
+
+ shift 2;
+
+ EXECUTABLE_JAR=$(ls ${PROJECT_HOME}/lib/*.jar);
+
+ JAVA_OPTS="${JAVA_PRE_OPTS}";
+ JAVA_OPTS="-DAJSC_HOME=$PROJECT_HOME";
+ JAVA_OPTS="$JAVA_OPTS -DBUNDLECONFIG_DIR=resources";
+ JAVA_OPTS="$JAVA_OPTS -Daai.home=$PROJECT_HOME ";
+ JAVA_OPTS="$JAVA_OPTS -Dhttps.protocols=TLSv1.1,TLSv1.2";
+ JAVA_OPTS="$JAVA_OPTS -Dloader.main=${className}";
+ JAVA_OPTS="$JAVA_OPTS -Dlogback.configurationFile=${logbackFile}";
+ JAVA_OPTS="${JAVA_OPTS} ${JAVA_POST_OPTS}";
+
+ ${JAVA_HOME}/bin/java ${JVM_OPTS} ${JAVA_OPTS} -jar ${EXECUTABLE_JAR} "$@"
+}
+
+# Prints the start date and the script that the user called
+start_date(){
+ echo
+ echo `date` " Starting $0"
+}
+
+# Prints the end date and the script that the user called
+end_date(){
+ echo
+ echo `date` " Done $0"
+}
diff --git a/aai-resources/src/main/scripts/createDBSchema.sh b/aai-resources/src/main/scripts/createDBSchema.sh
index 56f0fcc..491a89c 100644
--- a/aai-resources/src/main/scripts/createDBSchema.sh
+++ b/aai-resources/src/main/scripts/createDBSchema.sh
@@ -30,24 +30,11 @@
# Ie. createDbSchema.sh GEN_DB_WITH_NO_SCHEMA
#
-echo
-echo `date` " Starting $0"
-
-. /etc/profile.d/aai.sh
-PROJECT_HOME=/opt/app/aai-resources
-
-
-for JAR in `ls $PROJECT_HOME/extJars/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-for JAR in `ls $PROJECT_HOME/lib/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-$JAVA_HOME/bin/java -classpath $CLASSPATH -Dhttps.protocols=TLSv1.1,TLSv1.2 -DBUNDLECONFIG_DIR=bundleconfig -DAJSC_HOME=$PROJECT_HOME -Daai.home=$PROJECT_HOME -Dlogback.configurationFile=$PROJECT_HOME/bundleconfig/etc/appprops/createDBSchema-logback.xml org.onap.aai.dbgen.GenTester $1
-
-echo `date` " Done $0"
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
+start_date;
+check_user;
+source_profile;
+execute_spring_jar org.onap.aai.dbgen.GenTester ${PROJECT_HOME}/resources/etc/appprops/createDBSchema-logback.xml "$@"
+end_date;
exit 0
diff --git a/aai-resources/src/main/scripts/deleteTool.sh b/aai-resources/src/main/scripts/deleteTool.sh
index b9ee8b0..3d7f923 100644
--- a/aai-resources/src/main/scripts/deleteTool.sh
+++ b/aai-resources/src/main/scripts/deleteTool.sh
@@ -65,7 +65,7 @@ fi
. /etc/profile.d/aai.sh
PROJECT_HOME=/opt/app/aai-resources
-prop_file=$PROJECT_HOME/bundleconfig/etc/appprops/aaiconfig.properties
+prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties
log_dir=$PROJECT_HOME/logs/misc
today=$(date +\%Y-\%m-\%d)
@@ -95,7 +95,7 @@ fi
if [ $MISSING_PROP = false ]; then
if [ $USEBASICAUTH = false ]; then
- AUTHSTRING="--cert $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPrivateKey.pem"
+ AUTHSTRING="--cert $PROJECT_HOME/resources/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/resources/etc/auth/aaiClientPrivateKey.pem"
else
AUTHSTRING="-u $CURLUSER:$CURLPASSWORD"
fi
diff --git a/aai-resources/src/main/scripts/dupeTool.sh b/aai-resources/src/main/scripts/dupeTool.sh
new file mode 100644
index 0000000..f088d5b
--- /dev/null
+++ b/aai-resources/src/main/scripts/dupeTool.sh
@@ -0,0 +1,73 @@
+#!/bin/ksh
+
+###
+# ============LICENSE_START=======================================================
+# org.onap.aai
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+#
+# dupeTool.sh -- This tool is used to look at or fix duplicate nodes for one nodeType
+# at a time and can be used to limit what it's looking at to just nodes created
+# within a recent time window.
+# It is made to deal with situations (like we have in 1610/1702) where one type
+# of node keeps needing to have duplicates cleaned up (tenant nodes).
+# It is needed because DataGrooming cannot be run often and cannot be focused just
+# on duplicates or just on one nodeType.
+#
+# Parameters:
+#
+# -userId (required) must be followed by a userid
+# -nodeType (required) must be followed by a valid nodeType
+# -timeWindowMinutes (optional) by default we would look at all nodes of the
+# given nodeType, but if a window is given, then we will only look at
+# nodes created that many (or fewer) minutes ago.
+# -autoFix (optional) use this if you want duplicates fixed automatically (if we
+# can figure out which to delete)
+# -maxFix (optional) like with dataGrooming lets you override the default maximum
+# number of dupes that can be processed at one time
+# -skipHostCheck (optional) By default, the dupe tool will check to see that it is running
+# on the host that is the first one in the list found in:
+# aaiconfig.properties aai.primary.filetransfer.serverlist
+# This is so that when run from the cron, it only runs on one machine.
+# This option lets you turn that checking off.
+# -sleepMinutes (optional) like with DataGrooming, you can override the
+# sleep time done when doing autoFix between first and second checks of the data.
+# -params4Collect (optional) followed by a string to tell what properties/values to use
+# to limit the nodes being looked at. Must be in the format
+# of “propertName|propValue” use commas to separate if there
+# are more than one name/value being passed.
+# -specialTenantRule (optional) turns on logic which will use extra logic to figure
+# out which tenant node can be deleted in a common scenario.
+#
+#
+# For example (there are many valid ways to use it):
+#
+# dupeTool.sh -userId am8383 -nodeType tenant -timeWindowMinutes 60 -autoFix
+# or
+# dupeTool.sh -userId am8383 -nodeType tenant -specialTenantRule -autoFix -maxFix 100
+#
+
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
+
+start_date;
+check_user;
+source_profile;
+execute_spring_jar org.onap.aai.dbgen.DupeTool ${PROJECT_HOME}/resources/etc/appprops/dupeTool-logback.xml "$@"
+end_date;
+exit 0
diff --git a/aai-resources/src/main/scripts/dynamicPayloadArchive.sh b/aai-resources/src/main/scripts/dynamicPayloadArchive.sh
index f17f679..75d75d4 100644
--- a/aai-resources/src/main/scripts/dynamicPayloadArchive.sh
+++ b/aai-resources/src/main/scripts/dynamicPayloadArchive.sh
@@ -21,10 +21,13 @@
###
#
-# The script is called to tar and gzip the files under /opt/app/aai-resources/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation which are the payload files created by the dynamicPayloadGenerator.sh tool.
+# The script is called to tar and gzip the files under /opt/app/aai-resources/resources/etc/scriptdata/addmanualdata/tenant_isolation which are the payload files created by the dynamicPayloadGenerator.sh tool.
#
#
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
+
. /etc/profile.d/aai.sh
PROJECT_HOME=/opt/app/aai-resources
@@ -38,7 +41,7 @@ if [ "${userid}" != $CHECK_USER ]; then
echo "You must be $CHECK_USER to run $0. The id used $userid."
exit 1
fi
-DIRECTORY=${PROJECT_HOME}/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation
+DIRECTORY=${PROJECT_HOME}/resources/etc/scriptdata/addmanualdata/tenant_isolation
if [ ! -d ${DIRECTORY} ]
then
echo " ${DIRECTORY} doesn't exist"
diff --git a/aai-resources/src/main/scripts/dynamicPayloadGenerator.sh b/aai-resources/src/main/scripts/dynamicPayloadGenerator.sh
index c386bed..6d46546 100644
--- a/aai-resources/src/main/scripts/dynamicPayloadGenerator.sh
+++ b/aai-resources/src/main/scripts/dynamicPayloadGenerator.sh
@@ -38,11 +38,11 @@
#
# For example (there are many valid ways to use it):
#
-# dynamicPayloadGenerator.sh -d '/opt/app/snapshots/snaphot.graphSON' -o '/opt/app/aai-resources/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/'
+# dynamicPayloadGenerator.sh -d '/opt/app/snapshots/snaphot.graphSON' -o '/opt/app/aai-resources/resources/etc/scriptdata/addmanualdata/tenant_isolation/'
#
# or
-# dynamicPayloadGenerator.sh -d '/opt/app/snapshots/snaphot.graphSON' -s false -c '/opt/app/aai-resources/bundleconfig/etc/appprops/dynamic.properties'
-# -o '/opt/app/aai-resources/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/' -f PAYLOAD -n '/opt/app/aai-resources/bundleconfig/etc/scriptdata/nodes.json'
+# dynamicPayloadGenerator.sh -d '/opt/app/snapshots/snaphot.graphSON' -s false -c '/opt/app/aai-resources/resources/etc/appprops/dynamic.properties'
+# -o '/opt/app/aai-resources/resources/etc/scriptdata/addmanualdata/tenant_isolation/' -f PAYLOAD -n '/opt/app/aai-resources/resources/etc/scriptdata/nodes.json'
#
@@ -63,10 +63,10 @@ display_usage() {
c. -f (optional) PAYLOAD or DMAAP-MR
d. -n (optional) input file for the script
4. For example (there are many valid ways to use it):
- dynamicPayloadGenerator.sh -d '/opt/app/snapshots/snaphot.graphSON' -o '/opt/app/aai-resources/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/'
+ dynamicPayloadGenerator.sh -d '/opt/app/snapshots/snaphot.graphSON' -o '/opt/app/aai-resources/resources/etc/scriptdata/addmanualdata/tenant_isolation/'
- dynamicPayloadGenerator.sh -d '/opt/app/snapshots/snaphot.graphSON' -s false -c '/opt/app/aai-resources/bundleconfig/etc/appprops/dynamic.properties'
- -o '/opt/app/aai-resources/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/' -f PAYLOAD -n '/opt/app/aai-resources/bundleconfig/etc/scriptdata/nodes.json'
+ dynamicPayloadGenerator.sh -d '/opt/app/snapshots/snaphot.graphSON' -s false -c '/opt/app/aai-resources/resources/etc/appprops/dynamic.properties'
+ -o '/opt/app/aai-resources/resources/etc/scriptdata/addmanualdata/tenant_isolation/' -f PAYLOAD -n '/opt/app/aai-resources/resources/etc/scriptdata/nodes.json'
EOF
}
@@ -75,27 +75,13 @@ if [ $# -eq 0 ]; then
exit 1
fi
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
-
-. /etc/profile.d/aai.sh
-PROJECT_HOME=/opt/app/aai-resources
-
-for JAR in `ls $PROJECT_HOME/extJars/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-for JAR in `ls $PROJECT_HOME/lib/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-
-$JAVA_HOME/bin/java -classpath $CLASSPATH -Dhttps.protocols=TLSv1.1,TLSv1.2 -DBUNDLECONFIG_DIR=bundleconfig -DAJSC_HOME=$PROJECT_HOME \
- -Daai.home=$PROJECT_HOME -Dlogback.configurationFile=$PROJECT_HOME/bundleconfig/etc/appprops/dynamicPayloadGenerator-logback.xml -Xmx9000m -Xms9000m \
- org.onap.aai.dbgen.DynamicPayloadGenerator "$@"
-
-
-echo `date` " Done $0"
-
+start_date;
+check_user;
+source_profile;
+export JVM_OPTS="-Xmx9000m -Xms9000m"
+execute_spring_jar org.onap.aai.dbgen.DynamicPayloadGenerator ${PROJECT_HOME}/resources/etc/appprops/dynamicPayloadGenerator-logback.xml "$@"
+end_date;
exit 0
diff --git a/aai-resources/src/main/scripts/edgeTagger.sh b/aai-resources/src/main/scripts/edgeTagger.sh
index b2bfcb9..abb3428 100644
--- a/aai-resources/src/main/scripts/edgeTagger.sh
+++ b/aai-resources/src/main/scripts/edgeTagger.sh
@@ -62,37 +62,25 @@
# or ./edgeTagger.sh "complex|ctag-pool"
#
-echo
-echo `date` " Starting $0"
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
+start_date;
-userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
-if [ "${userid}" != "aaiadmin" ]; then
- echo "You must be aaiadmin to run $0. The id used $userid."
- exit 1
-fi
+echo " NOTE - if you are deleting data, please run the dataSnapshot.sh script first or "
+echo " at least make a note the details of the node that you are deleting. "
-. /etc/profile.d/aai.sh
-PROJECT_HOME=/opt/app/aai-resources
+check_user;
+source_profile;
-for JAR in `ls $PROJECT_HOME/extJars/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
+execute_spring_jar org.onap.aai.dbgen.UpdateEdgeTags "" "$@"
-for JAR in `ls $PROJECT_HOME/lib/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
+PROCESS_STATUS=$?;
-$JAVA_HOME/bin/java -classpath $CLASSPATH -Dhttps.protocols=TLSv1.1,TLSv1.2 -DAJSC_HOME=$PROJECT_HOME -Daai.home=$PROJECT_HOME \
- -Dcom.att.eelf.logging.file=default-logback.xml -Dcom.att.eelf.logging.path="$PROJECT_HOME/bundleconfig/etc/appprops/" \
- org.onap.aai.dbgen.UpdateEdgeTags $1
-if [ "$?" -ne "0" ]; then
- echo "Problem executing UpdateEdgeTags "
- exit 1
-fi
+if [ ${PROCESS_STATUS} -ne 0 ]; then
+ echo "Problem executing UpdateEdgeTags";
+ exit 1;
+fi;
-
-echo `date` " Done $0"
+end_date;
exit 0
diff --git a/aai-resources/src/main/scripts/forceDeleteTool.sh b/aai-resources/src/main/scripts/forceDeleteTool.sh
index 9c199bc..cb87b38 100644
--- a/aai-resources/src/main/scripts/forceDeleteTool.sh
+++ b/aai-resources/src/main/scripts/forceDeleteTool.sh
@@ -66,37 +66,19 @@
#
#
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
-echo
-echo `date` " Starting $0"
+start_date;
echo " NOTE - if you are deleting data, please run the dataSnapshot.sh script first or "
echo " at least make a note the details of the node that you are deleting. "
-userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
-if [ "${userid}" != "aaiadmin" ]; then
- echo "You must be aaiadmin to run $0. The id used $userid."
- exit 1
-fi
+check_user;
+source_profile;
-. /etc/profile.d/aai.sh
-PROJECT_HOME=/opt/app/aai-resources
+execute_spring_jar org.onap.aai.dbgen.ForceDeleteTool ${PROJECT_HOME}/resources/etc/appprops/forceDelete-logback.xml "$@"
-for JAR in `ls $PROJECT_HOME/extJars/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-for JAR in `ls $PROJECT_HOME/lib/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-
-$JAVA_HOME/bin/java -classpath $CLASSPATH -Dhttps.protocols=TLSv1.1,TLSv1.2 -DAJSC_HOME=$PROJECT_HOME -Daai.home=$PROJECT_HOME \
- org.onap.aai.dbgen.ForceDeleteTool "$@"
-
-
-echo `date` " Done $0"
+end_date;
exit 0
diff --git a/aai-resources/src/main/scripts/getTool.sh b/aai-resources/src/main/scripts/getTool.sh
index 8d006b0..3f61ab1 100644
--- a/aai-resources/src/main/scripts/getTool.sh
+++ b/aai-resources/src/main/scripts/getTool.sh
@@ -60,7 +60,7 @@ fi
. /etc/profile.d/aai.sh
PROJECT_HOME=/opt/app/aai-resources
-prop_file=$PROJECT_HOME/bundleconfig/etc/appprops/aaiconfig.properties
+prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties
log_dir=$PROJECT_HOME/logs/misc
today=$(date +\%Y-\%m-\%d)
@@ -91,11 +91,11 @@ fi
if [ $MISSING_PROP = false ]; then
if [ $USEBASICAUTH = false ]; then
- AUTHSTRING="--cert $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPrivateKey.pem"
+ AUTHSTRING="--cert $PROJECT_HOME/resources/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/resources/etc/auth/aaiClientPrivateKey.pem"
else
AUTHSTRING="-u $CURLUSER:$CURLPASSWORD"
fi
- curl --request GET -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" $RESTURL$RESOURCE | python -mjson.tool
+ curl --request GET -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" $RESTURL$RESOURCE | jq '.'
RC=$?;
else
echo "usage: $0 resource"
diff --git a/aai-resources/src/main/scripts/install/addManualData.sh b/aai-resources/src/main/scripts/install/addManualData.sh
index 930b9ba..9a5bb59 100644
--- a/aai-resources/src/main/scripts/install/addManualData.sh
+++ b/aai-resources/src/main/scripts/install/addManualData.sh
@@ -22,7 +22,7 @@
# this script now requires a release parameter.
# the tool finds and sorts *.txt files within the
-# bundleconfig/etc/scriptdate/addmanualdata/$release directory containing
+# resources/etc/scriptdata/addmanualdata/$release directory containing
# one resource to be added to the graph. The directory contains a second
# file with the same name, but the extension is .json. This json file
# is passed to the PutTool as the payload. The parameters passed to the
@@ -77,15 +77,15 @@ k=0
if [ "$1" = "tenant_isolation" ]
then
- CR_TEXT_PATH=`find $PROJECT_HOME/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/cloud-region -name "*.txt" -print | sort -f`
- AZ_TEXT_PATH=`find $PROJECT_HOME/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/availability-zone -name "*.txt" -print | sort -f`
- COMPLEX_TEXT_PATH=`find $PROJECT_HOME/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/complex -name "*.txt" -print | sort -f`
- ZONE_TEXT_PATH=`find $PROJECT_HOME/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/zone -name "*.txt" -print | sort -f`
- PSERVER_TEXT_PATH=`find $PROJECT_HOME/bundleconfig/etc/scriptdata/addmanualdata/tenant_isolation/pserver -name "*.txt" -print | sort -f`
+ CR_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/cloud-region -name "*.txt" -print | sort -f`
+ AZ_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/availability-zone -name "*.txt" -print | sort -f`
+ COMPLEX_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/complex -name "*.txt" -print | sort -f`
+ ZONE_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/zone -name "*.txt" -print | sort -f`
+ PSERVER_TEXT_PATH=`find $PROJECT_HOME/resources/etc/scriptdata/addmanualdata/tenant_isolation/pserver -name "*.txt" -print | sort -f`
TEXT_PATH="${CR_TEXT_PATH} ${AZ_TEXT_PATH} ${COMPLEX_TEXT_PATH} ${ZONE_TEXT_PATH} ${PSERVER_TEXT_PATH}"
COMMAND=${TEXT_PATH}
else
- TEXT_PATH=$PROJECT_HOME/bundleconfig/etc/scriptdata/addmanualdata/*/*.txt
+ TEXT_PATH=$PROJECT_HOME/resources/etc/scriptdata/addmanualdata/*/*.txt
COMMAND=`ls ${TEXT_PATH} | sort -f`
fi
diff --git a/aai-resources/src/main/scripts/putTool.sh b/aai-resources/src/main/scripts/putTool.sh
index b5ad862..46696b2 100644
--- a/aai-resources/src/main/scripts/putTool.sh
+++ b/aai-resources/src/main/scripts/putTool.sh
@@ -84,7 +84,7 @@ fi
. /etc/profile.d/aai.sh
PROJECT_HOME=/opt/app/aai-resources
-prop_file=$PROJECT_HOME/bundleconfig/etc/appprops/aaiconfig.properties
+prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties
log_dir=$PROJECT_HOME/logs/misc
today=$(date +\%Y-\%m-\%d)
@@ -121,15 +121,15 @@ fi
if [ $MISSING_PROP = false ]; then
if [ $USEBASICAUTH = false ]; then
- AUTHSTRING="--cert $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPrivateKey.pem"
+ AUTHSTRING="--cert $PROJECT_HOME/resources/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/resources/etc/auth/aaiClientPrivateKey.pem"
else
AUTHSTRING="-u $CURLUSER:$CURLPASSWORD"
fi
if [ $RETURNRESPONSE = true ]; then
- curl --request PUT -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" -T $JSONFILE $RESTURL$RESOURCE | python -mjson.tool
+ curl --request PUT -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" -T /tmp/$(basename $JSONFILE) $RESTURL$RESOURCE | jq '.'
RC=$?
else
- result=`curl --request PUT -sL -w "%{http_code}" -o /dev/null -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" -T $JSONFILE $RESTURL$RESOURCE`
+ result=`curl --request PUT -sL -w "%{http_code}" -o /dev/null -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" -T /tmp/$(basename $JSONFILE) $RESTURL$RESOURCE`
#echo "result is $result."
RC=0;
if [ $? -eq 0 ]; then
diff --git a/aai-resources/src/main/scripts/rshipTool.sh b/aai-resources/src/main/scripts/rshipTool.sh
index 8decd04..3952d44 100644
--- a/aai-resources/src/main/scripts/rshipTool.sh
+++ b/aai-resources/src/main/scripts/rshipTool.sh
@@ -113,7 +113,7 @@ fi
. /etc/profile.d/aai.sh
PROJECT_HOME=/opt/app/aai-resources
-prop_file=$PROJECT_HOME/bundleconfig/etc/appprops/aaiconfig.properties
+prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties
log_dir=$PROJECT_HOME/logs/misc
today=$(date +\%Y-\%m-\%d)
@@ -144,12 +144,12 @@ fi
if [ $MISSING_PROP = false ]; then
if [ $USEBASICAUTH = false ]; then
- AUTHSTRING="--cert $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/bundleconfig/etc/auth/aaiClientPrivateKey.pem"
+ AUTHSTRING="--cert $PROJECT_HOME/resources/etc/auth/aaiClientPublicCert.pem --key $PROJECT_HOME/resources/etc/auth/aaiClientPrivateKey.pem"
else
AUTHSTRING="-u $CURLUSER:$CURLPASSWORD"
fi
- RESOURCEVERSION=$(curl --request GET -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" $RESTURL$RESOURCE | python -c "import sys, json; print json.load(sys.stdin)['resource-version']")
+ RESOURCEVERSION=$(curl --request GET -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" $RESTURL$RESOURCE | jq -r '.["resource-version"]')
if [ $ACTION = "PUT" ]; then
result=`curl --request PUT -sL -w "%{http_code}" -o /dev/null -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" -T $JSONFILE $RESTURL$RESOURCE$RELATIONSHIP?$RESOURCEVERSION`
#echo "result is $result."
@@ -161,7 +161,7 @@ if [ $MISSING_PROP = false ]; then
if [[ "$result" -ge 200 && $result -lt 300 ]]
then
echo "PUT result is OK, $result"
- curl --request GET -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" $RESTURL$RESOURCE | python -mjson.tool
+ curl --request GET -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" $RESTURL$RESOURCE | jq '.'
else
if [ -z $ALLOWHTTPRESPONSES ]; then
echo "PUT request failed, response code was $result"
@@ -198,7 +198,7 @@ if [ $MISSING_PROP = false ]; then
if [[ "$result" -ge 200 && $result -lt 300 ]]
then
echo "DELETE result is OK, $result"
- curl --request GET -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" $RESTURL$RESOURCE | python -mjson.tool
+ curl --request GET -sL -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" $RESTURL$RESOURCE | jq '.'
else
echo "failed DELETE request, response code was $result"
RC=$result
diff --git a/aai-resources/src/main/scripts/run_DbTestProcessBuilder.sh b/aai-resources/src/main/scripts/run_DbTestProcessBuilder.sh
index b3a3ac4..6e6ac6f 100644
--- a/aai-resources/src/main/scripts/run_DbTestProcessBuilder.sh
+++ b/aai-resources/src/main/scripts/run_DbTestProcessBuilder.sh
@@ -1,15 +1,16 @@
#!/bin/ksh
-#
+
+###
# ============LICENSE_START=======================================================
# org.onap.aai
# ================================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# 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,
@@ -17,39 +18,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ============LICENSE_END=========================================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
-
-#
-# This script invokes the dataSnapshot java class passing an option to tell it to take
-# a snapshot of the database and store it as a single-line XML file.
-#
-
-echo
-echo `date` " Starting $0"
-
-
-userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
-if [ "${userid}" != "aaiadmin" ]; then
- echo "You must be aaiadmin to run $0. The id used $userid."
- exit 1
-fi
-
-. /etc/profile.d/aai.sh
-PROJECT_HOME=/opt/app/aai-resources
+###
-for JAR in `ls $PROJECT_HOME/extJars/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
-for JAR in `ls $PROJECT_HOME/lib/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
+start_date;
+check_user;
+source_profile;
-$JAVA_HOME/bin/java -classpath $CLASSPATH -Dhttps.protocols=TLSv1.1,TLSv1.2 -DAJSC_HOME=$PROJECT_HOME -Daai.home=$PROJECT_HOME org.onap.aai.util.DbTestProcessBuilder "$@"
+CERTPATH=$PROJECT_HOME/resources/etc/auth/
+KEYNAME=aaiClientPrivateKey.pem
+CERTNAME=aaiClientPublicCert.pem
-echo `date` " Done $0"
+pw=$(execute_spring_jar org.onap.aai.util.AAIConfigCommandLinePropGetter "" "aai.keystore.passwd" 2> /dev/null | tail -1)
+openssl pkcs12 -in ${CERTPATH}/aai-client-cert.p12 -out $CERTPATH$CERTNAME -clcerts -nokeys -passin pass:$pw
+openssl pkcs12 -in ${CERTPATH}/aai-client-cert.p12 -out $CERTPATH$KEYNAME -nocerts -nodes -passin pass:$pw
+end_date;
exit 0
diff --git a/aai-resources/src/main/scripts/run_Migrations.sh b/aai-resources/src/main/scripts/run_Migrations.sh
index 7f0ea08..1309094 100644
--- a/aai-resources/src/main/scripts/run_Migrations.sh
+++ b/aai-resources/src/main/scripts/run_Migrations.sh
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/sh
###
# ============LICENSE_START=======================================================
@@ -20,57 +20,28 @@
# ============LICENSE_END=========================================================
###
-echo
-echo $(date) " Starting $0"
-
-userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
-if [ "${userid}" != "aaiadmin" ]; then
- echo "You must be aaiadmin to run $0. The id used $userid."
- exit 1
-fi
-
-if [ -f "/etc/profile.d/aai.sh" ]; then
- source /etc/profile.d/aai.sh
-else
- echo "File not found: /etc/profile.d/aai.sh";
- exit
-fi
-
-JAVA=$JAVA_HOME/bin/java
-PROJECT_HOME=/opt/app/aai-resources
-
-ARGS="-c ${PROJECT_HOME}/bundleconfig/etc/appprops/titan-realtime.properties $@"
-
-for JAR in $(ls $PROJECT_HOME/extJars/*.jar)
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-UUID=$(uuidgen)
-
-unzip -o $PROJECT_HOME/lib/ajsc-runner-5.0.0-RC16.0.5.jar -d /tmp/ajsc-war-$UUID/ > /dev/null
-unzip -o /tmp/ajsc-war-$UUID/ajsc-war-5.0.0-RC16.0.5.war -d /tmp/ajsc-war-$UUID/ > /dev/null
-
-for JAR in $(ls /tmp/ajsc-war-$UUID/WEB-INF/lib/*.jar)
-do
- if [[ ! "$JAR" =~ .*logback-classic-.*.jar ]];
- then
- CLASSPATH=$CLASSPATH:$JAR
- fi
-done
-
-for JAR in $(ls /opt/app/swm/dme2/lib/*.jar)
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-for JAR in $(ls $PROJECT_HOME/lib/*.jar)
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-CLASSPATH=$CLASSPATH:${PROJECT_HOME}"/bundleconfig/etc/tmp-config/"
-
-$JAVA -Dhttps.protocols=TLSv1.1,TLSv1.2 -DAJSC_HOME=$PROJECT_HOME -Daai.home=$PROJECT_HOME -DBUNDLECONFIG_DIR="bundleconfig" -Dlogback.configurationFile=$PROJECT_HOME/bundleconfig/etc/appprops/migration-logback.xml -cp $CLASSPATH org.onap.aai.migration.MigrationController $ARGS
-
-rm -r /tmp/ajsc-war-$UUID/
+COMMON_ENV_PATH=$( cd "$(dirname "$0")" ; pwd -P )
+. ${COMMON_ENV_PATH}/common_functions.sh
+
+# TODO: There is a better way where you can pass in the function
+# and then let the common functions check if the function exist and invoke it
+# So this all can be templated out
+start_date;
+check_user;
+source_profile;
+
+ARGS="-c ${PROJECT_HOME}/resources/etc/appprops/titan-realtime.properties";
+
+if [ -f "$PROJECT_HOME/resources/application.properties" ]; then
+ # Get the application properties file and look for all lines
+ # starting with either jms dmaap or niws
+ # Turn them into system properties and export JAVA_PRE_OPTS so
+ # execute spring jar will get those values
+ # This is only needed since dmaap is used by run_migrations
+ JAVA_PRE_OPTS=$(egrep '^(dmaap|jms|niws)' $PROJECT_HOME/resources/application.properties | sed 's/^\(.*\)$/-D\1/g' | tr '\n' ' ');
+ export JAVA_PRE_OPTS;
+fi;
+
+execute_spring_jar org.onap.aai.migration.MigrationController ${PROJECT_HOME}/resources/etc/appprops/migration-logback.xml ${ARGS} "$@"
+end_date;
+exit 0
diff --git a/aai-resources/src/main/scripts/run_FixXSD.sh b/aai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/docker-compose.template.yaml
index 40ffb81..5a2712b 100644
--- a/aai-resources/src/main/scripts/run_FixXSD.sh
+++ b/aai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/docker-compose.template.yaml
@@ -1,4 +1,3 @@
-#!/bin/ksh
#
# ============LICENSE_START=======================================================
# org.onap.aai
@@ -21,49 +20,22 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-#
-# The script invokes GetResource java class to get all nodes
-#
-
-echo
-echo `date` " Starting $0"
-
-REV=$1
-AAIHOME=$2
-echo "AAIHOME: $AAIHOME"
-
-if test "$REV" = ""
-then
- REV=v6
-fi
-
-. /etc/profile.d/aai.sh
-PROJECT_HOME=/opt/app/aai-resources
-
-if test "$AAIHOME" = ""
-then
- AAIHOME=$PROJECT_HOME
-fi
-
-
-for JAR in `ls $AAIHOME/target/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-for JAR in `ls $PROJECT_HOME/lib/*.jar`
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-export REV=$REV
-echo "FixXSD $REV $AAIHOME"
-$JAVA_HOME/bin/java -classpath $CLASSPATH -DAJSC_HOME=$AAIHOME org.onap.aai.util.FixXSDNew $REV
-ret_code=$?
-if [ $ret_code != 0 ]; then
- echo `date` " Done $0"
- exit $ret_code
-fi
-
-echo `date` " Done $0"
-exit 0
+# SCLD_ENV is for the environment context for dme2
+# AAI_CHEF_ENV is used for both dme2 properites and
+# also used by chef to generate appropriate properties
+
+version: '2'
+services:
+ aai-resources:
+ image: __REGISTRY__/__NAMESPACE__/aai-resources:__IMAGE_VERSION__
+ network_mode: host
+ environment:
+ - LOCAL_USER_ID=__LOCAL_USER_ID__
+ - LOCAL_GROUP_ID=__LOCAL_GROUP_ID__
+ volumes:
+ - /opt/aai/logroot/AAI-RES:/opt/aai/logroot/AAI-RES
+ logging:
+ driver: "json-file"
+ options:
+ max-size: "30m"
+ max-file: "5"
diff --git a/aai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/execTool.sh b/aai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/execTool.sh
new file mode 100644
index 0000000..8613410
--- /dev/null
+++ b/aai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/execTool.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+
+export WORKING_DIR="$( cd "$(dirname "$0")" ; pwd -P )/"
+
+CONTAINER_NAME=$(docker ps | grep 'aai-resources' | awk '{ print $7; }');
+
+SCRIPT_NAME=$1;
+
+shift;
+
+docker exec -u aaiadmin ${CONTAINER_NAME} ls /opt/app/aai-resources/scripts/${SCRIPT_NAME} && {
+ docker exec -u aaiadmin ${CONTAINER_NAME} /opt/app/aai-resources/scripts/${SCRIPT_NAME} "$@"
+ exit 0;
+} || {
+ echo "Unable to find the tool in the /opt/app/aai-resources/scripts";
+ exit 1;
+}
diff --git a/aai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/kill_resources.sh b/aai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/kill_resources.sh
new file mode 100755
index 0000000..d8e14e5
--- /dev/null
+++ b/aai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/kill_resources.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+. /etc/profile.d/aai.sh
+PROJECT_HOME=/opt/app/aai-resources
+
+docker-compose -f ${PROJECT_HOME}/docker-compose.yaml stop && \
+ docker-compose -f ${PROJECT_HOME}/docker-compose.yaml rm -f
diff --git a/aai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/start_resources.sh b/aai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/start_resources.sh
new file mode 100755
index 0000000..e9d73ec
--- /dev/null
+++ b/aai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/start_resources.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+. /etc/profile.d/aai.sh
+PROJECT_HOME=/opt/app/aai-resources
+
+docker-compose -f ${PROJECT_HOME}/docker-compose.yaml up -d || exit 200
diff --git a/aai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/stop_resources.sh b/aai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/stop_resources.sh
new file mode 100755
index 0000000..05bd23d
--- /dev/null
+++ b/aai-resources/src/main/swm/package/nix/dist_files/opt/app/aai-resources/stop_resources.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+. /etc/profile.d/aai.sh
+PROJECT_HOME=/opt/app/aai-resources
+
+docker-compose -f ${PROJECT_HOME}/docker-compose.yaml stop || exit 200
diff --git a/aai-resources/src/main/swm/package/nix/install/postproc/post_proc b/aai-resources/src/main/swm/package/nix/install/postproc/post_proc
new file mode 100644
index 0000000..d017750
--- /dev/null
+++ b/aai-resources/src/main/swm/package/nix/install/postproc/post_proc
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd ../../common
+exec sh -x ./install_postproc.sh
diff --git a/aai-resources/src/main/swm/package/nix/install/preproc/pre_proc b/aai-resources/src/main/swm/package/nix/install/preproc/pre_proc
new file mode 100644
index 0000000..3f1b26f
--- /dev/null
+++ b/aai-resources/src/main/swm/package/nix/install/preproc/pre_proc
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd ../../common
+exec sh -x ./install_preproc.sh
diff --git a/aai-resources/src/test/java/org/onap/aai/AAISetup.java b/aai-resources/src/test/java/org/onap/aai/AAISetup.java
index 05864fd..d3b5abe 100644
--- a/aai-resources/src/test/java/org/onap/aai/AAISetup.java
+++ b/aai-resources/src/test/java/org/onap/aai/AAISetup.java
@@ -35,9 +35,9 @@ public abstract class AAISetup {
@BeforeClass
public static void setupBundleconfig() throws Exception {
- System.setProperty("AJSC_HOME", ".");
- System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local");
- QueryFormatTestHelper.setFinalStatic(AAIConstants.class.getField("AAI_HOME_ETC_OXM"), "bundleconfig-local/etc/oxm/");
+ System.setProperty("AJSC_HOME", "./");
+ System.setProperty("BUNDLECONFIG_DIR", "src/main/resources/");
+// QueryFormatTestHelper.setFinalStatic(AAIConstants.class.getField("AAI_HOME_ETC_OXM"), "bundleconfig-local/etc/oxm/");
}
public String getPayload(String filename) throws IOException {
diff --git a/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java b/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java
new file mode 100644
index 0000000..f2745c0
--- /dev/null
+++ b/aai-resources/src/test/java/org/onap/aai/ResourcesTestConfiguration.java
@@ -0,0 +1,125 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.apache.http.client.HttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.ssl.SSLContextBuilder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.TestConfiguration;
+import org.springframework.boot.web.client.RestTemplateBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.core.env.Environment;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.client.ClientHttpResponse;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.util.ResourceUtils;
+import org.springframework.web.client.ResponseErrorHandler;
+import org.springframework.web.client.RestTemplate;
+
+import javax.net.ssl.SSLContext;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.KeyStore;
+
+@TestConfiguration
+public class ResourcesTestConfiguration {
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(ResourcesTestConfiguration.class);
+
+ @Autowired
+ private Environment env;
+
+ /**
+ * Create a RestTemplate bean, using the RestTemplateBuilder provided
+ * by the auto-configuration.
+ */
+ @Bean
+ RestTemplate restTemplate(RestTemplateBuilder builder) throws Exception {
+
+ char[] trustStorePassword = env.getProperty("server.ssl.trust-store-password").toCharArray();
+ char[] keyStorePassword = env.getProperty("server.ssl.key-store-password").toCharArray();
+
+ String keyStore = env.getProperty("server.ssl.key-store");
+ String trustStore = env.getProperty("server.ssl.trust-store");
+
+ SSLContextBuilder sslContextBuilder = SSLContextBuilder.create();
+
+ if(env.acceptsProfiles("two-way-ssl")){
+ sslContextBuilder = sslContextBuilder.loadKeyMaterial(loadPfx(keyStore, keyStorePassword), keyStorePassword);
+ }
+
+ SSLContext sslContext = sslContextBuilder
+ .loadTrustMaterial(ResourceUtils.getFile(trustStore), trustStorePassword)
+ .build();
+
+ HttpClient client = HttpClients.custom()
+ .setSSLContext(sslContext)
+ .setSSLHostnameVerifier((s, sslSession) -> true)
+ .build();
+
+ RestTemplate restTemplate = builder
+ .requestFactory(new HttpComponentsClientHttpRequestFactory(client))
+ .build();
+
+ restTemplate.setErrorHandler(new ResponseErrorHandler() {
+ @Override
+ public boolean hasError(ClientHttpResponse clientHttpResponse) throws IOException {
+ if (clientHttpResponse.getStatusCode() != HttpStatus.OK) {
+
+ logger.debug("Status code: " + clientHttpResponse.getStatusCode());
+
+ if (clientHttpResponse.getStatusCode() == HttpStatus.FORBIDDEN) {
+ logger.debug("Call returned a error 403 forbidden resposne ");
+ return true;
+ }
+
+ if(clientHttpResponse.getRawStatusCode() % 100 == 5){
+ logger.debug("Call returned a error " + clientHttpResponse.getStatusText());
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public void handleError(ClientHttpResponse clientHttpResponse) throws IOException {
+ }
+ });
+
+ return restTemplate;
+ }
+
+ private KeyStore loadPfx(String file, char[] password) throws Exception {
+ KeyStore keyStore = KeyStore.getInstance("PKCS12");
+ File key = ResourceUtils.getFile(file);
+ try (InputStream in = new FileInputStream(key)) {
+ keyStore.load(in, password);
+ }
+ return keyStore;
+ }
+}
diff --git a/aai-resources/src/test/java/org/onap/aai/dbgen/DupeToolTest.java b/aai-resources/src/test/java/org/onap/aai/dbgen/DupeToolTest.java
new file mode 100644
index 0000000..3da335b
--- /dev/null
+++ b/aai-resources/src/test/java/org/onap/aai/dbgen/DupeToolTest.java
@@ -0,0 +1,150 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.dbgen;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.thinkaurelius.titan.core.TitanTransaction;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.aai.AAISetup;
+import org.onap.aai.dbmap.AAIGraph;
+import org.onap.aai.serialization.db.EdgeRules;
+
+import static org.junit.Assert.*;
+
+
+public class DupeToolTest extends AAISetup {
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(DupeToolTest.class);
+
+ private DupeTool dupeTool;
+
+ @Before
+ public void setup(){
+ dupeTool = new DupeTool();
+ dupeTool.SHOULD_EXIT_VM = false;
+ createGraph();
+ }
+
+ private void createGraph() {
+ TitanTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction();
+
+ EdgeRules edgeRules = EdgeRules.getInstance();
+
+ boolean success = true;
+
+ try {
+
+ GraphTraversalSource g = transaction.traversal();
+
+ Vertex cloudRegionVertex = g.addV()
+ .property("aai-node-type", "cloud-region")
+ .property("cloud-owner", "test-owner")
+ .property("cloud-region-id", "test-region")
+ .property("source-of-truth", "JUNIT")
+ .next();
+
+ Vertex tenantVertex = g.addV()
+ .property("aai-node-type", "tenant")
+ .property("tenant-id", "test-tenant")
+ .property("source-of-truth", "JUNIT")
+ .next();
+
+ Vertex pserverVertex = g.addV()
+ .property("aai-node-type", "pserver")
+ .property("hostname", "test-pserver")
+ .property("in-maint", false)
+ .property("source-of-truth", "JUNIT")
+ .next();
+
+ for(int i = 0; i < 100; ++i){
+ g.addV()
+ .property("aai-node-type", "pserver")
+ .property("hostname", "test-pserver")
+ .property("in-maint", false)
+ .property("source-of-truth", "JUNIT")
+ .next();
+ }
+
+ edgeRules.addTreeEdge(g, cloudRegionVertex, tenantVertex);
+ edgeRules.addEdge(g, cloudRegionVertex, pserverVertex);
+
+ } catch(Exception ex){
+ success = false;
+ logger.error("Unable to create the vertexes", ex);
+ } finally {
+ if(success){
+ transaction.commit();
+ } else {
+ transaction.rollback();
+ fail("Unable to setup the graph");
+ }
+ }
+ }
+
+ @Test
+ public void testDupeTool(){
+
+ String[] args = {
+ "-userId", "testuser",
+ "-nodeType", "pserver",
+ "-timeWindowMinutes", "30",
+ "-autoFix",
+ "-maxFix", "30",
+ "-sleepMinutes", "0"
+ };
+
+ dupeTool.main(args);
+ }
+
+ @After
+ public void tearDown(){
+
+ TitanTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction();
+ boolean success = true;
+
+ try {
+
+ GraphTraversalSource g = transaction.traversal();
+
+ g.V().has("source-of-truth", "JUNIT")
+ .toList()
+ .forEach(v -> v.remove());
+
+ } catch(Exception ex){
+ success = false;
+ logger.error("Unable to remove the vertexes", ex);
+ } finally {
+ if(success){
+ transaction.commit();
+ } else {
+ transaction.rollback();
+ fail("Unable to teardown the graph");
+ }
+ }
+
+ }
+}
diff --git a/aai-resources/src/test/java/org/onap/aai/dbgen/ForceDeleteToolTest.java b/aai-resources/src/test/java/org/onap/aai/dbgen/ForceDeleteToolTest.java
new file mode 100644
index 0000000..7f78421
--- /dev/null
+++ b/aai-resources/src/test/java/org/onap/aai/dbgen/ForceDeleteToolTest.java
@@ -0,0 +1,210 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.dbgen;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.thinkaurelius.titan.core.TitanTransaction;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+import org.onap.aai.AAISetup;
+import org.onap.aai.dbmap.AAIGraph;
+import org.onap.aai.serialization.db.EdgeRules;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.List;
+
+import static org.junit.Assert.fail;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ForceDeleteToolTest extends AAISetup {
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(ForceDeleteToolTest.class);
+
+ private ForceDeleteTool deleteTool;
+
+ private Vertex cloudRegionVertex;
+ @Before
+ public void setup(){
+ deleteTool = new ForceDeleteTool();
+ deleteTool.SHOULD_EXIT_VM = false;
+ TitanTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction();
+
+ EdgeRules edgeRules = EdgeRules.getInstance();
+
+ boolean success = true;
+
+ try {
+
+ GraphTraversalSource g = transaction.traversal();
+
+ cloudRegionVertex = g.addV()
+ .property("aai-node-type", "cloud-region")
+ .property("cloud-owner", "test-owner")
+ .property("cloud-region-id", "test-region")
+ .property("source-of-truth", "JUNIT")
+ .next();
+
+ Vertex tenantVertex = g.addV()
+ .property("aai-node-type", "tenant")
+ .property("tenant-id", "test-tenant")
+ .property("source-of-truth", "JUNIT")
+ .next();
+
+ Vertex pserverVertex = g.addV()
+ .property("aai-node-type", "pserver")
+ .property("hostname", "test-pserver")
+ .property("in-maint", false)
+ .property("source-of-truth", "JUNIT")
+ .next();
+
+ edgeRules.addTreeEdge(g, cloudRegionVertex, tenantVertex);
+ edgeRules.addEdge(g, cloudRegionVertex, pserverVertex);
+
+ } catch(Exception ex){
+ success = false;
+ logger.error("Unable to create the vertexes", ex);
+ } finally {
+ if(success){
+ transaction.commit();
+ } else {
+ transaction.rollback();
+ fail("Unable to setup the graph");
+ }
+ }
+
+
+ }
+
+ @Test
+ public void testCollectDataForVertex(){
+
+ String [] args = {
+
+ "-action",
+ "COLLECT_DATA",
+ "-userId",
+ "someuser",
+ "-params4Collect",
+ "cloud-owner|test-owner"
+ };
+
+ deleteTool.main(args);
+ }
+
+ @Test
+ public void testDeleteNode(){
+
+ String id = cloudRegionVertex.id().toString();
+
+ String [] args = {
+
+ "-action",
+ "DELETE_NODE",
+ "-userId",
+ "someuser",
+ "-vertexId",
+ id
+ };
+
+ deleteTool.main(args);
+ }
+
+ @Test
+ public void testCollectDataForEdge(){
+
+ TitanTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction();
+ GraphTraversalSource g = transaction.traversal();
+ List<Edge> edges = g.E().toList();
+ String cloudRegionToPserverId = edges.get(0).id().toString();
+
+ String [] args = {
+
+ "-action",
+ "COLLECT_DATA",
+ "-userId",
+ "someuser",
+ "-edgeId",
+ cloudRegionToPserverId
+ };
+
+ deleteTool.main(args);
+ }
+
+ @Test
+ public void testDeleteForEdge(){
+
+ InputStream systemInputStream = System.in;
+ ByteArrayInputStream in = new ByteArrayInputStream("y".getBytes());
+ System.setIn(in);
+ TitanTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction();
+ GraphTraversalSource g = transaction.traversal();
+ List<Edge> edges = g.E().toList();
+ String cloudRegionToPserverId = edges.get(0).id().toString();
+
+ String [] args = {
+
+ "-action",
+ "DELETE_EDGE",
+ "-userId",
+ "someuser",
+ "-edgeId",
+ cloudRegionToPserverId
+ };
+
+ deleteTool.main(args);
+ System.setIn(systemInputStream);
+ }
+ @After
+ public void tearDown(){
+
+ TitanTransaction transaction = AAIGraph.getInstance().getGraph().newTransaction();
+ boolean success = true;
+
+ try {
+
+ GraphTraversalSource g = transaction.traversal();
+
+ g.V().has("source-of-truth", "JUNIT")
+ .toList()
+ .forEach(v -> v.remove());
+
+ } catch(Exception ex){
+ success = false;
+ logger.error("Unable to remove the vertexes", ex);
+ } finally {
+ if(success){
+ transaction.commit();
+ } else {
+ transaction.rollback();
+ fail("Unable to teardown the graph");
+ }
+ }
+ }
+}
diff --git a/aai-resources/src/test/java/org/onap/aai/interceptors/AAILogJAXRSInInterceptorTest.java b/aai-resources/src/test/java/org/onap/aai/interceptors/AAILogJAXRSInInterceptorTest.java
deleted file mode 100644
index 01a6788..0000000
--- a/aai-resources/src/test/java/org/onap/aai/interceptors/AAILogJAXRSInInterceptorTest.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.aai.interceptors;
-
-import org.apache.cxf.message.Exchange;
-import org.apache.cxf.message.ExchangeImpl;
-import org.apache.cxf.message.Message;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.aai.AAISetup;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.mockito.Mockito.*;
-
-public class AAILogJAXRSInInterceptorTest extends AAISetup {
-
- private AAILogJAXRSInInterceptor aaiLogJAXRSInInterceptor;
-
- private Message message;
- private Exchange exchange;
- private InputStream is;
- private Map<String, List<String>> headers;
-
-
- @Before
- public void setup(){
-
- aaiLogJAXRSInInterceptor = new AAILogJAXRSInInterceptor();
-
- message = mock(Message.class);
- exchange = spy(new ExchangeImpl());
-
- is = getClass().getClassLoader().getResourceAsStream("logback.xml");
-
- headers = new HashMap<>();
- headers.put("X-FromAppId", Arrays.asList("JUNIT"));
- headers.put("X-TransactionId", Arrays.asList("JUNIT"));
- headers.put("Content-Type", Arrays.asList("application/json"));
- headers.put("Accept", Arrays.asList("application/json"));
- }
-
- @Test
- public void testHandleMessageWhenNotCamelRequest() throws IOException {
-
- when(message.getExchange()).thenReturn(exchange);
- when(message.getContent(InputStream.class)).thenReturn(is);
- when(message.get(Message.PROTOCOL_HEADERS)).thenReturn(headers);
- when(message.get(Message.CONTENT_TYPE)).thenReturn("*/*");
-
- when(message.get("CamelHttpUrl")).thenReturn("/somestring");
- aaiLogJAXRSInInterceptor.handleMessage(message);
- }
-
- @Test
- public void testHandleMessageWhenUUIDHasMultiple() throws IOException {
-
- Map<String, List<String>> headers = new HashMap<>();
-
- headers.put("X-FromAppId", Arrays.asList("JUNIT"));
- headers.put("X-TransactionId", Arrays.asList("jfasodjf:fjaosjfidsaj:afsidjfaodfja"));
- headers.put("Content-Type", Arrays.asList("application/json"));
- headers.put("Accept", Arrays.asList("application/json"));
-
- when(message.getExchange()).thenReturn(exchange);
- when(message.getContent(InputStream.class)).thenReturn(is);
- when(message.get(Message.PROTOCOL_HEADERS)).thenReturn(headers);
- when(message.get(Message.CONTENT_TYPE)).thenReturn("*/*");
-
- when(message.get("CamelHttpUrl")).thenReturn("/somestring");
- aaiLogJAXRSInInterceptor.handleMessage(message);
- }
-
- @Test
- public void testHandleMessageWhenMissingTransactionId() throws IOException {
-
- Map<String, List<String>> headers = new HashMap<>();
-
- headers.put("X-FromAppId", Arrays.asList("JUNIT"));
- headers.put("Content-Type", Arrays.asList("application/json"));
- headers.put("Accept", Arrays.asList("application/json"));
-
- when(message.getExchange()).thenReturn(exchange);
- when(message.getContent(InputStream.class)).thenReturn(is);
- when(message.get(Message.PROTOCOL_HEADERS)).thenReturn(headers);
- when(message.get(Message.CONTENT_TYPE)).thenReturn("*/*");
-
- when(message.get("CamelHttpUrl")).thenReturn("/somestring");
- aaiLogJAXRSInInterceptor.handleMessage(message);
- }
-
- @Test
- public void testHandleMessageWhenMissingContentType() throws IOException {
-
- Map<String, List<String>> headers = new HashMap<>();
-
- headers.put("X-FromAppId", Arrays.asList("JUNIT"));
- headers.put("X-TransactionId", Arrays.asList("jfasodjf:fjaosjfidsaj:afsidjfaodfja"));
- headers.put("Accept", Arrays.asList("application/json"));
-
- when(message.getExchange()).thenReturn(exchange);
- when(message.getContent(InputStream.class)).thenReturn(is);
- when(message.get(Message.PROTOCOL_HEADERS)).thenReturn(headers);
- when(message.get(Message.CONTENT_TYPE)).thenReturn("*/*");
-
- when(message.get("CamelHttpUrl")).thenReturn("/somestring");
- aaiLogJAXRSInInterceptor.handleMessage(message);
- }
-
- @Test
- public void testHandleMessageWhenQueryExistsAndUriEcho() throws IOException {
-
- Map<String, List<String>> headers = new HashMap<>();
-
- headers.put("X-FromAppId", Arrays.asList("JUNIT"));
- headers.put("X-TransactionId", Arrays.asList("jfasodjf:fjaosjfidsaj:afsidjfaodfja"));
- headers.put("Content-Type", Arrays.asList("application/json"));
- headers.put("Accept", Arrays.asList("application/json"));
-
- when(message.getExchange()).thenReturn(exchange);
- when(message.getContent(InputStream.class)).thenReturn(is);
- when(message.get(Message.PROTOCOL_HEADERS)).thenReturn(headers);
- when(message.get(Message.CONTENT_TYPE)).thenReturn("*/*");
- when(message.get(Message.QUERY_STRING)).thenReturn(null);
- when(exchange.containsKey("AAI_LOGGING_HBASE_ENABLED")).thenReturn(true);
- when(exchange.remove("AAI_LOGGING_HBASE_ENABLED")).thenReturn("");
- when(exchange.containsKey("AAI_LOGGING_TRACE_ENABLED")).thenReturn(true);
- when(exchange.remove("AAI_LOGGING_TRACE_ENABLED")).thenReturn("");
- when(message.get("CamelHttpUrl")).thenReturn("/util/echo");
- aaiLogJAXRSInInterceptor.handleMessage(message);
- }
-
- @Test
- public void testHandleMessageWhenQueryExistsAndUriTranslog() throws IOException {
-
- Map<String, List<String>> headers = new HashMap<>();
-
- headers.put("X-FromAppId", Arrays.asList("JUNIT"));
- headers.put("X-TransactionId", Arrays.asList("jfasodjf:fjaosjfidsaj:afsidjfaodfja"));
- headers.put("Content-Type", Arrays.asList("application/json"));
- headers.put("Accept", Arrays.asList("application/json"));
-
- when(message.getExchange()).thenReturn(exchange);
- when(message.getContent(InputStream.class)).thenReturn(is);
- when(message.get(Message.PROTOCOL_HEADERS)).thenReturn(headers);
- when(message.get(Message.CONTENT_TYPE)).thenReturn("*/*");
- when(message.get(Message.QUERY_STRING)).thenReturn(null);
- when(exchange.containsKey("AAI_LOGGING_HBASE_ENABLED")).thenReturn(true);
- when(exchange.remove("AAI_LOGGING_HBASE_ENABLED")).thenReturn("");
- when(exchange.containsKey("AAI_LOGGING_TRACE_ENABLED")).thenReturn(true);
- when(exchange.remove("AAI_LOGGING_TRACE_ENABLED")).thenReturn("");
- when(message.get("CamelHttpUrl")).thenReturn("/translog/");
- aaiLogJAXRSInInterceptor.handleMessage(message);
- }
-
- @Test
- public void testHandleMessageWhenPutMessageKeyReturnsException() throws IOException {
-
- Map<String, List<String>> headers = new HashMap<>();
-
- headers.put("X-FromAppId", Arrays.asList("JUNIT"));
- headers.put("X-TransactionId", Arrays.asList("jfasodjf:fjaosjfidsaj:afsidjfaodfja"));
- headers.put("Content-Type", Arrays.asList("application/json"));
- headers.put("Accept", Arrays.asList("application/json"));
-
- when(message.getExchange()).thenReturn(exchange);
- when(message.getContent(InputStream.class)).thenReturn(is);
- when(message.get(Message.PROTOCOL_HEADERS)).thenReturn(headers);
- when(message.get(Message.CONTENT_TYPE)).thenReturn("*/*");
- when(message.get(Message.QUERY_STRING)).thenReturn(null);
- when(exchange.containsKey("AAI_LOGGING_HBASE_ENABLED")).thenReturn(true);
- when(exchange.remove("AAI_LOGGING_HBASE_ENABLED")).thenReturn("");
- when(exchange.containsKey("AAI_LOGGING_TRACE_ENABLED")).thenReturn(true);
- when(exchange.remove("AAI_LOGGING_TRACE_ENABLED")).thenReturn("");
- when(message.get("CamelHttpUrl")).thenReturn("/translog/");
- when(message.get(Message.ENCODING)).thenReturn("http");
- when(message.get(Message.RESPONSE_CODE)).thenReturn(200);
-
- aaiLogJAXRSInInterceptor.handleMessage(message);
- }
-} \ No newline at end of file
diff --git a/aai-resources/src/test/java/org/onap/aai/interceptors/AAILogJAXRSOutInterceptorTest.java b/aai-resources/src/test/java/org/onap/aai/interceptors/AAILogJAXRSOutInterceptorTest.java
deleted file mode 100644
index 455aa2c..0000000
--- a/aai-resources/src/test/java/org/onap/aai/interceptors/AAILogJAXRSOutInterceptorTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.aai.interceptors;
-
-import org.apache.cxf.io.CacheAndWriteOutputStream;
-import org.apache.cxf.message.Exchange;
-import org.apache.cxf.message.ExchangeImpl;
-import org.apache.cxf.message.Message;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.aai.AAISetup;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.mockito.Mockito.*;
-
-public class AAILogJAXRSOutInterceptorTest extends AAISetup {
-
- private AAILogJAXRSOutInterceptor aaiLogJAXRSOutInterceptor;
-
- private Message message;
- private Exchange exchange;
- private OutputStream out;
- private Map<String, List<String>> headers;
- private Message outMessage;
- private Message inMessage;
-
-
- @Before
- public void setup(){
-
- aaiLogJAXRSOutInterceptor = new AAILogJAXRSOutInterceptor();
-
- message = mock(Message.class);
- exchange = spy(new ExchangeImpl());
- out = mock(OutputStream.class);
- outMessage = mock(Message.class);
- inMessage = mock(Message.class);
-
-
- headers = new HashMap<>();
- headers.put("X-FromAppId", Arrays.asList("JUNIT"));
- headers.put("X-TransactionId", Arrays.asList("JUNIT"));
- headers.put("Content-Type", Arrays.asList("application/json"));
- headers.put("Accept", Arrays.asList("application/json"));
- }
-
- @Test
- public void testHandleMessageWhenNotCamelRequest() throws IOException {
-
- when(message.getExchange()).thenReturn(exchange);
- when(message.getContent(OutputStream.class)).thenReturn(out);
- when(message.get(Message.PROTOCOL_HEADERS)).thenReturn(headers);
- when(message.get(Message.CONTENT_TYPE)).thenReturn("*/*");
- when(exchange.getOutMessage()).thenReturn(outMessage);
- when(outMessage.getContent(OutputStream.class)).thenReturn(out);
- when(exchange.containsKey("AAI_LOGGING_HBASE_ENABLED")).thenReturn(true);
- when(exchange.remove("AAI_LOGGING_HBASE_ENABLED")).thenReturn("");
-
- when(message.get("CamelHttpUrl")).thenReturn("/somestring");
- aaiLogJAXRSOutInterceptor.handleMessage(message);
- }
-
- @Test
- public void testLogCallBack(){
-
- when(message.getExchange()).thenReturn(exchange);
- when(message.getContent(OutputStream.class)).thenReturn(out);
- when(message.get(Message.PROTOCOL_HEADERS)).thenReturn(headers);
- when(message.get(Message.CONTENT_TYPE)).thenReturn("*/*");
- when(exchange.getOutMessage()).thenReturn(outMessage);
-
- when(outMessage.getContent(OutputStream.class)).thenReturn(out);
- when(exchange.containsKey("AAI_LOGGING_HBASE_ENABLED")).thenReturn(true);
- when(exchange.remove("AAI_LOGGING_HBASE_ENABLED")).thenReturn("");
- when(exchange.getInMessage()).thenReturn(inMessage);
-
- when(inMessage.getExchange()).thenReturn(exchange);
- when(inMessage.getContent(OutputStream.class)).thenReturn(out);
- when(inMessage.get(Message.PROTOCOL_HEADERS)).thenReturn(headers);
- when(inMessage.get(Message.CONTENT_TYPE)).thenReturn("*/*");
-
- AAILogJAXRSOutInterceptor.LoggingCallback loggingCallback = new AAILogJAXRSOutInterceptor().new LoggingCallback(message, out);
- final CacheAndWriteOutputStream newOut = new CacheAndWriteOutputStream(out);
- loggingCallback.onClose(newOut);
- }
-
-} \ No newline at end of file
diff --git a/aai-resources/src/test/java/org/onap/aai/interceptors/PostAaiAjscInterceptorTest.java b/aai-resources/src/test/java/org/onap/aai/interceptors/PostAaiAjscInterceptorTest.java
deleted file mode 100644
index a1e0259..0000000
--- a/aai-resources/src/test/java/org/onap/aai/interceptors/PostAaiAjscInterceptorTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.aai.interceptors;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.onap.aai.logging.LoggingContext;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public class PostAaiAjscInterceptorTest {
-
- private PostAaiAjscInterceptor postAaiAjscInterceptor;
-
- @Before
- public void setup(){
- postAaiAjscInterceptor = new PostAaiAjscInterceptor();
- }
-
- @Test
- public void getInstance() throws Exception {
- PostAaiAjscInterceptor interceptor = PostAaiAjscInterceptor.getInstance();
- assertNotNull(interceptor);
- }
-
- @Test
- public void testAllowOrRejectIfSuccess() throws Exception {
-
- HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
- HttpServletResponse resp = Mockito.mock(HttpServletResponse.class);
- resp.setStatus(HttpServletResponse.SC_OK);
- LoggingContext.put(LoggingContext.LoggingField.RESPONSE_CODE.toString(), "0");
- Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("/fadsjoifj"));
-
- boolean success = postAaiAjscInterceptor.allowOrReject(request, resp, null);
-
- assertTrue("Expecting the post interceptor to return success regardless", success);
- }
-
- @Test
- public void testAllowOrRejectIfFailure() throws Exception {
-
- HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
- HttpServletResponse resp = Mockito.mock(HttpServletResponse.class);
- resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
- LoggingContext.put(LoggingContext.LoggingField.RESPONSE_CODE.toString(), "400");
- Mockito.when(request.getRequestURL()).thenReturn(new StringBuffer("/fadsjoifj"));
-
- boolean success = postAaiAjscInterceptor.allowOrReject(request, resp, null);
-
- assertTrue("Expecting the post interceptor to return success regardless", success);
- }
-}
diff --git a/aai-resources/src/test/java/org/onap/aai/interceptors/PreAaiAjscInterceptorTest.java b/aai-resources/src/test/java/org/onap/aai/interceptors/PreAaiAjscInterceptorTest.java
deleted file mode 100644
index 35651c3..0000000
--- a/aai-resources/src/test/java/org/onap/aai/interceptors/PreAaiAjscInterceptorTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.aai.interceptors;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import javax.servlet.http.HttpServletRequest;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.anyString;
-
-public class PreAaiAjscInterceptorTest {
-
- private PreAaiAjscInterceptor preAaiAjscInterceptor;
-
- @Before
- public void setup(){
- preAaiAjscInterceptor = new PreAaiAjscInterceptor();
- }
-
- @Test
- public void getInstance() throws Exception {
- PreAaiAjscInterceptor interceptor = PreAaiAjscInterceptor.getInstance();
- assertNotNull(interceptor);
- }
-
- @Test
- public void testAllowOrRejectIfSuccess() throws Exception {
-
- HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
-
- Mockito.when(request.getRequestURI()).thenReturn("/fadsjoifj");
- Mockito.when(request.getHeader(anyString())).thenReturn("JUNIT-Test");
- Mockito.when(request.getMethod()).thenReturn("GET");
-
- boolean success = preAaiAjscInterceptor.allowOrReject(request, null, null);
-
- assertTrue("Expecting the post interceptor to return success regardless", success);
- }
-
-} \ No newline at end of file
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java
index 747f319..f85eeb8 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java
@@ -154,6 +154,8 @@ public class BulkProcessConsumerTest extends BulkProcessorTestAbstraction {
Response response = legacyMoxyConsumer.getLegacy(
"",
+ "-1",
+ "-1",
Version.getLatest().toString(),
uri,
"all",
@@ -187,6 +189,8 @@ public class BulkProcessConsumerTest extends BulkProcessorTestAbstraction {
queryParameters.add("depth", "10000");
response = legacyMoxyConsumer.getLegacy(
"",
+ "-1",
+ "-1",
Version.getLatest().toString(),
uri,
"all",
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java
index 8c14697..260e2ae 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java
@@ -140,6 +140,8 @@ public class LegacyMoxyConsumerTest extends AAISetup {
MockHttpServletRequest mockReqGet = new MockHttpServletRequest("GET", uri);
Response response = legacyMoxyConsumer.getLegacy(
"",
+ "-1",
+ "-1",
Version.getLatest().toString(),
uri,
"all",
@@ -172,6 +174,8 @@ public class LegacyMoxyConsumerTest extends AAISetup {
response = legacyMoxyConsumer.getLegacy(
"",
+ "-1",
+ "-1",
Version.getLatest().toString(),
uri,
"10000",
@@ -216,6 +220,8 @@ public class LegacyMoxyConsumerTest extends AAISetup {
response = legacyMoxyConsumer.getLegacy(
"",
+ "-1",
+ "-1",
Version.getLatest().toString(),
uri,
"all",
@@ -361,6 +367,8 @@ public class LegacyMoxyConsumerTest extends AAISetup {
mockReq = new MockHttpServletRequest("GET", uri);
response = legacyMoxyConsumer.getLegacy(
"",
+ "-1",
+ "-1",
Version.getLatest().toString(),
uri,
"all",
@@ -417,7 +425,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
int code = response.getStatus();
System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), code);
+ assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), code);
response = legacyMoxyConsumer.updateRelationship(
payload,
@@ -430,11 +438,13 @@ public class LegacyMoxyConsumerTest extends AAISetup {
code = response.getStatus();
System.out.println("Response Code: " + code + "\tEntity: " + response.getEntity());
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), code);
+ assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), code);
mockReq = new MockHttpServletRequest("GET", uri);
response = legacyMoxyConsumer.getLegacy(
"",
+ "-1",
+ "-1",
Version.getLatest().toString(),
uri,
"all",
@@ -445,7 +455,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
);
assertNotNull("Response from the legacy moxy consumer returned null", response);
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), code);
+ assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), code);
mockReq = new MockHttpServletRequest("DELETE", uri);
queryParameters.add("resource-version", "3434394839483");
@@ -471,7 +481,7 @@ public class LegacyMoxyConsumerTest extends AAISetup {
mockReq
);
code = response.getStatus();
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), code);
+ assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), code);
}
@Test
@@ -491,6 +501,8 @@ public class LegacyMoxyConsumerTest extends AAISetup {
MockHttpServletRequest mockReq = new MockHttpServletRequest("GET", uri);
Response response = legacyMoxyConsumer.getLegacy(
"",
+ "-1",
+ "-1",
Version.getLatest().toString(),
uri,
"all",
@@ -550,6 +562,8 @@ public class LegacyMoxyConsumerTest extends AAISetup {
MockHttpServletRequest mockReqGet = new MockHttpServletRequest("GET", uri);
Response response = legacyMoxyConsumer.getLegacy(
"",
+ "-1",
+ "-1",
Version.getLatest().toString(),
uri,
"all",
@@ -584,6 +598,8 @@ public class LegacyMoxyConsumerTest extends AAISetup {
queryParameters.add("depth", "10000");
response = legacyMoxyConsumer.getLegacy(
"",
+ "-1",
+ "-1",
Version.getLatest().toString(),
uri,
"all",
@@ -697,6 +713,8 @@ public class LegacyMoxyConsumerTest extends AAISetup {
MockHttpServletRequest mockReqGet = new MockHttpServletRequest("GET", uri);
Response response = legacyMoxyConsumer.getLegacy(
"",
+ "-1",
+ "-1",
Version.getLatest().toString(),
uri,
"all",
@@ -724,6 +742,8 @@ public class LegacyMoxyConsumerTest extends AAISetup {
MockHttpServletRequest mockReqGet = new MockHttpServletRequest("GET", uri);
Response response = legacyMoxyConsumer.getLegacy(
"",
+ "-1",
+ "-1",
Version.getLatest().toString(),
uri,
"all",
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/PserverTest.java b/aai-resources/src/test/java/org/onap/aai/rest/PserverTest.java
new file mode 100644
index 0000000..b5ea4d9
--- /dev/null
+++ b/aai-resources/src/test/java/org/onap/aai/rest/PserverTest.java
@@ -0,0 +1,115 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.aai.rest;
+
+import com.jayway.jsonpath.JsonPath;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.aai.ResourcesApp;
+import org.onap.aai.ResourcesTestConfiguration;
+import org.onap.aai.config.PropertyPasswordConfiguration;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.embedded.LocalServerPort;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Import;
+import org.springframework.http.*;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.Collections;
+import java.util.UUID;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * A sample junit test using spring boot that provides the ability to spin
+ * up the application from the junit layer and run rest requests against
+ * SpringBootTest annotation with web environment requires which spring boot
+ * class to load and the random port starts the application on a random port
+ * and injects back into the application for the field with annotation LocalServerPort
+ * <p>
+ *
+ * This can be used to potentially replace a lot of the fitnesse tests since
+ * they will be testing against the same thing except fitnesse uses hbase
+ */
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = ResourcesApp.class)
+@TestPropertySource(locations = "classpath:application-test.properties")
+@ContextConfiguration(initializers = PropertyPasswordConfiguration.class)
+@Import(ResourcesTestConfiguration.class)
+public class PserverTest {
+
+ @Autowired
+ RestTemplate restTemplate;
+
+ @LocalServerPort
+ int randomPort;
+
+ private HttpEntity httpEntity;
+
+ private String baseUrl;
+
+ @Before
+ public void setup(){
+
+ HttpHeaders headers = new HttpHeaders();
+
+ headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ headers.add("Real-Time", "true");
+ headers.add("X-FromAppId", "JUNIT");
+ headers.add("X-TransactionId", "JUNIT");
+
+ httpEntity = new HttpEntity(headers);
+ baseUrl = "https://localhost:" + randomPort;
+ }
+
+ @Test
+ public void testPutPserverExtractVertexAndThenDoGetByVertexIdAndThenDeleteIt() {
+
+ String endpoint = "/aai/v11/cloud-infrastructure/pservers/pserver/test" + UUID.randomUUID().toString();
+
+ ResponseEntity responseEntity = null;
+
+ responseEntity = restTemplate.exchange(baseUrl + endpoint, HttpMethod.GET, httpEntity, String.class);
+ assertEquals(HttpStatus.NOT_FOUND, responseEntity.getStatusCode());
+
+ responseEntity = restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
+ assertEquals(HttpStatus.CREATED, responseEntity.getStatusCode());
+
+ String vertexId = responseEntity.getHeaders().getFirst("vertex-id");
+ responseEntity = restTemplate.exchange(baseUrl + "/aai/v11/resources/id/" + vertexId, HttpMethod.GET, httpEntity, String.class);
+ assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
+
+ responseEntity = restTemplate.exchange(baseUrl + endpoint, HttpMethod.GET, httpEntity, String.class);
+ assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
+
+ String body = responseEntity.getBody().toString();
+ String resourceVersion = JsonPath.read(body, "$.resource-version");
+
+ responseEntity = restTemplate.exchange(baseUrl + endpoint+ "?resource-version=" + resourceVersion, HttpMethod.DELETE, httpEntity, String.class);
+ assertEquals(HttpStatus.NO_CONTENT, responseEntity.getStatusCode());
+ }
+}
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java
index 982cedf..f732a6d 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java
@@ -129,6 +129,8 @@ public class URLFromVertexIdConsumerTest extends AAISetup {
MockHttpServletRequest mockReqGet = new MockHttpServletRequest("GET", uri);
Response response = legacyMoxyConsumer.getLegacy(
"",
+ "-1",
+ "-1",
Version.getLatest().toString(),
uri,
"all",
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java
index fb639ce..aab2470 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java
@@ -129,6 +129,8 @@ public class VertexIdConsumerTest extends AAISetup {
MockHttpServletRequest mockReqGet = new MockHttpServletRequest("GET", uri);
Response response = legacyMoxyConsumer.getLegacy(
"",
+ "-1",
+ "-1",
Version.getLatest().toString(),
uri,
"all",
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/retired/RetiredConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/retired/RetiredConsumerTest.java
index 66846b6..50964a3 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/retired/RetiredConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/retired/RetiredConsumerTest.java
@@ -26,6 +26,7 @@ import com.att.eelf.configuration.EELFManager;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
+import org.onap.aai.AAISetup;
import org.onap.aai.introspection.Version;
import javax.ws.rs.core.*;
@@ -36,7 +37,7 @@ import static org.junit.Assert.assertNotNull;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.when;
-public abstract class RetiredConsumerTest {
+public abstract class RetiredConsumerTest extends AAISetup {
protected static final MediaType APPLICATION_JSON = MediaType.valueOf("application/json");
diff --git a/aai-resources/src/test/java/org/onap/aai/schema/db/AuditOXMTest.java b/aai-resources/src/test/java/org/onap/aai/schema/db/AuditOXMTest.java
deleted file mode 100644
index d3c7302..0000000
--- a/aai-resources/src/test/java/org/onap/aai/schema/db/AuditOXMTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.aai.schema.db;
-
-import com.thinkaurelius.titan.core.TitanFactory;
-import com.thinkaurelius.titan.core.TitanGraph;
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.onap.aai.AAISetup;
-import org.onap.aai.db.schema.AuditDoc;
-import org.onap.aai.db.schema.AuditOXM;
-import org.onap.aai.db.schema.Auditor;
-import org.onap.aai.db.schema.AuditorFactory;
-import org.onap.aai.introspection.Version;
-
-import java.io.IOException;
-
-@Ignore("not ready for testing")
-public class AuditOXMTest extends AAISetup {
-
-
- /**
- * Gets the graph audit.
- *
- * @return the graph audit
- * @throws JsonGenerationException the json generation exception
- * @throws JsonMappingException the json mapping exception
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @Test
- public void getGraphAudit() throws JsonGenerationException, JsonMappingException, IOException {
- TitanGraph graph = TitanFactory.open("bundleconfig-local/etc/appprops/aaiconfig.properties");
- Auditor a = AuditorFactory.getGraphAuditor(graph);
- AuditDoc doc = a.getAuditDoc();
-
- ObjectMapper mapper = new ObjectMapper();
-
- String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(doc);
- System.out.println(json);
-
- }
-
- /**
- * Gets the audit.
- *
- * @return the audit
- * @throws JsonGenerationException the json generation exception
- * @throws JsonMappingException the json mapping exception
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @Test
- public void getAudit() throws JsonGenerationException, JsonMappingException, IOException {
- AuditOXM oxm = new AuditOXM(Version.v8);
-
- AuditDoc doc = oxm.getAuditDoc();
-
- ObjectMapper mapper = new ObjectMapper();
-
- String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(doc);
- System.out.println(json);
- }
-}
diff --git a/aai-resources/src/test/java/org/onap/aai/serialization/db/DBSerializerMaxRetryTest.java b/aai-resources/src/test/java/org/onap/aai/serialization/db/DBSerializerMaxRetryTest.java
deleted file mode 100644
index b64c261..0000000
--- a/aai-resources/src/test/java/org/onap/aai/serialization/db/DBSerializerMaxRetryTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.aai.serialization.db;
-
-
-import com.att.eelf.configuration.EELFLogger;
-import com.thinkaurelius.titan.core.TitanException;
-import com.thinkaurelius.titan.core.TitanGraph;
-import com.thinkaurelius.titan.core.TitanTransaction;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.onap.aai.db.props.AAIProperties;
-import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.parsers.query.QueryParser;
-import org.onap.aai.rest.db.HttpEntry;
-import org.onap.aai.serialization.engines.TransactionalGraphEngine;
-import org.onap.aai.serialization.engines.query.QueryEngine;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-@Ignore
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({QueryParser.class, TransactionalGraphEngine.class, TitanGraph.class, TitanTransaction.class, LoaderFactory.class, DBSerializer.class})
-public class DBSerializerMaxRetryTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- /**
- * Test.
- *
- * @throws Exception the exception
- */
- @Test
- public void test() throws Exception {
-
- HttpEntry mockEntry = PowerMockito.mock(HttpEntry.class);
- QueryParser mockQuery = PowerMockito.mock(QueryParser.class);
- PowerMockito.when(mockQuery.isDependent()).thenReturn(true);
- TransactionalGraphEngine mockEngine = PowerMockito.mock(TransactionalGraphEngine.class);
- TitanGraph mockGraph = PowerMockito.mock(TitanGraph.class);
- //PowerMockito.when(mockEngine.getGraph()).thenReturn(mockGraph);
- TitanTransaction mockGraphTrans = PowerMockito.mock(TitanTransaction.class);
- PowerMockito.when(mockGraph.newTransaction()).thenReturn(mockGraphTrans);
- QueryEngine mockQueryEngine = PowerMockito.mock(QueryEngine.class);
- PowerMockito.when(mockEngine.getQueryEngine()).thenReturn(mockQueryEngine);
- PowerMockito.when(mockQuery.getQueryBuilder().getParentQuery().toList()).thenThrow(new TitanException("mock error"));
- EELFLogger mockLogger = PowerMockito.mock(EELFLogger.class);
-
- PowerMockito.whenNew(EELFLogger.class).withAnyArguments().thenReturn(mockLogger);
-
- PowerMockito.mockStatic(LoaderFactory.class);
-
- DBSerializer dbs = new DBSerializer(AAIProperties.LATEST, mockEngine, null, null);
-
- thrown.expect(AAIException.class);
- thrown.expectMessage("AAI_6134");
- dbs.serializeToDb(null, null, mockQuery, null, null);
- }
-
-}
diff --git a/aai-resources/src/test/java/org/onap/aai/util/AAIAppServletContextListenerTest.java b/aai-resources/src/test/java/org/onap/aai/util/AAIAppServletContextListenerTest.java
deleted file mode 100644
index c079007..0000000
--- a/aai-resources/src/test/java/org/onap/aai/util/AAIAppServletContextListenerTest.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.aai.util;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.PatternLayout;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.AppenderBase;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.onap.aai.dbmap.AAIGraph;
-import org.onap.aai.logging.ErrorLogHelper;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.agent.PowerMockAgent;
-import org.powermock.modules.junit4.rule.PowerMockRule;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.ServletContextEvent;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertTrue;
-
-@PrepareForTest({AAIGraph.class, AAIConfig.class, ErrorLogHelper.class})
-public class AAIAppServletContextListenerTest {
-
- @Rule
- public PowerMockRule rule = new PowerMockRule();
-
- static {
- PowerMockAgent.initializeIfNeeded();
- }
-
- private ServletContextEvent arg;
- private AAIAppServletContextListener listener;
-
- /**
- * Initialize.
- */
- @Before
- @PrepareForTest({AAIGraph.class, AAIConfig.class, ErrorLogHelper.class})
- public void initialize(){
- arg = PowerMockito.mock(ServletContextEvent.class);
- PowerMockito.mockStatic(AAIGraph.class);
- PowerMockito.mockStatic(AAIConfig.class);
- PowerMockito.mockStatic(ErrorLogHelper.class);
-
- listener = new AAIAppServletContextListener();
- configureLog();
- }
-
- /**
- * Test contextDestroyed.
- */
- @Test
- @Ignore
- public void testContextDestroyed(){
- listener.contextDestroyed(arg);
- assertTrue(logContains(Level.DEBUG, "AAI Server shutdown"));
- assertTrue(logContains(Level.INFO, "AAI graph shutdown"));
- }
-
- /**
- * Test contextInitialized.
- */
- @Test
- @Ignore
- public void testContextInitialized(){
- listener.contextInitialized(arg);
- assertTrue(logContains(Level.DEBUG, "Loading aaiconfig.properties"));
- assertTrue(logContains(Level.DEBUG, "Loading error.properties"));
- assertTrue(logContains(Level.DEBUG, "Loading graph database"));
- assertTrue(logContains(Level.INFO, "AAI Server initialization"));
- }
-
-
- /**
- * Helper method to check if a String appears in the desired log level.
- *
- * @param level Log level to use
- * @param expected String to search for
- * @return True if search String is found, false otherwise
- */
- private boolean logContains(Level level, String expected) {
- String actual[] = RecordingAppender.messages();
- for (String log : actual) {
- if (log.contains(level.toString()) && log.contains(expected))
- return true;
- }
- return false;
- }
-
- /**
- * Set logging level, and initialize log-appender.
- */
- private void configureLog() {
- Logger rootLogger = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
- rootLogger.setLevel(Level.DEBUG);
- rootLogger.detachAndStopAllAppenders();
- rootLogger.addAppender(RecordingAppender.appender(new PatternLayout()));
- }
-
-}
-
-
-/**
- * Appender class that appends log messages to a String List when some logging event occurs
- */
-class RecordingAppender extends AppenderBase<ILoggingEvent> {
- private static List<String> messages = new ArrayList<String>();
- private static RecordingAppender appender = new RecordingAppender();
- private PatternLayout patternLayout;
-
- private RecordingAppender() {
- super();
- }
-
- /**
- * @param patternLayout Pattern to format log message
- * @return Current appender
- */
- public static RecordingAppender appender(PatternLayout patternLayout) {
- appender.patternLayout = patternLayout;
- appender.clear();
- return appender;
- }
-
- @Override
- protected void append(ILoggingEvent event) {
- messages.add(patternLayout.doLayout(event));
- }
-
- public void close() {}
-
- public boolean requiresLayout() {
- return false;
- }
-
- /**
- * @return Return logs as a String array
- */
- public static String[] messages() {
- return (String[]) messages.toArray(new String[messages.size()]);
- }
-
- /**
- * Clear the message container
- */
- private void clear() {
- messages.clear();
- }
-
-}
diff --git a/aai-resources/src/test/java/org/onap/aai/util/AAICSVWriterTest.java b/aai-resources/src/test/java/org/onap/aai/util/AAICSVWriterTest.java
deleted file mode 100644
index dae280f..0000000
--- a/aai-resources/src/test/java/org/onap/aai/util/AAICSVWriterTest.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.aai.util;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.powermock.modules.agent.PowerMockAgent;
-import org.powermock.modules.junit4.rule.PowerMockRule;
-
-import java.io.*;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-public class AAICSVWriterTest {
-
- @Rule
- public PowerMockRule rule = new PowerMockRule();
-
- static {
- PowerMockAgent.initializeIfNeeded();
- }
-
-
- Writer writer;
- File f;
- AAICSVWriter testObj;
- String fileName = "test_csvWriter.csv";
- String lineEnd = "\n";
- char quoteChar = '\"';
- String separator = ",";
- String str1[], str2[];
-
- /**
- * Initialize.
- */
- @Before
- public void initialize(){
- str1 = new String[]{"s0", "s1"};
-
- str2 = new String[]{"t0", "t1"};
-
- try {
- f = new File(fileName);
- f.createNewFile();
- writer = new PrintWriter(f);
- testObj = new AAICSVWriter(new FileWriter(fileName), separator, quoteChar, lineEnd);
- } catch (FileNotFoundException e) {
- fail("Input csv file not found.");
- e.printStackTrace();
- } catch (IOException e) {
- fail("Can't create csv file.");
- e.printStackTrace();
- }
- }
-
- /**
- * Test writeNextLine with String arrays.
- */
- @Test
- public void testWriteNextLine(){
- populateAndGetFileSize(false, str1, str2);
- String wholeText = str1[0] + separator + str1[1] + lineEnd + str2[0] + separator + str2[1] + lineEnd;
- assertTrue("CSV file missing text", allLinesFound(wholeText));
- }
-
- /**
- * Test writeNextLine with null.
- */
- @Test
- public void testWriteNextLine_withNull(){
- populateAndGetFileSize(false, null, null);
- assertTrue("CSV file should not contain any text", f.length() == 0);
- }
-
-
- /**
- * Test writeColumn with String arrays.
- */
- @Test
- public void testWriteColumn(){
- populateAndGetFileSize(true, str1, str2);
- String wholeText = str1[0] + str1[1] + lineEnd + str2[0] + str2[1] + lineEnd;
- assertTrue("CSV file missing text", allLinesFound(wholeText));
- }
-
-
- /**
- * Test writeColumn with null.
- */
- @Test
- public void testWriteColumn_withNull(){
- populateAndGetFileSize(true, null, null);
- assertTrue("CSV file should not contain any text", f.length() == 0);
- }
-
- /**
- * Helper method to create file with given data.
- *
- * @param isColumnWise True if csv file is to be written in column wise, false otherwise
- * @param c1 First set of data
- * @param c2 Second set of data
- */
- private void populateAndGetFileSize(boolean isColumnWise, String c1[], String c2[]){
- if ( isColumnWise ){
- testObj.writeColumn(c1);
- testObj.writeColumn(c2);
- } else{
- testObj.writeNext(c1, false);
- testObj.writeNext(c2, false);
- }
- try {
- testObj.close();
- } catch (IOException e) {
- fail("Can't close stream");
- e.printStackTrace();
- }
- }
-
-
- /**
- * Helper method to check if a file contains required data.
- *
- * @param all Data to look for
- * @return True if data is found, false otherwise
- */
- private boolean allLinesFound(String all){
- String fileContents = "";
- try {
- fileContents = new String(Files.readAllBytes(Paths.get(fileName)));
- } catch (IOException e1) {
- fail("csv file not found");
- e1.printStackTrace();
- }
-
- return all.equals(fileContents);
- }
-
-
- /**
- * Cleanup.
- */
- @After
- public void cleanup(){
- if ( f.exists() ){
- f.delete();
- }
- }
-
-}
diff --git a/aai-resources/src/test/resources/application-test.properties b/aai-resources/src/test/resources/application-test.properties
new file mode 100644
index 0000000..e6edb6d
--- /dev/null
+++ b/aai-resources/src/test/resources/application-test.properties
@@ -0,0 +1,70 @@
+# The following info parameters are being referenced by ajsc6
+info.build.artifact=aai-resources
+info.build.name=resources
+info.build.description=Resources Microservice
+info.build.version=1.1.0
+
+spring.application.name=aai-resources
+spring.jersey.type=filter
+
+server.contextPath=/
+spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
+
+spring.profiles.active=production
+#The max number of active threads in this pool
+server.tomcat.max-threads=200
+#The minimum number of threads always kept alive
+server.tomcat.min-Spare-Threads=25
+#The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads
+server.tomcat.max-idle-time=60000
+
+
+#Add this properties only if you want to change the URL, AJSC Framework interceptors will intercept
+#com.att.ajsc.common.interceptors.PreInterceptor.url=/**
+#com.att.ajsc.common.interceptors.PostInterceptor.url=/**
+
+#Servlet context parameters
+server.context_parameters.p-name=value #context parameter with p-name as key and value as value.
+kubernetes.namespace=org-onap-aai
+
+# If you get an application startup failure that the port is already taken
+# If thats not it, please check if the key-store file path makes sense
+server.local.startpath=src/main/resources/
+server.basic.auth.location=${server.local.startpath}etc/auth/realm.properties
+
+server.port=8447
+server.ssl.enabled-protocols=TLSv1.1,TLSv1.2
+server.ssl.key-store=${server.local.startpath}etc/auth/aai_keystore
+server.ssl.key-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
+server.ssl.trust-store=${server.local.startpath}etc/auth/aai_keystore
+server.ssl.trust-store-password=password(OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0)
+server.ssl.client-auth=want
+server.ssl.key-store-type=JKS
+
+# JMS bind address host port
+jms.bind.address=tcp://localhost:61647
+dmaap.ribbon.eureka.enabled=false
+dmaap.ribbon.listOfServers=localhost:3904
+# Number of milliseconds to wait before making ping requests again
+dmaap.ribbon.ServerListRefreshInterval=75000
+dmaap.ribbon.NFLoadBalancerPingInterval=75000
+dmaap.ribbon.NFLoadBalancerRuleClassName=com.netflix.loadbalancer.AvailabilityFilteringRule
+dmaap.ribbon.NFLoadBalancerPingClassName=org.onap.aai.config.HttpPingImpl
+dmaap.ribbon.EnableMarkingServerDownOnReachingFailureLimit=true
+dmaap.ribbon.ServerDownFailureLimit=1
+# This needs to be verified but it seems that adding this property should automatically
+# Make the dmaap client change the url from http to https depending on the server
+dmaap.ribbon.securePorts=3905
+
+# Custom Dmaap Specific Configuration
+dmaap.ribbon.health.endpoint=/topics/AAI-EVENT
+# Number of seconds to wait for the ping to work and might need to increase this if the pings are all failing
+dmaap.ribbon.pingport.timeout=3
+
+niws.loadbalancer.dmaap.filterCircuitTripped=true
+niws.loadbalancer.dmaap.connectionFailureCountThreshold=3
+niws.loadbalancer.dmaap.circuitTripMaxTimeoutSeconds=180
+#dmaap.ribbon.retryableStatusCodes=404,503
+#dmaap.ribbon.retryableStatusCodes.MaxAutoRetriesNextServer=2
+#dmaap.ribbon.retryableStatusCodes.MaxAutoRetries=2
+#dmaap.ribbon.retryableStatusCodes.OkToRetryOnAllOperations=true
diff --git a/aai-resources/src/test/resources/logback.xml b/aai-resources/src/test/resources/logback.xml
index bece12d..a6e4345 100644
--- a/aai-resources/src/test/resources/logback.xml
+++ b/aai-resources/src/test/resources/logback.xml
@@ -22,24 +22,50 @@
-->
<configuration scan="true" scanPeriod="60 seconds" debug="false">
- <contextName>${module.ajsc.namespace.name}</contextName>
+ <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
+
+ <property resource="application.properties" />
+
+ <property name="namespace" value="aai-resources"/>
+
+ <property name="AJSC_HOME" value="${AJSC_HOME:-.}" />
<jmxConfigurator />
<property name="logDirectory" value="${AJSC_HOME}/logs" />
-
- <!-- Example evaluator filter applied against console appender -->
+ <property name="eelfLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/>
+ <property name="eelfAuditLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n|\r\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/>
+ <property name="eelfMetricLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{targetVirtualEntity}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/>
+ <!-- <property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n|\r\n', '^'}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> -->
+ <property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%ecompResponseCode|%ecompResponseDescription|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/>
+ <property name="eelfTransLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{partnerName}:%m%n"/>
+
+ <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
+ <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
+ <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <filter class="ch.qos.logback.classic.filter.LevelFilter">
- <!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> -->
- <level>ERROR</level>
- <onMatch>ACCEPT</onMatch>
- <onMismatch>DENY</onMismatch>
- </filter>
+ <encoder>
+ <pattern>
+ %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}
+ </pattern>
+ </encoder>
+ </appender>
+
+ <appender name="SANE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/rest/sane.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${logDirectory}/rest/sane.log.%d{yyyy-MM-dd}</fileNamePattern>
+ </rollingPolicy>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n
</pattern>
</encoder>
</appender>
+ <appender name="asyncSANE" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>1000</queueSize>
+ <includeCallerData>true</includeCallerData>
+ <appender-ref ref="SANE" />
+ </appender>
+
<appender name="METRIC"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
@@ -47,124 +73,180 @@
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
- <file>${logDirectory}/rest/metric.log</file>
+ <file>${logDirectory}/rest/metrics.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${logDirectory}/rest/metric.log.%d{yyyy-MM-dd}</fileNamePattern>
+ <fileNamePattern>${logDirectory}/rest/metrics.log.%d{yyyy-MM-dd}
+ </fileNamePattern>
</rollingPolicy>
- <!-- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>5MB</maxFileSize>
- </triggeringPolicy> -->
- <encoder>
- <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%m%n</pattern>
+ <encoder class="org.onap.aai.logging.EcompEncoder">
+ <pattern>${eelfMetricLogPattern}</pattern>
</encoder>
</appender>
+ <appender name="asyncMETRIC" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>1000</queueSize>
+ <includeCallerData>true</includeCallerData>
+ <appender-ref ref="METRIC" />
+ </appender>
<appender name="DEBUG"
class="ch.qos.logback.core.rolling.RollingFileAppender">
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>DEBUG</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<file>${logDirectory}/rest/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${logDirectory}/rest/debug.log.%d{yyyy-MM-dd}</fileNamePattern>
+ <fileNamePattern>${logDirectory}/rest/debug.log.%d{yyyy-MM-dd}
+ </fileNamePattern>
</rollingPolicy>
- <!-- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>5MB</maxFileSize>
- </triggeringPolicy>-->
- <encoder>
- <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%m%n</pattern>
+ <encoder class="org.onap.aai.logging.EcompEncoder">
+ <pattern>${eelfLogPattern}</pattern>
</encoder>
</appender>
+ <appender name="asyncDEBUG" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>1000</queueSize>
+ <includeCallerData>true</includeCallerData>
+ <appender-ref ref="DEBUG" />
+ </appender>
+
<appender name="ERROR"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
- <onMatch>ACCEPT</onMatch>
- <onMismatch>DENY</onMismatch>
</filter>
<file>${logDirectory}/rest/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${logDirectory}/rest/error.log.%d{yyyy-MM-dd}</fileNamePattern>
+ <fileNamePattern>${logDirectory}/rest/error.log.%d{yyyy-MM-dd}
+ </fileNamePattern>
</rollingPolicy>
- <!-- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>5MB</maxFileSize>
- </triggeringPolicy>-->
- <encoder>
- <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n"</pattern> -->
- <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%m%n</pattern>
+ <encoder class="org.onap.aai.logging.EcompEncoder">
+ <pattern>${eelfErrorLogPattern}</pattern>
</encoder>
</appender>
-
- <appender name="AUDIT"
+
+ <appender name="asyncERROR" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>1000</queueSize>
+ <includeCallerData>true</includeCallerData>
+ <appender-ref ref="ERROR" />
+ </appender>
+
+ <appender name="AUDIT"
class="ch.qos.logback.core.rolling.RollingFileAppender">
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator>
- <matcher>
- <Name>audit</Name>
- <!-- filter out odd numbered statements -->
- <regex>co\=aairest</regex>
- </matcher>
- <expression>level == INFO &amp;&amp; audit.matches(formattedMessage)</expression>
- </evaluator>
- <OnMatch>ACCEPT</OnMatch>
- <OnMismatch>DENY</OnMismatch>
- </filter>
<file>${logDirectory}/rest/audit.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${logDirectory}/rest/metric.log.%d{yyyy-MM-dd}</fileNamePattern>
+ <fileNamePattern>${logDirectory}/rest/audit.log.%d{yyyy-MM-dd}
+ </fileNamePattern>
</rollingPolicy>
- <encoder>
- <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%m%n</pattern>
+ <encoder class="org.onap.aai.logging.EcompEncoder">
+ <pattern>${eelfAuditLogPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncAUDIT" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>1000</queueSize>
+ <includeCallerData>true</includeCallerData>
+ <appender-ref ref="AUDIT" />
+ </appender>
+
+ <appender name="translog"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
+ <level>DEBUG</level>
+ <onMatch>ACCEPT</onMatch>
+ <onMismatch>DENY</onMismatch>
+ </filter>
+ <file>${logDirectory}/rest/translog.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${logDirectory}/rest/translog.log.%d{yyyy-MM-dd}
+ </fileNamePattern>
+ </rollingPolicy>
+ <encoder class="org.onap.aai.logging.EcompEncoder">
+ <pattern>${eelfTransLogPattern}</pattern>
</encoder>
</appender>
- <appender name="auditLogs"
+ <appender name="asynctranslog" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>1000</queueSize>
+ <includeCallerData>true</includeCallerData>
+ <appender-ref ref="translog" />
+ </appender>
+
+ <appender name="dmaapAAIEventConsumer"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>WARN</level>
</filter>
- <file>${logDirectory}/rest/audit.log</file>
+ <File>${logDirectory}/dmaapAAIEventConsumer/error.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${logDirectory}/rest/audit.%d{yyyy-MM-dd}.log.zip
+ <fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/error.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>5MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern>
+ <encoder class="org.onap.aai.logging.EcompEncoder">
+ <pattern>${eelfLogPattern}</pattern>
</encoder>
</appender>
-
- <appender name="perfLogs"
+
+ <appender name="dmaapAAIEventConsumerDebug"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
+ <level>DEBUG</level>
+ <onMatch>ACCEPT</onMatch>
+ <onMismatch>DENY</onMismatch>
+ </filter>
+ <File>${logDirectory}/dmaapAAIEventConsumer/debug.log</File>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/debug.log.%d{yyyy-MM-dd}
+ </fileNamePattern>
+ </rollingPolicy>
+ <encoder class="org.onap.aai.logging.EcompEncoder">
+ <pattern>${eelfLogPattern}</pattern>
+ </encoder>
+ </appender>
+ <appender name="dmaapAAIEventConsumerMetric"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
+ <level>INFO</level>
+ <onMatch>ACCEPT</onMatch>
+ <onMismatch>DENY</onMismatch>
+ </filter>
+ <File>${logDirectory}/dmaapAAIEventConsumer/metrics.log</File>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/metrics.log.%d{yyyy-MM-dd}
+ </fileNamePattern>
+ </rollingPolicy>
+ <encoder class="org.onap.aai.logging.EcompEncoder">
+ <pattern>${eelfMetricLogPattern}</pattern>
+ </encoder>
+ </appender>
+ <appender name="external"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>WARN</level>
</filter>
- <file>${logDirectory}/rest/perform.log</file>
+ <file>${logDirectory}/external/external.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${logDirectory}/rest/perform.%d{yyyy-MM-dd}.log.zip
+ <fileNamePattern>${logDirectory}/external/external.log.%d{yyyy-MM-dd}
</fileNamePattern>
</rollingPolicy>
- <!-- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>5MB</maxFileSize>
- </triggeringPolicy> -->
- <encoder>
- <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern>
+ <encoder class="org.onap.aai.logging.EcompEncoder">
+ <pattern>${eelfLogPattern}</pattern>
</encoder>
</appender>
+ <logger name="org.onap.aai" level="DEBUG" additivity="true">
+ <appender-ref ref="asyncDEBUG" />
+ <appender-ref ref="asyncERROR" />
+ <appender-ref ref="asyncMETRIC" />
+ <appender-ref ref="asyncSANE" />
+ </logger>
<!-- Spring related loggers -->
<logger name="org.springframework" level="WARN" />
<logger name="org.springframework.beans" level="WARN" />
<logger name="org.springframework.web" level="WARN" />
<logger name="com.blog.spring.jms" level="WARN" />
+ <logger name="com.jayway.jsonpath" level="WARN" />
<!-- AJSC Services (bootstrap services) -->
<logger name="ajsc" level="WARN" />
@@ -175,9 +257,11 @@
<logger name="ajsc.UserDefinedJarService" level="WARN" />
<logger name="ajsc.UserDefinedBeansDefService" level="WARN" />
<logger name="ajsc.LoggingConfigurationService" level="WARN" />
-
+
<!-- AJSC related loggers (DME2 Registration, csi logging, restlet, servlet
logging) -->
+ <logger name="org.codehaus.groovy" level="WARN" />
+ <logger name="com.att.scamper" level="WARN" />
<logger name="ajsc.utils" level="WARN" />
<logger name="ajsc.utils.DME2Helper" level="WARN" />
<logger name="ajsc.filters" level="WARN" />
@@ -187,6 +271,9 @@
<logger name="com.att.ajsc" level="WARN" />
<logger name="com.att.ajsc.csi.logging" level="WARN" />
<logger name="com.att.ajsc.filemonitor" level="WARN" />
+ <logger name="com.netflix.loadbalancer" level="WARN" />
+
+ <logger name="org.apache.zookeeper" level="WARN" />
<!-- Other Loggers that may help troubleshoot -->
<logger name="net.sf" level="WARN" />
@@ -205,54 +292,101 @@
<logger name="org.restlet" level="WARN" />
<logger name="org.apache.camel.component.restlet" level="WARN" />
+ <logger name="org.hibernate.validator" level="WARN" />
+ <logger name="org.hibernate" level="WARN" />
+ <logger name="org.hibernate.ejb" level="OFF" />
+
<!-- logback internals logging -->
- <logger name="ch.qos.logback.classic" level="INFO" />
- <logger name="ch.qos.logback.core" level="INFO" />
+ <logger name="ch.qos.logback.classic" level="WARN" />
+ <logger name="ch.qos.logback.core" level="WARN" />
- <appender name="ASYNC-audit" class="ch.qos.logback.classic.AsyncAppender">
- <queueSize>1000</queueSize>
- <discardingThreshold>0</discardingThreshold>
- <appender-ref ref="Audit-Record-Queue" />
+ <logger name="org.eclipse.jetty" level="WARN" />
+
+ <!-- logback jms appenders & loggers definition starts here -->
+ <appender name="auditLogs"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter" />
+ <file>${logDirectory}/perf-audit/Audit-${lrmRVer}-${lrmRO}-${Pid}.log
+ </file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/perf-audit/Audit-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern>
+ </encoder>
</appender>
-
- <appender name="ASYNC-perf" class="ch.qos.logback.classic.AsyncAppender">
- <queueSize>1000</queueSize>
- <discardingThreshold>0</discardingThreshold>
- <appender-ref ref="Performance-Tracker-Queue" />
+ <appender name="perfLogs"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter" />
+ <file>${logDirectory}/perf-audit/Perform-${lrmRVer}-${lrmRO}-${Pid}.log
+ </file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/perf-audit/Perform-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern>
+ </encoder>
</appender>
-
- <!--
- <logger name="AuditRecord" level="INFO" additivity="FALSE">
- <appender-ref ref="ASYNC-audit" />
+ <logger name="AuditRecord" level="INFO" additivity="false">
<appender-ref ref="auditLogs" />
</logger>
- <logger name="AuditRecord_DirectCall" level="INFO" additivity="FALSE">
- <appender-ref ref="ASYNC-audit" />
+ <logger name="AuditRecord_DirectCall" level="INFO" additivity="false">
<appender-ref ref="auditLogs" />
</logger>
- <logger name="PerfTrackerRecord" level="INFO" additivity="FALSE">
- <appender-ref ref="ASYNC-perf" />
+ <logger name="PerfTrackerRecord" level="INFO" additivity="false">
<appender-ref ref="perfLogs" />
- </logger>
- -->
-
- <logger name="org.onap.aai" level="INFO" />
-
- <!--
- <logger name="org.onap.aai.util" level="WARN" />
- <logger name="org.onap.aai.rest" level="WARN" />
- <logger name="org.onap.aai.rest.Business" level="WARN" />
- -->
-
+ </logger>
+ <!-- logback jms appenders & loggers definition ends here -->
+
+ <logger name="org.onap.aai.interceptors.post" level="DEBUG"
+ additivity="false">
+ <appender-ref ref="asynctranslog" />
+ </logger>
+
+ <logger name="org.onap.aai.interceptors.pre.SetLoggingContext" level="DEBUG">
+ <appender-ref ref="asyncAUDIT"/>
+ </logger>
+
+ <logger name="org.onap.aai.interceptors.post.ResetLoggingContext" level="DEBUG">
+ <appender-ref ref="asyncAUDIT"/>
+ </logger>
+
+ <logger name="org.onap.aai.dmaap" level="DEBUG" additivity="false">
+ <appender-ref ref="dmaapAAIEventConsumer" />
+ <appender-ref ref="dmaapAAIEventConsumerDebug" />
+ <appender-ref ref="dmaapAAIEventConsumerMetric" />
+ </logger>
+
<logger name="org.apache" level="WARN" />
<logger name="org.zookeeper" level="WARN" />
<logger name="com.thinkaurelius" level="WARN" />
+ <logger name="com.att.aft.dme2" level="WARN" />
- <root level="WARN">
- <appender-ref ref="DEBUG" />
- <appender-ref ref="ERROR" />
- <appender-ref ref="METRIC" />
- <appender-ref ref="AUDIT" />
- </root>
+ <!-- ============================================================================ -->
+ <!-- General EELF logger -->
+ <!-- ============================================================================ -->
+ <logger name="com.att.eelf" level="WARN" additivity="false">
+ <appender-ref ref="asyncDEBUG" />
+ <appender-ref ref="asyncERROR" />
+ <appender-ref ref="asyncMETRIC" />
+ </logger>
+ <root level="DEBUG">
+ <appender-ref ref="external" />
+ <appender-ref ref="STDOUT" />
+ </root>
</configuration>
diff --git a/deploy.sh b/deploy.sh
deleted file mode 100755
index 2cd95b8..0000000
--- a/deploy.sh
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/bin/bash
-#
-# ============LICENSE_START=======================================================
-# org.onap.aai
-# ================================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ============LICENSE_END=========================================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
-
-
-if [ -f "/opt/docker/docker-compose" ];
-then
- DOCKER_COMPOSE_CMD="/opt/docker/docker-compose"
-else
- DOCKER_COMPOSE_CMD="docker-compose"
-fi
-
-export DOCKER_REGISTRY="${DOCKER_REGISTRY:-localhost:5000}";
-export HBASE_IMAGE="${HBASE_IMAGE:-wc9368/aai-hbase-1.2.3}";
-export GREMLIN_SERVER_IMAGE="${GREMLIN_SERVER_IMAGE:-gremlin-server}";
-export AAI_HAPROXY_IMAGE="${AAI_HAPROXY_IMAGE:-aai-haproxy}";
-
-function wait_for_container() {
-
- CONTAINER_NAME="$1";
- START_TEXT="$2";
-
- TIMEOUT=120
-
- # wait for the real startup
- AMOUNT_STARTUP=$(docker logs ${CONTAINER_NAME} 2>&1 | grep "$START_TEXT" | wc -l)
- while [[ ${AMOUNT_STARTUP} -ne 1 ]];
- do
- echo "Waiting for '$CONTAINER_NAME' deployment to finish ..."
- AMOUNT_STARTUP=$(docker logs ${CONTAINER_NAME} 2>&1 | grep "$START_TEXT" | wc -l)
- if [ "$TIMEOUT" = "0" ];
- then
- echo "ERROR: $CONTAINER_NAME deployment failed."
- exit 1
- fi
- let TIMEOUT-=1
- sleep 1
- done
-}
-
-# cleanup
-$DOCKER_COMPOSE_CMD stop
-$DOCKER_COMPOSE_CMD rm -f -v
-
-# deploy
-$DOCKER_COMPOSE_CMD up -d aai_haproxy
-
-HBASE_CONTAINER_NAME=$($DOCKER_COMPOSE_CMD up -d hbase 2>&1 | awk '{ print $2; }');
-wait_for_container $HBASE_CONTAINER_NAME '^starting regionserver';
-
-GREMLIN_CONTAINER_NAME=$($DOCKER_COMPOSE_CMD up -d gremlin 2>&1 | awk '{ print $2; }');
-wait_for_container $GREMLIN_CONTAINER_NAME 'Channel started at port 8182';
-
-RESOURCES_CONTAINER_NAME=$($DOCKER_COMPOSE_CMD up -d aai-resources 2>&1 | awk '{ print $2; }');
-wait_for_container $RESOURCES_CONTAINER_NAME '0.0.0.0:8447';
-
-$DOCKER_COMPOSE_CMD up -d aai-graph-query
-
diff --git a/docker-compose.yml b/docker-compose.yml
deleted file mode 100644
index 5790055..0000000
--- a/docker-compose.yml
+++ /dev/null
@@ -1,78 +0,0 @@
-#
-# ============LICENSE_START=======================================================
-# org.onap.aai
-# ================================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ============LICENSE_END=========================================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
-
-version: '2'
-services:
- aai-resources:
- image: ${DOCKER_REGISTRY}/openecomp/aai-resources
- network_mode: host
- environment:
- - AAI_CHEF_ENV=solo
- - AAI_REPO_PATH=r/aai
- - AAI_CHEF_LOC=/var/chef/aai-data/environments
- - docker_gitbranch=master
- - PROTOCOL=http
- logging:
- driver: "json-file"
- options:
- max-size: "30m"
- max-file: "5"
- aai-graph-query:
- image: ${DOCKER_REGISTRY}/openecomp/aai-traversal
- network_mode: host
- environment:
- - AAI_CHEF_ENV=solo
- - AAI_REPO_PATH=r/aai
- - AAI_CHEF_LOC=/var/chef/aai-data/environments
- - docker_gitbranch=master
- - PROTOCOL=http
- logging:
- driver: "json-file"
- options:
- max-size: "30m"
- max-file: "5"
- hbase:
- image: ${HBASE_IMAGE}
- network_mode: host
- logging:
- driver: "json-file"
- options:
- max-size: "30m"
- max-file: "5"
- gremlin:
- image: ${GREMLIN_SERVER_IMAGE}
- network_mode: host
- logging:
- driver: "json-file"
- options:
- max-size: "30m"
- max-file: "5"
- aai_haproxy:
- image: ${AAI_HAPROXY_IMAGE}
- volumes:
- - /dev/log:/dev/log
- network_mode: host
- logging:
- driver: "json-file"
- options:
- max-size: "30m"
- max-file: "5"
diff --git a/pom.xml b/pom.xml
index 1cf6484..05752ba 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,11 +3,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>ajsc-archetype-parent</artifactId>
- <groupId>com.att.ajsc</groupId>
- <version>2.1.0</version>
- </parent>
<groupId>org.onap.aai.resources</groupId>
<artifactId>resources</artifactId>
<version>1.2.0-SNAPSHOT</version>
@@ -18,41 +13,99 @@
</modules>
<properties>
<nexusproxy>https://nexus.onap.org</nexusproxy>
- <sitePath>/content/sites/site/org/onap/aai/resources/${project.artifactId}/${project.version}</sitePath>
- <maven.compiler.target>1.8</maven.compiler.target>
- <maven.compiler.source>1.8</maven.compiler.source>
- <module.ajsc.namespace.name>ActiveAndAvailableInventory-CloudNetwork</module.ajsc.namespace.name>
- <runAjscHome>${aaiAppHome}/target/swm/package/nix/dist_files${distFilesRoot}</runAjscHome>
- <module.ajsc.namespace.version>v1</module.ajsc.namespace.version>
- <ajscRuntimeVersion>2.1.0</ajscRuntimeVersion>
- <aai.project.version>1.2.0</aai.project.version>
- <aai.docker.version>1.2</aai.docker.version>
-
- <!-- This will be the Absolute Root of the Project and should contain NO
- Versioning -->
- <absoluteDistFilesRoot>/opt/app/aai-resources</absoluteDistFilesRoot>
- <distFilesRoot>/opt/app/aai-resources</distFilesRoot>
- <aaiAppHome>${basedir}/aai-resources</aaiAppHome>
-
- <!-- For SOA Cloud Installation -->
- <installOwnerUser>aaiadmin</installOwnerUser>
- <installOwnerGroup>aaiadmin</installOwnerGroup>
-
- <!-- Port Selection. A value of 0 will allow for dynamic port selection.
- For local testing, you may choose to hardcode this value to something like
- 8080 -->
- <serverPort>8087</serverPort>
- <sslport>8447</sslport>
+ </properties>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>sonar-maven-plugin</artifactId>
+ <version>3.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-deploy</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>nexus-staging-maven-plugin</artifactId>
+ <version>1.6.7</version>
+ <extensions>true</extensions>
+ <configuration>
+ <nexusUrl>${nexusproxy}</nexusUrl>
+ <stagingProfileId>176c31dfe190a</stagingProfileId>
+ <serverId>ecomp-staging</serverId>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
- <testRouteOffer>workstation</testRouteOffer>
- <testEnv>DEV</testEnv>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.6</version>
+ <configuration>
+ <reportPlugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
+ <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
+ </configuration>
+ <reports>
+ <report>dependencies</report>
+ </reports>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.8</version>
+ <configuration>
+ <additionalparam>-Xdoclint:none</additionalparam>
+ </configuration>
+ </plugin>
+ </reportPlugins>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav-jackrabbit</artifactId>
+ <version>2.10</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
- <!-- For using CXF with Maven -->
- <cxf.version>3.0.4</cxf.version>
- <snapshot.file>int1-data.graphson</snapshot.file>
- <aai.core.version>1.2.1-SNAPSHOT</aai.core.version>
- <aai.schema.version>1.2.1-SNAPSHOT</aai.schema.version>
- </properties>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.10.4</version>
+ <configuration>
+ <failOnError>false</failOnError>
+ <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
+ <docletArtifact>
+ <groupId>org.umlgraph</groupId>
+ <artifactId>umlgraph</artifactId>
+ <version>5.6</version>
+ </docletArtifact>
+ <additionalparam>-views</additionalparam>
+ <useStandardDocletOptions>true</useStandardDocletOptions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
<pluginRepositories>
<pluginRepository>
<id>central</id>
@@ -96,314 +149,5 @@
<name>ECOMP Snapshot Repository</name>
<url>${nexusproxy}/content/repositories/snapshots/</url>
</repository>
-
</repositories>
-
- <distributionManagement>
- <repository>
- <id>ecomp-releases</id>
- <name>ECOMP Release Repository</name>
- <url>${nexusproxy}/content/repositories/releases/</url>
- </repository>
- <snapshotRepository>
- <id>ecomp-snapshots</id>
- <name>ECOMP Snapshot Repository</name>
- <url>${nexusproxy}/content/repositories/snapshots/</url>
- </snapshotRepository>
- <site>
- <id>ecomp-site</id>
- <url>dav:${nexusproxy}${sitePath}</url>
- </site>
- </distributionManagement>
-
- <!-- The standard build tasks for this project are inherited from the parent.
- Please do not override the build tasks. However tasks and/or profiles can
- be included here as well as additional dependencies for your service. Any
- runtime or compile scope dependencies will be copied to the INSTALLATION_PATH/extJars
- folder and will be made available on the AJSC classpath for your service.
- Please, NOTE: DME2 and CSM related dependencies are EXTERNALIZED within the
- CSI environment. Therefore, they are provided within this project as "provided"
- dependencies. In order for the AJSC to run properly, locally, the CSM and
- DME2 dependencies will be copied into the target/commonLibs folder and will
- be made available to the classpath of the AJSC through the use of the system
- property, "AJSC_EXTERNAL_LIB_FOLDERS". This system property needs to be set
- in the "runAjsc" maven profile within the pom.xml (and, is defaulted to do
- so). If you have a startup failure related to a missing dme2 class not found
- exception, please contact the AJSC team for assistance. -->
- <profiles>
- <profile>
- <id>jenkins-properties</id>
- <activation>
- <os>
- <family>unix</family>
- </os>
- </activation>
- <properties>
-
- </properties>
- </profile>
- <profile>
- <id>runAjsc</id>
- <build>
- <defaultGoal>initialize</defaultGoal>
- <plugins>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>1.3.2</version>
- <executions>
- <execution>
- <id>run ajsc</id>
- <phase>initialize</phase>
- <goals>
- <goal>java</goal>
- </goals>
- <configuration>
- <!-- In order to better mimic a SOA cloud installation of AJSC (and
- to help eliminate Maven/Eclipse/AJSC classpath issues that may be difficult
- to diagnose), within this profile used to run locally, we are NOT including
- project dependencies. These will be loaded by AJSC from $AJSC_HOME/extJars.
- The only jar needed to run AJSC is the ajsc-runner.jar, and therefore is
- the only dependency required by this profile to run locally. -->
- <includeProjectDependencies>false</includeProjectDependencies>
- <includePluginDependencies>true</includePluginDependencies>
- <executable>java</executable>
- <mainClass>com.att.ajsc.runner.Runner</mainClass>
- <executableDependency>
- <groupId>com.att.ajsc</groupId>
- <artifactId>ajsc-runner</artifactId>
- </executableDependency>
-
- <environmentVariables>
- <AJSC_HOME>${runAjscHome}</AJSC_HOME>
- </environmentVariables>
- <additionalClasspathElements>
- <additionalClasspathElement>${runAjscHome}/extJars/logback-access-1.1.7.jar
- </additionalClasspathElement>
- <additionalClasspathElement>${runAjscHome}/extJars/logback-core-1.1.7.jar
- </additionalClasspathElement>
- <additionalClasspathElement>
- ${runAjscHome}/extJars/aai-core-${aai.core.version}.jar
- </additionalClasspathElement>
- </additionalClasspathElements>
-
- <!-- Main AJSC System Properties below (necessary for proper startup) -->
- <systemProperties>
- <systemProperty>
- <key>AJSC_HOME</key>
- <value>${runAjscHome}</value>
- </systemProperty>
- <systemProperty>
- <key>AFT_HOME</key>
- <value>${runAjscHome}/bundleconfig/</value>
- </systemProperty>
- <systemProperty>
- <key>AJSC_CONF_HOME</key>
- <value>${aaiAppHome}/bundleconfig-local</value>
- </systemProperty>
- <systemProperty>
- <key>logback.configurationFile</key>
- <value>${aaiAppHome}/ajsc-shared-config/etc/logback.xml</value>
- </systemProperty>
- <systemProperty>
- <key>AJSC_SHARED_CONFIG</key>
- <value>${aaiAppHome}/ajsc-shared-config</value>
- </systemProperty>
- <systemProperty>
- <key>file.separator</key>
- <value>/</value>
- </systemProperty>
- <systemProperty>
- <key>snapshot.location</key>
- <value>${basedir}/aai-resources/snapshots/${snapshot.file}</value>
- </systemProperty>
- <!-- Please, NOTE: The following 2 system properties will normally
- be set within the sys-props.properties file once deployed to a node. We are
- setting them HERE to run locally to make more efficient use of maven variable
- replacement for ${basedir} -->
- <!-- AJSC_EXTERNAL_LIB_FOLDERS represents the particular jars that
- will be externalized on a CSI node. This includes dme2 and csm related artifact. -->
- <sysproperty>
- <key>AJSC_EXTERNAL_LIB_FOLDERS</key>
- <value>${aaiAppHome}/target/commonLibs</value>
- </sysproperty>
- <!-- AJSC_EXTERNAL_PROPERTIES_FOLDERS represents the particular
- files that may need to be added to the classpath. These files will be externalized
- on a CSI node. This includes dme2 and csm related artifact (such as csm-config-app.properties).
- Failure to have these files on the classpath may result in errors thrown
- by csm framework. -->
- <sysproperty>
- <key>AJSC_EXTERNAL_PROPERTIES_FOLDERS</key>
- <value>${aaiAppHome}/ajsc-shared-config/etc</value>
- </sysproperty>
-
- <systemProperty>
- <key>AJSC_SERVICE_NAMESPACE</key>
- <value>${module.ajsc.namespace.name}</value>
- </systemProperty>
- <systemProperty>
- <key>AJSC_SERVICE_VERSION</key>
- <value>${module.ajsc.namespace.version}</value>
- </systemProperty>
- <systemProperty>
- <key>SOACLOUD_SERVICE_VERSION</key>
- <value>${project.version}</value>
- </systemProperty>
- <systemProperty>
- <key>server.port</key>
- <value>${serverPort}</value>
- </systemProperty>
- <systemProperty>
- <key>aai-core.version</key>
- <value>${aai.core.version}</value>
- </systemProperty>
- </systemProperties>
-
- <!-- Command Line Arguments to add to the java command. Here, you
- can specify the port as well as the Context you want your service to run
- in. Use context=/ to run in an unnamed Context (Root Context). The default
- configuration of the AJSC is to run under the / Context. Setting the port
- here can aid during the development phase of your service. However, you can
- leave this argument out entirely, and the AJSC will default to using an Ephemeral
- port. -->
- <arguments>
- <argument>context=/</argument>
- <argument>port=${serverPort}</argument>
- <argument>sslport=${sslport}</argument>
- </arguments>
- </configuration>
- </execution>
- </executions>
- <configuration>
- <executable>java</executable>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>com.att.ajsc</groupId>
- <artifactId>ajsc-runner</artifactId>
- <version>${ajscRuntimeVersion}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>sonar-maven-plugin</artifactId>
- <version>3.2</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
- <configuration>
- <compilerId>groovy-eclipse-compiler</compilerId>
- <verbose>false</verbose>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-eclipse-compiler</artifactId>
- <version>2.9.0-01</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-eclipse-batch</artifactId>
- <version>2.3.4-01</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <executions>
- <execution>
- <id>default-deploy</id>
- <phase>none</phase>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.sonatype.plugins</groupId>
- <artifactId>nexus-staging-maven-plugin</artifactId>
- <version>1.6.7</version>
- <extensions>true</extensions>
- <configuration>
- <nexusUrl>${nexusproxy}</nexusUrl>
- <stagingProfileId>176c31dfe190a</stagingProfileId>
- <serverId>ecomp-staging</serverId>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-site-plugin</artifactId>
- <version>3.6</version>
- <configuration>
- <reportPlugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- <version>2.4</version>
- <configuration>
- <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
- <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
- </configuration>
- <reports>
- <report>dependencies</report>
- </reports>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.8</version>
- <configuration>
- <additionalparam>-Xdoclint:none</additionalparam>
- </configuration>
- </plugin>
- </reportPlugins>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-webdav-jackrabbit</artifactId>
- <version>2.10</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
-
- </build>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.10.4</version>
- <configuration>
- <failOnError>false</failOnError>
- <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
- <docletArtifact>
- <groupId>org.umlgraph</groupId>
- <artifactId>umlgraph</artifactId>
- <version>5.6</version>
- </docletArtifact>
- <additionalparam>-views</additionalparam>
- <useStandardDocletOptions>true</useStandardDocletOptions>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
-
</project>