diff options
author | Michael DÜrre <michael.duerre@highstreet-technologies.com> | 2022-01-31 05:11:03 +0100 |
---|---|---|
committer | KAPIL SINGAL <ks220y@att.com> | 2022-02-01 03:42:42 +0000 |
commit | f01064b548d479d2f98abb7d30429b4a410a209e (patch) | |
tree | 08bede472e8833eeb431836a4bb33ae544f5430d /sdnr/wt/data-provider/provider/src/test | |
parent | 9912e1626d93afeb4f7148dd5d826ae1caa1ef8a (diff) |
add nodb support
add option to work without db
Issue-ID: CCSDK-3573
Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com>
Change-Id: I1a1dc785dceb1789fe12bf6b3009e35d56578816
Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/data-provider/provider/src/test')
-rw-r--r-- | sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestConfig.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestConfig.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestConfig.java index 8c62ec9d5..c12128337 100644 --- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestConfig.java +++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestConfig.java @@ -22,7 +22,8 @@ package org.onap.ccsdk.features.sdnr.wt.dataprovider.test; import static org.junit.Assert.assertEquals; - +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.io.File; import org.junit.After; @@ -32,6 +33,7 @@ import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRep import org.onap.ccsdk.features.sdnr.wt.common.configuration.subtypes.Section; import org.onap.ccsdk.features.sdnr.wt.common.configuration.subtypes.Section.EnvGetter; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.EsConfig; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.impl.DataProviderConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,6 +43,7 @@ public class TestConfig { private static final String TESTFILENAME = "testconfig.properties"; private static String ENVSDNRDBURL = "SDNRDBURL"; + private static String ENVSDNRDBENABLED = "SDNRDBENABLED"; private static String SDNRDBURL = "http://sdnrdb:9200"; @After @@ -60,11 +63,17 @@ public class TestConfig { return envname.equals(ENVSDNRDBURL) ? SDNRDBURL : env.getenv(envname); }); ConfigurationFileRepresentation configuration = new ConfigurationFileRepresentation(TESTFILENAME); - EsConfig esConfig = new EsConfig(configuration); + DataProviderConfig dbConfig = new DataProviderConfig(configuration); + EsConfig esConfig = dbConfig.getEsConfig(); LOG.info("Defaultconfiguration: {}", esConfig.toString()); assertEquals("http", esConfig.getHosts()[0].protocol.getValue()); assertEquals(9200, esConfig.getHosts()[0].port); assertEquals("sdnrdb", esConfig.getHosts()[0].hostname); - + assertTrue(dbConfig.isEnabled()); + Section.setEnvGetter((envname) -> { + return envname.equals(ENVSDNRDBENABLED) ? "false" : env.getenv(envname); + }); + assertFalse(dbConfig.isEnabled()); + } } |