Update DCAE SDK library 89/123489/6
authorPiotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com>
Tue, 24 Aug 2021 09:20:54 +0000 (11:20 +0200)
committerPiotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com>
Tue, 24 Aug 2021 13:06:14 +0000 (15:06 +0200)
Issue-ID: DCAEGEN2-2719
Signed-off-by: Piotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com>
Change-Id: If4086ddf60747b4d87c5067a68df748a7dc2c689

Changelog.md
README.md
pom.xml
src/main/java/org/onap/dcae/ApplicationConfigurationListener.java
src/main/java/org/onap/dcae/VesApplication.java
src/main/java/org/onap/dcae/configuration/ConfigurationHandler.java
src/test/java/org/onap/dcae/ApplicationConfigurationListenerTest.java
src/test/java/org/onap/dcae/configuration/CbsConfigurationHandlerTest.java
version.properties

index 6e107d7..1a0c7d2 100644 (file)
@@ -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
index 407fc7a..94571b1 100644 (file)
--- 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 b0fe678..ac8601f 100644 (file)
--- a/pom.xml
+++ b/pom.xml
-<?xml version="1.0"?>\r
-<!--\r
-    ================================================================================\r
-       Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.\r
-       Copyright (c) 2020-2021 Nokia. All rights reserved.\r
-       ================================================================================\r
-       Licensed under the Apache License, Version 2.0 (the "License"); you may not\r
-       use this file except in compliance with the License. You may obtain a copy\r
-       of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required\r
-       by applicable law or agreed to in writing, software distributed under the\r
-       License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS\r
-       OF ANY KIND, either express or implied. See the License for the specific\r
-       language governing permissions and limitations under the License.\r
-       ============LICENSE_END=========================================================\r
--->\r
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
-  <modelVersion>4.0.0</modelVersion>\r
-  <parent>\r
-    <groupId>org.onap.oparent</groupId>\r
-    <artifactId>oparent</artifactId>\r
-    <version>3.2.0</version>\r
-    <relativePath/>\r
-  </parent>\r
-  <groupId>org.onap.dcaegen2.collectors.ves</groupId>\r
-  <artifactId>VESCollector</artifactId>\r
-  <version>1.10.0-SNAPSHOT</version>\r
-  <name>dcaegen2-collectors-ves</name>\r
-  <description>VESCollector</description>\r
-  <properties>\r
-    <!-- PROJECT SETTINGS -->\r
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\r
-    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>\r
-    <java.version>11</java.version>\r
-    <docker.image.name>onap/org.onap.dcaegen2.collectors.ves.vescollector</docker.image.name>\r
-    <!-- TEST SETTINGS -->\r
-    <surefire.redirectTestOutputToFile>true</surefire.redirectTestOutputToFile>\r
-    <!-- PLUGIN SETTINGS -->\r
-    <dependency.locations.enabled>false</dependency.locations.enabled>\r
-    <!-- NEXUS RELATED SETTINGS -->\r
-    <nexusproxy>https://nexus.onap.org</nexusproxy>\r
-    <snapshots.path>content/repositories/snapshots/</snapshots.path>\r
-    <releases.path>content/repositories/releases/</releases.path>\r
-    <site.path>content/sites/site/org/onap/dcaegen2/collectors/ves/${project.artifactId}/${project.version}</site.path>\r
-    <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>\r
-    <onap.nexus.dockerregistry.daily>nexus3.onap.org:10003</onap.nexus.dockerregistry.daily>\r
-    <maven.compiler.target>${java.version}</maven.compiler.target>\r
-    <maven.compiler.source>${java.version}</maven.compiler.source>\r
-    <sonar.coverage.jacoco.xmlReportPaths>\r
-       ${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml\r
-    </sonar.coverage.jacoco.xmlReportPaths>\r
-    <!-- DEPENDENCY RELATED SETTINGS -->\r
-    <micrometer.version>1.6.5</micrometer.version>\r
-    <spring.version>2.4.3</spring.version>\r
-    <maven-assembly-plugin.version>3.1.0</maven-assembly-plugin.version>\r
-    <maven-javadoc-plugin.version>3.0.1</maven-javadoc-plugin.version>\r
-    <maven-project-info-reports-plugin.version>2.9</maven-project-info-reports-plugin.version>\r
-    <maven-surefire-plugin.version>3.0.0-M1</maven-surefire-plugin.version>\r
-    <docker-maven-plugin.version>1.2.0</docker-maven-plugin.version>\r
-    <json-simple.version>1.1.1</json-simple.version>\r
-    <json-schema-validator.version>1.0.49</json-schema-validator.version>\r
-    <gson.version>2.8.6</gson.version>\r
-    <json.version>20210307</json.version>\r
-    <unirest-java.version>1.4.9</unirest-java.version>\r
-    <commons-collections.version>3.2.2</commons-collections.version>\r
-    <commons-configuration.version>1.10</commons-configuration.version>\r
-    <vavr.version>0.10.3</vavr.version>\r
-    <spring-boot-starter-log4j2.version>2.4.3</spring-boot-starter-log4j2.version>\r
-    <springfox-swagger2.version>3.0.0</springfox-swagger2.version>\r
-    <assertj-core.version>3.19.0</assertj-core.version>\r
-    <spring-boot-starter-test.version>2.2.13.RELEASE</spring-boot-starter-test.version>\r
-    <sdk.version>1.8.0</sdk.version>\r
-    <guava.version>30.1-jre</guava.version>\r
-    <mock-server.version>5.11.1</mock-server.version>\r
-    <dmaap-client.version>1.8.6</dmaap-client.version>\r
-    <reactor-test.version>3.4.0</reactor-test.version>\r
-    <testcontainers.version>1.15.1</testcontainers.version>\r
-    <junit-jupiter.version>1.15.1</junit-jupiter.version>\r
-  </properties>\r
-  <build>\r
-    <pluginManagement>\r
-      <plugins>\r
-        <plugin>\r
-          <groupId>org.springframework.boot</groupId>\r
-          <artifactId>spring-boot-maven-plugin</artifactId>\r
-        </plugin>\r
-        <plugin>\r
-          <artifactId>maven-assembly-plugin</artifactId>\r
-          <version>${maven-assembly-plugin.version}</version>\r
-        </plugin>\r
-        <plugin>\r
-          <artifactId>maven-javadoc-plugin</artifactId>\r
-          <version>${maven-javadoc-plugin.version}</version>\r
-        </plugin>\r
-        <plugin>\r
-          <artifactId>maven-project-info-reports-plugin</artifactId>\r
-          <version>${maven-project-info-reports-plugin.version}</version>\r
-        </plugin>\r
-        <plugin>\r
-          <groupId>org.apache.maven.plugins</groupId>\r
-          <artifactId>maven-surefire-plugin</artifactId>\r
-          <version>${maven-surefire-plugin.version}</version>\r
-          <configuration>\r
-            <environmentVariables>\r
-              <TESTCONTAINERS_RYUK_DISABLED>true</TESTCONTAINERS_RYUK_DISABLED>\r
-            </environmentVariables>\r
-          </configuration>\r
-        </plugin>\r
-        <plugin>\r
-          <groupId>com.spotify</groupId>\r
-          <artifactId>docker-maven-plugin</artifactId>\r
-          <version>${docker-maven-plugin.version}</version>\r
-        </plugin>\r
-        <plugin>\r
-          <groupId>org.apache.maven.plugins</groupId>\r
-          <artifactId>maven-enforcer-plugin</artifactId>\r
-          <configuration>\r
-            <skip>true</skip>\r
-          </configuration>\r
-        </plugin>\r
-      </plugins>\r
-    </pluginManagement>\r
-    <plugins>\r
-      <plugin>\r
-        <artifactId>maven-assembly-plugin</artifactId>\r
-        <configuration>\r
-          <descriptors>\r
-            <descriptor>src/assembly/dep.xml</descriptor>\r
-          </descriptors>\r
-          <attach>false</attach>\r
-          <appendAssemblyId>false</appendAssemblyId>\r
-          <updateOnly>true</updateOnly>\r
-        </configuration>\r
-        <executions>\r
-          <execution>\r
-            <id>make-assembly</id>\r
-            <phase>package</phase>\r
-            <goals>\r
-              <goal>single</goal>\r
-            </goals>\r
-          </execution>\r
-        </executions>\r
-      </plugin>\r
-      <plugin>\r
-        <groupId>org.springframework.boot</groupId>\r
-        <artifactId>spring-boot-maven-plugin</artifactId>\r
-        <executions>\r
-          <execution>\r
-            <goals>\r
-              <goal>repackage</goal>\r
-            </goals>\r
-          </execution>\r
-        </executions>\r
-      </plugin>\r
-      <plugin>\r
-        <artifactId>maven-javadoc-plugin</artifactId>\r
-        <configuration>\r
-          <quiet>true</quiet>\r
-          <verbose>false</verbose>\r
-          <useStandardDocletOptions>false</useStandardDocletOptions>\r
-        </configuration>\r
-        <executions>\r
-          <execution>\r
-            <id>aggregate</id>\r
-            <phase>site</phase>\r
-            <goals>\r
-              <goal>aggregate</goal>\r
-            </goals>\r
-          </execution>\r
-          <execution>\r
-            <id>attach-javadoc</id>\r
-            <goals>\r
-              <goal>jar</goal>\r
-            </goals>\r
-          </execution>\r
-        </executions>\r
-      </plugin>\r
-      <plugin>\r
-        <groupId>com.spotify</groupId>\r
-        <artifactId>docker-maven-plugin</artifactId>\r
-        <configuration>\r
-          <serverId>${onap.nexus.dockerregistry.daily}</serverId>\r
-          <imageName>${onap.nexus.dockerregistry.daily}/${docker.image.name}</imageName>\r
-          <imageTags>\r
-            <imageTag>${project.version}-${maven.build.timestamp}Z</imageTag>\r
-            <imageTag>${project.version}</imageTag>\r
-            <imageTag>latest</imageTag>\r
-          </imageTags>\r
-          <baseImage>openjdk:11-jre-slim</baseImage>\r
-          <user>vescollector</user>\r
-          <env>\r
-            <HOSTALIASES>/etc/host.aliases</HOSTALIASES>\r
-          </env>\r
-          <workdir>/opt/app/VESCollector</workdir>\r
-          <resources>\r
-            <resource>\r
-              <targetPath>.</targetPath>\r
-              <directory>${project.build.directory}/${project.artifactId}-${project.version}</directory>\r
-            </resource>\r
-          </resources>\r
-          <runs>\r
-            <run>useradd -r -U vescollector</run>\r
-            <run>chown -R vescollector:vescollector /opt/app</run>\r
-            <run>mkdir /opt/app/VESCollector/logs</run>\r
-            <run>chown -R vescollector:vescollector /opt/app/VESCollector/logs</run>\r
-            <run>chown -R vescollector:vescollector /opt/app/VESCollector/etc</run>\r
-            <!-- Maven is loosing file permissions during artifacts copy -->\r
-            <run>chmod +x bin/*.sh</run>\r
-            <run>\r
-              <![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>\r
-          </runs>\r
-          <exposes>\r
-            <expose>8080</expose>\r
-            <expose>8443</expose>\r
-          </exposes>\r
-          <cmd>bin/docker-entry.sh</cmd>\r
-        </configuration>\r
-      </plugin>\r
-    </plugins>\r
-  </build>\r
-  <profiles>\r
-    <profile>\r
-      <id>buildForPerfTests</id>\r
-      <activation>\r
-        <activeByDefault>false</activeByDefault>\r
-      </activation>\r
-      <dependencies>\r
-        <!-- Libraries related with performance tests-->\r
-        <dependency>\r
-          <groupId>org.springframework.boot</groupId>\r
-          <artifactId>spring-boot-starter-actuator</artifactId>\r
-          <version>${spring.version}</version>\r
-        </dependency>\r
-        <dependency>\r
-          <groupId>io.micrometer</groupId>\r
-          <artifactId>micrometer-registry-prometheus</artifactId>\r
-          <version>${micrometer.version}</version>\r
-        </dependency>\r
-        <dependency>\r
-          <groupId>io.micrometer</groupId>\r
-          <artifactId>micrometer-core</artifactId>\r
-          <version>${micrometer.version}</version>\r
-        </dependency>\r
-      </dependencies>\r
-    </profile>\r
-    <profile>\r
-      <id>with-system-proxy</id>\r
-      <build>\r
-        <plugins>\r
-          <plugin>\r
-            <groupId>com.spotify</groupId>\r
-            <artifactId>docker-maven-plugin</artifactId>\r
-            <configuration>\r
-              <buildArgs>\r
-                <http_proxy>${env.http_proxy}</http_proxy>\r
-              </buildArgs>\r
-            </configuration>\r
-          </plugin>\r
-        </plugins>\r
-      </build>\r
-    </profile>\r
-  </profiles>\r
-  <reporting>\r
-    <plugins>\r
-      <plugin>\r
-        <artifactId>maven-project-info-reports-plugin</artifactId>\r
-        <reportSets>\r
-          <reportSet>\r
-            <reports>\r
-              <report>dependencies</report>\r
-              <report>license</report>\r
-            </reports>\r
-          </reportSet>\r
-        </reportSets>\r
-      </plugin>\r
-      <plugin>\r
-        <artifactId>maven-javadoc-plugin</artifactId>\r
-        <configuration>\r
-          <failOnError>false</failOnError>\r
-          <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>\r
-          <docletArtifact>\r
-            <groupId>org.umlgraph</groupId>\r
-            <artifactId>umlgraph</artifactId>\r
-            <version>5.6</version>\r
-          </docletArtifact>\r
-          <additionalparam>-views</additionalparam>\r
-          <useStandardDocletOptions>true</useStandardDocletOptions>\r
-        </configuration>\r
-      </plugin>\r
-    </plugins>\r
-  </reporting>\r
-  <dependencyManagement>\r
-    <dependencies>\r
-      <dependency>\r
-        <!-- Import dependency management from Spring Boot -->\r
-        <groupId>org.springframework.boot</groupId>\r
-        <artifactId>spring-boot-dependencies</artifactId>\r
-        <version>${spring.version}</version>\r
-        <type>pom</type>\r
-        <scope>import</scope>\r
-      </dependency>\r
-    </dependencies>\r
-  </dependencyManagement>\r
-  <dependencies>\r
-    <!-- JSON RELATED -->\r
-    <dependency>\r
-      <groupId>com.networknt</groupId>\r
-      <artifactId>json-schema-validator</artifactId>\r
-      <version>${json-schema-validator.version}</version>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>com.fasterxml.jackson.core</groupId>\r
-          <artifactId>jackson-databind</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>com.google.code.gson</groupId>\r
-      <artifactId>gson</artifactId>\r
-      <version>${gson.version}</version>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.json</groupId>\r
-      <artifactId>json</artifactId>\r
-      <version>${json.version}</version>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>com.google.guava</groupId>\r
-      <artifactId>guava</artifactId>\r
-      <version>${guava.version}</version>\r
-    </dependency>\r
-    <!-- REST API RELATED -->\r
-    <dependency>\r
-      <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>\r
-      <artifactId>dmaap-client</artifactId>\r
-      <version>${dmaap-client.version}</version>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>ch.qos.logback</groupId>\r
-          <artifactId>logback-classic</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>io.projectreactor</groupId>\r
-      <artifactId>reactor-test</artifactId>\r
-      <version>${reactor-test.version}</version>\r
-      <scope>test</scope>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.testcontainers</groupId>\r
-      <artifactId>testcontainers</artifactId>\r
-      <version>${testcontainers.version}</version>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.testcontainers</groupId>\r
-      <artifactId>junit-jupiter</artifactId>\r
-      <version>${junit-jupiter.version}</version>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>com.mashape.unirest</groupId>\r
-      <artifactId>unirest-java</artifactId>\r
-      <version>${unirest-java.version}</version>\r
-    </dependency>\r
-    <!-- MISCELLANEOUS -->\r
-    <dependency>\r
-      <groupId>commons-collections</groupId>\r
-      <artifactId>commons-collections</artifactId>\r
-      <version>${commons-collections.version}</version>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>commons-configuration</groupId>\r
-      <artifactId>commons-configuration</artifactId>\r
-      <version>${commons-configuration.version}</version>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>io.vavr</groupId>\r
-      <artifactId>vavr</artifactId>\r
-      <version>${vavr.version}</version>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.springframework.boot</groupId>\r
-      <artifactId>spring-boot-starter-web</artifactId>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>org.springframework.boot</groupId>\r
-          <artifactId>spring-boot-starter-logging</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.springframework.boot</groupId>\r
-      <artifactId>spring-boot-starter-log4j2</artifactId>\r
-      <version>${spring-boot-starter-log4j2.version}</version>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>io.springfox</groupId>\r
-      <artifactId>springfox-swagger2</artifactId>\r
-      <version>${springfox-swagger2.version}</version>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>io.springfox</groupId>\r
-      <artifactId>springfox-swagger-ui</artifactId>\r
-      <version>${springfox-swagger2.version}</version>\r
-      <scope>compile</scope>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.mock-server</groupId>\r
-      <artifactId>mockserver-junit-jupiter</artifactId>\r
-      <version>${mock-server.version}</version>\r
-      <scope>test</scope>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.assertj</groupId>\r
-      <artifactId>assertj-core</artifactId>\r
-      <version>${assertj-core.version}</version>\r
-      <scope>test</scope>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.springframework.boot</groupId>\r
-      <artifactId>spring-boot-starter-test</artifactId>\r
-      <version>${spring-boot-starter-test.version}</version>\r
-      <scope>test</scope>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>com.vaadin.external.google</groupId>\r
-          <artifactId>android-json</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.onap.dcaegen2.services.sdk.security.crypt</groupId>\r
-      <artifactId>crypt-password</artifactId>\r
-      <classifier>slim</classifier>\r
-      <version>${sdk.version}</version>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.onap.dcaegen2.services.sdk</groupId>\r
-      <artifactId>dcaegen2-services-sdk-services-external-schema-manager</artifactId>\r
-      <version>${sdk.version}</version>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.springframework.security</groupId>\r
-      <artifactId>spring-security-crypto</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.onap.dcaegen2.services.sdk.standardization</groupId>\r
-      <artifactId>api-custom-header</artifactId>\r
-      <version>${sdk.version}</version>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>\r
-      <artifactId>cbs-client</artifactId>\r
-      <version>${sdk.version}</version>\r
-    </dependency>\r
-  </dependencies>\r
-  <repositories>\r
-    <repository>\r
-      <id>external-repository</id>\r
-      <url>https://oss.sonatype.org/content/repositories</url>\r
-    </repository>\r
-  </repositories>\r
-  <pluginRepositories>\r
-    <!-- Black Duck plugin dependencies -->\r
-    <pluginRepository>\r
-      <id>JCenter</id>\r
-      <name>JCenter Repository</name>\r
-      <url>http://jcenter.bintray.com</url>\r
-    </pluginRepository>\r
-    <pluginRepository>\r
-      <id>Restlet</id>\r
-      <name>Restlet Repository</name>\r
-      <url>http://maven.restlet.com</url>\r
-    </pluginRepository>\r
-  </pluginRepositories>\r
-</project>\r
+<?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>
index b86bc1e..c847cdd 100644 (file)
@@ -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) {
index f8cd74a..75fd459 100644 (file)
@@ -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);
 
index ebdf047..aa3561b 100644 (file)
@@ -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() {
index 49132f1..1aa5425 100644 (file)
@@ -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());
index 7b1af1d..8ad1dd0 100644 (file)
@@ -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();
     }
 
 
index e9e5596..81b72c0 100644 (file)
@@ -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