From 4aa20bc42b7bd98dde15f7594084669eb92412c2 Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Wed, 29 Jan 2020 17:38:07 +0000 Subject: 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 --- .../sdc/common/util/YamlToObjectConverterTest.java | 26 +++++++++------------- .../sdc/fe/config/WorkspaceConfigurationTest.java | 2 +- 2 files changed, 12 insertions(+), 16 deletions(-) (limited to 'common-app-api/src/test/java/org') 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); -- cgit 1.2.3-korg