Code Review
/
policy
/
engine.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
[POLICY-122] Policy GUI Fixes
[policy/engine.git]
/
PolicyEngineClient
/
src
/
main
/
java
/
org
/
openecomp
/
policyEngine
/
GeneralTestClient.java
diff --git
a/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/GeneralTestClient.java
b/PolicyEngineClient/src/main/java/org/openecomp/policyEngine/GeneralTestClient.java
index
c78fc6f
..
4298e81
100644
(file)
--- a/
PolicyEngineClient/src/main/java/org/openecomp/policyEngine/GeneralTestClient.java
+++ b/
PolicyEngineClient/src/main/java/org/openecomp/policyEngine/GeneralTestClient.java
@@
-47,6
+47,8
@@
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.openecomp.policy.api.PolicyEngine;
import org.openecomp.policy.api.PolicyEngineException;
import org.json.simple.parser.JSONParser;
import org.openecomp.policy.api.PolicyEngine;
import org.openecomp.policy.api.PolicyEngineException;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
/**
* Class reads from .testCases file and run the test cases available in the file
/**
* Class reads from .testCases file and run the test cases available in the file
@@
-58,6
+60,9
@@
import org.openecomp.policy.api.PolicyEngineException;
*
*/
public class GeneralTestClient {
*
*/
public class GeneralTestClient {
+
+ private static final Logger LOGGER = FlexLogger.getLogger(GeneralTestClient.class);
+
static int totalTC = 0, passTC = 0, failTC = 0;
public static void main(String[] args) {
static int totalTC = 0, passTC = 0, failTC = 0;
public static void main(String[] args) {
@@
-121,8
+126,8
@@
public class GeneralTestClient {
for (Object jsonObject : jsonObjectArray) {
totalTC++;
totalTCforFile++;
for (Object jsonObject : jsonObjectArray) {
totalTC++;
totalTCforFile++;
- ArrayList<String> expectedResult = new ArrayList<
String
>();
- ArrayList<String> resultReceived = new ArrayList<
String
>();
+ ArrayList<String> expectedResult = new ArrayList<>();
+ ArrayList<String> resultReceived = new ArrayList<>();
JSONObject testCase = (JSONObject) jsonObject;
// get a String from the JSON object
long id = (long) testCase.get("id");
JSONObject testCase = (JSONObject) jsonObject;
// get a String from the JSON object
long id = (long) testCase.get("id");
@@
-150,7
+155,7
@@
public class GeneralTestClient {
.get("ECOMPName");
String configName = (String) testCase
.get("ConfigName");
.get("ECOMPName");
String configName = (String) testCase
.get("ConfigName");
- Map<String, String> configAttributes = new HashMap<
String, String
>();
+ Map<String, String> configAttributes = new HashMap<>();
configAttributes.put("key", "value");
JSONArray configAttributesJSON = (JSONArray) testCase
.get("configAttributes");
configAttributes.put("key", "value");
JSONArray configAttributesJSON = (JSONArray) testCase
.get("configAttributes");
@@
-186,7
+191,7
@@
public class GeneralTestClient {
break;
case "getAction":
break;
case "getAction":
- Map<String, String> eventAttributes = new HashMap<
String, String
>();
+ Map<String, String> eventAttributes = new HashMap<>();
eventAttributes.put("Key", "Value");
JSONArray eventAttributesJSON = (JSONArray) testCase
.get("eventAttributes");
eventAttributes.put("Key", "Value");
JSONArray eventAttributesJSON = (JSONArray) testCase
.get("eventAttributes");
@@
-223,7
+228,7
@@
public class GeneralTestClient {
case "getDecision":
eCOMPComponentName = (String) testCase
.get("ECOMPName");
case "getDecision":
eCOMPComponentName = (String) testCase
.get("ECOMPName");
- Map<String, String> decisionAttributes = new HashMap<
String, String
>();
+ Map<String, String> decisionAttributes = new HashMap<>();
decisionAttributes.put("Key", "Value");
JSONArray decisionAttributesJSON = (JSONArray) testCase
.get("decisionAttributes");
decisionAttributes.put("Key", "Value");
JSONArray decisionAttributesJSON = (JSONArray) testCase
.get("decisionAttributes");
@@
-275,29
+280,26
@@
public class GeneralTestClient {
}
} catch (PolicyEngineException e) {
}
} catch (PolicyEngineException e) {
- // TODO Auto-generated catch block
printResult(id, testFor, testCaseDescription, "FAILED");
failTCforFile++;
failTC++;
printResult(id, testFor, testCaseDescription, "FAILED");
failTCforFile++;
failTC++;
-
e.printStackTrace(
);
+
LOGGER.error("Exception Occured"+e
);
} catch (Exception e) {
} catch (Exception e) {
- // TODO Auto-generated catch block
printResult(id, testFor, testCaseDescription, "FAILED");
failTCforFile++;
failTC++;
printResult(id, testFor, testCaseDescription, "FAILED");
failTCforFile++;
failTC++;
-
e.printStackTrace(
);
+
LOGGER.error("Exception Occured"+e
);
}
}
} catch (FileNotFoundException ex) {
}
}
} catch (FileNotFoundException ex) {
-
ex.printStackTrace(
);
+
LOGGER.error("Exception Occured due to File not found"+ex
);
} catch (IOException ex) {
} catch (IOException ex) {
-
ex.printStackTrace(
);
+
LOGGER.error("Exception Occured"+ex
);
} catch (NullPointerException ex) {
} catch (NullPointerException ex) {
-
ex.printStackTrace(
);
+
LOGGER.error("Exception Occured due to Null Pointer"+ex
);
} catch (org.json.simple.parser.ParseException e) {
} catch (org.json.simple.parser.ParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.error("Exception Occured while Parsing"+e);
}
}
System.out.println("\n\n\t Summary for the file: TOTAL: "
}
}
System.out.println("\n\n\t Summary for the file: TOTAL: "