aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/templates/template.demo.v1.0.0/template.demo
diff options
context:
space:
mode:
authorMagnusen, Drew (dm741q) <dm741q@att.com>2017-08-24 11:37:46 -0500
committerMagnusen, Drew (dm741q) <dm741q@att.com>2017-08-28 13:07:09 -0500
commit11e0afc41aa47b9b5fe36c6c654c5b7493e4ba46 (patch)
treeb05742106ad95c9f47a006f36eb87aabb784ca1e /controlloop/templates/template.demo.v1.0.0/template.demo
parentd03507850e293674cc118f76bab0629d457179ae (diff)
Removal of sys.out/err with logger messages
Removed any use of System.out.println or System.err.println and replaced with relevant logger statements. Issue-ID: POLICY-176 Change-Id: I91513267635bfb2a34f2a9650c48f367d53fc842 Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
Diffstat (limited to 'controlloop/templates/template.demo.v1.0.0/template.demo')
-rw-r--r--controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestAPPCPayload.java5
-rw-r--r--controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestFirewallDemo.java47
-rw-r--r--controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestMSO.java10
3 files changed, 35 insertions, 27 deletions
diff --git a/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestAPPCPayload.java b/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestAPPCPayload.java
index 73501bce5..42b28d2f4 100644
--- a/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestAPPCPayload.java
+++ b/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestAPPCPayload.java
@@ -30,9 +30,12 @@ import org.onap.policy.appc.util.Serialization;
import org.onap.policy.vnf.trafficgenerator.PGRequest;
import org.onap.policy.vnf.trafficgenerator.PGStream;
import org.onap.policy.vnf.trafficgenerator.PGStreams;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class TestAPPCPayload {
+ private static final Logger logger = LoggerFactory.getLogger(TestAPPCPayload.class);
@Test
public void test() {
PGRequest request = new PGRequest();
@@ -52,7 +55,7 @@ public class TestAPPCPayload {
appc.Action = "ModifyConfig";
appc.Payload = new HashMap<String, Object>();
appc.Payload.put("pg-streams", request);
- System.out.println(Serialization.gsonPretty.toJson(appc));
+ logger.debug(Serialization.gsonPretty.toJson(appc));
}
}
diff --git a/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestFirewallDemo.java b/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestFirewallDemo.java
index e48aafdad..2cfead157 100644
--- a/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestFirewallDemo.java
+++ b/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestFirewallDemo.java
@@ -50,12 +50,13 @@ import org.onap.policy.controlloop.ControlLoopEventStatus;
import org.onap.policy.controlloop.ControlLoopTargetType;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.appc.util.Serialization;
-
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class TestFirewallDemo {
-
+ private static final Logger logger = LoggerFactory.getLogger(TestFirewallDemo.class);
@Test
public void testvDNS() throws IOException {
//
@@ -105,8 +106,8 @@ public class TestFirewallDemo {
invalidEvent.AAI.put("vserver.vserver-name", "vserver-name-16102016-aai3255-data-11-1");
invalidEvent.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
- System.out.println("----- Invalid ONSET -----");
- System.out.println(Serialization.gsonPretty.toJson(invalidEvent));
+ logger.debug("----- Invalid ONSET -----");
+ logger.debug(Serialization.gsonPretty.toJson(invalidEvent));
//
// Insert invalid DCAE Event into memory
@@ -131,8 +132,8 @@ public class TestFirewallDemo {
onsetEvent.AAI.put("vserver.vserver-name", "vserver-name-16102016-aai3255-data-11-1");
onsetEvent.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
- System.out.println("----- ONSET -----");
- System.out.println(Serialization.gsonPretty.toJson(onsetEvent));
+ logger.debug("----- ONSET -----");
+ logger.debug(Serialization.gsonPretty.toJson(onsetEvent));
//
// Insert first DCAE ONSET Event into memory
@@ -221,8 +222,8 @@ public class TestFirewallDemo {
invalidEvent.AAI.put("generic-vnf.vnf-id", "foo");
invalidEvent.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
- System.out.println("----- Invalid ONSET -----");
- System.out.println(Serialization.gsonPretty.toJson(invalidEvent));
+ logger.debug("----- Invalid ONSET -----");
+ logger.debug(Serialization.gsonPretty.toJson(invalidEvent));
//
// Insert invalid DCAE Event into memory
@@ -248,8 +249,8 @@ public class TestFirewallDemo {
//onsetEvent.AAI.put("vserver.vserver-name", "vserver-name-16102016-aai3255-data-11-1");
onsetEvent.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
- System.out.println("----- ONSET -----");
- System.out.println(Serialization.gsonPretty.toJson(onsetEvent));
+ logger.debug("----- ONSET -----");
+ logger.debug(Serialization.gsonPretty.toJson(onsetEvent));
//
// Insert first DCAE ONSET Event into memory
@@ -282,8 +283,8 @@ public class TestFirewallDemo {
//subOnsetEvent.AAI.put("vserver.vserver-name", "vserver-name-16102016-aai3255-data-11-1");
subOnsetEvent.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
- System.out.println("----- Subsequent ONSET -----");
- System.out.println(Serialization.gsonPretty.toJson(subOnsetEvent));
+ logger.debug("----- Subsequent ONSET -----");
+ logger.debug(Serialization.gsonPretty.toJson(subOnsetEvent));
//
// Insert subsequent DCAE ONSET Event into memory
@@ -320,8 +321,8 @@ public class TestFirewallDemo {
responseStatus1.Code = 100;
response1.Status = responseStatus1;
//
- System.out.println("----- APP-C RESPONSE 100 -----");
- System.out.println(Serialization.gsonPretty.toJson(response1));
+ logger.debug("----- APP-C RESPONSE 100 -----");
+ logger.debug(Serialization.gsonPretty.toJson(response1));
//
// Insert APPC Response into memory
//
@@ -347,8 +348,8 @@ public class TestFirewallDemo {
responseStatus2.Code = 400;
response2.Status = responseStatus2;
//
- System.out.println("----- APP-C RESPONSE 400 -----");
- System.out.println(Serialization.gsonPretty.toJson(response2));
+ logger.debug("----- APP-C RESPONSE 400 -----");
+ logger.debug(Serialization.gsonPretty.toJson(response2));
//
// Insert APPC Response into memory
//
@@ -385,9 +386,9 @@ public class TestFirewallDemo {
}
public static void dumpFacts(KieSession kieSession) {
- System.out.println("Fact Count: " + kieSession.getFactCount());
+ logger.debug("Fact Count: {}", kieSession.getFactCount());
for (FactHandle handle : kieSession.getFactHandles()) {
- System.out.println("FACT: " + handle);
+ logger.debug("FACT: {}", handle);
}
}
@@ -414,7 +415,7 @@ public class TestFirewallDemo {
KieModuleModel kModule = ks.newKieModuleModel();
- System.out.println("KMODULE:" + System.lineSeparator() + kModule.toXML());
+ logger.debug("KMODULE: {} {}", System.lineSeparator(), kModule.toXML());
//
// Generate our drools rule from our template
@@ -452,18 +453,18 @@ public class TestFirewallDemo {
Results results = builder.getResults();
if (results.hasMessages(Message.Level.ERROR)) {
for (Message msg : results.getMessages()) {
- System.err.println(msg.toString());
+ logger.error("{}", msg);
}
throw new RuntimeException("Drools Rule has Errors");
}
for (Message msg : results.getMessages()) {
- System.out.println(msg.toString());
+ logger.debug("{}", msg);
}
//
// Create our kie Session and container
//
ReleaseId releaseId = ks.getRepository().getDefaultReleaseId();
- System.out.println(releaseId);
+ logger.debug("{}", releaseId);
KieContainer kContainer = ks.newKieContainer(releaseId);
return kContainer.newKieSession();
@@ -585,7 +586,7 @@ public class TestFirewallDemo {
ruleContents = m.replaceAll(appcTopic);
}
- System.out.println(ruleContents);
+ logger.debug(ruleContents);
return ruleContents;
}
diff --git a/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestMSO.java b/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestMSO.java
index a960661ee..fab0961c5 100644
--- a/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestMSO.java
+++ b/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestMSO.java
@@ -36,19 +36,23 @@ import org.onap.policy.mso.MSORequestParameters;
import org.onap.policy.aai.AAINQF199.AAINQF199Response;
import org.onap.policy.aai.AAINQF199.AAINQF199ResponseWrapper;
import org.onap.policy.mso.util.Serialization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
import com.google.gson.stream.JsonReader;
public class TestMSO {
+ private static final Logger logger = LoggerFactory.getLogger(TestMSO.class);
+
@Test
public void test() throws FileNotFoundException {
Gson gson = new Gson();
JsonReader reader = new JsonReader(new FileReader("src/test/resources/aairesponse.json"));
AAINQF199Response response = gson.fromJson(reader, AAINQF199Response.class);
- System.out.println(Serialization.gsonPretty.toJson(response));
+ logger.debug(Serialization.gsonPretty.toJson(response));
AAINQF199ResponseWrapper aainqf199ResponseWrapper = new AAINQF199ResponseWrapper(UUID.randomUUID(), response);
@@ -152,8 +156,8 @@ public class TestMSO {
//
// print MSO request for debug
//
- System.out.println("MSO request sent:");
- System.out.println(Serialization.gsonPretty.toJson(request));
+ logger.debug("MSO request sent:");
+ logger.debug(Serialization.gsonPretty.toJson(request));
}
}