From 042a8f5ec583a7431971847995f1aabd9bc48366 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Mon, 6 Jul 2020 09:31:18 +0100 Subject: Fix URL checking on REST plugins The URL parameter must always be provided on the REST client carrier plugin The URL parameter must always be provided on the REST requestor consumer The URL parameter is not required on the REST requestor producer This patch fixes the implementation to always checks the URL for existence on the REST Client plugin. The current checks on the REST Requestor are correct for the REST requestor plugin consumer and producer classes, so the checks are not required in the REST Requestor parameters. Issue-ID: POLICY-2692 Change-Id: I4e1534202002cf4a03bd159ac97b2a4f5b1746ab Signed-off-by: liamfallon --- .../RestRequestorCarrierTechnologyParameters.java | 32 ---------------------- 1 file changed, 32 deletions(-) (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src') diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorCarrierTechnologyParameters.java index 9f3a631e1..9e55e22d6 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorCarrierTechnologyParameters.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorCarrierTechnologyParameters.java @@ -21,12 +21,9 @@ package org.onap.policy.apex.plugins.event.carrier.restrequestor; -import java.util.regex.Matcher; 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.ValidationStatus; // @formatter:off /** @@ -70,33 +67,4 @@ public class RestRequestorCarrierTechnologyParameters extends RestPluginCarrierT this.setEventProducerPluginClass(ApexRestRequestorProducer.class.getName()); this.setEventConsumerPluginClass(ApexRestRequestorConsumer.class.getName()); } - - // @formatter:off - /** - * Validate the URL. - * - *

Checks: - * http://www.blah.com/{par1/somethingelse (Missing end tag) use {[^\\{}]*$ - * http://www.blah.com/{par1/{some}thingelse (Nested tag) use {[^}]*{ - * http://www.blah.com/{par1}/some}thingelse (Missing start tag1) use }[^{}]*.} - * http://www.blah.com/par1}/somethingelse (Missing start tag2) use }[^{}]*} - * http://www.blah.com/{}/somethingelse (Empty tag) use {[\s]*} - * @param result the result of the validation - */ - // @formatter:on - @Override - public GroupValidationResult validateUrl(final GroupValidationResult result) { - // URL is only set on Requestor consumers - if (getUrl() == null) { - return result; - } - - Matcher matcher = patternErrorKey.matcher(getUrl()); - if (matcher.find()) { - result.setResult("url", ValidationStatus.INVALID, - "no proper URL has been set for event sending on REST requestor"); - } - - return result; - } } -- cgit 1.2.3-korg