summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-08-27 15:24:06 -0400
committerJim Hahn <jrh3@att.com>2021-08-27 16:08:00 -0400
commitf4580fa8a931c84b36d59e2ef853d1fba3d5917e (patch)
tree0c6a047fadfa26898af614460ac8699f2aa4a4ab /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src
parent9d8894092ced589c0bdc5b9e85ee1bf1c85d3e36 (diff)
Fix sonars in apex-pdp #2
plugins-events thru plugins-persistence-jpa-eclipselink Fixed: - use "var" - disambiguate method parameter types - rename parameter Issue-ID: POLICY-3093 Change-Id: Ife5897015be495403e731754d5862b803a217c87 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src')
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java16
1 files changed, 7 insertions, 9 deletions
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 c0a43a387..952ebd793 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
@@ -30,13 +30,11 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
-import java.util.Properties;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
-import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
@@ -154,7 +152,7 @@ public class ApexRestRequestorConsumer extends ApexPluginsEventConsumer {
// Check if HTTP headers has been set
if (restConsumerProperties.checkHttpHeadersSet()) {
- final String httpHeaderString = Arrays.deepToString(restConsumerProperties.getHttpHeaders());
+ final var httpHeaderString = Arrays.deepToString(restConsumerProperties.getHttpHeaders());
LOGGER.debug("REST Requestor consumer has http headers ({}): {}", this.name, httpHeaderString);
}
@@ -201,11 +199,11 @@ public class ApexRestRequestorConsumer extends ApexPluginsEventConsumer {
// Create a thread to process the REST request and place it on the map of ongoing
// requests
- final RestRequestRunner restRequestRunner = new RestRequestRunner(restRequest);
+ final var restRequestRunner = new RestRequestRunner(restRequest);
ongoingRestRequestMap.put(restRequest, restRequestRunner);
// Start execution of the request
- final Thread restRequestRunnerThread = new Thread(restRequestRunner);
+ final var restRequestRunnerThread = new Thread(restRequestRunner);
restRequestRunnerThread.setName("RestRequestRunner_" + nextRequestRunnerThreadNo);
restRequestRunnerThread.start();
} catch (final InterruptedException e) {
@@ -284,7 +282,7 @@ public class ApexRestRequestorConsumer extends ApexPluginsEventConsumer {
public void run() {
// Get the thread for the request
restRequestThread = Thread.currentThread();
- Properties inputExecutionProperties = request.getExecutionProperties();
+ var inputExecutionProperties = request.getExecutionProperties();
String url = restConsumerProperties.getUrl();
Set<String> names = restConsumerProperties.getKeysFromUrl();
if (!names.isEmpty() && inputExecutionProperties != null) {
@@ -305,12 +303,12 @@ public class ApexRestRequestorConsumer extends ApexPluginsEventConsumer {
NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, url, request.getEvent().toString());
}
// Execute the REST request
- final Response response = sendEventAsRestRequest(url);
+ final var response = sendEventAsRestRequest(url);
// Get the event we received
- final String eventJsonString = response.readEntity(String.class);
+ final var eventJsonString = response.readEntity(String.class);
NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, url, eventJsonString);
// Match the return code
- Matcher isPass = httpCodeFilterPattern.matcher(String.valueOf(response.getStatus()));
+ var isPass = httpCodeFilterPattern.matcher(String.valueOf(response.getStatus()));
// Check that the request worked
if (!isPass.matches()) {