diff options
author | andre.schmid <andre.schmid@est.tech> | 2020-01-29 17:38:07 +0000 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-02-18 16:06:10 +0000 |
commit | 4aa20bc42b7bd98dde15f7594084669eb92412c2 (patch) | |
tree | 65e9a29c54a600bb2f81bfd36cb15a606f88993a /common-app-api/src/test/java/org | |
parent | b2b6accda7c04a5df5029dcf250b8138c231f38e (diff) |
Configuration file runtime reload
Reloads the backend configuration file when the file
listener catches a change.
Forces validations errors when the configuration file
could not be parsed.
Remove not used configurations.
Change-Id: Ic6fcb2b557d52ec53074c38ab8e0fcfa96e9be67
Issue-ID: SDC-2758
Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'common-app-api/src/test/java/org')
2 files changed, 12 insertions, 16 deletions
diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/util/YamlToObjectConverterTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/util/YamlToObjectConverterTest.java index 49fc553302..35af78bd4e 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/util/YamlToObjectConverterTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/util/YamlToObjectConverterTest.java @@ -29,6 +29,7 @@ import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Paths; +import org.openecomp.sdc.exception.YamlConversionException; import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertFalse; @@ -81,14 +82,14 @@ public class YamlToObjectConverterTest { } @Test - public void validateConvertWithFullFilePathReturnsValidObjectCreatedFromYaml() { + public void validateConvertWithFullFilePathReturnsValidObjectCreatedFromYaml() throws YamlConversionException { Configuration result = yamlToObjectConverter.convert(filePath+fileName, Configuration.class); assertThatCreatedObjectIsValid(result); } @Test - public void validateConvertWithFullFilePathReturnsNullIfFileDoesNotExist() { + public void validateConvertWithFullFilePathReturnsNullIfFileDoesNotExist() throws YamlConversionException { final String wrongFileName = "wrong-configuration.yaml"; Configuration result = yamlToObjectConverter.convert(wrongFileName, Configuration.class); @@ -96,28 +97,23 @@ public class YamlToObjectConverterTest { assertNull(result); } - @Test - public void validateConvertWithFullFilePathReturnsNullIfClassDoesNotMathYaml() { - - HttpClient result = yamlToObjectConverter.convert(filePath+fileName, HttpClient.class); - - assertNull(result); + @Test(expected = YamlConversionException.class) + public void validateConvertWithFullFilePathThrowsExceptionIfClassDoesNotMathYaml() throws YamlConversionException { + yamlToObjectConverter.convert(filePath + fileName, HttpClient.class); } @Test - public void validateConvertWithFilePathAndFileNameReturnsValidObjectCreatedFromYaml() { + public void validateConvertWithFilePathAndFileNameReturnsValidObjectCreatedFromYaml() + throws YamlConversionException { Configuration result = yamlToObjectConverter.convert(filePath, Configuration.class, fileName); assertThatCreatedObjectIsValid(result); } - @Test - public void validateConvertWithFilePathAndFileNameReturnsNullIfClassIsNull() { - - HttpClient result = yamlToObjectConverter.convert(filePath, null, fileName); - - assertNull(result); + @Test(expected = IllegalArgumentException.class) + public void validateConvertWithFilePathAndFileNameThrowsExceptionIfClassIsNull() throws YamlConversionException { + yamlToObjectConverter.convert(filePath, null, fileName); } @Test diff --git a/common-app-api/src/test/java/org/openecomp/sdc/fe/config/WorkspaceConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/fe/config/WorkspaceConfigurationTest.java index dd1fe8b2be..08e9b34195 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/fe/config/WorkspaceConfigurationTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/fe/config/WorkspaceConfigurationTest.java @@ -41,7 +41,7 @@ public class WorkspaceConfigurationTest { @Before public void setUp() { - String appConfigDir = "src/test/resources/config/common"; + String appConfigDir = "src/test/resources/config/fe"; ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); configurationManager = new ConfigurationManager(configurationSource); |