diff options
author | Dan Timoney <dtimoney@att.com> | 2017-09-20 20:02:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-09-20 20:02:58 +0000 |
commit | 630809c9b6b8f9ed1ff3f875d3c9849db52139e0 (patch) | |
tree | 682cd7673d469be9d8552e913cd061a9523ad063 | |
parent | 3231dedd31e302054968dd7438ed5c0dabe87c8d (diff) | |
parent | 03235aa6cc35871630ee3e09fe467eca79ce315e (diff) |
Merge "Abstract utility classes for re-use"
-rwxr-xr-x | dblib/provider/pom.xml | 5 | ||||
-rw-r--r-- | dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java | 20 | ||||
-rwxr-xr-x | pom.xml | 1 | ||||
-rw-r--r-- | utils/pom.xml | 56 | ||||
-rw-r--r-- | utils/src/main/java/org/onap/ccsdk/sli/core/utils/DefaultFileResolver.java (renamed from dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibDefaultFileResolver.java) | 20 | ||||
-rw-r--r-- | utils/src/main/java/org/onap/ccsdk/sli/core/utils/EnvVarFileResolver.java (renamed from dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolver.java) | 15 | ||||
-rw-r--r-- | utils/src/main/java/org/onap/ccsdk/sli/core/utils/JREFileResolver.java (renamed from dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolver.java) | 15 | ||||
-rw-r--r-- | utils/src/main/java/org/onap/ccsdk/sli/core/utils/KarafRootFileResolver.java (renamed from dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibKarafRootFileResolver.java) | 15 | ||||
-rw-r--r-- | utils/src/main/java/org/onap/ccsdk/sli/core/utils/PropertiesFileResolver.java (renamed from dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibPropertiesFileResolver.java) | 8 | ||||
-rw-r--r-- | utils/src/main/java/org/onap/ccsdk/sli/core/utils/dblib/DblibDefaultFileResolver.java | 17 | ||||
-rw-r--r-- | utils/src/main/java/org/onap/ccsdk/sli/core/utils/dblib/DblibEnvVarFileResolver.java | 15 | ||||
-rw-r--r-- | utils/src/test/java/org/onap/ccsdk/sli/core/utils/JREFileResolverTest.java (renamed from dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolverTest.java) | 6 | ||||
-rw-r--r-- | utils/src/test/java/org/onap/ccsdk/sli/core/utils/KarafRootFileResolverTest.java (renamed from dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibKarafRootFileResolverTest.java) | 6 | ||||
-rw-r--r-- | utils/src/test/java/org/onap/ccsdk/sli/core/utils/dblib/DblibDefaultFileResolverTest.java (renamed from dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibDefaultFileResolverTest.java) | 7 | ||||
-rw-r--r-- | utils/src/test/java/org/onap/ccsdk/sli/core/utils/dblib/DblibEnvVarFileResolverTest.java (renamed from dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolverTest.java) | 7 |
15 files changed, 154 insertions, 59 deletions
diff --git a/dblib/provider/pom.xml b/dblib/provider/pom.xml index 8ff109417..ad1cc9d28 100755 --- a/dblib/provider/pom.xml +++ b/dblib/provider/pom.xml @@ -56,6 +56,11 @@ <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>utils</artifactId> + <version>${project.version}</version> + </dependency> <!-- Testing related dependencies --> <dependency> diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java index 062cd8408..8e0b534f0 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java @@ -27,11 +27,11 @@ import java.util.Optional; import java.util.Properties; import java.util.Vector; -import org.onap.ccsdk.sli.core.dblib.propertiesfileresolver.DblibDefaultFileResolver; -import org.onap.ccsdk.sli.core.dblib.propertiesfileresolver.DblibEnvVarFileResolver; -import org.onap.ccsdk.sli.core.dblib.propertiesfileresolver.DblibJREFileResolver; -import org.onap.ccsdk.sli.core.dblib.propertiesfileresolver.DblibKarafRootFileResolver; -import org.onap.ccsdk.sli.core.dblib.propertiesfileresolver.DblibPropertiesFileResolver; +import org.onap.ccsdk.sli.core.utils.dblib.DblibDefaultFileResolver; +import org.onap.ccsdk.sli.core.utils.dblib.DblibEnvVarFileResolver; +import org.onap.ccsdk.sli.core.utils.JREFileResolver; +import org.onap.ccsdk.sli.core.utils.KarafRootFileResolver; +import org.onap.ccsdk.sli.core.utils.PropertiesFileResolver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,7 +58,7 @@ public class DBLIBResourceProvider { /** * A prioritized list of strategies for resolving dblib properties files. */ - private Vector<DblibPropertiesFileResolver> dblibPropertiesFileResolvers = new Vector(); + private Vector<PropertiesFileResolver> dblibPropertiesFileResolvers = new Vector(); /** * The configuration properties for the db connection. @@ -75,10 +75,10 @@ public class DBLIBResourceProvider { dblibPropertiesFileResolvers.add(new DblibDefaultFileResolver( "Using property file (1) from default directory" )); - dblibPropertiesFileResolvers.add(new DblibJREFileResolver( - "Using property file (2) from JRE argument" + dblibPropertiesFileResolvers.add(new JREFileResolver( + "Using property file (2) from JRE argument", DBLIBResourceProvider.class )); - dblibPropertiesFileResolvers.add(new DblibKarafRootFileResolver( + dblibPropertiesFileResolvers.add(new KarafRootFileResolver( "Using property file (4) from karaf root", this)); // determines properties file as according to the priority described in the class header comment @@ -141,7 +141,7 @@ public class DBLIBResourceProvider { */ File determinePropertiesFile(final DBLIBResourceProvider dblibResourceProvider) { - for (final DblibPropertiesFileResolver dblibPropertiesFileResolver : dblibPropertiesFileResolvers) { + for (final PropertiesFileResolver dblibPropertiesFileResolver : dblibPropertiesFileResolvers) { final Optional<File> fileOptional = dblibPropertiesFileResolver.resolveFile(DBLIB_PROP_FILE_NAME); if (fileOptional.isPresent()) { return reportSuccess(dblibPropertiesFileResolver.getSuccessfulResolutionMessage(), fileOptional); @@ -114,6 +114,7 @@ <module>filters</module> <module>sliPluginUtils</module> <module>sliapi</module> + <module>utils</module> </modules> <organization> <name>ONAP</name> diff --git a/utils/pom.xml b/utils/pom.xml new file mode 100644 index 000000000..93326a9dc --- /dev/null +++ b/utils/pom.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <parent> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>ccsdk-sli-core</artifactId> + <version>0.1.2-SNAPSHOT</version> + </parent> + + <modelVersion>4.0.0</modelVersion> + <packaging>bundle</packaging> + <artifactId>utils</artifactId> + <name>SLI Core Utilities Package</name> + + <description> + The SLI Core Utilities Package provides common functionality for setting up SLI connectivity. + </description> + + <dependencies> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + <dependency> + <groupId>equinoxSDK381</groupId> + <artifactId>org.eclipse.osgi</artifactId> + <version>${equinox.osgi.version}</version> + </dependency> + + <!-- Testing Dependencies --> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <version>${bundle.plugin.version}</version> + </plugin> + </plugins> + </build> + <organization> + <name>Inocybe Technologies and Others</name> + </organization> +</project> diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibDefaultFileResolver.java b/utils/src/main/java/org/onap/ccsdk/sli/core/utils/DefaultFileResolver.java index a7797d9f7..8938aa6e7 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibDefaultFileResolver.java +++ b/utils/src/main/java/org/onap/ccsdk/sli/core/utils/DefaultFileResolver.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.dblib.propertiesfileresolver; +package org.onap.ccsdk.sli.core.utils; import java.io.File; import java.nio.file.Path; @@ -29,17 +29,15 @@ import java.util.Optional; * Resolves dblib properties files relative to the default file path. In Unix, this is represented by: * <code>/opt/sdnc/data/properties</code> */ -public class DblibDefaultFileResolver implements DblibPropertiesFileResolver { - - /** - * Default path to look for the configuration directory - */ - private static final Path DEFAULT_DBLIB_PROP_DIR = Paths.get("opt", "sdnc", "data", "properties"); +public abstract class DefaultFileResolver implements PropertiesFileResolver { private final String successMessage; - public DblibDefaultFileResolver(final String successMessage) { + private final Path propertyPath; + + public DefaultFileResolver(final String successMessage, final Path propertyPath) { this.successMessage = successMessage; + this.propertyPath = propertyPath; } /** @@ -48,10 +46,10 @@ public class DblibDefaultFileResolver implements DblibPropertiesFileResolver { * @return an Optional File containing the location if it exists, or an empty Optional */ @Override - public Optional<File> resolveFile(final String dblibFileName) { - final File fileFromDefaultDblibDir = DEFAULT_DBLIB_PROP_DIR.resolve(dblibFileName).toFile(); + public Optional<File> resolveFile(final String filename) { + final File fileFromDefaultDblibDir = propertyPath.resolve(filename).toFile(); if (fileFromDefaultDblibDir.exists()) { - Optional.of(fileFromDefaultDblibDir); + return Optional.of(fileFromDefaultDblibDir); } return Optional.empty(); } diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolver.java b/utils/src/main/java/org/onap/ccsdk/sli/core/utils/EnvVarFileResolver.java index 0b69109f9..3e438d1a9 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolver.java +++ b/utils/src/main/java/org/onap/ccsdk/sli/core/utils/EnvVarFileResolver.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.dblib.propertiesfileresolver; +package org.onap.ccsdk.sli.core.utils; import com.google.common.base.Strings; @@ -30,17 +30,18 @@ import java.util.Optional; * Resolves dblib properties files relative to the directory identified by the <code>SDNC_CONFIG_DIR</code> * environment variable. */ -public class DblibEnvVarFileResolver implements DblibPropertiesFileResolver { +public abstract class EnvVarFileResolver implements PropertiesFileResolver { /** * Key for environment variable representing the configuration directory */ - private static final String SDNC_CONFIG_DIR_PROP_KEY = "SDNC_CONFIG_DIR"; + private final String propertyKey; private final String successMessage; - public DblibEnvVarFileResolver(final String successMessage) { + public EnvVarFileResolver(final String successMessage, final String propertyKey) { this.successMessage = successMessage; + this.propertyKey = propertyKey; } /** @@ -49,12 +50,12 @@ public class DblibEnvVarFileResolver implements DblibPropertiesFileResolver { * @return an Optional File containing the location if it exists, or an empty Optional */ @Override - public Optional<File> resolveFile(final String dblibFileName) { + public Optional<File> resolveFile(final String filename) { // attempt to resolve the property directory from the corresponding environment variable - final String propDirectoryFromEnvVariable = System.getenv(SDNC_CONFIG_DIR_PROP_KEY); + final String propDirectoryFromEnvVariable = System.getenv(propertyKey); final File fileFromEnvVariable; if (!Strings.isNullOrEmpty(propDirectoryFromEnvVariable)) { - fileFromEnvVariable = Paths.get(propDirectoryFromEnvVariable).resolve(dblibFileName).toFile(); + fileFromEnvVariable = Paths.get(propDirectoryFromEnvVariable).resolve(filename).toFile(); if(fileFromEnvVariable.exists()) { return Optional.of(fileFromEnvVariable); } diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolver.java b/utils/src/main/java/org/onap/ccsdk/sli/core/utils/JREFileResolver.java index 673ccbf03..5cd6c3606 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolver.java +++ b/utils/src/main/java/org/onap/ccsdk/sli/core/utils/JREFileResolver.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.dblib.propertiesfileresolver; +package org.onap.ccsdk.sli.core.utils; import java.io.File; import java.net.URISyntaxException; @@ -26,14 +26,13 @@ import java.net.URL; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Optional; -import org.onap.ccsdk.sli.core.dblib.DBLIBResourceProvider; import org.osgi.framework.FrameworkUtil; /** * Resolves dblib properties files relative to the directory identified by the JRE property * <code>dblib.properties</code>. */ -public class DblibJREFileResolver implements DblibPropertiesFileResolver { +public class JREFileResolver implements PropertiesFileResolver { /** * Key for JRE argument representing the configuration directory @@ -41,9 +40,11 @@ public class DblibJREFileResolver implements DblibPropertiesFileResolver { private static final String DBLIB_JRE_PROPERTY_KEY = "dblib.properties"; private final String successMessage; + private final Class clazz; - public DblibJREFileResolver(final String successMessage) { + public JREFileResolver(final String successMessage, final Class clazz) { this.successMessage = successMessage; + this.clazz = clazz; } /** @@ -52,15 +53,15 @@ public class DblibJREFileResolver implements DblibPropertiesFileResolver { * @return an Optional File containing the location if it exists, or an empty Optional */ @Override - public Optional<File> resolveFile(final String dblibFileName) { - final URL jreArgumentUrl = FrameworkUtil.getBundle(DBLIBResourceProvider.class) + public Optional<File> resolveFile(final String filename) { + final URL jreArgumentUrl = FrameworkUtil.getBundle(this.clazz) .getResource(DBLIB_JRE_PROPERTY_KEY); try { if (jreArgumentUrl == null) { return Optional.empty(); } final Path dblibPath = Paths.get(jreArgumentUrl.toURI()); - return Optional.of(dblibPath.resolve(dblibFileName).toFile()); + return Optional.of(dblibPath.resolve(filename).toFile()); } catch(final URISyntaxException e) { return Optional.empty(); } diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibKarafRootFileResolver.java b/utils/src/main/java/org/onap/ccsdk/sli/core/utils/KarafRootFileResolver.java index d2b164e3b..0cb754504 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibKarafRootFileResolver.java +++ b/utils/src/main/java/org/onap/ccsdk/sli/core/utils/KarafRootFileResolver.java @@ -18,25 +18,24 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.dblib.propertiesfileresolver; +package org.onap.ccsdk.sli.core.utils; import java.io.File; import java.net.URL; import java.util.Optional; -import org.onap.ccsdk.sli.core.dblib.DBLIBResourceProvider; /** * Resolves dblib properties files relative to the karaf root directory. */ -public class DblibKarafRootFileResolver implements DblibPropertiesFileResolver { +public class KarafRootFileResolver implements PropertiesFileResolver { - final DBLIBResourceProvider dblibResourceProvider; + final Object provider; private final String successMessage; - public DblibKarafRootFileResolver(final String successMessage, final DBLIBResourceProvider dblibResourceProvider) { + public KarafRootFileResolver(final String successMessage, final Object provider) { this.successMessage = successMessage; - this.dblibResourceProvider = dblibResourceProvider; + this.provider = provider; } /** @@ -45,8 +44,8 @@ public class DblibKarafRootFileResolver implements DblibPropertiesFileResolver { * @return an Optional File containing the location if it exists, or an empty Optional */ @Override - public Optional<File> resolveFile(final String dblibFileName) { - final URL fromKarafRoot = dblibResourceProvider.getClass().getResource(dblibFileName); + public Optional<File> resolveFile(final String filename) { + final URL fromKarafRoot = provider.getClass().getResource(filename); if (fromKarafRoot != null) { final File propertiesFile = new File(fromKarafRoot.getFile()); if (propertiesFile.exists()) { diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibPropertiesFileResolver.java b/utils/src/main/java/org/onap/ccsdk/sli/core/utils/PropertiesFileResolver.java index 97ab08acf..bfb417dca 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibPropertiesFileResolver.java +++ b/utils/src/main/java/org/onap/ccsdk/sli/core/utils/PropertiesFileResolver.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.dblib.propertiesfileresolver; +package org.onap.ccsdk.sli.core.utils; import java.io.File; import java.util.Optional; @@ -26,15 +26,15 @@ import java.util.Optional; /** * Strategy for resolving dblib properties. */ -public interface DblibPropertiesFileResolver { +public interface PropertiesFileResolver { /** * Resolve dblib properties file. * - * @param dblibFileName the name of the file to look for at the specific location. + * @param filename the name of the file to look for at the specific location. * @return An optional File or empty. */ - Optional<File> resolveFile(final String dblibFileName); + Optional<File> resolveFile(final String filename); /** * A success message, used only for logging now. diff --git a/utils/src/main/java/org/onap/ccsdk/sli/core/utils/dblib/DblibDefaultFileResolver.java b/utils/src/main/java/org/onap/ccsdk/sli/core/utils/dblib/DblibDefaultFileResolver.java new file mode 100644 index 000000000..56b4ca1b6 --- /dev/null +++ b/utils/src/main/java/org/onap/ccsdk/sli/core/utils/dblib/DblibDefaultFileResolver.java @@ -0,0 +1,17 @@ +package org.onap.ccsdk.sli.core.utils.dblib; + +import java.nio.file.Path; +import java.nio.file.Paths; +import org.onap.ccsdk.sli.core.utils.DefaultFileResolver; + +public class DblibDefaultFileResolver extends DefaultFileResolver { + + /** + * Default path to look for the configuration directory + */ + private static final Path DEFAULT_DBLIB_PROP_DIR = Paths.get("opt", "sdnc", "data", "properties"); + + public DblibDefaultFileResolver(final String successMessage) { + super(successMessage, DEFAULT_DBLIB_PROP_DIR); + } +} diff --git a/utils/src/main/java/org/onap/ccsdk/sli/core/utils/dblib/DblibEnvVarFileResolver.java b/utils/src/main/java/org/onap/ccsdk/sli/core/utils/dblib/DblibEnvVarFileResolver.java new file mode 100644 index 000000000..9eef4cee2 --- /dev/null +++ b/utils/src/main/java/org/onap/ccsdk/sli/core/utils/dblib/DblibEnvVarFileResolver.java @@ -0,0 +1,15 @@ +package org.onap.ccsdk.sli.core.utils.dblib; + +import org.onap.ccsdk.sli.core.utils.EnvVarFileResolver; + +public class DblibEnvVarFileResolver extends EnvVarFileResolver { + + /** + * Key for environment variable representing the configuration directory + */ + private static final String SDNC_CONFIG_DIR_PROP_KEY = "SDNC_CONFIG_DIR"; + + public DblibEnvVarFileResolver(final String successMessage) { + super(successMessage, SDNC_CONFIG_DIR_PROP_KEY); + } +} diff --git a/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolverTest.java b/utils/src/test/java/org/onap/ccsdk/sli/core/utils/JREFileResolverTest.java index 65ebfbae2..e5051d65a 100644 --- a/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibJREFileResolverTest.java +++ b/utils/src/test/java/org/onap/ccsdk/sli/core/utils/JREFileResolverTest.java @@ -1,14 +1,14 @@ -package org.onap.ccsdk.sli.core.dblib.propertiesfileresolver; +package org.onap.ccsdk.sli.core.utils; import static org.junit.Assert.*; import org.junit.Test; -public class DblibJREFileResolverTest { +public class JREFileResolverTest { @Test public void getSuccessfulResolutionMessage() throws Exception { - final DblibPropertiesFileResolver resolver = new DblibJREFileResolver("success"); + final PropertiesFileResolver resolver = new JREFileResolver("success", JREFileResolverTest.class); assertEquals("success", resolver.getSuccessfulResolutionMessage()); } diff --git a/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibKarafRootFileResolverTest.java b/utils/src/test/java/org/onap/ccsdk/sli/core/utils/KarafRootFileResolverTest.java index 0a032e8b7..5e407daf6 100644 --- a/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibKarafRootFileResolverTest.java +++ b/utils/src/test/java/org/onap/ccsdk/sli/core/utils/KarafRootFileResolverTest.java @@ -1,13 +1,13 @@ -package org.onap.ccsdk.sli.core.dblib.propertiesfileresolver; +package org.onap.ccsdk.sli.core.utils; import static org.junit.Assert.*; import org.junit.Test; -public class DblibKarafRootFileResolverTest { +public class KarafRootFileResolverTest { @Test public void getSuccessfulResolutionMessage() throws Exception { - final DblibPropertiesFileResolver resolver = new DblibKarafRootFileResolver("success", null); + final PropertiesFileResolver resolver = new KarafRootFileResolver("success", null); assertEquals("success", resolver.getSuccessfulResolutionMessage()); } diff --git a/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibDefaultFileResolverTest.java b/utils/src/test/java/org/onap/ccsdk/sli/core/utils/dblib/DblibDefaultFileResolverTest.java index 41011e55b..4b28d449d 100644 --- a/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibDefaultFileResolverTest.java +++ b/utils/src/test/java/org/onap/ccsdk/sli/core/utils/dblib/DblibDefaultFileResolverTest.java @@ -1,23 +1,24 @@ -package org.onap.ccsdk.sli.core.dblib.propertiesfileresolver; +package org.onap.ccsdk.sli.core.utils.dblib; import static org.junit.Assert.*; import java.io.File; import java.util.Optional; import org.junit.Test; +import org.onap.ccsdk.sli.core.utils.PropertiesFileResolver; public class DblibDefaultFileResolverTest { @Test public void resolveFile() throws Exception { - final DblibPropertiesFileResolver resolver = new DblibDefaultFileResolver("success"); + final PropertiesFileResolver resolver = new DblibDefaultFileResolver("success"); final Optional<File> file = resolver.resolveFile("doesnotexist.cfg"); assertFalse(file.isPresent()); } @Test public void getSuccessfulResolutionMessage() throws Exception { - final DblibPropertiesFileResolver resolver = new DblibDefaultFileResolver("success"); + final PropertiesFileResolver resolver = new DblibDefaultFileResolver("success"); assertEquals("success", resolver.getSuccessfulResolutionMessage()); } diff --git a/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolverTest.java b/utils/src/test/java/org/onap/ccsdk/sli/core/utils/dblib/DblibEnvVarFileResolverTest.java index 775898930..bae4168d8 100644 --- a/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/propertiesfileresolver/DblibEnvVarFileResolverTest.java +++ b/utils/src/test/java/org/onap/ccsdk/sli/core/utils/dblib/DblibEnvVarFileResolverTest.java @@ -1,22 +1,23 @@ -package org.onap.ccsdk.sli.core.dblib.propertiesfileresolver; +package org.onap.ccsdk.sli.core.utils.dblib; import static org.junit.Assert.*; import java.io.File; import java.util.Optional; import org.junit.Test; +import org.onap.ccsdk.sli.core.utils.PropertiesFileResolver; public class DblibEnvVarFileResolverTest { @Test public void resolveFile() throws Exception { - final DblibPropertiesFileResolver resolver = new DblibEnvVarFileResolver("success"); + final PropertiesFileResolver resolver = new DblibEnvVarFileResolver("success"); final Optional<File> file = resolver.resolveFile("doesnotexist.cfg"); assertFalse(file.isPresent()); } @Test public void getSuccessfulResolutionMessage() throws Exception { - final DblibPropertiesFileResolver resolver = new DblibEnvVarFileResolver("success"); + final PropertiesFileResolver resolver = new DblibEnvVarFileResolver("success"); assertEquals("success", resolver.getSuccessfulResolutionMessage()); } |