diff options
author | Jim Hahn <jrh3@att.com> | 2021-04-28 15:45:22 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-05-03 15:44:08 -0400 |
commit | e168ce2fad71650ad730519c772a9b093c0a8f43 (patch) | |
tree | 8d97f8823eb4f97916b2c19909c6b13e6a008e4a /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient | |
parent | cb09008c4d252dbc9a62f3a1d0b463a74380aa77 (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: I2c0c01fac355e6cde4d8d6998dc42f8a2e2ebb65
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient')
2 files changed, 18 insertions, 11 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParameters.java index d5bca3f5a..23936439a 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParameters.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParameters.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-2020 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. @@ -24,7 +25,8 @@ package org.onap.policy.apex.plugins.event.carrier.restclient; import lombok.Getter; import lombok.Setter; import org.onap.policy.apex.service.parameters.carriertechnology.RestPluginCarrierTechnologyParameters; -import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ObjectValidationResult; +import org.onap.policy.common.parameters.ValidationResult; import org.onap.policy.common.parameters.ValidationStatus; // @formatter:off @@ -66,14 +68,13 @@ public class RestClientCarrierTechnologyParameters extends RestPluginCarrierTech * {@inheritDoc} */ @Override - public GroupValidationResult validateUrl(final GroupValidationResult result) { + public ValidationResult validateUrl() { // Check if the URL has been set for event output - final String urlNullMessage = "no URL has been set for event sending on " + getLabel(); if (getUrl() == null) { - result.setResult("url", ValidationStatus.INVALID, urlNullMessage); - return result; + final String urlNullMessage = "no URL has been set for event sending on " + getLabel(); + return new ObjectValidationResult("url", null, ValidationStatus.INVALID, urlNullMessage); } - return super.validateUrl(result); + return super.validateUrl(); } } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParametersTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParametersTest.java index 9d4da1cd0..58d265a97 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParametersTest.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParametersTest.java @@ -3,6 +3,7 @@ * Copyright (C) 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. @@ -47,7 +48,10 @@ public class RestClientCarrierTechnologyParametersTest { arguments.setRelativeFileRoot("."); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) - .hasMessageContaining("HTTP header array entry is null\n parameter"); + .hasMessageContaining("httpHeaders") + .hasMessageContaining("item \"entry 0\" value \"null\" INVALID, is null") + .hasMessageContaining("item \"entry 1\" value \"null\" INVALID, is null") + .hasMessageContaining("item \"entry 2\" value \"null\" INVALID, is null"); } @Test @@ -57,8 +61,9 @@ public class RestClientCarrierTechnologyParametersTest { arguments.setRelativeFileRoot("."); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) - .hasMessageContaining("HTTP header array entries must have one key and one value: [aaa, bbb, ccc]") - .hasMessageEndingWith("HTTP header array entries must have one key and one value: [aaa]\n"); + .hasMessageContaining("httpHeaders") + .hasMessageContaining("\"entry 0\" value \"[aaa, bbb, ccc]\" INVALID, must have one key and one value") + .hasMessageContaining("\"entry 0\" value \"[aaa]\" INVALID, must have one key and one value"); } @Test @@ -68,8 +73,9 @@ public class RestClientCarrierTechnologyParametersTest { arguments.setRelativeFileRoot("."); assertThatThrownBy(() -> new ApexParameterHandler().getParameters(arguments)) - .hasMessageContaining("HTTP header key is null or blank: [null, bbb]") - .hasMessageEndingWith("HTTP header value is null or blank: [ccc, null]\n"); + .hasMessageContaining("httpHeaders", "entry 0", "entry 1") + .hasMessageContaining("item \"key\" value \"null\" INVALID, is blank") + .hasMessageContaining("item \"value\" value \"null\" INVALID, is blank"); } @Test |