aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changelog.md3
-rw-r--r--README.md13
-rw-r--r--pom.xml951
-rw-r--r--src/main/java/org/onap/dcae/ApplicationConfigurationListener.java22
-rw-r--r--src/main/java/org/onap/dcae/VesApplication.java6
-rw-r--r--src/main/java/org/onap/dcae/configuration/ConfigurationHandler.java20
-rw-r--r--src/test/java/org/onap/dcae/ApplicationConfigurationListenerTest.java4
-rw-r--r--src/test/java/org/onap/dcae/configuration/CbsConfigurationHandlerTest.java23
-rw-r--r--version.properties2
9 files changed, 524 insertions, 520 deletions
diff --git a/Changelog.md b/Changelog.md
index 6e107d7e..1a0c7d2f 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -61,3 +61,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- sending event for many topics at once is no longer supported
- add backward compatibility status codes
- add additional validation for batchEvent
+## [1.10.1] - 24/08/2021
+ - [DCAEGEN2-1483](https://jira.onap.org/browse/DCAEGEN2-2719) - CBS-Client supporting configMap
+ - update CBS-Client from 1.8.0 to 1.8.7 in order to enable config file support
diff --git a/README.md b/README.md
index 407fc7ad..94571b17 100644
--- a/README.md
+++ b/README.md
@@ -103,6 +103,7 @@ Variables set manually / coming from deployment system:
- CONFIG_BINDING_SERVICE - should be a name of CBS
- CONFIG_BINDING_SERVICE_SERVICE_PORT - should be an http port of CBS
- HOSTNAME - should be a name of VESCollector application as it is registered in CBS catalog
+- CBS_CLIENT_CONFIG_PATH - (optional) should contain path to application config file.
### Docker file system layout
The main directory where all code resides in docker container
@@ -143,14 +144,16 @@ For testing purpose, the docker image includes preset configuration which can be
-### Consul - Dynamic configuration
+### Dynamic configuration
-Application properties like /etc/collector.properties and Dmaap configuration /etc/DmaapConfig.json are updated frequently by configuration stored in Consul(CBS)
+Application properties like /etc/collector.properties and Dmaap configuration /etc/DmaapConfig.json are updated frequently by configuration stored in config file or if it doesn't exist, in Consul (CBS)
http://<kubernetes_host_ip>:30270/ui/#/dc1/kv/<vescollector_SCN>
-Configuration stored in Consul have bigger priority and always will override local configuration so all configuration modification should be done using Consul update on corresponding kv store.
-Frequently how often configuration will be fetch from Consul server is manageable in /etc/collector.properties property "collector.dynamic.config.update.frequency={time in minutes}".
-To fetch configuration from Consul, VES collector uses CBS client from DCAE SDK.
+By default, config file is located in /app-config/application_config.yaml and this path can be changed by CBS_CLIENT_CONFIG_PATH env.
+Configuration stored in config file has the biggest priority and always will override local configuration.
+If config file doesn't exist then configuration will be fetched from Consul server.
+Frequently how often configuration will be dynamically fetched is manageable in /etc/collector.properties property "collector.dynamic.config.update.frequency={time in minutes}".
+To fetch configuration, VES collector uses CBS client from DCAE SDK.
Sample configuration of VESCollector K-V store can be found under /dpo/data-formats/ConsulConfig.json
diff --git a/pom.xml b/pom.xml
index b0fe6788..ac8601fc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,476 +1,475 @@
-<?xml version="1.0"?>
-<!--
- ================================================================================
- Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
- Copyright (c) 2020-2021 Nokia. All rights reserved.
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License"); you may not
- use this file except in compliance with the License. You may obtain a copy
- of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License.
- ============LICENSE_END=========================================================
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.oparent</groupId>
- <artifactId>oparent</artifactId>
- <version>3.2.0</version>
- <relativePath/>
- </parent>
- <groupId>org.onap.dcaegen2.collectors.ves</groupId>
- <artifactId>VESCollector</artifactId>
- <version>1.10.0-SNAPSHOT</version>
- <name>dcaegen2-collectors-ves</name>
- <description>VESCollector</description>
- <properties>
- <!-- PROJECT SETTINGS -->
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <java.version>11</java.version>
- <docker.image.name>onap/org.onap.dcaegen2.collectors.ves.vescollector</docker.image.name>
- <!-- TEST SETTINGS -->
- <surefire.redirectTestOutputToFile>true</surefire.redirectTestOutputToFile>
- <!-- PLUGIN SETTINGS -->
- <dependency.locations.enabled>false</dependency.locations.enabled>
- <!-- NEXUS RELATED SETTINGS -->
- <nexusproxy>https://nexus.onap.org</nexusproxy>
- <snapshots.path>content/repositories/snapshots/</snapshots.path>
- <releases.path>content/repositories/releases/</releases.path>
- <site.path>content/sites/site/org/onap/dcaegen2/collectors/ves/${project.artifactId}/${project.version}</site.path>
- <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
- <onap.nexus.dockerregistry.daily>nexus3.onap.org:10003</onap.nexus.dockerregistry.daily>
- <maven.compiler.target>${java.version}</maven.compiler.target>
- <maven.compiler.source>${java.version}</maven.compiler.source>
- <sonar.coverage.jacoco.xmlReportPaths>
- ${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml
- </sonar.coverage.jacoco.xmlReportPaths>
- <!-- DEPENDENCY RELATED SETTINGS -->
- <micrometer.version>1.6.5</micrometer.version>
- <spring.version>2.4.3</spring.version>
- <maven-assembly-plugin.version>3.1.0</maven-assembly-plugin.version>
- <maven-javadoc-plugin.version>3.0.1</maven-javadoc-plugin.version>
- <maven-project-info-reports-plugin.version>2.9</maven-project-info-reports-plugin.version>
- <maven-surefire-plugin.version>3.0.0-M1</maven-surefire-plugin.version>
- <docker-maven-plugin.version>1.2.0</docker-maven-plugin.version>
- <json-simple.version>1.1.1</json-simple.version>
- <json-schema-validator.version>1.0.49</json-schema-validator.version>
- <gson.version>2.8.6</gson.version>
- <json.version>20210307</json.version>
- <unirest-java.version>1.4.9</unirest-java.version>
- <commons-collections.version>3.2.2</commons-collections.version>
- <commons-configuration.version>1.10</commons-configuration.version>
- <vavr.version>0.10.3</vavr.version>
- <spring-boot-starter-log4j2.version>2.4.3</spring-boot-starter-log4j2.version>
- <springfox-swagger2.version>3.0.0</springfox-swagger2.version>
- <assertj-core.version>3.19.0</assertj-core.version>
- <spring-boot-starter-test.version>2.2.13.RELEASE</spring-boot-starter-test.version>
- <sdk.version>1.8.0</sdk.version>
- <guava.version>30.1-jre</guava.version>
- <mock-server.version>5.11.1</mock-server.version>
- <dmaap-client.version>1.8.6</dmaap-client.version>
- <reactor-test.version>3.4.0</reactor-test.version>
- <testcontainers.version>1.15.1</testcontainers.version>
- <junit-jupiter.version>1.15.1</junit-jupiter.version>
- </properties>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>${maven-assembly-plugin.version}</version>
- </plugin>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>${maven-javadoc-plugin.version}</version>
- </plugin>
- <plugin>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- <version>${maven-project-info-reports-plugin.version}</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>${maven-surefire-plugin.version}</version>
- <configuration>
- <environmentVariables>
- <TESTCONTAINERS_RYUK_DISABLED>true</TESTCONTAINERS_RYUK_DISABLED>
- </environmentVariables>
- </configuration>
- </plugin>
- <plugin>
- <groupId>com.spotify</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>${docker-maven-plugin.version}</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/dep.xml</descriptor>
- </descriptors>
- <attach>false</attach>
- <appendAssemblyId>false</appendAssemblyId>
- <updateOnly>true</updateOnly>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>repackage</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <quiet>true</quiet>
- <verbose>false</verbose>
- <useStandardDocletOptions>false</useStandardDocletOptions>
- </configuration>
- <executions>
- <execution>
- <id>aggregate</id>
- <phase>site</phase>
- <goals>
- <goal>aggregate</goal>
- </goals>
- </execution>
- <execution>
- <id>attach-javadoc</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>com.spotify</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <configuration>
- <serverId>${onap.nexus.dockerregistry.daily}</serverId>
- <imageName>${onap.nexus.dockerregistry.daily}/${docker.image.name}</imageName>
- <imageTags>
- <imageTag>${project.version}-${maven.build.timestamp}Z</imageTag>
- <imageTag>${project.version}</imageTag>
- <imageTag>latest</imageTag>
- </imageTags>
- <baseImage>openjdk:11-jre-slim</baseImage>
- <user>vescollector</user>
- <env>
- <HOSTALIASES>/etc/host.aliases</HOSTALIASES>
- </env>
- <workdir>/opt/app/VESCollector</workdir>
- <resources>
- <resource>
- <targetPath>.</targetPath>
- <directory>${project.build.directory}/${project.artifactId}-${project.version}</directory>
- </resource>
- </resources>
- <runs>
- <run>useradd -r -U vescollector</run>
- <run>chown -R vescollector:vescollector /opt/app</run>
- <run>mkdir /opt/app/VESCollector/logs</run>
- <run>chown -R vescollector:vescollector /opt/app/VESCollector/logs</run>
- <run>chown -R vescollector:vescollector /opt/app/VESCollector/etc</run>
- <!-- Maven is loosing file permissions during artifacts copy -->
- <run>chmod +x bin/*.sh</run>
- <run>
- <![CDATA[apt-get update && apt-get install -y --no-install-recommends procps && apt-get install -y less && apt-get install -y vim && apt-get install -y curl && apt-get clean all]]></run>
- </runs>
- <exposes>
- <expose>8080</expose>
- <expose>8443</expose>
- </exposes>
- <cmd>bin/docker-entry.sh</cmd>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <profiles>
- <profile>
- <id>buildForPerfTests</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <dependencies>
- <!-- Libraries related with performance tests-->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-actuator</artifactId>
- <version>${spring.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-core</artifactId>
- <version>${micrometer.version}</version>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>with-system-proxy</id>
- <build>
- <plugins>
- <plugin>
- <groupId>com.spotify</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <configuration>
- <buildArgs>
- <http_proxy>${env.http_proxy}</http_proxy>
- </buildArgs>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
- <reporting>
- <plugins>
- <plugin>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- <reportSets>
- <reportSet>
- <reports>
- <report>dependencies</report>
- <report>license</report>
- </reports>
- </reportSet>
- </reportSets>
- </plugin>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <failOnError>false</failOnError>
- <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
- <docletArtifact>
- <groupId>org.umlgraph</groupId>
- <artifactId>umlgraph</artifactId>
- <version>5.6</version>
- </docletArtifact>
- <additionalparam>-views</additionalparam>
- <useStandardDocletOptions>true</useStandardDocletOptions>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <!-- Import dependency management from Spring Boot -->
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-dependencies</artifactId>
- <version>${spring.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
- <dependencies>
- <!-- JSON RELATED -->
- <dependency>
- <groupId>com.networknt</groupId>
- <artifactId>json-schema-validator</artifactId>
- <version>${json-schema-validator.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>${gson.version}</version>
- </dependency>
- <dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- <version>${json.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>${guava.version}</version>
- </dependency>
- <!-- REST API RELATED -->
- <dependency>
- <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
- <artifactId>dmaap-client</artifactId>
- <version>${dmaap-client.version}</version>
- <exclusions>
- <exclusion>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>io.projectreactor</groupId>
- <artifactId>reactor-test</artifactId>
- <version>${reactor-test.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.testcontainers</groupId>
- <artifactId>testcontainers</artifactId>
- <version>${testcontainers.version}</version>
- </dependency>
- <dependency>
- <groupId>org.testcontainers</groupId>
- <artifactId>junit-jupiter</artifactId>
- <version>${junit-jupiter.version}</version>
- </dependency>
- <dependency>
- <groupId>com.mashape.unirest</groupId>
- <artifactId>unirest-java</artifactId>
- <version>${unirest-java.version}</version>
- </dependency>
- <!-- MISCELLANEOUS -->
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>${commons-collections.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-configuration</groupId>
- <artifactId>commons-configuration</artifactId>
- <version>${commons-configuration.version}</version>
- </dependency>
- <dependency>
- <groupId>io.vavr</groupId>
- <artifactId>vavr</artifactId>
- <version>${vavr.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-log4j2</artifactId>
- <version>${spring-boot-starter-log4j2.version}</version>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger2</artifactId>
- <version>${springfox-swagger2.version}</version>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger-ui</artifactId>
- <version>${springfox-swagger2.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.mock-server</groupId>
- <artifactId>mockserver-junit-jupiter</artifactId>
- <version>${mock-server.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj-core.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <version>${spring-boot-starter-test.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>com.vaadin.external.google</groupId>
- <artifactId>android-json</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.onap.dcaegen2.services.sdk.security.crypt</groupId>
- <artifactId>crypt-password</artifactId>
- <classifier>slim</classifier>
- <version>${sdk.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.dcaegen2.services.sdk</groupId>
- <artifactId>dcaegen2-services-sdk-services-external-schema-manager</artifactId>
- <version>${sdk.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-crypto</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.dcaegen2.services.sdk.standardization</groupId>
- <artifactId>api-custom-header</artifactId>
- <version>${sdk.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
- <artifactId>cbs-client</artifactId>
- <version>${sdk.version}</version>
- </dependency>
- </dependencies>
- <repositories>
- <repository>
- <id>external-repository</id>
- <url>https://oss.sonatype.org/content/repositories</url>
- </repository>
- </repositories>
- <pluginRepositories>
- <!-- Black Duck plugin dependencies -->
- <pluginRepository>
- <id>JCenter</id>
- <name>JCenter Repository</name>
- <url>http://jcenter.bintray.com</url>
- </pluginRepository>
- <pluginRepository>
- <id>Restlet</id>
- <name>Restlet Repository</name>
- <url>http://maven.restlet.com</url>
- </pluginRepository>
- </pluginRepositories>
-</project>
+<?xml version="1.0"?>
+<!--
+ ================================================================================
+ Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ Copyright (c) 2020-2021 Nokia. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ use this file except in compliance with the License. You may obtain a copy
+ of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
+ by applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ OF ANY KIND, either express or implied. See the License for the specific
+ language governing permissions and limitations under the License.
+ ============LICENSE_END=========================================================
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.oparent</groupId>
+ <artifactId>oparent</artifactId>
+ <version>3.2.0</version>
+ <relativePath/>
+ </parent>
+ <groupId>org.onap.dcaegen2.collectors.ves</groupId>
+ <artifactId>VESCollector</artifactId>
+ <version>1.10.1-SNAPSHOT</version>
+ <name>dcaegen2-collectors-ves</name>
+ <description>VESCollector</description>
+ <properties>
+ <!-- PROJECT SETTINGS -->
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <java.version>11</java.version>
+ <docker.image.name>onap/org.onap.dcaegen2.collectors.ves.vescollector</docker.image.name>
+ <!-- TEST SETTINGS -->
+ <surefire.redirectTestOutputToFile>true</surefire.redirectTestOutputToFile>
+ <!-- PLUGIN SETTINGS -->
+ <dependency.locations.enabled>false</dependency.locations.enabled>
+ <!-- NEXUS RELATED SETTINGS -->
+ <nexusproxy>https://nexus.onap.org</nexusproxy>
+ <snapshots.path>content/repositories/snapshots/</snapshots.path>
+ <releases.path>content/repositories/releases/</releases.path>
+ <site.path>content/sites/site/org/onap/dcaegen2/collectors/ves/${project.artifactId}/${project.version}</site.path>
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
+ <onap.nexus.dockerregistry.daily>nexus3.onap.org:10003</onap.nexus.dockerregistry.daily>
+ <maven.compiler.target>${java.version}</maven.compiler.target>
+ <maven.compiler.source>${java.version}</maven.compiler.source>
+ <sonar.coverage.jacoco.xmlReportPaths>
+ ${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml
+ </sonar.coverage.jacoco.xmlReportPaths>
+ <!-- DEPENDENCY RELATED SETTINGS -->
+ <micrometer.version>1.6.5</micrometer.version>
+ <spring.version>2.4.3</spring.version>
+ <maven-assembly-plugin.version>3.1.0</maven-assembly-plugin.version>
+ <maven-javadoc-plugin.version>3.0.1</maven-javadoc-plugin.version>
+ <maven-project-info-reports-plugin.version>2.9</maven-project-info-reports-plugin.version>
+ <maven-surefire-plugin.version>3.0.0-M1</maven-surefire-plugin.version>
+ <docker-maven-plugin.version>1.2.0</docker-maven-plugin.version>
+ <json-simple.version>1.1.1</json-simple.version>
+ <json-schema-validator.version>1.0.49</json-schema-validator.version>
+ <gson.version>2.8.6</gson.version>
+ <json.version>20210307</json.version>
+ <unirest-java.version>1.4.9</unirest-java.version>
+ <commons-collections.version>3.2.2</commons-collections.version>
+ <commons-configuration.version>1.10</commons-configuration.version>
+ <vavr.version>0.10.3</vavr.version>
+ <spring-boot-starter-log4j2.version>2.4.3</spring-boot-starter-log4j2.version>
+ <springfox-swagger2.version>3.0.0</springfox-swagger2.version>
+ <assertj-core.version>3.19.0</assertj-core.version>
+ <spring-boot-starter-test.version>2.2.13.RELEASE</spring-boot-starter-test.version>
+ <sdk.version>1.8.7</sdk.version>
+ <guava.version>30.1-jre</guava.version>
+ <mock-server.version>5.11.1</mock-server.version>
+ <reactor-test.version>3.4.0</reactor-test.version>
+ <testcontainers.version>1.15.1</testcontainers.version>
+ <junit-jupiter.version>1.15.1</junit-jupiter.version>
+ </properties>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>${maven-assembly-plugin.version}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>${maven-javadoc-plugin.version}</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>${maven-project-info-reports-plugin.version}</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${maven-surefire-plugin.version}</version>
+ <configuration>
+ <environmentVariables>
+ <TESTCONTAINERS_RYUK_DISABLED>true</TESTCONTAINERS_RYUK_DISABLED>
+ </environmentVariables>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.spotify</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>${docker-maven-plugin.version}</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/dep.xml</descriptor>
+ </descriptors>
+ <attach>false</attach>
+ <appendAssemblyId>false</appendAssemblyId>
+ <updateOnly>true</updateOnly>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <quiet>true</quiet>
+ <verbose>false</verbose>
+ <useStandardDocletOptions>false</useStandardDocletOptions>
+ </configuration>
+ <executions>
+ <execution>
+ <id>aggregate</id>
+ <phase>site</phase>
+ <goals>
+ <goal>aggregate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>attach-javadoc</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>com.spotify</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <configuration>
+ <serverId>${onap.nexus.dockerregistry.daily}</serverId>
+ <imageName>${onap.nexus.dockerregistry.daily}/${docker.image.name}</imageName>
+ <imageTags>
+ <imageTag>${project.version}-${maven.build.timestamp}Z</imageTag>
+ <imageTag>${project.version}</imageTag>
+ <imageTag>latest</imageTag>
+ </imageTags>
+ <baseImage>openjdk:11-jre-slim</baseImage>
+ <user>vescollector</user>
+ <env>
+ <HOSTALIASES>/etc/host.aliases</HOSTALIASES>
+ </env>
+ <workdir>/opt/app/VESCollector</workdir>
+ <resources>
+ <resource>
+ <targetPath>.</targetPath>
+ <directory>${project.build.directory}/${project.artifactId}-${project.version}</directory>
+ </resource>
+ </resources>
+ <runs>
+ <run>useradd -r -U vescollector</run>
+ <run>chown -R vescollector:vescollector /opt/app</run>
+ <run>mkdir /opt/app/VESCollector/logs</run>
+ <run>chown -R vescollector:vescollector /opt/app/VESCollector/logs</run>
+ <run>chown -R vescollector:vescollector /opt/app/VESCollector/etc</run>
+ <!-- Maven is loosing file permissions during artifacts copy -->
+ <run>chmod +x bin/*.sh</run>
+ <run>
+ <![CDATA[apt-get update && apt-get install -y --no-install-recommends procps && apt-get install -y less && apt-get install -y vim && apt-get install -y curl && apt-get clean all]]></run>
+ </runs>
+ <exposes>
+ <expose>8080</expose>
+ <expose>8443</expose>
+ </exposes>
+ <cmd>bin/docker-entry.sh</cmd>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>buildForPerfTests</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <dependencies>
+ <!-- Libraries related with performance tests-->
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ <version>${spring.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-core</artifactId>
+ <version>${micrometer.version}</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>with-system-proxy</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.spotify</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <configuration>
+ <buildArgs>
+ <http_proxy>${env.http_proxy}</http_proxy>
+ </buildArgs>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>dependencies</report>
+ <report>license</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <failOnError>false</failOnError>
+ <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
+ <docletArtifact>
+ <groupId>org.umlgraph</groupId>
+ <artifactId>umlgraph</artifactId>
+ <version>5.6</version>
+ </docletArtifact>
+ <additionalparam>-views</additionalparam>
+ <useStandardDocletOptions>true</useStandardDocletOptions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <!-- Import dependency management from Spring Boot -->
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${spring.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <!-- JSON RELATED -->
+ <dependency>
+ <groupId>com.networknt</groupId>
+ <artifactId>json-schema-validator</artifactId>
+ <version>${json-schema-validator.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>${gson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ <version>${json.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>${guava.version}</version>
+ </dependency>
+ <!-- REST API RELATED -->
+ <dependency>
+ <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
+ <artifactId>dmaap-client</artifactId>
+ <version>${sdk.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>io.projectreactor</groupId>
+ <artifactId>reactor-test</artifactId>
+ <version>${reactor-test.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testcontainers</groupId>
+ <artifactId>testcontainers</artifactId>
+ <version>${testcontainers.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.testcontainers</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <version>${junit-jupiter.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.mashape.unirest</groupId>
+ <artifactId>unirest-java</artifactId>
+ <version>${unirest-java.version}</version>
+ </dependency>
+ <!-- MISCELLANEOUS -->
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>${commons-collections.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ <version>${commons-configuration.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.vavr</groupId>
+ <artifactId>vavr</artifactId>
+ <version>${vavr.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-log4j2</artifactId>
+ <version>${spring-boot-starter-log4j2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger2</artifactId>
+ <version>${springfox-swagger2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger-ui</artifactId>
+ <version>${springfox-swagger2.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mock-server</groupId>
+ <artifactId>mockserver-junit-jupiter</artifactId>
+ <version>${mock-server.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <version>${assertj-core.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <version>${spring-boot-starter-test.version}</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>com.vaadin.external.google</groupId>
+ <artifactId>android-json</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.dcaegen2.services.sdk.security.crypt</groupId>
+ <artifactId>crypt-password</artifactId>
+ <classifier>slim</classifier>
+ <version>${sdk.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.dcaegen2.services.sdk</groupId>
+ <artifactId>dcaegen2-services-sdk-services-external-schema-manager</artifactId>
+ <version>${sdk.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-crypto</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.dcaegen2.services.sdk.standardization</groupId>
+ <artifactId>api-custom-header</artifactId>
+ <version>${sdk.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
+ <artifactId>cbs-client</artifactId>
+ <version>${sdk.version}</version>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>external-repository</id>
+ <url>https://oss.sonatype.org/content/repositories</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <!-- Black Duck plugin dependencies -->
+ <pluginRepository>
+ <id>JCenter</id>
+ <name>JCenter Repository</name>
+ <url>http://jcenter.bintray.com</url>
+ </pluginRepository>
+ <pluginRepository>
+ <id>Restlet</id>
+ <name>Restlet Repository</name>
+ <url>http://maven.restlet.com</url>
+ </pluginRepository>
+ </pluginRepositories>
+</project>
diff --git a/src/main/java/org/onap/dcae/ApplicationConfigurationListener.java b/src/main/java/org/onap/dcae/ApplicationConfigurationListener.java
index b86bc1ec..c847cddc 100644
--- a/src/main/java/org/onap/dcae/ApplicationConfigurationListener.java
+++ b/src/main/java/org/onap/dcae/ApplicationConfigurationListener.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* VES Collector
* ================================================================================
- * Copyright (C) 2020 Nokia. All rights reserved.
+ * Copyright (C) 2020-2021 Nokia. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ import reactor.core.Disposable;
import java.time.Duration;
/**
- * ApplicationConfigurationListener is used to listen at notifications with configuration updates send from Consul.
+ * ApplicationConfigurationListener is used to listen at notifications with configuration updates.
*/
public class ApplicationConfigurationListener implements Runnable {
@@ -42,7 +42,7 @@ public class ApplicationConfigurationListener implements Runnable {
/**
* Constructor
* @param interval defines period of time when notification can come
- * @param configurationHandler handles notifications send by Consul
+ * @param configurationHandler handles notifications
*/
public ApplicationConfigurationListener(Duration interval, ConfigurationHandler configurationHandler) {
this.interval = interval;
@@ -50,7 +50,7 @@ public class ApplicationConfigurationListener implements Runnable {
}
/**
- * Reload listener to start listening for Consul notifications with defined interval.
+ * Reload listener to start listening for configurations notifications with defined interval.
* @param interval defines period of time when notification can come
*/
public synchronized void reload(Duration interval) {
@@ -64,23 +64,23 @@ public class ApplicationConfigurationListener implements Runnable {
}
/**
- * Start listening for Consul notification.
+ * Start listening for configurations notification.
*/
@Override
public void run() {
- Disposable consulListener = null;
+ Disposable configListener = null;
do {
try {
- consulListener = listenForConfigurationUpdates();
+ configListener = listenForConfigurationUpdates();
synchronized (this) {
- log.info("Switch to configuration handler thread. Active waiting for configuration from Consul.");
+ log.info("Switch to configuration handler thread. Active waiting for configuration.");
this.wait();
}
} catch (Exception e) {
- log.error("Unexpected error occurred during handling data from Consul.", e);
+ log.error("Unexpected error occurred during handling data.", e);
terminate();
} finally {
- stopListeningForConfigurationUpdates(consulListener);
+ stopListeningForConfigurationUpdates(configListener);
}
} while (!this.terminate);
}
@@ -95,7 +95,7 @@ public class ApplicationConfigurationListener implements Runnable {
/**
* Release resources when there is a need to stop listener
- * @param consulListener Handler to Consul listener
+ * @param consulListener Handler to configurations listener
*/
void stopListeningForConfigurationUpdates(Disposable consulListener) {
if (consulListener != null) {
diff --git a/src/main/java/org/onap/dcae/VesApplication.java b/src/main/java/org/onap/dcae/VesApplication.java
index f8cd74ad..75fd4594 100644
--- a/src/main/java/org/onap/dcae/VesApplication.java
+++ b/src/main/java/org/onap/dcae/VesApplication.java
@@ -3,7 +3,7 @@
* PROJECT
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2020 Nokia. All rights reserved.
+ * Copyright (C) 2020-2021 Nokia. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,7 +66,7 @@ public class VesApplication {
applicationLock.lock();
try {
startApplication(args);
- startListeningForApplicationConfigurationStoredInConsul();
+ startListeningForApplicationConfiguration();
} finally {
applicationLock.unlock();
}
@@ -110,7 +110,7 @@ public class VesApplication {
context = SpringApplication.run(VesApplication.class);
}
- private static void startListeningForApplicationConfigurationStoredInConsul() {
+ private static void startListeningForApplicationConfiguration() {
ConfigurationHandler cbsHandler = new ConfigurationHandler(new CbsClientConfigurationProvider(), configUpdater);
ApplicationConfigurationListener applicationConfigProvider = new ApplicationConfigurationListener(Duration.ofMinutes(DEFAULT_CONFIGURATION_FETCH_PERIOD), cbsHandler);
diff --git a/src/main/java/org/onap/dcae/configuration/ConfigurationHandler.java b/src/main/java/org/onap/dcae/configuration/ConfigurationHandler.java
index ebdf0474..aa3561b6 100644
--- a/src/main/java/org/onap/dcae/configuration/ConfigurationHandler.java
+++ b/src/main/java/org/onap/dcae/configuration/ConfigurationHandler.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* VES Collector
* ================================================================================
- * Copyright (C) 2020 Nokia. All rights reserved.s
+ * Copyright (C) 2020-2021 Nokia. All rights reserved.s
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,8 +37,8 @@ import reactor.core.publisher.Mono;
import java.time.Duration;
/**
- * ConfigurationHandler is responsible for receiving configuration updates from Consul.
- * Any change made in the Consul will be reported as a notification.
+ * ConfigurationHandler is responsible for receiving configuration updates from config file or Consul (if config file doesn't exist).
+ * Any change made in the configuration will be reported as a notification.
*/
public class ConfigurationHandler {
@@ -61,12 +61,12 @@ public class ConfigurationHandler {
/**
* Start listen for application configuration notifications with configuration changes
* @param interval defines period of time when notification can come
- * @return {@link Disposable} handler to close Consul listener at the end
+ * @return {@link Disposable} handler to close configuration listener at the end
*/
public Disposable startListen(Duration interval) {
- log.info("Start listening for configuration from Consul ...");
- log.info(String.format("Consul configuration will be fetched in %s period.", interval));
+ log.info("Start listening for configuration ...");
+ log.info(String.format("Configuration will be fetched in %s period.", interval));
// Polling properties
final Duration initialDelay = Duration.ofSeconds(5);
@@ -78,7 +78,7 @@ public class ConfigurationHandler {
return createCbsClient(cbsClientConfiguration)
.flatMapMany(cbsClient -> cbsClient.updates(request, initialDelay, period))
.subscribe(
- this::handleConfigurationFromConsul,
+ this::handleConfiguration,
this::handleError
);
}
@@ -87,8 +87,8 @@ public class ConfigurationHandler {
return CbsClientFactory.createCbsClient(cbsClientConfiguration);
}
- void handleConfigurationFromConsul(JsonObject jsonObject) {
- log.info("Configuration update from Consul {}", jsonObject);
+ void handleConfiguration(JsonObject jsonObject) {
+ log.info("Configuration update {}", jsonObject);
if(jsonObject.has(CONFIG_DICT)) {
JsonObject config = jsonObject.getAsJsonObject(CONFIG_DICT);
JSONObject jObject = new JSONObject(config.toString());
@@ -99,7 +99,7 @@ public class ConfigurationHandler {
}
private void handleError(Throwable throwable) {
- log.error("Unexpected error occurred during fetching configuration from Consul", throwable);
+ log.error("Unexpected error occurred during fetching configuration", throwable);
}
private CbsRequest createCbsRequest() {
diff --git a/src/test/java/org/onap/dcae/ApplicationConfigurationListenerTest.java b/src/test/java/org/onap/dcae/ApplicationConfigurationListenerTest.java
index 49132f1e..1aa54257 100644
--- a/src/test/java/org/onap/dcae/ApplicationConfigurationListenerTest.java
+++ b/src/test/java/org/onap/dcae/ApplicationConfigurationListenerTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* VES Collector
* ================================================================================
- * Copyright (C) 2020 Nokia. All rights reserved.
+ * Copyright (C) 2020-2021 Nokia. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,7 +43,7 @@ public class ApplicationConfigurationListenerTest {
private ApplicationConfigurationListener applicationConfigurationListener;
@Test
- public void shouldStopJobAndCloseConnectionWhenErrorOccurredDuringListenAtConsulChange() {
+ public void shouldStopJobAndCloseConnectionWhenErrorOccurredDuringListenAtConfigChange() {
// given
Mockito.doThrow(new RuntimeException("Simulate exception")).when(configurationHandler).startListen(any());
diff --git a/src/test/java/org/onap/dcae/configuration/CbsConfigurationHandlerTest.java b/src/test/java/org/onap/dcae/configuration/CbsConfigurationHandlerTest.java
index 7b1af1de..8ad1dd0a 100644
--- a/src/test/java/org/onap/dcae/configuration/CbsConfigurationHandlerTest.java
+++ b/src/test/java/org/onap/dcae/configuration/CbsConfigurationHandlerTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* VES Collector
* ================================================================================
- * Copyright (C) 2020 Nokia. All rights reserved.s
+ * Copyright (C) 2020-2021 Nokia. All rights reserved.s
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,9 +41,9 @@ import java.time.Duration;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class CbsConfigurationHandlerTest {
@@ -67,9 +67,8 @@ public class CbsConfigurationHandlerTest {
@Test
public void shouldCreateCbsConfigurationHandler() {
// given
-
- when(cbsConfigurationHandler.createCbsClient(cbsClientConfiguration)).thenReturn(cbsClient);
- when(cbsClientConfigurationProvider.get()).thenReturn(cbsClientConfiguration);
+ doReturn(cbsClient).when(cbsConfigurationHandler).createCbsClient(cbsClientConfiguration);
+ doReturn(cbsClientConfiguration).when(cbsClientConfigurationProvider).get();
// when
final Disposable handler = cbsConfigurationHandler.startListen(Duration.ofMinutes(5));
@@ -81,10 +80,10 @@ public class CbsConfigurationHandlerTest {
@Test
public void shouldUpdateAppConfigurationWhenConfigurationIsValid() {
// given
- final JsonObject configuration = createConsulConfiguration(VES_CONSUL_CONFIG);
+ final JsonObject configuration = createConfiguration(VES_CONSUL_CONFIG);
// when
- this.cbsConfigurationHandler.handleConfigurationFromConsul(configuration);
+ this.cbsConfigurationHandler.handleConfiguration(configuration);
// then
final ArgumentCaptor<Option<JSONObject>> acConfiguration = ArgumentCaptor.forClass(Option.class);
@@ -93,12 +92,12 @@ public class CbsConfigurationHandlerTest {
}
@Test
- public void shouldReportAnErrorWhenConsulReturnsEmptyConfiguration() {
+ public void shouldReportAnErrorWhenConfigHandlerReturnsEmptyConfiguration() {
// given
- final JsonObject configuration = createConsulConfiguration("{}");
+ final JsonObject configuration = createConfiguration("{}");
// when
- assertThatThrownBy(() -> this.cbsConfigurationHandler.handleConfigurationFromConsul(configuration))
+ assertThatThrownBy(() -> this.cbsConfigurationHandler.handleConfiguration(configuration))
.isInstanceOf(IllegalArgumentException.class).hasMessageContaining(String.format("Invalid application configuration: %s ", "{}"));
// then
@@ -109,8 +108,8 @@ public class CbsConfigurationHandlerTest {
return new JSONObject(vesConfig).toString();
}
- private JsonObject createConsulConfiguration(String vesConsulConfig) {
- return new JsonParser().parse(vesConsulConfig).getAsJsonObject();
+ private JsonObject createConfiguration(String vesConfig) {
+ return new JsonParser().parse(vesConfig).getAsJsonObject();
}
diff --git a/version.properties b/version.properties
index e9e55960..81b72c03 100644
--- a/version.properties
+++ b/version.properties
@@ -1,6 +1,6 @@
major=1
minor=10
-patch=0
+patch=1
base_version=${major}.${minor}.${patch}
release_version=${base_version}
snapshot_version=${base_version}-SNAPSHOT