From 011cdf2d4fa47ab078061d3700a95c3d3764e5e0 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Tue, 14 Aug 2018 16:43:53 -0400 Subject: Fix checkstyle comments etc. Adding javadoc comments, renaming variables names, fixed whitespace and 120 length. Also some variables were made final since they were declared further from usage. Splitting out Asserts. Still remaining are the abbreviations. Issue-ID: POLICY-881 Change-Id: I31ce5a9eea02578bce023c0c607a19108bb726fa Signed-off-by: Pamela Dragosh --- .../org/onap/policy/common/ia/AuditorTimeTest.java | 3 +- .../endpoints/event/comm/bus/ApiKeyEnabled.java | 4 + .../event/comm/bus/DmaapTopicSinkFactory.java | 85 ++++++++++++---------- .../event/comm/bus/DmaapTopicSourceFactory.java | 78 ++++++++++---------- .../event/comm/bus/UebTopicSinkFactory.java | 23 ++---- .../event/comm/bus/UebTopicSourceFactory.java | 10 --- .../event/comm/bus/internal/BusConsumer.java | 7 ++ .../event/comm/bus/internal/BusPublisher.java | 11 +++ .../event/comm/bus/internal/BusTopicBase.java | 2 - .../event/comm/bus/internal/BusTopicParams.java | 45 ++++++------ .../comm/bus/internal/InlineDmaapTopicSink.java | 1 - .../bus/internal/SingleThreadedBusTopicSource.java | 6 +- .../internal/SingleThreadedDmaapTopicSource.java | 4 +- .../http/client/internal/JerseyClient.java | 16 +++- .../http/server/internal/JettyJerseyServer.java | 4 +- .../http/server/internal/JettyServletServer.java | 21 ++++-- .../endpoints/http/server/test/HttpClientTest.java | 31 ++++++-- .../endpoints/http/server/test/HttpServerTest.java | 6 +- .../http/server/test/RestEchoService.java | 15 ++-- .../endpoints/http/server/test/RestEndpoints.java | 11 ++- .../http/server/test/RestMockHealthCheck.java | 6 +- .../endpoints/http/server/test/TestFilter.java | 1 + 22 files changed, 225 insertions(+), 165 deletions(-) diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/AuditorTimeTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/AuditorTimeTest.java index 7da157f2..b8e4ba5d 100644 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/AuditorTimeTest.java +++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/AuditorTimeTest.java @@ -20,7 +20,8 @@ package org.onap.policy.common.ia; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import org.junit.Test; import org.onap.policy.common.utils.time.CurrentTime; diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/ApiKeyEnabled.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/ApiKeyEnabled.java index 42e01366..0e06007f 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/ApiKeyEnabled.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/ApiKeyEnabled.java @@ -25,11 +25,15 @@ package org.onap.policy.common.endpoints.event.comm.bus; */ public interface ApiKeyEnabled { /** + * Get API key. + * * @return api key */ public String getApiKey(); /** + * Get API secret. + * * @return api secret */ public String getApiSecret(); diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSinkFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSinkFactory.java index e79d4888..08e8dfe8 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSinkFactory.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSinkFactory.java @@ -139,7 +139,7 @@ class IndexedDmaapTopicSinkFactory implements DmaapTopicSinkFactory { protected HashMap dmaapTopicWriters = new HashMap<>(); @Override - public DmaapTopicSink build(BusTopicParams busTopicParams){ + public DmaapTopicSink build(BusTopicParams busTopicParams) { if (busTopicParams.getTopic() == null || busTopicParams.getTopic().isEmpty()) { throw new IllegalArgumentException(MISSING_TOPIC); @@ -197,60 +197,71 @@ class IndexedDmaapTopicSinkFactory implements DmaapTopicSinkFactory { serverList = new ArrayList<>(); } - String apiKey = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." + topic - + PolicyEndPointProperties.PROPERTY_TOPIC_API_KEY_SUFFIX); - String apiSecret = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." - + topic + PolicyEndPointProperties.PROPERTY_TOPIC_API_SECRET_SUFFIX); + final String apiKey = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_API_KEY_SUFFIX); + final String apiSecret = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_API_SECRET_SUFFIX); - String aafMechId = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." - + topic + PolicyEndPointProperties.PROPERTY_TOPIC_AAF_MECHID_SUFFIX); - String aafPassword = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." - + topic + PolicyEndPointProperties.PROPERTY_TOPIC_AAF_PASSWORD_SUFFIX); + final String aafMechId = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_AAF_MECHID_SUFFIX); + final String aafPassword = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_AAF_PASSWORD_SUFFIX); - String partitionKey = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." - + topic + PolicyEndPointProperties.PROPERTY_TOPIC_SINK_PARTITION_KEY_SUFFIX); + final String partitionKey = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_SINK_PARTITION_KEY_SUFFIX); - String managedString = properties.getProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + "." - + topic + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX); + final String managedString = properties.getProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX); /* DME2 Properties */ - String dme2Environment = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS - + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_ENVIRONMENT_SUFFIX); + final String dme2Environment = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_ENVIRONMENT_SUFFIX); - String dme2AftEnvironment = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS - + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_AFT_ENVIRONMENT_SUFFIX); + final String dme2AftEnvironment = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_AFT_ENVIRONMENT_SUFFIX); - String dme2Partner = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." - + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_PARTNER_SUFFIX); + final String dme2Partner = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_PARTNER_SUFFIX); - String dme2RouteOffer = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." - + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_ROUTE_OFFER_SUFFIX); + final String dme2RouteOffer = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_ROUTE_OFFER_SUFFIX); - String dme2Latitude = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." - + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_LATITUDE_SUFFIX); + final String dme2Latitude = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." + + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_LATITUDE_SUFFIX); - String dme2Longitude = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." - + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_LONGITUDE_SUFFIX); + final String dme2Longitude = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_LONGITUDE_SUFFIX); - String dme2EpReadTimeoutMs = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS - + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_EP_READ_TIMEOUT_MS_SUFFIX); + final String dme2EpReadTimeoutMs = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_EP_READ_TIMEOUT_MS_SUFFIX); - String dme2EpConnTimeout = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS - + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_EP_CONN_TIMEOUT_SUFFIX); + final String dme2EpConnTimeout = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_EP_CONN_TIMEOUT_SUFFIX); - String dme2RoundtripTimeoutMs = - properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." + topic + final String dme2RoundtripTimeoutMs = + properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_ROUNDTRIP_TIMEOUT_MS_SUFFIX); - String dme2Version = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." - + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_VERSION_SUFFIX); + final String dme2Version = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." + + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_VERSION_SUFFIX); - String dme2SubContextPath = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS - + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_SUB_CONTEXT_PATH_SUFFIX); + final String dme2SubContextPath = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_SUB_CONTEXT_PATH_SUFFIX); - String dme2SessionStickinessRequired = - properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + "." + topic + final String dme2SessionStickinessRequired = + properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_SESSION_STICKINESS_REQUIRED_SUFFIX); Map dme2AdditionalProps = new HashMap<>(); diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSourceFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSourceFactory.java index 41611f4e..30cc923b 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSourceFactory.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/DmaapTopicSourceFactory.java @@ -59,23 +59,9 @@ public interface DmaapTopicSourceFactory { /** * Instantiates a new DMAAP Topic Source. - * - * servers list of servers - * topic topic name - * apiKey API Key - * apiSecret API Secret - * userName user name - * password password - * consumerGroup Consumer Group - * consumerInstance Consumer Instance - * fetchTimeout Read Fetch Timeout - * fetchLimit Fetch Limit - * managed is this endpoind managed? - * useHttps does the connection use HTTPS? - * allowSelfSignedCerts does connection allow self-signed certificates? - * @param busTopicParams parameter object - * @return an DMAAP Topic Source - * @throws IllegalArgumentException if invalid parameters are present + * + * @param busTopicParams parameters object + * @return a DMAAP Topic Source */ DmaapTopicSource build(BusTopicParams busTopicParams); @@ -211,65 +197,81 @@ class IndexedDmaapTopicSourceFactory implements DmaapTopicSourceFactory { serverList = new ArrayList<>(); } - String apiKey = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + final String apiKey = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_API_KEY_SUFFIX); - String apiSecret = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + final String apiSecret = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_API_SECRET_SUFFIX); - String aafMechId = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + final String aafMechId = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_AAF_MECHID_SUFFIX); - String aafPassword = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + final String aafPassword = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_AAF_PASSWORD_SUFFIX); - String consumerGroup = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + final String consumerGroup = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_SOURCE_CONSUMER_GROUP_SUFFIX); - String consumerInstance = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + final String consumerInstance = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_SOURCE_CONSUMER_INSTANCE_SUFFIX); - String fetchTimeoutString = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + final String fetchTimeoutString = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_SOURCE_FETCH_TIMEOUT_SUFFIX); /* DME2 Properties */ - String dme2Environment = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + final String dme2Environment = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_ENVIRONMENT_SUFFIX); - String dme2AftEnvironment = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + final String dme2AftEnvironment = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_AFT_ENVIRONMENT_SUFFIX); - String dme2Partner = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + final String dme2Partner = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_PARTNER_SUFFIX); - String dme2RouteOffer = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + final String dme2RouteOffer = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_ROUTE_OFFER_SUFFIX); - String dme2Latitude = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + final String dme2Latitude = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_LATITUDE_SUFFIX); - String dme2Longitude = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + final String dme2Longitude = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_LONGITUDE_SUFFIX); - String dme2EpReadTimeoutMs = + final String dme2EpReadTimeoutMs = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_EP_READ_TIMEOUT_MS_SUFFIX); - String dme2EpConnTimeout = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + final String dme2EpConnTimeout = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_EP_CONN_TIMEOUT_SUFFIX); - String dme2RoundtripTimeoutMs = + final String dme2RoundtripTimeoutMs = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_ROUNDTRIP_TIMEOUT_MS_SUFFIX); - String dme2Version = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + final String dme2Version = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_VERSION_SUFFIX); - String dme2SubContextPath = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + final String dme2SubContextPath = properties.getProperty( + PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_SUB_CONTEXT_PATH_SUFFIX); - String dme2SessionStickinessRequired = + final String dme2SessionStickinessRequired = properties.getProperty(PolicyEndPointProperties.PROPERTY_DMAAP_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_DMAAP_DME2_SESSION_STICKINESS_REQUIRED_SUFFIX); @@ -384,7 +386,7 @@ class IndexedDmaapTopicSourceFactory implements DmaapTopicSourceFactory { /** * {@inheritDoc} * - * @throws IllegalArgumentException + * @throws IllegalArgumentException throws illegal argument exception */ @Override public DmaapTopicSource build(List servers, String topic, String apiKey, String apiSecret) { @@ -404,7 +406,7 @@ class IndexedDmaapTopicSourceFactory implements DmaapTopicSourceFactory { /** * {@inheritDoc} * - * @throws IllegalArgumentException + * @throws IllegalArgumentException throws illegal argument exception */ @Override public DmaapTopicSource build(List servers, String topic) { diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicSinkFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicSinkFactory.java index faa8e342..bc107c1a 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicSinkFactory.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicSinkFactory.java @@ -41,15 +41,8 @@ public interface UebTopicSinkFactory { /** * Instantiates a new UEB Topic Writer. * - * servers list of servers - * topic topic name - * apiKey API Key - * apiSecret API Secret - * partitionKey Consumer Group - * managed is this sink endpoint managed? - * @param busTopicParams parameter object + * @param busTopicParams parameters object * @return an UEB Topic Sink - * @throws IllegalArgumentException if invalid parameters are present */ UebTopicSink build(BusTopicParams busTopicParams); @@ -189,14 +182,14 @@ class IndexedUebTopicSinkFactory implements UebTopicSinkFactory { continue; } - List serverList = new ArrayList<>(Arrays.asList(servers.split("\\s*,\\s*"))); + final List serverList = new ArrayList<>(Arrays.asList(servers.split("\\s*,\\s*"))); - String apiKey = properties.getProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + "." + topic - + PolicyEndPointProperties.PROPERTY_TOPIC_API_KEY_SUFFIX); - String apiSecret = properties.getProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + "." - + topic + PolicyEndPointProperties.PROPERTY_TOPIC_API_SECRET_SUFFIX); - String partitionKey = properties.getProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + "." - + topic + PolicyEndPointProperties.PROPERTY_TOPIC_SINK_PARTITION_KEY_SUFFIX); + final String apiKey = properties.getProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_API_KEY_SUFFIX); + final String apiSecret = properties.getProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_API_SECRET_SUFFIX); + final String partitionKey = properties.getProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_SINK_PARTITION_KEY_SUFFIX); String managedString = properties.getProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX); diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicSourceFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicSourceFactory.java index 1245127a..4f62ffa4 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicSourceFactory.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/UebTopicSourceFactory.java @@ -51,18 +51,8 @@ public interface UebTopicSourceFactory { /** * Instantiates a new UEB Topic Source. * - * servers list of servers - * topic topic name - * apiKey API Key - * apiSecret API Secret - * consumerGroup Consumer Group - * consumerInstance Consumer Instance - * fetchTimeout Read Fetch Timeout - * fetchLimit Fetch Limit - * managed is this source endpoint managed? * @param busTopicParams parameters object * @return an UEB Topic Source - * @throws IllegalArgumentException if invalid parameters are present */ UebTopicSource build(BusTopicParams busTopicParams); diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusConsumer.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusConsumer.java index 034ac66e..ecc90139 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusConsumer.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusConsumer.java @@ -429,6 +429,13 @@ public interface BusConsumer { private final Properties props; + /** + * Constructor. + * + * @param busTopicParams topic paramters + * + * @throws MalformedURLException must provide a valid URL + */ public DmaapDmeConsumerWrapper(BusTopicParams busTopicParams) throws MalformedURLException { diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java index 05e92638..2d1d8257 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusPublisher.java @@ -73,6 +73,11 @@ public interface BusPublisher { @JsonIgnore protected volatile CambriaBatchingPublisher publisher; + /** + * Constructor. + * + * @param busTopicParams topic parameters + */ public CambriaPublisherWrapper(BusTopicParams busTopicParams) { PublisherBuilder builder = new CambriaClientBuilders.PublisherBuilder(); @@ -292,6 +297,12 @@ public interface BusPublisher { } public static class DmaapDmePublisherWrapper extends DmaapPublisherWrapper { + + /** + * Constructor. + * + * @param busTopicParams topic parameters + */ public DmaapDmePublisherWrapper(BusTopicParams busTopicParams) { super(ProtocolTypeConstants.DME2, busTopicParams.getServers(),busTopicParams.getTopic(), diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBase.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBase.java index 3e112f90..3e4f48e7 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBase.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicBase.java @@ -20,8 +20,6 @@ package org.onap.policy.common.endpoints.event.comm.bus.internal; -import java.util.List; - import org.onap.policy.common.endpoints.event.comm.bus.ApiKeyEnabled; /** diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParams.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParams.java index 347ae42c..b133f1c7 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParams.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/BusTopicParams.java @@ -213,112 +213,113 @@ public class BusTopicParams { } public static class TopicParamsBuilder { - BusTopicParams m = new BusTopicParams(); + + BusTopicParams params = new BusTopicParams(); private TopicParamsBuilder() { } public TopicParamsBuilder servers(List servers) { - this.m.servers = servers; + this.params.servers = servers; return this; } public TopicParamsBuilder topic(String topic) { - this.m.topic = topic; + this.params.topic = topic; return this; } public TopicParamsBuilder apiKey(String apiKey) { - this.m.apiKey = apiKey; + this.params.apiKey = apiKey; return this; } public TopicParamsBuilder apiSecret(String apiSecret) { - this.m.apiSecret = apiSecret; + this.params.apiSecret = apiSecret; return this; } public TopicParamsBuilder consumerGroup(String consumerGroup) { - this.m.consumerGroup = consumerGroup; + this.params.consumerGroup = consumerGroup; return this; } public TopicParamsBuilder consumerInstance(String consumerInstance) { - this.m.consumerInstance = consumerInstance; + this.params.consumerInstance = consumerInstance; return this; } public TopicParamsBuilder fetchTimeout(int fetchTimeout) { - this.m.fetchTimeout = fetchTimeout; + this.params.fetchTimeout = fetchTimeout; return this; } public TopicParamsBuilder fetchLimit(int fetchLimit) { - this.m.fetchLimit = fetchLimit; + this.params.fetchLimit = fetchLimit; return this; } public TopicParamsBuilder useHttps(boolean useHttps) { - this.m.useHttps = useHttps; + this.params.useHttps = useHttps; return this; } public TopicParamsBuilder allowSelfSignedCerts(boolean allowSelfSignedCerts) { - this.m.allowSelfSignedCerts = allowSelfSignedCerts; + this.params.allowSelfSignedCerts = allowSelfSignedCerts; return this; } public TopicParamsBuilder userName(String userName) { - this.m.userName = userName; + this.params.userName = userName; return this; } public TopicParamsBuilder password(String password) { - this.m.password = password; + this.params.password = password; return this; } public TopicParamsBuilder environment(String environment) { - this.m.environment = environment; + this.params.environment = environment; return this; } public TopicParamsBuilder aftEnvironment(String aftEnvironment) { - this.m.aftEnvironment = aftEnvironment; + this.params.aftEnvironment = aftEnvironment; return this; } public TopicParamsBuilder partner(String partner) { - this.m.partner = partner; + this.params.partner = partner; return this; } public TopicParamsBuilder latitude(String latitude) { - this.m.latitude = latitude; + this.params.latitude = latitude; return this; } public TopicParamsBuilder longitude(String longitude) { - this.m.longitude = longitude; + this.params.longitude = longitude; return this; } public TopicParamsBuilder additionalProps(Map additionalProps) { - this.m.additionalProps = additionalProps; + this.params.additionalProps = additionalProps; return this; } public TopicParamsBuilder partitionId(String partitionId) { - this.m.partitionId = partitionId; + this.params.partitionId = partitionId; return this; } public BusTopicParams build() { - return m; + return params; } public TopicParamsBuilder managed(boolean managed) { - this.m.managed = managed; + this.params.managed = managed; return this; } } diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java index 5c18fb3f..eb431229 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java @@ -21,7 +21,6 @@ package org.onap.policy.common.endpoints.event.comm.bus.internal; -import java.util.List; import java.util.Map; import org.onap.policy.common.endpoints.event.comm.Topic; diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java index e4b335c3..f9dd4852 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java @@ -78,9 +78,11 @@ public abstract class SingleThreadedBusTopicSource extends BusTopicBase /** - * + * Constructor. * - * @param busTopicParams@throws IllegalArgumentException An invalid parameter passed in + * @param busTopicParams topic parameters + * + * @throws IllegalArgumentException An invalid parameter passed in */ public SingleThreadedBusTopicSource(BusTopicParams busTopicParams) { diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java index 0fcb86b4..45c0b6fc 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java @@ -51,8 +51,10 @@ public class SingleThreadedDmaapTopicSource extends SingleThreadedBusTopicSource /** + * Constructor. + * + * @param busTopicParams Parameters object containing all the required inputs * - * @param busTopicParams Parameters object containing all the required inputs * * @throws IllegalArgumentException An invalid parameter passed in */ public SingleThreadedDmaapTopicSource(BusTopicParams busTopicParams) { diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java index 0454e54b..1fc00bfe 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java @@ -61,7 +61,21 @@ public class JerseyClient implements HttpClient { protected boolean alive = true; - + /** + * Constructor. + * + * @param name the name + * @param https is it https or not + * @param selfSignedCerts are there self signed certs + * @param hostname the hostname + * @param port port being used + * @param basePath base context + * @param userName user + * @param password password + * + * @throws KeyManagementException key exception + * @throws NoSuchAlgorithmException no algorithm exception + */ public JerseyClient(String name, boolean https, boolean selfSignedCerts, String hostname, int port, String basePath, String userName, String password) throws KeyManagementException, NoSuchAlgorithmException { diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyJerseyServer.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyJerseyServer.java index 72013395..a97a9bf5 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyJerseyServer.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyJerseyServer.java @@ -20,15 +20,13 @@ package org.onap.policy.common.endpoints.http.server.internal; +import io.swagger.jersey.config.JerseyJaxrsConfig; import java.util.HashMap; - import org.eclipse.jetty.servlet.ServletHolder; import org.onap.policy.common.utils.network.NetworkUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.swagger.jersey.config.JerseyJaxrsConfig; - /** * REST Jetty Server that uses Jersey Servlets to support JAX-RS Web Services. */ diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java index b866a81e..7d37521e 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java @@ -127,8 +127,6 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable */ public JettyServletServer(String name, boolean https, String host, int port, String contextPath) { String srvName = name; - String srvHost = host; - String ctxtPath = contextPath; if (srvName == null || srvName.isEmpty()) { srvName = "http-" + port; @@ -138,10 +136,12 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable throw new IllegalArgumentException("Invalid Port provided: " + port); } + String srvHost = host; if (srvHost == null || srvHost.isEmpty()) { srvHost = "localhost"; } + String ctxtPath = contextPath; if (ctxtPath == null || ctxtPath.isEmpty()) { ctxtPath = "/"; } @@ -179,20 +179,25 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable } @Override - public void addFilterClass(String aFilterPath, String aFilterClass) { - if (aFilterClass == null || aFilterClass.isEmpty()) { + public void addFilterClass(String filterPath, String filterClass) { + if (filterClass == null || filterClass.isEmpty()) { throw new IllegalArgumentException("No filter class provided"); } - String filterPath = aFilterPath; - if (aFilterPath == null || aFilterPath.isEmpty()) { - filterPath = "/*"; + String tempFilterPath = filterPath; + if (filterPath == null || filterPath.isEmpty()) { + tempFilterPath = "/*"; } - context.addFilter(aFilterClass, filterPath, + context.addFilter(filterClass, tempFilterPath, EnumSet.of(DispatcherType.INCLUDE, DispatcherType.REQUEST)); } + /** + * Returns the https connector. + * + * @return + */ public ServerConnector httpsConnector() { SslContextFactory sslContextFactory = new SslContextFactory(); diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java index 6ec9bc21..4ffa4273 100644 --- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java +++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java @@ -45,6 +45,12 @@ public class HttpClientTest { private static final HashMap savedValuesMap = new HashMap<>(); + /** + * Setup before class method. + * + * @throws InterruptedException can be interrupted + * @throws IOException can have an IO exception + */ @BeforeClass public static void setUp() throws InterruptedException, IOException { logger.info("-- setup() --"); @@ -65,9 +71,11 @@ public class HttpClientTest { savedValuesMap.put(JettyJerseyServer.SYSTEM_KEYSTORE_PROPERTY_NAME, keyStoreSystemProperty); } - String keyStorePasswordSystemProperty = System.getProperty(JettyJerseyServer.SYSTEM_KEYSTORE_PASSWORD_PROPERTY_NAME); + String keyStorePasswordSystemProperty = + System.getProperty(JettyJerseyServer.SYSTEM_KEYSTORE_PASSWORD_PROPERTY_NAME); if (keyStorePasswordSystemProperty != null) { - savedValuesMap.put(JettyJerseyServer.SYSTEM_KEYSTORE_PASSWORD_PROPERTY_NAME, keyStorePasswordSystemProperty); + savedValuesMap.put( + JettyJerseyServer.SYSTEM_KEYSTORE_PASSWORD_PROPERTY_NAME, keyStorePasswordSystemProperty); } String trustStoreSystemProperty = System.getProperty(JettyJerseyServer.SYSTEM_TRUSTSTORE_PROPERTY_NAME); @@ -76,7 +84,8 @@ public class HttpClientTest { .put(JettyJerseyServer.SYSTEM_TRUSTSTORE_PROPERTY_NAME, trustStoreSystemProperty); } - String trustStorePasswordSystemProperty = System.getProperty(JettyJerseyServer.SYSTEM_TRUSTSTORE_PASSWORD_PROPERTY_NAME); + String trustStorePasswordSystemProperty = + System.getProperty(JettyJerseyServer.SYSTEM_TRUSTSTORE_PASSWORD_PROPERTY_NAME); if (trustStorePasswordSystemProperty != null) { savedValuesMap .put(JettyJerseyServer.SYSTEM_TRUSTSTORE_PASSWORD_PROPERTY_NAME, trustStorePasswordSystemProperty); @@ -101,6 +110,10 @@ public class HttpClientTest { } } + /** + * After the class is created method. + * + */ @AfterClass public static void tearDown() { logger.info("-- tearDown() --"); @@ -109,28 +122,32 @@ public class HttpClientTest { HttpClient.factory.destroy(); if (savedValuesMap.containsKey(JettyJerseyServer.SYSTEM_KEYSTORE_PROPERTY_NAME)) { - System.setProperty(JettyJerseyServer.SYSTEM_KEYSTORE_PROPERTY_NAME, savedValuesMap.get(JettyJerseyServer.SYSTEM_KEYSTORE_PROPERTY_NAME)); + System.setProperty(JettyJerseyServer.SYSTEM_KEYSTORE_PROPERTY_NAME, + savedValuesMap.get(JettyJerseyServer.SYSTEM_KEYSTORE_PROPERTY_NAME)); savedValuesMap.remove(JettyJerseyServer.SYSTEM_KEYSTORE_PROPERTY_NAME); } else { System.clearProperty(JettyJerseyServer.SYSTEM_KEYSTORE_PROPERTY_NAME); } if (savedValuesMap.containsKey(JettyJerseyServer.SYSTEM_KEYSTORE_PASSWORD_PROPERTY_NAME)) { - System.setProperty(JettyJerseyServer.SYSTEM_KEYSTORE_PASSWORD_PROPERTY_NAME, savedValuesMap.get(JettyJerseyServer.SYSTEM_KEYSTORE_PASSWORD_PROPERTY_NAME)); + System.setProperty(JettyJerseyServer.SYSTEM_KEYSTORE_PASSWORD_PROPERTY_NAME, + savedValuesMap.get(JettyJerseyServer.SYSTEM_KEYSTORE_PASSWORD_PROPERTY_NAME)); savedValuesMap.remove(JettyJerseyServer.SYSTEM_KEYSTORE_PASSWORD_PROPERTY_NAME); } else { System.clearProperty(JettyJerseyServer.SYSTEM_KEYSTORE_PASSWORD_PROPERTY_NAME); } if (savedValuesMap.containsKey(JettyJerseyServer.SYSTEM_TRUSTSTORE_PROPERTY_NAME)) { - System.setProperty(JettyJerseyServer.SYSTEM_TRUSTSTORE_PROPERTY_NAME, savedValuesMap.get(JettyJerseyServer.SYSTEM_TRUSTSTORE_PROPERTY_NAME)); + System.setProperty(JettyJerseyServer.SYSTEM_TRUSTSTORE_PROPERTY_NAME, + savedValuesMap.get(JettyJerseyServer.SYSTEM_TRUSTSTORE_PROPERTY_NAME)); savedValuesMap.remove(JettyJerseyServer.SYSTEM_TRUSTSTORE_PROPERTY_NAME); } else { System.clearProperty(JettyJerseyServer.SYSTEM_TRUSTSTORE_PROPERTY_NAME); } if (savedValuesMap.containsKey(JettyJerseyServer.SYSTEM_TRUSTSTORE_PASSWORD_PROPERTY_NAME)) { - System.setProperty(JettyJerseyServer.SYSTEM_TRUSTSTORE_PASSWORD_PROPERTY_NAME, savedValuesMap.get(JettyJerseyServer.SYSTEM_TRUSTSTORE_PASSWORD_PROPERTY_NAME)); + System.setProperty(JettyJerseyServer.SYSTEM_TRUSTSTORE_PASSWORD_PROPERTY_NAME, + savedValuesMap.get(JettyJerseyServer.SYSTEM_TRUSTSTORE_PASSWORD_PROPERTY_NAME)); savedValuesMap.remove(JettyJerseyServer.SYSTEM_TRUSTSTORE_PASSWORD_PROPERTY_NAME); } else { System.clearProperty(JettyJerseyServer.SYSTEM_TRUSTSTORE_PASSWORD_PROPERTY_NAME); diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java index 6dbe8a7e..4552109d 100644 --- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java +++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java @@ -184,9 +184,9 @@ public class HttpServerTest { * @throws IOException thrown is IO exception occurs * @throws InterruptedException thrown if thread interrupted occurs */ - protected String http(HttpServletServer server, String aUrl) + protected String http(HttpServletServer server, String urlString) throws MalformedURLException, IOException, InterruptedException { - URL url = new URL(aUrl); + URL url = new URL(urlString); String response = null; int numRetries = 1; int maxNumberRetries = 5; @@ -195,7 +195,7 @@ public class HttpServerTest { response = response(url); break; } catch (ConnectException e) { - logger.warn("http server {} @ {} ({}) - cannot connect yet ..", server, aUrl, numRetries, e); + logger.warn("http server {} @ {} ({}) - cannot connect yet ..", server, urlString, numRetries, e); numRetries++; Thread.sleep(10000L); } catch (Exception e) { diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEchoService.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEchoService.java index 139d1842..fdb8770c 100644 --- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEchoService.java +++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEchoService.java @@ -20,27 +20,26 @@ package org.onap.policy.common.endpoints.http.server.test; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; - -@Api(value="echo") +@Api(value = "echo") @Path("/junit/echo") public class RestEchoService { - + @GET @Path("{word}") @Produces(MediaType.TEXT_PLAIN) @ApiOperation( - value="echoes back whatever received" - ) + value = "echoes back whatever received" + ) public String echo(@PathParam("word") String word) { - return word; + return word; } } diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEndpoints.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEndpoints.java index 9800a9d4..fe199645 100644 --- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEndpoints.java +++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEndpoints.java @@ -32,13 +32,18 @@ import org.onap.policy.common.endpoints.http.server.HttpServletServer; @Path("/junit/endpoints") public class RestEndpoints { + /** + * Returns the http servers. + * + * @return the list of servers as a string + */ @GET @Path("http/servers") @Produces(MediaType.TEXT_PLAIN) public String httpServers() { - List servers = - HttpServletServer.factory.inventory(); - return servers.toString(); + List servers = + HttpServletServer.factory.inventory(); + return servers.toString(); } diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestMockHealthCheck.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestMockHealthCheck.java index 573a4498..f0d68c0c 100644 --- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestMockHealthCheck.java +++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestMockHealthCheck.java @@ -29,19 +29,19 @@ import javax.ws.rs.core.Response.Status; @Path("/") public class RestMockHealthCheck { - + @GET @Path("pap/test") @Produces(MediaType.APPLICATION_JSON) public Response papHealthCheck() { - return Response.status(Status.OK).entity("All Alive").build(); + return Response.status(Status.OK).entity("All Alive").build(); } @GET @Path("pdp/test") @Produces(MediaType.APPLICATION_JSON) public Response pdpHealthCheck() { - return Response.status(Status.INTERNAL_SERVER_ERROR).entity("At least some Dead").build(); + return Response.status(Status.INTERNAL_SERVER_ERROR).entity("At least some Dead").build(); } diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/TestFilter.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/TestFilter.java index 5de96930..44b37656 100644 --- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/TestFilter.java +++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/TestFilter.java @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.common.endpoints.http.server.test; import java.io.IOException; -- cgit 1.2.3-korg