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 | |
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')
9 files changed, 43 insertions, 43 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"); } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequest.java index 46e68acda..12b9a695c 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequest.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequest.java @@ -21,7 +21,7 @@ package org.onap.policy.apex.plugins.event.carrier.restrequestor; /** - * This class holds a record of a REST request for the REST requestor plugin + * This class holds a record of a REST request for the REST requestor plugin. * * @author Liam Fallon (liam.fallon@ericsson.com) */ diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java index a2069a794..9998349db 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java @@ -129,7 +129,7 @@ public class ApexRestRequestorConsumer implements ApexEventConsumer, Runnable { } // Check if the HTTP URL has been set - if (restConsumerProperties.getURL() == null) { + if (restConsumerProperties.getUrl() == null) { final String errorMessage = "no URL has been specified on REST Requestor consumer (" + this.name + ")"; LOGGER.warn(errorMessage); throw new ApexEventException(errorMessage); @@ -137,7 +137,7 @@ public class ApexRestRequestorConsumer implements ApexEventConsumer, Runnable { // Check if the HTTP URL is valid try { - new URL(restConsumerProperties.getURL()); + new URL(restConsumerProperties.getUrl()); } catch (final Exception e) { final String errorMessage = "invalid URL has been specified on REST Requestor consumer (" + this.name + ")"; LOGGER.warn(errorMessage); @@ -154,7 +154,7 @@ public class ApexRestRequestorConsumer implements ApexEventConsumer, Runnable { } /** - * Receive an incoming REST request from the peered REST Requestor producer and queue it + * Receive an incoming REST request from the peered REST Requestor producer and queue it. * * @param restRequest the incoming rest request to queue * @throws ApexEventRuntimeException on queueing errors @@ -346,7 +346,7 @@ public class ApexRestRequestorConsumer implements ApexEventConsumer, Runnable { // Check that the event request worked if (response.getStatus() != Response.Status.OK.getStatusCode()) { final String errorMessage = "reception of response to \"" + request + "\" from URL \"" - + restConsumerProperties.getURL() + "\" failed with status code " + response.getStatus() + + restConsumerProperties.getUrl() + "\" failed with status code " + response.getStatus() + " and message \"" + response.readEntity(String.class) + "\""; throw new ApexEventRuntimeException(errorMessage); } @@ -357,7 +357,7 @@ public class ApexRestRequestorConsumer implements ApexEventConsumer, Runnable { // Check there is content if (eventJSONString == null || eventJSONString.trim().length() == 0) { final String errorMessage = "received an enpty response to \"" + request + "\" from URL \"" - + restConsumerProperties.getURL() + "\""; + + restConsumerProperties.getUrl() + "\""; throw new ApexEventRuntimeException(errorMessage); } @@ -390,18 +390,18 @@ public class ApexRestRequestorConsumer implements ApexEventConsumer, Runnable { public Response sendEventAsRESTRequest() { switch (restConsumerProperties.getHttpMethod()) { case GET: - return client.target(restConsumerProperties.getURL()).request(APPLICATION_JSON).get(); + return client.target(restConsumerProperties.getUrl()).request(APPLICATION_JSON).get(); case PUT: - return client.target(restConsumerProperties.getURL()).request(APPLICATION_JSON) + return client.target(restConsumerProperties.getUrl()).request(APPLICATION_JSON) .put(Entity.json(request.getEvent())); case POST: - return client.target(restConsumerProperties.getURL()).request(APPLICATION_JSON) + return client.target(restConsumerProperties.getUrl()).request(APPLICATION_JSON) .post(Entity.json(request.getEvent())); case DELETE: - return client.target(restConsumerProperties.getURL()).request(APPLICATION_JSON).delete(); + return client.target(restConsumerProperties.getUrl()).request(APPLICATION_JSON).delete(); } return null; diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java index 12f194510..721dfb683 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorProducer.java @@ -86,7 +86,7 @@ public class ApexRestRequestorProducer implements ApexEventProducer { } // Check if the HTTP URL has been set - if (restProducerProperties.getURL() != null) { + if (restProducerProperties.getUrl() != null) { final String errorMessage = "URL may not be specified on REST Requestor producer (" + this.name + ")"; LOGGER.warn(errorMessage); throw new ApexEventException(errorMessage); @@ -112,7 +112,7 @@ public class ApexRestRequestorProducer implements ApexEventProducer { } /** - * Get the number of events sent to date + * Get the number of events sent to date. * * @return the number of events received */ @@ -163,7 +163,7 @@ public class ApexRestRequestorProducer implements ApexEventProducer { // Find the REST Response Consumer that will handle this request final ApexEventConsumer consumer = peeredRequestorReference.getPeeredConsumer(); if (!(consumer instanceof ApexRestRequestorConsumer)) { - final String errorMessage = "send of event to URL \"" + restProducerProperties.getURL() + "\" failed," + final String errorMessage = "send of event to URL \"" + restProducerProperties.getUrl() + "\" failed," + " REST response consumer is not an instance of ApexRestRequestorConsumer\n" + event; LOGGER.warn(errorMessage); throw new ApexEventRuntimeException(errorMessage); @@ -176,7 +176,7 @@ public class ApexRestRequestorProducer implements ApexEventProducer { eventsSent++; } else { // No peered consumer defined - final String errorMessage = "send of event to URL \"" + restProducerProperties.getURL() + "\" failed," + final String errorMessage = "send of event to URL \"" + restProducerProperties.getUrl() + "\" failed," + " REST response consumer is not defined\n" + event; LOGGER.warn(errorMessage); throw new ApexEventRuntimeException(errorMessage); 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 9b841d768..65eb731ed 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 @@ -26,7 +26,7 @@ import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnolo * Apex parameters for REST as an event carrier technology with Apex issuing a REST request and receiving a REST * response. * - * The parameters for this plugin are: + * <p>The parameters for this plugin are: * <ol> * <li>url: The URL that the Apex Rest Requestor will connect to over REST for REST request sending. This parameter is * mandatory. @@ -81,7 +81,7 @@ public class RESTRequestorCarrierTechnologyParameters extends CarrierTechnologyP * * @return the URL */ - public String getURL() { + public String getUrl() { return url; } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restrequestor/TestRESTRequestor.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restrequestor/TestRESTRequestor.java index 70d567b0d..3db0f1467 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restrequestor/TestRESTRequestor.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restrequestor/TestRESTRequestor.java @@ -60,7 +60,7 @@ public class TestRESTRequestor { @BeforeClass public static void setUp() throws Exception { - final ResourceConfig rc = new ResourceConfig(TestRESTREequestorEndpoint.class); + final ResourceConfig rc = new ResourceConfig(TestRestRequestorEndpoint.class); server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc); while (!server.isStarted()) { @@ -79,7 +79,7 @@ public class TestRESTRequestor { @Before public void resetCounters() { - TestRESTREequestorEndpoint.resetCounters(); + TestRestRequestorEndpoint.resetCounters(); } @Test diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restrequestor/TestRESTREequestorEndpoint.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restrequestor/TestRestRequestorEndpoint.java index d9569b1ed..4977b3efb 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restrequestor/TestRESTREequestorEndpoint.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restrequestor/TestRestRequestorEndpoint.java @@ -35,7 +35,7 @@ import javax.ws.rs.Path; import javax.ws.rs.core.Response; @Path("/apex") -public class TestRESTREequestorEndpoint { +public class TestRestRequestorEndpoint { private static Object counterLock = new Object(); private static int postMessagesReceived = 0; |