summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-07-06 09:31:18 +0100
committerliamfallon <liam.fallon@est.tech>2020-07-06 15:18:50 +0100
commit042a8f5ec583a7431971847995f1aabd9bc48366 (patch)
tree44dc989c4d57ad0fee1a4b119dd262d103c0c6c1 /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src
parent9519d1257b4fe4fbb68d3e9ab155de8ff0f13052 (diff)
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 <liam.fallon@est.tech>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src')
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/RestClientCarrierTechnologyParameters.java17
1 files changed, 17 insertions, 0 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 47e94ff51..d5bca3f5a 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
@@ -24,6 +24,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.ValidationStatus;
// @formatter:off
/**
@@ -59,4 +61,19 @@ public class RestClientCarrierTechnologyParameters extends RestPluginCarrierTech
this.setEventProducerPluginClass(ApexRestClientProducer.class.getName());
this.setEventConsumerPluginClass(ApexRestClientConsumer.class.getName());
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public GroupValidationResult validateUrl(final GroupValidationResult result) {
+ // 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;
+ }
+
+ return super.validateUrl(result);
+ }
}