diff options
Diffstat (limited to 'common/onap-common-configuration-management/onap-configuration-management-core')
11 files changed, 144 insertions, 160 deletions
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/pom.xml b/common/onap-common-configuration-management/onap-configuration-management-core/pom.xml index c610307494..40693df779 100644 --- a/common/onap-common-configuration-management/onap-configuration-management-core/pom.xml +++ b/common/onap-common-configuration-management/onap-configuration-management-core/pom.xml @@ -1,112 +1,113 @@ -<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> +<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> - <name>onap-configuration-management-core</name> - <artifactId>onap-configuration-management-core</artifactId> + <name>onap-configuration-management-core</name> + <artifactId>onap-configuration-management-core</artifactId> - <parent> - <artifactId>onap-common-configuration-management</artifactId> - <groupId>org.onap.sdc.common</groupId> - <version>1.3.0-SNAPSHOT</version> - <relativePath>..</relativePath> - </parent> + <parent> + <artifactId>onap-common-configuration-management</artifactId> + <groupId>org.onap.sdc.common</groupId> + <version>1.3.0-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> - <dependencies> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - <version>2.5.4</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.dataformat</groupId> - <artifactId>jackson-dataformat-yaml</artifactId> - <version>${jackson.version}</version> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-configuration2</artifactId> - <version>2.1</version> - </dependency> - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <version>1.2</version> - </dependency> - <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - <version>${commons.beanutils.version}</version> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - <version>3.3.2</version> - </dependency> - <dependency> - <groupId>com.github.adejanovski</groupId> - <artifactId>cassandra-jdbc-wrapper</artifactId> - <version>3.1.0</version> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-dbcp2</artifactId> - <version>2.0</version> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-pool2</artifactId> - <version>2.4.2</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>${commons.io.version}</version> - </dependency> - <dependency> - <groupId>net.sf.corn</groupId> - <artifactId>corn-cps</artifactId> - <version>1.1.7</version> - <exclusions> - <exclusion> - <groupId>com.sun</groupId> - <artifactId>tools</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>com.virtlink.commons</groupId> - <artifactId>commons-configuration2-jackson</artifactId> - <version>0.6.1</version> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>2.7</version> - </dependency> - <dependency> - <groupId>org.onap.sdc.common</groupId> - <artifactId>onap-configuration-management-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <version>${servlet-api.version}</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-annotations</artifactId> - <version>2.8.1</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - <version>${junit.version}</version> - </dependency> + <dependencies> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>2.5.4</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.dataformat</groupId> + <artifactId>jackson-dataformat-yaml</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-configuration2</artifactId> + <version>2.1</version> + </dependency> + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>1.2</version> + </dependency> + <dependency> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + <version>${commons.beanutils.version}</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.3.2</version> + </dependency> + <dependency> + <groupId>com.github.adejanovski</groupId> + <artifactId>cassandra-jdbc-wrapper</artifactId> + <version>3.1.0</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-dbcp2</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-pool2</artifactId> + <version>2.4.2</version> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>${commons.io.version}</version> + </dependency> + <dependency> + <groupId>net.sf.corn</groupId> + <artifactId>corn-cps</artifactId> + <version>1.1.7</version> + <exclusions> + <exclusion> + <groupId>com.sun</groupId> + <artifactId>tools</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>com.virtlink.commons</groupId> + <artifactId>commons-configuration2-jackson</artifactId> + <version>0.6.1</version> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>2.7</version> + </dependency> + <dependency> + <groupId>org.onap.sdc.common</groupId> + <artifactId>onap-configuration-management-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <version>${servlet-api.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>2.8.1</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + <version>${junit.version}</version> + </dependency> - </dependencies> + </dependencies> </project> diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java index 53baaec2cf..db64f7f7fc 100644 --- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java +++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java @@ -26,7 +26,7 @@ import org.onap.config.impl.AgglomerateConfiguration; import org.onap.config.impl.ConfigurationDataSource; import org.onap.config.type.ConfigurationMode; import org.onap.config.type.ConfigurationType; - + import javax.sql.DataSource; import java.io.File; import java.lang.reflect.Field; @@ -67,6 +67,11 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; +import java.util.stream.Collectors; +import java.util.stream.Stream; + import static com.google.common.collect.ImmutableMap.builder; import static java.util.Optional.ofNullable; @@ -74,6 +79,10 @@ import static org.onap.config.api.Hint.EXTERNAL_LOOKUP; import static org.onap.config.api.Hint.LATEST_LOOKUP; import static org.onap.config.api.Hint.NODE_SPECIFIC; + +import static com.google.common.collect.ImmutableMap.builder; +import static org.onap.config.api.Hint.*; + /** * The type Configuration utils. */ diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/AggregateConfiguration.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/AggregateConfiguration.java index c8d76d9bd9..7698d3f8ec 100644 --- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/AggregateConfiguration.java +++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/AggregateConfiguration.java @@ -5,7 +5,6 @@ import org.apache.commons.configuration2.Configuration; import org.apache.commons.configuration2.tree.MergeCombiner; import org.apache.commons.configuration2.tree.OverrideCombiner; import org.apache.commons.configuration2.tree.UnionCombiner; -import static org.onap.config.Constants.LOAD_ORDER_KEY; import org.onap.config.ConfigurationUtils; import org.onap.config.type.ConfigurationMode; @@ -14,6 +13,8 @@ import java.net.URL; import java.util.HashMap; import java.util.*; +import static org.onap.config.Constants.LOAD_ORDER_KEY; + /** * The type Aggregate configuration. */ diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/CliConfigurationImpl.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/CliConfigurationImpl.java index 53ebf2943b..6663c85805 100644 --- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/CliConfigurationImpl.java +++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/CliConfigurationImpl.java @@ -1,43 +1,27 @@ package org.onap.config.impl; -import static org.onap.config.Constants.DB_NAMESPACE; -import static org.onap.config.Constants.DEFAULT_NAMESPACE; -import static org.onap.config.Constants.DEFAULT_TENANT; -import static org.onap.config.Constants.KEY_ELEMENTS_DELEMETER; -import static org.onap.config.Constants.LOAD_ORDER_KEY; -import static org.onap.config.Constants.MBEAN_NAME; -import static org.onap.config.Constants.MODE_KEY; -import static org.onap.config.Constants.NAMESPACE_KEY; +import org.apache.commons.configuration2.*; +import org.onap.config.ConfigurationUtils; +import org.onap.config.Constants; +import org.onap.config.api.ConfigurationManager; +import org.onap.config.api.Hint; +import org.onap.config.type.ConfigurationQuery; +import org.onap.config.type.ConfigurationUpdate; import java.io.File; import java.io.PrintWriter; +import java.util.*; import java.lang.management.ManagementFactory; import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; + import javax.management.MBeanServer; import javax.management.MBeanServerDelegate; import javax.management.MBeanServerNotification; import javax.management.Notification; import javax.management.ObjectName; import javax.management.StandardMBean; -import org.apache.commons.configuration2.CombinedConfiguration; -import org.apache.commons.configuration2.CompositeConfiguration; -import org.apache.commons.configuration2.Configuration; -import org.apache.commons.configuration2.FileBasedConfiguration; -import org.apache.commons.configuration2.PropertiesConfiguration; -import org.onap.config.ConfigurationUtils; -import org.onap.config.Constants; -import org.onap.config.api.ConfigurationManager; -import org.onap.config.api.Hint; -import org.onap.config.type.ConfigurationQuery; -import org.onap.config.type.ConfigurationUpdate; + +import static org.onap.config.Constants.*; /** * The type Cli configuration. diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationChangeNotifier.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationChangeNotifier.java index 015634b1cd..88c71c14e0 100644 --- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationChangeNotifier.java +++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationChangeNotifier.java @@ -5,7 +5,7 @@ import org.onap.config.Constants; import org.onap.config.api.ConfigurationChangeListener; import org.onap.config.api.ConfigurationManager; import org.onap.config.api.Hint; - + import java.io.File; import java.io.IOException; import java.lang.management.ManagementFactory; @@ -37,6 +37,7 @@ import javax.management.MBeanServerConnection; import javax.management.ObjectName; + /** * The type Configuration change notifier. */ diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationDataSource.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationDataSource.java index ea9c61f635..64fd22e431 100644 --- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationDataSource.java +++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationDataSource.java @@ -5,13 +5,8 @@ import org.apache.commons.dbcp2.BasicDataSource; import org.apache.commons.lang3.StringUtils; import org.onap.config.ConfigurationUtils; import org.onap.config.Constants; - +import java.util.*; import java.sql.Driver; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.ServiceLoader; -import java.util.Set; /** * The type Configuration data source. diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationFilter.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationFilter.java index 9df69ed1d7..2956943f7e 100644 --- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationFilter.java +++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationFilter.java @@ -3,6 +3,7 @@ package org.onap.config.impl; import org.onap.config.Constants; import org.onap.config.api.Configuration; +import javax.servlet.annotation.WebFilter; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; @@ -10,7 +11,8 @@ import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; -import javax.servlet.annotation.WebFilter; + + @WebFilter("/") public class ConfigurationFilter implements Filter { diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java index 7faf3ee8cf..00725b1165 100644 --- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java +++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java @@ -1,7 +1,5 @@ package org.onap.config.impl; -import static org.onap.config.ConfigurationUtils.getConfigurationRepositoryKey; - import org.apache.commons.configuration2.Configuration; import org.apache.commons.configuration2.DatabaseConfiguration; import org.onap.config.ConfigurationUtils; @@ -26,6 +24,8 @@ import java.util.Map; import java.util.Set; import java.util.function.Predicate; +import static org.onap.config.ConfigurationUtils.getConfigurationRepositoryKey; + /** * The type Configuration. */ diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationRepository.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationRepository.java index 1c3bc1313f..953f793b9d 100644 --- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationRepository.java +++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationRepository.java @@ -12,15 +12,7 @@ import org.onap.config.Constants; import java.io.File; import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; +import java.util.*; /** * The type Configuration repository. diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ContextListener.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ContextListener.java index cf87db936d..cc31e775b7 100644 --- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ContextListener.java +++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ContextListener.java @@ -1,13 +1,14 @@ package org.onap.config.impl; -import static org.onap.config.Constants.MBEAN_NAME; +import org.onap.config.api.ConfigurationManager; -import java.lang.management.ManagementFactory; import javax.management.ObjectName; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import javax.servlet.annotation.WebListener; -import org.onap.config.api.ConfigurationManager; +import java.lang.management.ManagementFactory; + +import static org.onap.config.Constants.MBEAN_NAME; @WebListener public class ContextListener implements ServletContextListener { diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/ConfigurationUtilsTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/ConfigurationUtilsTest.java index 90966fccf6..707573640b 100644 --- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/ConfigurationUtilsTest.java +++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/ConfigurationUtilsTest.java @@ -5,9 +5,7 @@ import org.junit.Test; import java.util.Arrays; import java.util.List; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; public class ConfigurationUtilsTest { @Test |