aboutsummaryrefslogtreecommitdiffstats
path: root/testsuites/integration/integration-uservice-test/src/test/java
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-09-13 15:25:32 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-09-13 15:26:47 +0100
commit4cfa2e2d98f6877d54da304ef17f096284430908 (patch)
treec9452d2bf6bb96fae9c1e8e2d8ce8f8d01e69d22 /testsuites/integration/integration-uservice-test/src/test/java
parent0e23f7634e1e1fb31454c516974613335fcea1a4 (diff)
Sonar/Checkstyle in service/plugins
Sonar and Checkstyle changes in plugins and services, and knock on changes Issue-ID: POLICY-1034 Change-Id: Iff7df74e54fce2c661dcc2fae75ae93d4cacfe5b Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'testsuites/integration/integration-uservice-test/src/test/java')
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java37
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerClient.java30
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerServer.java29
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberClient.java24
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberServer.java23
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java6
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngDepMessagingTest.java4
7 files changed, 145 insertions, 8 deletions
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java
index b17457516..c95498a05 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java
@@ -28,7 +28,6 @@ import java.util.Properties;
import kafka.admin.AdminUtils;
import kafka.admin.RackAwareMode;
-import kafka.server.BrokerState;
import kafka.server.KafkaConfig;
import kafka.server.KafkaServer;
import kafka.utils.TestUtils;
@@ -48,6 +47,9 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.service.engine.main.ApexMain;
+/**
+ * The Class TestKafka2Kafka.
+ */
public class TestKafka2Kafka {
// The method of starting an embedded Kafka server used in this example is based on the method
// on stack overflow at
@@ -66,6 +68,11 @@ public class TestKafka2Kafka {
private static ZkClient zkClient;
private static KafkaServer kafkaServer;
+ /**
+ * Setup dummy kafka server.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@BeforeClass
public static void setupDummyKafkaServer() throws IOException {
// setup Zookeeper
@@ -95,6 +102,11 @@ public class TestKafka2Kafka {
}
+ /**
+ * Shutdown dummy kafka server.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@AfterClass
public static void shutdownDummyKafkaServer() throws IOException {
if (kafkaServer != null) {
@@ -108,18 +120,39 @@ public class TestKafka2Kafka {
}
}
+ /**
+ * Test json kafka events.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ */
@Test
public void testJsonKafkaEvents() throws MessagingException, ApexException {
final String[] args = {"src/test/resources/prodcons/Kafka2KafkaJsonEvent.json"};
testKafkaEvents(args, false, "json");
}
+ /**
+ * Test XML kafka events.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ */
@Test
- public void testXMLKafkaEvents() throws MessagingException, ApexException {
+ public void testXmlKafkaEvents() throws MessagingException, ApexException {
final String[] args = {"src/test/resources/prodcons/Kafka2KafkaXmlEvent.json"};
testKafkaEvents(args, true, "xml");
}
+ /**
+ * Test kafka events.
+ *
+ * @param args the args
+ * @param xmlEvents the xml events
+ * @param topicSuffix the topic suffix
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ */
private void testKafkaEvents(final String[] args, final Boolean xmlEvents, final String topicSuffix)
throws MessagingException, ApexException {
final KafkaEventSubscriber subscriber =
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerClient.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerClient.java
index bda312c42..fd78ba5c0 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerClient.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerClient.java
@@ -26,6 +26,9 @@ 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;
+/**
+ * The Class WebSocketEventProducerClient.
+ */
public class WebSocketEventProducerClient implements WsStringMessageListener {
private final String host;
private final int port;
@@ -36,6 +39,16 @@ public class WebSocketEventProducerClient implements WsStringMessageListener {
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;
@@ -51,6 +64,9 @@ public class WebSocketEventProducerClient implements WsStringMessageListener {
+ ", event count " + eventCount + ", xmlEvents " + xmlEvents);
}
+ /**
+ * Send events.
+ */
public void sendEvents() {
System.out.println(WebSocketEventProducerClient.class.getCanonicalName() + ": sending events on host " + host
+ ", port " + port + ", event count " + eventCount + ", xmlEvents " + xmlEvents);
@@ -74,10 +90,18 @@ public class WebSocketEventProducerClient implements WsStringMessageListener {
System.out.println(WebSocketEventProducerClient.class.getCanonicalName() + ": completed");
}
+ /**
+ * Gets the events sent count.
+ *
+ * @return the events sent count
+ */
public long getEventsSentCount() {
return eventsSentCount;
}
+ /**
+ * Shutdown.
+ */
public void shutdown() {
client.stop();
System.out.println(WebSocketEventProducerClient.class.getCanonicalName() + ": stopped");
@@ -96,6 +120,12 @@ public class WebSocketEventProducerClient implements WsStringMessageListener {
+ ", received event " + 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) {
System.err.println("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerServer.java
index a36c4d61e..53aa0cab4 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerServer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerServer.java
@@ -26,6 +26,9 @@ 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;
+/**
+ * The Class WebSocketEventProducerServer.
+ */
public class WebSocketEventProducerServer implements WsStringMessageListener {
private final int port;
private final int eventCount;
@@ -35,6 +38,15 @@ public class WebSocketEventProducerServer implements WsStringMessageListener {
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;
@@ -49,6 +61,9 @@ public class WebSocketEventProducerServer implements WsStringMessageListener {
+ eventCount + ", xmlEvents " + xmlEvents);
}
+ /**
+ * Send events.
+ */
public void sendEvents() {
System.out.println(WebSocketEventProducerServer.class.getCanonicalName() + ": sending events on port " + port
+ ", event count " + eventCount + ", xmlEvents " + xmlEvents);
@@ -73,10 +88,18 @@ public class WebSocketEventProducerServer implements WsStringMessageListener {
System.out.println(WebSocketEventProducerServer.class.getCanonicalName() + ": event sending completed");
}
+ /**
+ * Gets the events sent count.
+ *
+ * @return the events sent count
+ */
public long getEventsSentCount() {
return eventsSentCount;
}
+ /**
+ * Shutdown.
+ */
public void shutdown() {
server.stop();
System.out.println(WebSocketEventProducerServer.class.getCanonicalName() + ": stopped");
@@ -95,6 +118,12 @@ public class WebSocketEventProducerServer implements WsStringMessageListener {
+ ", received event " + 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) {
System.err.println("usage WebSocketEventProducerServer port #events XML|JSON eventInterval");
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberClient.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberClient.java
index 48ca9c884..27a34a92e 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberClient.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberClient.java
@@ -24,12 +24,22 @@ 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;
+/**
+ * The Class WebSocketEventSubscriberClient.
+ */
public class WebSocketEventSubscriberClient implements WsStringMessageListener {
private final int port;
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;
@@ -51,15 +61,29 @@ public class WebSocketEventSubscriberClient implements WsStringMessageListener {
eventsReceivedCount++;
}
+ /**
+ * Gets the events received count.
+ *
+ * @return the events received count
+ */
public long getEventsReceivedCount() {
return eventsReceivedCount;
}
+ /**
+ * Shutdown.
+ */
public void shutdown() {
client.stop();
System.out.println(WebSocketEventSubscriberServer.class.getCanonicalName() + ": stopped");
}
+ /**
+ * 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) {
System.err.println("usage WebSocketEventSubscriberClient host port");
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberServer.java
index 83e324b9c..854a0e410 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberServer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberServer.java
@@ -24,12 +24,21 @@ 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;
+/**
+ * The Class WebSocketEventSubscriberServer.
+ */
public class WebSocketEventSubscriberServer implements WsStringMessageListener {
private final int port;
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;
@@ -54,15 +63,29 @@ public class WebSocketEventSubscriberServer implements WsStringMessageListener {
eventsReceivedCount++;
}
+ /**
+ * Gets the events received count.
+ *
+ * @return the events received count
+ */
public long getEventsReceivedCount() {
return eventsReceivedCount;
}
+ /**
+ * Shutdown.
+ */
public void shutdown() {
server.stop();
System.out.println(WebSocketEventSubscriberServer.class.getCanonicalName() + ": stopped");
}
+ /**
+ * 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) {
System.err.println("usage WebSocketEventSubscriberClient port");
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java
index aa7b56189..8f9aa6cee 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java
@@ -29,13 +29,11 @@ import java.io.IOException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
-import org.onap.policy.apex.auth.clieditor.ApexCLIEditorMain;
+import org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.model.basicmodel.service.ModelService;
import org.onap.policy.apex.model.utilities.TextFileUtils;
import org.onap.policy.apex.service.engine.main.ApexMain;
-import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.common.utils.resources.ResourceUtils;
public class EventAlbumContextTest {
@@ -86,7 +84,7 @@ public class EventAlbumContextTest {
final String[] cliArgs = new String[] { "-c", tempCommandFile.getCanonicalPath(), "-l",
tempLogFile.getAbsolutePath(), "-o", tempModelFile.getAbsolutePath() };
- new ApexCLIEditorMain(cliArgs);
+ new ApexCommandLineEditorMain(cliArgs);
final String[] args = new String[] { "-m", tempModelFile.getAbsolutePath(), "-c", configFile };
final ApexMain apexMain = new ApexMain(args);
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngDepMessagingTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngDepMessagingTest.java
index 451b4c76a..187a2a316 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngDepMessagingTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngDepMessagingTest.java
@@ -42,7 +42,7 @@ import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.service.ModelService;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
-import org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters;
+import org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters;
import org.onap.policy.apex.service.engine.event.ApexEvent;
import org.onap.policy.apex.service.parameters.engineservice.EngineServiceParameters;
import org.onap.policy.apex.test.common.model.SampleDomainModelFactory;
@@ -94,7 +94,7 @@ public class EngDepMessagingTest {
engineServiceParameters.setDeploymentPort(58820);
engineServiceParameters.setInstanceCount(3);
engineServiceParameters.setId(100);
- engineServiceParameters.getEngineParameters().getExecutorParameterMap().put("MVEL", new MVELExecutorParameters());
+ engineServiceParameters.getEngineParameters().getExecutorParameterMap().put("MVEL", new MvelExecutorParameters());
ParameterService.register(engineServiceParameters);
ParameterService.register(engineServiceParameters.getEngineParameters());