summaryrefslogtreecommitdiffstats
path: root/services/services-engine/src/test/java
diff options
context:
space:
mode:
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/impl/eventrequestor/EventRequestorCarrierTechnologyParametersTest.java7
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java3
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ApexParametersTest.java10
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java80
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ProducerConsumerTests.java58
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/SyncParameterTests.java236
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperCarrierTechnologyParameters.java116
7 files changed, 153 insertions, 357 deletions
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorCarrierTechnologyParametersTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorCarrierTechnologyParametersTest.java
index c0da81625..878756383 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorCarrierTechnologyParametersTest.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorCarrierTechnologyParametersTest.java
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +24,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
-import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ValidationResult;
public class EventRequestorCarrierTechnologyParametersTest {
@@ -37,7 +38,7 @@ public class EventRequestorCarrierTechnologyParametersTest {
@Test
public void validate() {
final EventRequestorCarrierTechnologyParameters parameters = new EventRequestorCarrierTechnologyParameters();
- final GroupValidationResult actual = parameters.validate();
+ final ValidationResult actual = parameters.validate();
assertNotNull(actual);
}
-} \ No newline at end of file
+}
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java
index b7532aba2..29a3e0f00 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java
@@ -3,6 +3,7 @@
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020-2021 Nordix Foundation.
* Modifications Copyright (C) 2020-2021 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -109,7 +110,7 @@ public class ApexMainTest {
apexMain1 = new ApexMain(args);
await().atMost(200, TimeUnit.MILLISECONDS).until(() -> outContent.toString()
- .contains("parameter group has status INVALID"));
+ .contains("item has status INVALID"));
assertNotNull(apexMain1);
}
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ApexParametersTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ApexParametersTest.java
index 9557ca8f9..a0169d7e3 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ApexParametersTest.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ApexParametersTest.java
@@ -3,6 +3,7 @@
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 Nordix Foundation.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,10 +71,11 @@ public class ApexParametersTest {
final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args);
assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments))
- .hasMessageContaining("java properties array entries must have one key and one value")
- .hasMessageContaining("java properties key is null or blank")
- .hasMessageContaining("java properties value is null or blank")
- .hasMessageContaining("java properties array entry is null");
+ .hasMessageContaining("\"javaProperties\"")
+ .hasMessageContaining("entry 0", "entry 1", "entry 2", "entry 3", "entry 4", "entry 5")
+ .hasMessageContaining("must have one key and one value")
+ .hasMessageContaining("\"key\" value \"null\" INVALID, is blank")
+ .hasMessageContaining("\"value\" value \"null\" INVALID, is blank");
}
@Test
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 da4ceaa12..e37da3540 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
@@ -3,6 +3,7 @@
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -72,15 +73,11 @@ public class ParameterTests {
final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args);
assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments))
- .hasMessage("validation error(s) on parameters from \"src/test/resources/parameters/noParams.json\"\n"
- + "parameter group \"APEX_PARAMETERS\" type "
- + "\"org.onap.policy.apex.service.parameters.ApexParameters\" INVALID, "
- + "parameter group has status INVALID\n" + " parameter group \"UNDEFINED\" INVALID, "
- + "engine service parameters are not specified\n"
- + " parameter group map \"eventOutputParameters\" INVALID, "
- + "at least one event output must be specified\n"
- + " parameter group map \"eventInputParameters\" INVALID, "
- + "at least one event input must be specified\n");
+ .hasMessageContaining("src/test/resources/parameters/noParams.json")
+ .hasMessageContaining("ApexParameters")
+ .hasMessageContaining("\"engineServiceParameters\" value \"null\" INVALID, is null")
+ .hasMessageContaining("\"eventOutputParameters\" value \"{}\" INVALID, minimum number of elements: 1")
+ .hasMessageContaining("\"eventInputParameters\" value \"{}\" INVALID, minimum number of elements: 1");
}
@Test
@@ -89,19 +86,13 @@ public class ParameterTests {
final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args);
assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments))
- .hasMessage("validation error(s) on parameters from \"src/test/resources/parameters/blankParams.json\"\n"
- + "parameter group \"APEX_PARAMETERS\" type "
- + "\"org.onap.policy.apex.service.parameters.ApexParameters\" INVALID, "
- + "parameter group has status INVALID\n" + " parameter group \"ENGINE_SERVICE_PARAMETERS\" type "
- + "\"org.onap.policy.apex.service.parameters.engineservice.EngineServiceParameters\" "
- + "INVALID, parameter group has status INVALID\n"
- + " field \"id\" type \"int\" value \"-1\" INVALID, "
- + "id not specified or specified value [-1] invalid, must be specified as id >= 0\n"
- + " field \"policyModel\" type \"java.lang.String\" value \"null\" INVALID, must be specified\n"
- + " parameter group map \"eventOutputParameters\" INVALID, "
- + "at least one event output must be specified\n"
- + " parameter group map \"eventInputParameters\" INVALID, "
- + "at least one event input must be specified\n");
+ .hasMessageContaining("src/test/resources/parameters/blankParams.json")
+ .hasMessageContaining("ApexParameters")
+ .hasMessageContaining("EngineServiceParameters")
+ .hasMessageContaining("\"id\" value \"-1\" INVALID, is below the minimum")
+ .hasMessageContaining("\"policyModel\" value \"null\" INVALID, is null")
+ .hasMessageContaining("\"eventOutputParameters\" value \"{}\" INVALID, minimum number of elements")
+ .hasMessageContaining("\"eventInputParameters\" value \"{}\" INVALID, minimum number of elements");
}
@Test
@@ -110,38 +101,19 @@ public class ParameterTests {
final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args);
assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments))
- .hasMessage("validation error(s) on parameters from \"src/test/resources/parameters/badParams.json\"\n"
- + "parameter group \"APEX_PARAMETERS\" type "
- + "\"org.onap.policy.apex.service.parameters.ApexParameters\" INVALID, "
- + "parameter group has status INVALID\n" + " parameter group \"hello there\" type "
- + "\"org.onap.policy.apex.service.parameters.engineservice.EngineServiceParameters\" "
- + "INVALID, parameter group has status INVALID\n"
- + " field \"name\" type \"java.lang.String\" value \"hello there\" INVALID, "
- + "name is invalid, it must match regular expression[A-Za-z0-9\\-_\\.]+\n"
- + " field \"id\" type \"int\" value \"-45\" INVALID, id not specified or "
- + "specified value [-45] invalid, must be specified as id >= 0\n"
- + " field \"instanceCount\" type \"int\" value \"-345\" INVALID, "
- + "instanceCount [-345] invalid, must be specified as instanceCount >= 1\n"
- + " field \"deploymentPort\" type \"int\" value \"65536\" INVALID, "
- + "deploymentPort [65536] invalid, must be specified as 1024 <= port <= 65535\n"
- + " parameter group map \"eventOutputParameters\" INVALID, "
- + "parameter group map has status INVALID\n" + " parameter group \"FirstProducer\" 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, "
- + "parameter group has status INVALID\n"
- + " field \"fileName\" type \"java.lang.String\" value \"null\" INVALID, "
- + "\"null\" invalid, must be specified as a non-empty string\n"
- + " parameter group map \"eventInputParameters\" INVALID, "
- + "parameter group map has status INVALID\n" + " parameter group \"TheFileConsumer1\" 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, "
- + "parameter group has status INVALID\n"
- + " field \"fileName\" type \"java.lang.String\" value \"null\" INVALID, "
- + "\"null\" invalid, must be specified as a non-empty string\n");
+ .hasMessageContaining("src/test/resources/parameters/badParams.json")
+ .hasMessageContaining("ApexParameters")
+ .hasMessageContaining("EngineServiceParameters")
+ .hasMessageContaining("\"name\" value \"hello there\" INVALID, does not match")
+ .hasMessageContaining("\"id\" value \"-45\" INVALID, is below the minimum")
+ .hasMessageContaining("\"instanceCount\" value \"-345\" INVALID, is below the minimum")
+ .hasMessageContaining("\"deploymentPort\" value \"65536\" INVALID, exceeds the maximum")
+ .hasMessageContaining("eventOutputParameters", "FirstProducer", "EventHandlerParameters",
+ "FileCarrierTechnologyParameters")
+ .hasMessageContaining("\"fileName\" value \"null\" INVALID, is blank")
+ .hasMessageContaining("eventInputParameters", "TheFileConsumer1", "EventHandlerParameters",
+ "FileCarrierTechnologyParameters")
+ .hasMessageContaining("\"fileName\" value \"null\" INVALID, is blank");
}
@Test
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 0ef4fa252..0b05eac63 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
@@ -3,6 +3,7 @@
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -75,14 +76,11 @@ public class ProducerConsumerTests {
final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args);
assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments))
- .hasMessage("validation error(s) on parameters from \"src/test/resources/parameters/prodConsNoCT.json\"\n"
- + "parameter group \"APEX_PARAMETERS\" type "
- + "\"org.onap.policy.apex.service.parameters.ApexParameters\" INVALID, "
- + "parameter group has status INVALID\n" + " parameter group map \"eventInputParameters\" INVALID, "
- + "parameter group map has status INVALID\n" + " parameter group \"aConsumer\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID,"
- + " parameter group has status INVALID\n" + " parameter group \"UNDEFINED\" INVALID, "
- + "event handler carrierTechnologyParameters not specified or blank\n");
+ .hasMessageContaining("src/test/resources/parameters/prodConsNoCT.json")
+ .hasMessageContaining("ApexParameters")
+ .hasMessageContaining("eventInputParameters", "aConsumer", "EventHandlerParameters",
+ "carrierTechnologyParameters")
+ .hasMessageContaining("is null");
}
@Test
@@ -91,23 +89,14 @@ public class ProducerConsumerTests {
final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args);
assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments))
- .hasMessage("validation error(s) on parameters from \"src/test/resources/parameters/prodConsNoEP.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 map 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 \"UNDEFINED\" INVALID, "
- + "event handler eventProtocolParameters not specified or blank\n"
- + " parameter group map \"eventInputParameters\" INVALID, "
- + "parameter group map has status INVALID\n" + " parameter group \"aConsumer\" 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, "
- + "parameter group has status INVALID\n"
- + " field \"fileName\" type \"java.lang.String\" value \"null\" INVALID, "
- + "\"null\" invalid, must be specified as a non-empty string\n");
+ .hasMessageContaining("src/test/resources/parameters/prodConsNoEP.json")
+ .hasMessageContaining("ApexParameters")
+ .hasMessageContaining("eventOutputParameters", "aProducer", "EventHandlerParameters",
+ "eventProtocolParameters")
+ .hasMessageContaining("eventInputParameters", "aConsumer", "EventHandlerParameters",
+ "FileCarrierTechnologyParameters", "fileName")
+ .hasMessageContaining("is null")
+ .hasMessageContaining("is blank");
}
@Test
@@ -170,19 +159,12 @@ public class ProducerConsumerTests {
final String[] args = {"-p", "src/test/resources/parameters/prodConsBadFileName.json"};
final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args);
- assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)).hasMessage(
- "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 map 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, "
- + "parameter group has status INVALID\n" + " field \"fileName\" type "
- + "\"java.lang.String\" value \"null\" INVALID, "
- + "\"null\" invalid, must be specified as a non-empty string\n");
+ assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments))
+ .hasMessageContaining("src/test/resources/parameters/prodConsBadFileName.json")
+ .hasMessageContaining("ApexParameters")
+ .hasMessageContaining("eventOutputParameters", "aProducer", "EventHandlerParameters",
+ "FileCarrierTechnologyParameters", "fileName")
+ .hasMessageContaining("is blank");
}
@Test
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 71ff28877..aaa98fd47 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
@@ -51,16 +51,10 @@ public class SyncParameterTests {
final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args);
assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments))
- .hasMessage("validation error(s) on parameters from "
- + "\"src/test/resources/parameters/syncBadParamsNoSyncWithPeer.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 map has status INVALID\n" + " parameter group \"SyncProducer0\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
- + ", specified peered mode \"SYNCHRONOUS\" "
- + "peer is illegal on eventOutputParameters \"SyncProducer0\" \n");
+ .hasMessageContaining("src/test/resources/parameters/syncBadParamsNoSyncWithPeer.json")
+ .hasMessageContaining("ApexParameters")
+ .hasMessageContaining("\"eventOutputParameters\" value \"SyncProducer0\" INVALID")
+ .hasMessageContaining("peer is illegal");
}
@Test
@@ -69,16 +63,10 @@ public class SyncParameterTests {
final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args);
assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments))
- .hasMessage("validation error(s) on parameters from "
- + "\"src/test/resources/parameters/syncBadParamsNotSyncWithPeer.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 map has status INVALID\n" + " parameter group \"SyncProducer0\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
- + ", specified peered mode \"SYNCHRONOUS\" peer is illegal "
- + "on eventOutputParameters \"SyncProducer0\" \n");
+ .hasMessageContaining("src/test/resources/parameters/syncBadParamsNotSyncWithPeer.json")
+ .hasMessageContaining("ApexParameters")
+ .hasMessageContaining("\"eventOutputParameters\" value \"SyncProducer0\" INVALID")
+ .hasMessageContaining("peer is illegal");
}
@Test
@@ -87,27 +75,13 @@ public class SyncParameterTests {
final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args);
assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments))
- .hasMessage("validation error(s) on parameters from "
- + "\"src/test/resources/parameters/syncBadParamsBadPeers.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 map has status INVALID\n" + " parameter group \"SyncProducer0\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
- + ", peer \"SyncProducer1 for peered mode SYNCHRONOUS does not exist "
- + "or is not defined with the same peered mode\n" + " parameter group \"SyncProducer1\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
- + ", peer \"SyncProducer0 for peered mode SYNCHRONOUS does not exist "
- + "or is not defined with the same peered mode\n"
- + " parameter group map \"eventInputParameters\" INVALID, "
- + "parameter group map has status INVALID\n" + " parameter group \"SyncConsumer0\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
- + ", peer \"SyncConsumer1 for peered mode SYNCHRONOUS does not exist "
- + "or is not defined with the same peered mode\n" + " parameter group \"SyncConsumer1\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
- + ", peer \"SyncConsumer0 for peered mode SYNCHRONOUS does not exist "
- + "or is not defined with the same peered mode\n");
+ .hasMessageContaining("src/test/resources/parameters/syncBadParamsBadPeers.json")
+ .hasMessageContaining("ApexParameters")
+ .hasMessageContaining("\"eventOutputParameters\" value \"SyncProducer0\" INVALID")
+ .hasMessageContaining("\"eventOutputParameters\" value \"SyncProducer1\" INVALID")
+ .hasMessageContaining("\"eventInputParameters\" value \"SyncConsumer0\" INVALID")
+ .hasMessageContaining("\"eventInputParameters\" value \"SyncConsumer1\" INVALID")
+ .hasMessageContaining("does not exist or is not defined");
}
@Test
@@ -116,29 +90,16 @@ public class SyncParameterTests {
final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args);
assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments))
- .hasMessage("validation error(s) on parameters from "
- + "\"src/test/resources/parameters/syncBadParamsInvalidTimeout.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 map has status INVALID\n" + " parameter group \"SyncProducer0\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID,"
- + " specified peered mode \"SYNCHRONOUS\" timeout value \"-10\" is illegal, "
- + "specify a non-negative timeout value in milliseconds\n"
- + " parameter group \"SyncProducer1\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" "
- + "INVALID, specified peered mode \"SYNCHRONOUS\" timeout value \"-3\" is illegal, "
- + "specify a non-negative timeout value in milliseconds\n"
- + " parameter group map \"eventInputParameters\" INVALID, "
- + "parameter group map 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, "
- + "specify a non-negative timeout value in milliseconds\n"
- + " parameter group \"SyncConsumer1\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID,"
- + " specified peered mode \"SYNCHRONOUS\" timeout value \"-99999999\" is illegal, "
- + "specify a non-negative timeout value in milliseconds\n");
+ .hasMessageContaining("src/test/resources/parameters/syncBadParamsInvalidTimeout.json")
+ .hasMessageContaining("ApexParameters")
+ .hasMessageContaining("\"eventOutputParameters\" value \"SyncProducer0\" INVALID")
+ .hasMessageContaining("\"eventOutputParameters\" value \"SyncProducer1\" INVALID")
+ .hasMessageContaining("\"eventInputParameters\" value \"SyncConsumer0\" INVALID")
+ .hasMessageContaining("\"eventInputParameters\" value \"SyncConsumer1\" INVALID")
+ .hasMessageContaining("timeout value \"-10\" is illegal")
+ .hasMessageContaining("timeout value \"-3\" is illegal")
+ .hasMessageContaining("timeout value \"-1\" is illegal")
+ .hasMessageContaining("timeout value \"-99999999\" is illegal");
}
@Test
@@ -147,16 +108,10 @@ public class SyncParameterTests {
final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args);
assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments))
- .hasMessage("validation error(s) on parameters from "
- + "\"src/test/resources/parameters/syncBadParamsBadTimeout.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 map has status INVALID\n" + " parameter group \"MyOtherProducer\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" "
- + "INVALID, specified peered mode \"SYNCHRONOUS\" "
- + "timeout is illegal on eventOutputParameters \"MyOtherProducer\"\n");
+ .hasMessageContaining("src/test/resources/parameters/syncBadParamsBadTimeout.json")
+ .hasMessageContaining("ApexParameters")
+ .hasMessageContaining("\"eventOutputParameters\" value \"MyOtherProducer\" INVALID, "
+ + "specified peered mode \"SYNCHRONOUS\" timeout is illegal");
}
@Test
@@ -165,29 +120,16 @@ public class SyncParameterTests {
final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args);
assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments))
- .hasMessage("validation error(s) on parameters from "
- + "\"src/test/resources/parameters/syncBadParamsUnpairedTimeout.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 map has status INVALID\n" + " parameter group \"SyncProducer0\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
- + ", peer \"SyncConsumer0 for peered mode SYNCHRONOUS timeout 10 on event handler "
- + "\"SyncProducer0\" does not equal timeout 1 on event handler \"SyncConsumer0\"\n"
- + " parameter group \"SyncProducer1\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
- + ", peer \"SyncConsumer1 for peered mode SYNCHRONOUS timeout 3 on event handler "
- + "\"SyncProducer1\" does not equal timeout 99999999 on event handler \"SyncConsumer1\"\n"
- + " parameter group map \"eventInputParameters\" INVALID, "
- + "parameter group map has status INVALID\n" + " parameter group \"SyncConsumer0\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
- + ", peer \"SyncProducer0 for peered mode SYNCHRONOUS timeout 1 on event handler "
- + "\"SyncConsumer0\" does not equal timeout 10 on event handler \"SyncProducer0\"\n"
- + " parameter group \"SyncConsumer1\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
- + ", peer \"SyncProducer1 for peered mode SYNCHRONOUS timeout 99999999 on event handler "
- + "\"SyncConsumer1\" does not equal timeout 3 on event handler \"SyncProducer1\"\n" + "");
+ .hasMessageContaining("src/test/resources/parameters/syncBadParamsUnpairedTimeout.json")
+ .hasMessageContaining("ApexParameters")
+ .hasMessageContaining("\"eventOutputParameters\" value \"SyncProducer0\" INVALID, peer \"SyncConsumer0\"")
+ .hasMessageContaining("\"eventOutputParameters\" value \"SyncProducer1\" INVALID, peer \"SyncConsumer1\"")
+ .hasMessageContaining("\"eventInputParameters\" value \"SyncConsumer0\" INVALID, peer \"SyncProducer0\"")
+ .hasMessageContaining("\"eventInputParameters\" value \"SyncConsumer1\" INVALID, peer \"SyncProducer1\"")
+ .hasMessageContaining("timeout 10 does not equal peer timeout 1")
+ .hasMessageContaining("timeout 3 does not equal peer timeout 99999999")
+ .hasMessageContaining("timeout 1 does not equal peer timeout 10")
+ .hasMessageContaining("timeout 99999999 does not equal peer timeout 3");
}
@Test
@@ -226,23 +168,12 @@ public class SyncParameterTests {
final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args);
assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments))
- .hasMessage("validation error(s) on parameters from "
- + "\"src/test/resources/parameters/syncUnusedConsumerPeers.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 map has status INVALID\n" + " parameter group \"SyncProducer1\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" "
- + "INVALID, peer \"SyncConsumer0 for peered mode SYNCHRONOUS, "
- + "value \"SyncProducer0\" on peer \"SyncConsumer0\" "
- + "does not equal event handler \"SyncProducer1\"\n"
- + " parameter group map \"eventInputParameters\" INVALID, "
- + "parameter group map has status INVALID\n" + " parameter group \"SyncConsumer1\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" "
- + "INVALID, peer \"SyncProducer1 for peered mode SYNCHRONOUS, "
- + "value \"SyncConsumer0\" on peer \"SyncProducer1\" "
- + "does not equal event handler \"SyncConsumer1\"\n");
+ .hasMessageContaining("src/test/resources/parameters/syncUnusedConsumerPeers.json")
+ .hasMessageContaining("ApexParameters")
+ .hasMessageContaining("\"eventOutputParameters\" value \"SyncProducer1\" INVALID, peer \"SyncConsumer0\"")
+ .hasMessageContaining("\"eventInputParameters\" value \"SyncConsumer1\" INVALID, peer \"SyncProducer1\"")
+ .hasMessageContaining("value \"SyncProducer0\" on peer does not equal event handler")
+ .hasMessageContaining("value \"SyncConsumer0\" on peer does not equal event handler");
}
@Test
@@ -251,29 +182,16 @@ public class SyncParameterTests {
final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args);
assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments))
- .hasMessage("validation error(s) on parameters from "
- + "\"src/test/resources/parameters/syncMismatchedPeers.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 map has status INVALID\n" + " parameter group \"SyncProducer0\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
- + ", peer \"SyncConsumer1 for peered mode SYNCHRONOUS, value \"SyncProducer1\" "
- + "on peer \"SyncConsumer1\" does not equal event handler \"SyncProducer0\"\n"
- + " parameter group \"SyncProducer1\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
- + ", peer \"SyncConsumer0 for peered mode SYNCHRONOUS, value \"SyncProducer0\" "
- + "on peer \"SyncConsumer0\" does not equal event handler \"SyncProducer1\"\n"
- + " parameter group map \"eventInputParameters\" INVALID, "
- + "parameter group map has status INVALID\n" + " parameter group \"SyncConsumer0\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
- + ", peer \"SyncProducer0 for peered mode SYNCHRONOUS, value \"SyncConsumer1\" "
- + "on peer \"SyncProducer0\" does not equal event handler \"SyncConsumer0\"\n"
- + " parameter group \"SyncConsumer1\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID"
- + ", peer \"SyncProducer1 for peered mode SYNCHRONOUS, value \"SyncConsumer0\" "
- + "on peer \"SyncProducer1\" does not equal event handler \"SyncConsumer1\"\n");
+ .hasMessageContaining("src/test/resources/parameters/syncMismatchedPeers.json")
+ .hasMessageContaining("ApexParameters")
+ .hasMessageContaining("\"eventOutputParameters\" value \"SyncProducer0\" INVALID, peer \"SyncConsumer1\"")
+ .hasMessageContaining("\"eventOutputParameters\" value \"SyncProducer1\" INVALID, peer \"SyncConsumer0\"")
+ .hasMessageContaining("\"eventInputParameters\" value \"SyncConsumer0\" INVALID, peer \"SyncProducer0\"")
+ .hasMessageContaining("\"eventInputParameters\" value \"SyncConsumer1\" INVALID, peer \"SyncProducer1\"")
+ .hasMessageContaining("value \"SyncProducer1\" on peer does not equal event handler")
+ .hasMessageContaining("value \"SyncProducer0\" on peer does not equal event handler")
+ .hasMessageContaining("value \"SyncConsumer1\" on peer does not equal event handler")
+ .hasMessageContaining("value \"SyncConsumer0\" on peer does not equal event handler");
}
@Test
@@ -282,21 +200,12 @@ public class SyncParameterTests {
final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args);
assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments))
- .hasMessage("validation error(s) on parameters from "
- + "\"src/test/resources/parameters/syncUnusedProducerPeers.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 map has status INVALID\n" + " parameter group \"SyncProducer0\" type "
- + "\"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 map 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");
+ .hasMessageContaining("src/test/resources/parameters/syncUnusedProducerPeers.json")
+ .hasMessageContaining("ApexParameters")
+ .hasMessageContaining("\"eventOutputParameters\" value \"SyncProducer0\" INVALID, peer \"SyncConsumer0\"")
+ .hasMessageContaining("\"eventInputParameters\" value \"SyncConsumer0\" INVALID, peer \"SyncProducer1\"")
+ .hasMessageContaining("value \"SyncProducer1\" on peer does not equal event handler")
+ .hasMessageContaining("value \"SyncConsumer1\" on peer does not equal event handler");
}
@Test
@@ -305,23 +214,12 @@ public class SyncParameterTests {
final ApexCommandLineArguments arguments = new ApexCommandLineArguments(args);
assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments))
- .hasMessage("validation error(s) on parameters from "
- + "\"src/test/resources/parameters/syncMismatchedTimeout.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 map has status INVALID\n"
- + " parameter group \"SyncProducer1\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID,"
- + " peer \"SyncConsumer1 for peered mode SYNCHRONOUS timeout 456 "
- + "on event handler \"SyncProducer1\" does not equal timeout 123 "
- + "on event handler \"SyncConsumer1\"\n"
- + " parameter group map \"eventInputParameters\" INVALID, "
- + "parameter group map has status INVALID\n" + " parameter group \"SyncConsumer1\" type "
- + "\"org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters\" INVALID,"
- + " peer \"SyncProducer1 for peered mode SYNCHRONOUS timeout 123 "
- + "on event handler \"SyncConsumer1\" does not equal timeout 456 "
- + "on event handler \"SyncProducer1\"\n");
+ .hasMessageContaining("src/test/resources/parameters/syncMismatchedTimeout.json")
+ .hasMessageContaining("ApexParameters")
+ .hasMessageContaining("\"eventOutputParameters\" value \"SyncProducer1\" INVALID, peer \"SyncConsumer1\"")
+ .hasMessageContaining("\"eventInputParameters\" value \"SyncConsumer1\" INVALID, peer \"SyncProducer1\"")
+ .hasMessageContaining("timeout 123 does not equal peer timeout 456")
+ .hasMessageContaining("timeout 456 does not equal peer timeout 123");
}
@Test
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 6805a3d84..d7a502c7f 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
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,15 +24,22 @@ package org.onap.policy.apex.service.engine.parameters.dummyclasses;
import java.util.Arrays;
import java.util.Collection;
import java.util.Properties;
+import org.apache.commons.lang3.StringUtils;
import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters;
-import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.common.parameters.ValidationStatus;
+import org.onap.policy.common.parameters.annotations.Min;
+import org.onap.policy.common.parameters.annotations.NotBlank;
+import org.onap.policy.common.parameters.annotations.NotNull;
+import org.onap.policy.models.base.Validated;
/**
* Apex parameters for SuperDooper as an event carrier technology.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@NotNull
+@NotBlank
public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyParameters {
// Default parameter values
private static final String DEFAULT_ACKS = "all";
@@ -71,16 +79,16 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar
// superDooper carrier parameters
private String bootstrapServers = DEFAULT_BOOTSTRAP_SERVERS;
private String acks = DEFAULT_ACKS;
- private int retries = DEFAULT_RETRIES;
- private int batchSize = DEFAULT_BATCH_SIZE;
- private int lingerTime = DEFAULT_LINGER_TIME;
- private long bufferMemory = DEFAULT_BUFFER_MEMORY;
+ private @Min(0) int retries = DEFAULT_RETRIES;
+ private @Min(0) int batchSize = DEFAULT_BATCH_SIZE;
+ private @Min(0) int lingerTime = DEFAULT_LINGER_TIME;
+ private @Min(0) long bufferMemory = DEFAULT_BUFFER_MEMORY;
private String groupId = DEFAULT_GROUP_ID;
private boolean enableAutoCommit = DEFAULT_ENABLE_AUTO_COMMIT;
- private int autoCommitTime = DEFAULT_AUTO_COMMIT_TIME;
+ private @Min(0) int autoCommitTime = DEFAULT_AUTO_COMMIT_TIME;
private int sessionTimeout = DEFAULT_SESSION_TIMEOUT;
private String producerTopic = DEFAULT_PRODUCER_TOPIC;
- private int consumerPollTime = DEFAULT_CONSUMER_POLL_TIME;
+ private @Min(0) int consumerPollTime = DEFAULT_CONSUMER_POLL_TIME;
private String[] consumerTopicList = DEFAULT_CONSUMER_TOPIC_LIST;
private String keySerializer = DEFAULT_KEYSERZER;
private String valueSerializer = DEFAULT_VALSERZER;
@@ -459,98 +467,30 @@ public class SuperDooperCarrierTechnologyParameters extends CarrierTechnologyPar
* {@inheritDoc}.
*/
@Override
- public GroupValidationResult validate() {
- final GroupValidationResult result = super.validate();
+ public BeanValidationResult validate() {
+ final BeanValidationResult result = super.validate();
- if (bootstrapServers == null || bootstrapServers.trim().length() == 0) {
- result.setResult("bootstrapServers", ValidationStatus.INVALID,
- "bootstrapServers not specified, must be specified as a string of form host:port");
+ if (consumerTopicList == null) {
+ return result;
}
- if (acks == null || acks.trim().length() == 0) {
- result.setResult("acks", ValidationStatus.INVALID,
- "acks not specified, must be specified as a string with values [0|1|all]");
- }
-
- if (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");
- }
-
- if (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");
- }
-
- if (groupId == null || groupId.trim().length() == 0) {
- result.setResult("groupId", ValidationStatus.INVALID, "not specified, must be specified as a string");
- }
-
- if (autoCommitTime < 0) {
- result.setResult("autoCommitTime", ValidationStatus.INVALID,
- "[" + autoCommitTime + "] invalid, must be specified as autoCommitTime >= 0");
- }
-
- if (sessionTimeout < 0) {
- result.setResult("sessionTimeout", ValidationStatus.INVALID,
- "sessionTimeout [" + sessionTimeout + "] invalid, must be specified as sessionTimeout >= 0");
- }
-
- if (producerTopic == null || producerTopic.trim().length() == 0) {
- 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");
- }
-
- if (consumerTopicList == null || consumerTopicList.length == 0) {
- result.setResult("consumerTopicList", ValidationStatus.INVALID,
+ if (consumerTopicList.length == 0) {
+ result.addResult("consumerTopicList", consumerTopicList, ValidationStatus.INVALID,
"not specified, must be specified as a list of strings");
+ return result;
}
- StringBuilder consumerTopicMessageBuilder = new StringBuilder();
+ BeanValidationResult result2 = new BeanValidationResult("consumerTopicList", consumerTopicList);
+ int item = 0;
for (final String consumerTopic : consumerTopicList) {
- if (consumerTopic == null || consumerTopic.trim().length() == 0) {
- consumerTopicMessageBuilder.append(" invalid consumer topic \"" + consumerTopic
- + "\" specified on consumerTopicList, consumer topics must be specified as strings");
+ if (StringUtils.isBlank(consumerTopic)) {
+ result2.addResult("entry " + item, consumerTopic, ValidationStatus.INVALID, Validated.IS_BLANK);
}
- }
- if (consumerTopicMessageBuilder.length() > 0) {
- result.setResult("consumerTopicList", ValidationStatus.INVALID, consumerTopicMessageBuilder.toString());
+ ++item;
}
- if (keySerializer == null || keySerializer.trim().length() == 0) {
- result.setResult("keySerializer", ValidationStatus.INVALID, "not specified, must be specified as a string");
- }
-
- if (valueSerializer == null || valueSerializer.trim().length() == 0) {
- 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");
- }
-
- if (valueDeserializer == null || valueDeserializer.trim().length() == 0) {
- result.setResult("valueDeserializer", ValidationStatus.INVALID,
- "not specified, must be specified as a string");
- }
+ result.addResult(result2);
return result;
}