diff options
author | Michael Lando <ml636r@att.com> | 2017-02-19 12:35:04 +0200 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2017-02-19 12:35:04 +0200 |
commit | f5f13c4f6b6fe3b4d98e349dfd7db59339803436 (patch) | |
tree | 72caffc93fab394ffa3b761505775331f1c559b9 /openecomp-be/backend/openecomp-sdc-application-config-manager/src/test/java | |
parent | 451a3400b76511393c62a444f588a4ed15f4a549 (diff) |
push addional code
Change-Id: Ia427bb3460cda3a896f8faced2de69eaf3807b74
Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-application-config-manager/src/test/java')
-rw-r--r-- | openecomp-be/backend/openecomp-sdc-application-config-manager/src/test/java/org/openecomp/sdc/applicationconfig/ApplicationConfigManagerTest.java | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-application-config-manager/src/test/java/org/openecomp/sdc/applicationconfig/ApplicationConfigManagerTest.java b/openecomp-be/backend/openecomp-sdc-application-config-manager/src/test/java/org/openecomp/sdc/applicationconfig/ApplicationConfigManagerTest.java new file mode 100644 index 0000000000..291ef18e19 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-application-config-manager/src/test/java/org/openecomp/sdc/applicationconfig/ApplicationConfigManagerTest.java @@ -0,0 +1,64 @@ +package org.openecomp.sdc.applicationconfig; + +import org.openecomp.sdc.applicationconfig.impl.ApplicationConfigManagerImpl; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.core.utilities.applicationconfig.dao.type.ApplicationConfigEntity; +import org.openecomp.core.utilities.applicationconfig.type.ConfigurationData; + +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.util.Collection; + +public class ApplicationConfigManagerTest { + + public static final String TEST_NAMESPACE_1 = "test-app-namespace"; + public static final String TEST_NAMESPACE_2 = "test-namespace"; + public static final String TEST_KEY = "test-app-key"; + public static final String TEST_VALUE = "test-app-value"; + ApplicationConfigManager applicationConfigManager = new ApplicationConfigManagerImpl(); + + @Test + public void testInsertIntoTable() { + try { + applicationConfigManager.insertIntoTable(TEST_NAMESPACE_1, TEST_KEY, TEST_VALUE); + } catch (CoreException e) { + Assert.assertEquals(e.getMessage(), + "Error occurred while loading questionnaire schema templates"); + } + } + + + @Test(dependsOnMethods = "testInsertIntoTable") + public void testGetValueFromTable() { + ConfigurationData value = applicationConfigManager.getFromTable(TEST_NAMESPACE_1, TEST_KEY); + + Assert.assertEquals(value.getValue(), TEST_VALUE); + } + + + @Test(dependsOnMethods = "testInsertIntoTable") + public void testGetValueFromTableNegative() { + try { + ConfigurationData value = + applicationConfigManager.getFromTable("not-existing-namespace", "not-existing-key"); + } catch (CoreException ce) { + Assert.assertEquals(ce.getMessage(), + "Configuration for namespace not-existing-namespace and key not-existing-key was not found"); + } + + } + + @Test + public void testGetList() { + applicationConfigManager.insertIntoTable(TEST_NAMESPACE_2, "key1", "val1"); + applicationConfigManager.insertIntoTable(TEST_NAMESPACE_2, "key2", "val2"); + applicationConfigManager.insertIntoTable(TEST_NAMESPACE_2, "key3", "val3"); + + Collection<ApplicationConfigEntity> ACElist = + applicationConfigManager.getListOfConfigurationByNamespace(TEST_NAMESPACE_2); + + Assert.assertNotNull(ACElist); + Assert.assertEquals(ACElist.size(), 3); + } +} |