summaryrefslogtreecommitdiffstats
path: root/services/services-engine/src/test/java
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-09-13 15:25:32 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-09-13 15:26:47 +0100
commit4cfa2e2d98f6877d54da304ef17f096284430908 (patch)
treec9452d2bf6bb96fae9c1e8e2d8ce8f8d01e69d22 /services/services-engine/src/test/java
parent0e23f7634e1e1fb31454c516974613335fcea1a4 (diff)
Sonar/Checkstyle in service/plugins
Sonar and Checkstyle changes in plugins and services, and knock on changes Issue-ID: POLICY-1034 Change-Id: Iff7df74e54fce2c661dcc2fae75ae93d4cacfe5b Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'services/services-engine/src/test/java')
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventGenerator.java (renamed from services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JSONEventGenerator.java)98
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJsonEventHandler.java (renamed from services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONEventHandler.java)224
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJsonTaggedEventConsumer.java (renamed from services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONTaggedEventConsumer.java)10
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java19
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java29
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java36
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java11
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperCarrierTechnologyParameters.java53
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperDistributorParameters.java4
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperTokenDelimitedEventProtocolParameters.java4
10 files changed, 317 insertions, 171 deletions
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JSONEventGenerator.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventGenerator.java
index 94210e473..1ba901090 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JSONEventGenerator.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventGenerator.java
@@ -27,9 +27,15 @@ import java.util.Random;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public class JSONEventGenerator {
+public class JsonEventGenerator {
private static int nextEventNo = 0;
+ /**
+ * Json events.
+ *
+ * @param eventCount the event count
+ * @return the string
+ */
public static String jsonEvents(final int eventCount) {
final StringBuilder builder = new StringBuilder();
@@ -43,6 +49,11 @@ public class JSONEventGenerator {
return builder.toString();
}
+ /**
+ * Json event.
+ *
+ * @return the string
+ */
public static String jsonEvent() {
final Random rand = new Random();
@@ -68,6 +79,11 @@ public class JSONEventGenerator {
return builder.toString();
}
+ /**
+ * Json event no name.
+ *
+ * @return the string
+ */
public static String jsonEventNoName() {
final Random rand = new Random();
@@ -93,6 +109,11 @@ public class JSONEventGenerator {
return builder.toString();
}
+ /**
+ * Json event bad name.
+ *
+ * @return the string
+ */
public static String jsonEventBadName() {
final Random rand = new Random();
@@ -117,6 +138,11 @@ public class JSONEventGenerator {
return builder.toString();
}
+ /**
+ * Json event no ex name.
+ *
+ * @return the string
+ */
public static String jsonEventNoExName() {
final Random rand = new Random();
@@ -140,6 +166,11 @@ public class JSONEventGenerator {
return builder.toString();
}
+ /**
+ * Json event no version.
+ *
+ * @return the string
+ */
public static String jsonEventNoVersion() {
final Random rand = new Random();
@@ -165,6 +196,11 @@ public class JSONEventGenerator {
return builder.toString();
}
+ /**
+ * Json event bad version.
+ *
+ * @return the string
+ */
public static String jsonEventBadVersion() {
final Random rand = new Random();
@@ -190,6 +226,11 @@ public class JSONEventGenerator {
return builder.toString();
}
+ /**
+ * Json event no ex version.
+ *
+ * @return the string
+ */
public static String jsonEventNoExVersion() {
final Random rand = new Random();
@@ -214,6 +255,11 @@ public class JSONEventGenerator {
return builder.toString();
}
+ /**
+ * Json event no namespace.
+ *
+ * @return the string
+ */
public static String jsonEventNoNamespace() {
final Random rand = new Random();
@@ -239,6 +285,11 @@ public class JSONEventGenerator {
return builder.toString();
}
+ /**
+ * Json event bad namespace.
+ *
+ * @return the string
+ */
public static String jsonEventBadNamespace() {
final Random rand = new Random();
@@ -264,6 +315,11 @@ public class JSONEventGenerator {
return builder.toString();
}
+ /**
+ * Json event no ex namespace.
+ *
+ * @return the string
+ */
public static String jsonEventNoExNamespace() {
final Random rand = new Random();
@@ -288,6 +344,11 @@ public class JSONEventGenerator {
return builder.toString();
}
+ /**
+ * Json event no source.
+ *
+ * @return the string
+ */
public static String jsonEventNoSource() {
final Random rand = new Random();
@@ -313,6 +374,11 @@ public class JSONEventGenerator {
return builder.toString();
}
+ /**
+ * Json event bad source.
+ *
+ * @return the string
+ */
public static String jsonEventBadSource() {
final Random rand = new Random();
@@ -338,6 +404,11 @@ public class JSONEventGenerator {
return builder.toString();
}
+ /**
+ * Json event no target.
+ *
+ * @return the string
+ */
public static String jsonEventNoTarget() {
final Random rand = new Random();
@@ -363,6 +434,11 @@ public class JSONEventGenerator {
return builder.toString();
}
+ /**
+ * Json event bad target.
+ *
+ * @return the string
+ */
public static String jsonEventBadTarget() {
final Random rand = new Random();
@@ -388,6 +464,11 @@ public class JSONEventGenerator {
return builder.toString();
}
+ /**
+ * Json event missing fields.
+ *
+ * @return the string
+ */
public static String jsonEventMissingFields() {
final StringBuilder builder = new StringBuilder();
@@ -402,6 +483,11 @@ public class JSONEventGenerator {
return builder.toString();
}
+ /**
+ * Json event null fields.
+ *
+ * @return the string
+ */
public static String jsonEventNullFields() {
final StringBuilder builder = new StringBuilder();
@@ -420,6 +506,11 @@ public class JSONEventGenerator {
return builder.toString();
}
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
public static void main(final String[] args) {
if (args.length != 1) {
System.err.println("usage EventGenerator #events");
@@ -438,6 +529,11 @@ public class JSONEventGenerator {
System.out.println(jsonEvents(eventCount));
}
+ /**
+ * Gets the next event no.
+ *
+ * @return the next event no
+ */
public static int getNextEventNo() {
return nextEventNo;
}
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONEventHandler.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJsonEventHandler.java
index 4f1089229..cfe2921b8 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONEventHandler.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJsonEventHandler.java
@@ -45,23 +45,30 @@ import org.onap.policy.apex.model.eventmodel.concepts.AxEvent;
import org.onap.policy.apex.model.eventmodel.concepts.AxEvents;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
import org.onap.policy.apex.model.utilities.TextFileUtils;
-import org.onap.policy.apex.service.engine.event.impl.jsonprotocolplugin.Apex2JSONEventConverter;
-import org.onap.policy.apex.service.engine.event.impl.jsonprotocolplugin.JSONEventProtocolParameters;
+import org.onap.policy.apex.service.engine.event.impl.jsonprotocolplugin.Apex2JsonEventConverter;
+import org.onap.policy.apex.service.engine.event.impl.jsonprotocolplugin.JsonEventProtocolParameters;
import org.onap.policy.common.parameters.ParameterService;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
/**
* Test JSON Event Handler.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public class TestJSONEventHandler {
- private static final XLogger logger = XLoggerFactory.getXLogger(TestJSONEventHandler.class);
-
+public class TestJsonEventHandler {
+ private static final XLogger logger = XLoggerFactory.getXLogger(TestJsonEventHandler.class);
+
+ /**
+ * Setup event model.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws ApexModelException the apex model exception
+ */
@BeforeClass
public static void setupEventModel() throws IOException, ApexModelException {
- final String policyModelString =
- TextFileUtils.getTextFileAsString("src/test/resources/policymodels/SamplePolicyModelMVEL.json");
+ final String policyModelString = TextFileUtils
+ .getTextFileAsString("src/test/resources/policymodels/SamplePolicyModelMVEL.json");
final ApexModelReader<AxPolicyModel> modelReader = new ApexModelReader<AxPolicyModel>(AxPolicyModel.class);
final AxPolicyModel apexPolicyModel = modelReader.read(new ByteArrayInputStream(policyModelString.getBytes()));
@@ -69,6 +76,9 @@ public class TestJSONEventHandler {
apexPolicyModel.register();
}
+ /**
+ * Initialize default schema parameters.
+ */
@BeforeClass
public static void initializeDefaultSchemaParameters() {
ParameterService.clear();
@@ -77,23 +87,31 @@ public class TestJSONEventHandler {
ParameterService.register(schemaParameters);
}
+ /**
+ * Teardown default schema parameters.
+ */
@AfterClass
public static void teardownDefaultSchemaParameters() {
ParameterService.deregister(ContextParameterConstants.SCHEMA_GROUP_NAME);
}
+ /**
+ * Test JSO nto apex event.
+ *
+ * @throws ApexException the apex exception
+ */
@Test
- public void testJSONtoApexEvent() throws ApexException {
+ public void testJsontoApexEvent() throws ApexException {
try {
- final Apex2JSONEventConverter jsonEventConverter = new Apex2JSONEventConverter();
+ final Apex2JsonEventConverter jsonEventConverter = new Apex2JsonEventConverter();
assertNotNull(jsonEventConverter);
- jsonEventConverter.init(new JSONEventProtocolParameters());
+ jsonEventConverter.init(new JsonEventProtocolParameters());
- final String apexEventJSONStringIn = JSONEventGenerator.jsonEvent();
+ final String apexEventJsonStringIn = JsonEventGenerator.jsonEvent();
- logger.debug("input event\n" + apexEventJSONStringIn);
+ logger.debug("input event\n" + apexEventJsonStringIn);
- final List<ApexEvent> apexEventList = jsonEventConverter.toApexEvent(null, apexEventJSONStringIn);
+ final List<ApexEvent> apexEventList = jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
for (final ApexEvent apexEvent : apexEventList) {
assertNotNull(apexEvent);
@@ -115,129 +133,136 @@ public class TestJSONEventHandler {
}
}
+ /**
+ * Test JSO nto apex bad event.
+ *
+ * @throws ApexException the apex exception
+ */
@Test
- public void testJSONtoApexBadEvent() throws ApexException {
+ public void testJsontoApexBadEvent() throws ApexException {
try {
- final Apex2JSONEventConverter jsonEventConverter = new Apex2JSONEventConverter();
+ final Apex2JsonEventConverter jsonEventConverter = new Apex2JsonEventConverter();
assertNotNull(jsonEventConverter);
- jsonEventConverter.init(new JSONEventProtocolParameters());
+ jsonEventConverter.init(new JsonEventProtocolParameters());
- String apexEventJSONStringIn = null;
+ String apexEventJsonStringIn = null;
try {
- apexEventJSONStringIn = JSONEventGenerator.jsonEventNoName();
- jsonEventConverter.toApexEvent(null, apexEventJSONStringIn);
+ apexEventJsonStringIn = JsonEventGenerator.jsonEventNoName();
+ jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
fail("Test should throw an exception here");
} catch (final ApexEventException e) {
assertEquals("Failed to unmarshal JSON event: event received without mandatory parameter \"name\" ",
- e.getMessage().substring(0, 82));
+ e.getMessage().substring(0, 82));
}
try {
- apexEventJSONStringIn = JSONEventGenerator.jsonEventBadName();
- jsonEventConverter.toApexEvent(null, apexEventJSONStringIn);
+ apexEventJsonStringIn = JsonEventGenerator.jsonEventBadName();
+ jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
fail("Test should throw an exception here");
} catch (final ApexEventException e) {
- assertTrue(e.getMessage()
- .startsWith("Failed to unmarshal JSON event: field \"name\" with value \"%%%%\" is invalid"));
+ assertTrue(e.getMessage().startsWith(
+ "Failed to unmarshal JSON event: field \"name\" with value \"%%%%\" is invalid"));
}
try {
- apexEventJSONStringIn = JSONEventGenerator.jsonEventNoExName();
- jsonEventConverter.toApexEvent(null, apexEventJSONStringIn);
+ apexEventJsonStringIn = JsonEventGenerator.jsonEventNoExName();
+ jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
fail("Test should throw an exception here");
} catch (final ApexEventException e) {
assertEquals("Failed to unmarshal JSON event: an event definition for an event named \"I_DONT_EXI",
- e.getMessage().substring(0, 82));
+ e.getMessage().substring(0, 82));
}
- apexEventJSONStringIn = JSONEventGenerator.jsonEventNoVersion();
- ApexEvent event = jsonEventConverter.toApexEvent(null, apexEventJSONStringIn).get(0);
+ apexEventJsonStringIn = JsonEventGenerator.jsonEventNoVersion();
+ ApexEvent event = jsonEventConverter.toApexEvent(null, apexEventJsonStringIn).get(0);
assertEquals("0.0.1", event.getVersion());
try {
- apexEventJSONStringIn = JSONEventGenerator.jsonEventBadVersion();
- jsonEventConverter.toApexEvent(null, apexEventJSONStringIn);
+ apexEventJsonStringIn = JsonEventGenerator.jsonEventBadVersion();
+ jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
fail("Test should throw an exception here");
} catch (final ApexEventException e) {
assertTrue(e.getMessage().startsWith(
- "Failed to unmarshal JSON event: field \"version\" with value \"#####\" is invalid"));
+ "Failed to unmarshal JSON event: field \"version\" with value \"#####\" is invalid"));
}
try {
- apexEventJSONStringIn = JSONEventGenerator.jsonEventNoExVersion();
- jsonEventConverter.toApexEvent(null, apexEventJSONStringIn);
+ apexEventJsonStringIn = JsonEventGenerator.jsonEventNoExVersion();
+ jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
fail("Test should throw an exception here");
} catch (final ApexEventException e) {
- assertTrue(e.getMessage().startsWith(
- "Failed to unmarshal JSON event: an event definition for an event named "
- + "\"Event0000\" with version \"1.2.3\" not found in Apex model"));
+ assertTrue(e.getMessage()
+ .startsWith("Failed to unmarshal JSON event: an event definition for an event named "
+ + "\"Event0000\" with version \"1.2.3\" not found in Apex model"));
}
- apexEventJSONStringIn = JSONEventGenerator.jsonEventNoNamespace();
- event = jsonEventConverter.toApexEvent(null, apexEventJSONStringIn).get(0);
+ apexEventJsonStringIn = JsonEventGenerator.jsonEventNoNamespace();
+ event = jsonEventConverter.toApexEvent(null, apexEventJsonStringIn).get(0);
assertEquals("org.onap.policy.apex.sample.events", event.getNameSpace());
try {
- apexEventJSONStringIn = JSONEventGenerator.jsonEventBadNamespace();
- jsonEventConverter.toApexEvent(null, apexEventJSONStringIn);
+ apexEventJsonStringIn = JsonEventGenerator.jsonEventBadNamespace();
+ jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
fail("Test should throw an exception here");
} catch (final ApexEventException e) {
- assertTrue(e.getMessage().startsWith(
- "Failed to unmarshal JSON event: field \"nameSpace\" with value \"hello.&&&&\" is invalid"));
+ assertTrue(e.getMessage().startsWith("Failed to unmarshal JSON event: field \"nameSpace\" "
+ + "with value \"hello.&&&&\" is invalid"));
}
try {
- apexEventJSONStringIn = JSONEventGenerator.jsonEventNoExNamespace();
- jsonEventConverter.toApexEvent(null, apexEventJSONStringIn);
+ apexEventJsonStringIn = JsonEventGenerator.jsonEventNoExNamespace();
+ jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
fail("Test should throw an exception here");
} catch (final ApexEventException e) {
- assertTrue(e.getMessage().startsWith(
- "Failed to unmarshal JSON event: namespace \"pie.in.the.sky\" on event \"Event0000\" does not"
- + " match namespace \"org.onap.policy.apex.sample.events\" for that event in the Apex model"));
+ assertTrue(e.getMessage()
+ .startsWith("Failed to unmarshal JSON event: namespace \"pie.in.the.sky\" "
+ + "on event \"Event0000\" does not"
+ + " match namespace \"org.onap.policy.apex.sample.events\" "
+ + "for that event in the Apex model"));
}
- apexEventJSONStringIn = JSONEventGenerator.jsonEventNoSource();
- event = jsonEventConverter.toApexEvent(null, apexEventJSONStringIn).get(0);
+ apexEventJsonStringIn = JsonEventGenerator.jsonEventNoSource();
+ event = jsonEventConverter.toApexEvent(null, apexEventJsonStringIn).get(0);
assertEquals("Outside", event.getSource());
try {
- apexEventJSONStringIn = JSONEventGenerator.jsonEventBadSource();
- jsonEventConverter.toApexEvent(null, apexEventJSONStringIn);
+ apexEventJsonStringIn = JsonEventGenerator.jsonEventBadSource();
+ jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
fail("Test should throw an exception here");
} catch (final ApexEventException e) {
assertTrue(e.getMessage().startsWith(
- "Failed to unmarshal JSON event: field \"source\" with value \"%!@**@!\" is invalid"));
+ "Failed to unmarshal JSON event: field \"source\" with value \"%!@**@!\" is invalid"));
}
- apexEventJSONStringIn = JSONEventGenerator.jsonEventNoTarget();
- event = jsonEventConverter.toApexEvent(null, apexEventJSONStringIn).get(0);
+ apexEventJsonStringIn = JsonEventGenerator.jsonEventNoTarget();
+ event = jsonEventConverter.toApexEvent(null, apexEventJsonStringIn).get(0);
assertEquals("Match", event.getTarget());
try {
- apexEventJSONStringIn = JSONEventGenerator.jsonEventBadTarget();
- jsonEventConverter.toApexEvent(null, apexEventJSONStringIn);
+ apexEventJsonStringIn = JsonEventGenerator.jsonEventBadTarget();
+ jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
fail("Test should throw an exception here");
} catch (final ApexEventException e) {
- assertTrue(e.getMessage().startsWith(
- "Failed to unmarshal JSON event: field \"target\" with value \"KNIO(*S)A(S)D\" is invalid"));
+ assertTrue(e.getMessage().startsWith("Failed to unmarshal JSON event: field \"target\" "
+ + "with value \"KNIO(*S)A(S)D\" is invalid"));
}
try {
- apexEventJSONStringIn = JSONEventGenerator.jsonEventMissingFields();
- jsonEventConverter.toApexEvent(null, apexEventJSONStringIn);
+ apexEventJsonStringIn = JsonEventGenerator.jsonEventMissingFields();
+ jsonEventConverter.toApexEvent(null, apexEventJsonStringIn);
fail("Test should throw an exception here");
} catch (final ApexEventException e) {
assertTrue(e.getMessage().startsWith("Failed to unmarshal JSON event: error parsing Event0000:0.0.1 "
- + "event from Json. Field \"TestMatchCase\" is missing, but is mandatory."));
+ + "event from Json. Field \"TestMatchCase\" is missing, but is mandatory."));
}
- apexEventJSONStringIn = JSONEventGenerator.jsonEventNullFields();
- event = jsonEventConverter.toApexEvent(null, apexEventJSONStringIn).get(0);
- assertEquals(event.get("TestSlogan"), null);
- assertEquals(event.get("TestMatchCase"), (byte) -1);
- assertEquals(event.get("TestTimestamp"), (long) -1);
- assertEquals(event.get("TestTemperature"), -1.0);
+ apexEventJsonStringIn = JsonEventGenerator.jsonEventNullFields();
+ event = jsonEventConverter.toApexEvent(null, apexEventJsonStringIn).get(0);
+ assertEquals(null, event.get("TestSlogan"));
+ assertEquals((byte) -1, event.get("TestMatchCase"));
+ assertEquals((long) -1, event.get("TestTimestamp"));
+ assertEquals(-1.0, event.get("TestTemperature"));
// Set the missing fields as optional in the model
final AxEvent eventDefinition = ModelService.getModel(AxEvents.class).get("Event0000");
@@ -246,8 +271,8 @@ public class TestJSONEventHandler {
eventDefinition.getParameterMap().get("TestTimestamp").setOptional(true);
eventDefinition.getParameterMap().get("TestTemperature").setOptional(true);
- apexEventJSONStringIn = JSONEventGenerator.jsonEventMissingFields();
- event = jsonEventConverter.toApexEvent(null, apexEventJSONStringIn).get(0);
+ apexEventJsonStringIn = JsonEventGenerator.jsonEventMissingFields();
+ event = jsonEventConverter.toApexEvent(null, apexEventJsonStringIn).get(0);
assertEquals(null, event.get("TestSlogan"));
assertEquals(null, event.get("TestMatchCase"));
assertEquals(null, event.get("TestTimestamp"));
@@ -258,10 +283,15 @@ public class TestJSONEventHandler {
}
}
+ /**
+ * Test apex event to JSON.
+ *
+ * @throws ApexException the apex exception
+ */
@Test
- public void testApexEventToJSON() throws ApexException {
+ public void testApexEventToJson() throws ApexException {
try {
- final Apex2JSONEventConverter jsonEventConverter = new Apex2JSONEventConverter();
+ final Apex2JsonEventConverter jsonEventConverter = new Apex2JsonEventConverter();
assertNotNull(jsonEventConverter);
final Date event0000StartTime = new Date();
@@ -271,23 +301,23 @@ public class TestJSONEventHandler {
event0000DataMap.put("TestTimestamp", event0000StartTime.getTime());
event0000DataMap.put("TestTemperature", 34.5445667);
- final ApexEvent apexEvent0000 =
- new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.sample.events", "test", "apex");
+ final ApexEvent apexEvent0000 = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.sample.events",
+ "test", "apex");
apexEvent0000.putAll(event0000DataMap);
- final String apexEvent0000JSONString = (String) jsonEventConverter.fromApexEvent(apexEvent0000);
+ final String apexEvent0000JsonString = (String) jsonEventConverter.fromApexEvent(apexEvent0000);
- logger.debug(apexEvent0000JSONString);
+ logger.debug(apexEvent0000JsonString);
- assertTrue(apexEvent0000JSONString.contains("\"name\": \"Event0000\""));
- assertTrue(apexEvent0000JSONString.contains("\"version\": \"0.0.1\""));
- assertTrue(apexEvent0000JSONString.contains("\"nameSpace\": \"org.onap.policy.apex.sample.events\""));
- assertTrue(apexEvent0000JSONString.contains("\"source\": \"test\""));
- assertTrue(apexEvent0000JSONString.contains("\"target\": \"apex\""));
- assertTrue(apexEvent0000JSONString.contains("\"TestSlogan\": \"This is a test slogan\""));
- assertTrue(apexEvent0000JSONString.contains("\"TestMatchCase\": 12345"));
- assertTrue(apexEvent0000JSONString.contains("\"TestTimestamp\": " + event0000StartTime.getTime()));
- assertTrue(apexEvent0000JSONString.contains("\"TestTemperature\": 34.5445667"));
+ assertTrue(apexEvent0000JsonString.contains("\"name\": \"Event0000\""));
+ assertTrue(apexEvent0000JsonString.contains("\"version\": \"0.0.1\""));
+ assertTrue(apexEvent0000JsonString.contains("\"nameSpace\": \"org.onap.policy.apex.sample.events\""));
+ assertTrue(apexEvent0000JsonString.contains("\"source\": \"test\""));
+ assertTrue(apexEvent0000JsonString.contains("\"target\": \"apex\""));
+ assertTrue(apexEvent0000JsonString.contains("\"TestSlogan\": \"This is a test slogan\""));
+ assertTrue(apexEvent0000JsonString.contains("\"TestMatchCase\": 12345"));
+ assertTrue(apexEvent0000JsonString.contains("\"TestTimestamp\": " + event0000StartTime.getTime()));
+ assertTrue(apexEvent0000JsonString.contains("\"TestTemperature\": 34.5445667"));
final Date event0004StartTime = new Date(1434363272000L);
final Map<String, Object> event0004DataMap = new HashMap<String, Object>();
@@ -304,22 +334,22 @@ public class TestJSONEventHandler {
event0004DataMap.put("TestActCaseSelected", new Integer(2));
event0004DataMap.put("TestActStateTime", new Long(1434370506095L));
- final ApexEvent apexEvent0004 =
- new ApexEvent("Event0004", "0.0.1", "org.onap.policy.apex.sample.events", "test", "apex");
+ final ApexEvent apexEvent0004 = new ApexEvent("Event0004", "0.0.1", "org.onap.policy.apex.sample.events",
+ "test", "apex");
apexEvent0004.putAll(event0004DataMap);
- final String apexEvent0004JSONString = (String) jsonEventConverter.fromApexEvent(apexEvent0004);
+ final String apexEvent0004JsonString = (String) jsonEventConverter.fromApexEvent(apexEvent0004);
- logger.debug(apexEvent0004JSONString);
+ logger.debug(apexEvent0004JsonString);
- assertTrue(apexEvent0004JSONString.contains("\"name\": \"Event0004\""));
- assertTrue(apexEvent0004JSONString.contains("\"version\": \"0.0.1\""));
- assertTrue(apexEvent0004JSONString.contains("\"nameSpace\": \"org.onap.policy.apex.sample.events\""));
- assertTrue(apexEvent0004JSONString.contains("\"source\": \"test\""));
- assertTrue(apexEvent0004JSONString.contains("\"target\": \"apex\""));
- assertTrue(apexEvent0004JSONString.contains("\"TestSlogan\": \"Test slogan for External Event\""));
- assertTrue(apexEvent0004JSONString.contains("1434370506078"));
- assertTrue(apexEvent0004JSONString.contains("1064.43"));
+ assertTrue(apexEvent0004JsonString.contains("\"name\": \"Event0004\""));
+ assertTrue(apexEvent0004JsonString.contains("\"version\": \"0.0.1\""));
+ assertTrue(apexEvent0004JsonString.contains("\"nameSpace\": \"org.onap.policy.apex.sample.events\""));
+ assertTrue(apexEvent0004JsonString.contains("\"source\": \"test\""));
+ assertTrue(apexEvent0004JsonString.contains("\"target\": \"apex\""));
+ assertTrue(apexEvent0004JsonString.contains("\"TestSlogan\": \"Test slogan for External Event\""));
+ assertTrue(apexEvent0004JsonString.contains("1434370506078"));
+ assertTrue(apexEvent0004JsonString.contains("1064.43"));
} catch (final Exception e) {
e.printStackTrace();
throw new ApexException("Exception reading Apex event JSON file", e);
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONTaggedEventConsumer.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJsonTaggedEventConsumer.java
index 49e6f3bdf..e948ba67a 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJSONTaggedEventConsumer.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/TestJsonTaggedEventConsumer.java
@@ -37,7 +37,7 @@ import org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.consumer
* Test JSON Tagged Event Consumer.
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public class TestJSONTaggedEventConsumer {
+public class TestJsonTaggedEventConsumer {
@Test
public void testGarbageText() throws IOException {
@@ -71,7 +71,7 @@ public class TestJSONTaggedEventConsumer {
taggedReader.init(jsonInputStream);
TextBlock textBlock = taggedReader.readTextBlock();
- assertEquals(textBlock.getText(), "{TestTimestamp\": 1469781869268}");
+ assertEquals("{TestTimestamp\": 1469781869268}", textBlock.getText());
textBlock = taggedReader.readTextBlock();
assertNull(textBlock.getText());
@@ -87,7 +87,7 @@ public class TestJSONTaggedEventConsumer {
taggedReader.init(jsonInputStream);
TextBlock textBlock = taggedReader.readTextBlock();
- assertEquals(textBlock.getText(), "{TestTimestamp\": 1469781869268}");
+ assertEquals("{TestTimestamp\": 1469781869268}", textBlock.getText());
assertFalse(textBlock.isEndOfText());
textBlock = taggedReader.readTextBlock();
@@ -104,7 +104,7 @@ public class TestJSONTaggedEventConsumer {
taggedReader.init(jsonInputStream);
TextBlock textBlock = taggedReader.readTextBlock();
- assertEquals(textBlock.getText(), "{TestTimestamp\": 1469781869268}");
+ assertEquals("{TestTimestamp\": 1469781869268}", textBlock.getText());
assertFalse(textBlock.isEndOfText());
textBlock = taggedReader.readTextBlock();
@@ -121,7 +121,7 @@ public class TestJSONTaggedEventConsumer {
taggedReader.init(jsonInputStream);
TextBlock textBlock = taggedReader.readTextBlock();
- assertEquals(textBlock.getText(), "{TestTimestamp\": 1469781869268}");
+ assertEquals("{TestTimestamp\": 1469781869268}", textBlock.getText());
assertFalse(textBlock.isEndOfText());
textBlock = taggedReader.readTextBlock();
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java
index bfda220a5..56e716dd6 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java
@@ -65,8 +65,8 @@ public class ContextParameterTests {
} catch (final ParameterException e) {
assertEquals("error reading parameters from \"src/test/resources/parameters/serviceContextBadParams.json\""
+ "\n(ParameterRuntimeException):failed to deserialize the parameters for "
- + "\"contextParameters\" to parameter class \"hello\"\njava.lang.ClassNotFoundException: hello",
- e.getMessage());
+ + "\"contextParameters\" to parameter class "
+ + "\"hello\"\njava.lang.ClassNotFoundException: hello", e.getMessage());
}
}
@@ -97,8 +97,10 @@ public class ContextParameterTests {
new ApexParameterHandler().getParameters(arguments);
fail("This test should throw an exception");
} catch (final ParameterException e) {
- assertEquals("error reading parameters from \"src/test/resources/parameters/serviceContextBadClassParams.json\""
- + "\n(ParameterRuntimeException):failed to deserialize the parameters for \"contextParameters\""
+ assertEquals("error reading parameters from "
+ + "\"src/test/resources/parameters/serviceContextBadClassParams.json\""
+ + "\n(ParameterRuntimeException):failed to deserialize "
+ + "the parameters for \"contextParameters\""
+ " to parameter class \"java.lang.Integer\"\ncom.google.gson.JsonSyntaxException: "
+ "java.lang.IllegalStateException: Expected NUMBER but was BEGIN_OBJECT at path $",
e.getMessage());
@@ -253,7 +255,8 @@ public class ContextParameterTests {
} catch (final ParameterException e) {
assertEquals("error reading parameters from "
+ "\"src/test/resources/parameters/serviceContextBadClassDistParams.json\"\n"
- + "(ClassCastException):org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to"
+ + "(ClassCastException):"
+ + "org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to"
+ " org.onap.policy.apex.context.parameters.DistributorParameters", e.getMessage());
}
}
@@ -270,7 +273,8 @@ public class ContextParameterTests {
} catch (final ParameterException e) {
assertEquals("error reading parameters from "
+ "\"src/test/resources/parameters/serviceContextBadClassLockParams.json\"\n"
- + "(ClassCastException):org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to"
+ + "(ClassCastException):"
+ + "org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to"
+ " org.onap.policy.apex.context.parameters.LockManagerParameters", e.getMessage());
}
}
@@ -287,7 +291,8 @@ public class ContextParameterTests {
} catch (final ParameterException e) {
assertEquals("error reading parameters from "
+ "\"src/test/resources/parameters/serviceContextBadClassPersistParams.json\"\n"
- + "(ClassCastException):org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to"
+ + "(ClassCastException):"
+ + "org.onap.policy.apex.context.parameters.ContextParameters cannot be cast to"
+ " org.onap.policy.apex.context.parameters.PersistorParameters", e.getMessage());
}
}
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java
index 97724becc..7b71253b0 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java
@@ -156,7 +156,7 @@ public class ParameterTests {
+ "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
+ ", parameter group has status INVALID\n" + " parameter group \"FILE\" type "
+ "\"org.onap.policy.apex.service.engine.event.impl."
- + "filecarrierplugin.FILECarrierTechnologyParameters\" INVALID, "
+ + "filecarrierplugin.FileCarrierTechnologyParameters\" INVALID, "
+ "parameter group has status INVALID\n"
+ " field \"fileName\" type \"java.lang.String\" value \"null\" INVALID, "
+ "fileName not specified or is blank or null, "
@@ -166,7 +166,7 @@ public class ParameterTests {
+ "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
+ ", parameter group has status INVALID\n" + " parameter group \"FILE\" type "
+ "\"org.onap.policy.apex.service.engine.event.impl."
- + "filecarrierplugin.FILECarrierTechnologyParameters\" INVALID, "
+ + "filecarrierplugin.FileCarrierTechnologyParameters\" INVALID, "
+ "parameter group has status INVALID\n"
+ " field \"fileName\" type \"java.lang.String\" value \"null\" INVALID, "
+ "fileName not specified or is blank or null, "
@@ -241,23 +241,24 @@ public class ParameterTests {
assertEquals(345, parameters.getEngineServiceParameters().getInstanceCount());
assertEquals(65522, parameters.getEngineServiceParameters().getDeploymentPort());
- final CarrierTechnologyParameters prodCT = parameters.getEventOutputParameters().get("FirstProducer")
- .getCarrierTechnologyParameters();
- final EventProtocolParameters prodEP = parameters.getEventOutputParameters().get("FirstProducer")
+ final CarrierTechnologyParameters prodCarrierTech = parameters.getEventOutputParameters()
+ .get("FirstProducer").getCarrierTechnologyParameters();
+ final EventProtocolParameters prodEventProt = parameters.getEventOutputParameters().get("FirstProducer")
.getEventProtocolParameters();
- final CarrierTechnologyParameters consCT = parameters.getEventInputParameters()
+ final CarrierTechnologyParameters consCarrierTech = parameters.getEventInputParameters()
.get("MySuperDooperConsumer1").getCarrierTechnologyParameters();
- final EventProtocolParameters consEP = parameters.getEventInputParameters().get("MySuperDooperConsumer1")
- .getEventProtocolParameters();
+ final EventProtocolParameters consEventProt = parameters.getEventInputParameters()
+ .get("MySuperDooperConsumer1").getEventProtocolParameters();
- assertEquals("SUPER_DOOPER", prodCT.getLabel());
- assertEquals("SUPER_TOK_DEL", prodEP.getLabel());
- assertEquals("SUPER_DOOPER", consCT.getLabel());
- assertEquals("JSON", consEP.getLabel());
+ assertEquals("SUPER_DOOPER", prodCarrierTech.getLabel());
+ assertEquals("SUPER_TOK_DEL", prodEventProt.getLabel());
+ assertEquals("SUPER_DOOPER", consCarrierTech.getLabel());
+ assertEquals("JSON", consEventProt.getLabel());
- assertTrue(prodCT instanceof SuperDooperCarrierTechnologyParameters);
+ assertTrue(prodCarrierTech instanceof SuperDooperCarrierTechnologyParameters);
- final SuperDooperCarrierTechnologyParameters superDooperParameters = (SuperDooperCarrierTechnologyParameters) prodCT;
+ final SuperDooperCarrierTechnologyParameters superDooperParameters =
+ (SuperDooperCarrierTechnologyParameters) prodCarrierTech;
assertEquals("somehost:12345", superDooperParameters.getBootstrapServers());
assertEquals("0", superDooperParameters.getAcks());
assertEquals(25, superDooperParameters.getRetries());
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java
index 26cf09c38..374a2df14 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java
@@ -24,7 +24,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.junit.Test;
-import org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.FILECarrierTechnologyParameters;
+import org.onap.policy.apex.service.engine.event.impl.filecarrierplugin.FileCarrierTechnologyParameters;
import org.onap.policy.apex.service.engine.main.ApexCommandLineArguments;
import org.onap.policy.apex.service.parameters.ApexParameterHandler;
import org.onap.policy.apex.service.parameters.ApexParameters;
@@ -117,7 +117,7 @@ public class ProducerConsumerTests {
+ "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
+ ", parameter group has status INVALID\n" + " parameter group \"FILE\" type "
+ "\"org.onap.policy.apex.service.engine.event.impl."
- + "filecarrierplugin.FILECarrierTechnologyParameters\" INVALID, "
+ + "filecarrierplugin.FileCarrierTechnologyParameters\" INVALID, "
+ "parameter group has status INVALID\n"
+ " field \"fileName\" type \"java.lang.String\" value \"null\" INVALID, "
+ "fileName not specified or is blank or null, "
@@ -156,8 +156,8 @@ public class ProducerConsumerTests {
+ "(ParameterRuntimeException):carrier technology \"SUPER_LOOPER\" "
+ "does not match plugin \"SUPER_DOOPER\" in \"" + "org.onap.policy.apex.service.engine."
+ "parameters.dummyclasses.SuperDooperCarrierTechnologyParameters"
- + "\", specify correct carrier technology parameter plugin in parameter \"parameterClassName\"",
- e.getMessage());
+ + "\", specify correct carrier technology parameter plugin "
+ + "in parameter \"parameterClassName\"", e.getMessage());
}
}
@@ -189,11 +189,11 @@ public class ProducerConsumerTests {
try {
final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments);
- final FILECarrierTechnologyParameters fileParams = (FILECarrierTechnologyParameters) parameters
+ final FileCarrierTechnologyParameters fileParams = (FileCarrierTechnologyParameters) parameters
.getEventOutputParameters().get("aProducer").getCarrierTechnologyParameters();
assertEquals("/tmp/aaa.json", fileParams.getFileName());
assertEquals(false, fileParams.isStandardError());
- assertEquals(false, fileParams.isStandardIO());
+ assertEquals(false, fileParams.isStandardIo());
assertEquals(false, fileParams.isStreamingMode());
} catch (final ParameterException e) {
fail("This test should not throw an exception");
@@ -210,18 +210,20 @@ public class ProducerConsumerTests {
new ApexParameterHandler().getParameters(arguments);
fail("This test should throw an exception");
} catch (final ParameterException e) {
- assertEquals("validation error(s) on parameters from \"src/test/resources/parameters/prodConsBadFileName.json\"\n"
+ assertEquals("validation error(s) on parameters from "
+ + "\"src/test/resources/parameters/prodConsBadFileName.json\"\n"
+ "parameter group \"APEX_PARAMETERS\" type "
+ "\"org.onap.policy.apex.service.parameters.ApexParameters\" INVALID, "
+ "parameter group has status INVALID\n"
- + " parameter group map \"eventOutputParameters\" INVALID, parameter group has status INVALID\n"
- + " parameter group \"aProducer\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID, "
- + "parameter group has status INVALID\n" + " parameter group \"FILE\" type "
+ + " parameter group map \"eventOutputParameters\" INVALID, "
+ + "parameter group has status INVALID\n" + " parameter group \"aProducer\" type "
+ + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" "
+ + "INVALID, parameter group has status INVALID\n" + " parameter group \"FILE\" type "
+ "\"org.onap.policy.apex.service.engine.event.impl."
- + "filecarrierplugin.FILECarrierTechnologyParameters\" INVALID, "
+ + "filecarrierplugin.FileCarrierTechnologyParameters\" INVALID, "
+ "parameter group has status INVALID\n" + " field \"fileName\" type "
- + "\"java.lang.String\" value \"null\" INVALID, fileName not specified or is blank or null, "
+ + "\"java.lang.String\" value \"null\" INVALID, "
+ + "fileName not specified or is blank or null, "
+ "it must be specified as a valid file location\n", e.getMessage());
}
}
@@ -237,8 +239,9 @@ public class ProducerConsumerTests {
fail("This test should throw an exception");
} catch (final ParameterException e) {
assertEquals("error reading parameters from \"src/test/resources/parameters/prodConsBadEPParClass.json\"\n"
- + "(ParameterRuntimeException):event protocol \"SUPER_TOK_DEL\" does not match plugin \"JSON\" in "
- + "\"org.onap.policy.apex.service.engine.event.impl.jsonprotocolplugin.JSONEventProtocolParameters"
+ + "(ParameterRuntimeException):event protocol \"SUPER_TOK_DEL\" "
+ + "does not match plugin \"JSON\" in \"org.onap.policy.apex.service.engine.event.impl"
+ + ".jsonprotocolplugin.JsonEventProtocolParameters"
+ "\", specify correct event protocol parameter plugin in parameter \"parameterClassName\"",
e.getMessage());
}
@@ -270,7 +273,8 @@ public class ProducerConsumerTests {
new ApexParameterHandler().getParameters(arguments);
fail("This test should throw an exception");
} catch (final ParameterException e) {
- assertEquals("error reading parameters from \"src/test/resources/parameters/prodConsMismatchEPParClass.json\"\n"
+ assertEquals("error reading parameters from "
+ + "\"src/test/resources/parameters/prodConsMismatchEPParClass.json\"\n"
+ "(ParameterRuntimeException):event protocol \"SUPER_TOK_BEL\" "
+ "does not match plugin \"SUPER_TOK_DEL\" in "
+ "\"org.onap.policy.apex.service.engine.parameters.dummyclasses."
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java
index 7913af84c..8ad0654b1 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java
@@ -151,8 +151,8 @@ public class SyncParameterTests {
+ "specify a non-negative timeout value in milliseconds\n"
+ " parameter group map \"eventInputParameters\" INVALID, "
+ "parameter group has status INVALID\n" + " parameter group \"SyncConsumer0\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID, "
- + "specified peered mode \"SYNCHRONOUS\" timeout value \"-1\" is illegal, "
+ + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" "
+ + "INVALID, specified peered mode \"SYNCHRONOUS\" timeout value \"-1\" is illegal, "
+ "specify a non-negative timeout value in milliseconds\n"
+ " parameter group \"SyncConsumer1\" type "
+ "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID,"
@@ -371,8 +371,8 @@ public class SyncParameterTests {
+ "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
+ ", peer \"SyncConsumer0 for peered mode SYNCHRONOUS, value \"SyncProducer1\" on peer "
+ "\"SyncConsumer0\" does not equal event handler \"SyncProducer0\"\n"
- + " parameter group map \"eventInputParameters\" INVALID, parameter group has status INVALID\n"
- + " parameter group \"SyncConsumer0\" type "
+ + " parameter group map \"eventInputParameters\" INVALID, parameter group has status "
+ + "INVALID\n parameter group \"SyncConsumer0\" type "
+ "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
+ ", peer \"SyncProducer1 for peered mode SYNCHRONOUS, value \"SyncConsumer1\" on peer "
+ "\"SyncProducer1\" does not equal event handler \"SyncConsumer0\"\n", e.getMessage());
@@ -454,7 +454,8 @@ public class SyncParameterTests {
assertTrue(consCT1 instanceof SuperDooperCarrierTechnologyParameters);
assertTrue(consEP1 instanceof SuperTokenDelimitedEventProtocolParameters);
- final SuperDooperCarrierTechnologyParameters superDooperParameters = (SuperDooperCarrierTechnologyParameters) consCT1;
+ final SuperDooperCarrierTechnologyParameters superDooperParameters =
+ (SuperDooperCarrierTechnologyParameters) consCT1;
assertEquals("localhost:9092", superDooperParameters.getBootstrapServers());
assertEquals("all", superDooperParameters.getAcks());
assertEquals(0, superDooperParameters.getRetries());
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperCarrierTechnologyParameters.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperCarrierTechnologyParameters.java
index 7eaf4c8e1..ccde5199a 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperCarrierTechnologyParameters.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperCarrierTechnologyParameters.java
@@ -47,11 +47,12 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar
private static final int DEFAULT_SESSION_TIMEOUT = 30000;
private static final String DEFAULT_PRODUCER_TOPIC = "apex-out";
private static final int DEFAULT_CONSUMER_POLL_TIME = 100;
- private static final String[] DEFAULT_CONSUMER_TOPIC_LIST = { "apex-in" };
- private static final String DEFAULT_KEY_SERIALIZER = "org.apache.superDooper.common.serialization.StringSerializer";
- private static final String DEFAULT_VALUE_SERIALIZER = "org.apache.superDooper.common.serialization.StringSerializer";
- private static final String DEFAULT_KEY_DESERIALIZER = "org.apache.superDooper.common.serialization.StringDeserializer";
- private static final String DEFAULT_VALUE_DESERIALIZER = "org.apache.superDooper.common.serialization.StringDeserializer";
+ private static final String[] DEFAULT_CONSUMER_TOPIC_LIST =
+ { "apex-in" };
+ private static final String DEFAULT_KEYSERZER = "org.apache.superDooper.common.serialization.StringSerializer";
+ private static final String DEFAULT_VALSERZER = "org.apache.superDooper.common.serialization.StringSerializer";
+ private static final String DEFAULT_KEYDESZER = "org.apache.superDooper.common.serialization.StringDeserializer";
+ private static final String DEFAULT_VALDESZER = "org.apache.superDooper.common.serialization.StringDeserializer";
// Parameter property map tokens
private static final String PROPERTY_BOOTSTRAP_SERVERS = "bootstrap.servers";
@@ -83,10 +84,10 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar
private String producerTopic = DEFAULT_PRODUCER_TOPIC;
private int consumerPollTime = DEFAULT_CONSUMER_POLL_TIME;
private String[] consumerTopicList = DEFAULT_CONSUMER_TOPIC_LIST;
- private String keySerializer = DEFAULT_KEY_SERIALIZER;
- private String valueSerializer = DEFAULT_VALUE_SERIALIZER;
- private String keyDeserializer = DEFAULT_KEY_DESERIALIZER;
- private String valueDeserializer = DEFAULT_VALUE_DESERIALIZER;
+ private String keySerializer = DEFAULT_KEYSERZER;
+ private String valueSerializer = DEFAULT_VALSERZER;
+ private String keyDeserializer = DEFAULT_KEYDESZER;
+ private String valueDeserializer = DEFAULT_VALDESZER;
/**
* Constructor to create a file carrier technology parameters instance and register the instance with the parameter
@@ -478,19 +479,23 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar
}
if (retries < 0) {
- result.setResult("retries", ValidationStatus.INVALID, "[" + retries + "] invalid, must be specified as retries >= 0");
+ result.setResult("retries", ValidationStatus.INVALID,
+ "[" + retries + "] invalid, must be specified as retries >= 0");
}
if (batchSize < 0) {
- result.setResult("batchSize", ValidationStatus.INVALID, "[" + batchSize + "] invalid, must be specified as batchSize >= 0");
+ result.setResult("batchSize", ValidationStatus.INVALID,
+ "[" + batchSize + "] invalid, must be specified as batchSize >= 0");
}
if (lingerTime < 0) {
- result.setResult("lingerTime", ValidationStatus.INVALID, "[" + lingerTime + "] invalid, must be specified as lingerTime >= 0");
+ result.setResult("lingerTime", ValidationStatus.INVALID,
+ "[" + lingerTime + "] invalid, must be specified as lingerTime >= 0");
}
if (bufferMemory < 0) {
- result.setResult("bufferMemory", ValidationStatus.INVALID, "[" + bufferMemory + "] invalid, must be specified as bufferMemory >= 0");
+ result.setResult("bufferMemory", ValidationStatus.INVALID,
+ "[" + bufferMemory + "] invalid, must be specified as bufferMemory >= 0");
}
if (groupId == null || groupId.trim().length() == 0) {
@@ -498,8 +503,8 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar
}
if (autoCommitTime < 0) {
- result.setResult("autoCommitTime", ValidationStatus.INVALID, "[" + autoCommitTime
- + "] invalid, must be specified as autoCommitTime >= 0");
+ result.setResult("autoCommitTime", ValidationStatus.INVALID,
+ "[" + autoCommitTime + "] invalid, must be specified as autoCommitTime >= 0");
}
if (sessionTimeout < 0) {
@@ -508,16 +513,18 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar
}
if (producerTopic == null || producerTopic.trim().length() == 0) {
- result.setResult("producerTopic", ValidationStatus.INVALID, "producerTopic not specified, must be specified as a string");
+ result.setResult("producerTopic", ValidationStatus.INVALID,
+ "producerTopic not specified, must be specified as a string");
}
if (consumerPollTime < 0) {
- result.setResult("consumerPollTime", ValidationStatus.INVALID, "[" + consumerPollTime
- + "] invalid, must be specified as consumerPollTime >= 0");
+ result.setResult("consumerPollTime", ValidationStatus.INVALID,
+ "[" + consumerPollTime + "] invalid, must be specified as consumerPollTime >= 0");
}
if (consumerTopicList == null || consumerTopicList.length == 0) {
- result.setResult("consumerTopicList", ValidationStatus.INVALID, "not specified, must be specified as a list of strings");
+ result.setResult("consumerTopicList", ValidationStatus.INVALID,
+ "not specified, must be specified as a list of strings");
}
StringBuilder consumerTopicMessageBuilder = new StringBuilder();
@@ -527,7 +534,7 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar
+ "\" specified on consumerTopicList, consumer topics must be specified as strings");
}
}
-
+
if (consumerTopicMessageBuilder.length() > 0) {
result.setResult("consumerTopicList", ValidationStatus.INVALID, consumerTopicMessageBuilder.toString());
}
@@ -537,11 +544,13 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar
}
if (valueSerializer == null || valueSerializer.trim().length() == 0) {
- result.setResult("valueSerializer", ValidationStatus.INVALID, "not specified, must be specified as a string");
+ result.setResult("valueSerializer", ValidationStatus.INVALID,
+ "not specified, must be specified as a string");
}
if (keyDeserializer == null || keyDeserializer.trim().length() == 0) {
- result.setResult("keyDeserializer", ValidationStatus.INVALID, "not specified, must be specified as a string");
+ result.setResult("keyDeserializer", ValidationStatus.INVALID,
+ "not specified, must be specified as a string");
}
if (valueDeserializer == null || valueDeserializer.trim().length() == 0) {
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperDistributorParameters.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperDistributorParameters.java
index a8d099654..0d021c919 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperDistributorParameters.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperDistributorParameters.java
@@ -74,8 +74,8 @@ public class SuperDooperDistributorParameters extends DistributorParameters {
return jgroupsBindAddress;
}
- public void setjGroupsBindAddress(final String jGroupsBindAddress) {
- this.jgroupsBindAddress = jGroupsBindAddress;
+ public void setjGroupsBindAddress(final String jgroupsBindAddress) {
+ this.jgroupsBindAddress = jgroupsBindAddress;
}
@Override
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperTokenDelimitedEventProtocolParameters.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperTokenDelimitedEventProtocolParameters.java
index ec4f97d78..7ae403726 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperTokenDelimitedEventProtocolParameters.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperTokenDelimitedEventProtocolParameters.java
@@ -20,7 +20,7 @@
package org.onap.policy.apex.service.engine.parameters.dummyclasses;
-import org.onap.policy.apex.service.engine.event.impl.jsonprotocolplugin.JSONEventProtocolParameters;
+import org.onap.policy.apex.service.engine.event.impl.jsonprotocolplugin.JsonEventProtocolParameters;
import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolTextTokenDelimitedParameters;
/**
@@ -38,7 +38,7 @@ public class SuperTokenDelimitedEventProtocolParameters extends EventProtocolTex
* the parameter service.
*/
public SuperTokenDelimitedEventProtocolParameters() {
- super(JSONEventProtocolParameters.class.getCanonicalName());
+ super(JsonEventProtocolParameters.class.getCanonicalName());
// Set the event protocol properties for the JSON carrier technology
this.setLabel(SUPER_TOKEN_EVENT_PROTOCOL_LABEL);