From 5c0ab1dfa4aab9cd83d5baac17710963a11b22d9 Mon Sep 17 00:00:00 2001 From: mojahidi Date: Tue, 26 Sep 2017 17:39:23 +0530 Subject: Increased test coverage for appc-java-client Added Junit test cases to increase test coverage for appc-java-client Change-Id: I31154acea348f50da5df47262611bfb108a4ed3a Issue-ID:APPC-223 Signed-off-by: mojahidi --- .../openecomp/appc/simulator/client/impl/JsonRequestHandler.java | 6 +++++- .../openecomp/appc/simulator/client/impl/JsonResponseHandler.java | 4 ++-- .../java/org/openecomp/appc/simulator/client/main/ClientRunner.java | 5 +++-- 3 files changed, 10 insertions(+), 5 deletions(-) (limited to 'appc-client/client-simulator/src/main') diff --git a/appc-client/client-simulator/src/main/java/org/openecomp/appc/simulator/client/impl/JsonRequestHandler.java b/appc-client/client-simulator/src/main/java/org/openecomp/appc/simulator/client/impl/JsonRequestHandler.java index 3180e7849..e3a86e01a 100644 --- a/appc-client/client-simulator/src/main/java/org/openecomp/appc/simulator/client/impl/JsonRequestHandler.java +++ b/appc-client/client-simulator/src/main/java/org/openecomp/appc/simulator/client/impl/JsonRequestHandler.java @@ -50,7 +50,7 @@ import java.util.Properties; public class JsonRequestHandler implements RequestHandler { - private enum modeT { + private enum modeT { SYNCH, ASYNCH } @@ -79,6 +79,10 @@ public class JsonRequestHandler implements RequestHandler { exceptRpcMap = prepareExceptionsMap(); } + public JsonRequestHandler(){ + + } + private HashMap prepareExceptionsMap() { exceptRpcMap = new HashMap<>(); diff --git a/appc-client/client-simulator/src/main/java/org/openecomp/appc/simulator/client/impl/JsonResponseHandler.java b/appc-client/client-simulator/src/main/java/org/openecomp/appc/simulator/client/impl/JsonResponseHandler.java index aef034f53..5f14bb849 100644 --- a/appc-client/client-simulator/src/main/java/org/openecomp/appc/simulator/client/impl/JsonResponseHandler.java +++ b/appc-client/client-simulator/src/main/java/org/openecomp/appc/simulator/client/impl/JsonResponseHandler.java @@ -65,7 +65,7 @@ public class JsonResponseHandler implements ResponseHandler { int errorCode = 0; boolean isFinal = true; try { - JsonNode code = OBJECT_MAPPER.readTree(output).findValue("status").findValue("code"); + JsonNode code= OBJECT_MAPPER.readTree(output).findValue("status").findValue("code"); if (code == null) { LOG.error("Status code doesn't exist. Malformed response : " + output); @@ -130,7 +130,7 @@ public class JsonResponseHandler implements ResponseHandler { this.flushToFile(output, ".error", isFinal); } - private void flushToFile(String output, String suffix, boolean isFinal) { + private void flushToFile(String output, String suffix, boolean isFinal) { try (FileWriter fileWriter = new FileWriter(fileName + suffix);){ LOG.info("Output file : " + fileName + suffix); diff --git a/appc-client/client-simulator/src/main/java/org/openecomp/appc/simulator/client/main/ClientRunner.java b/appc-client/client-simulator/src/main/java/org/openecomp/appc/simulator/client/main/ClientRunner.java index d28927302..704fbee80 100644 --- a/appc-client/client-simulator/src/main/java/org/openecomp/appc/simulator/client/main/ClientRunner.java +++ b/appc-client/client-simulator/src/main/java/org/openecomp/appc/simulator/client/main/ClientRunner.java @@ -37,6 +37,7 @@ import java.util.List; import java.util.Properties; public class ClientRunner { + public static void main(String ... args) throws Exception { String folder = args[0]; if (folder == null) { @@ -66,7 +67,7 @@ public class ClientRunner { // System.exit(0); } - private static Properties getProperties(String folder) { + private static Properties getProperties(String folder) { Properties prop = new Properties(); InputStream conf = null; @@ -91,7 +92,7 @@ public class ClientRunner { return prop; } - private static List getJsonFiles(String folder) throws FileNotFoundException { + private static List getJsonFiles(String folder) throws FileNotFoundException { Path dir = Paths.get(folder); FileFilter fileFilter = new WildcardFileFilter("*.json"); return new ArrayList(Arrays.asList(dir.toFile().listFiles(fileFilter))); -- cgit 1.2.3-korg