From 9253f81d14a5217479ca8e59efb198eaa32ec9f0 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Wed, 27 Nov 2019 13:32:45 +0000 Subject: Replace getCaononicalName() with getName() in code base Issue-ID: POLICY-1861 Change-Id: Iccbdcbc5b5978305c56ab74c01a52a562697bee1 Signed-off-by: liamfallon --- .../uservice/adapt/jms/JmsEventProducer.java | 10 +++++----- .../uservice/adapt/jms/JmsEventSubscriber.java | 7 ++++--- .../uservice/adapt/kafka/KafkaEventProducer.java | 13 +++++++------ .../uservice/adapt/kafka/KafkaEventSubscriber.java | 9 +++++---- .../websocket/WebSocketEventProducerClient.java | 21 +++++++++++---------- .../websocket/WebSocketEventProducerServer.java | 19 +++++++++---------- .../websocket/WebSocketEventSubscriberClient.java | 5 +++-- .../websocket/WebSocketEventSubscriberServer.java | 7 ++++--- .../executionproperties/DummyApexEventConsumer.java | 17 +++++++++-------- 9 files changed, 57 insertions(+), 51 deletions(-) (limited to 'testsuites/integration/integration-uservice-test') 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 7367b0220..3baa14714 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 @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -120,8 +121,7 @@ public class JmsEventProducer implements Runnable { */ private void sendEventsToTopic(final Session jmsSession, final MessageProducer jmsProducer) throws JMSException { - LOGGER.debug("{} : sending events to JMS server, event count {}", this.getClass().getCanonicalName(), - eventCount); + LOGGER.debug("{} : sending events to JMS server, event count {}", this.getClass().getName(), 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.debug("{} : completed, number of events sent", this.getClass().getCanonicalName(), eventsSentCount); + LOGGER.debug("{} : completed, number of events sent", this.getClass().getName(), eventsSentCount); } /** @@ -151,13 +151,13 @@ public class JmsEventProducer implements Runnable { * Shutdown. */ public void shutdown() { - LOGGER.debug("{} : stopping", this.getClass().getCanonicalName()); + LOGGER.debug("{} : stopping", this.getClass().getName()); stopFlag = true; while (producerThread.isAlive()) { ThreadUtilities.sleep(10); } - LOGGER.debug("{} : stopped", this.getClass().getCanonicalName()); + LOGGER.debug("{} : stopped", this.getClass().getName()); } } 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 2fd174651..5140d71cd 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 @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -94,7 +95,7 @@ public class JmsEventSubscriber implements Runnable { ((TextMessage) message).getText(); } else { throw new ApexEventException("unknowm message \"" + message + "\" of type \"" - + message.getClass().getCanonicalName() + "\" received"); + + message.getClass().getName() + "\" received"); } eventsReceivedCount++; } catch (final Exception e) { @@ -106,7 +107,7 @@ public class JmsEventSubscriber implements Runnable { throw new ApexEventRuntimeException("JMS event consumption failed", e); } - LOGGER.debug("{} : event reception completed", this.getClass().getCanonicalName()); + LOGGER.debug("{} : event reception completed", this.getClass().getName()); } /** @@ -131,7 +132,7 @@ public class JmsEventSubscriber implements Runnable { } connection.close(); - LOGGER.debug("{} : stopped", this.getClass().getCanonicalName()); + LOGGER.debug("{} : stopped", this.getClass().getName()); } } 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 e0f5c23c4..c214b72a8 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 @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -107,11 +108,11 @@ public class KafkaEventProducer implements Runnable { */ private void sendEventsToTopic(final Producer producer) { LOGGER.debug("{} : sending events to Kafka server, event count {}, xmlEvents {}", - KafkaEventProducer.class.getCanonicalName(), eventCount, xmlEvents); + KafkaEventProducer.class.getName(), eventCount, xmlEvents); for (int i = 0; i < eventCount; i++) { - LOGGER.debug("{} : waiting {} milliseconds before sending next event", - KafkaEventProducer.class.getCanonicalName(), eventInterval); + LOGGER.debug("{} : waiting {} milliseconds before sending next event", KafkaEventProducer.class.getName(), + eventInterval); ThreadUtilities.sleep(eventInterval); String eventString = null; @@ -125,7 +126,7 @@ public class KafkaEventProducer implements Runnable { eventsSentCount++; LOGGER.debug("****** Sent event No. {} ******", eventsSentCount); } - LOGGER.debug("{}: completed", KafkaEventProducer.class.getCanonicalName()); + LOGGER.debug("{}: completed", KafkaEventProducer.class.getName()); } /** @@ -141,7 +142,7 @@ public class KafkaEventProducer implements Runnable { * Shutdown. */ public void shutdown() { - LOGGER.debug("{} : stopping", KafkaEventProducer.class.getCanonicalName()); + LOGGER.debug("{} : stopping", KafkaEventProducer.class.getName()); stopFlag = true; @@ -149,6 +150,6 @@ public class KafkaEventProducer implements Runnable { ThreadUtilities.sleep(10); } - LOGGER.debug("{} : stopped", KafkaEventProducer.class.getCanonicalName()); + LOGGER.debug("{} : stopped", KafkaEventProducer.class.getName()); } } 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 da2cc3344..1bb2e8021 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 @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,8 +81,8 @@ public class KafkaEventSubscriber implements Runnable { */ @Override public void run() { - LOGGER.debug("{}: receiving events from Kafka server on topic {}", - KafkaEventSubscriber.class.getCanonicalName(), topic); + LOGGER.debug("{}: receiving events from Kafka server on topic {}", KafkaEventSubscriber.class.getName(), + topic); while (subscriberThread.isAlive() && !subscriberThread.isInterrupted()) { try { @@ -97,7 +98,7 @@ public class KafkaEventSubscriber implements Runnable { } } - LOGGER.debug("{}: event reception completed", KafkaEventSubscriber.class.getCanonicalName()); + LOGGER.debug("{}: event reception completed", KafkaEventSubscriber.class.getName()); } /** @@ -120,6 +121,6 @@ public class KafkaEventSubscriber implements Runnable { } consumer.close(); - LOGGER.debug("{} : stopped", KafkaEventSubscriber.class.getCanonicalName()); + LOGGER.debug("{} : stopped", KafkaEventSubscriber.class.getName()); } } 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 023ff9998..ffb8f1e1b 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 @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,8 +65,8 @@ public class WebSocketEventProducerClient implements WsStringMessageListener { client = new WsStringMessageClient(host, port); client.start(this); - LOGGER.debug("{}: host {}, port {}, event count {}, xmlEvents {}", - WebSocketEventProducerClient.class.getCanonicalName(), host, port, eventCount, xmlEvents); + LOGGER.debug("{}: host {}, port {}, event count {}, xmlEvents {}", WebSocketEventProducerClient.class.getName(), + host, port, eventCount, xmlEvents); } /** @@ -73,11 +74,11 @@ public class WebSocketEventProducerClient implements WsStringMessageListener { */ public void sendEvents() { LOGGER.debug("{}: sending events on host {}, port {}, event count {}, xmlEvents {}", - WebSocketEventProducerClient.class.getCanonicalName(), host, port, eventCount, xmlEvents); + WebSocketEventProducerClient.class.getName(), host, port, eventCount, xmlEvents); for (int i = 0; i < eventCount; i++) { LOGGER.debug("{}: waiting {} milliseconds before sending next event", - WebSocketEventProducerClient.class.getCanonicalName(), eventInterval); + WebSocketEventProducerClient.class.getName(), eventInterval); ThreadUtilities.sleep(eventInterval); String eventString = null; @@ -88,10 +89,10 @@ public class WebSocketEventProducerClient implements WsStringMessageListener { } client.sendString(eventString); eventsSentCount++; - LOGGER.debug("{}: host {}, port {}, sent event {}", WebSocketEventProducerClient.class.getCanonicalName(), - host, port, eventString); + LOGGER.debug("{}: host {}, port {}, sent event {}", WebSocketEventProducerClient.class.getName(), host, + port, eventString); } - LOGGER.debug("{}: completed", WebSocketEventProducerClient.class.getCanonicalName()); + LOGGER.debug("{}: completed", WebSocketEventProducerClient.class.getName()); } /** @@ -108,7 +109,7 @@ public class WebSocketEventProducerClient implements WsStringMessageListener { */ public void shutdown() { client.stop(); - LOGGER.debug("{}: stopped", WebSocketEventProducerClient.class.getCanonicalName()); + LOGGER.debug("{}: stopped", WebSocketEventProducerClient.class.getName()); } /** @@ -116,8 +117,8 @@ public class WebSocketEventProducerClient implements WsStringMessageListener { */ @Override public void receiveString(final String eventString) { - LOGGER.debug("{}: host {}, port {}, received event {}", WebSocketEventProducerServer.class.getCanonicalName(), - host, port, eventString); + LOGGER.debug("{}: host {}, port {}, received event {}", WebSocketEventProducerServer.class.getName(), host, + port, eventString); } /** 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 11438d952..ec3112c39 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 @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,8 +62,8 @@ public class WebSocketEventProducerServer implements WsStringMessageListener { server = new WsStringMessageServer(port); server.start(this); - LOGGER.debug("{}: port {}, event count {}, xmlEvents {}", WebSocketEventProducerServer.class.getCanonicalName(), - port, eventCount, xmlEvents); + LOGGER.debug("{}: port {}, event count {}, xmlEvents {}", WebSocketEventProducerServer.class.getName(), port, + eventCount, xmlEvents); } /** @@ -70,11 +71,11 @@ public class WebSocketEventProducerServer implements WsStringMessageListener { */ public void sendEvents() { LOGGER.debug("{}: sending events on port {}, event count {}, xmlEvents {}", - WebSocketEventProducerServer.class.getCanonicalName(), port, eventCount, xmlEvents); + WebSocketEventProducerServer.class.getName(), port, eventCount, xmlEvents); for (int i = 0; i < eventCount; i++) { LOGGER.debug("{}: waiting {} milliseconds before sending next event", - WebSocketEventProducerServer.class.getCanonicalName(), eventInterval); + WebSocketEventProducerServer.class.getName(), eventInterval); ThreadUtilities.sleep(eventInterval); String eventString = null; @@ -85,11 +86,10 @@ public class WebSocketEventProducerServer implements WsStringMessageListener { } server.sendString(eventString); eventsSentCount++; - LOGGER.debug("{}: port {}, sent event {}", WebSocketEventProducerServer.class.getCanonicalName(), port, - eventString); + LOGGER.debug("{}: port {}, sent event {}", WebSocketEventProducerServer.class.getName(), port, eventString); } - LOGGER.debug("{}: event sending completed", WebSocketEventProducerServer.class.getCanonicalName()); + LOGGER.debug("{}: event sending completed", WebSocketEventProducerServer.class.getName()); } /** @@ -106,7 +106,7 @@ public class WebSocketEventProducerServer implements WsStringMessageListener { */ public void shutdown() { server.stop(); - LOGGER.debug("{}: stopped", WebSocketEventProducerServer.class.getCanonicalName()); + LOGGER.debug("{}: stopped", WebSocketEventProducerServer.class.getName()); } /** @@ -114,8 +114,7 @@ public class WebSocketEventProducerServer implements WsStringMessageListener { */ @Override public void receiveString(final String eventString) { - LOGGER.debug("{}: port {}, received event {}", WebSocketEventProducerServer.class.getCanonicalName(), port, - eventString); + LOGGER.debug("{}: port {}, received event {}", WebSocketEventProducerServer.class.getName(), port, eventString); } /** 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 5cd871225..7fe2d4306 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 @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,7 +57,7 @@ public class WebSocketEventSubscriberClient implements WsStringMessageListener { */ @Override public void receiveString(final String eventString) { - LOGGER.debug("{}: port {}, received event {}", WebSocketEventSubscriberClient.class.getCanonicalName(), port, + LOGGER.debug("{}: port {}, received event {}", WebSocketEventSubscriberClient.class.getName(), port, eventString); eventsReceivedCount++; } @@ -75,7 +76,7 @@ public class WebSocketEventSubscriberClient implements WsStringMessageListener { */ public void shutdown() { client.stop(); - LOGGER.debug("{}: stopped", WebSocketEventSubscriberServer.class.getCanonicalName()); + LOGGER.debug("{}: stopped", WebSocketEventSubscriberServer.class.getName()); } /** 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 48d221791..d36ce9638 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 @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +50,7 @@ public class WebSocketEventSubscriberServer implements WsStringMessageListener { server = new WsStringMessageServer(port); server.start(this); - LOGGER.debug("{}: port {}, waiting for events", WebSocketEventSubscriberServer.class.getCanonicalName(), port); + LOGGER.debug("{}: port {}, waiting for events", WebSocketEventSubscriberServer.class.getName(), port); } /** @@ -57,7 +58,7 @@ public class WebSocketEventSubscriberServer implements WsStringMessageListener { */ @Override public void receiveString(final String eventString) { - LOGGER.debug("{}: port {}, received event {}", WebSocketEventSubscriberServer.class.getCanonicalName(), port, + LOGGER.debug("{}: port {}, received event {}", WebSocketEventSubscriberServer.class.getName(), port, eventString); eventsReceivedCount++; } @@ -76,7 +77,7 @@ public class WebSocketEventSubscriberServer implements WsStringMessageListener { */ public void shutdown() { server.stop(); - LOGGER.debug("{} : stopped", WebSocketEventSubscriberServer.class.getCanonicalName()); + LOGGER.debug("{} : stopped", WebSocketEventSubscriberServer.class.getName()); } /** diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventConsumer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventConsumer.java index e5a88a365..dc5cce8c6 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventConsumer.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventConsumer.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,22 +60,21 @@ public class DummyApexEventConsumer implements ApexEventConsumer { @Override public void init(final String consumerName, final EventHandlerParameters consumerParameters, - final ApexEventReceiver incomingEventReceiver) throws ApexEventException { + final ApexEventReceiver incomingEventReceiver) throws ApexEventException { this.eventReceiver = incomingEventReceiver; this.name = consumerName; - // Check and get the properties if (!(consumerParameters.getCarrierTechnologyParameters() instanceof DummyCarrierTechnologyParameters)) { String message = "specified consumer properties of type \"" - + consumerParameters.getCarrierTechnologyParameters().getClass().getCanonicalName() - + "\" are not applicable to a dummy consumer"; + + consumerParameters.getCarrierTechnologyParameters().getClass().getName() + + "\" are not applicable to a dummy consumer"; LOGGER.warn(message); throw new ApexEventException(message); } - dummyConsumerProperties = - (DummyCarrierTechnologyParameters) consumerParameters.getCarrierTechnologyParameters(); + dummyConsumerProperties = (DummyCarrierTechnologyParameters) consumerParameters + .getCarrierTechnologyParameters(); } @Override @@ -107,7 +107,8 @@ public class DummyApexEventConsumer implements ApexEventConsumer { } @Override - public void stop() {} + public void stop() { + } private class RunTestEventSender implements Runnable { @Override @@ -117,7 +118,7 @@ public class DummyApexEventConsumer implements ApexEventConsumer { executionProperties.load(new FileInputStream(new File(dummyConsumerProperties.getPropertyFileName()))); } catch (IOException e1) { String message = "reading of executor properties for testing failed from file: " - + dummyConsumerProperties.getPropertyFileName(); + + dummyConsumerProperties.getPropertyFileName(); LOGGER.warn(message); throw new ApexEventRuntimeException(message); } -- cgit 1.2.3-korg