Moved loading to separate object. Added a unit test for loading the properties

This commit is contained in:
nbaars
2015-02-07 11:37:53 +01:00
parent 1d7ecb0627
commit 861f3e9d37
4 changed files with 77 additions and 16 deletions

View File

@ -0,0 +1,24 @@
package org.owasp.webgoat.plugins;
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
public final class GlobalProperties {
private final Plugin plugin;
public GlobalProperties(Path pluginDirectory) {
this.plugin = new Plugin(pluginDirectory);
}
public void loadProperties(Path globalPropertiesPath) {
try {
List<Path> filesInDirectory = PluginFileUtils.getFilesInDirectory(globalPropertiesPath);
this.plugin.loadFiles(filesInDirectory, true);
} catch (IOException e) {
throw new IllegalStateException("Unable to load global properties, check your installation for the directory i18n: " + globalPropertiesPath.toString(), e);
}
}
}