aboutsummaryrefslogtreecommitdiffstats
path: root/testsuites/integration/integration-uservice-test/src
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-09-13 23:48:50 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-09-13 23:49:32 +0100
commitcd68fc9bae7d6258f77ff59c1431e4f925f61a4c (patch)
tree53054a7c8e8738644785039c3a200c6b23d4b3ed /testsuites/integration/integration-uservice-test/src
parent4cfa2e2d98f6877d54da304ef17f096284430908 (diff)
Address sonar/Checkstyle Issues
Sweep through Apex codebase to fix most ceheckstyle and straightforward sonar issues. Issue-ID: POLICY-1034 Change-Id: I149d9a94ad893affc93573e8de5e3304b6bdde2d Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'testsuites/integration/integration-uservice-test/src')
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/EventGenerator.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/events/EventGenerator.java)111
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2File.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2File.java)4
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileFiltered.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2FileFiltered.java)14
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileIgnore.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2FileIgnore.java)23
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/JMSEventProducer.java)45
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/JMSEventSubscriber.java)32
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestContext.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestContext.java)105
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestInitialContextFactory.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestInitialContextFactory.java)10
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestJMS2JMS.java)72
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestPing.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestPing.java)52
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/KafkaEventProducer.java)39
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/KafkaEventSubscriber.java)28
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/TestKafka2Kafka.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java)2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/TestKafkaXmlEventProducer.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafkaXMLEventProducer.java)11
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestFile2Rest.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestFile2REST.java)101
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRest2File.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestREST2File.java)105
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRestClientEndpoint.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestRESTClientEndpoint.java)50
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServer.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restserver/TestRESTServer.java)214
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServerVpnContext.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restserver/TestRESTServerVPNContext.java)14
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/sampletypes/Foo.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/sampletypes/Foo.java)2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/sampletypes/FooMap.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/sampletypes/FooMap.java)6
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsClient.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/TestWs2WsClient.java)12
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsServer.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/TestWs2WsServer.java)35
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerClient.java)4
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerServer.java)4
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberClient.java)2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberServer.java)2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/context/EventAlbumContextTest.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java)2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngDepMessagingTest.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngDepMessagingTest.java)34
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngineTestServer.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngineTestServer.java)4
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/policymodels/JMSTestModel.json8
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSJsonEvent.json4
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSObjectEvent.json4
33 files changed, 953 insertions, 202 deletions
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/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 4c2ed5c88..6a585d7c5 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/events/EventGenerator.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/EventGenerator.java
@@ -18,16 +18,24 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.events;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.events;
import java.util.Random;
/**
+ * The Class EventGenerator.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class EventGenerator {
private static int nextEventNo = 0;
+ /**
+ * Xml events.
+ *
+ * @param eventCount the event count
+ * @return the string
+ */
public static String xmlEvents(final int eventCount) {
final StringBuilder builder = new StringBuilder();
@@ -41,6 +49,12 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json events.
+ *
+ * @param eventCount the event count
+ * @return the string
+ */
public static String jsonEvents(final int eventCount) {
final StringBuilder builder = new StringBuilder();
@@ -54,6 +68,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Xml event.
+ *
+ * @return the string
+ */
public static String xmlEvent() {
final Random rand = new Random();
@@ -93,6 +112,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event.
+ *
+ * @return the string
+ */
public static String jsonEvent() {
final Random rand = new Random();
@@ -118,6 +142,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event no name.
+ *
+ * @return the string
+ */
public static String jsonEventNoName() {
final Random rand = new Random();
@@ -143,6 +172,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event bad name.
+ *
+ * @return the string
+ */
public static String jsonEventBadName() {
final Random rand = new Random();
@@ -167,6 +201,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event no ex name.
+ *
+ * @return the string
+ */
public static String jsonEventNoExName() {
final Random rand = new Random();
@@ -190,6 +229,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event no version.
+ *
+ * @return the string
+ */
public static String jsonEventNoVersion() {
final Random rand = new Random();
@@ -215,6 +259,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event bad version.
+ *
+ * @return the string
+ */
public static String jsonEventBadVersion() {
final Random rand = new Random();
@@ -240,6 +289,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event no ex version.
+ *
+ * @return the string
+ */
public static String jsonEventNoExVersion() {
final Random rand = new Random();
@@ -264,6 +318,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event no namespace.
+ *
+ * @return the string
+ */
public static String jsonEventNoNamespace() {
final Random rand = new Random();
@@ -289,6 +348,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event bad namespace.
+ *
+ * @return the string
+ */
public static String jsonEventBadNamespace() {
final Random rand = new Random();
@@ -314,6 +378,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event no ex namespace.
+ *
+ * @return the string
+ */
public static String jsonEventNoExNamespace() {
final Random rand = new Random();
@@ -338,6 +407,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event no source.
+ *
+ * @return the string
+ */
public static String jsonEventNoSource() {
final Random rand = new Random();
@@ -363,6 +437,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event bad source.
+ *
+ * @return the string
+ */
public static String jsonEventBadSource() {
final Random rand = new Random();
@@ -388,6 +467,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event no target.
+ *
+ * @return the string
+ */
public static String jsonEventNoTarget() {
final Random rand = new Random();
@@ -413,6 +497,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event bad target.
+ *
+ * @return the string
+ */
public static String jsonEventBadTarget() {
final Random rand = new Random();
@@ -438,6 +527,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event missing fields.
+ *
+ * @return the string
+ */
public static String jsonEventMissingFields() {
final StringBuilder builder = new StringBuilder();
@@ -452,6 +546,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event null fields.
+ *
+ * @return the string
+ */
public static String jsonEventNullFields() {
final StringBuilder builder = new StringBuilder();
@@ -470,6 +569,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
public static void main(final String[] args) {
if (args.length != 2) {
System.err.println("usage EventGenerator #events XML|JSON");
@@ -495,6 +599,11 @@ public class EventGenerator {
}
}
+ /**
+ * Gets the next event no.
+ *
+ * @return the next event no
+ */
public static int getNextEventNo() {
return nextEventNo;
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2File.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2File.java
index 347cce80e..5483501b2 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2File.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2File.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.file;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.file;
import static org.junit.Assert.assertEquals;
@@ -42,7 +42,7 @@ public class TestFile2File {
}
@Test
- public void testXMLFileEvents() throws MessagingException, ApexException, IOException {
+ public void testXmlFileEvents() throws MessagingException, ApexException, IOException {
final String[] args = {"src/test/resources/prodcons/File2FileXmlEvent.json"};
testFileEvents(args, "src/test/resources/events/EventsOut.xmlfile", 106739);
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2FileFiltered.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileFiltered.java
index c2b097273..48cd6c013 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2FileFiltered.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileFiltered.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.file;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.file;
import static org.junit.Assert.assertEquals;
@@ -38,8 +38,10 @@ public class TestFile2FileFiltered {
public void testJsonFilteredFileInOutEvents() throws MessagingException, ApexException, IOException {
final String[] args = {"src/test/resources/prodcons/File2FileFilteredInOutJsonEvent.json"};
- final String[] outFilePaths =
- {"src/test/resources/events/Events0004Out.json", "src/test/resources/events/Events0104Out.json"};
+ final String[] outFilePaths = {
+ "src/test/resources/events/Events0004Out.json",
+ "src/test/resources/events/Events0104Out.json"
+ };
final long[] expectedFileSizes = {25949, 23007};
@@ -50,8 +52,10 @@ public class TestFile2FileFiltered {
public void testJsonFilteredFileOutEvents() throws MessagingException, ApexException, IOException {
final String[] args = {"src/test/resources/prodcons/File2FileFilteredOutJsonEvent.json"};
- final String[] outFilePaths =
- {"src/test/resources/events/Events0004Out.json", "src/test/resources/events/Events0104Out.json"};
+ final String[] outFilePaths = {
+ "src/test/resources/events/Events0004Out.json",
+ "src/test/resources/events/Events0104Out.json"
+ };
final long[] expectedFileSizes = {25949, 23007};
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2FileIgnore.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileIgnore.java
index c952d73b5..49c7a96d1 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2FileIgnore.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileIgnore.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.file;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.file;
import static org.junit.Assert.assertEquals;
@@ -31,10 +31,21 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.utilities.TextFileUtils;
import org.onap.policy.apex.service.engine.main.ApexMain;
+/**
+ * The Class TestFile2FileIgnore.
+ */
public class TestFile2FileIgnore {
// This test is used just to bring up an instance of Apex for manual testing and demonstrations
// It should always be ignored in automated testing because it holds Apex up for a very long
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
// time
public static void main(final String[] args) throws MessagingException, ApexException, IOException {
final String[] apexArgs = {"src/test/resources/prodcons/File2FileJsonEvent.json"};
@@ -42,6 +53,16 @@ public class TestFile2FileIgnore {
testFileEvents(apexArgs, "src/test/resources/events/EventsOut.json", 48656);
}
+ /**
+ * Test file events.
+ *
+ * @param args the args
+ * @param outFilePath the out file path
+ * @param expectedFileSize the expected file size
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
private static void testFileEvents(final String[] args, final String outFilePath, final long expectedFileSize)
throws MessagingException, ApexException, IOException {
final ApexMain apexMain = new ApexMain(args);
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/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 8b9f2a112..6a7e61739 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/JMSEventProducer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.jms;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.jms;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@@ -29,17 +29,19 @@ import javax.jms.Session;
import javax.jms.Topic;
import org.apache.activemq.command.ActiveMQTopic;
-import org.onap.policy.apex.apps.uservice.test.adapt.events.EventGenerator;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException;
+import org.onap.policy.apex.testsuites.integration.uservice.adapt.events.EventGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
+ * The Class JmsEventProducer.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public class JMSEventProducer implements Runnable {
- private static final Logger LOGGER = LoggerFactory.getLogger(JMSEventProducer.class);
+public class JmsEventProducer implements Runnable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(JmsEventProducer.class);
private final String topic;
private final int eventCount;
@@ -52,7 +54,19 @@ public class JMSEventProducer implements Runnable {
private boolean stopFlag = false;
private final Connection connection;
- public JMSEventProducer(final String topic, final ConnectionFactory connectionFactory, final String username,
+ /**
+ * Instantiates a new jms event producer.
+ *
+ * @param topic the topic
+ * @param connectionFactory the connection factory
+ * @param username the username
+ * @param password the password
+ * @param eventCount the event count
+ * @param sendObjects the send objects
+ * @param eventInterval the event interval
+ * @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 {
this.topic = topic;
@@ -66,6 +80,9 @@ public class JMSEventProducer implements Runnable {
producerThread.start();
}
+ /* (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
@Override
public void run() {
final Topic jmsTopic = new ActiveMQTopic(topic);
@@ -86,10 +103,20 @@ public class JMSEventProducer implements Runnable {
}
}
+ /**
+ * Send events.
+ */
public void sendEvents() {
sendEventsFlag = true;
}
+ /**
+ * Send events to topic.
+ *
+ * @param jmsSession the jms session
+ * @param jmsProducer the jms producer
+ * @throws JMSException the JMS exception
+ */
private void sendEventsToTopic(final Session jmsSession, final MessageProducer jmsProducer) throws JMSException {
LOGGER.info("{} : sending events to JMS server, event count {}", this.getClass().getCanonicalName(),
@@ -110,10 +137,18 @@ public class JMSEventProducer implements Runnable {
LOGGER.info("{} : completed, number of events sent", this.getClass().getCanonicalName(), eventsSentCount);
}
+ /**
+ * Gets the events sent count.
+ *
+ * @return the events sent count
+ */
public long getEventsSentCount() {
return eventsSentCount;
}
+ /**
+ * Shutdown.
+ */
public void shutdown() {
LOGGER.info("{} : stopping", this.getClass().getCanonicalName());
stopFlag = true;
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/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 916216a5a..d1af8c39a 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/JMSEventSubscriber.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.jms;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.jms;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@@ -38,10 +38,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
+ * The Class JmsEventSubscriber.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public class JMSEventSubscriber implements Runnable {
- private static final Logger LOGGER = LoggerFactory.getLogger(JMSEventSubscriber.class);
+public class JmsEventSubscriber implements Runnable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(JmsEventSubscriber.class);
private final String topic;
private long eventsReceivedCount = 0;
@@ -50,7 +52,16 @@ public class JMSEventSubscriber implements Runnable {
private final Connection connection;
- public JMSEventSubscriber(final String topic, final ConnectionFactory connectionFactory, final String username,
+ /**
+ * Instantiates a new jms event subscriber.
+ *
+ * @param topic the topic
+ * @param connectionFactory the connection factory
+ * @param username the username
+ * @param password the password
+ * @throws JMSException the JMS exception
+ */
+ public JmsEventSubscriber(final String topic, final ConnectionFactory connectionFactory, final String username,
final String password) throws JMSException {
this.topic = topic;
connection = connectionFactory.createConnection(username, password);
@@ -60,6 +71,9 @@ public class JMSEventSubscriber implements Runnable {
subscriberThread.start();
}
+ /* (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
@Override
public void run() {
final Topic jmsTopic = new ActiveMQTopic(topic);
@@ -95,10 +109,20 @@ public class JMSEventSubscriber implements Runnable {
LOGGER.info("{} : event reception completed", this.getClass().getCanonicalName());
}
+ /**
+ * Gets the events received count.
+ *
+ * @return the events received count
+ */
public long getEventsReceivedCount() {
return eventsReceivedCount;
}
+ /**
+ * Shutdown.
+ *
+ * @throws JMSException the JMS exception
+ */
public void shutdown() throws JMSException {
subscriberThread.interrupt();
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestContext.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestContext.java
index de3c8d37b..b8ea0c7fe 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestContext.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestContext.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.jms;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.jms;
-import static org.onap.policy.apex.apps.uservice.test.adapt.jms.TestJMS2JMS.HOST;
-import static org.onap.policy.apex.apps.uservice.test.adapt.jms.TestJMS2JMS.JMS_TOPIC_APEX_IN;
-import static org.onap.policy.apex.apps.uservice.test.adapt.jms.TestJMS2JMS.JMS_TOPIC_APEX_OUT;
-import static org.onap.policy.apex.apps.uservice.test.adapt.jms.TestJMS2JMS.PORT;
-import static org.onap.policy.apex.apps.uservice.test.adapt.jms.TestJMS2JMS.connectionFactory;
+import static org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestJms2Jms.HOST;
+import static org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestJms2Jms.JMS_TOPIC_APEX_IN;
+import static org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestJms2Jms.JMS_TOPIC_APEX_OUT;
+import static org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestJms2Jms.PORT;
+import static org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestJms2Jms.connectionFactory;
import java.util.HashMap;
import java.util.Hashtable;
@@ -43,12 +43,17 @@ import org.apache.activemq.command.ActiveMQTopic;
import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException;
/**
+ * The Class TestContext.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestContext implements Context {
private Properties testProperties;
+ /**
+ * Instantiates a new test context.
+ */
public TestContext() {
try {
testProperties = new Properties();
@@ -65,127 +70,213 @@ public class TestContext implements Context {
}
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#lookup(javax.naming.Name)
+ */
@Override
public Object lookup(final Name name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#lookup(java.lang.String)
+ */
@Override
public Object lookup(final String name) throws NamingException {
return testProperties.get(name);
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#bind(javax.naming.Name, java.lang.Object)
+ */
@Override
public void bind(final Name name, final Object obj) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#bind(java.lang.String, java.lang.Object)
+ */
@Override
public void bind(final String name, final Object obj) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#rebind(javax.naming.Name, java.lang.Object)
+ */
@Override
public void rebind(final Name name, final Object obj) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#rebind(java.lang.String, java.lang.Object)
+ */
@Override
public void rebind(final String name, final Object obj) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#unbind(javax.naming.Name)
+ */
@Override
public void unbind(final Name name) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#unbind(java.lang.String)
+ */
@Override
public void unbind(final String name) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#rename(javax.naming.Name, javax.naming.Name)
+ */
@Override
public void rename(final Name oldName, final Name newName) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#rename(java.lang.String, java.lang.String)
+ */
@Override
public void rename(final String oldName, final String newName) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#list(javax.naming.Name)
+ */
@Override
public NamingEnumeration<NameClassPair> list(final Name name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#list(java.lang.String)
+ */
@Override
public NamingEnumeration<NameClassPair> list(final String name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#listBindings(javax.naming.Name)
+ */
@Override
public NamingEnumeration<Binding> listBindings(final Name name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#listBindings(java.lang.String)
+ */
@Override
public NamingEnumeration<Binding> listBindings(final String name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#destroySubcontext(javax.naming.Name)
+ */
@Override
public void destroySubcontext(final Name name) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#destroySubcontext(java.lang.String)
+ */
@Override
public void destroySubcontext(final String name) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#createSubcontext(javax.naming.Name)
+ */
@Override
public Context createSubcontext(final Name name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#createSubcontext(java.lang.String)
+ */
@Override
public Context createSubcontext(final String name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#lookupLink(javax.naming.Name)
+ */
@Override
public Object lookupLink(final Name name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#lookupLink(java.lang.String)
+ */
@Override
public Object lookupLink(final String name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#getNameParser(javax.naming.Name)
+ */
@Override
public NameParser getNameParser(final Name name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#getNameParser(java.lang.String)
+ */
@Override
public NameParser getNameParser(final String name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#composeName(javax.naming.Name, javax.naming.Name)
+ */
@Override
public Name composeName(final Name name, final Name prefix) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#composeName(java.lang.String, java.lang.String)
+ */
@Override
public String composeName(final String name, final String prefix) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#addToEnvironment(java.lang.String, java.lang.Object)
+ */
@Override
public Object addToEnvironment(final String propName, final Object propVal) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#removeFromEnvironment(java.lang.String)
+ */
@Override
public Object removeFromEnvironment(final String propName) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#getEnvironment()
+ */
@Override
public Hashtable<?, ?> getEnvironment() throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#close()
+ */
@Override
public void close() throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#getNameInNamespace()
+ */
@Override
public String getNameInNamespace() throws NamingException {
return null;
}
-
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestInitialContextFactory.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestInitialContextFactory.java
index 6cb874671..d04cd5791 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestInitialContextFactory.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestInitialContextFactory.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.jms;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.jms;
import java.util.Hashtable;
@@ -27,12 +27,19 @@ import javax.naming.NamingException;
import javax.naming.spi.InitialContextFactory;
/**
+ * A factory for creating TestInitialContext objects.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestInitialContextFactory implements InitialContextFactory {
private final Context context = new TestContext();
+ /**
+ * Instantiates a new test initial context factory.
+ *
+ * @throws NamingException the naming exception
+ */
public TestInitialContextFactory() throws NamingException {}
/*
@@ -44,5 +51,4 @@ public class TestInitialContextFactory implements InitialContextFactory {
public Context getInitialContext(final Hashtable<?, ?> environment) throws NamingException {
return context;
}
-
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestJMS2JMS.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.java
index f021b2674..422a97a11 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestJMS2JMS.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.jms;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.jms;
import static org.junit.Assert.assertEquals;
@@ -44,7 +44,10 @@ import org.onap.policy.apex.service.engine.main.ApexMain;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
-public class TestJMS2JMS {
+/**
+ * The Class TestJms2Jms.
+ */
+public class TestJms2Jms {
public static final String PORT = "5445";
public static final String HOST = "localhost";
public static final String JMS_TOPIC_APEX_IN = "jms/topic/apexIn";
@@ -52,14 +55,14 @@ public class TestJMS2JMS {
private static final int SLEEP_TIME = 1500;
private static final String GROUP_ROLE = "guests";
- private static final String PACKAGE_NAME = "org.onap.policy.apex.apps.uservice.test.adapt.jms";
+ private static final String PACKAGE_NAME = "org.onap.policy.apex.testsuites.integration.uservice.adapt.jms";
private static final String USERNAME = "guest";
private static final String PASSWORD = "IAmAGuest";
private static final String URL = "tcp://" + HOST + ":" + PORT;
private static final String DATA_PARENT_DIR = Paths.get("target", "activemq-data").toString();
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(TestJMS2JMS.class);
+ private static final XLogger LOGGER = XLoggerFactory.getXLogger(TestJms2Jms.class);
private static final long MAX_TEST_LENGTH = 10000;
private static final int EVENT_COUNT = 100;
@@ -70,8 +73,13 @@ public class TestJMS2JMS {
public static ActiveMQConnectionFactory connectionFactory;
+ /**
+ * Setup embedded jms server.
+ *
+ * @throws Exception the exception
+ */
@BeforeClass
- public static void setupEmbeddedJMSServer() throws Exception {
+ public static void setupEmbeddedJmsServer() throws Exception {
final ArrayList<BrokerPlugin> plugins = new ArrayList<BrokerPlugin>();
final BrokerPlugin authenticationPlugin = getAuthenticationBrokerPlugin();
plugins.add(authenticationPlugin);
@@ -89,6 +97,11 @@ public class TestJMS2JMS {
connectionFactory.setTrustedPackages(Arrays.asList(PACKAGE_NAME));
}
+ /**
+ * Gets the authentication broker plugin.
+ *
+ * @return the authentication broker plugin
+ */
private static BrokerPlugin getAuthenticationBrokerPlugin() {
final List<AuthenticationUser> users = new ArrayList<AuthenticationUser>();
users.add(new AuthenticationUser(USERNAME, PASSWORD, GROUP_ROLE));
@@ -96,8 +109,13 @@ public class TestJMS2JMS {
return authenticationPlugin;
}
+ /**
+ * Shutdown embedded jms server.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@AfterClass
- public static void shutdownEmbeddedJMSServer() throws IOException {
+ public static void shutdownEmbeddedJmsServer() throws IOException {
try {
if (broker != null) {
broker.stop();
@@ -108,22 +126,42 @@ public class TestJMS2JMS {
}
+ /**
+ * Test jms object events.
+ *
+ * @throws ApexException the apex exception
+ * @throws JMSException the JMS exception
+ */
@Test
- public void testJMSObjectEvents() throws ApexException, JMSException {
+ public void testJmsObjectEvents() throws ApexException, JMSException {
final String[] args = { "src/test/resources/prodcons/JMS2JMSObjectEvent.json" };
- testJMSEvents(args, true);
+ testJmsEvents(args, true);
}
+ /**
+ * Test jms json events.
+ *
+ * @throws ApexException the apex exception
+ * @throws JMSException the JMS exception
+ */
@Test
- public void testJMSJsonEvents() throws ApexException, JMSException {
+ public void testJmsJsonEvents() throws ApexException, JMSException {
final String[] args = { "src/test/resources/prodcons/JMS2JMSJsonEvent.json" };
- testJMSEvents(args, false);
+ testJmsEvents(args, false);
}
- private void testJMSEvents(final String[] args, final Boolean sendObjects) throws ApexException, JMSException {
- final JMSEventSubscriber subscriber =
- new JMSEventSubscriber(JMS_TOPIC_APEX_OUT, connectionFactory, USERNAME, PASSWORD);
- final JMSEventProducer producer = new JMSEventProducer(JMS_TOPIC_APEX_IN, connectionFactory, USERNAME, PASSWORD,
+ /**
+ * Test jms events.
+ *
+ * @param args the args
+ * @param sendObjects the send objects
+ * @throws ApexException the apex exception
+ * @throws JMSException the JMS exception
+ */
+ private void testJmsEvents(final String[] args, final Boolean sendObjects) throws ApexException, JMSException {
+ final JmsEventSubscriber subscriber =
+ new JmsEventSubscriber(JMS_TOPIC_APEX_OUT, connectionFactory, USERNAME, PASSWORD);
+ final JmsEventProducer producer = new JmsEventProducer(JMS_TOPIC_APEX_IN, connectionFactory, USERNAME, PASSWORD,
EVENT_COUNT, sendObjects, EVENT_INTERVAL);
final ApexMain apexMain = new ApexMain(args);
@@ -148,6 +186,12 @@ public class TestJMS2JMS {
}
+ /**
+ * Checks if is timed out.
+ *
+ * @param testStartTime the test start time
+ * @return true, if is timed out
+ */
private boolean isTimedOut(final long testStartTime) {
return System.currentTimeMillis() < testStartTime + MAX_TEST_LENGTH;
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestPing.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestPing.java
index caf6e2ffd..b0dfb553a 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestPing.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestPing.java
@@ -18,13 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.jms;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.jms;
import java.io.Serializable;
import org.onap.policy.apex.service.engine.event.ApexEventException;
/**
+ * The Class TestPing.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestPing implements Serializable {
@@ -35,44 +37,92 @@ public class TestPing implements Serializable {
private long pingTime = System.currentTimeMillis();
private long pongTime = -1;
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
public String getName() {
return name;
}
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
public void setName(final String name) {
this.name = name;
}
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
public String getDescription() {
return description;
}
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
public void setDescription(final String description) {
this.description = description;
}
+ /**
+ * Gets the ping time.
+ *
+ * @return the ping time
+ */
public long getPingTime() {
return pingTime;
}
+ /**
+ * Sets the ping time.
+ *
+ * @param pingTime the new ping time
+ */
public void setPingTime(final long pingTime) {
this.pingTime = pingTime;
}
+ /**
+ * Gets the pong time.
+ *
+ * @return the pong time
+ */
public long getPongTime() {
return pongTime;
}
+ /**
+ * Sets the pong time.
+ *
+ * @param pongTime the new pong time
+ */
public void setPongTime(final long pongTime) {
this.pongTime = pongTime;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
@Override
public String toString() {
return "TestPing [name=" + name + ", description=" + description + ", pingTime=" + pingTime + ", pongTime="
+ pongTime + "]";
}
+ /**
+ * Verify.
+ *
+ * @throws ApexEventException the apex event exception
+ */
public void verify() throws ApexEventException {
if (!name.startsWith("Rose")) {
throw new ApexEventException("TestPing is not valid");
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/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 c243b8b07..072d67864 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/KafkaEventProducer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.kafka;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.kafka;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
@@ -26,10 +26,12 @@ import java.util.concurrent.TimeUnit;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerRecord;
-import org.onap.policy.apex.apps.uservice.test.adapt.events.EventGenerator;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
+import org.onap.policy.apex.testsuites.integration.uservice.adapt.events.EventGenerator;
/**
+ * The Class KafkaEventProducer.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class KafkaEventProducer implements Runnable {
@@ -44,6 +46,15 @@ public class KafkaEventProducer implements Runnable {
private boolean sendEventsFlag = false;
private boolean stopFlag = false;
+ /**
+ * Instantiates a new kafka event producer.
+ *
+ * @param topic the topic
+ * @param kafkaServerAddress the kafka server address
+ * @param eventCount the event count
+ * @param xmlEvents the xml events
+ * @param eventInterval the event interval
+ */
public KafkaEventProducer(final String topic, final String kafkaServerAddress, final int eventCount,
final boolean xmlEvents, final long eventInterval) {
this.topic = topic;
@@ -56,6 +67,9 @@ public class KafkaEventProducer implements Runnable {
producerThread.start();
}
+ /* (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
@Override
public void run() {
final Properties kafkaProducerProperties = new Properties();
@@ -82,10 +96,18 @@ public class KafkaEventProducer implements Runnable {
producer.close(1000, TimeUnit.MILLISECONDS);
}
+ /**
+ * Send events.
+ */
public void sendEvents() {
sendEventsFlag = true;
}
+ /**
+ * Send events to topic.
+ *
+ * @param producer the producer
+ */
private void sendEventsToTopic(final Producer<String, String> producer) {
System.out.println(KafkaEventProducer.class.getCanonicalName() + ": sending events to Kafka server at "
+ kafkaServerAddress + ", event count " + eventCount + ", xmlEvents " + xmlEvents);
@@ -109,10 +131,18 @@ public class KafkaEventProducer implements Runnable {
System.out.println(KafkaEventProducer.class.getCanonicalName() + ": completed");
}
+ /**
+ * Gets the events sent count.
+ *
+ * @return the events sent count
+ */
public long getEventsSentCount() {
return eventsSentCount;
}
+ /**
+ * Shutdown.
+ */
public void shutdown() {
System.out.println(KafkaEventProducer.class.getCanonicalName() + ": stopping");
@@ -125,6 +155,11 @@ public class KafkaEventProducer implements Runnable {
System.out.println(KafkaEventProducer.class.getCanonicalName() + ": stopped");
}
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
public static void main(final String[] args) {
if (args.length != 5) {
System.err.println("usage KafkaEventProducer topic kafkaServerAddress #events XML|JSON eventInterval");
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/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 8bdc56dda..4b6a62e28 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/KafkaEventSubscriber.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.kafka;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.kafka;
import java.util.Arrays;
import java.util.Properties;
@@ -30,6 +30,8 @@ import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
/**
+ * The Class KafkaEventSubscriber.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class KafkaEventSubscriber implements Runnable {
@@ -41,6 +43,13 @@ public class KafkaEventSubscriber implements Runnable {
Thread subscriberThread;
+ /**
+ * Instantiates a new kafka event subscriber.
+ *
+ * @param topic the topic
+ * @param kafkaServerAddress the kafka server address
+ * @throws MessagingException the messaging exception
+ */
public KafkaEventSubscriber(final String topic, final String kafkaServerAddress) throws MessagingException {
this.topic = topic;
this.kafkaServerAddress = kafkaServerAddress;
@@ -61,6 +70,9 @@ public class KafkaEventSubscriber implements Runnable {
subscriberThread.start();
}
+ /* (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
@Override
public void run() {
System.out.println(KafkaEventSubscriber.class.getCanonicalName() + ": receiving events from Kafka server at "
@@ -85,10 +97,18 @@ public class KafkaEventSubscriber implements Runnable {
System.out.println(KafkaEventSubscriber.class.getCanonicalName() + ": event reception completed");
}
+ /**
+ * Gets the events received count.
+ *
+ * @return the events received count
+ */
public long getEventsReceivedCount() {
return eventsReceivedCount;
}
+ /**
+ * Shutdown.
+ */
public void shutdown() {
subscriberThread.interrupt();
@@ -101,6 +121,12 @@ public class KafkaEventSubscriber implements Runnable {
}
+ /**
+ * 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 KafkaEventSubscriber topic kafkaServerAddress");
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/testsuites/integration/uservice/adapt/kafka/TestKafka2Kafka.java
index c95498a05..e70a597c2 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/testsuites/integration/uservice/adapt/kafka/TestKafka2Kafka.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.kafka;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.kafka;
import static org.junit.Assert.assertEquals;
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafkaXMLEventProducer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/TestKafkaXmlEventProducer.java
index 80b4aef55..2b16d71d4 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafkaXMLEventProducer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/TestKafkaXmlEventProducer.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.kafka;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.kafka;
import java.util.Properties;
@@ -29,10 +29,17 @@ import org.onap.policy.apex.plugins.event.protocol.xml.jaxb.XMLApexEvent;
import org.onap.policy.apex.plugins.event.protocol.xml.jaxb.XMLApexEventData;
/**
+ * The Class TestKafkaXmlEventProducer.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public class TestKafkaXMLEventProducer {
+public class TestKafkaXmlEventProducer {
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
public static void main(final String[] args) {
final Properties props = new Properties();
props.put("bootstrap.servers", "localhost:49092");
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestFile2REST.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestFile2Rest.java
index dd3f15ab6..d681fd471 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestFile2REST.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestFile2Rest.java
@@ -18,11 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.restclient;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.restclient;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import com.google.gson.Gson;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
@@ -44,10 +46,10 @@ 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;
-import com.google.gson.Gson;
-
-
-public class TestFile2REST {
+/**
+ * The Class TestFile2Rest.
+ */
+public class TestFile2Rest {
private static final String BASE_URI = "http://localhost:32801/TestFile2Rest";
private static HttpServer server;
@@ -57,9 +59,14 @@ public class TestFile2REST {
private final PrintStream stdout = System.out;
private final PrintStream stderr = System.err;
+ /**
+ * Sets the up.
+ *
+ * @throws Exception the exception
+ */
@BeforeClass
public static void setUp() throws Exception {
- final ResourceConfig rc = new ResourceConfig(TestRESTClientEndpoint.class);
+ final ResourceConfig rc = new ResourceConfig(TestRestClientEndpoint.class);
server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc);
while (!server.isStarted()) {
@@ -67,23 +74,36 @@ public class TestFile2REST {
}
}
+ /**
+ * Tear down.
+ *
+ * @throws Exception the exception
+ */
@AfterClass
public static void tearDown() throws Exception {
server.shutdown();
}
+ /**
+ * Test file events post.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testFileEventsPost() throws MessagingException, ApexException, IOException {
final Client client = ClientBuilder.newClient();
- final String[] args = {"src/test/resources/prodcons/File2RESTJsonEventPost.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/File2RESTJsonEventPost.json" };
final ApexMain apexMain = new ApexMain(args);
// Wait for the required amount of events to be received or for 10 seconds
for (int i = 0; i < 100; i++) {
ThreadUtilities.sleep(100);
final Response response = client.target("http://localhost:32801/TestFile2Rest/apex/event/Stats")
- .request("application/json").get();
+ .request("application/json").get();
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
final String responseString = response.readEntity(String.class);
@@ -98,9 +118,17 @@ public class TestFile2REST {
apexMain.shutdown();
}
+ /**
+ * Test file events put.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testFileEventsPut() throws MessagingException, ApexException, IOException {
- final String[] args = {"src/test/resources/prodcons/File2RESTJsonEventPut.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/File2RESTJsonEventPut.json" };
final ApexMain apexMain = new ApexMain(args);
final Client client = ClientBuilder.newClient();
@@ -109,7 +137,7 @@ public class TestFile2REST {
for (int i = 0; i < 100; i++) {
ThreadUtilities.sleep(100);
final Response response = client.target("http://localhost:32801/TestFile2Rest/apex/event/Stats")
- .request("application/json").get();
+ .request("application/json").get();
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
final String responseString = response.readEntity(String.class);
@@ -124,12 +152,20 @@ public class TestFile2REST {
apexMain.shutdown();
}
+ /**
+ * Test file events no url.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testFileEventsNoURL() throws MessagingException, ApexException, IOException {
+ public void testFileEventsNoUrl() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/File2RESTJsonEventNoURL.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/File2RESTJsonEventNoURL.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(200);
@@ -143,12 +179,20 @@ public class TestFile2REST {
assertTrue(outString.contains(" no URL has been set for event sending on REST client"));
}
+ /**
+ * Test file events bad url.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testFileEventsBadURL() throws MessagingException, ApexException, IOException {
+ public void testFileEventsBadUrl() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/File2RESTJsonEventBadURL.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/File2RESTJsonEventBadURL.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(200);
@@ -160,15 +204,23 @@ public class TestFile2REST {
System.setErr(stderr);
assertTrue(outString.contains(
- "send of event to URL \"http://localhost:32801/TestFile2Rest/apex/event/Bad\" using HTTP \"POST\" failed with status code 404"));
+ "send of event to URL \"http://localhost:32801/TestFile2Rest/apex/event/Bad\" using HTTP \"POST\" failed with status code 404"));
}
+ /**
+ * Test file events bad http method.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testFileEventsBadHTTPMethod() throws MessagingException, ApexException, IOException {
+ public void testFileEventsBadHttpMethod() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/File2RESTJsonEventBadHTTPMethod.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/File2RESTJsonEventBadHTTPMethod.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(200);
@@ -180,15 +232,24 @@ public class TestFile2REST {
System.setErr(stderr);
assertTrue(outString.contains(
- "specified HTTP method of \"DELETE\" is invalid, only HTTP methods \"POST\" and \"PUT\" are supproted for event sending on REST client producer"));
+ "specified HTTP method of \"DELETE\" is invalid, only HTTP methods \"POST\" and \"PUT\" "
+ + "are supproted for event sending on REST client producer"));
}
+ /**
+ * Test file events bad response.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testFileEventsBadResponse() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/File2RESTJsonEventPostBadResponse.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/File2RESTJsonEventPostBadResponse.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(500);
@@ -200,6 +261,6 @@ public class TestFile2REST {
System.setErr(stderr);
assertTrue(outString.contains(
- "send of event to URL \"http://localhost:32801/TestFile2Rest/apex/event/PostEventBadResponse\" using HTTP \"POST\" failed with status code 400"));
+ "send of event to URL \"http://localhost:32801/TestFile2Rest/apex/event/PostEventBadResponse\" using HTTP \"POST\" failed with status code 400"));
}
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestREST2File.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRest2File.java
index 922e03217..ec41de5fb 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestREST2File.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRest2File.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.restclient;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.restclient;
import static org.junit.Assert.assertTrue;
@@ -41,8 +41,10 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.utilities.TextFileUtils;
import org.onap.policy.apex.service.engine.main.ApexMain;
-
-public class TestREST2File {
+/**
+ * The Class TestRest2File.
+ */
+public class TestRest2File {
private static final String BASE_URI = "http://localhost:32801/TestRest2File";
private HttpServer server;
@@ -53,9 +55,14 @@ public class TestREST2File {
private final PrintStream stdout = System.out;
private final PrintStream stderr = System.err;
+ /**
+ * Sets the up.
+ *
+ * @throws Exception the exception
+ */
@Before
public void setUp() throws Exception {
- final ResourceConfig rc = new ResourceConfig(TestRESTClientEndpoint.class);
+ final ResourceConfig rc = new ResourceConfig(TestRestClientEndpoint.class);
server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc);
while (!server.isStarted()) {
@@ -63,19 +70,35 @@ public class TestREST2File {
}
}
+ /**
+ * Tear down.
+ *
+ * @throws Exception the exception
+ */
@After
public void tearDown() throws Exception {
server.shutdown();
}
+ /**
+ * Delete temp files.
+ */
@AfterClass
public static void deleteTempFiles() {
new File("src/test/resources/events/EventsOut.json").delete();
}
+ /**
+ * Test rest events in.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTEventsIn() throws MessagingException, ApexException, IOException {
- final String[] args = {"src/test/resources/prodcons/REST2FileJsonEvent.json"};
+ public void testRestEventsIn() throws MessagingException, ApexException, IOException {
+ final String[] args =
+ { "src/test/resources/prodcons/REST2FileJsonEvent.json" };
final ApexMain apexMain = new ApexMain(args);
@@ -83,16 +106,24 @@ public class TestREST2File {
apexMain.shutdown();
final String outputEventText = TextFileUtils.getTextFileAsString("src/test/resources/events/EventsOut.json");
- assertTrue(outputEventText.contains(
- "04\",\n" + " \"version\": \"0.0.1\",\n" + " \"nameSpace\": \"org.onap.policy.apex.sample.events\""));
+ assertTrue(outputEventText.contains("04\",\n" + " \"version\": \"0.0.1\",\n"
+ + " \"nameSpace\": \"org.onap.policy.apex.sample.events\""));
}
+ /**
+ * Test file empty events.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testFileEmptyEvents() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/REST2FileJsonEmptyEvents.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/REST2FileJsonEmptyEvents.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(1000);
@@ -104,15 +135,23 @@ public class TestREST2File {
System.setErr(stderr);
assertTrue(outString.contains(
- "received an empty event from URL \"http://localhost:32801/TestRest2File/apex/event/GetEmptyEvent\""));
+ "received an empty event from URL \"http://localhost:32801/TestRest2File/apex/event/GetEmptyEvent\""));
}
+ /**
+ * Test file events no url.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testFileEventsNoURL() throws MessagingException, ApexException, IOException {
+ public void testFileEventsNoUrl() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/REST2FileJsonEventNoURL.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/REST2FileJsonEventNoURL.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(1000);
@@ -126,12 +165,20 @@ public class TestREST2File {
assertTrue(outString.contains(" no URL has been set for event sending on REST client"));
}
+ /**
+ * Test file events bad url.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testFileEventsBadURL() throws MessagingException, ApexException, IOException {
+ public void testFileEventsBadUrl() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/REST2FileJsonEventBadURL.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/REST2FileJsonEventBadURL.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(1000);
@@ -143,15 +190,23 @@ public class TestREST2File {
System.setErr(stderr);
assertTrue(outString.contains(
- "reception of event from URL \"http://localhost:32801/TestRest2File/apex/event/Bad\" failed with status code 404"));
+ "reception of event from URL \"http://localhost:32801/TestRest2File/apex/event/Bad\" failed with status code 404"));
}
+ /**
+ * Test file events bad http method.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testFileEventsBadHTTPMethod() throws MessagingException, ApexException, IOException {
+ public void testFileEventsBadHttpMethod() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/REST2FileJsonEventBadHTTPMethod.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/REST2FileJsonEventBadHTTPMethod.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(1000);
@@ -162,16 +217,24 @@ public class TestREST2File {
System.setOut(stdout);
System.setErr(stderr);
- assertTrue(outString.contains(
- "specified HTTP method of \"POST\" is invalid, only HTTP method \"GET\" is supported for event reception on REST client consumer"));
+ assertTrue(outString.contains("specified HTTP method of \"POST\" is invalid, "
+ + "only HTTP method \"GET\" is supported for event reception on REST client consumer"));
}
+ /**
+ * Test file events bad response.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testFileEventsBadResponse() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/REST2FileJsonEventBadResponse.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/REST2FileJsonEventBadResponse.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(1000);
@@ -183,6 +246,6 @@ public class TestREST2File {
System.setErr(stderr);
assertTrue(outString.contains(
- "reception of event from URL \"http://localhost:32801/TestRest2File/apex/event/GetEventBadResponse\" failed with status code 400 and message \"\""));
+ "reception of event from URL \"http://localhost:32801/TestRest2File/apex/event/GetEventBadResponse\" failed with status code 400 and message \"\""));
}
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestRESTClientEndpoint.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRestClientEndpoint.java
index 79634ebcb..906b20bf2 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestRESTClientEndpoint.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRestClientEndpoint.java
@@ -18,11 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.restclient;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.restclient;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import com.google.gson.Gson;
+
import java.util.Map;
import java.util.Random;
@@ -32,17 +34,22 @@ import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
-import com.google.gson.Gson;
-
-
+/**
+ * The Class TestRestClientEndpoint.
+ */
@Path("/apex")
-public class TestRESTClientEndpoint {
+public class TestRestClientEndpoint {
private static int postMessagesReceived = 0;
private static int putMessagesReceived = 0;
private static int statMessagesReceived = 0;
private static int getMessagesReceived = 0;
+ /**
+ * Service get stats.
+ *
+ * @return the response
+ */
@Path("/event/Stats")
@GET
public Response serviceGetStats() {
@@ -51,6 +58,11 @@ public class TestRESTClientEndpoint {
+ ",\"POST\": " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build();
}
+ /**
+ * Service get event.
+ *
+ * @return the response
+ */
@Path("/event/GetEvent")
@GET
public Response serviceGetEvent() {
@@ -69,18 +81,34 @@ public class TestRESTClientEndpoint {
return Response.status(200).entity(eventString).build();
}
+ /**
+ * Service get empty event.
+ *
+ * @return the response
+ */
@Path("/event/GetEmptyEvent")
@GET
public Response serviceGetEmptyEvent() {
return Response.status(200).build();
}
+ /**
+ * Service get event bad response.
+ *
+ * @return the response
+ */
@Path("/event/GetEventBadResponse")
@GET
public Response serviceGetEventBadResponse() {
return Response.status(400).build();
}
+ /**
+ * Service post request.
+ *
+ * @param jsonString the json string
+ * @return the response
+ */
@Path("/event/PostEvent")
@POST
public Response servicePostRequest(final String jsonString) {
@@ -98,12 +126,24 @@ public class TestRESTClientEndpoint {
+ ",\"POST\": , " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build();
}
+ /**
+ * Service post request bad response.
+ *
+ * @param jsonString the json string
+ * @return the response
+ */
@Path("/event/PostEventBadResponse")
@POST
public Response servicePostRequestBadResponse(final String jsonString) {
return Response.status(400).build();
}
+ /**
+ * Service put request.
+ *
+ * @param jsonString the json string
+ * @return the response
+ */
@Path("/event/PutEvent")
@PUT
public Response servicePutRequest(final String jsonString) {
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restserver/TestRESTServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServer.java
index 15928b3c7..59cc2ceea 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restserver/TestRESTServer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServer.java
@@ -18,11 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.restserver;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.restserver;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import com.google.gson.Gson;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
@@ -40,10 +42,10 @@ 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;
-import com.google.gson.Gson;
-
-
-public class TestRESTServer {
+/**
+ * The Class TestRestServer.
+ */
+public class TestRestServer {
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
private final ByteArrayOutputStream errContent = new ByteArrayOutputStream();
@@ -52,16 +54,24 @@ public class TestRESTServer {
private static int eventsSent = 0;
+ /**
+ * Test rest server put.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerPut() throws MessagingException, ApexException, IOException {
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEvent.json"};
+ public void testRestServerPut() throws MessagingException, ApexException, IOException {
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEvent.json" };
final ApexMain apexMain = new ApexMain(args);
final Client client = ClientBuilder.newClient();
for (int i = 0; i < 20; i++) {
final Response response = client.target("http://localhost:23324/apex/FirstConsumer/EventIn")
- .request("application/json").put(Entity.json(getEvent()));
+ .request("application/json").put(Entity.json(getEvent()));
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
final String responseString = response.readEntity(String.class);
@@ -75,16 +85,24 @@ public class TestRESTServer {
apexMain.shutdown();
}
+ /**
+ * Test rest server post.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerPost() throws MessagingException, ApexException, IOException {
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEvent.json"};
+ public void testRestServerPost() throws MessagingException, ApexException, IOException {
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEvent.json" };
final ApexMain apexMain = new ApexMain(args);
final Client client = ClientBuilder.newClient();
for (int i = 0; i < 20; i++) {
final Response response = client.target("http://localhost:23324/apex/FirstConsumer/EventIn")
- .request("application/json").post(Entity.json(getEvent()));
+ .request("application/json").post(Entity.json(getEvent()));
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
final String responseString = response.readEntity(String.class);
@@ -98,9 +116,17 @@ public class TestRESTServer {
apexMain.shutdown();
}
+ /**
+ * Test rest server get status.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerGetStatus() throws MessagingException, ApexException, IOException {
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEvent.json"};
+ public void testRestServerGetStatus() throws MessagingException, ApexException, IOException {
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEvent.json" };
final ApexMain apexMain = new ApexMain(args);
final Client client = ClientBuilder.newClient();
@@ -108,39 +134,47 @@ public class TestRESTServer {
// trigger 10 POST & PUT events
for (int i = 0; i < 10; i++) {
final Response postResponse = client.target("http://localhost:23324/apex/FirstConsumer/EventIn")
- .request("application/json").post(Entity.json(getEvent()));
+ .request("application/json").post(Entity.json(getEvent()));
final Response putResponse = client.target("http://localhost:23324/apex/FirstConsumer/EventIn")
- .request("application/json").put(Entity.json(getEvent()));
+ .request("application/json").put(Entity.json(getEvent()));
assertEquals(Response.Status.OK.getStatusCode(), postResponse.getStatus());
assertEquals(Response.Status.OK.getStatusCode(), putResponse.getStatus());
}
- final Response statResponse =
- client.target("http://localhost:23324/apex/FirstConsumer/Status").request("application/json").get();
+ final Response statResponse = client.target("http://localhost:23324/apex/FirstConsumer/Status")
+ .request("application/json").get();
assertEquals(Response.Status.OK.getStatusCode(), statResponse.getStatus());
final String responseString = statResponse.readEntity(String.class);
@SuppressWarnings("unchecked")
final Map<String, Object> jsonMap = new Gson().fromJson(responseString, Map.class);
- assertEquals("[FirstConsumer]", jsonMap.get("INPUTS"));
+ assertEquals("[FirstConsumer", ((String)jsonMap.get("INPUTS")).substring(0, 14));
assertEquals(1.0, jsonMap.get("STAT"));
- assertEquals(10.0, jsonMap.get("POST"));
- assertEquals(10.0, jsonMap.get("PUT"));
+ assertTrue((double)jsonMap.get("POST") >= 10.0);
+ assertTrue((double)jsonMap.get("PUT") >= 10.0);
apexMain.shutdown();
}
+ /**
+ * Test rest server multi inputs.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerMultiInputs() throws MessagingException, ApexException, IOException {
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventMultiIn.json"};
+ public void testRestServerMultiInputs() throws MessagingException, ApexException, IOException {
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventMultiIn.json" };
final ApexMain apexMain = new ApexMain(args);
final Client client = ClientBuilder.newClient();
for (int i = 0; i < 20; i++) {
final Response firstResponse = client.target("http://localhost:23324/apex/FirstConsumer/EventIn")
- .request("application/json").post(Entity.json(getEvent()));
+ .request("application/json").post(Entity.json(getEvent()));
assertEquals(Response.Status.OK.getStatusCode(), firstResponse.getStatus());
final String firstResponseString = firstResponse.readEntity(String.class);
@@ -151,7 +185,7 @@ public class TestRESTServer {
assertEquals("Test slogan for External Event0", firstJsonMap.get("TestSlogan"));
final Response secondResponse = client.target("http://localhost:23324/apex/SecondConsumer/EventIn")
- .request("application/json").post(Entity.json(getEvent()));
+ .request("application/json").post(Entity.json(getEvent()));
assertEquals(Response.Status.OK.getStatusCode(), secondResponse.getStatus());
final String secondResponseString = secondResponse.readEntity(String.class);
@@ -165,12 +199,20 @@ public class TestRESTServer {
apexMain.shutdown();
}
+ /**
+ * Test rest server producer standalone.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerProducerStandalone() throws MessagingException, ApexException, IOException {
+ public void testRestServerProducerStandalone() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventProducerStandalone.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventProducerStandalone.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(200);
@@ -181,16 +223,24 @@ public class TestRESTServer {
System.setOut(stdout);
System.setErr(stderr);
- assertTrue(outString
- .contains("the parameters \"host\", \"port\", and \"standalone\" are illegal on REST Server producer"));
+ assertTrue(outString.contains(
+ "the parameters \"host\", \"port\", and \"standalone\" are illegal on REST Server producer"));
}
+ /**
+ * Test rest server producer host.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerProducerHost() throws MessagingException, ApexException, IOException {
+ public void testRestServerProducerHost() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventProducerHost.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventProducerHost.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(200);
@@ -204,12 +254,20 @@ public class TestRESTServer {
assertTrue(outString.contains(" host is specified only in standalone mode"));
}
+ /**
+ * Test rest server producer port.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerProducerPort() throws MessagingException, ApexException, IOException {
+ public void testRestServerProducerPort() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventProducerPort.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventProducerPort.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(200);
@@ -223,12 +281,20 @@ public class TestRESTServer {
assertTrue(outString.contains(" port is specified only in standalone mode"));
}
+ /**
+ * Test rest server consumer standalone no host.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerConsumerStandaloneNoHost() throws MessagingException, ApexException, IOException {
+ public void testRestServerConsumerStandaloneNoHost() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventConsumerStandaloneNoHost.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventConsumerStandaloneNoHost.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(200);
@@ -239,16 +305,24 @@ public class TestRESTServer {
System.setOut(stdout);
System.setErr(stderr);
- assertTrue(outString.contains(
- "the parameters \"host\" and \"port\" must be defined for REST Server consumer (FirstConsumer) in standalone mode"));
+ assertTrue(outString.contains("the parameters \"host\" and \"port\" must be defined for REST Server consumer "
+ + "(FirstConsumer) in standalone mode"));
}
+ /**
+ * Test rest server consumer standalone no port.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerConsumerStandaloneNoPort() throws MessagingException, ApexException, IOException {
+ public void testRestServerConsumerStandaloneNoPort() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventConsumerStandaloneNoPort.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventConsumerStandaloneNoPort.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(200);
@@ -259,16 +333,24 @@ public class TestRESTServer {
System.setOut(stdout);
System.setErr(stderr);
- assertTrue(outString.contains(
- "the parameters \"host\" and \"port\" must be defined for REST Server consumer (FirstConsumer) in standalone mode"));
+ assertTrue(outString.contains("the parameters \"host\" and \"port\" must be defined for REST Server consumer "
+ + "(FirstConsumer) in standalone mode"));
}
+ /**
+ * Test rest server producer not sync.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerProducerNotSync() throws MessagingException, ApexException, IOException {
+ public void testRestServerProducerNotSync() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventProducerNotSync.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventProducerNotSync.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(200);
@@ -279,16 +361,24 @@ public class TestRESTServer {
System.setOut(stdout);
System.setErr(stderr);
- assertTrue(outString.contains(
- "REST Server producer (FirstProducer) must run in synchronous mode with a REST Server consumer"));
+ assertTrue(outString.contains("REST Server producer (FirstProducer) must run in synchronous mode "
+ + "with a REST Server consumer"));
}
+ /**
+ * Test rest server consumer not sync.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerConsumerNotSync() throws MessagingException, ApexException, IOException {
+ public void testRestServerConsumerNotSync() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventConsumerNotSync.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventConsumerNotSync.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(200);
@@ -299,20 +389,29 @@ public class TestRESTServer {
System.setOut(stdout);
System.setErr(stderr);
- assertTrue(outString.contains(
- "peer \"FirstConsumer for peered mode SYNCHRONOUS does not exist or is not defined with the same peered mode"));
+ assertTrue(outString
+ .contains("peer \"FirstConsumer for peered mode SYNCHRONOUS does not exist or is not defined "
+ + "with the same peered mode"));
}
+ /**
+ * Test rest server divide by zero.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerDivideByZero() throws MessagingException, ApexException, IOException {
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventDivideByZero.json"};
+ public void testRestServerDivideByZero() throws MessagingException, ApexException, IOException {
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventDivideByZero.json" };
final ApexMain apexMain = new ApexMain(args);
final Client client = ClientBuilder.newClient();
for (int i = 0; i < 20; i++) {
final Response response = client.target("http://localhost:23324/apex/FirstConsumer/EventIn")
- .request("application/json").put(Entity.json(getEvent()));
+ .request("application/json").put(Entity.json(getEvent()));
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
final String responseString = response.readEntity(String.class);
@@ -327,16 +426,21 @@ public class TestRESTServer {
apexMain.shutdown();
}
+ /**
+ * Gets the event.
+ *
+ * @return the event
+ */
private String getEvent() {
final Random rand = new Random();
final int nextMatchCase = rand.nextInt(4);
final String nextEventName = "Event0" + rand.nextInt(2) + "00";
final String eventString = "{\n" + "\"nameSpace\": \"org.onap.policy.apex.sample.events\",\n" + "\"name\": \""
- + nextEventName + "\",\n" + "\"version\": \"0.0.1\",\n" + "\"source\": \"REST_" + eventsSent++ + "\",\n"
- + "\"target\": \"apex\",\n" + "\"TestSlogan\": \"Test slogan for External Event0\",\n"
- + "\"TestMatchCase\": " + nextMatchCase + ",\n" + "\"TestTimestamp\": " + System.currentTimeMillis()
- + ",\n" + "\"TestTemperature\": 9080.866\n" + "}";
+ + nextEventName + "\",\n" + "\"version\": \"0.0.1\",\n" + "\"source\": \"REST_" + eventsSent++
+ + "\",\n" + "\"target\": \"apex\",\n" + "\"TestSlogan\": \"Test slogan for External Event0\",\n"
+ + "\"TestMatchCase\": " + nextMatchCase + ",\n" + "\"TestTimestamp\": "
+ + System.currentTimeMillis() + ",\n" + "\"TestTemperature\": 9080.866\n" + "}";
return eventString;
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restserver/TestRESTServerVPNContext.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServerVpnContext.java
index cb52dd50b..1791033e6 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restserver/TestRESTServerVPNContext.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServerVpnContext.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.restserver;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.restserver;
import static org.junit.Assert.assertEquals;
@@ -37,12 +37,12 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.service.engine.main.ApexMain;
-public class TestRESTServerVPNContext {
+public class TestRestServerVpnContext {
private static int eventsSent = 0;
@Ignore
@Test
- public void testRESTServerPut() throws MessagingException, ApexException, IOException {
+ public void testRestServerPut() throws MessagingException, ApexException, IOException {
final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventContextJava.json"};
final ApexMain apexMain = new ApexMain(args);
@@ -79,7 +79,7 @@ public class TestRESTServerVPNContext {
@Ignore
@Test
- public void testRESTServerPutAvro() throws MessagingException, ApexException, IOException {
+ public void testRestServerPutAvro() throws MessagingException, ApexException, IOException {
final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventContextAvro.json"};
final ApexMain apexMain = new ApexMain(args);
@@ -123,12 +123,12 @@ public class TestRESTServerVPNContext {
return eventString;
}
- private String setupCustomerContext(final String customerName, final String linkList, final int slaDT,
- final int ytdDT) {
+ private String setupCustomerContext(final String customerName, final String linkList, final int slaDt,
+ final int ytdDt) {
final String eventString = "{\n" + "\"nameSpace\": \"org.onap.policy.apex.domains.vpn.events\",\n"
+ "\"name\": \"VPNCustomerCtxtTriggerEvent\",\n" + "\"version\": \"0.0.1\",\n" + "\"source\": \"REST_"
+ eventsSent++ + "\",\n" + "\"target\": \"apex\",\n" + "\"CustomerName\": \"" + customerName + "\",\n"
- + "\"LinkList\": \"" + linkList + "\",\n" + "\"SlaDT\": \"" + slaDT + "\",\n" + "\"YtdDT\": " + ytdDT
+ + "\"LinkList\": \"" + linkList + "\",\n" + "\"SlaDT\": \"" + slaDt + "\",\n" + "\"YtdDT\": " + ytdDt
+ "\n" + "}";
return eventString;
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/sampletypes/Foo.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/sampletypes/Foo.java
index da075b6a2..2d6ab4629 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/sampletypes/Foo.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/sampletypes/Foo.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.sampletypes;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.sampletypes;
public class Foo {
private String bar;
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/sampletypes/FooMap.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/sampletypes/FooMap.java
index 9adaf6dae..af09e5a3b 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/sampletypes/FooMap.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/sampletypes/FooMap.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.sampletypes;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.sampletypes;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -42,7 +42,7 @@ public class FooMap extends LinkedHashMap<String, String> {
super(initialCapacity);
}
- public FooMap(final Map<? extends String, ? extends String> m) {
- super(m);
+ public FooMap(final Map<? extends String, ? extends String> map) {
+ super(map);
}
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/TestWs2WsClient.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsClient.java
index 52e896438..c2db95860 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/TestWs2WsClient.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsClient.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.websocket;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
import static org.junit.Assert.assertEquals;
@@ -35,18 +35,18 @@ public class TestWs2WsClient {
private static final int EVENT_INTERVAL = 20;
@Test
- public void testJsonWSEvents() throws MessagingException, ApexException {
+ public void testJsonWsEvents() throws MessagingException, ApexException {
final String[] args = {"src/test/resources/prodcons/Ws2WsClientJsonEvent.json"};
- testWSEvents(args, false);
+ testWsEvents(args, false);
}
@Test
- public void testXMLWSEvents() throws MessagingException, ApexException {
+ public void testXmlWsEvents() throws MessagingException, ApexException {
final String[] args = {"src/test/resources/prodcons/Ws2WsClientXMLEvent.json"};
- testWSEvents(args, true);
+ testWsEvents(args, true);
}
- private void testWSEvents(final String[] args, final Boolean xmlEvents) throws MessagingException, ApexException {
+ 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);
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/TestWs2WsServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsServer.java
index 86f6ee123..34871e3c6 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/TestWs2WsServer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsServer.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.websocket;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
import static org.junit.Assert.assertEquals;
@@ -28,25 +28,48 @@ 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;
+ /**
+ * Test json ws events.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ */
@Test
- public void testJsonWSEvents() throws MessagingException, ApexException {
+ public void testJsonWsEvents() throws MessagingException, ApexException {
final String[] args = {"src/test/resources/prodcons/Ws2WsServerJsonEvent.json"};
- testWSEvents(args, false);
+ testWsEvents(args, false);
}
+ /**
+ * Test xml ws events.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ */
@Test
- public void testXMLWSEvents() throws MessagingException, ApexException {
+ public void testXmlWsEvents() throws MessagingException, ApexException {
final String[] args = {"src/test/resources/prodcons/Ws2WsServerXMLEvent.json"};
- testWSEvents(args, true);
+ testWsEvents(args, true);
}
- public void testWSEvents(final String[] args, final boolean xmlEvents) throws MessagingException, ApexException {
+ /**
+ * 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);
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/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java
index fd78ba5c0..84a337362 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/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.websocket;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
-import org.onap.policy.apex.apps.uservice.test.adapt.events.EventGenerator;
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;
/**
* The Class WebSocketEventProducerClient.
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/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java
index 53aa0cab4..3e5ff714e 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/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.websocket;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
-import org.onap.policy.apex.apps.uservice.test.adapt.events.EventGenerator;
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;
/**
* The Class WebSocketEventProducerServer.
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/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java
index 27a34a92e..6477a0dc9 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/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.websocket;
+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;
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/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java
index 854a0e410..92329236f 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/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.websocket;
+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;
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/testsuites/integration/uservice/context/EventAlbumContextTest.java
index 8f9aa6cee..757a48302 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/testsuites/integration/uservice/context/EventAlbumContextTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.context;
+package org.onap.policy.apex.testsuites.integration.uservice.context;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
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/testsuites/integration/uservice/engdep/EngDepMessagingTest.java
index 187a2a316..a306b536e 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/testsuites/integration/uservice/engdep/EngDepMessagingTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.engdep;
+package org.onap.policy.apex.testsuites.integration.uservice.engdep;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -45,7 +45,7 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
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;
+import org.onap.policy.apex.testsuites.integration.common.model.SampleDomainModelFactory;
import org.onap.policy.common.parameters.ParameterService;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -67,15 +67,18 @@ public class EngDepMessagingTest {
private ContextParameters contextParameters;
private EngineServiceParameters engineServiceParameters;
+ /**
+ * Before test.
+ */
@Before
public void beforeTest() {
schemaParameters = new SchemaParameters();
-
+
schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
- ParameterService.register(schemaParameters);
-
+ ParameterService.register(schemaParameters, true);
+
contextParameters = new ContextParameters();
contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME);
@@ -83,23 +86,27 @@ public class EngDepMessagingTest {
contextParameters.getLockManagerParameters().setName(ContextParameterConstants.LOCKING_GROUP_NAME);
contextParameters.getPersistorParameters().setName(ContextParameterConstants.PERSISTENCE_GROUP_NAME);
- ParameterService.register(contextParameters);
+ ParameterService.register(contextParameters, true);
ParameterService.register(contextParameters.getDistributorParameters());
ParameterService.register(contextParameters.getLockManagerParameters());
ParameterService.register(contextParameters.getPersistorParameters());
-
+
engineServiceParameters = new EngineServiceParameters();
engineServiceParameters.setName("EngDepMessagingTest");
engineServiceParameters.setVersion("0.0.1");
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());
}
+ /**
+ * After test.
+ */
@After
public void afterTest() {
ParameterService.deregister(engineServiceParameters);
@@ -158,13 +165,13 @@ public class EngDepMessagingTest {
eventDataMap.put("TestTimestamp", testStartTime.getTime());
eventDataMap.put("TestTemperature", 34.5445667);
- final ApexEvent event0 =
- new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "apex", "test");
+ final ApexEvent event0 = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events",
+ "apex", "test");
event0.putAll(eventDataMap);
server.sendEvent(event0);
- final ApexEvent event1 =
- new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "apex", "test");
+ final ApexEvent event1 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events",
+ "apex", "test");
event1.putAll(eventDataMap);
server.sendEvent(event1);
@@ -215,5 +222,6 @@ public class EngDepMessagingTest {
* @throws Exception the exception
*/
@After
- public void tearDown() throws Exception {}
+ public void tearDown() throws Exception {
+ }
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngineTestServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngineTestServer.java
index 1a8b1d364..9e6ff67ca 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngineTestServer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngineTestServer.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.engdep;
+package org.onap.policy.apex.testsuites.integration.uservice.engdep;
import java.util.Date;
@@ -211,7 +211,7 @@ public class EngineTestServer implements Runnable, EngineServiceEventInterface {
* is registered with a component using the component's {@code addTestApexListener} method. When
* the testApex event occurs, that object's appropriate method is invoked.
*
- * This class listens for events from the Apex engine
+ * <p>This class listens for events from the Apex engine
*
* @see TestApexEvent
*/
diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policymodels/JMSTestModel.json b/testsuites/integration/integration-uservice-test/src/test/resources/policymodels/JMSTestModel.json
index d85630456..354638a6d 100644
--- a/testsuites/integration/integration-uservice-test/src/test/resources/policymodels/JMSTestModel.json
+++ b/testsuites/integration/integration-uservice-test/src/test/resources/policymodels/JMSTestModel.json
@@ -342,7 +342,7 @@
"taskLogic": {
"key": "TaskLogic",
"logicFlavour": "JAVASCRIPT",
- "logic": "var outFieldType = Java.type(\"org.onap.policy.apex.apps.uservice.test.adapt.jms.TestPing\");\nvar outValue = new outFieldType();\n\nvar inValue = executor.inFields.get(\"TestPing\");\n\nexecutor.logger.info(inValue);\n\noutValue.setPingTime(inValue.getPingTime());\noutValue.setPongTime(new Date().getTime());\noutValue.setName(inValue.getName() + \"_out\");\n\noutValue.setDescription(\ninValue.getDescription() +\n\". So Romeo would, were he not Romeo call'd,\" +\n\" retain that dear perfection which he owes, without that title.\");\n\nexecutor.logger.info(outValue);\nexecutor.outFields.put(\"TestPing\", outValue)\n\nvar returnValueType = Java.type(\"java.lang.Boolean\");\nvar returnValue = new returnValueType(true);"
+ "logic": "var outFieldType = Java.type(\"org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestPing\");\nvar outValue = new outFieldType();\n\nvar inValue = executor.inFields.get(\"TestPing\");\n\nexecutor.logger.info(inValue);\n\noutValue.setPingTime(inValue.getPingTime());\noutValue.setPongTime(new Date().getTime());\noutValue.setName(inValue.getName() + \"_out\");\n\noutValue.setDescription(\ninValue.getDescription() +\n\". So Romeo would, were he not Romeo call'd,\" +\n\" retain that dear perfection which he owes, without that title.\");\n\nexecutor.logger.info(outValue);\nexecutor.outFields.put(\"TestPing\", outValue)\n\nvar returnValueType = Java.type(\"java.lang.Boolean\");\nvar returnValue = new returnValueType(true);"
}
}
}
@@ -366,7 +366,7 @@
"name": "TestPingIncomingEvent",
"version": "0.0.1"
},
- "nameSpace": "org.onap.policy.apex.apps.uservice.test.adapt.jms",
+ "nameSpace": "org.onap.policy.apex.testsuites.integration.uservice.adapt.jms",
"source": "JMS",
"target": "Apex",
"parameter": {
@@ -396,7 +396,7 @@
"name": "TestPingOutgoingEvent",
"version": "0.0.1"
},
- "nameSpace": "org.onap.policy.apex.apps.uservice.test.adapt.jms",
+ "nameSpace": "org.onap.policy.apex.testsuites.integration.uservice.adapt.jms",
"source": "Apex",
"target": "JMS",
"parameter": {
@@ -446,7 +446,7 @@
"version": "0.0.1"
},
"schemaFlavour": "Java",
- "schemaDefinition": "org.onap.policy.apex.apps.uservice.test.adapt.jms.TestPing"
+ "schemaDefinition": "org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestPing"
}
}
]
diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSJsonEvent.json b/testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSJsonEvent.json
index 0d55d8a7d..f8479969b 100644
--- a/testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSJsonEvent.json
+++ b/testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSJsonEvent.json
@@ -20,7 +20,7 @@
"carrierTechnology": "JMS",
"parameterClassName": "org.onap.policy.apex.plugins.event.carrier.jms.JmsCarrierTechnologyParameters",
"parameters": {
- "initialContextFactory": "org.onap.policy.apex.apps.uservice.test.adapt.jms.TestInitialContextFactory",
+ "initialContextFactory": "org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestInitialContextFactory",
"connectionFactory": "ConnectionFactory",
"providerURL": "remote://localhost:5445",
"securityPrincipal": "guest",
@@ -41,7 +41,7 @@
"carrierTechnology": "JMS",
"parameterClassName": "org.onap.policy.apex.plugins.event.carrier.jms.JmsCarrierTechnologyParameters",
"parameters": {
- "initialContextFactory": "org.onap.policy.apex.apps.uservice.test.adapt.jms.TestInitialContextFactory",
+ "initialContextFactory": "org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestInitialContextFactory",
"connectionFactory": "ConnectionFactory",
"providerURL": "remote://localhost:5445",
"securityPrincipal": "guest",
diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSObjectEvent.json b/testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSObjectEvent.json
index 228f8ec60..8fea3346b 100644
--- a/testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSObjectEvent.json
+++ b/testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSObjectEvent.json
@@ -20,7 +20,7 @@
"carrierTechnology": "JMS",
"parameterClassName": "org.onap.policy.apex.plugins.event.carrier.jms.JmsCarrierTechnologyParameters",
"parameters": {
- "initialContextFactory": "org.onap.policy.apex.apps.uservice.test.adapt.jms.TestInitialContextFactory",
+ "initialContextFactory": "org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestInitialContextFactory",
"connectionFactory": "ConnectionFactory",
"providerURL": "remote://localhost:5445",
"securityPrincipal": "guest",
@@ -40,7 +40,7 @@
"carrierTechnology": "JMS",
"parameterClassName": "org.onap.policy.apex.plugins.event.carrier.jms.JmsCarrierTechnologyParameters",
"parameters": {
- "initialContextFactory": "org.onap.policy.apex.apps.uservice.test.adapt.jms.TestInitialContextFactory",
+ "initialContextFactory": "org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestInitialContextFactory",
"connectionFactory": "ConnectionFactory",
"providerURL": "remote://localhost:5445",
"securityPrincipal": "guest",