summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-11-26 14:31:28 +0000
committerliamfallon <liam.fallon@est.tech>2019-11-26 14:39:59 +0000
commit8a3a78067eb678f3e51e2199a57b713e3ffcfb29 (patch)
tree3e29726e0ef38d3e1fb25fd6ec7c0703ba2904ec
parent0b98743df167bf38a874f00be730375b7d1558d7 (diff)
Reduce verbosity of logging during unit test
Logging dialled back in logback.xml files and on ligging statements in unit test java code. Issue-ID: POLICY-2272 Change-Id: I3b9a46d8993b1571c8dc62687a9c136af46c1f51 Signed-off-by: liamfallon <liam.fallon@est.tech>
-rw-r--r--auth/cli-editor/src/test/resources/logback-test.xml2
-rw-r--r--context/context-management/src/test/resources/logback-test.xml2
-rw-r--r--core/core-infrastructure/src/test/resources/logback-test.xml2
-rw-r--r--core/core-protocols/src/test/resources/logback-test.xml2
-rw-r--r--examples/examples-aadm/src/test/resources/logback-test.xml4
-rw-r--r--examples/examples-myfirstpolicy/src/test/resources/logback-test.xml4
-rw-r--r--examples/examples-pcvs/src/test/resources/logback-test.xml4
-rw-r--r--examples/examples-servlet/src/main/resources/webapp/WEB-INF/classes/logback.xml2
-rw-r--r--model/basic-model/src/test/resources/logback-test.xml2
-rw-r--r--model/context-model/src/test/resources/logback-test.xml6
-rw-r--r--model/engine-model/src/test/resources/logback-test.xml2
-rw-r--r--model/event-model/src/test/resources/logback-test.xml4
-rw-r--r--model/model-api/src/test/resources/logback-test.xml2
-rw-r--r--model/policy-model/src/test/resources/logback-test.xml2
-rw-r--r--packages/apex-pdp-package-full/src/main/resources/logback-default.xml2
-rw-r--r--packages/apex-pdp-package-full/src/main/resources/logback-logic.xml2
-rw-r--r--packages/apex-pdp-package-full/src/main/resources/logback-server.xml6
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/logback-test.xml6
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/resources/logback-test.xml2
-rw-r--r--testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml6
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/EventGenerator.java21
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java16
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java4
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java21
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java20
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java50
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java50
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java20
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java23
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java74
30 files changed, 194 insertions, 169 deletions
diff --git a/auth/cli-editor/src/test/resources/logback-test.xml b/auth/cli-editor/src/test/resources/logback-test.xml
index 1a2026950..6a6899e40 100644
--- a/auth/cli-editor/src/test/resources/logback-test.xml
+++ b/auth/cli-editor/src/test/resources/logback-test.xml
@@ -64,7 +64,7 @@
</encoder>
</appender>
- <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="INFO" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
diff --git a/context/context-management/src/test/resources/logback-test.xml b/context/context-management/src/test/resources/logback-test.xml
index 3c12577eb..0e9fbf1cd 100644
--- a/context/context-management/src/test/resources/logback-test.xml
+++ b/context/context-management/src/test/resources/logback-test.xml
@@ -64,7 +64,7 @@
<appender-ref ref="CTXT_FILE" />
</logger>
- <logger name="org.onap.policy.apex.core.context" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context" level="INFO" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
</configuration>
diff --git a/core/core-infrastructure/src/test/resources/logback-test.xml b/core/core-infrastructure/src/test/resources/logback-test.xml
index 4ece82083..c52f2ded6 100644
--- a/core/core-infrastructure/src/test/resources/logback-test.xml
+++ b/core/core-infrastructure/src/test/resources/logback-test.xml
@@ -60,7 +60,7 @@
</encoder>
</appender>
- <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="INFO" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
diff --git a/core/core-protocols/src/test/resources/logback-test.xml b/core/core-protocols/src/test/resources/logback-test.xml
index 4ece82083..c52f2ded6 100644
--- a/core/core-protocols/src/test/resources/logback-test.xml
+++ b/core/core-protocols/src/test/resources/logback-test.xml
@@ -60,7 +60,7 @@
</encoder>
</appender>
- <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="INFO" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
diff --git a/examples/examples-aadm/src/test/resources/logback-test.xml b/examples/examples-aadm/src/test/resources/logback-test.xml
index 4b9258c40..d8e25806f 100644
--- a/examples/examples-aadm/src/test/resources/logback-test.xml
+++ b/examples/examples-aadm/src/test/resources/logback-test.xml
@@ -60,11 +60,11 @@
</encoder>
</appender>
- <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="INFO" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
- <logger name="org.onap.policy.apex" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex" level="INFO" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
diff --git a/examples/examples-myfirstpolicy/src/test/resources/logback-test.xml b/examples/examples-myfirstpolicy/src/test/resources/logback-test.xml
index ea201e0a9..6676bda38 100644
--- a/examples/examples-myfirstpolicy/src/test/resources/logback-test.xml
+++ b/examples/examples-myfirstpolicy/src/test/resources/logback-test.xml
@@ -60,11 +60,11 @@
</encoder>
</appender>
- <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="INFO" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
- <logger name="org.onap.policy.apex" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex" level="INFO" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
diff --git a/examples/examples-pcvs/src/test/resources/logback-test.xml b/examples/examples-pcvs/src/test/resources/logback-test.xml
index ea201e0a9..6676bda38 100644
--- a/examples/examples-pcvs/src/test/resources/logback-test.xml
+++ b/examples/examples-pcvs/src/test/resources/logback-test.xml
@@ -60,11 +60,11 @@
</encoder>
</appender>
- <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="INFO" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
- <logger name="org.onap.policy.apex" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex" level="INFO" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
diff --git a/examples/examples-servlet/src/main/resources/webapp/WEB-INF/classes/logback.xml b/examples/examples-servlet/src/main/resources/webapp/WEB-INF/classes/logback.xml
index ac15721b9..2ae2fde77 100644
--- a/examples/examples-servlet/src/main/resources/webapp/WEB-INF/classes/logback.xml
+++ b/examples/examples-servlet/src/main/resources/webapp/WEB-INF/classes/logback.xml
@@ -56,7 +56,7 @@
<appender-ref ref="FILE" />
</logger>
- <logger name="org.onap.policy.apex.core.context.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.monitoring" level="INFO" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
diff --git a/model/basic-model/src/test/resources/logback-test.xml b/model/basic-model/src/test/resources/logback-test.xml
index 4ece82083..c52f2ded6 100644
--- a/model/basic-model/src/test/resources/logback-test.xml
+++ b/model/basic-model/src/test/resources/logback-test.xml
@@ -60,7 +60,7 @@
</encoder>
</appender>
- <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="INFO" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
diff --git a/model/context-model/src/test/resources/logback-test.xml b/model/context-model/src/test/resources/logback-test.xml
index 628f02397..af4993550 100644
--- a/model/context-model/src/test/resources/logback-test.xml
+++ b/model/context-model/src/test/resources/logback-test.xml
@@ -40,7 +40,7 @@
<appender-ref ref="STDOUT" />
</logger>
- <logger name="org.onap.policy.apex.core.contextmodel" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.contextmodel" level="INFO" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
@@ -48,7 +48,7 @@
<appender-ref ref="STDOUT" />
</logger>
- <logger name="org.onap.policy.apex.core" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core" level="INFO" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
@@ -68,7 +68,7 @@
</encoder>
</appender>
- <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="INFO" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
diff --git a/model/engine-model/src/test/resources/logback-test.xml b/model/engine-model/src/test/resources/logback-test.xml
index 4ece82083..c52f2ded6 100644
--- a/model/engine-model/src/test/resources/logback-test.xml
+++ b/model/engine-model/src/test/resources/logback-test.xml
@@ -60,7 +60,7 @@
</encoder>
</appender>
- <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="INFO" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
diff --git a/model/event-model/src/test/resources/logback-test.xml b/model/event-model/src/test/resources/logback-test.xml
index 96f8d2ba3..2aff4c2e9 100644
--- a/model/event-model/src/test/resources/logback-test.xml
+++ b/model/event-model/src/test/resources/logback-test.xml
@@ -44,7 +44,7 @@
<appender-ref ref="STDOUT" />
</logger>
- <logger name="org.onap.policy.apex.core" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core" level="INFO" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
@@ -64,7 +64,7 @@
</encoder>
</appender>
- <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="INFO" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
diff --git a/model/model-api/src/test/resources/logback-test.xml b/model/model-api/src/test/resources/logback-test.xml
index 7c3609ee3..2aff4c2e9 100644
--- a/model/model-api/src/test/resources/logback-test.xml
+++ b/model/model-api/src/test/resources/logback-test.xml
@@ -64,7 +64,7 @@
</encoder>
</appender>
- <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="INFO" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
diff --git a/model/policy-model/src/test/resources/logback-test.xml b/model/policy-model/src/test/resources/logback-test.xml
index 7c3609ee3..2aff4c2e9 100644
--- a/model/policy-model/src/test/resources/logback-test.xml
+++ b/model/policy-model/src/test/resources/logback-test.xml
@@ -64,7 +64,7 @@
</encoder>
</appender>
- <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="INFO" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
diff --git a/packages/apex-pdp-package-full/src/main/resources/logback-default.xml b/packages/apex-pdp-package-full/src/main/resources/logback-default.xml
index b96a37686..16246f134 100644
--- a/packages/apex-pdp-package-full/src/main/resources/logback-default.xml
+++ b/packages/apex-pdp-package-full/src/main/resources/logback-default.xml
@@ -57,7 +57,7 @@
<appender-ref ref="FILE" />
</logger>
- <logger name="org.onap.policy.apex.core.context.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.monitoring" level="INFO" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
diff --git a/packages/apex-pdp-package-full/src/main/resources/logback-logic.xml b/packages/apex-pdp-package-full/src/main/resources/logback-logic.xml
index 23ce2b32b..e8b07f1df 100644
--- a/packages/apex-pdp-package-full/src/main/resources/logback-logic.xml
+++ b/packages/apex-pdp-package-full/src/main/resources/logback-logic.xml
@@ -50,7 +50,7 @@
<appender-ref ref="STDOUT" />
</root>
- <logger name="org.onap.policy.apex" level="debug" additivity="false">
+ <logger name="org.onap.policy.apex" level="info" additivity="false">
<appender-ref ref="FILE" />
</logger>
diff --git a/packages/apex-pdp-package-full/src/main/resources/logback-server.xml b/packages/apex-pdp-package-full/src/main/resources/logback-server.xml
index 262c826d8..6f88302f1 100644
--- a/packages/apex-pdp-package-full/src/main/resources/logback-server.xml
+++ b/packages/apex-pdp-package-full/src/main/resources/logback-server.xml
@@ -34,11 +34,11 @@
</encoder>
</appender>
- <root level="debug">
+ <root level="info">
<appender-ref ref="FILE" />
</root>
- <logger name="org.onap.policy.apex.executionlogging" level="debug" additivity="false">
+ <logger name="org.onap.policy.apex.executionlogging" level="info" additivity="false">
<appender-ref ref="FILE" />
</logger>
-</configuration> \ No newline at end of file
+</configuration>
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/logback-test.xml b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/logback-test.xml
index 10cf3cc57..482b395f5 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/logback-test.xml
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/test/resources/logback-test.xml
@@ -60,15 +60,15 @@
</encoder>
</appender>
- <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="INFO" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
- <logger name="org.onap.policy.apex.executionlogging.TaskExecutionLogging" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.executionlogging.TaskExecutionLogging" level="INFO" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
- <logger name="org.onap.policy.apex" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex" level="INFO" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
</configuration>
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/resources/logback-test.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/resources/logback-test.xml
index b5c23f24c..43440971a 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/resources/logback-test.xml
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/resources/logback-test.xml
@@ -44,7 +44,7 @@
</encoder>
</appender>
- <logger name="org.onap.policy.apex.plugins.event.carrier.restserver" level="trace" additivity="false">
+ <logger name="org.onap.policy.apex.plugins.event.carrier.restserver" level="info" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
</configuration>
diff --git a/testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml b/testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml
index 021e55d2a..006555e78 100644
--- a/testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml
+++ b/testsuites/integration/integration-executor-test/src/test/resources/logback-test.xml
@@ -60,15 +60,15 @@
</encoder>
</appender>
- <logger name="org.onap.policy.apex.core.context.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.monitoring" level="INFO" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
- <logger name="org.onap.policy.apex.core.engine.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.engine.monitoring" level="INFO" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
- <logger name="org.onap.policy.apex.executionlogging" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.executionlogging" level="INFO" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/EventGenerator.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/EventGenerator.java
index 6a585d7c5..55b9fa953 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/EventGenerator.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/EventGenerator.java
@@ -5,15 +5,15 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -22,12 +22,17 @@ package org.onap.policy.apex.testsuites.integration.uservice.adapt.events;
import java.util.Random;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* The Class EventGenerator.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class EventGenerator {
+ private static final Logger LOGGER = LoggerFactory.getLogger(EventGenerator.class);
+
private static int nextEventNo = 0;
/**
@@ -576,7 +581,7 @@ public class EventGenerator {
*/
public static void main(final String[] args) {
if (args.length != 2) {
- System.err.println("usage EventGenerator #events XML|JSON");
+ LOGGER.error("usage EventGenerator #events XML|JSON");
return;
}
@@ -584,17 +589,17 @@ public class EventGenerator {
try {
eventCount = Integer.parseInt(args[0]);
} catch (final Exception e) {
- System.err.println("usage EventGenerator #events XML|JSON");
+ LOGGER.error("usage EventGenerator #events XML|JSON");
e.printStackTrace();
return;
}
if (args[1].equalsIgnoreCase("XML")) {
- System.out.println(xmlEvents(eventCount));
+ LOGGER.info(xmlEvents(eventCount));
} else if (args[1].equalsIgnoreCase("JSON")) {
- System.out.println(jsonEvents(eventCount));
+ LOGGER.info(jsonEvents(eventCount));
} else {
- System.err.println("usage EventGenerator #events XML|JSON");
+ LOGGER.error("usage EventGenerator #events XML|JSON");
return;
}
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java
index dcec4a944..7367b0220 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java
@@ -68,8 +68,8 @@ public class JmsEventProducer implements Runnable {
* @throws JMSException the JMS exception
*/
public JmsEventProducer(final String topic, final ConnectionFactory connectionFactory, final String username,
- final String password, final int eventCount, final boolean sendObjects, final long eventInterval)
- throws JMSException {
+ final String password, final int eventCount, final boolean sendObjects, final long eventInterval)
+ throws JMSException {
this.topic = topic;
this.eventCount = eventCount;
this.sendObjects = sendObjects;
@@ -88,7 +88,7 @@ public class JmsEventProducer implements Runnable {
public void run() {
final Topic jmsTopic = new ActiveMQTopic(topic);
try (final Session jmsSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- final MessageProducer jmsProducer = jmsSession.createProducer(jmsTopic)) {
+ final MessageProducer jmsProducer = jmsSession.createProducer(jmsTopic)) {
while (producerThread.isAlive() && !stopFlag) {
ThreadUtilities.sleep(50);
@@ -120,8 +120,8 @@ public class JmsEventProducer implements Runnable {
*/
private void sendEventsToTopic(final Session jmsSession, final MessageProducer jmsProducer) throws JMSException {
- LOGGER.info("{} : sending events to JMS server, event count {}", this.getClass().getCanonicalName(),
- eventCount);
+ LOGGER.debug("{} : sending events to JMS server, event count {}", this.getClass().getCanonicalName(),
+ eventCount);
for (int i = 0; i < eventCount; i++) {
ThreadUtilities.sleep(eventInterval);
@@ -135,7 +135,7 @@ public class JmsEventProducer implements Runnable {
jmsProducer.send(jmsMessage);
eventsSentCount++;
}
- LOGGER.info("{} : completed, number of events sent", this.getClass().getCanonicalName(), eventsSentCount);
+ LOGGER.debug("{} : completed, number of events sent", this.getClass().getCanonicalName(), eventsSentCount);
}
/**
@@ -151,13 +151,13 @@ public class JmsEventProducer implements Runnable {
* Shutdown.
*/
public void shutdown() {
- LOGGER.info("{} : stopping", this.getClass().getCanonicalName());
+ LOGGER.debug("{} : stopping", this.getClass().getCanonicalName());
stopFlag = true;
while (producerThread.isAlive()) {
ThreadUtilities.sleep(10);
}
- LOGGER.info("{} : stopped", this.getClass().getCanonicalName());
+ LOGGER.debug("{} : stopped", this.getClass().getCanonicalName());
}
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java
index 94155c1a5..2fd174651 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java
@@ -106,7 +106,7 @@ public class JmsEventSubscriber implements Runnable {
throw new ApexEventRuntimeException("JMS event consumption failed", e);
}
- LOGGER.info("{} : event reception completed", this.getClass().getCanonicalName());
+ LOGGER.debug("{} : event reception completed", this.getClass().getCanonicalName());
}
/**
@@ -131,7 +131,7 @@ public class JmsEventSubscriber implements Runnable {
}
connection.close();
- LOGGER.info("{} : stopped", this.getClass().getCanonicalName());
+ LOGGER.debug("{} : stopped", this.getClass().getCanonicalName());
}
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java
index dd46f7f74..e0f5c23c4 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java
@@ -29,6 +29,8 @@ import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.serialization.StringSerializer;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.testsuites.integration.uservice.adapt.events.EventGenerator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The Class KafkaEventProducer.
@@ -36,6 +38,9 @@ import org.onap.policy.apex.testsuites.integration.uservice.adapt.events.EventGe
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class KafkaEventProducer implements Runnable {
+ // Get a reference to the logger
+ private static final Logger LOGGER = LoggerFactory.getLogger(KafkaEventProducer.class);
+
private final String topic;
private final SharedKafkaTestResource sharedKafkaTestResource;
private final int eventCount;
@@ -101,12 +106,12 @@ public class KafkaEventProducer implements Runnable {
* @param producer the producer
*/
private void sendEventsToTopic(final Producer<String, String> producer) {
- System.out.println(KafkaEventProducer.class.getCanonicalName()
- + ": sending events to Kafka server , event count " + eventCount + ", xmlEvents " + xmlEvents);
+ LOGGER.debug("{} : sending events to Kafka server, event count {}, xmlEvents {}",
+ KafkaEventProducer.class.getCanonicalName(), eventCount, xmlEvents);
for (int i = 0; i < eventCount; i++) {
- System.out.println(KafkaEventProducer.class.getCanonicalName() + ": waiting " + eventInterval
- + " milliseconds before sending next event");
+ LOGGER.debug("{} : waiting {} milliseconds before sending next event",
+ KafkaEventProducer.class.getCanonicalName(), eventInterval);
ThreadUtilities.sleep(eventInterval);
String eventString = null;
@@ -118,9 +123,9 @@ public class KafkaEventProducer implements Runnable {
producer.send(new ProducerRecord<String, String>(topic, "Event" + i + "Of" + eventCount, eventString));
producer.flush();
eventsSentCount++;
- System.out.println("****** Sent event No. " + eventsSentCount + " ******");
+ LOGGER.debug("****** Sent event No. {} ******", eventsSentCount);
}
- System.out.println(KafkaEventProducer.class.getCanonicalName() + ": completed");
+ LOGGER.debug("{}: completed", KafkaEventProducer.class.getCanonicalName());
}
/**
@@ -136,7 +141,7 @@ public class KafkaEventProducer implements Runnable {
* Shutdown.
*/
public void shutdown() {
- System.out.println(KafkaEventProducer.class.getCanonicalName() + ": stopping");
+ LOGGER.debug("{} : stopping", KafkaEventProducer.class.getCanonicalName());
stopFlag = true;
@@ -144,6 +149,6 @@ public class KafkaEventProducer implements Runnable {
ThreadUtilities.sleep(10);
}
- System.out.println(KafkaEventProducer.class.getCanonicalName() + ": stopped");
+ LOGGER.debug("{} : stopped", KafkaEventProducer.class.getCanonicalName());
}
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java
index dbe8d0294..da2cc3344 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java
@@ -32,6 +32,8 @@ import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The Class KafkaEventSubscriber.
@@ -39,6 +41,9 @@ import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class KafkaEventSubscriber implements Runnable {
+ // Get a reference to the logger
+ private static final Logger LOGGER = LoggerFactory.getLogger(KafkaEventSubscriber.class);
+
private static final Duration POLL_DURATION = Duration.ofMillis(100);
private final String topic;
@@ -59,11 +64,9 @@ public class KafkaEventSubscriber implements Runnable {
throws MessagingException {
this.topic = topic;
-
final Properties consumerProperties = new Properties();
consumerProperties.put("group.id", "test");
-
consumer = sharedKafkaTestResource.getKafkaTestUtils().getKafkaConsumer(StringDeserializer.class,
StringDeserializer.class, consumerProperties);
consumer.subscribe(Arrays.asList(topic));
@@ -77,17 +80,16 @@ public class KafkaEventSubscriber implements Runnable {
*/
@Override
public void run() {
- System.out.println(KafkaEventSubscriber.class.getCanonicalName()
- + ": receiving events from Kafka server on topic " + topic);
+ LOGGER.debug("{}: receiving events from Kafka server on topic {}",
+ KafkaEventSubscriber.class.getCanonicalName(), topic);
while (subscriberThread.isAlive() && !subscriberThread.isInterrupted()) {
try {
final ConsumerRecords<String, String> records = consumer.poll(POLL_DURATION);
for (final ConsumerRecord<String, String> record : records) {
eventsReceivedCount++;
- System.out.println("****** Received event No. " + eventsReceivedCount + " ******");
- System.out.println("offset=" + record.offset());
- System.out.println("key=" + record.key());
+ LOGGER.debug("****** Received event No. {} ******\noffset={}\nkey={}", eventsReceivedCount,
+ record.offset(), record.key());
}
} catch (final Exception e) {
// Thread interrupted
@@ -95,7 +97,7 @@ public class KafkaEventSubscriber implements Runnable {
}
}
- System.out.println(KafkaEventSubscriber.class.getCanonicalName() + ": event reception completed");
+ LOGGER.debug("{}: event reception completed", KafkaEventSubscriber.class.getCanonicalName());
}
/**
@@ -118,6 +120,6 @@ public class KafkaEventSubscriber implements Runnable {
}
consumer.close();
- System.out.println(KafkaEventSubscriber.class.getCanonicalName() + ": stopped");
+ LOGGER.debug("{} : stopped", KafkaEventSubscriber.class.getCanonicalName());
}
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java
index 46973290a..023ff9998 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java
@@ -5,15 +5,15 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -25,11 +25,15 @@ import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStri
import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageListener;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.testsuites.integration.uservice.adapt.events.EventGenerator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The Class WebSocketEventProducerClient.
*/
public class WebSocketEventProducerClient implements WsStringMessageListener {
+ private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketEventProducerClient.class);
+
private final String host;
private final int port;
private final int eventCount;
@@ -50,7 +54,7 @@ public class WebSocketEventProducerClient implements WsStringMessageListener {
* @throws MessagingException the messaging exception
*/
public WebSocketEventProducerClient(final String host, final int port, final int eventCount,
- final boolean xmlEvents, final long eventInterval) throws MessagingException {
+ final boolean xmlEvents, final long eventInterval) throws MessagingException {
this.host = host;
this.port = port;
this.eventCount = eventCount;
@@ -60,20 +64,20 @@ public class WebSocketEventProducerClient implements WsStringMessageListener {
client = new WsStringMessageClient(host, port);
client.start(this);
- System.out.println(WebSocketEventProducerClient.class.getCanonicalName() + ": host " + host + ", port " + port
- + ", event count " + eventCount + ", xmlEvents " + xmlEvents);
+ LOGGER.debug("{}: host {}, port {}, event count {}, xmlEvents {}",
+ WebSocketEventProducerClient.class.getCanonicalName(), host, port, eventCount, xmlEvents);
}
/**
* Send events.
*/
public void sendEvents() {
- System.out.println(WebSocketEventProducerClient.class.getCanonicalName() + ": sending events on host " + host
- + ", port " + port + ", event count " + eventCount + ", xmlEvents " + xmlEvents);
+ LOGGER.debug("{}: sending events on host {}, port {}, event count {}, xmlEvents {}",
+ WebSocketEventProducerClient.class.getCanonicalName(), host, port, eventCount, xmlEvents);
for (int i = 0; i < eventCount; i++) {
- System.out.println(WebSocketEventProducerClient.class.getCanonicalName() + ": waiting " + eventInterval
- + " milliseconds before sending next event");
+ LOGGER.debug("{}: waiting {} milliseconds before sending next event",
+ WebSocketEventProducerClient.class.getCanonicalName(), eventInterval);
ThreadUtilities.sleep(eventInterval);
String eventString = null;
@@ -84,10 +88,10 @@ public class WebSocketEventProducerClient implements WsStringMessageListener {
}
client.sendString(eventString);
eventsSentCount++;
- System.out.println(WebSocketEventProducerClient.class.getCanonicalName() + ": host " + host + ", port "
- + port + ", sent event " + eventString);
+ LOGGER.debug("{}: host {}, port {}, sent event {}", WebSocketEventProducerClient.class.getCanonicalName(),
+ host, port, eventString);
}
- System.out.println(WebSocketEventProducerClient.class.getCanonicalName() + ": completed");
+ LOGGER.debug("{}: completed", WebSocketEventProducerClient.class.getCanonicalName());
}
/**
@@ -104,7 +108,7 @@ public class WebSocketEventProducerClient implements WsStringMessageListener {
*/
public void shutdown() {
client.stop();
- System.out.println(WebSocketEventProducerClient.class.getCanonicalName() + ": stopped");
+ LOGGER.debug("{}: stopped", WebSocketEventProducerClient.class.getCanonicalName());
}
/**
@@ -112,8 +116,8 @@ public class WebSocketEventProducerClient implements WsStringMessageListener {
*/
@Override
public void receiveString(final String eventString) {
- System.out.println(WebSocketEventProducerServer.class.getCanonicalName() + ": host " + host + ", port " + port
- + ", received event " + eventString);
+ LOGGER.debug("{}: host {}, port {}, received event {}", WebSocketEventProducerServer.class.getCanonicalName(),
+ host, port, eventString);
}
/**
@@ -124,7 +128,7 @@ public class WebSocketEventProducerClient implements WsStringMessageListener {
*/
public static void main(final String[] args) throws MessagingException {
if (args.length != 5) {
- System.err.println("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
+ LOGGER.error("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
return;
}
@@ -132,7 +136,7 @@ public class WebSocketEventProducerClient implements WsStringMessageListener {
try {
port = Integer.parseInt(args[1]);
} catch (final Exception e) {
- System.err.println("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
+ LOGGER.error("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
e.printStackTrace();
return;
}
@@ -141,7 +145,7 @@ public class WebSocketEventProducerClient implements WsStringMessageListener {
try {
eventCount = Integer.parseInt(args[2]);
} catch (final Exception e) {
- System.err.println("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
+ LOGGER.error("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
e.printStackTrace();
return;
}
@@ -150,7 +154,7 @@ public class WebSocketEventProducerClient implements WsStringMessageListener {
try {
eventInterval = Long.parseLong(args[4]);
} catch (final Exception e) {
- System.err.println("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
+ LOGGER.error("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
e.printStackTrace();
return;
}
@@ -159,12 +163,12 @@ public class WebSocketEventProducerClient implements WsStringMessageListener {
if (args[3].equalsIgnoreCase("XML")) {
xmlEvents = true;
} else if (!args[3].equalsIgnoreCase("JSON")) {
- System.err.println("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
+ LOGGER.error("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
return;
}
- final WebSocketEventProducerClient client =
- new WebSocketEventProducerClient(args[0], port, eventCount, xmlEvents, eventInterval);
+ final WebSocketEventProducerClient client = new WebSocketEventProducerClient(args[0], port, eventCount,
+ xmlEvents, eventInterval);
client.sendEvents();
client.shutdown();
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java
index b75d99ff0..11438d952 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java
@@ -5,15 +5,15 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -25,11 +25,15 @@ import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStri
import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageServer;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.testsuites.integration.uservice.adapt.events.EventGenerator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The Class WebSocketEventProducerServer.
*/
public class WebSocketEventProducerServer implements WsStringMessageListener {
+ private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketEventProducerServer.class);
+
private final int port;
private final int eventCount;
private final boolean xmlEvents;
@@ -48,7 +52,7 @@ public class WebSocketEventProducerServer implements WsStringMessageListener {
* @throws MessagingException the messaging exception
*/
public WebSocketEventProducerServer(final int port, final int eventCount, final boolean xmlEvents,
- final long eventInterval) throws MessagingException {
+ final long eventInterval) throws MessagingException {
this.port = port;
this.eventCount = eventCount;
this.xmlEvents = xmlEvents;
@@ -57,20 +61,20 @@ public class WebSocketEventProducerServer implements WsStringMessageListener {
server = new WsStringMessageServer(port);
server.start(this);
- System.out.println(WebSocketEventProducerServer.class.getCanonicalName() + ": port " + port + ", event count "
- + eventCount + ", xmlEvents " + xmlEvents);
+ LOGGER.debug("{}: port {}, event count {}, xmlEvents {}", WebSocketEventProducerServer.class.getCanonicalName(),
+ port, eventCount, xmlEvents);
}
/**
* Send events.
*/
public void sendEvents() {
- System.out.println(WebSocketEventProducerServer.class.getCanonicalName() + ": sending events on port " + port
- + ", event count " + eventCount + ", xmlEvents " + xmlEvents);
+ LOGGER.debug("{}: sending events on port {}, event count {}, xmlEvents {}",
+ WebSocketEventProducerServer.class.getCanonicalName(), port, eventCount, xmlEvents);
for (int i = 0; i < eventCount; i++) {
- System.out.println(WebSocketEventProducerServer.class.getCanonicalName() + ": waiting " + eventInterval
- + " milliseconds before sending next event");
+ LOGGER.debug("{}: waiting {} milliseconds before sending next event",
+ WebSocketEventProducerServer.class.getCanonicalName(), eventInterval);
ThreadUtilities.sleep(eventInterval);
String eventString = null;
@@ -81,11 +85,11 @@ public class WebSocketEventProducerServer implements WsStringMessageListener {
}
server.sendString(eventString);
eventsSentCount++;
- System.out.println(WebSocketEventProducerServer.class.getCanonicalName() + ": port " + port
- + ", sent event " + eventString);
+ LOGGER.debug("{}: port {}, sent event {}", WebSocketEventProducerServer.class.getCanonicalName(), port,
+ eventString);
}
- System.out.println(WebSocketEventProducerServer.class.getCanonicalName() + ": event sending completed");
+ LOGGER.debug("{}: event sending completed", WebSocketEventProducerServer.class.getCanonicalName());
}
/**
@@ -102,7 +106,7 @@ public class WebSocketEventProducerServer implements WsStringMessageListener {
*/
public void shutdown() {
server.stop();
- System.out.println(WebSocketEventProducerServer.class.getCanonicalName() + ": stopped");
+ LOGGER.debug("{}: stopped", WebSocketEventProducerServer.class.getCanonicalName());
}
/**
@@ -110,8 +114,8 @@ public class WebSocketEventProducerServer implements WsStringMessageListener {
*/
@Override
public void receiveString(final String eventString) {
- System.out.println(WebSocketEventProducerServer.class.getCanonicalName() + ": port " + port
- + ", received event " + eventString);
+ LOGGER.debug("{}: port {}, received event {}", WebSocketEventProducerServer.class.getCanonicalName(), port,
+ eventString);
}
/**
@@ -122,7 +126,7 @@ public class WebSocketEventProducerServer implements WsStringMessageListener {
*/
public static void main(final String[] args) throws MessagingException {
if (args.length != 4) {
- System.err.println("usage WebSocketEventProducerServer port #events XML|JSON eventInterval");
+ LOGGER.error("usage WebSocketEventProducerServer port #events XML|JSON eventInterval");
return;
}
@@ -130,7 +134,7 @@ public class WebSocketEventProducerServer implements WsStringMessageListener {
try {
port = Integer.parseInt(args[0]);
} catch (final Exception e) {
- System.err.println("usage WebSocketEventProducerServer port #events XML|JSON eventInterval");
+ LOGGER.error("usage WebSocketEventProducerServer port #events XML|JSON eventInterval");
e.printStackTrace();
return;
}
@@ -139,7 +143,7 @@ public class WebSocketEventProducerServer implements WsStringMessageListener {
try {
eventCount = Integer.parseInt(args[1]);
} catch (final Exception e) {
- System.err.println("usage WebSocketEventProducerServer port #events XML|JSON eventInterval");
+ LOGGER.error("usage WebSocketEventProducerServer port #events XML|JSON eventInterval");
e.printStackTrace();
return;
}
@@ -148,7 +152,7 @@ public class WebSocketEventProducerServer implements WsStringMessageListener {
try {
eventInterval = Long.parseLong(args[3]);
} catch (final Exception e) {
- System.err.println("usage WebSocketEventProducerServer port #events XML|JSON eventInterval");
+ LOGGER.error("usage WebSocketEventProducerServer port #events XML|JSON eventInterval");
e.printStackTrace();
return;
}
@@ -157,12 +161,12 @@ public class WebSocketEventProducerServer implements WsStringMessageListener {
if (args[2].equalsIgnoreCase("XML")) {
xmlEvents = true;
} else if (!args[2].equalsIgnoreCase("JSON")) {
- System.err.println("usage WebSocketEventProducerServer port #events XML|JSON startDelay eventInterval");
+ LOGGER.error("usage WebSocketEventProducerServer port #events XML|JSON startDelay eventInterval");
return;
}
- final WebSocketEventProducerServer server =
- new WebSocketEventProducerServer(port, eventCount, xmlEvents, eventInterval);
+ final WebSocketEventProducerServer server = new WebSocketEventProducerServer(port, eventCount, xmlEvents,
+ eventInterval);
server.sendEvents();
server.shutdown();
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java
index fab51529a..5cd871225 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java
@@ -5,15 +5,15 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -23,11 +23,15 @@ package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageClient;
import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The Class WebSocketEventSubscriberClient.
*/
public class WebSocketEventSubscriberClient implements WsStringMessageListener {
+ private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketEventSubscriberClient.class);
+
private final int port;
private long eventsReceivedCount = 0;
@@ -52,8 +56,8 @@ public class WebSocketEventSubscriberClient implements WsStringMessageListener {
*/
@Override
public void receiveString(final String eventString) {
- System.out.println(WebSocketEventSubscriberClient.class.getCanonicalName() + ": port " + port
- + ", received event " + eventString);
+ LOGGER.debug("{}: port {}, received event {}", WebSocketEventSubscriberClient.class.getCanonicalName(), port,
+ eventString);
eventsReceivedCount++;
}
@@ -71,7 +75,7 @@ public class WebSocketEventSubscriberClient implements WsStringMessageListener {
*/
public void shutdown() {
client.stop();
- System.out.println(WebSocketEventSubscriberServer.class.getCanonicalName() + ": stopped");
+ LOGGER.debug("{}: stopped", WebSocketEventSubscriberServer.class.getCanonicalName());
}
/**
@@ -82,7 +86,7 @@ public class WebSocketEventSubscriberClient implements WsStringMessageListener {
*/
public static void main(final String[] args) throws MessagingException {
if (args.length != 2) {
- System.err.println("usage WebSocketEventSubscriberClient host port");
+ LOGGER.error("usage WebSocketEventSubscriberClient host port");
return;
}
@@ -90,7 +94,7 @@ public class WebSocketEventSubscriberClient implements WsStringMessageListener {
try {
port = Integer.parseInt(args[0]);
} catch (final Exception e) {
- System.err.println("usage WebSocketEventSubscriberClient port");
+ LOGGER.error("usage WebSocketEventSubscriberClient port");
e.printStackTrace();
return;
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java
index edd6d7961..48d221791 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java
@@ -5,15 +5,15 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -23,11 +23,15 @@ package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageListener;
import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageServer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The Class WebSocketEventSubscriberServer.
*/
public class WebSocketEventSubscriberServer implements WsStringMessageListener {
+ private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketEventSubscriberServer.class);
+
private final int port;
private long eventsReceivedCount = 0;
@@ -45,8 +49,7 @@ public class WebSocketEventSubscriberServer implements WsStringMessageListener {
server = new WsStringMessageServer(port);
server.start(this);
- System.out.println(
- WebSocketEventSubscriberServer.class.getCanonicalName() + ": port " + port + ", waiting for events");
+ LOGGER.debug("{}: port {}, waiting for events", WebSocketEventSubscriberServer.class.getCanonicalName(), port);
}
/**
@@ -54,8 +57,8 @@ public class WebSocketEventSubscriberServer implements WsStringMessageListener {
*/
@Override
public void receiveString(final String eventString) {
- System.out.println(WebSocketEventSubscriberServer.class.getCanonicalName() + ": port " + port
- + ", received event " + eventString);
+ LOGGER.debug("{}: port {}, received event {}", WebSocketEventSubscriberServer.class.getCanonicalName(), port,
+ eventString);
eventsReceivedCount++;
}
@@ -73,7 +76,7 @@ public class WebSocketEventSubscriberServer implements WsStringMessageListener {
*/
public void shutdown() {
server.stop();
- System.out.println(WebSocketEventSubscriberServer.class.getCanonicalName() + ": stopped");
+ LOGGER.debug("{} : stopped", WebSocketEventSubscriberServer.class.getCanonicalName());
}
/**
@@ -84,7 +87,7 @@ public class WebSocketEventSubscriberServer implements WsStringMessageListener {
*/
public static void main(final String[] args) throws MessagingException {
if (args.length != 1) {
- System.err.println("usage WebSocketEventSubscriberClient port");
+ LOGGER.error("usage WebSocketEventSubscriberClient port");
return;
}
@@ -92,7 +95,7 @@ public class WebSocketEventSubscriberServer implements WsStringMessageListener {
try {
port = Integer.parseInt(args[0]);
} catch (final Exception e) {
- System.err.println("usage WebSocketEventSubscriberClient port");
+ LOGGER.error("usage WebSocketEventSubscriberClient port");
e.printStackTrace();
return;
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java
index 34893ca5c..2377cfb91 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java
@@ -5,15 +5,15 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -103,7 +103,6 @@ public class ApexServiceTest {
parameters.getEngineParameters().getExecutorParameterMap().put("MVEL", new MvelExecutorParameters());
service = EngineServiceImpl.create(parameters);
-
LOGGER.debug("Running TestApexEngine. . .");
apexPolicyModel = new SampleDomainModelFactory().getSamplePolicyModel("JAVASCRIPT");
@@ -127,12 +126,12 @@ public class ApexServiceTest {
ParameterService.register(new LockManagerParameters());
ParameterService.register(new PersistorParameters());
ParameterService.register(new EngineServiceParameters());
-
+
EngineParameters engineParameters = new EngineParameters();
engineParameters.getExecutorParameterMap().put("JAVASCRIPT", new JavascriptExecutorParameters());
ParameterService.register(engineParameters);
}
-
+
/**
* Clear down parameters.
*/
@@ -146,7 +145,7 @@ public class ApexServiceTest {
ParameterService.deregister(ContextParameterConstants.MAIN_GROUP_NAME);
ParameterService.deregister(ContextParameterConstants.SCHEMA_GROUP_NAME);
}
-
+
/**
* Update the engine then test the engine with 2 sample events.
*
@@ -158,7 +157,7 @@ public class ApexServiceTest {
final long starttime = System.currentTimeMillis();
for (final AxArtifactKey engineKey : service.getEngineKeys()) {
- LOGGER.info("{}", service.getStatus(engineKey));
+ LOGGER.debug("{}", service.getStatus(engineKey));
}
while (!service.isStarted() && System.currentTimeMillis() - starttime < MAX_START_WAIT) {
ThreadUtilities.sleep(200);
@@ -177,14 +176,14 @@ public class ApexServiceTest {
eventDataMap.put("TestTimestamp", testStartTime.getTime());
eventDataMap.put("TestTemperature", 34.5445667);
- final ApexEvent event =
- new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
+ final ApexEvent event = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events",
+ "test", "apex");
event.setExecutionId(System.nanoTime());
event.putAll(eventDataMap);
engineServiceEventInterface.sendEvent(event);
- final ApexEvent event2 =
- new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
+ final ApexEvent event2 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events",
+ "test", "apex");
event2.setExecutionId(System.nanoTime());
event2.putAll(eventDataMap);
engineServiceEventInterface.sendEvent(event2);
@@ -198,7 +197,6 @@ public class ApexServiceTest {
assertEquals(2, actionEventsReceived);
actionEventsReceived = 0;
-
// Stop all engines on this engine service
final long stoptime = System.currentTimeMillis();
service.stop();
@@ -221,7 +219,7 @@ public class ApexServiceTest {
final long starttime = System.currentTimeMillis();
for (final AxArtifactKey engineKey : service.getEngineKeys()) {
- LOGGER.info("{}", service.getStatus(engineKey));
+ LOGGER.debug("{}", service.getStatus(engineKey));
}
while (!service.isStarted() && System.currentTimeMillis() - starttime < MAX_START_WAIT) {
ThreadUtilities.sleep(200);
@@ -238,8 +236,8 @@ public class ApexServiceTest {
eventDataMap.put("TestTimestamp", testStartTime.getTime());
eventDataMap.put("TestTemperature", 34.5445667);
- final ApexEvent event1 =
- new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
+ final ApexEvent event1 = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events",
+ "test", "apex");
event1.putAll(eventDataMap);
event1.setExecutionId(System.nanoTime());
@@ -260,8 +258,8 @@ public class ApexServiceTest {
ThreadUtilities.sleep(100);
}
- final ApexEvent event2 =
- new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
+ final ApexEvent event2 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events",
+ "test", "apex");
event2.setExecutionId(System.nanoTime());
event2.putAll(eventDataMap);
@@ -309,7 +307,7 @@ public class ApexServiceTest {
final long starttime = System.currentTimeMillis();
for (final AxArtifactKey engineKey : service.getEngineKeys()) {
- LOGGER.info("{}", service.getStatus(engineKey));
+ LOGGER.debug("{}", service.getStatus(engineKey));
}
while (!service.isStarted() && System.currentTimeMillis() - starttime < MAX_START_WAIT) {
ThreadUtilities.sleep(200);
@@ -328,14 +326,14 @@ public class ApexServiceTest {
eventDataMap.put("TestTimestamp", testStartTime.getTime());
eventDataMap.put("TestTemperature", 34.5445667);
- final ApexEvent event =
- new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
+ final ApexEvent event = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events",
+ "test", "apex");
event.setExecutionId(System.nanoTime());
event.putAll(eventDataMap);
engineServiceEventInterface.sendEvent(event);
- final ApexEvent event2 =
- new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
+ final ApexEvent event2 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events",
+ "test", "apex");
event2.setExecutionId(System.nanoTime());
event2.putAll(eventDataMap);
engineServiceEventInterface.sendEvent(event2);
@@ -371,7 +369,7 @@ public class ApexServiceTest {
final long starttime = System.currentTimeMillis();
for (final AxArtifactKey engineKey : service.getEngineKeys()) {
- LOGGER.info("{}", service.getStatus(engineKey));
+ LOGGER.debug("{}", service.getStatus(engineKey));
}
while (!service.isStarted() && System.currentTimeMillis() - starttime < MAX_START_WAIT) {
ThreadUtilities.sleep(200);
@@ -388,8 +386,8 @@ public class ApexServiceTest {
eventDataMap.put("TestTimestamp", testStartTime.getTime());
eventDataMap.put("TestTemperature", 34.5445667);
- final ApexEvent event1 =
- new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
+ final ApexEvent event1 = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events",
+ "test", "apex");
event1.putAll(eventDataMap);
final ApexEventListener myEventListener1 = new ApexEventListener() {
@@ -409,8 +407,8 @@ public class ApexServiceTest {
ThreadUtilities.sleep(100);
}
- final ApexEvent event2 =
- new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
+ final ApexEvent event2 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events",
+ "test", "apex");
event2.putAll(eventDataMap);
final ApexEventListener myEventListener2 = new ApexEventListener() {
@@ -468,10 +466,10 @@ public class ApexServiceTest {
}
/**
- * The listener interface for receiving test events. The class that is interested in processing
- * a test event implements this interface, and the object created with that class is registered
- * with a component using the component's <code>addTestListener</code> method. When the test
- * event occurs, that object's appropriate method is invoked.
+ * The listener interface for receiving test events. The class that is interested in processing a test event
+ * implements this interface, and the object created with that class is registered with a component using the
+ * component's <code>addTestListener</code> method. When the test event occurs, that object's appropriate method is
+ * invoked.
*
* @see TestEvent
*/
@@ -489,7 +487,7 @@ public class ApexServiceTest {
final Date testStartTime = new Date((Long) event.get("TestTimestamp"));
final Date testEndTime = new Date();
- LOGGER.info("policy execution time: " + (testEndTime.getTime() - testStartTime.getTime()) + "ms");
+ LOGGER.debug("policy execution time: " + (testEndTime.getTime() - testStartTime.getTime()) + "ms");
}
/**
@@ -504,13 +502,13 @@ public class ApexServiceTest {
assertTrue(result.get("TestMatchCase").equals(new Byte((byte) 123)));
assertTrue(result.get("TestTemperature").equals(34.5445667));
assertTrue(((byte) result.get("TestMatchCaseSelected")) >= 0
- && ((byte) result.get("TestMatchCaseSelected") <= 3));
+ && ((byte) result.get("TestMatchCaseSelected") <= 3));
assertTrue(((byte) result.get("TestEstablishCaseSelected")) >= 0
- && ((byte) result.get("TestEstablishCaseSelected") <= 3));
+ && ((byte) result.get("TestEstablishCaseSelected") <= 3));
assertTrue(((byte) result.get("TestDecideCaseSelected")) >= 0
- && ((byte) result.get("TestDecideCaseSelected") <= 3));
- assertTrue(
- ((byte) result.get("TestActCaseSelected")) >= 0 && ((byte) result.get("TestActCaseSelected") <= 3));
+ && ((byte) result.get("TestDecideCaseSelected") <= 3));
+ assertTrue(((byte) result.get("TestActCaseSelected")) >= 0
+ && ((byte) result.get("TestActCaseSelected") <= 3));
}
}