From: Varun Gudisena Date: Wed, 4 Oct 2017 06:13:29 +0000 (-0500) Subject: Add unit test cases X-Git-Tag: v1.0.1~15 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=c1db5e88f5db89df99cc2cccd25e830d6bfaac1f;p=dmaap%2Fmessagerouter%2Fmessageservice.git Add unit test cases Issue-Id: DMAAP-151 Change-Id: I380fd88c4cbe51e4b13b38d71a9d492ff864813a Signed-off-by: Varun Gudisena --- diff --git a/src/test/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMapTest.java b/src/test/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMapTest.java index df3695e..d4e9838 100644 --- a/src/test/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMapTest.java +++ b/src/test/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMapTest.java @@ -70,15 +70,20 @@ public class ServicePropertiesMapTest { @Test() public void testRefreshJsonFile() throws Exception { - Path resourceDirectory = Paths.get("src/test/resources"); - map.refresh(new File(resourceDirectory+"\\"+"test.json")); - assertTrue(true); + //Path resourceDirectory = Paths.get("src/test/resources"); + // map.refresh(new File(resourceDirectory+"\\"+"test.json")); + ClassLoader classLoader = getClass().getClassLoader(); + map.refresh(new File(classLoader.getResource("test.json").getFile())); + + assertTrue(true); } @Test public void testRefreshPropsFile() throws Exception { - Path resourceDirectory = Paths.get("src/test/resources"); - map.refresh(new File(resourceDirectory+"\\"+"test.properties")); + /*Path resourceDirectory = Paths.get("src/test/resources"); + map.refresh(new File(resourceDirectory+"\\"+"test.properties"));*/ + ClassLoader classLoader = getClass().getClassLoader(); + map.refresh(new File(classLoader.getResource("test.json").getFile())); assertTrue(true); } diff --git a/src/test/resources/test.json b/src/test/resources/test.json new file mode 100644 index 0000000..1eac3d1 --- /dev/null +++ b/src/test/resources/test.json @@ -0,0 +1,3 @@ +{ + "testKey":"testValue" +} \ No newline at end of file diff --git a/src/test/resources/test.properties b/src/test/resources/test.properties new file mode 100644 index 0000000..e53f196 --- /dev/null +++ b/src/test/resources/test.properties @@ -0,0 +1 @@ +man=power \ No newline at end of file