X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=sdnr%2Fwt%2Fcommon%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fccsdk%2Ffeatures%2Fsdnr%2Fwt%2Fcommon%2Ftest%2FTestConfig.java;h=7f1dc962ca91ed96da9e895a62b3df72f7aef890;hb=a452cd75ddae953c881e507ee9223961387e9355;hp=415620415bcb5e2ce103445bbddcc1f2473a1fd6;hpb=06332d2a54f0d83c1929142aab98753385cec49e;p=ccsdk%2Ffeatures.git diff --git a/sdnr/wt/common/src/test/java/org/onap/ccsdk/features/sdnr/wt/common/test/TestConfig.java b/sdnr/wt/common/src/test/java/org/onap/ccsdk/features/sdnr/wt/common/test/TestConfig.java index 415620415..7f1dc962c 100644 --- a/sdnr/wt/common/src/test/java/org/onap/ccsdk/features/sdnr/wt/common/test/TestConfig.java +++ b/sdnr/wt/common/src/test/java/org/onap/ccsdk/features/sdnr/wt/common/test/TestConfig.java @@ -21,17 +21,15 @@ */ package org.onap.ccsdk.features.sdnr.wt.common.test; -import static org.junit.Assert.*; - +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.File; import java.io.IOException; -import java.lang.reflect.Field; import java.net.MalformedURLException; import java.net.URL; import java.nio.file.Files; -import java.util.Collections; -import java.util.Map; - import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -53,6 +51,8 @@ public class TestConfig { private static final int TESTVALUE1 = 123; private static final int TESTVALUE1_2 = 1234; private static final boolean TESTVALUE2 = true; + private static final String TESTCOMMENT1 = "my comment for this value"; + private static final String TESTCOMMENT1_2 = "my comment line 2 for this value"; private static final String TESTVALUE3 = "http://localhost:2223"; private static final String TESTVALUE4 = "httasdasdas"; private static final String TESTCONTENT1 = " [test]\n" + TESTKEY1 + "=" + TESTVALUE1 + "\n" + "#her a comment\n" @@ -102,6 +102,8 @@ public class TestConfig { Section section = confiuration.addSection(SECTIONNAME); section.setProperty(TESTKEY1, String.valueOf(TESTVALUE1)); + section.addComment(TESTKEY1, TESTCOMMENT1); + section.addComment(TESTKEY1, TESTCOMMENT1_2); section.setProperty(TESTKEY2, String.valueOf(TESTVALUE2)); section.setProperty(TESTKEY3, String.valueOf(TESTVALUE3)); confiuration.save(); @@ -249,17 +251,4 @@ public class TestConfig { section.parseLines(); assertTrue(section.getProperty(KEY).length() > " in ".length()); } - - public static void setEnv(String key, String value) { - try { - Map env = System.getenv(); - Class cl = env.getClass(); - Field field = cl.getDeclaredField("m"); - field.setAccessible(true); - Map writableEnv = (Map) field.get(env); - writableEnv.put(key, value); - } catch (Exception e) { - throw new IllegalStateException("Failed to set environment variable", e); - } - } }