aboutsummaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2022-02-11 00:43:14 +0000
committerliamfallon <liam.fallon@est.tech>2022-02-11 00:43:18 +0000
commitf0fd964e343fe5a9cc2044d417fadf6cdd1ef0d1 (patch)
treec316685cbee53330570bcbf0509bc327ad118196 /testsuites
parent8534756d13531ffec9c2d7b2ffe0a53ee1d3aaef (diff)
Remove apex-pdp unused core modules
This is the final review in the refactoring of the model code in apex-pdp. The core-messaging and core-infrastructure modules are unused in apex-pdp except for websocket communication. Websocket communication is also not used in any deployment. This review: - removes the core-mesaging module, which had an apex-specific websocket implementation, except for the MessageException class, which is moved to the base core module - removes the core-infrastructure module, except for the ThreadUtils class, which is moved to the base core module - removes the websocket event protocol, which used core-messaging but is not used in any deployment - collapses all three "core" submodules into a single module - Updates dependencies where needed Issue-ID: POLICY-1820 Change-Id: Ieae30063e99570e61943372d3fa23b77a211462c Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/integration/integration-common/pom.xml4
-rw-r--r--testsuites/integration/integration-context-test/pom.xml8
-rw-r--r--testsuites/integration/integration-executor-test/pom.xml8
-rw-r--r--testsuites/integration/integration-uservice-test/pom.xml2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsClient.java81
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsServer.java104
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java171
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java167
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java99
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java100
10 files changed, 5 insertions, 739 deletions
diff --git a/testsuites/integration/integration-common/pom.xml b/testsuites/integration/integration-common/pom.xml
index 54736f8b1..e9972bf14 100644
--- a/testsuites/integration/integration-common/pom.xml
+++ b/testsuites/integration/integration-common/pom.xml
@@ -1,7 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
- Modifications Copyright (C) 2020 Nordix Foundation.
+ Modifications Copyright (C) 2020,2022 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@
</dependency>
<dependency>
<groupId>org.onap.policy.apex-pdp.core</groupId>
- <artifactId>core-engine</artifactId>
+ <artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
diff --git a/testsuites/integration/integration-context-test/pom.xml b/testsuites/integration/integration-context-test/pom.xml
index 3499f20bc..8aa466d62 100644
--- a/testsuites/integration/integration-context-test/pom.xml
+++ b/testsuites/integration/integration-context-test/pom.xml
@@ -1,7 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
- Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ Modifications Copyright (C) 2019-2020,2022 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -39,12 +39,6 @@
<artifactId>utils</artifactId>
</dependency>
<dependency>
- <groupId>org.onap.policy.apex-pdp.core</groupId>
- <artifactId>core-infrastructure</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId>
<artifactId>integration-common</artifactId>
<version>${project.version}</version>
diff --git a/testsuites/integration/integration-executor-test/pom.xml b/testsuites/integration/integration-executor-test/pom.xml
index 4af8f675a..0d2a0cf27 100644
--- a/testsuites/integration/integration-executor-test/pom.xml
+++ b/testsuites/integration/integration-executor-test/pom.xml
@@ -1,7 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
- Modifications Copyright (C) 2020 Nordix Foundation.
+ Modifications Copyright (C) 2020,2022 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -33,12 +33,6 @@
<dependencies>
<dependency>
- <groupId>org.onap.policy.apex-pdp.core</groupId>
- <artifactId>core-infrastructure</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId>
<artifactId>integration-common</artifactId>
<version>${project.version}</version>
diff --git a/testsuites/integration/integration-uservice-test/pom.xml b/testsuites/integration/integration-uservice-test/pom.xml
index d852ad1b5..c627c9d6c 100644
--- a/testsuites/integration/integration-uservice-test/pom.xml
+++ b/testsuites/integration/integration-uservice-test/pom.xml
@@ -45,7 +45,7 @@
</dependency>
<dependency>
<groupId>org.onap.policy.apex-pdp.core</groupId>
- <artifactId>core-engine</artifactId>
+ <artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsClient.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsClient.java
deleted file mode 100644
index 96f31e98d..000000000
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsClient.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
-import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.service.engine.main.ApexMain;
-
-public class TestWs2WsClient {
- private static final long MAX_TEST_LENGTH = 10000;
-
- private static final int EVENT_COUNT = 100;
- private static final int EVENT_INTERVAL = 20;
-
- /**
- * Clear relative file root environment variable.
- */
- @Before
- public void clearRelativeFileRoot() {
- System.clearProperty("APEX_RELATIVE_FILE_ROOT");
- }
-
- @Test
- public void testJsonWsEvents() throws MessagingException, ApexException {
- final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/Ws2WsClientJsonEvent.json"};
- testWsEvents(args, false);
- }
-
- @Test
- public void testXmlWsEvents() throws MessagingException, ApexException {
- final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/Ws2WsClientXMLEvent.json"};
- testWsEvents(args, true);
- }
-
- private void testWsEvents(final String[] args, final Boolean xmlEvents) throws MessagingException, ApexException {
- final WebSocketEventSubscriberServer subServer = new WebSocketEventSubscriberServer(42453);
- final WebSocketEventProducerServer prodServer =
- new WebSocketEventProducerServer(42451, EVENT_COUNT, xmlEvents, EVENT_INTERVAL);
-
- final ApexMain apexMain = new ApexMain(args);
-
- prodServer.sendEvents();
-
- final long testStartTime = System.currentTimeMillis();
-
- while (System.currentTimeMillis() < testStartTime + MAX_TEST_LENGTH
- && subServer.getEventsReceivedCount() < EVENT_COUNT) {
- ThreadUtilities.sleep(EVENT_INTERVAL);
- }
-
- assertEquals(prodServer.getEventsSentCount(), subServer.getEventsReceivedCount());
-
- apexMain.shutdown();
- prodServer.shutdown();
- subServer.shutdown();
- }
-}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsServer.java
deleted file mode 100644
index 870eb9ec7..000000000
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsServer.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
-import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.service.engine.main.ApexMain;
-
-/**
- * The Class TestWs2WsServer.
- */
-public class TestWs2WsServer {
- private static final long MAX_TEST_LENGTH = 10000;
-
- private static final int EVENT_COUNT = 100;
- private static final int EVENT_INTERVAL = 20;
-
- /**
- * Clear relative file root environment variable.
- */
- @Before
- public void clearRelativeFileRoot() {
- System.clearProperty("APEX_RELATIVE_FILE_ROOT");
- }
-
- /**
- * Test json ws events.
- *
- * @throws MessagingException the messaging exception
- * @throws ApexException the apex exception
- */
- @Test
- public void testJsonWsEvents() throws MessagingException, ApexException {
- final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/Ws2WsServerJsonEvent.json"};
- testWsEvents(args, false);
- }
-
- /**
- * Test xml ws events.
- *
- * @throws MessagingException the messaging exception
- * @throws ApexException the apex exception
- */
- @Test
- public void testXmlWsEvents() throws MessagingException, ApexException {
- final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/Ws2WsServerXMLEvent.json"};
- testWsEvents(args, true);
- }
-
- /**
- * Test ws events.
- *
- * @param args the args
- * @param xmlEvents the xml events
- * @throws MessagingException the messaging exception
- * @throws ApexException the apex exception
- */
- public void testWsEvents(final String[] args, final boolean xmlEvents) throws MessagingException, ApexException {
- final ApexMain apexMain = new ApexMain(args);
-
- final WebSocketEventSubscriberClient subClient = new WebSocketEventSubscriberClient("localhost", 42452);
- final WebSocketEventProducerClient prodClient =
- new WebSocketEventProducerClient("localhost", 42450, EVENT_COUNT, xmlEvents, EVENT_INTERVAL);
-
- prodClient.sendEvents();
-
- final long testStartTime = System.currentTimeMillis();
-
- while (System.currentTimeMillis() < testStartTime + MAX_TEST_LENGTH
- && subClient.getEventsReceivedCount() < EVENT_COUNT) {
- ThreadUtilities.sleep(EVENT_INTERVAL);
- }
-
- assertEquals(subClient.getEventsReceivedCount(), prodClient.getEventsSentCount());
-
- prodClient.shutdown();
- subClient.shutdown();
- apexMain.shutdown();
- }
-}
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
deleted file mode 100644
index 6ffdeeaf2..000000000
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
-
-import lombok.Getter;
-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.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;
- private final boolean xmlEvents;
- private final long eventInterval;
- @Getter
- private long eventsSentCount = 0;
-
- WsStringMessageClient client;
-
- /**
- * Instantiates a new web socket event producer client.
- *
- * @param host the host
- * @param port the port
- * @param eventCount the event count
- * @param xmlEvents the xml events
- * @param eventInterval the event interval
- * @throws MessagingException the messaging exception
- */
- public WebSocketEventProducerClient(final String host, final int port, final int eventCount,
- final boolean xmlEvents, final long eventInterval) throws MessagingException {
- this.host = host;
- this.port = port;
- this.eventCount = eventCount;
- this.xmlEvents = xmlEvents;
- this.eventInterval = eventInterval;
-
- client = new WsStringMessageClient(host, port);
- client.start(this);
-
- LOGGER.debug("{}: host {}, port {}, event count {}, xmlEvents {}", WebSocketEventProducerClient.class.getName(),
- host, port, eventCount, xmlEvents);
- }
-
- /**
- * Send events.
- */
- public void sendEvents() {
- LOGGER.debug("{}: sending events on host {}, port {}, event count {}, 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.getName(), eventInterval);
- ThreadUtilities.sleep(eventInterval);
-
- String eventString = null;
- if (xmlEvents) {
- eventString = EventGenerator.xmlEvent();
- } else {
- eventString = EventGenerator.jsonEvent();
- }
- client.sendString(eventString);
- eventsSentCount++;
- LOGGER.debug("{}: host {}, port {}, sent event {}", WebSocketEventProducerClient.class.getName(), host,
- port, eventString);
- }
- LOGGER.debug("{}: completed", WebSocketEventProducerClient.class.getName());
- }
-
- /**
- * Shutdown.
- */
- public void shutdown() {
- client.stop();
- LOGGER.debug("{}: stopped", WebSocketEventProducerClient.class.getName());
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void receiveString(final String eventString) {
- LOGGER.debug("{}: host {}, port {}, received event {}", WebSocketEventProducerServer.class.getName(), host,
- port, eventString);
- }
-
- /**
- * The main method.
- *
- * @param args the arguments
- * @throws MessagingException the messaging exception
- */
- public static void main(final String[] args) throws MessagingException {
- if (args.length != 5) {
- LOGGER.error("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
- return;
- }
-
- int port = 0;
- try {
- port = Integer.parseInt(args[1]);
- } catch (final Exception e) {
- LOGGER.error("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
- e.printStackTrace();
- return;
- }
-
- int eventCount = 0;
- try {
- eventCount = Integer.parseInt(args[2]);
- } catch (final Exception e) {
- LOGGER.error("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
- e.printStackTrace();
- return;
- }
-
- long eventInterval = 0;
- try {
- eventInterval = Long.parseLong(args[4]);
- } catch (final Exception e) {
- LOGGER.error("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
- e.printStackTrace();
- return;
- }
-
- boolean xmlEvents = false;
- if (args[3].equalsIgnoreCase("XML")) {
- xmlEvents = true;
- } else if (!args[3].equalsIgnoreCase("JSON")) {
- LOGGER.error("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
- return;
- }
-
- 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
deleted file mode 100644
index 1bdb56ec3..000000000
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
-
-import lombok.Getter;
-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.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;
- private final long eventInterval;
- @Getter
- private long eventsSentCount = 0;
-
- WsStringMessageServer server;
-
- /**
- * Instantiates a new web socket event producer server.
- *
- * @param port the port
- * @param eventCount the event count
- * @param xmlEvents the xml events
- * @param eventInterval the event interval
- * @throws MessagingException the messaging exception
- */
- public WebSocketEventProducerServer(final int port, final int eventCount, final boolean xmlEvents,
- final long eventInterval) throws MessagingException {
- this.port = port;
- this.eventCount = eventCount;
- this.xmlEvents = xmlEvents;
- this.eventInterval = eventInterval;
-
- server = new WsStringMessageServer(port);
- server.start(this);
-
- LOGGER.debug("{}: port {}, event count {}, xmlEvents {}", WebSocketEventProducerServer.class.getName(), port,
- eventCount, xmlEvents);
- }
-
- /**
- * Send events.
- */
- public void sendEvents() {
- LOGGER.debug("{}: sending events on port {}, event count {}, xmlEvents {}",
- WebSocketEventProducerServer.class.getName(), port, eventCount, xmlEvents);
-
- for (int i = 0; i < eventCount; i++) {
- LOGGER.debug("{}: waiting {} milliseconds before sending next event",
- WebSocketEventProducerServer.class.getName(), eventInterval);
- ThreadUtilities.sleep(eventInterval);
-
- String eventString = null;
- if (xmlEvents) {
- eventString = EventGenerator.xmlEvent();
- } else {
- eventString = EventGenerator.jsonEvent();
- }
- server.sendString(eventString);
- eventsSentCount++;
- LOGGER.debug("{}: port {}, sent event {}", WebSocketEventProducerServer.class.getName(), port, eventString);
- }
-
- LOGGER.debug("{}: event sending completed", WebSocketEventProducerServer.class.getName());
- }
-
- /**
- * Shutdown.
- */
- public void shutdown() {
- server.stop();
- LOGGER.debug("{}: stopped", WebSocketEventProducerServer.class.getName());
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void receiveString(final String eventString) {
- LOGGER.debug("{}: port {}, received event {}", WebSocketEventProducerServer.class.getName(), port, eventString);
- }
-
- /**
- * The main method.
- *
- * @param args the arguments
- * @throws MessagingException the messaging exception
- */
- public static void main(final String[] args) throws MessagingException {
- if (args.length != 4) {
- LOGGER.error("usage WebSocketEventProducerServer port #events XML|JSON eventInterval");
- return;
- }
-
- int port = 0;
- try {
- port = Integer.parseInt(args[0]);
- } catch (final Exception e) {
- LOGGER.error("usage WebSocketEventProducerServer port #events XML|JSON eventInterval");
- e.printStackTrace();
- return;
- }
-
- int eventCount = 0;
- try {
- eventCount = Integer.parseInt(args[1]);
- } catch (final Exception e) {
- LOGGER.error("usage WebSocketEventProducerServer port #events XML|JSON eventInterval");
- e.printStackTrace();
- return;
- }
-
- long eventInterval = 0;
- try {
- eventInterval = Long.parseLong(args[3]);
- } catch (final Exception e) {
- LOGGER.error("usage WebSocketEventProducerServer port #events XML|JSON eventInterval");
- e.printStackTrace();
- return;
- }
-
- boolean xmlEvents = false;
- if (args[2].equalsIgnoreCase("XML")) {
- xmlEvents = true;
- } else if (!args[2].equalsIgnoreCase("JSON")) {
- LOGGER.error("usage WebSocketEventProducerServer port #events XML|JSON startDelay eventInterval");
- return;
- }
-
- 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
deleted file mode 100644
index 23d32e252..000000000
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
-
-import lombok.Getter;
-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;
- @Getter
- private long eventsReceivedCount = 0;
-
- private final WsStringMessageClient client;
-
- /**
- * Instantiates a new web socket event subscriber client.
- *
- * @param host the host
- * @param port the port
- * @throws MessagingException the messaging exception
- */
- public WebSocketEventSubscriberClient(final String host, final int port) throws MessagingException {
- this.port = port;
-
- client = new WsStringMessageClient(host, port);
- client.start(this);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void receiveString(final String eventString) {
- LOGGER.debug("{}: port {}, received event {}", WebSocketEventSubscriberClient.class.getName(), port,
- eventString);
- eventsReceivedCount++;
- }
-
- /**
- * Shutdown.
- */
- public void shutdown() {
- client.stop();
- LOGGER.debug("{}: stopped", WebSocketEventSubscriberServer.class.getName());
- }
-
- /**
- * The main method.
- *
- * @param args the arguments
- * @throws MessagingException the messaging exception
- */
- public static void main(final String[] args) throws MessagingException {
- if (args.length != 2) {
- LOGGER.error("usage WebSocketEventSubscriberClient host port");
- return;
- }
-
- int port = 0;
- try {
- port = Integer.parseInt(args[0]);
- } catch (final Exception e) {
- LOGGER.error("usage WebSocketEventSubscriberClient port");
- e.printStackTrace();
- return;
- }
-
- new WebSocketEventSubscriberClient(args[0], port);
- }
-}
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
deleted file mode 100644
index 41291a467..000000000
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
-
-import lombok.Getter;
-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;
- @Getter
- private long eventsReceivedCount = 0;
-
- private final WsStringMessageServer server;
-
- /**
- * Instantiates a new web socket event subscriber server.
- *
- * @param port the port
- * @throws MessagingException the messaging exception
- */
- public WebSocketEventSubscriberServer(final int port) throws MessagingException {
- this.port = port;
-
- server = new WsStringMessageServer(port);
- server.start(this);
-
- LOGGER.debug("{}: port {}, waiting for events", WebSocketEventSubscriberServer.class.getName(), port);
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void receiveString(final String eventString) {
- LOGGER.debug("{}: port {}, received event {}", WebSocketEventSubscriberServer.class.getName(), port,
- eventString);
- eventsReceivedCount++;
- }
-
- /**
- * Shutdown.
- */
- public void shutdown() {
- server.stop();
- LOGGER.debug("{} : stopped", WebSocketEventSubscriberServer.class.getName());
- }
-
- /**
- * The main method.
- *
- * @param args the arguments
- * @throws MessagingException the messaging exception
- */
- public static void main(final String[] args) throws MessagingException {
- if (args.length != 1) {
- LOGGER.error("usage WebSocketEventSubscriberClient port");
- return;
- }
-
- int port = 0;
- try {
- port = Integer.parseInt(args[0]);
- } catch (final Exception e) {
- LOGGER.error("usage WebSocketEventSubscriberClient port");
- e.printStackTrace();
- return;
- }
-
- new WebSocketEventSubscriberServer(port);
- }
-}