aboutsummaryrefslogtreecommitdiffstats
path: root/common/onap-common-configuration-management/onap-configuration-management-core
diff options
context:
space:
mode:
Diffstat (limited to 'common/onap-common-configuration-management/onap-configuration-management-core')
-rwxr-xr-xcommon/onap-common-configuration-management/onap-configuration-management-core/pom.xml7
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/NodeSpecificCliTest.java53
2 files changed, 35 insertions, 25 deletions
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/pom.xml b/common/onap-common-configuration-management/onap-configuration-management-core/pom.xml
index 83dfa8e59c..5077a64518 100755
--- a/common/onap-common-configuration-management/onap-configuration-management-core/pom.xml
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/pom.xml
@@ -31,6 +31,13 @@
<dependencies>
+ <!-- https://mvnrepository.com/artifact/org.awaitility/awaitility -->
+ <dependency>
+ <groupId>org.awaitility</groupId>
+ <artifactId>awaitility</artifactId>
+ <version>4.0.3</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/NodeSpecificCliTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/NodeSpecificCliTest.java
index f61830c169..e3f7833a80 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/NodeSpecificCliTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/test/NodeSpecificCliTest.java
@@ -16,7 +16,10 @@
package org.onap.config.test;
-import static org.junit.Assert.assertTrue;
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.awaitility.Awaitility.await;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.FileOutputStream;
@@ -24,63 +27,63 @@ import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.onap.config.api.ConfigurationManager;
import org.onap.config.impl.CliConfigurationImpl;
import org.onap.config.util.ConfigTestConstant;
import org.onap.config.util.TestUtil;
/**
- * Created by sheetalm on 10/19/2016.
- * Scenario 19
- * Pre-requisite - set -Dnode.config.location=${"user.home"}/TestResources/ while running test
- * Verify node specific override using CLI
+ * Created by sheetalm on 10/19/2016. Scenario 19 Pre-requisite - set -Dnode.config.location=${"user.home"}/TestResources/ while running test Verify
+ * node specific override using CLI
*/
-public class NodeSpecificCliTest {
+@Disabled("Investigate instability (random failures)")
+class NodeSpecificCliTest {
private static final String NAMESPACE = "NodeCLI";
+ private static final File FILE = new File(TestUtil.jsonSchemaLoc + "config.properties");
- @AfterClass
+ @AfterAll
public static void tearDown() throws Exception {
TestUtil.cleanUp();
- File f = new File(TestUtil.jsonSchemaLoc + "config.properties");
- if (f.exists()) {
- assertTrue(f.delete());
+ if (FILE.exists()) {
+ assertTrue(FILE.delete());
}
}
@Test
- public void testCliApi() throws Exception {
+ void testCliApi() throws Exception {
//Verify without fallback
- Map<String, Object> input = new HashMap<>();
+ final Map<String, Object> input = new HashMap<>();
input.put("ImplClass", "org.onap.config.type.ConfigurationQuery");
input.put("namespace", NAMESPACE);
input.put("key", ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH);
- ConfigurationManager conf = new CliConfigurationImpl();
- String maxLength = conf.getConfigurationValue(input);
+ final ConfigurationManager conf = new CliConfigurationImpl();
+ final String maxLength = conf.getConfigurationValue(input);
//Verify Property from Namespace configurations
- Assert.assertEquals("30", maxLength);
+ assertEquals("30", maxLength);
//Add node specific configurations
- Properties props = new Properties();
+ final Properties props = new Properties();
props.setProperty(ConfigTestConstant.ARTIFACT_NAME_MAXLENGTH, "50");
props.setProperty("_config.namespace", NAMESPACE);
- File f = new File(TestUtil.jsonSchemaLoc + "config.properties");
- try (OutputStream out = new FileOutputStream(f)) {
+
+ await().atMost(30, SECONDS).pollInterval(1, SECONDS).until(() -> FILE.exists());
+ try (final OutputStream out = new FileOutputStream(FILE)) {
props.store(out, "Node Config Property");
}
//Verify property from node specific configuration
input.put("nodeSpecific", true);
- String nodeVal = conf.getConfigurationValue(input);
- Assert.assertEquals("30", nodeVal);
+ final String nodeVal = conf.getConfigurationValue(input);
+ assertEquals("30", nodeVal);
- if (f.exists()) {
- assertTrue(f.delete());
+ if (FILE.exists()) {
+ assertTrue(FILE.delete());
}
}
}