summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Goulding <ryandgoulding@gmail.com>2017-09-19 11:14:41 -0400
committerRyan Goulding <ryandgoulding@gmail.com>2017-09-20 16:21:46 +0000
commit03235aa6cc35871630ee3e09fe467eca79ce315e (patch)
tree30f362896e30fdd8ab52859b15ab1d0ddc5a4211
parent9a236162e1c3fd5dcc425544c5ecf5290b0fafb2 (diff)
Abstract utility classes for re-use
When looking at the existing uses of BundleActivator(s), it became immediately clear that other parts of the code have a strategy based properties file resolution very similar to those abstracted by dblib. This change aggregates a separate utils bundle for this functionality, which is further abstracted for potential reuse with other use cases. The next use case is in the sli bundle, which will be handled in a follow-up patch. Issue-Id: SDNC-54 Change-Id: Ie4d4bb679617474b1983e6044c08cca1742b9893 Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
-rwxr-xr-xdblib/provider/pom.xml5
-rw-r--r--dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBLIBResourceProvider.java20
-rwxr-xr-xpom.xml1
-rw-r--r--utils/pom.xml56
-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.java17
-rw-r--r--utils/src/main/java/org/onap/ccsdk/sli/core/utils/dblib/DblibEnvVarFileResolver.java15
-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 8ff10941..ad1cc9d2 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 062cd840..8e0b534f 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);
diff --git a/pom.xml b/pom.xml
index 1c6cd4ae..a3691810 100755
--- a/pom.xml
+++ b/pom.xml
@@ -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 00000000..93326a9d
--- /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 a7797d9f..8938aa6e 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 0b69109f..3e438d1a 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 673ccbf0..5cd6c360 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 d2b164e3..0cb75450 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 97ab08ac..bfb417dc 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 00000000..56b4ca1b
--- /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 00000000..9eef4cee
--- /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 65ebfbae..e5051d65 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 0a032e8b..5e407daf 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 41011e55..4b28d449 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 77589893..bae4168d 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());
}