summaryrefslogtreecommitdiffstats
path: root/reception/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-04-27 15:08:59 -0400
committerJim Hahn <jrh3@att.com>2021-04-29 14:49:33 -0400
commita05cc62b6426d31c23f60dbe4a6f367331431ea4 (patch)
treebb38e4b81c133004ab9541c15db030750957f5f3 /reception/src
parentadfc3ee02f3194a143bcea430e5e3aeb99a23206 (diff)
Remove GroupValidationResult
Removed GroupValidationResult, replacing it with BeanValidationResult. Modified the ParameterGroup subclasses to use BeanValidator, adding annotations where needed to trigger the validations that had been automatically performed by GroupValidationResult. Issue-ID: POLICY-2059 Change-Id: Ib5c0dc0ac3762e68307e63f5ce29efb49208e55d Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'reception/src')
-rw-r--r--reception/src/main/java/org/onap/policy/distribution/reception/parameters/PluginHandlerParameters.java53
-rw-r--r--reception/src/main/java/org/onap/policy/distribution/reception/parameters/PolicyDecoderParameters.java71
-rw-r--r--reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerParameters.java101
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPluginHandlerParameters.java21
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPolicyDecoderParameters.java19
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestReceptionHandlerParameters.java31
6 files changed, 77 insertions, 219 deletions
diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PluginHandlerParameters.java b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PluginHandlerParameters.java
index bd0ad900..c3e44274 100644
--- a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PluginHandlerParameters.java
+++ b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PluginHandlerParameters.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 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.
@@ -21,10 +22,13 @@
package org.onap.policy.distribution.reception.parameters;
import java.util.Map;
-import java.util.Map.Entry;
-import org.onap.policy.common.parameters.GroupValidationResult;
+import lombok.Setter;
+import org.onap.policy.common.parameters.BeanValidationResult;
+import org.onap.policy.common.parameters.BeanValidator;
import org.onap.policy.common.parameters.ParameterGroup;
-import org.onap.policy.common.parameters.ValidationStatus;
+import org.onap.policy.common.parameters.annotations.NotNull;
+import org.onap.policy.common.parameters.annotations.Size;
+import org.onap.policy.common.parameters.annotations.Valid;
import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters;
/**
@@ -32,13 +36,19 @@ import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParamet
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
+@NotNull
public class PluginHandlerParameters implements ParameterGroup {
private static final String PLUGIN_HANDLER = "_PluginHandler";
+ @Setter
private String name;
- private Map<String, PolicyDecoderParameters> policyDecoders;
- private Map<String, PolicyForwarderParameters> policyForwarders;
+
+ @Size(min = 1)
+ private Map<String, @NotNull @Valid PolicyDecoderParameters> policyDecoders;
+
+ @Size(min = 1)
+ private Map<String, @NotNull @Valid PolicyForwarderParameters> policyForwarders;
/**
* Constructor for instantiating PluginHandlerParameters.
@@ -80,36 +90,7 @@ public class PluginHandlerParameters implements ParameterGroup {
*
*/
@Override
- public GroupValidationResult validate() {
- final GroupValidationResult validationResult = new GroupValidationResult(this);
- if (policyDecoders == null || policyDecoders.size() == 0) {
- validationResult.setResult("policyDecoders", ValidationStatus.INVALID,
- "must have at least one policy decoder");
- } else {
- for (final Entry<String, PolicyDecoderParameters> nestedGroupEntry : policyDecoders.entrySet()) {
- validationResult.setResult("policyDecoders", nestedGroupEntry.getKey(),
- nestedGroupEntry.getValue().validate());
- }
- }
- if (policyForwarders == null || policyForwarders.size() == 0) {
- validationResult.setResult("policyForwarders", ValidationStatus.INVALID,
- "must have at least one policy forwarder");
- } else {
- for (final Entry<String, PolicyForwarderParameters> nestedGroupEntry : policyForwarders.entrySet()) {
- validationResult.setResult("policyForwarders", nestedGroupEntry.getKey(),
- nestedGroupEntry.getValue().validate());
- }
- }
- return validationResult;
- }
-
- /**
- * Set the name of this group.
- *
- * @param name the name to set.
- */
- @Override
- public void setName(final String name) {
- this.name = name;
+ public BeanValidationResult validate() {
+ return new BeanValidator().validateTop(getClass().getSimpleName(), this);
}
}
diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PolicyDecoderParameters.java b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PolicyDecoderParameters.java
index f8ede1a9..492e2e05 100644
--- a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PolicyDecoderParameters.java
+++ b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PolicyDecoderParameters.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,23 +22,24 @@
package org.onap.policy.distribution.reception.parameters;
-import org.onap.policy.common.parameters.GroupValidationResult;
+import lombok.Getter;
+import org.onap.policy.common.parameters.BeanValidationResult;
+import org.onap.policy.common.parameters.BeanValidator;
import org.onap.policy.common.parameters.ParameterGroup;
-import org.onap.policy.common.parameters.ValidationStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.policy.common.parameters.annotations.ClassName;
+import org.onap.policy.common.parameters.annotations.NotBlank;
+import org.onap.policy.common.parameters.annotations.NotNull;
/**
* Class to hold all the policy decoder parameters.
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
+@Getter
+@NotBlank
public class PolicyDecoderParameters implements ParameterGroup {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(PolicyDecoderParameters.class);
-
- private String decoderType;
- private String decoderClassName;
+ private @NotNull String decoderType;
+ private @NotNull @ClassName String decoderClassName;
private String decoderConfigurationName;
/**
@@ -55,33 +57,6 @@ public class PolicyDecoderParameters implements ParameterGroup {
}
/**
- * Return the decoderType of this PolicyDecoderParameters instance.
- *
- * @return the decoderType
- */
- public String getDecoderType() {
- return decoderType;
- }
-
- /**
- * Return the decoderClassName of this PolicyDecoderParameters instance.
- *
- * @return the decoderClassName
- */
- public String getDecoderClassName() {
- return decoderClassName;
- }
-
- /**
- * Return the name of the decoder configuration of this {@link PolicyDecoderParameters} instance.
- *
- * @return the the name of the decoder configuration
- */
- public String getDecoderConfigurationName() {
- return decoderConfigurationName;
- }
-
- /**
* {@inheritDoc}.
*/
@Override
@@ -101,27 +76,7 @@ public class PolicyDecoderParameters implements ParameterGroup {
* {@inheritDoc}.
*/
@Override
- public GroupValidationResult validate() {
- final GroupValidationResult validationResult = new GroupValidationResult(this);
- if (decoderType == null || decoderType.trim().length() == 0) {
- validationResult.setResult("decoderType", ValidationStatus.INVALID, "must be a non-blank string");
- }
- if (decoderClassName == null || decoderClassName.trim().length() == 0) {
- validationResult.setResult("decoderClassName", ValidationStatus.INVALID,
- "must be a non-blank string containing full class name of the decoder");
- } else {
- validatePolicyDecoderClass(validationResult);
- }
- return validationResult;
- }
-
- private void validatePolicyDecoderClass(final GroupValidationResult validationResult) {
- try {
- Class.forName(decoderClassName);
- } catch (final ClassNotFoundException exp) {
- LOGGER.trace("policy decoder class not found in classpath", exp);
- validationResult.setResult("decoderClassName", ValidationStatus.INVALID,
- "policy decoder class not found in classpath");
- }
+ public BeanValidationResult validate() {
+ return new BeanValidator().validateTop(getClass().getSimpleName(), this);
}
}
diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerParameters.java b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerParameters.java
index ea6d8d86..901c4968 100644
--- a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerParameters.java
+++ b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerParameters.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,26 +22,30 @@
package org.onap.policy.distribution.reception.parameters;
-import org.onap.policy.common.parameters.GroupValidationResult;
+import lombok.Getter;
+import lombok.Setter;
+import org.onap.policy.common.parameters.BeanValidationResult;
+import org.onap.policy.common.parameters.BeanValidator;
import org.onap.policy.common.parameters.ParameterGroup;
-import org.onap.policy.common.parameters.ValidationStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.policy.common.parameters.annotations.ClassName;
+import org.onap.policy.common.parameters.annotations.NotBlank;
+import org.onap.policy.common.parameters.annotations.NotNull;
+import org.onap.policy.common.parameters.annotations.Valid;
/**
* Class to hold all the reception handler parameters.
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
+@NotNull
+@NotBlank
+@Getter
public class ReceptionHandlerParameters implements ParameterGroup {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ReceptionHandlerParameters.class);
-
- private String name;
+ private @Setter String name;
private String receptionHandlerType;
- private String receptionHandlerClassName;
+ private @ClassName String receptionHandlerClassName;
private String receptionHandlerConfigurationName;
- private PluginHandlerParameters pluginHandlerParameters;
+ private @Valid PluginHandlerParameters pluginHandlerParameters;
/**
* Constructor for instantiating ReceptionHandlerParameters.
@@ -58,42 +63,6 @@ public class ReceptionHandlerParameters implements ParameterGroup {
this.pluginHandlerParameters = pluginHandlerParameters;
}
- /**
- * Return the receptionHandlerType of this ReceptionHandlerParameters instance.
- *
- * @return the receptionHandlerType
- */
- public String getReceptionHandlerType() {
- return receptionHandlerType;
- }
-
- /**
- * Return the receptionHandlerClassName of this ReceptionHandlerParameters instance.
- *
- * @return the receptionHandlerClassName
- */
- public String getReceptionHandlerClassName() {
- return receptionHandlerClassName;
- }
-
- /**
- * Return the name of the reception handler configuration for this ReceptionHandlerParameters instance.
- *
- * @return the PssdConfigurationParametersGroup
- */
- public String getReceptionHandlerConfigurationName() {
- return receptionHandlerConfigurationName;
- }
-
- /**
- * Return the pluginHandlerParameters of this ReceptionHandlerParameters instance.
- *
- * @return the pluginHandlerParameters
- */
- public PluginHandlerParameters getPluginHandlerParameters() {
- return pluginHandlerParameters;
- }
-
@Override
public String getName() {
return name + "_" + receptionHandlerType;
@@ -104,43 +73,7 @@ public class ReceptionHandlerParameters implements ParameterGroup {
*
*/
@Override
- public GroupValidationResult validate() {
- final GroupValidationResult validationResult = new GroupValidationResult(this);
- if (receptionHandlerType == null || receptionHandlerType.trim().length() == 0) {
- validationResult.setResult("receptionHandlerType", ValidationStatus.INVALID, "must be a non-blank string");
- }
- if (receptionHandlerClassName == null || receptionHandlerClassName.trim().length() == 0) {
- validationResult.setResult("receptionHandlerClassName", ValidationStatus.INVALID,
- "must be a non-blank string containing full class name of the reception handler");
- } else {
- validateReceptionHandlerClass(validationResult);
- }
- if (pluginHandlerParameters == null) {
- validationResult.setResult("pluginHandlerParameters", ValidationStatus.INVALID,
- "must have a plugin handler");
- } else {
- validationResult.setResult("pluginHandlerParameters", pluginHandlerParameters.validate());
- }
- return validationResult;
- }
-
- private void validateReceptionHandlerClass(final GroupValidationResult validationResult) {
- try {
- Class.forName(receptionHandlerClassName);
- } catch (final ClassNotFoundException exp) {
- LOGGER.error("reception handler class not found in classpath", exp);
- validationResult.setResult("receptionHandlerClassName", ValidationStatus.INVALID,
- "reception handler class not found in classpath");
- }
- }
-
- /**
- * Set the name of this group.
- *
- * @param name the name to set
- */
- @Override
- public void setName(final String name) {
- this.name = name;
+ public BeanValidationResult validate() {
+ return new BeanValidator().validateTop(getClass().getSimpleName(), this);
}
}
diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPluginHandlerParameters.java b/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPluginHandlerParameters.java
index 9d6a78d0..9a0ac316 100644
--- a/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPluginHandlerParameters.java
+++ b/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPluginHandlerParameters.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.
@@ -25,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
-import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters;
/**
@@ -40,30 +41,24 @@ public class TestPluginHandlerParameters {
public void testValidate_PolicyDecodersEmpty() {
PluginHandlerParameters emptyDecoder = new PluginHandlerParameters(new HashMap<>(), getPolicyForwarders());
- GroupValidationResult result = emptyDecoder.validate();
+ ValidationResult result = emptyDecoder.validate();
- assertThat(result.getResult())
- .contains("parameter group map \"policyDecoders\" INVALID, must have at least one policy decoder");
- assertThat(result.getResult()).doesNotContain(
- "parameter group map \"policyForwarders\" INVALID, must have at least one policy forwarder");
+ assertThat(result.getResult()).contains("\"policyDecoders\"", "minimum").doesNotContain("\"policyForwarders\"");
}
@Test
public void testValidate_PolicyForwardersNullEmpty() {
PluginHandlerParameters emptyDecoder = new PluginHandlerParameters(getPolicyDecoders(), new HashMap<>());
- GroupValidationResult result = emptyDecoder.validate();
+ ValidationResult result = emptyDecoder.validate();
- assertThat(result.getResult())
- .contains("parameter group map \"policyForwarders\" INVALID, must have at least one policy forwarder");
- assertThat(result.getResult()).doesNotContain(
- "parameter group map \"policyDecoders\" INVALID, must have at least one policy decoder");
+ assertThat(result.getResult()).contains("\"policyForwarders\"", "minimum").doesNotContain("\"policyDecoders\"");
}
private Map<String, PolicyDecoderParameters> getPolicyDecoders() {
final Map<String, PolicyDecoderParameters> policyDecoders = new HashMap<>();
final PolicyDecoderParameters pDParameters =
- new PolicyDecoderParameters("DummyDecoder", "DummyDecoder", "dummyDecoderConfiguration");
+ new PolicyDecoderParameters("DummyDecoder", getClass().getName(), "dummyDecoderConfiguration");
policyDecoders.put("DummyDecoder", pDParameters);
return policyDecoders;
@@ -72,7 +67,7 @@ public class TestPluginHandlerParameters {
private Map<String, PolicyForwarderParameters> getPolicyForwarders() {
final Map<String, PolicyForwarderParameters> policyForwarders = new HashMap<>();
final PolicyForwarderParameters pFParameters =
- new PolicyForwarderParameters("DummyForwarder", "DummyForwarder", "dummyForwarderConfiguration");
+ new PolicyForwarderParameters("DummyForwarder", getClass().getName(), "dummyForwarderConfiguration");
policyForwarders.put("DummyForwarder", pFParameters);
return policyForwarders;
diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPolicyDecoderParameters.java b/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPolicyDecoderParameters.java
index d1d0b421..dae91abf 100644
--- a/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPolicyDecoderParameters.java
+++ b/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestPolicyDecoderParameters.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,6 +24,7 @@ package org.onap.policy.distribution.reception.parameters;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
+import org.onap.policy.distribution.reception.handling.DummyDecoder;
/**
* Class for unit testing PolicyDecoderParameters class.
@@ -32,7 +34,7 @@ import org.junit.Test;
*/
public class TestPolicyDecoderParameters {
- static final String DECODER_CLASS_NAME = "org.onap.policy.distribution.reception.handling.DummyDecoder";
+ static final String DECODER_CLASS_NAME = DummyDecoder.class.getName();
static final String DECODER_CONFIG = "decoderConfigName";
static final String DECODER_TYPE = "DummyDecoder";
@@ -40,14 +42,12 @@ public class TestPolicyDecoderParameters {
public void testValidate_DecoderTypeEmptyNull() {
PolicyDecoderParameters sutParams = new PolicyDecoderParameters(null, DECODER_CLASS_NAME, DECODER_CONFIG);
- assertThat(sutParams.validate().getResult()).contains(
- "field \"decoderType\" type \"java.lang.String\" value \"null\" INVALID, must be a non-blank string");
+ assertThat(sutParams.validate().getResult()).contains("\"decoderType\" value \"null\" INVALID, is null");
sutParams.setName("");
- assertThat(sutParams.validate().getResult()).contains(
- "field \"decoderType\" type \"java.lang.String\" value \"\" INVALID, must be a non-blank string");
- assertThat(sutParams.validate().getResult()).doesNotContain("policy decoder class not found in classpath");
+ assertThat(sutParams.validate().getResult()).contains("\"decoderType\" value \"\" INVALID, is blank")
+ .doesNotContain("not found in classpath");
}
@Test
@@ -55,13 +55,10 @@ public class TestPolicyDecoderParameters {
PolicyDecoderParameters nullClassName = new PolicyDecoderParameters(DECODER_TYPE, null, DECODER_CONFIG);
assertThat(nullClassName.validate().getResult())
- .contains("field \"decoderClassName\" type \"java.lang.String\" value \"null\" INVALID, "
- + "must be a non-blank string containing full class name of the decoder");
+ .contains("\"decoderClassName\" value \"null\" INVALID, is null");
PolicyDecoderParameters emptyClassName = new PolicyDecoderParameters(DECODER_TYPE, "", DECODER_CONFIG);
- assertThat(emptyClassName.validate().getResult())
- .contains("field \"decoderClassName\" type \"java.lang.String\" value \"\" INVALID, "
- + "must be a non-blank string containing full class name of the decoder");
+ assertThat(emptyClassName.validate().getResult()).contains("\"decoderClassName\" value \"\" INVALID, is blank");
}
}
diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestReceptionHandlerParameters.java b/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestReceptionHandlerParameters.java
index e2ef01db..b12af003 100644
--- a/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestReceptionHandlerParameters.java
+++ b/reception/src/test/java/org/onap/policy/distribution/reception/parameters/TestReceptionHandlerParameters.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.
@@ -26,6 +27,7 @@ import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters;
+import org.onap.policy.distribution.reception.handling.DummyDecoder;
/**
* Class for unit testing ReceptionHandlerParameters class.
@@ -42,25 +44,24 @@ public class TestReceptionHandlerParameters {
ReceptionHandlerParameters sutParams = getReceptionHandlerParameters(className);
sutParams.setName(className);
- assertThat(sutParams.validate().getResult()).contains("reception handler class not found in classpath");
+ assertThat(sutParams.validate().getResult()).contains("class is not in the classpath");
}
@Test
public void testValidate_ReceptionHandlerTypeNullEmpty() {
- final String className = "org.onap.policy.distribution.reception.handling.DummyReceptionHandler";
+ final String className = DummyDecoder.class.getName();
final PluginHandlerParameters pHParameters =
new PluginHandlerParameters(getPolicyDecoders(), getPolicyForwarders());
ReceptionHandlerParameters nullType = new ReceptionHandlerParameters(null, className, className, pHParameters);
- assertThat(nullType.validate().getResult()).contains("field \"receptionHandlerType\" type \"java.lang.String\""
- + " value \"null\" INVALID, must be a non-blank string");
+ assertThat(nullType.validate().getResult())
+ .contains("\"receptionHandlerType\" value \"null\" INVALID, is null");
ReceptionHandlerParameters emptyType = new ReceptionHandlerParameters("", className, className, pHParameters);
- assertThat(emptyType.validate().getResult()).contains("field \"receptionHandlerType\" type \"java.lang.String\""
- + " value \"\" INVALID, must be a non-blank string");
- assertThat(emptyType.validate().getResult()).doesNotContain("reception handler class not found in classpath");
+ assertThat(emptyType.validate().getResult()).contains("\"receptionHandlerType\" value \"\" INVALID, is blank")
+ .doesNotContain("classpath");
}
@Test
@@ -72,17 +73,13 @@ public class TestReceptionHandlerParameters {
"dummyReceptionHandlerConfiguration", pHParameters);
assertThat(nullType.validate().getResult())
- .contains("field \"receptionHandlerClassName\" type \"java.lang.String\" value "
- + "\"null\" INVALID, must be a non-blank string containing full class name "
- + "of the reception handler");
+ .contains("\"receptionHandlerClassName\" value \"null\" INVALID, is null");
ReceptionHandlerParameters emptyType = new ReceptionHandlerParameters("DummyReceptionHandler", "",
"dummyReceptionHandlerConfiguration", pHParameters);
assertThat(emptyType.validate().getResult())
- .contains("field \"receptionHandlerClassName\" type \"java.lang.String\" value "
- + "\"\" INVALID, must be a non-blank string containing full class name of "
- + "the reception handler");
+ .contains("\"receptionHandlerClassName\" value \"\" INVALID, is blank");
}
@Test
@@ -93,7 +90,7 @@ public class TestReceptionHandlerParameters {
"dummyReceptionHandlerConfiguration", null);
assertThat(sutParams.validate().getResult())
- .contains("parameter group \"UNDEFINED\" INVALID, must have a plugin handler");
+ .contains("\"pluginHandlerParameters\" value \"null\" INVALID, is null");
}
private ReceptionHandlerParameters getReceptionHandlerParameters(String className) {
@@ -109,7 +106,7 @@ public class TestReceptionHandlerParameters {
final Map<String, PolicyDecoderParameters> policyDecoders = new HashMap<>();
final PolicyDecoderParameters pDParameters =
- new PolicyDecoderParameters("DummyDecoder", "DummyDecoder", "dummyDecoderConfiguration");
+ new PolicyDecoderParameters("DummyDecoder", DummyDecoder.class.getName(), "dummyDecoderConfiguration");
policyDecoders.put("DummyDecoder", pDParameters);
return policyDecoders;
@@ -118,8 +115,8 @@ public class TestReceptionHandlerParameters {
private Map<String, PolicyForwarderParameters> getPolicyForwarders() {
final Map<String, PolicyForwarderParameters> policyForwarders = new HashMap<>();
- final PolicyForwarderParameters pFParameters =
- new PolicyForwarderParameters("DummyForwarder", "DummyForwarder", "dummyForwarderConfiguration");
+ final PolicyForwarderParameters pFParameters = new PolicyForwarderParameters("DummyForwarder",
+ DummyDecoder.class.getName(), "dummyForwarderConfiguration");
policyForwarders.put("DummyForwarder", pFParameters);
return policyForwarders;