aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aai-traversal/pom.xml260
-rw-r--r--aai-traversal/src/main/docker/Dockerfile32
-rw-r--r--aai-traversal/src/main/docker/aai.sh3
-rw-r--r--aai-traversal/src/main/docker/docker-entrypoint.sh55
-rw-r--r--aai-traversal/src/main/java/org/onap/aai/TraversalApp.java14
-rw-r--r--aai-traversal/src/main/java/org/onap/aai/dbgraphgen/ModelBasedProcessing.java10
-rw-r--r--aai-traversal/src/main/java/org/onap/aai/rest/CQ2GremlinTest.java2
-rw-r--r--aai-traversal/src/main/java/org/onap/aai/rest/search/LocalCQConfig.java5
-rw-r--r--aai-traversal/src/main/java/org/onap/aai/rest/util/EchoHealthIndicator.java49
-rw-r--r--aai-traversal/src/main/java/org/onap/aai/rest/util/EchoResponse.java39
-rw-r--r--aai-traversal/src/main/java/org/onap/aai/service/AuthorizationService.java4
-rw-r--r--aai-traversal/src/main/resources/application.properties7
-rw-r--r--aai-traversal/src/main/scripts/common_functions.sh15
-rw-r--r--aai-traversal/src/main/scripts/deleteNamedQuery.sh9
-rw-r--r--aai-traversal/src/main/scripts/deleteTool.sh18
-rw-r--r--aai-traversal/src/main/scripts/getTool.sh12
-rwxr-xr-x[-rw-r--r--]aai-traversal/src/main/scripts/install/updateQueryData.sh49
-rw-r--r--aai-traversal/src/main/scripts/putTool.sh114
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/AAIGremlinQueryTest.java4
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/AAISetup.java4
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/QueryParameterTest.java4
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/SubgraphPruneTest.java4
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/TraversalTestConfiguration.java4
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/WebClientConfiguration.java16
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/dbgraphmap/SearchGraphNamedQueryTest.java5
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/it/multitenancy/MultiTenancyIT.java2
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/BadQueryFormatTest.java4
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/ConfigurationTest.java4
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/DslConsumerTest.java74
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/QueryConsumerTest.java4
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/history/AbstractSpringHistoryRestTest.java4
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/search/OnapQueryTest.java2
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/search/QueryTest.java3
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/util/EchoHealthIndicatorTest.java71
-rw-r--r--aai-traversal/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java11
-rw-r--r--aai-traversal/src/test/resources/application-onap-test.properties2
-rw-r--r--aai-traversal/src/test/resources/application-test.properties6
-rw-r--r--aai-traversal/src/test/resources/schema-ingest.properties2
-rw-r--r--onap-java-formatter.xml6
-rw-r--r--pom.xml9
-rw-r--r--releases/1.14.3-container-release.yaml7
-rw-r--r--releases/1.14.4-container-release.yaml7
-rw-r--r--releases/1.14.5-container-release.yaml7
-rw-r--r--releases/1.14.6-container-release.yaml7
-rw-r--r--releases/1.14.7-container-release.yaml7
-rw-r--r--test_csvWriter.csv2
-rw-r--r--version.properties4
47 files changed, 490 insertions, 493 deletions
diff --git a/aai-traversal/pom.xml b/aai-traversal/pom.xml
index 99e5c2d..66ab01d 100644
--- a/aai-traversal/pom.xml
+++ b/aai-traversal/pom.xml
@@ -26,18 +26,18 @@
<parent>
<groupId>org.onap.aai.traversal</groupId>
<artifactId>traversal</artifactId>
- <version>1.14.3-SNAPSHOT</version>
+ <version>1.15.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.aai.traversal</groupId>
<artifactId>aai-traversal</artifactId>
<properties>
- <java.version>1.8</java.version>
+ <java.version>11</java.version>
<start-class>org.onap.aai.TraversalApp</start-class>
<maven.skip.tests>true</maven.skip.tests>
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
+ <maven.compiler.source>11</maven.compiler.source>
+ <maven.compiler.target>11</maven.compiler.target>
<jopt.simple.version>4.9</jopt.simple.version>
@@ -58,8 +58,6 @@
<aai.build.directory>${project.build.directory}/${project.artifactId}-${project.version}-build/</aai.build.directory>
<aai.docker.version>1.0.0</aai.docker.version>
<aai.docker.namespace>onap</aai.docker.namespace>
- <aai.base.image>alpine</aai.base.image>
- <aai.base.image.version>1.13.4</aai.base.image.version>
<!-- Nexus Proxy Properties and Snapshot Locations Ideally this can be
overwritten at runtime per internal environment specific values at runtime -->
@@ -93,21 +91,28 @@
<schema.uri.base.path>/aai</schema.uri.base.path>
<!-- versions -->
- <spring.boot.version>2.4.13</spring.boot.version>
- <janusgraph.version>0.5.0</janusgraph.version>
- <gremlin.version>3.4.13</gremlin.version>
+ <janusgraph.version>0.6.4</janusgraph.version>
+ <gremlin.version>3.5.8</gremlin.version>
+
+ <spring-cloud.version>2020.0.6</spring-cloud.version>
+
+ <!-- fix the driver version to match the one defined in janusgraph-cql
+ spring-boot (2.4) is otherwise downgrading it to 4.9.0 -->
+ <!-- see https://github.com/spring-projects/spring-boot/blob/d336a96b7f204a398b8237560c5dfa7095c53460/spring-boot-project/spring-boot-dependencies/build.gradle#L163 -->
+ <!-- see https://github.com/JanusGraph/janusgraph/blob/6105d67f412def90ed6e704fa01cbf656602e6c9/pom.xml#L112 -->
+ <cassandra-driver.version>4.17.0</cassandra-driver.version>
+ <datastax.native-protocol.version>1.5.1</datastax.native-protocol.version>
- <spring-cloud.version>2020.0.2</spring-cloud.version>
<javax.servlet.version>4.0.1</javax.servlet.version>
<antlr.version>4.9.3</antlr.version>
<keycloak.version>11.0.2</keycloak.version>
+ <activemq.version>5.16.7</activemq.version>
+ <io.swagger.version>1.6.14</io.swagger.version>
<micrometer.version>1.6.6</micrometer.version>
<mockito.core.version>3.4.0</mockito.core.version>
<testcontainers.version>1.6.1</testcontainers.version>
- <netty.handler.version>4.1.63.Final</netty.handler.version>
- <netty.version>4.1.63.Final</netty.version>
<!-- End of Default ONAP Schema Properties -->
<!-- Integration tests will be skipped by default. Could be enabled here or by -DskipITs=false-->
@@ -125,34 +130,9 @@
<artifactId>gmaven-plugin</artifactId>
<version>1.0</version>
<executions>
- <execution>
- <phase>pre-clean</phase>
- </execution>
- <execution>
- <id>parse-base</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <source>
- def userAaiBaseImage = session.userProperties['aai.base.image'];
- def userAaiCommonVersion =
- session.userProperties['aai.base.image.version'];
- if (userAaiCommonVersion != null) {
- project.properties['aai.base.image.version'] =
- userAaiCommonVersion;
- }
- if (userAaiBaseImage != null) {
- project.properties['aai.base.image'] = userAaiBaseImage;
- }
- log.info 'Base image flavour: ' +
- project.properties['aai.base.image'];
- log.info 'Base image version: ' +
- project.properties['aai.base.image.version'];
- </source>
- </configuration>
- </execution>
+ <execution>
+ <phase>pre-clean</phase>
+ </execution>
</executions>
</plugin>
<plugin>
@@ -318,23 +298,12 @@
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-hateoas</artifactId>
- </dependency>
- <dependency>
- <groupId>io.micrometer</groupId>
- <artifactId>micrometer-core</artifactId>
- <version>${micrometer.version}</version>
- </dependency>
- <dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
- <version>${micrometer.version}</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-jersey2</artifactId>
- <version>${micrometer.version}</version>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
@@ -347,16 +316,12 @@
<version>2.1</version>
</dependency>
<dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- </dependency>
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
+ <groupId>jakarta.xml.bind</groupId>
+ <artifactId>jakarta.xml.bind-api</artifactId>
</dependency>
<dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-core</artifactId>
+ <groupId>org.glassfish.jaxb</groupId>
+ <artifactId>jaxb-runtime</artifactId>
</dependency>
<dependency>
<groupId>net.sf.jopt-simple</groupId>
@@ -379,47 +344,8 @@
</dependency>
<dependency>
<groupId>io.swagger</groupId>
- <artifactId>swagger-jersey-jaxrs</artifactId>
- <exclusions>
- <exclusion>
- <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-configuration</groupId>
- <artifactId>commons-configuration</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </exclusion>
- </exclusions>
+ <artifactId>swagger-jersey2-jaxrs</artifactId>
+ <version>${io.swagger.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
@@ -450,10 +376,7 @@
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
+ <version>3.1.12</version>
</dependency>
<dependency>
<groupId>org.janusgraph</groupId>
@@ -463,13 +386,17 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-inmemory</artifactId>
<version>${janusgraph.version}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-ffi</artifactId>
@@ -493,14 +420,6 @@
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
<dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- </dependency>
- <dependency>
- <groupId>org.freemarker</groupId>
- <artifactId>freemarker</artifactId>
- </dependency>
- <dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
</dependency>
@@ -550,14 +469,6 @@
<artifactId>aai-aaf-auth</artifactId>
</exclusion>
<exclusion>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-mapper-asl</artifactId>
- </exclusion>
- <exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
</exclusion>
@@ -582,19 +493,6 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
- <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>
</dependency>
<dependency>
<groupId>org.onap.aai.aai-common</groupId>
@@ -606,17 +504,6 @@
</exclusion>
</exclusions>
</dependency>
- <dependency>
- <groupId>org.skyscreamer</groupId>
- <artifactId>jsonassert</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>com.vaadin.external.google</groupId>
- <artifactId>android-json</artifactId>
- </exclusion>
- </exclusions>
- </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
@@ -633,11 +520,6 @@
</exclusions>
</dependency>
<dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-handler</artifactId>
- <version>${netty.handler.version}</version>
- </dependency>
- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
@@ -672,38 +554,13 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
- </dependency>
- <!-- TODO: Migrate tests to junit 5 and remove this dependency -->
- <dependency>
- <groupId>org.junit.vintage</groupId>
- <artifactId>junit-vintage-engine</artifactId>
- <scope>test</scope>
<exclusions>
- <exclusion>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-core</artifactId>
- </exclusion>
+ <exclusion>
+ <groupId>com.vaadin.external.google</groupId>
+ <artifactId>android-json</artifactId>
+ </exclusion>
</exclusions>
- </dependency>
- <dependency>
- <groupId>org.onap.aaf.authz</groupId>
- <artifactId>aaf-cadi-aaf</artifactId>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>${netty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-test</artifactId>
- <scope>test</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
@@ -717,6 +574,10 @@
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-guava</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -738,10 +599,6 @@
<artifactId>gremlin-groovy</artifactId>
</dependency>
<dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- </dependency>
- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
@@ -754,6 +611,12 @@
<artifactId>testcontainers-keycloak</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
@@ -761,10 +624,16 @@
<version>${keycloak.version}</version>
<scope>test</scope>
</dependency>
+ <!-- TODO: Migrate tests to junit 5 and remove this dependency -->
+ <dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
- <version>1.18.30</version>
+ <version>1.18.34</version>
<scope>provided</scope>
</dependency>
</dependencies>
@@ -788,7 +657,24 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>25.0-jre</version>
- </dependency>
+ </dependency>
+ <!-- cassandra driver -->
+ <dependency>
+ <groupId>com.datastax.oss</groupId>
+ <artifactId>java-driver-core</artifactId>
+ <version>${cassandra-driver.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.datastax.oss</groupId>
+ <artifactId>java-driver-query-builder</artifactId>
+ <version>${cassandra-driver.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.datastax.oss</groupId>
+ <artifactId>native-protocol</artifactId>
+ <version>${datastax.native-protocol.version}</version>
+ </dependency>
+ <!-- /cassandra driver -->
</dependencies>
</dependencyManagement>
<build>
@@ -1119,7 +1005,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
- <version>3.0.0-M4</version>
+ <version>3.1.2</version>
<configuration>
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
</configuration>
diff --git a/aai-traversal/src/main/docker/Dockerfile b/aai-traversal/src/main/docker/Dockerfile
index 0186e25..3bd8e4e 100644
--- a/aai-traversal/src/main/docker/Dockerfile
+++ b/aai-traversal/src/main/docker/Dockerfile
@@ -1,28 +1,14 @@
-FROM @aai.docker.namespace@/aai-common-@aai.base.image@:@aai.base.image.version@
+FROM eclipse-temurin:11-jre-alpine
+# curl is used in the putTool script
+# (PUT's can't be done using the busybox wget)
+RUN apk --no-cache add curl
-USER root
+USER nobody
+ENV SERVER_PORT=8446
+EXPOSE ${SERVER_PORT}
-RUN mkdir -p /opt/aaihome/aaiadmin /opt/aai/logroot/AAI-GQ \
- /opt/app/aai-traversal \
- && chown -R aaiadmin:aaiadmin /opt/aaihome/aaiadmin /opt/aai/logroot/AAI-GQ \
- /opt/app/aai-traversal /etc/profile.d /opt/app /opt/aai/logroot \
- /etc/profile.d \
- /opt/app
-
-VOLUME /tmp
-VOLUME /opt/tools
-
-HEALTHCHECK --interval=40s --timeout=10s --retries=3 CMD nc -z -v localhost 8446 || exit 1
-
-# Add the proper files into the docker image from your build
WORKDIR /opt/app/aai-traversal
-COPY --chown=aaiadmin:aaiadmin /maven/aai-traversal/ .
-
-USER aaiadmin
+COPY --chown=nobody:nobody /maven/aai-traversal/ .
-ENV AAI_BUILD_VERSION @aai.docker.version@
-# Expose the ports for outside linux to use
-# 8446 is the important one to be used
-EXPOSE 8446
-ENTRYPOINT ["/bin/bash", "/opt/app/aai-traversal/docker-entrypoint.sh"] \ No newline at end of file
+ENTRYPOINT ["/bin/sh", "/opt/app/aai-traversal/docker-entrypoint.sh"]
diff --git a/aai-traversal/src/main/docker/aai.sh b/aai-traversal/src/main/docker/aai.sh
index 8cda4f0..412586e 100644
--- a/aai-traversal/src/main/docker/aai.sh
+++ b/aai-traversal/src/main/docker/aai.sh
@@ -30,7 +30,8 @@ if [ -z $JAVA_HOME ] && [ $(grep -i "ID=ubuntu" /etc/os-release | wc -w) -eq 1 ]
fi
# set app related env
-export PROJECT_HOME=/opt/app/aai-traversal
+: ${PROJECT_HOME:=/opt/app/aai-traversal}
+export PROJECT_HOME=$PROJECT_HOME
export AAIENV=dev
export PROJECT_OWNER=aaiadmin
export PROJECT_GROUP=aaiadmin
diff --git a/aai-traversal/src/main/docker/docker-entrypoint.sh b/aai-traversal/src/main/docker/docker-entrypoint.sh
index 7d3ca9a..9325ec6 100644
--- a/aai-traversal/src/main/docker/docker-entrypoint.sh
+++ b/aai-traversal/src/main/docker/docker-entrypoint.sh
@@ -7,9 +7,9 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,75 +28,34 @@ GROUP_ID=${LOCAL_GROUP_ID:-9001}
find /opt/app/ -name "*.sh" -exec chmod +x {} +
-if [ -f ${APP_HOME}/aai.sh ]; then
-
- ln -s bin scripts
- ln -s /opt/aai/logroot/AAI-GQ logs
- mv ${APP_HOME}/aai.sh /etc/profile.d/aai.sh
-
- chmod 755 /etc/profile.d/aai.sh
-
- scriptName=$1;
-
- if [ ! -z $scriptName ]; then
-
- if [ -f ${APP_HOME}/bin/${scriptName} ]; then
- shift 1;
- ${APP_HOME}/bin/${scriptName} "$@" || {
- echo "Failed to run the ${scriptName}";
- exit 1;
- }
- else
- echo "Unable to find the script ${scriptName} in ${APP_HOME}/bin";
- exit 1;
- fi;
-
- exit 0;
- fi;
-fi;
-
if [ -z ${DISABLE_UPDATE_QUERY} ]; then
UPDATE_QUERY_RAN_FILE="updateQueryRan.txt";
/opt/app/aai-traversal/bin/install/updateQueryData.sh
touch ${UPDATE_QUERY_RAN_FILE};
fi
-mkdir -p /opt/app/aai-traversal/logs/gc
-
-if [ -f ${APP_HOME}/resources/aai-traversal-swm-vars.sh ]; then
- source ${APP_HOME}/resources/aai-traversal-swm-vars.sh;
-fi;
-
MIN_HEAP_SIZE=${MIN_HEAP_SIZE:-512m};
MAX_HEAP_SIZE=${MAX_HEAP_SIZE:-1024m};
MAX_METASPACE_SIZE=${MAX_METASPACE_SIZE:-512m};
JAVA_CMD="exec java";
-JVM_OPTS="${PRE_JVM_ARGS} -Xloggc:/opt/app/aai-traversal/logs/gc/aai_gc.log";
+JVM_OPTS="${PRE_JVM_ARGS}";
JVM_OPTS="${JVM_OPTS} -XX:HeapDumpPath=/opt/app/aai-traversal/logs/ajsc-jetty/heap-dump";
-JVM_OPTS="${JVM_OPTS} -Xms${MIN_HEAP_SIZE}";
-JVM_OPTS="${JVM_OPTS} -Xmx${MAX_HEAP_SIZE}";
-
-JVM_OPTS="${JVM_OPTS} -XX:+PrintGCDetails";
-JVM_OPTS="${JVM_OPTS} -XX:+PrintGCTimeStamps";
JVM_OPTS="${JVM_OPTS} -XX:MaxMetaspaceSize=${MAX_METASPACE_SIZE}";
+JVM_OPTS="${JVM_OPTS} -XX:MaxRAMPercentage=${MAX_RAM_PERCENTAGE:-60}";
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:+UseG1GC";
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} -Dsun.net.inetaddr.ttl=180";
JVM_OPTS="${JVM_OPTS} -XX:+HeapDumpOnOutOfMemoryError";
JVM_OPTS="${JVM_OPTS} ${POST_JVM_ARGS}";
@@ -105,10 +64,6 @@ 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} -DAFT_ENVIRONMENT=${AFT_ENVIRONMENT}";
-JAVA_OPTS="${JAVA_OPTS} -DAAI_BUILD_VERSION=${AAI_BUILD_VERSION}";
JAVA_OPTS="${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom";
JAVA_OPTS="${JAVA_OPTS} -Dlogback.configurationFile=./resources/logback.xml";
JAVA_OPTS="${JAVA_OPTS} -Dloader.path=$APP_HOME/resources";
diff --git a/aai-traversal/src/main/java/org/onap/aai/TraversalApp.java b/aai-traversal/src/main/java/org/onap/aai/TraversalApp.java
index b382a16..db6076b 100644
--- a/aai-traversal/src/main/java/org/onap/aai/TraversalApp.java
+++ b/aai-traversal/src/main/java/org/onap/aai/TraversalApp.java
@@ -40,6 +40,8 @@ import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
+import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
@@ -49,8 +51,14 @@ import org.springframework.core.env.Profiles;
import org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration;
@SpringBootApplication(
- exclude = {DataSourceAutoConfiguration.class,
- DataSourceTransactionManagerAutoConfiguration.class, HibernateJpaAutoConfiguration.class, JmsAutoConfiguration.class})
+ exclude = {
+ DataSourceAutoConfiguration.class,
+ DataSourceTransactionManagerAutoConfiguration.class,
+ HibernateJpaAutoConfiguration.class,
+ JmsAutoConfiguration.class,
+ CassandraDataAutoConfiguration.class,
+ CassandraAutoConfiguration.class
+ })
// 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
@@ -58,7 +66,7 @@ import org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration;
@ComponentScan(
basePackages = {"org.onap.aai.config", "org.onap.aai.web", "org.onap.aai.setup",
"org.onap.aai.tasks", "org.onap.aai.service", "org.onap.aai.rest", "org.onap.aai.aaf",
- "org.onap.aai.aailog"})
+ "org.onap.aai.aailog", "org.onap.aai.introspection", "org.onap.aai.rest.notification"})
public class TraversalApp {
private static final Logger logger = LoggerFactory.getLogger(TraversalApp.class.getName());
diff --git a/aai-traversal/src/main/java/org/onap/aai/dbgraphgen/ModelBasedProcessing.java b/aai-traversal/src/main/java/org/onap/aai/dbgraphgen/ModelBasedProcessing.java
index 005d3dc..f262ac4 100644
--- a/aai-traversal/src/main/java/org/onap/aai/dbgraphgen/ModelBasedProcessing.java
+++ b/aai-traversal/src/main/java/org/onap/aai/dbgraphgen/ModelBasedProcessing.java
@@ -269,7 +269,7 @@ public class ModelBasedProcessing {
try {
Optional<Vertex> result = dbMethHelper.searchVertexByIdentityMap(modTopNodeType,
startNodeFilterArrayOfHashes.get(i));
- if (!result.isPresent()) {
+ if (result.isEmpty()) {
throw new AAIException("AAI_6114",
"No Node of type " + modTopNodeType + " found for properties");
}
@@ -710,7 +710,7 @@ public class ModelBasedProcessing {
Optional<Vertex> result =
dbMethHelper.searchVertexByIdentityMap(topNodeTypeVal, startNodeFilterHash);
- if (!result.isPresent()) {
+ if (result.isEmpty()) {
throw new AAIException("AAI_6114",
"No Node of type " + topNodeTypeVal + " found for properties");
}
@@ -741,7 +741,7 @@ public class ModelBasedProcessing {
}
Optional<Vertex> result =
dbMethHelper.locateUniqueVertex(widgModNodeType, startNodeFilterHash);
- if (!result.isPresent()) {
+ if (result.isEmpty()) {
throw new AAIException("AAI_6114",
"No Node of type " + topNType + " found for properties");
}
@@ -794,7 +794,7 @@ public class ModelBasedProcessing {
// Locate the starting node that we'll use to start looking for instance data
Optional<Vertex> result =
dbMethHelper.searchVertexByIdentityMap(topNType, startNodeFilterHash);
- if (!result.isPresent()) {
+ if (result.isEmpty()) {
throw new AAIException("AAI_6114",
"No Node of type " + topNType + " found for properties");
}
@@ -2093,7 +2093,7 @@ public class ModelBasedProcessing {
propHash.put(targetProp, valFromInstance);
Optional<Vertex> result = dbMethHelper.locateUniqueVertex(targetNodeType, propHash);
- if (!result.isPresent()) {
+ if (result.isEmpty()) {
// If it can't find the lookup node, don't fail, just log that it couldn't be found
// ---
logger.debug("WARNING - Could not find lookup node that corresponds to nodeType ["
diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/CQ2GremlinTest.java b/aai-traversal/src/main/java/org/onap/aai/rest/CQ2GremlinTest.java
index bade2cd..76da9d8 100644
--- a/aai-traversal/src/main/java/org/onap/aai/rest/CQ2GremlinTest.java
+++ b/aai-traversal/src/main/java/org/onap/aai/rest/CQ2GremlinTest.java
@@ -204,7 +204,7 @@ public class CQ2GremlinTest extends RESTAPI {
protected void addStartNode(GraphTraversal<Vertex, Vertex> g, CustomQueryTestDTO content) {
Optional<LinkedHashMap<String, String>> startNodeVertex = content.getVerticesDtos().stream()
.filter(map -> map.containsKey("start-node")).findFirst();
- if (!startNodeVertex.isPresent()) {
+ if (startNodeVertex.isEmpty()) {
throw new IllegalArgumentException("start-node was not specified");
}
startNodeVertex.get().forEach((k, v) -> {
diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/search/LocalCQConfig.java b/aai-traversal/src/main/java/org/onap/aai/rest/search/LocalCQConfig.java
index ebf49d7..ad5eb4e 100644
--- a/aai-traversal/src/main/java/org/onap/aai/rest/search/LocalCQConfig.java
+++ b/aai-traversal/src/main/java/org/onap/aai/rest/search/LocalCQConfig.java
@@ -25,7 +25,6 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
@@ -56,7 +55,7 @@ public class LocalCQConfig extends CQConfig {
String filepath =
storedQueriesLocation + AAIConstants.AAI_FILESEP + "stored-queries.json";
logger.info("Using the Local stored queries");
- Path path = Paths.get(filepath);
+ Path path = Path.of(filepath);
String customQueryConfigJson = new String(Files.readAllBytes(path));
queryConfig = new GetCustomQueryConfig(customQueryConfigJson);
@@ -72,7 +71,7 @@ public class LocalCQConfig extends CQConfig {
protected void onChange(File file) {
try {
String filepath = storedQueriesLocation;
- Path path = Paths.get(filepath);
+ Path path = Path.of(filepath);
String customQueryConfigJson = new String(Files.readAllBytes(path));
queryConfig = new GetCustomQueryConfig(customQueryConfigJson);
diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/util/EchoHealthIndicator.java b/aai-traversal/src/main/java/org/onap/aai/rest/util/EchoHealthIndicator.java
new file mode 100644
index 0000000..d44b415
--- /dev/null
+++ b/aai-traversal/src/main/java/org/onap/aai/rest/util/EchoHealthIndicator.java
@@ -0,0 +1,49 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2024 Deutsche Telekom. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY 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.rest.util;
+
+
+import org.springframework.boot.actuate.health.Health;
+import org.springframework.boot.actuate.health.HealthIndicator;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.stereotype.Component;
+
+import lombok.RequiredArgsConstructor;
+
+@Component
+@RequiredArgsConstructor
+@ConditionalOnProperty(name = "aai.actuator.echo.enabled", havingValue = "true")
+public class EchoHealthIndicator implements HealthIndicator {
+
+ private final AaiGraphChecker aaiGraphChecker;
+
+ @Override
+ public Health health() {
+ return healthy()
+ ? Health.up().build()
+ : Health.down().build();
+ }
+
+ private boolean healthy() {
+ return aaiGraphChecker.isAaiGraphDbAvailable();
+ }
+
+}
diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/util/EchoResponse.java b/aai-traversal/src/main/java/org/onap/aai/rest/util/EchoResponse.java
index df677d5..028ebca 100644
--- a/aai-traversal/src/main/java/org/onap/aai/rest/util/EchoResponse.java
+++ b/aai-traversal/src/main/java/org/onap/aai/rest/util/EchoResponse.java
@@ -54,6 +54,8 @@ public class EchoResponse extends RESTAPI {
public EchoResponse(AaiGraphChecker aaiGraphChecker) {
this.aaiGraphChecker = aaiGraphChecker;
}
+
+ private static final String UP_RESPONSE="{\"status\":\"UP\",\"groups\":[\"liveness\",\"readiness\"]}";
/**
* Simple health-check API that echos back the X-FromAppId and X-TransactionId
@@ -92,7 +94,7 @@ public class EchoResponse extends RESTAPI {
if (!aaiGraphChecker.isAaiGraphDbAvailable()) {
throw new AAIException("AAI_5105", "Error establishing a database connection");
}
- return generateSuccessResponse(headers, templateVars);
+ return generateSuccessResponse();
} catch (AAIException aaiException) {
ErrorLogHelper.logException(aaiException);
return generateFailureResponse(headers, templateVars, aaiException);
@@ -102,30 +104,19 @@ public class EchoResponse extends RESTAPI {
return generateFailureResponse(headers, templateVars, aaiException);
}
}
- return generateSuccessResponse(headers, templateVars);
+ return generateSuccessResponse();
}
- private Response generateSuccessResponse(HttpHeaders headers, ArrayList<String> templateVariables) {
- HashMap<AAIException, ArrayList<String>> exceptionList = new HashMap<>();
- exceptionList.put(new AAIException("AAI_0002", "OK"), templateVariables);
- try {
- return Response.status(Status.OK)
- .entity(
- ErrorLogHelper.getRESTAPIInfoResponse(new ArrayList<>(headers.getAcceptableMediaTypes()), exceptionList))
- .build();
- } catch (Exception e) {
- AAIException aaiException = new AAIException("AAI_4000", e);
- ErrorLogHelper.logException(aaiException);
- return generateFailureResponse(headers, templateVariables, aaiException);
- }
- }
+ private Response generateSuccessResponse() {
+ return Response.status(Status.OK)
+ .entity(UP_RESPONSE)
+ .build();
+ }
- private Response generateFailureResponse(HttpHeaders headers, ArrayList<String> templateVariables,
- AAIException aaiException) {
- return Response.status(aaiException.getErrorObject().getHTTPResponseCode())
- .entity(
- ErrorLogHelper.getRESTAPIErrorResponseWithLogging(
- headers.getAcceptableMediaTypes(), aaiException, templateVariables))
- .build();
- }
+ private Response generateFailureResponse(HttpHeaders headers, ArrayList<String> templateVariables,
+ AAIException aaiException) {
+ return Response.status(aaiException.getErrorObject().getHTTPResponseCode()).entity(ErrorLogHelper
+ .getRESTAPIErrorResponseWithLogging(headers.getAcceptableMediaTypes(), aaiException, templateVariables))
+ .build();
+ }
}
diff --git a/aai-traversal/src/main/java/org/onap/aai/service/AuthorizationService.java b/aai-traversal/src/main/java/org/onap/aai/service/AuthorizationService.java
index 10bee2b..c291551 100644
--- a/aai-traversal/src/main/java/org/onap/aai/service/AuthorizationService.java
+++ b/aai-traversal/src/main/java/org/onap/aai/service/AuthorizationService.java
@@ -22,7 +22,7 @@ package org.onap.aai.service;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.nio.file.Path;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
@@ -53,7 +53,7 @@ public class AuthorizationService {
String basicAuthFile = getBasicAuthFilePath();
- try (Stream<String> stream = Files.lines(Paths.get(basicAuthFile))) {
+ try (Stream<String> stream = Files.lines(Path.of(basicAuthFile))) {
stream.filter(line -> !line.startsWith("#")).forEach(str -> {
byte[] bytes = null;
diff --git a/aai-traversal/src/main/resources/application.properties b/aai-traversal/src/main/resources/application.properties
index 29243ae..de08b4e 100644
--- a/aai-traversal/src/main/resources/application.properties
+++ b/aai-traversal/src/main/resources/application.properties
@@ -140,3 +140,10 @@ management.metrics.tags.group_id=aai
# management.metrics.tags.app_id=${info.build.artifact}
#Enable this option only for debug purposes. For more information: https://github.com/micrometer-metrics/micrometer/issues/1584
scrape.uri.metrics=true
+
+
+# If true, the actuator health check will be overriden
+# to use the AaiGraphChecker check instead
+# this does the same as the /echo endpoint,
+# but doesn't show up in micrometer metrics
+aai.actuator.echo.enabled=false
diff --git a/aai-traversal/src/main/scripts/common_functions.sh b/aai-traversal/src/main/scripts/common_functions.sh
index 43de18c..6fb725a 100644
--- a/aai-traversal/src/main/scripts/common_functions.sh
+++ b/aai-traversal/src/main/scripts/common_functions.sh
@@ -1,22 +1,11 @@
-#!/bin/ksh
+#!/bin/sh
# 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(){
- PROJECT_HOME=/opt/app/aai-traversal
+ : ${PROJECT_HOME:=/opt/app/aai-traversal}
}
# Runs the spring boot jar based on which main class
diff --git a/aai-traversal/src/main/scripts/deleteNamedQuery.sh b/aai-traversal/src/main/scripts/deleteNamedQuery.sh
index 43aaae7..6213de3 100644
--- a/aai-traversal/src/main/scripts/deleteNamedQuery.sh
+++ b/aai-traversal/src/main/scripts/deleteNamedQuery.sh
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/sh
#
# ============LICENSE_START=======================================================
# org.onap.aai
@@ -31,13 +31,6 @@ OUTFILE=/opt/app/aai-traversal/logs/misc/${PROGNAME}.log.$(date +\%Y-\%m-\%d)
TS=$(date "+%Y-%m-%d %H:%M:%S")
-CHECK_USER="aaiadmin"
-userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
-if [ "${userid}" != $CHECK_USER ]; then
- echo "You must be $CHECK_USER to run $0. The id used $userid."
- exit 1
-fi
-
error_exit () {
echo "${PROGNAME}: failed for ${1:-"Unknown error"} on cmd $2" 1>&2
echo "${PROGNAME}: failed for ${1:-"Unknown error"} on cmd $2" >> $OUTFILE
diff --git a/aai-traversal/src/main/scripts/deleteTool.sh b/aai-traversal/src/main/scripts/deleteTool.sh
index c347b0d..239563b 100644
--- a/aai-traversal/src/main/scripts/deleteTool.sh
+++ b/aai-traversal/src/main/scripts/deleteTool.sh
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/sh
#
# ============LICENSE_START=======================================================
# org.onap.aai
@@ -23,7 +23,7 @@
#
# The script is called with a resource to be deleted.
-# Uses aaiconfig.properties for authorization type and url.
+# Uses aaiconfig.properties for authorization type and url.
# It invokes a GET on the resource using curl and parses the resource-version.
# If found, prompts the user to continue and invokes DELETE using curl.
# responses in the range of 200 to 299 are considered successful
@@ -39,17 +39,11 @@ fi
echo `date` " Starting $0 for resource $RESOURCE"
XFROMAPPID="AAI-TOOLS"
-XTRANSID=`uuidgen`
-XTRANSID1=`uuidgen`
-
-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
+XTRANSID="someUUID"
+XTRANSID1="someUUID"
-PROJECT_HOME=/opt/app/aai-traversal
+: ${PROJECT_HOME:=/opt/app/aai-traversal}
prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties
log_dir=$PROJECT_HOME/logs/misc
today=$(date +\%Y-\%m-\%d)
@@ -98,7 +92,7 @@ if [ $MISSING_PROP = false ]; then
echo `date` " Done $0, returning -1"
exit -1
fi
-
+
result=`curl --request DELETE -sL -w "%{http_code}" -o /dev/null -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" $RESTURL$RESOURCE?resource-version=$RESOURCEVERSION`
echo "result is $result."
RC=0;
diff --git a/aai-traversal/src/main/scripts/getTool.sh b/aai-traversal/src/main/scripts/getTool.sh
index 6db0914..f72120b 100644
--- a/aai-traversal/src/main/scripts/getTool.sh
+++ b/aai-traversal/src/main/scripts/getTool.sh
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/sh
#
# ============LICENSE_START=======================================================
# org.onap.aai
@@ -36,16 +36,10 @@ fi
echo `date` " Starting $0 for resource $RESOURCE"
XFROMAPPID="AAI-TOOLS"
-XTRANSID=`uuidgen`
-
-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
+XTRANSID="someUUID"
-PROJECT_HOME=/opt/app/aai-traversal
+: ${PROJECT_HOME:=/opt/app/aai-traversal}
prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties
log_dir=$PROJECT_HOME/logs/misc
today=$(date +\%Y-\%m-\%d)
diff --git a/aai-traversal/src/main/scripts/install/updateQueryData.sh b/aai-traversal/src/main/scripts/install/updateQueryData.sh
index 7b5d1b3..9884efe 100644..100755
--- a/aai-traversal/src/main/scripts/install/updateQueryData.sh
+++ b/aai-traversal/src/main/scripts/install/updateQueryData.sh
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/sh
#
# ============LICENSE_START=======================================================
# org.onap.aai
@@ -22,8 +22,8 @@
#
PROGNAME=$(basename $0)
-PROJECT_HOME=/opt/app/aai-traversal
-OUTFILE=$PROJECT_HOME/logs/misc/${PROGNAME}.log.$(date +\%Y-\%m-\%d)
+
+: ${PROJECT_HOME:=/opt/app/aai-traversal}
if [ "$1" = "--debug" ]; then
set -x;
@@ -31,16 +31,8 @@ fi;
TS=$(date "+%Y-%m-%d %H:%M:%S")
-CHECK_USER="aaiadmin"
-userid=$( id | cut -f2 -d"(" | cut -f1 -d")" )
-if [ "${userid}" != $CHECK_USER ]; then
- echo "You must be $CHECK_USER to run $0. The id used $userid."
- exit 1
-fi
-
error_exit () {
echo "${PROGNAME}: failed for ${1:-"Unknown error"} on cmd $2" 1>&2
- echo "${PROGNAME}: failed for ${1:-"Unknown error"} on cmd $2" >> $OUTFILE
# exit ${2:-"1"}
}
@@ -54,11 +46,11 @@ vers=`grep model-invariant-id $filepath|cut -d':' -f2|cut -d'"' -f2`
# last parameter will skip put if it exists
resource=service-design-and-creation/models/model/$vers
if [ "$1" = "--debug" ]; then
- bash -x $PROJECT_HOME/scripts/putTool.sh $resource $filepath 412 >> $OUTFILE 2>&1 || error_exit "$resource $filepath" $j
-else
- $PROJECT_HOME/scripts/putTool.sh $resource $filepath 412 >> $OUTFILE 2>&1 || error_exit "$resource $filepath" $j
+ sh -x $PROJECT_HOME/bin/putTool.sh $resource $filepath 412 2>&1 || error_exit "$resource $filepath" $j
+else
+ $PROJECT_HOME/bin/putTool.sh $resource $filepath 412 2>&1 || error_exit "$resource $filepath" $j
fi;
-echo "End putTool for widget $filename" | tee -a $OUTFILE
+echo "End putTool for widget $filename"
done
j=0
@@ -66,16 +58,16 @@ for filepath in `ls $PROJECT_HOME/resources/etc/scriptdata/named-query-json/*.js
do
j=$(expr "$j" + 1)
filename=$(basename $filepath)
-echo "Begin putTool for named-query $filename" | tee -a $OUTFILE
+echo "Begin putTool for named-query $filename"
vers=`grep named-query-uuid $filepath|cut -d':' -f2|cut -d'"' -f2`
# last parameter will skip put if it exists
resource=service-design-and-creation/named-queries/named-query/$vers
if [ "$1" = "--debug" ]; then
- bash -x $PROJECT_HOME/scripts/putTool.sh $resource $filepath 412 >> $OUTFILE 2>&1 || error_exit "$resource $filepath" $j
+ bash -x $PROJECT_HOME/bin/putTool.sh $resource $filepath 412 2>&1 || error_exit "$resource $filepath" $j
else
- $PROJECT_HOME/scripts/putTool.sh $resource $filepath 412 >> $OUTFILE 2>&1 || error_exit "$resource $filepath" $j
+ $PROJECT_HOME/bin/putTool.sh $resource $filepath 412 2>&1 || error_exit "$resource $filepath" $j
fi;
-echo "End putTool for named-query $filename" | tee -a $OUTFILE
+echo "End putTool for named-query $filename"
done
j=0
@@ -83,16 +75,16 @@ for filepath in `ls $PROJECT_HOME/resources/etc/scriptdata/resource-model-json/*
do
j=$(expr "$j" + 1)
filename=$(basename $filepath)
-echo "Begin putTool for resource model $filename" | tee -a $OUTFILE
+echo "Begin putTool for resource model $filename"
vers=`grep model-invariant-id $filepath|cut -d':' -f2|cut -d'"' -f2`
# last parameter will skip put if it exists
resource=service-design-and-creation/models/model/$vers
if [ "$1" = "--debug" ]; then
- bash -x $PROJECT_HOME/scripts/putTool.sh $resource $filepath 412 >> $OUTFILE 2>&1 || error_exit "$resource $filepath" $j
+ bash -x $PROJECT_HOME/bin/putTool.sh $resource $filepath 412 2>&1 || error_exit "$resource $filepath" $j
else
- $PROJECT_HOME/scripts/putTool.sh $resource $filepath 412 >> $OUTFILE 2>&1 || error_exit "$resource $filepath" $j
+ $PROJECT_HOME/bin/putTool.sh $resource $filepath 412 2>&1 || error_exit "$resource $filepath" $j
fi;
-echo "End putTool for resource model $filename" | tee -a $OUTFILE
+echo "End putTool for resource model $filename"
done
j=0
@@ -100,19 +92,18 @@ for filepath in `ls $PROJECT_HOME/resources/etc/scriptdata/service-model-json/*.
do
j=$(expr "$j" + 1)
filename=$(basename $filepath)
-echo "Begin putTool for service model $filename" | tee -a $OUTFILE
+echo "Begin putTool for service model $filename"
vers=`grep model-invariant-id $filepath|cut -d':' -f2|cut -d'"' -f2`
# last parameter will skip put if it exists
resource=service-design-and-creation/models/model/$vers
if [ "$1" = "--debug" ]; then
- bash -x $PROJECT_HOME/scripts/putTool.sh $resource $filepath 412 >> $OUTFILE 2>&1 || error_exit "$resource $filepath" $j
+ bash -x $PROJECT_HOME/bin/putTool.sh $resource $filepath 412 2>&1 || error_exit "$resource $filepath" $j
else
- $PROJECT_HOME/scripts/putTool.sh $resource $filepath 412 >> $OUTFILE 2>&1 || error_exit "$resource $filepath" $j
+ $PROJECT_HOME/bin/putTool.sh $resource $filepath 412 2>&1 || error_exit "$resource $filepath" $j
fi;
-echo "End putTool for service model $filename" | tee -a $OUTFILE
+echo "End putTool for service model $filename"
done
-echo "$PROGNAME completed ${TS}" | tee -a $OUTFILE
-echo "See output and error file: $OUTFILE"
+echo "$PROGNAME completed ${TS}"
exit 0
diff --git a/aai-traversal/src/main/scripts/putTool.sh b/aai-traversal/src/main/scripts/putTool.sh
index 6f22067..28463f4 100644
--- a/aai-traversal/src/main/scripts/putTool.sh
+++ b/aai-traversal/src/main/scripts/putTool.sh
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/sh
#
# ============LICENSE_START=======================================================
# org.onap.aai
@@ -78,16 +78,11 @@ echo `date` " Starting $0 for resource $RESOURCE"
ALLOWHTTPRESPONSES=$3
XFROMAPPID="AAI-TOOLS"
-XTRANSID=`uuidgen`
+XTRANSID="someUUID"
-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
-PROJECT_HOME=/opt/app/aai-traversal
+: ${PROJECT_HOME:=/opt/app/aai-traversal}
prop_file=$PROJECT_HOME/resources/etc/appprops/aaiconfig.properties
log_dir=$PROJECT_HOME/logs/misc
today=$(date +\%Y-\%m-\%d)
@@ -130,62 +125,69 @@ fi
fname=$JSONFILE
if [ -f /tmp/$(basename $JSONFILE) ]; then
- fname=/tmp/$(basename $JSONFILE)
+ fname=/tmp/$(basename $JSONFILE)
elif [ ! -f $JSONFILE ]; then
- echo "The file $JSONFILE does not exist"
- exit -1
+ echo "The file $JSONFILE does not exist"
+ exit -1
fi
if [ $MISSING_PROP = false ]; then
- if [ $USEBASICAUTH = false ]; then
- 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" -H "Content-Type: application/json" -T $fname $RESTURL$RESOURCE | jq '.'
- RC=$?
- else
- result=`curl --request PUT -w "%{http_code}" -o /dev/null -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" -H "Content-Type: application/json" -T $fname $RESTURL$RESOURCE`
- #echo "result is $result."
- RC=0;
- if [ $? -eq 0 ]; then
- case $result in
- +([0-9])?)
- if [[ "$result" -ge 200 && $result -lt 300 ]]
- then
- echo "PUT result is OK, $result"
- else
- if [ -z $ALLOWHTTPRESPONSES ]; then
- echo "PUT request failed, response code was $result"
- RC=$result
- else
- contains $ALLOWHTTPRESPONSES $result
- if [ $? -ne 0 ]
- then
- echo "PUT request failed, unexpected response code was $result"
- RC=$result
- else
- echo "PUT result is expected, $result"
- fi
- fi
- fi
- ;;
- *)
- echo "PUT request failed, response was $result"
- RC=-1
- ;;
-
+ if [ $USEBASICAUTH = false ]; then
+ 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" -H "Content-Type: application/json" -T $fname $RESTURL$RESOURCE | jq '.'
+ RC=$?
+ else
+ result=`curl --request PUT -w "%{http_code}" -o /dev/null -k $AUTHSTRING -H "X-FromAppId: $XFROMAPPID" -H "X-TransactionId: $XTRANSID" -H "Accept: application/json" -H "Content-Type: application/json" -T $fname $RESTURL$RESOURCE`
+ #echo "result is $result."
+ RC=0;
+ if [ $? -eq 0 ]; then
+ case $result in
+ # Match one or more digits optionally followed by another character
+ *[0-9]*)
+ if [ "$result" -ge 200 ] && [ "$result" -lt 300 ]; then
+ echo "PUT result is OK, $result"
+ else
+ if [ -z "$ALLOWHTTPRESPONSES" ]; then
+ echo "PUT request failed, response code was $result"
+ RC=$result
+ else
+ # Function to check if a string is in a list of strings
+ contains() {
+ for item in $1; do
+ if [ "$item" = "$2" ]; then
+ return 0
+ fi
+ done
+ return 1
+ }
+ contains "$ALLOWHTTPRESPONSES" "$result"
+ if [ $? -ne 0 ]; then
+ echo "PUT request failed, unexpected response code was $result"
+ RC=$result
+ else
+ echo "PUT result is expected, $result"
+ fi
+ fi
+ fi
+ ;;
+ *)
+ echo "PUT request failed, response was $result"
+ RC=-1
+ ;;
esac
- else
+ else
echo "FAILED to send request to $RESTURL"
RC=-1
- fi
- fi
+ fi
+ fi
else
- echo "usage: $0 resource file [expected-failure-codes]"
- RC=-1
+ echo "usage: $0 resource file [expected-failure-codes]"
+ RC=-1
fi
echo `date` " Done $0, returning $RC"
-exit $RC \ No newline at end of file
+exit $RC
diff --git a/aai-traversal/src/test/java/org/onap/aai/AAIGremlinQueryTest.java b/aai-traversal/src/test/java/org/onap/aai/AAIGremlinQueryTest.java
index 652c2f3..0bac97e 100644
--- a/aai-traversal/src/test/java/org/onap/aai/AAIGremlinQueryTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/AAIGremlinQueryTest.java
@@ -47,6 +47,9 @@ import org.onap.aai.util.AAIConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
+import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.context.annotation.Import;
@@ -80,6 +83,7 @@ import com.jayway.jsonpath.JsonPath;
classes = TraversalApp.class)
@TestPropertySource(locations = "classpath:application-test.properties")
@ContextConfiguration(initializers = PropertyPasswordConfiguration.class)
+@EnableAutoConfiguration(exclude={CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) // there is no running cassandra instance for the test
@Import(TraversalTestConfiguration.class)
public class AAIGremlinQueryTest {
diff --git a/aai-traversal/src/test/java/org/onap/aai/AAISetup.java b/aai-traversal/src/test/java/org/onap/aai/AAISetup.java
index 7849671..5e6fccc 100644
--- a/aai-traversal/src/test/java/org/onap/aai/AAISetup.java
+++ b/aai-traversal/src/test/java/org/onap/aai/AAISetup.java
@@ -40,6 +40,7 @@ import org.onap.aai.rest.dsl.DslQueryProcessor;
import org.onap.aai.rest.dsl.V1DslQueryProcessor;
import org.onap.aai.rest.dsl.V2DslQueryProcessor;
import org.onap.aai.rest.dsl.v1.DslListener;
+import org.onap.aai.rest.notification.NotificationService;
import org.onap.aai.rest.search.GremlinServerSingleton;
import org.onap.aai.serialization.db.EdgeSerializer;
import org.onap.aai.setup.AAIConfigTranslator;
@@ -57,7 +58,8 @@ import org.springframework.test.context.junit4.rules.SpringMethodRule;
classes = {ConfigConfiguration.class, AAIConfigTranslator.class, EdgeIngestor.class,
EdgeSerializer.class, NodeIngestor.class, SpringContextAware.class,
IntrospectionConfig.class, RestBeanConfig.class, SearchConfiguration.class, XmlFormatTransformerConfiguration.class,
- GremlinServerSingleton.class, V1DslQueryProcessor.class, V2DslQueryProcessor.class, DslListener.class, org.onap.aai.rest.dsl.v2.DslListener.class})
+ GremlinServerSingleton.class, V1DslQueryProcessor.class, V2DslQueryProcessor.class, DslListener.class, org.onap.aai.rest.dsl.v2.DslListener.class,
+ LoaderFactory.class, NotificationService.class})
@TestPropertySource(
properties = {"schema.uri.base.path = /aai",
"schema.ingest.file = src/test/resources/application-test.properties"})
diff --git a/aai-traversal/src/test/java/org/onap/aai/QueryParameterTest.java b/aai-traversal/src/test/java/org/onap/aai/QueryParameterTest.java
index 817ba28..4e6ce81 100644
--- a/aai-traversal/src/test/java/org/onap/aai/QueryParameterTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/QueryParameterTest.java
@@ -36,6 +36,9 @@ import org.onap.aai.config.PropertyPasswordConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
+import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.context.annotation.Import;
@@ -51,6 +54,7 @@ import org.springframework.web.client.RestTemplate;
classes = TraversalApp.class)
@TestPropertySource(locations = "classpath:application-test.properties")
@ContextConfiguration(initializers = PropertyPasswordConfiguration.class)
+@EnableAutoConfiguration(exclude={CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) // there is no running cassandra instance for the test
@Import(TraversalTestConfiguration.class)
public class QueryParameterTest {
diff --git a/aai-traversal/src/test/java/org/onap/aai/SubgraphPruneTest.java b/aai-traversal/src/test/java/org/onap/aai/SubgraphPruneTest.java
index 4aefa85..d6d385f 100644
--- a/aai-traversal/src/test/java/org/onap/aai/SubgraphPruneTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/SubgraphPruneTest.java
@@ -31,6 +31,9 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aai.config.PropertyPasswordConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
+import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.context.annotation.Import;
@@ -46,6 +49,7 @@ import org.springframework.web.client.RestTemplate;
classes = TraversalApp.class)
@TestPropertySource(locations = "classpath:application-test.properties")
@ContextConfiguration(initializers = PropertyPasswordConfiguration.class)
+@EnableAutoConfiguration(exclude={CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) // there is no running cassandra instance for the test
@Import(TraversalTestConfiguration.class)
public class SubgraphPruneTest {
diff --git a/aai-traversal/src/test/java/org/onap/aai/TraversalTestConfiguration.java b/aai-traversal/src/test/java/org/onap/aai/TraversalTestConfiguration.java
index 4a03c03..8e2e823 100644
--- a/aai-traversal/src/test/java/org/onap/aai/TraversalTestConfiguration.java
+++ b/aai-traversal/src/test/java/org/onap/aai/TraversalTestConfiguration.java
@@ -33,6 +33,9 @@ import org.apache.http.ssl.SSLContextBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
+import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
@@ -46,6 +49,7 @@ import org.springframework.web.client.ResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
@TestConfiguration
+@EnableAutoConfiguration(exclude={CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) // there is no running cassandra instance for the test
public class TraversalTestConfiguration {
private static final Logger logger = LoggerFactory.getLogger(TraversalTestConfiguration.class);
diff --git a/aai-traversal/src/test/java/org/onap/aai/WebClientConfiguration.java b/aai-traversal/src/test/java/org/onap/aai/WebClientConfiguration.java
index 73239c6..4bedf3f 100644
--- a/aai-traversal/src/test/java/org/onap/aai/WebClientConfiguration.java
+++ b/aai-traversal/src/test/java/org/onap/aai/WebClientConfiguration.java
@@ -22,10 +22,13 @@ package org.onap.aai;
import java.time.Duration;
import java.util.Collections;
+
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Lazy;
+import org.springframework.context.annotation.Primary;
import org.springframework.http.MediaType;
import org.springframework.test.web.reactive.server.WebTestClient;
@@ -34,6 +37,7 @@ public class WebClientConfiguration {
@Lazy
@Bean
+ @Primary
WebTestClient webTestClient(@LocalServerPort int port) {
return WebTestClient.bindToServer()
.baseUrl("http://localhost:" + port)
@@ -47,4 +51,16 @@ public class WebClientConfiguration {
})
.build();
}
+
+ @Lazy
+ @Bean
+ WebTestClient mgmtClient(@Value("${local.management.port}") int port) {
+ return WebTestClient.bindToServer()
+ .baseUrl("http://localhost:" + port)
+ .responseTimeout(Duration.ofSeconds(300))
+ .defaultHeaders(headers -> {
+ headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
+ })
+ .build();
+ }
}
diff --git a/aai-traversal/src/test/java/org/onap/aai/dbgraphmap/SearchGraphNamedQueryTest.java b/aai-traversal/src/test/java/org/onap/aai/dbgraphmap/SearchGraphNamedQueryTest.java
index e3351ae..9b88c38 100644
--- a/aai-traversal/src/test/java/org/onap/aai/dbgraphmap/SearchGraphNamedQueryTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/dbgraphmap/SearchGraphNamedQueryTest.java
@@ -29,7 +29,6 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -101,7 +100,7 @@ public class SearchGraphNamedQueryTest extends AAISetup {
assert files != null;
for (File file : files) {
try {
- Path path = Paths.get(widgetPath + AAIConstants.AAI_FILESEP + file.getName());
+ Path path = Path.of(widgetPath + AAIConstants.AAI_FILESEP + file.getName());
String widgetPayload = new String(Files.readAllBytes(path));
String modelInvariantId = getJsonValue(widgetPayload, "model-invariant-id");
String widgetUri =
@@ -126,7 +125,7 @@ public class SearchGraphNamedQueryTest extends AAISetup {
assert files != null;
for (File file : files) {
try {
- Path path = Paths.get(namedQueryPath + AAIConstants.AAI_FILESEP + file.getName());
+ Path path = Path.of(namedQueryPath + AAIConstants.AAI_FILESEP + file.getName());
String namedQueryPayload = new String(Files.readAllBytes(path));
String namedQueryUuid = getJsonValue(namedQueryPayload, "named-query-uuid");
String namedQueryUri =
diff --git a/aai-traversal/src/test/java/org/onap/aai/it/multitenancy/MultiTenancyIT.java b/aai-traversal/src/test/java/org/onap/aai/it/multitenancy/MultiTenancyIT.java
index 38490f8..18e7a52 100644
--- a/aai-traversal/src/test/java/org/onap/aai/it/multitenancy/MultiTenancyIT.java
+++ b/aai-traversal/src/test/java/org/onap/aai/it/multitenancy/MultiTenancyIT.java
@@ -102,7 +102,7 @@ public class MultiTenancyIT extends AbstractSpringRestTest {
@Test
public void testDslQueryWithDataOwner() throws Exception {
baseUrl = "http://localhost:" + randomPort;
- String endpoint = baseUrl + "/aai/v23/dsl?format=console";
+ String endpoint = baseUrl + "/aai/v29/dsl?format=console";
List<Object> queryResults = null;
ResponseEntity responseEntity = null;
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/BadQueryFormatTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/BadQueryFormatTest.java
index 1efbce7..6580c74 100644
--- a/aai-traversal/src/test/java/org/onap/aai/rest/BadQueryFormatTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/BadQueryFormatTest.java
@@ -37,6 +37,9 @@ import org.onap.aai.TraversalApp;
import org.onap.aai.TraversalTestConfiguration;
import org.onap.aai.config.PropertyPasswordConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
+import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.context.annotation.Import;
@@ -52,6 +55,7 @@ import org.springframework.web.client.RestTemplate;
classes = TraversalApp.class)
@TestPropertySource(locations = "classpath:application-test.properties")
@ContextConfiguration(initializers = PropertyPasswordConfiguration.class)
+@EnableAutoConfiguration(exclude={CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) // there is no running cassandra instance for the test
@Import(TraversalTestConfiguration.class)
public class BadQueryFormatTest {
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/ConfigurationTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/ConfigurationTest.java
index 0992519..a892522 100644
--- a/aai-traversal/src/test/java/org/onap/aai/rest/ConfigurationTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/ConfigurationTest.java
@@ -35,6 +35,9 @@ import org.onap.aai.config.SpringContextAware;
import org.onap.aai.restclient.PropertyPasswordConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
+import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration;
import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
@@ -57,6 +60,7 @@ import io.prometheus.client.exporter.common.TextFormat;
@SpringBootTest(
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
classes = {SpringContextAware.class, TraversalApp.class})
+@EnableAutoConfiguration(exclude={CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) // there is no running cassandra instance for the test
public class ConfigurationTest extends AbstractSpringRestTest {
@Autowired
RestTemplate restTemplate;
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/DslConsumerTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/DslConsumerTest.java
index ed4a6e6..9c38fd0 100644
--- a/aai-traversal/src/test/java/org/onap/aai/rest/DslConsumerTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/DslConsumerTest.java
@@ -299,7 +299,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
@Test
public void testDslQueryV2Aggregate() throws Exception {
- String endpoint = "/aai/v17/dsl?format=aggregate";
+ String endpoint = "/aai/v29/dsl?format=aggregate";
Map<String, String> dslQueryMap = new HashMap<>();
dslQueryMap.put("dsl-query", "pserver*('hostname','test-pserver-dsl')");
String payload = PayloadUtil.getTemplatePayload("dsl-query.json", dslQueryMap);
@@ -309,7 +309,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
ResponseEntity<String> responseEntity =
restTemplate.exchange(baseUrl + endpoint, HttpMethod.PUT, httpEntity, String.class);
- assertNotNull("Response from /aai/v17/dsl is not null", responseEntity);
+ assertNotNull("Response from /aai/v29/dsl is not null", responseEntity);
assertEquals("Expected the response to be 200", HttpStatus.OK,
responseEntity.getStatusCode());
}
@@ -388,7 +388,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
dslQueryMap.put("dsl-query",
"pserver{'hostname', 'ptnii-equip-name', 'in-maint'}('hostname','test-pserver-dsl')");
String payload = PayloadUtil.getTemplatePayload("dsl-query.json", dslQueryMap);
- String endpoint = "/aai/v16/dsl?format=simple&depth=0&nodesOnly=true&as-tree=true";
+ String endpoint = "/aai/v29/dsl?format=simple&depth=0&nodesOnly=true&as-tree=true";
// Add header with V2 to use the {} feature as a part of dsl query
headers.add("X-DslApiVersion", "V2");
@@ -415,7 +415,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
dslQueryMap.put("dsl-query",
"pserver{'hostname', 'ptnii-equip-name', 'in-maint'}('hostname','test-pserver-dsl')");
String payload = PayloadUtil.getTemplatePayload("dsl-query.json", dslQueryMap);
- String endpoint = "/aai/v16/dsl?format=simple&depth=0&nodesOnly=true";
+ String endpoint = "/aai/v29/dsl?format=simple&depth=0&nodesOnly=true";
// Add header with V2 to use the {} feature as a part of dsl query
headers.add("X-DslApiVersion", "V2");
@@ -443,7 +443,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
dslQueryMap.put("dsl-query",
"pserver{'hostname', 'ptnii-equip-name', 'in-maint'}('hostname','test-pserver-dsl')");
String payload = PayloadUtil.getTemplatePayload("dsl-query.json", dslQueryMap);
- String endpoint = "/aai/v16/dsl?format=resource&depth=0&nodesOnly=true&as-tree=true";
+ String endpoint = "/aai/v29/dsl?format=resource&depth=0&nodesOnly=true&as-tree=true";
// Add header with V2 to use the {} feature as a part of dsl query
headers.add("X-DslApiVersion", "V2");
@@ -470,7 +470,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
dslQueryMap.put("dsl-query",
"pserver{'hostname', 'ptnii-equip-name', 'in-maint'}('hostname','test-pserver-dsl')");
String payload = PayloadUtil.getTemplatePayload("dsl-query.json", dslQueryMap);
- String endpoint = "/aai/v16/dsl?format=resource&depth=0&nodesOnly=true";
+ String endpoint = "/aai/v29/dsl?format=resource&depth=0&nodesOnly=true";
// Add header with V2 to use the {} feature as a part of dsl query
headers.add("X-DslApiVersion", "V2");
@@ -498,7 +498,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
"pserver{'hostname', 'ptnii-equip-name', 'in-maint'}('hostname','test-pserver-dsl')");
String payload = PayloadUtil.getTemplatePayload("dsl-query.json", dslQueryMap);
String endpoint =
- "/aai/v16/dsl?format=resource_and_url&depth=0&nodesOnly=true&as-tree=true";
+ "/aai/v29/dsl?format=resource_and_url&depth=0&nodesOnly=true&as-tree=true";
// Add header with V2 to use the {} feature as a part of dsl query
headers.add("X-DslApiVersion", "V2");
@@ -525,7 +525,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
dslQueryMap.put("dsl-query",
"pserver{'hostname', 'ptnii-equip-name', 'in-maint'}('hostname','test-pserver-dsl')");
String payload = PayloadUtil.getTemplatePayload("dsl-query.json", dslQueryMap);
- String endpoint = "/aai/v16/dsl?format=resource_and_url&depth=0&nodesOnly=true";
+ String endpoint = "/aai/v29/dsl?format=resource_and_url&depth=0&nodesOnly=true";
// Add header with V2 to use the {} feature as a part of dsl query
headers.add("X-DslApiVersion", "V2");
@@ -552,7 +552,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
dslQueryMap.put("dsl-query",
"pserver{'hostname'}('hostname','test-pserver-dsl') > complex");
String payload = PayloadUtil.getTemplatePayload("dsl-query.json", dslQueryMap);
- String endpoint = "/aai/v16/dsl?format=aggregate";
+ String endpoint = "/aai/v29/dsl?format=aggregate";
// Add header with V2 to use the {} feature as a part of dsl query
headers.add("X-DslApiVersion", "V2");
@@ -565,7 +565,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
JsonArray resultsArray = results.get("results").getAsJsonArray();
JsonObject resultsValue = resultsArray.get(0).getAsJsonObject();
assertNull(
- resultsValue.get("/aai/v16/cloud-infrastructure/complexes/complex/test-complex-dsl")); // assert
+ resultsValue.get("/aai/v29/cloud-infrastructure/complexes/complex/test-complex-dsl")); // assert
// complex
// is
// not
@@ -576,7 +576,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
// not
// selected
JsonObject properties =
- resultsValue.get("/aai/v16/cloud-infrastructure/pservers/pserver/test-pserver-dsl")
+ resultsValue.get("/aai/v29/cloud-infrastructure/pservers/pserver/test-pserver-dsl")
.getAsJsonObject().get("properties").getAsJsonObject();
assertEquals(1, properties.size());
assertThat(properties.get("hostname").toString(), is("\"test-pserver-dsl\"")); // assert
@@ -595,7 +595,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
dslQueryMap.put("dsl-query",
"pserver{'hostname'}('hostname','test-pserver-dsl') > complex*");
String payload = PayloadUtil.getTemplatePayload("dsl-query.json", dslQueryMap);
- String endpoint = "/aai/v16/dsl?format=aggregate";
+ String endpoint = "/aai/v29/dsl?format=aggregate";
// Add header with V2 to use the {} feature as a part of dsl query
headers.add("X-DslApiVersion", "V2");
@@ -608,14 +608,14 @@ public class DslConsumerTest extends AbstractSpringRestTest {
JsonArray resultsArray = results.get("results").getAsJsonArray();
JsonArray resultsValue = resultsArray.get(0).getAsJsonArray();
assertNotNull(resultsValue.get(1).getAsJsonObject()
- .get("/aai/v16/cloud-infrastructure/complexes/complex/test-complex-dsl")); // assert
+ .get("/aai/v29/cloud-infrastructure/complexes/complex/test-complex-dsl")); // assert
// complex is
// returned
// since it
// is
// selected
JsonObject properties = resultsValue.get(0).getAsJsonObject()
- .get("/aai/v16/cloud-infrastructure/pservers/pserver/test-pserver-dsl")
+ .get("/aai/v29/cloud-infrastructure/pservers/pserver/test-pserver-dsl")
.getAsJsonObject().get("properties").getAsJsonObject();
assertEquals(1, properties.size());
assertThat(properties.get("hostname").toString(), is("\"test-pserver-dsl\"")); // verify
@@ -628,7 +628,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
assertNull(properties.get("in-maint")); // assert that in-maint is not returned in the
// properties list
JsonObject complexProperties = resultsValue.get(1).getAsJsonObject()
- .get("/aai/v16/cloud-infrastructure/complexes/complex/test-complex-dsl")
+ .get("/aai/v29/cloud-infrastructure/complexes/complex/test-complex-dsl")
.getAsJsonObject().get("properties").getAsJsonObject();
assertEquals(2, complexProperties.size()); // internal properties like source-of-truth,
// node-type and aai-uri are not returned.
@@ -640,7 +640,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
Map<String, String> dslQueryMap = new HashMap<>();
dslQueryMap.put("dsl-query", "pserver*('hostname','test-pserver-dsl')");
String payload = PayloadUtil.getTemplatePayload("dsl-query.json", dslQueryMap);
- String endpoint = "/aai/v16/dsl?format=aggregate";
+ String endpoint = "/aai/v29/dsl?format=aggregate";
// Add header with V2 to use the {} feature as a part of dsl query
headers.add("X-DslApiVersion", "V2");
@@ -652,7 +652,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
JsonObject results = JsonParser.parseString(responseString).getAsJsonObject();
JsonArray resultsArray = results.get("results").getAsJsonArray();
JsonObject properties = resultsArray.get(0).getAsJsonObject()
- .get("/aai/v16/cloud-infrastructure/pservers/pserver/test-pserver-dsl")
+ .get("/aai/v29/cloud-infrastructure/pservers/pserver/test-pserver-dsl")
.getAsJsonObject().get("properties").getAsJsonObject();
assertEquals(2, properties.size());
assertThat(properties.get("hostname").toString(), is("\"test-pserver-dsl\"")); // verify
@@ -673,7 +673,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
dslQueryMap.put("dsl-query",
"pserver*('hostname','test-pserver-dsl')(> complex)(> cloud-region)");
String payload = PayloadUtil.getTemplatePayload("dsl-query.json", dslQueryMap);
- String endpoint = "/aai/v18/dsl?format=aggregate";
+ String endpoint = "/aai/v29/dsl?format=aggregate";
// Add header with V2 to use the {} feature as a part of dsl query
headers.add("X-DslApiVersion", "V2");
@@ -688,10 +688,10 @@ public class DslConsumerTest extends AbstractSpringRestTest {
// test-pserver-dsl-03 since it does not have an edge
// to cloud-region
assertEquals(null, resultsArray.get(0).getAsJsonObject()
- .get("/aai/v18/cloud-infrastructure/pservers/pserver/test-pserver-dsl-03")); // not
+ .get("/aai/v29/cloud-infrastructure/pservers/pserver/test-pserver-dsl-03")); // not
// returned
assertNotNull(resultsArray.get(0).getAsJsonObject()
- .get("/aai/v18/cloud-infrastructure/pservers/pserver/test-pserver-dsl"));
+ .get("/aai/v29/cloud-infrastructure/pservers/pserver/test-pserver-dsl"));
headers.remove("X-DslApiVersion");
}
@@ -700,7 +700,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
Map<String, String> dslQueryMap = new HashMap<>();
dslQueryMap.put("dsl-query", "pserver*('hostname')!(> complex)!(> cloud-region)");
String payload = PayloadUtil.getTemplatePayload("dsl-query.json", dslQueryMap);
- String endpoint = "/aai/v18/dsl?format=aggregate";
+ String endpoint = "/aai/v29/dsl?format=aggregate";
// Add header with V2 to use the {} feature as a part of dsl query
headers.add("X-DslApiVersion", "V2");
@@ -713,10 +713,10 @@ public class DslConsumerTest extends AbstractSpringRestTest {
JsonArray resultsArray = results.get("results").getAsJsonArray();
assertEquals(1, resultsArray.size()); // Returns only test-pserver-dsl-02
assertEquals(null, resultsArray.get(0).getAsJsonObject()
- .get("/aai/v18/cloud-infrastructure/pservers/pserver/test-pserver-dsl")); // not
+ .get("/aai/v29/cloud-infrastructure/pservers/pserver/test-pserver-dsl")); // not
// returned
assertNotNull(resultsArray.get(0).getAsJsonObject()
- .get("/aai/v18/cloud-infrastructure/pservers/pserver/test-pserver-dsl-02"));
+ .get("/aai/v29/cloud-infrastructure/pservers/pserver/test-pserver-dsl-02"));
headers.remove("X-DslApiVersion");
}
@@ -726,7 +726,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
dslQueryMap.put("dsl-query", "pserver*('number-of-cpus','test')");
String payload = PayloadUtil.getTemplatePayload("dsl-query.json", dslQueryMap);
- String endpoint = "/aai/v16/dsl?format=simple";
+ String endpoint = "/aai/v29/dsl?format=simple";
httpEntity = new HttpEntity<String>(payload, headers);
ResponseEntity<String> responseEntity =
@@ -744,7 +744,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
dslQueryMap.put("dsl-query",
"[complex*('source-of-truth', 'JUNIT'), complex*('aai-uri', '/cloud-infrastructure/complexes/complex/test-complex-dsl')]");
String payload = PayloadUtil.getTemplatePayload("dsl-query.json", dslQueryMap);
- String endpoint = "/aai/v16/dsl?format=resource";
+ String endpoint = "/aai/v29/dsl?format=resource";
httpEntity = new HttpEntity<String>(payload, headers);
ResponseEntity<String> responseEntity =
@@ -766,7 +766,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
dslQueryMap.put("dsl-query",
"[pserver*('hostname','test-pserver-dsl'), complex*('physical-location-id', 'test-complex-dsl')]");
String payload = PayloadUtil.getTemplatePayload("dsl-query.json", dslQueryMap);
- String endpoint = "/aai/v16/dsl?format=resource";
+ String endpoint = "/aai/v29/dsl?format=resource";
httpEntity = new HttpEntity<String>(payload, headers);
ResponseEntity<String> responseEntity =
@@ -797,7 +797,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
dslQueryMap.put("dsl-query",
"[pserver*('hostname','test-pserver-dsl-02'), pserver*('hostname','test-pserver-dsl')>complex*, pnf('pnf-name','pnf-name-noResults')>lag-interface>l-interface] > complex*");
String payload = PayloadUtil.getTemplatePayload("dsl-query.json", dslQueryMap);
- String endpoint = "/aai/v16/dsl?format=resource";
+ String endpoint = "/aai/v29/dsl?format=resource";
httpEntity = new HttpEntity<String>(payload, headers);
ResponseEntity<String> responseEntity =
@@ -835,7 +835,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
dslQueryMap.put("dsl-query",
"[pnf*('pnf-name','test-pnf-name-01'),pserver(>cloud-region*('cloud-owner','test-cloud-owner-01'))]");
String payload = PayloadUtil.getTemplatePayload("dsl-query.json", dslQueryMap);
- String endpoint = "/aai/v16/dsl?format=resource";
+ String endpoint = "/aai/v29/dsl?format=resource";
httpEntity = new HttpEntity<String>(payload, headers);
ResponseEntity<String> responseEntity =
@@ -862,7 +862,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
public void testDslQuery_IsAgnosticWithBooleanPropertyAsString_ReturnSuccessfulResponse()
throws Exception {
Map<String, String> dslQueryMap = new HashMap<>();
- String endpoint = "/aai/v19/dsl?format=resource&nodesOnly=true";
+ String endpoint = "/aai/v29/dsl?format=resource&nodesOnly=true";
// With expected boolean value "false" as a boolean value (no quotes)
dslQueryMap.put("dsl-query",
@@ -896,7 +896,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
public void testDslQuery_IsAgnosticWithWrongBooleanPropertyAsString_ReturnSuccessfulResponse()
throws Exception {
Map<String, String> dslQueryMap = new HashMap<>();
- String endpoint = "/aai/v19/dsl?format=resource&nodesOnly=true";
+ String endpoint = "/aai/v29/dsl?format=resource&nodesOnly=true";
// all string values not boolean related default to false
dslQueryMap.put("dsl-query",
@@ -915,7 +915,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
public void testDslQuery_IsAgnosticWithBooleanPropertyAsInteger0_ReturnSuccessfulResponse()
throws Exception {
Map<String, String> dslQueryMap = new HashMap<>();
- String endpoint = "/aai/v19/dsl?format=resource&nodesOnly=true";
+ String endpoint = "/aai/v29/dsl?format=resource&nodesOnly=true";
// 0 is false, should return value
dslQueryMap.put("dsl-query",
@@ -934,7 +934,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
public void testDslQuery_IsAgnosticWithBooleanPropertyAsInteger1_ReturnSuccessfulResponse()
throws Exception {
Map<String, String> dslQueryMap = new HashMap<>();
- String endpoint = "/aai/v19/dsl?format=resource&nodesOnly=true";
+ String endpoint = "/aai/v29/dsl?format=resource&nodesOnly=true";
// 0 is false, should return value
dslQueryMap.put("dsl-query",
@@ -954,7 +954,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
public void testDslQuery_IsAgnosticWithBooleanPropertyAsTrue_ReturnSuccessfulResponse()
throws Exception {
Map<String, String> dslQueryMap = new HashMap<>();
- String endpoint = "/aai/v19/dsl?format=resource&nodesOnly=true";
+ String endpoint = "/aai/v29/dsl?format=resource&nodesOnly=true";
// 0 is false, should return value
dslQueryMap.put("dsl-query",
@@ -974,7 +974,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
public void testDslQuery_IsAgnosticWithBooleanPropertyAsTrueString_ReturnSuccessfulResponse()
throws Exception {
Map<String, String> dslQueryMap = new HashMap<>();
- String endpoint = "/aai/v19/dsl?format=resource&nodesOnly=true";
+ String endpoint = "/aai/v29/dsl?format=resource&nodesOnly=true";
// 0 is false, should return value
dslQueryMap.put("dsl-query",
@@ -994,7 +994,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
public void testDslQuery_IsAgnosticWithIntegerPropertyAsString_ReturnSuccessfulResponse()
throws Exception {
Map<String, String> dslQueryMap = new HashMap<>();
- String endpoint = "/aai/v19/dsl?format=resource&nodesOnly=true";
+ String endpoint = "/aai/v29/dsl?format=resource&nodesOnly=true";
// With expected boolean value "false" as a boolean value (no quotes)
dslQueryMap.put("dsl-query",
@@ -1028,7 +1028,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
public void testDslQuery_IsAgnosticWithLongPropertyAsString_ReturnSuccessfulResponse()
throws Exception {
Map<String, String> dslQueryMap = new HashMap<>();
- String endpoint = "/aai/v19/dsl?format=resource&nodesOnly=true";
+ String endpoint = "/aai/v29/dsl?format=resource&nodesOnly=true";
// With expected boolean value "false" as a boolean value (no quotes)
dslQueryMap.put("dsl-query",
@@ -1061,7 +1061,7 @@ public class DslConsumerTest extends AbstractSpringRestTest {
public void testDslQuery_IsAgnosticWithPrimitivePropertiesInList_ReturnSuccessfulResponse()
throws Exception {
Map<String, String> dslQueryMap = new HashMap<>();
- String endpoint = "/aai/v19/dsl?format=resource&nodesOnly=true";
+ String endpoint = "/aai/v29/dsl?format=resource&nodesOnly=true";
// With expected boolean value "false" as a boolean value (no quotes)
dslQueryMap.put("dsl-query",
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/QueryConsumerTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/QueryConsumerTest.java
index a6da4fc..e75019a 100644
--- a/aai-traversal/src/test/java/org/onap/aai/rest/QueryConsumerTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/QueryConsumerTest.java
@@ -49,6 +49,9 @@ import org.onap.aai.exceptions.AAIException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
+import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.context.annotation.Import;
@@ -65,6 +68,7 @@ import org.springframework.web.client.RestTemplate;
classes = TraversalApp.class)
@TestPropertySource(locations = "classpath:application-test.properties")
@ContextConfiguration(initializers = PropertyPasswordConfiguration.class)
+@EnableAutoConfiguration(exclude={CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) // there is no running cassandra instance for the test
@Import({TraversalTestConfiguration.class, WebClientConfiguration.class})
public class QueryConsumerTest {
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/history/AbstractSpringHistoryRestTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/history/AbstractSpringHistoryRestTest.java
index 5e397dd..9fdce03 100644
--- a/aai-traversal/src/test/java/org/onap/aai/rest/history/AbstractSpringHistoryRestTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/history/AbstractSpringHistoryRestTest.java
@@ -36,6 +36,9 @@ import org.onap.aai.exceptions.AAIException;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.util.AAIConfig;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
+import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.context.annotation.Import;
@@ -55,6 +58,7 @@ import org.springframework.web.client.RestTemplate;
locations = "classpath:application-test.properties",
properties = {"history.enabled=true", "history.truncate.window.days = " + Integer.MAX_VALUE})
@ContextConfiguration(initializers = PropertyPasswordConfiguration.class)
+@EnableAutoConfiguration(exclude={CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) // there is no running cassandra instance for the test
@Import(TraversalTestConfiguration.class)
public abstract class AbstractSpringHistoryRestTest {
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/search/OnapQueryTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/search/OnapQueryTest.java
index 44264c1..32f9d76 100644
--- a/aai-traversal/src/test/java/org/onap/aai/rest/search/OnapQueryTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/search/OnapQueryTest.java
@@ -80,7 +80,7 @@ import org.springframework.test.context.junit4.rules.SpringMethodRule;
@ContextConfiguration(
classes = {ConfigConfiguration.class, AAIConfigTranslator.class, EdgeIngestor.class,
EdgeSerializer.class, NodeIngestor.class, SpringContextAware.class,
- SearchConfiguration.class, IntrospectionConfig.class})
+ SearchConfiguration.class, IntrospectionConfig.class, LoaderFactory.class})
@TestPropertySource(
properties = {"schema.uri.base.path = /aai",
"schema.ingest.file = src/test/resources/application-onap-test.properties"})
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/search/QueryTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/search/QueryTest.java
index 4574ca1..2cbc1cd 100644
--- a/aai-traversal/src/test/java/org/onap/aai/rest/search/QueryTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/search/QueryTest.java
@@ -59,6 +59,7 @@ import org.onap.aai.introspection.LoaderFactory;
import org.onap.aai.introspection.ModelType;
import org.onap.aai.nodes.NodeIngestor;
import org.onap.aai.query.builder.GremlinTraversal;
+import org.onap.aai.rest.notification.NotificationService;
import org.onap.aai.restcore.search.GremlinGroovyShell;
import org.onap.aai.restcore.search.GroovyQueryBuilder;
import org.onap.aai.serialization.db.EdgeSerializer;
@@ -80,7 +81,7 @@ import org.springframework.test.context.junit4.rules.SpringMethodRule;
@ContextConfiguration(
classes = {ConfigConfiguration.class, AAIConfigTranslator.class, EdgeIngestor.class,
EdgeSerializer.class, NodeIngestor.class, SpringContextAware.class,
- SearchConfiguration.class, IntrospectionConfig.class})
+ SearchConfiguration.class, IntrospectionConfig.class, LoaderFactory.class, NotificationService.class})
@TestPropertySource(
properties = {"schema.uri.base.path = /aai",
"schema.ingest.file = src/test/resources/application-test.properties"})
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/util/EchoHealthIndicatorTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/util/EchoHealthIndicatorTest.java
new file mode 100644
index 0000000..b129e7e
--- /dev/null
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/util/EchoHealthIndicatorTest.java
@@ -0,0 +1,71 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2024 Deutsche Telekom. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY 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.rest.util;
+
+import static org.mockito.Mockito.when;
+
+import org.junit.jupiter.api.Test;
+import org.onap.aai.WebClientConfiguration;
+import org.onap.aai.rest.AbstractSpringRestTest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.context.annotation.Import;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.web.reactive.server.WebTestClient;
+
+
+@Import(WebClientConfiguration.class)
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+@TestPropertySource(properties = {"aai.actuator.echo.enabled=true",
+ "server.ssl.enabled=false"})
+public class EchoHealthIndicatorTest extends AbstractSpringRestTest {
+
+ @Autowired
+ @Qualifier("mgmtClient")
+ WebTestClient webClient;
+
+ @MockBean private AaiGraphChecker aaiGraphChecker;
+
+ @Test
+ public void thatActuatorCheckIsHealthy() {
+ when(aaiGraphChecker.isAaiGraphDbAvailable()).thenReturn(true);
+
+ webClient.get()
+ .uri("/actuator/health")
+ .exchange()
+ .expectStatus()
+ .isOk();
+ }
+
+ @Test
+ public void thatActuatorCheckIsUnhealthy() {
+ when(aaiGraphChecker.isAaiGraphDbAvailable()).thenReturn(false);
+
+ webClient.get()
+ .uri("/actuator/health")
+ .exchange()
+ .expectStatus()
+ .is5xxServerError();
+ }
+}
diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java
index eb67799..fb71599 100644
--- a/aai-traversal/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java
+++ b/aai-traversal/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java
@@ -152,13 +152,10 @@ public class EchoResponseTest {
}
@Test
- public void testEchoResultWhenValidHeadersButMediaTypeWrong() throws Exception {
-
- when(httpHeaders.getAcceptableMediaTypes()).thenThrow(new IllegalStateException())
- .thenReturn(outputMediaTypes);
-
- Response response = echoResponse.echoResult(httpHeaders, null, null);
-
+ public void testCheckDbNowAction_Unknown() {
+ when(aaiGraphCheckerMock.isAaiGraphDbAvailable()).thenReturn(null);
+ Response response = echoResponse.echoResult(httpHeaders, null, "myAction");
+ // Verify
assertNotNull(response);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatus());
}
diff --git a/aai-traversal/src/test/resources/application-onap-test.properties b/aai-traversal/src/test/resources/application-onap-test.properties
index 5340d17..862e7e2 100644
--- a/aai-traversal/src/test/resources/application-onap-test.properties
+++ b/aai-traversal/src/test/resources/application-onap-test.properties
@@ -57,7 +57,7 @@ schema.ingest.file=${server.local.startpath}/application-test.properties
# Schema Version Related Attributes
schema.uri.base.path=/aai
# Lists all of the versions in the schema
-schema.version.list=v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20,v21,v22,v23,v24,v25,v26,v27,v28,v29
+schema.version.list=v10,v11,v12,v13,v14,v29
# Specifies from which version should the depth parameter to default to zero
schema.version.depth.start=v10
# Specifies from which version should the related link be displayed in response payload
diff --git a/aai-traversal/src/test/resources/application-test.properties b/aai-traversal/src/test/resources/application-test.properties
index d4e0378..b4a9352 100644
--- a/aai-traversal/src/test/resources/application-test.properties
+++ b/aai-traversal/src/test/resources/application-test.properties
@@ -37,7 +37,7 @@ server.local.startpath=src/main/resources
server.basic.auth.location=${server.local.startpath}/etc/auth/realm.properties
server.port=8446
-security.require-ssl=false
+security.require-ssl=false
server.ssl.enabled=false
#server.ssl.enabled-protocols=TLSv1.1,TLSv1.2
#server.ssl.key-store=${server.local.startpath}/etc/auth/aai_keystore
@@ -66,7 +66,7 @@ schema.ingest.file=${server.local.startpath}/application-test.properties
# Schema Version Related Attributes
schema.uri.base.path=/aai
# Lists all of the versions in the schema
-schema.version.list=v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20,v21,v22,v23,v24,v25,v26,v27,v28,v29
+schema.version.list=v10,v11,v12,v13,v14v27,v28,v29
# Specifies from which version should the depth parameter to default to zero
schema.version.depth.start=v10
# Specifies from which version should the related link be displayed in response payload
@@ -88,4 +88,4 @@ management.server.port=0
management.endpoints.enabled-by-default=true
management.endpoints.web.exposure.include=info, health, prometheus
management.metrics.web.server.request.autotime.enabled=false
-scrape.uri.metrics=true \ No newline at end of file
+scrape.uri.metrics=true
diff --git a/aai-traversal/src/test/resources/schema-ingest.properties b/aai-traversal/src/test/resources/schema-ingest.properties
index eeec1ac..6e3a8b9 100644
--- a/aai-traversal/src/test/resources/schema-ingest.properties
+++ b/aai-traversal/src/test/resources/schema-ingest.properties
@@ -2,7 +2,7 @@ schema.configuration.location=N/A
schema.nodes.location=src/main/resources/etc/oxm/
schema.edges.location=src/main/resources/etc/dbedgerules/
-schema.version.list=v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20,v21,v22,v23,v24,v25,v26,v27,v28,v29
+schema.version.list=v10,v11,v12,v13,v14,v29
schema.version.depth.start=v10
schema.version.related.link.start=v10
schema.version.app.root.start=v11
diff --git a/onap-java-formatter.xml b/onap-java-formatter.xml
index 920d37b..29dbb9a 100644
--- a/onap-java-formatter.xml
+++ b/onap-java-formatter.xml
@@ -2,11 +2,11 @@
<profiles version="12">
<profile kind="CodeFormatterProfile" name="onap-java-formatter" version="12">
<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
-<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.8"/>
-<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.8"/>
+<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="11"/>
+<setting id="org.eclipse.jdt.core.compiler.compliance" value="11"/>
<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
-<setting id="org.eclipse.jdt.core.compiler.source" value="1.8"/>
+<setting id="org.eclipse.jdt.core.compiler.source" value="11"/>
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="48"/>
diff --git a/pom.xml b/pom.xml
index cbe9459..6ab1d77 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,22 +26,23 @@
<parent>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-parent</artifactId>
- <version>1.14.3</version>
+ <version>1.15.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.aai.traversal</groupId>
<artifactId>traversal</artifactId>
- <version>1.14.3-SNAPSHOT</version>
+ <version>1.15.0-SNAPSHOT</version>
<name>aai-traversal</name>
<packaging>pom</packaging>
<modules>
<module>aai-traversal</module>
</modules>
<properties>
+ <maven.compiler.release>11</maven.compiler.release>
<!--
Nexus Proxy Properties and Snapshot Locations
Ideally this can be overwritten at runtime per internal environment specific values at runtime
-->
- <aai.common.version>1.14.3</aai.common.version>
+ <aai.common.version>1.15.0-SNAPSHOT</aai.common.version>
<nexusproxy>https://nexus.onap.org</nexusproxy>
<site.path>/content/sites/site/org/onap/aai/traversal/${project.artifactId}/${project.version}</site.path>
<release.path>/content/repositories/releases/</release.path>
@@ -49,7 +50,7 @@
<staging.path>/content/repositories/staging/</staging.path>
<!-- GMaven plugin uses this property to figure out the name of the docker tag -->
<aai.project.version>${project.version}</aai.project.version>
- <aai.schema.service.version>1.12.4</aai.schema.service.version>
+ <aai.schema.service.version>1.12.5</aai.schema.service.version>
</properties>
<build>
<pluginManagement>
diff --git a/releases/1.14.3-container-release.yaml b/releases/1.14.3-container-release.yaml
new file mode 100644
index 0000000..d2385ef
--- /dev/null
+++ b/releases/1.14.3-container-release.yaml
@@ -0,0 +1,7 @@
+distribution_type: container
+container_release_tag: 1.14.3
+project: traversal
+ref: 89d63d1f1bdb1f1805f26746421c1902f0e6a00d
+containers:
+ - name: aai-traversal
+ version: 1.14-STAGING-20240701T095752Z
diff --git a/releases/1.14.4-container-release.yaml b/releases/1.14.4-container-release.yaml
new file mode 100644
index 0000000..7021260
--- /dev/null
+++ b/releases/1.14.4-container-release.yaml
@@ -0,0 +1,7 @@
+distribution_type: container
+container_release_tag: 1.14.4
+project: traversal
+ref: 0fd911705e0136905f5d8da40380e713968b09c9
+containers:
+ - name: aai-traversal
+ version: 1.14-STAGING-20240704T134306Z
diff --git a/releases/1.14.5-container-release.yaml b/releases/1.14.5-container-release.yaml
new file mode 100644
index 0000000..03ecdc1
--- /dev/null
+++ b/releases/1.14.5-container-release.yaml
@@ -0,0 +1,7 @@
+distribution_type: container
+container_release_tag: 1.14.5
+project: traversal
+ref: de332b8981bd5c62c6f901312c6cc7945d4d3610
+containers:
+ - name: aai-traversal
+ version: 1.14-STAGING-20240806T095453Z
diff --git a/releases/1.14.6-container-release.yaml b/releases/1.14.6-container-release.yaml
new file mode 100644
index 0000000..1798ed8
--- /dev/null
+++ b/releases/1.14.6-container-release.yaml
@@ -0,0 +1,7 @@
+distribution_type: container
+container_release_tag: 1.14.6
+project: traversal
+ref: 2fd7864b0681864ee5a8853270a9a032e7ee6acc
+containers:
+ - name: aai-traversal
+ version: 1.14-STAGING-20240815T132236Z
diff --git a/releases/1.14.7-container-release.yaml b/releases/1.14.7-container-release.yaml
new file mode 100644
index 0000000..198bb0a
--- /dev/null
+++ b/releases/1.14.7-container-release.yaml
@@ -0,0 +1,7 @@
+distribution_type: container
+container_release_tag: 1.14.7
+project: traversal
+ref: 256763965c5c06db942928b412a46938138cdb5d
+containers:
+ - name: aai-traversal
+ version: 1.14-STAGING-20240919T062645Z
diff --git a/test_csvWriter.csv b/test_csvWriter.csv
deleted file mode 100644
index 2f66fec..0000000
--- a/test_csvWriter.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-s0,s1
-t0,t1
diff --git a/version.properties b/version.properties
index a9c3f22..039d36d 100644
--- a/version.properties
+++ b/version.properties
@@ -4,8 +4,8 @@
# because they are used in Jenkins, whose plug-in doesn't support
major_version=1
-minor_version=14
-patch_version=3
+minor_version=15
+patch_version=0
base_version=${major_version}.${minor_version}.${patch_version}