diff options
author | liamfallon <liam.fallon@ericsson.com> | 2018-09-07 15:11:46 +0100 |
---|---|---|
committer | liamfallon <liam.fallon@ericsson.com> | 2018-09-07 15:11:55 +0100 |
commit | 07922e8590597e7a74a2059a1b344c92f04771c5 (patch) | |
tree | d7f0c7afc4c2a7830b959727049e1118472e8abb /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main | |
parent | a41c877a6b1980e0e866699633e0289d9a3fdbb5 (diff) |
Parameter group fields must have getters
Modifications to apex parameters to include getters
that follow naming conventions, and knock on changes.
Also checkstyle fixes taken in modifified classes.
Issue-ID: POLICY-1095
Change-Id: Iff5ccc7a069a4ec2b2b974ed9f5ed70a88692e00
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main')
3 files changed, 24 insertions, 24 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/ApexRestClientConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java index b9348d494..af5d4d861 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java @@ -72,19 +72,19 @@ public class ApexRestClientConsumer implements ApexEventConsumer, Runnable { @Override public void init(final String consumerName, final EventHandlerParameters consumerParameters, - final ApexEventReceiver incomingEventReceiver) throws ApexEventException { + final ApexEventReceiver incomingEventReceiver) throws ApexEventException { this.eventReceiver = incomingEventReceiver; this.name = consumerName; // Check and get the REST Properties if (!(consumerParameters.getCarrierTechnologyParameters() instanceof RESTClientCarrierTechnologyParameters)) { - final String errorMessage = - "specified consumer properties are not applicable to REST client consumer (" + this.name + ")"; + final String errorMessage = "specified consumer properties are not applicable to REST client consumer (" + + this.name + ")"; LOGGER.warn(errorMessage); throw new ApexEventException(errorMessage); } - restConsumerProperties = - (RESTClientCarrierTechnologyParameters) consumerParameters.getCarrierTechnologyParameters(); + restConsumerProperties = (RESTClientCarrierTechnologyParameters) consumerParameters + .getCarrierTechnologyParameters(); // Check if the HTTP method has been set if (restConsumerProperties.getHttpMethod() == null) { @@ -92,10 +92,10 @@ public class ApexRestClientConsumer implements ApexEventConsumer, Runnable { } if (!restConsumerProperties.getHttpMethod() - .equalsIgnoreCase(RESTClientCarrierTechnologyParameters.CONSUMER_HTTP_METHOD)) { + .equalsIgnoreCase(RESTClientCarrierTechnologyParameters.CONSUMER_HTTP_METHOD)) { final String errorMessage = "specified HTTP method of \"" + restConsumerProperties.getHttpMethod() - + "\" is invalid, only HTTP method \"GET\" is supported for event reception on REST client consumer (" - + this.name + ")"; + + "\" is invalid, only HTTP method \"GET\" " + + "is supported for event reception on REST client consumer (" + this.name + ")"; LOGGER.warn(errorMessage); throw new ApexEventException(errorMessage); } @@ -202,14 +202,14 @@ public class ApexRestClientConsumer implements ApexEventConsumer, Runnable { @Override public void run() { try { - final Response response = - client.target(restConsumerProperties.getURL()).request("application/json").get(); + final Response response = client.target(restConsumerProperties.getUrl()).request("application/json") + .get(); // Check that the event request worked if (response.getStatus() != Response.Status.OK.getStatusCode()) { - final String errorMessage = "reception of event from URL \"" + restConsumerProperties.getURL() - + "\" failed with status code " + response.getStatus() + " and message \"" - + response.readEntity(String.class) + "\""; + final String errorMessage = "reception of event from URL \"" + restConsumerProperties.getUrl() + + "\" failed with status code " + response.getStatus() + " and message \"" + + response.readEntity(String.class) + "\""; throw new ApexEventRuntimeException(errorMessage); } @@ -218,8 +218,8 @@ public class ApexRestClientConsumer implements ApexEventConsumer, Runnable { // Check there is content if (eventJSONString == null || eventJSONString.trim().length() == 0) { - final String errorMessage = - "received an empty event from URL \"" + restConsumerProperties.getURL() + "\""; + final String errorMessage = "received an empty event from URL \"" + restConsumerProperties.getUrl() + + "\""; throw new ApexEventRuntimeException(errorMessage); } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java index 9d838f55e..2765fe9e7 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java @@ -146,11 +146,11 @@ public class ApexRestClientProducer implements ApexEventProducer { } // Send the event as a REST request - final Response response = sendEventAsRESTRequest((String) event); + final Response response = sendEventAsRestRequest((String) event); // Check that the request worked if (response.getStatus() != Response.Status.OK.getStatusCode()) { - final String errorMessage = "send of event to URL \"" + restProducerProperties.getURL() + "\" using HTTP \"" + final String errorMessage = "send of event to URL \"" + restProducerProperties.getUrl() + "\" using HTTP \"" + restProducerProperties.getHttpMethod() + "\" failed with status code " + response.getStatus() + " and message \"" + response.readEntity(String.class) + "\", event:\n" + event; LOGGER.warn(errorMessage); @@ -159,7 +159,7 @@ public class ApexRestClientProducer implements ApexEventProducer { if (LOGGER.isTraceEnabled()) { LOGGER.trace("event sent from engine using {} to URL {} with HTTP {} : {} and response {} ", this.name, - restProducerProperties.getURL(), restProducerProperties.getHttpMethod(), event, response); + restProducerProperties.getUrl(), restProducerProperties.getHttpMethod(), event, response); } } @@ -180,12 +180,12 @@ public class ApexRestClientProducer implements ApexEventProducer { * @param event the event to send * @return the response tot he JSON request */ - public Response sendEventAsRESTRequest(final String event) { + public Response sendEventAsRestRequest(final String event) { // We have already checked that it is a PUT or POST request if (restProducerProperties.getHttpMethod().equalsIgnoreCase("POST")) { - return client.target(restProducerProperties.getURL()).request("application/json").post(Entity.json(event)); + return client.target(restProducerProperties.getUrl()).request("application/json").post(Entity.json(event)); } else { - return client.target(restProducerProperties.getURL()).request("application/json").put(Entity.json(event)); + return client.target(restProducerProperties.getUrl()).request("application/json").put(Entity.json(event)); } } } 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 59d19f76b..d260cbeca 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 @@ -27,7 +27,7 @@ import org.onap.policy.common.parameters.ValidationStatus; /** * Apex parameters for REST as an event carrier technology with Apex as a REST client. * - * The parameters for this plugin are: + * <p>The parameters for this plugin are: * <ol> * <li>url: The URL that the Apex Rest client will connect to over REST for event reception or event sending. This * parameter is mandatory. @@ -76,7 +76,7 @@ public class RESTClientCarrierTechnologyParameters extends CarrierTechnologyPara * * @return the URL */ - public String getURL() { + public String getUrl() { return url; } @@ -126,7 +126,7 @@ public class RESTClientCarrierTechnologyParameters extends CarrierTechnologyPara final GroupValidationResult result = super.validate(); // Check if the URL has been set for event output - if (getURL() == null) { + if (getUrl() == null) { result.setResult("url", ValidationStatus.INVALID, "no URL has been set for event sending on REST client"); } |