diff options
author | liamfallon <liam.fallon@est.tech> | 2021-06-16 12:08:01 +0100 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2021-06-17 15:51:34 +0100 |
commit | 2d186df9e3ed47599dbc86c2f435f7884535398c (patch) | |
tree | d77b85e48927ad072248e784c7b99b12205f4e0b /participant/participant-impl/participant-impl-dcae/src | |
parent | 17f5d3c97e47064407452122bc6cb801e43df5f9 (diff) |
Clean up CLAMP Sonar and checkstyle issues
This commit cleans up sonar and checkstyle issues identified in the
CLAMP repository.
Issue-ID: POLICY-3206
Change-Id: I16b61bbe771cc17de15183a24b2a5e82a8d35872
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'participant/participant-impl/participant-impl-dcae/src')
6 files changed, 28 insertions, 8 deletions
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/DcaeParticipantApplication.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/DcaeParticipantApplication.java index 25edaf552..9be83bbd3 100644 --- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/DcaeParticipantApplication.java +++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/DcaeParticipantApplication.java @@ -30,8 +30,10 @@ import org.springframework.context.annotation.ComponentScan; *
*/
@SpringBootApplication
-@ComponentScan({"org.onap.policy.clamp.controlloop.participant.dcae",
- "org.onap.policy.clamp.controlloop.participant.intermediary"})
+@ComponentScan({
+ "org.onap.policy.clamp.controlloop.participant.dcae",
+ "org.onap.policy.clamp.controlloop.participant.intermediary"
+})
@ConfigurationPropertiesScan("org.onap.policy.clamp.controlloop.participant.dcae.main.parameters")
public class DcaeParticipantApplication {
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java index e23aaaf23..43326e725 100644 --- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java +++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java @@ -24,7 +24,6 @@ import java.io.Closeable; import java.io.IOException; import java.util.Collections; import javax.ws.rs.client.Entity; -import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException; import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop; @@ -46,6 +45,9 @@ public abstract class AbstractHttpClient implements Closeable { /** * Constructor. + * + * @param restClientParameters the REST client parameters + * @throws ControlLoopRuntimeException on errors */ protected AbstractHttpClient(BusTopicParams restClientParameters) { try { @@ -58,7 +60,7 @@ public abstract class AbstractHttpClient implements Closeable { protected boolean executePut(String path, String jsonEntity, int statusCode) { try { - Response response = httpclient.put(path, Entity.json(jsonEntity), Collections.emptyMap()); + var response = httpclient.put(path, Entity.json(jsonEntity), Collections.emptyMap()); return response.getStatus() == statusCode; } catch (Exception e) { LOGGER.error(MSG_REQUEST_FAILED, httpclient.getName(), e); @@ -68,7 +70,7 @@ public abstract class AbstractHttpClient implements Closeable { protected boolean executePut(String path, int statusCode) { try { - Response response = httpclient.put(path, Entity.json(""), Collections.emptyMap()); + var response = httpclient.put(path, Entity.json(""), Collections.emptyMap()); return response.getStatus() == statusCode; } catch (Exception e) { LOGGER.error(MSG_REQUEST_FAILED, httpclient.getName(), e); @@ -78,7 +80,7 @@ public abstract class AbstractHttpClient implements Closeable { protected Loop executePost(String path, int statusCode) { try { - Response response = httpclient.post(path, Entity.json(""), Collections.emptyMap()); + var response = httpclient.post(path, Entity.json(""), Collections.emptyMap()); if (response.getStatus() != statusCode) { return null; } @@ -91,7 +93,7 @@ public abstract class AbstractHttpClient implements Closeable { protected Loop executeGet(String path, int statusCode) { try { - Response response = httpclient.get(path); + var response = httpclient.get(path); if (response.getStatus() != statusCode) { return null; diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java index e928c138f..fd19d9d3a 100644 --- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java +++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java @@ -40,6 +40,8 @@ public class ClampHttpClient extends AbstractHttpClient { /** * Constructor. + * + * @param parameters the DCAE parameters */ public ClampHttpClient(ParticipantDcaeParameters parameters) { super(parameters.getClampClientParameters()); diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java index 4f76e3025..154dd09be 100644 --- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java +++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java @@ -31,6 +31,8 @@ public class ConsulDcaeHttpClient extends AbstractHttpClient { /** * Constructor. + * + * @param parameters the DCAE parameters */ public ConsulDcaeHttpClient(ParticipantDcaeParameters parameters) { super(parameters.getConsulClientParameters()); @@ -39,6 +41,7 @@ public class ConsulDcaeHttpClient extends AbstractHttpClient { /** * Call consult. * + * @param name the name to deploy * @param jsonEntity the Entity * @return true */ diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java index 76ed1122c..6c5ff1d78 100644 --- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java +++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java @@ -74,6 +74,9 @@ public class ControlLoopElementHandler implements ControlLoopElementListener { /** * Constructor. + * + * @param clampClient the CLAMP client + * @param consulClient the Consul client */ public ControlLoopElementHandler(ClampHttpClient clampClient, ConsulDcaeHttpClient consulClient) { this.clampClient = clampClient; diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java index cb06fcb15..5d8881eb3 100644 --- a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java +++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java @@ -59,16 +59,19 @@ public class CommonTestData { /** * Converts the contents of a map to a parameter class. * + * @param <T> specific type of ParameterGroup class * @param source property map * @param clazz class of object to be created from the map * @return a new object represented by the map + * @throws ControlLoopRuntimeException on errors */ public <T extends ParameterGroup> T toObject(final Map<String, Object> source, final Class<T> clazz) { try { return coder.convert(source, clazz); } catch (final CoderException e) { - throw new RuntimeException("cannot create " + clazz.getName() + " from map", e); + throw new ControlLoopRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, + "cannot create " + clazz.getName() + " from map", e); } } @@ -95,6 +98,7 @@ public class CommonTestData { * * @param isEmpty boolean value to represent that object created should be empty or not * @return a property map suitable for constructing an object + * @throws ControlLoopRuntimeException on errors */ public Map<String, Object> getClampClientParametersMap(final boolean isEmpty) { final Map<String, Object> map = new TreeMap<>(); @@ -121,6 +125,7 @@ public class CommonTestData { * * @param isEmpty boolean value to represent that object created should be empty or not * @return a property map suitable for constructing an object + * @throws ControlLoopRuntimeException on errors */ public Map<String, Object> getConsulClientParametersMap(final boolean isEmpty) { final Map<String, Object> map = new TreeMap<>(); @@ -228,6 +233,7 @@ public class CommonTestData { * * @param port port to be inserted into the parameters * @return the standard participant parameters + * @throws ControlLoopRuntimeException on errors */ public ParticipantDcaeParameters getParticipantParameterGroup(int port) { try { @@ -244,6 +250,7 @@ public class CommonTestData { * * @param port port to be inserted into the parameters * @return the standard participant parameters + * @throws ControlLoopRuntimeException on errors */ public static String getParticipantParameterGroupAsString(int port) { @@ -289,6 +296,7 @@ public class CommonTestData { * * @param status the status of Partecipant * @return the JSON + * @throws ControlLoopRuntimeException on errors */ public static String createJsonStatus(String status) { try { |