summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event/plugins-event-carrier
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
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')
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java7
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/GrpcCarrierTechnologyParameters.java3
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java17
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java2
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java2
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java13
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParameters.java18
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java8
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java2
-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
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java3
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducer.java2
12 files changed, 44 insertions, 49 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java
index ce00210e8..fcb743df8 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducer.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
* Modifications Copyright (C) 2020-2021 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,13 +25,11 @@ package org.onap.policy.apex.plugins.event.carrier.grpc;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.util.JsonFormat;
import java.util.Properties;
-import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType;
import org.onap.ccsdk.cds.controllerblueprints.common.api.Status;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
-import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput.Builder;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput;
import org.onap.policy.apex.service.engine.event.ApexEventConsumer;
import org.onap.policy.apex.service.engine.event.ApexEventException;
@@ -100,7 +99,7 @@ public class ApexGrpcProducer extends ApexPluginsEventProducer implements CdsPro
final Object event) {
ExecutionServiceInput executionServiceInput;
- Builder builder = ExecutionServiceInput.newBuilder();
+ var builder = ExecutionServiceInput.newBuilder();
try {
JsonFormat.parser().ignoringUnknownFields().merge((String) event, builder);
executionServiceInput = builder.build();
@@ -109,7 +108,7 @@ public class ApexGrpcProducer extends ApexPluginsEventProducer implements CdsPro
"Incoming Event cannot be converted to ExecutionServiceInput type for gRPC request." + e.getMessage());
}
try {
- CountDownLatch countDownLatch = client.sendRequest(executionServiceInput);
+ var countDownLatch = client.sendRequest(executionServiceInput);
if (!countDownLatch.await(props.getTimeout(), TimeUnit.SECONDS)) {
cdsResponse.set(ExecutionServiceOutput.newBuilder().setStatus(Status.newBuilder()
.setErrorMessage(CdsActorConstants.TIMED_OUT).setEventType(EventType.EVENT_COMPONENT_FAILURE))
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/GrpcCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/GrpcCarrierTechnologyParameters.java
index f13248ec5..79a28c6cf 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/GrpcCarrierTechnologyParameters.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/main/java/org/onap/policy/apex/plugins/event/carrier/grpc/GrpcCarrierTechnologyParameters.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -84,7 +85,7 @@ public class GrpcCarrierTechnologyParameters extends CarrierTechnologyParameters
* @throws ApexEventException exception thrown when invalid parameters are provided
*/
public void validateGrpcParameters(boolean isProducer) throws ApexEventException {
- StringBuilder errorMessage = new StringBuilder();
+ var errorMessage = new StringBuilder();
if (isProducer) {
if (timeout < 1) {
errorMessage.append("timeout should have a positive value.\n");
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java
index 4bad4cb7a..2bca82eb6 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +26,6 @@ import java.util.Properties;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Message;
-import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.Session;
import javax.jms.Topic;
@@ -141,11 +141,11 @@ public class ApexJmsConsumer extends ApexPluginsEventConsumer implements Message
@Override
public void run() {
// JMS session and message consumer for receiving messages
- try (final Session jmsSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE)) {
+ try (final var jmsSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE)) {
// Create a message consumer for reception of messages and set this class as a message listener
createMessageConsumer(jmsSession);
} catch (final Exception exc) {
- final String errorMessage = "failed to create a JMS session towards the JMS server for receiving messages";
+ final var errorMessage = "failed to create a JMS session towards the JMS server for receiving messages";
throw new ApexEventRuntimeException(errorMessage, exc);
}
// Everything is now set up
@@ -161,7 +161,7 @@ public class ApexJmsConsumer extends ApexPluginsEventConsumer implements Message
* @param jmsSession a JMS session
*/
private void createMessageConsumer(final Session jmsSession) {
- try (final MessageConsumer messageConsumer = jmsSession.createConsumer(jmsIncomingTopic)) {
+ try (final var messageConsumer = jmsSession.createConsumer(jmsIncomingTopic)) {
messageConsumer.setMessageListener(this);
// The endless loop that receives events over JMS
@@ -169,8 +169,7 @@ public class ApexJmsConsumer extends ApexPluginsEventConsumer implements Message
ThreadUtilities.sleep(jmsConsumerProperties.getConsumerWaitTime());
}
} catch (final Exception exc) {
- final String errorMessage = "failed to create a JMS message consumer for receiving messages";
- throw new ApexEventRuntimeException(errorMessage, exc);
+ throw new ApexEventRuntimeException("failed to create a JMS message consumer for receiving messages", exc);
}
}
@@ -188,8 +187,7 @@ public class ApexJmsConsumer extends ApexPluginsEventConsumer implements Message
eventReceiver.receiveEvent(new Properties(), jmsMessage);
} catch (final Exception e) {
- final String errorMessage = "failed to receive message from JMS";
- throw new ApexEventRuntimeException(errorMessage, e);
+ throw new ApexEventRuntimeException("failed to receive message from JMS", e);
}
}
@@ -210,8 +208,7 @@ public class ApexJmsConsumer extends ApexPluginsEventConsumer implements Message
connection.close();
}
} catch (final Exception e) {
- final String errorMessage = "close of connection to the JMS server failed";
- LOGGER.warn(errorMessage, e);
+ LOGGER.warn("close of connection to the JMS server failed", e);
}
}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java
index 42bde24ca..21309396a 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java
@@ -197,7 +197,7 @@ public class ApexJmsProducer implements ApexEventProducer {
public void sendEvent(final long executionId, final Properties executionProperties, final String eventname,
final Object eventObject) {
// Check if this is a synchronized event, if so we have received a reply
- final SynchronousEventCache synchronousEventCache = (SynchronousEventCache) peerReferenceMap
+ final var synchronousEventCache = (SynchronousEventCache) peerReferenceMap
.get(EventHandlerPeeredMode.SYNCHRONOUS);
if (synchronousEventCache != null) {
synchronousEventCache.removeCachedEventToApexIfExists(executionId);
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java
index 3e2f239df..42ff67df1 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java
@@ -159,7 +159,7 @@ public class JmsCarrierTechnologyParameters extends CarrierTechnologyParameters
* @return the jms consumer properties
*/
private Properties getJmsProperties() {
- final Properties jmsProperties = new Properties();
+ final var jmsProperties = new Properties();
jmsProperties.put(PROPERTY_INITIAL_CONTEXT_FACTORY, initialContextFactory);
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java
index 2957a1a11..95379d457 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java
@@ -3,6 +3,7 @@
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -87,9 +88,9 @@ public class ApexKafkaConsumer extends ApexPluginsEventConsumer {
try {
final ConsumerRecords<String, String> records =
kafkaConsumer.poll(kafkaConsumerProperties.getConsumerPollDuration());
- for (final ConsumerRecord<String, String> record : records) {
- traceIfTraceEnabled(record);
- eventReceiver.receiveEvent(new Properties(), record.value());
+ for (final ConsumerRecord<String, String> dataRecord : records) {
+ traceIfTraceEnabled(dataRecord);
+ eventReceiver.receiveEvent(new Properties(), dataRecord.value());
}
} catch (final Exception e) {
LOGGER.debug("error receiving events on thread {}", consumerThread.getName(), e);
@@ -101,12 +102,12 @@ public class ApexKafkaConsumer extends ApexPluginsEventConsumer {
/**
* Trace a record if trace is enabled.
*
- * @param record the record to trace
+ * @param dataRecord the record to trace
*/
- private void traceIfTraceEnabled(final ConsumerRecord<String, String> record) {
+ private void traceIfTraceEnabled(final ConsumerRecord<String, String> dataRecord) {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("event received for {} for forwarding to Apex engine : {} {}",
- this.getClass().getName() + ":" + this.name, record.key(), record.value());
+ this.getClass().getName() + ":" + this.name, dataRecord.key(), dataRecord.value());
}
}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParameters.java
index 475017283..a599307ff 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParameters.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParameters.java
@@ -158,11 +158,11 @@ public class KafkaCarrierTechnologyParameters extends CarrierTechnologyParameter
* @return the kafka producer properties
*/
public Properties getKafkaProducerProperties() {
- final Properties retKafkaProps = new Properties();
+ final var retKafkaProps = new Properties();
// Add properties from the Kafka property array
if (kafkaProperties != null) {
- for (int i = 0; i < kafkaProperties.length; i++) {
+ for (var i = 0; i < kafkaProperties.length; i++) {
retKafkaProps.setProperty(kafkaProperties[i][0], kafkaProperties[i][1]);
}
}
@@ -188,11 +188,11 @@ public class KafkaCarrierTechnologyParameters extends CarrierTechnologyParameter
* @return the kafka consumer properties
*/
public Properties getKafkaConsumerProperties() {
- final Properties retKafkaProps = new Properties();
+ final var retKafkaProps = new Properties();
// Add properties from the Kafka property array
if (kafkaProperties != null) {
- for (int i = 0; i < kafkaProperties.length; i++) {
+ for (var i = 0; i < kafkaProperties.length; i++) {
retKafkaProps.setProperty(kafkaProperties[i][0], kafkaProperties[i][1]);
}
}
@@ -250,8 +250,8 @@ public class KafkaCarrierTechnologyParameters extends CarrierTechnologyParameter
"not specified, must be specified as a list of strings");
}
- BeanValidationResult result = new BeanValidationResult("consumerTopicList", consumerTopicList);
- int item = 0;
+ var result = new BeanValidationResult("consumerTopicList", consumerTopicList);
+ var item = 0;
for (final String consumerTopic : consumerTopicList) {
if (StringUtils.isBlank(consumerTopic)) {
result.addResult(ENTRY + item, consumerTopic, ValidationStatus.INVALID, Validated.IS_BLANK);
@@ -272,13 +272,13 @@ public class KafkaCarrierTechnologyParameters extends CarrierTechnologyParameter
return null;
}
- BeanValidationResult result = new BeanValidationResult(KAFKA_PROPERTIES, kafkaProperties);
+ var result = new BeanValidationResult(KAFKA_PROPERTIES, kafkaProperties);
- for (int i = 0; i < kafkaProperties.length; i++) {
+ for (var i = 0; i < kafkaProperties.length; i++) {
final String label = ENTRY + i;
final String[] kafkaProperty = kafkaProperties[i];
final List<String> value = (kafkaProperty == null ? null : Arrays.asList(kafkaProperty));
- final BeanValidationResult result2 = new BeanValidationResult(label, value);
+ final var result2 = new BeanValidationResult(label, value);
if (kafkaProperty == null) {
// note: add to result, not result2
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 db14006eb..956345cd4 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
@@ -24,11 +24,9 @@
package org.onap.policy.apex.plugins.event.carrier.restclient;
import java.util.Properties;
-import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.core.Response;
import lombok.AccessLevel;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
@@ -148,11 +146,11 @@ public class ApexRestClientConsumer extends ApexPluginsEventConsumer {
@Override
public void run() {
try {
- final Response response = client.target(restConsumerProperties.getUrl()).request("application/json")
+ final var response = client.target(restConsumerProperties.getUrl()).request("application/json")
.headers(restConsumerProperties.getHttpHeadersAsMultivaluedMap()).get();
// Match the return code
- Matcher isPass = httpCodeFilterPattern.matcher(String.valueOf(response.getStatus()));
+ var isPass = httpCodeFilterPattern.matcher(String.valueOf(response.getStatus()));
// Check that status code
if (!isPass.matches()) {
@@ -164,7 +162,7 @@ public class ApexRestClientConsumer extends ApexPluginsEventConsumer {
}
// Get the event we received
- final String eventJsonString = response.readEntity(String.class);
+ final var eventJsonString = response.readEntity(String.class);
// Check there is content
if (StringUtils.isBlank(eventJsonString)) {
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 cb6b55371..035bd6524 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
@@ -124,7 +124,7 @@ public class ApexRestClientProducer extends ApexPluginsEventProducer {
NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, untaggedUrl, event.toString());
// Send the event as a REST request
- final Response response = sendEventAsRestRequest(untaggedUrl, (String) event);
+ final var response = sendEventAsRestRequest(untaggedUrl, (String) event);
NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, untaggedUrl, response.readEntity(String.class));
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()) {
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java
index 3bfde18e3..ad3d77bf1 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -171,7 +172,7 @@ public class ApexRestServerConsumer extends ApexPluginsEventConsumer {
.entity("{'errorMessage', '" + errorMessage + ", " + e.getMessage() + "'}").build();
}
- final SynchronousEventCache synchronousEventCache =
+ final var synchronousEventCache =
(SynchronousEventCache) peerReferenceMap.get(EventHandlerPeeredMode.SYNCHRONOUS);
// Wait until the event is in the cache of events sent to apex
do {
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducer.java
index 03913e081..f3579565a 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerProducer.java
@@ -118,7 +118,7 @@ public class ApexRestServerProducer implements ApexEventProducer {
}
// If we are not synchronized, then exit
- final SynchronousEventCache synchronousEventCache =
+ final var synchronousEventCache =
(SynchronousEventCache) peerReferenceMap.get(EventHandlerPeeredMode.SYNCHRONOUS);
if (synchronousEventCache == null) {
return;