aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-08-30 15:03:16 +0000
committerGerrit Code Review <gerrit@onap.org>2021-08-30 15:03:16 +0000
commit795bd98b7459fd677e06354ea054c8922821522b (patch)
tree298ea6055dbd772cc44530ec7bfe0cbd27c96fd8
parent543c92e84894e200f88927d2d065795486b85165 (diff)
parentf4580fa8a931c84b36d59e2ef853d1fba3d5917e (diff)
Merge "Fix sonars in apex-pdp #2"
-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
-rw-r--r--plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java2
-rw-r--r--plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/Apex2XmlEventConverter.java17
-rw-r--r--plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java8
-rw-r--r--plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java8
-rw-r--r--plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java8
-rw-r--r--plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptExecutor.java5
-rw-r--r--plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutorTest.java6
-rw-r--r--plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java3
-rw-r--r--plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java3
-rw-r--r--plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java3
-rw-r--r--plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java3
-rw-r--r--plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java3
-rw-r--r--plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java3
25 files changed, 83 insertions, 82 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;
diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java
index 7f33fe6a7..cd14f4a3b 100644
--- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java
+++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/src/main/java/org/onap/policy/apex/plugins/event/protocol/jms/Apex2JmsObjectEventConverter.java
@@ -100,7 +100,7 @@ public final class Apex2JmsObjectEventConverter implements ApexEventProtocolConv
// Create the Apex event
// @formatter:off
- final ApexEvent apexEvent = new ApexEvent(
+ final var apexEvent = new ApexEvent(
jmsIncomingObject.getClass().getSimpleName() + eventProtocolParameters.getIncomingEventSuffix(),
eventProtocolParameters.getIncomingEventVersion(),
jmsIncomingObject.toString().getClass().getPackage().getName(),
diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/Apex2XmlEventConverter.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/Apex2XmlEventConverter.java
index af4b7815a..f601c4b6f 100644
--- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/Apex2XmlEventConverter.java
+++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/Apex2XmlEventConverter.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* 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.
@@ -23,7 +24,6 @@ package org.onap.policy.apex.plugins.event.protocol.xml;
import java.io.ByteArrayInputStream;
import java.io.StringWriter;
-import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
@@ -34,7 +34,6 @@ import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.transform.stream.StreamSource;
-import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.onap.policy.apex.plugins.event.protocol.xml.jaxb.ObjectFactory;
import org.onap.policy.apex.plugins.event.protocol.xml.jaxb.XMLApexEvent;
@@ -69,11 +68,11 @@ public final class Apex2XmlEventConverter implements ApexEventProtocolConverter
*/
public Apex2XmlEventConverter() throws ApexEventException {
try {
- final URL schemaUrl = ResourceUtils.getUrlResource(MODEL_SCHEMA_NAME);
- final Schema apexEventSchema =
+ final var schemaUrl = ResourceUtils.getUrlResource(MODEL_SCHEMA_NAME);
+ final var apexEventSchema =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(schemaUrl);
- final JAXBContext jaxbContext = JAXBContext.newInstance(XMLApexEvent.class);
+ final var jaxbContext = JAXBContext.newInstance(XMLApexEvent.class);
// Set up the unmarshaller to carry out validation
unmarshaller = jaxbContext.createUnmarshaller();
@@ -121,7 +120,7 @@ public final class Apex2XmlEventConverter implements ApexEventProtocolConverter
// Use JAXB to read and verify the event from the XML string
try {
- final StreamSource source = new StreamSource(new ByteArrayInputStream(xmlEventString.getBytes()));
+ final var source = new StreamSource(new ByteArrayInputStream(xmlEventString.getBytes()));
final JAXBElement<XMLApexEvent> rootElement = unmarshaller.unmarshal(source, XMLApexEvent.class);
xmlApexEvent = rootElement.getValue();
} catch (final JAXBException e) {
@@ -129,7 +128,7 @@ public final class Apex2XmlEventConverter implements ApexEventProtocolConverter
}
// Create the Apex event
- final ApexEvent apexEvent = new ApexEvent(xmlApexEvent.getName(), xmlApexEvent.getVersion(),
+ final var apexEvent = new ApexEvent(xmlApexEvent.getName(), xmlApexEvent.getVersion(),
xmlApexEvent.getNameSpace(), xmlApexEvent.getSource(), xmlApexEvent.getTarget());
// Set the data on the apex event
@@ -170,13 +169,13 @@ public final class Apex2XmlEventConverter implements ApexEventProtocolConverter
}
// Create the XML event
- final XMLApexEvent xmlApexEvent = new XMLApexEvent(apexEvent.getName(), apexEvent.getVersion(),
+ final var xmlApexEvent = new XMLApexEvent(apexEvent.getName(), apexEvent.getVersion(),
apexEvent.getNameSpace(), apexEvent.getSource(), apexEvent.getTarget(), xmlDataList);
// Write the event into a DOM document
try {
// Marshal the event into XML
- final StringWriter writer = new StringWriter();
+ final var writer = new StringWriter();
marshaller.marshal(objectFactory.createXmlApexEvent(xmlApexEvent), writer);
// Return the event as XML in a string
diff --git a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java
index 922f64f2d..21afa2ec1 100644
--- a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java
+++ b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications 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.
@@ -21,7 +22,6 @@
package org.onap.policy.apex.plugins.executor.java;
-import java.lang.reflect.Method;
import java.util.Map;
import java.util.Properties;
import org.onap.policy.apex.context.ContextException;
@@ -80,14 +80,14 @@ public class JavaStateFinalizerExecutor extends StateFinalizerExecutor {
executePre(executionId, executionProperties, incomingFields);
// Check and execute the Java logic
- boolean returnValue = false;
+ var returnValue = false;
try {
// Find and call the method with the signature "public boolean getStateOutput(final
// StateFinalizerExecutionContext executor) throws ApexException"
// to invoke the
// task logic in the Java class
- final Method method = stateFinalizerLogicObject.getClass().getDeclaredMethod("getStateOutput",
- new Class[] {StateFinalizerExecutionContext.class});
+ final var classes = new Class[] {StateFinalizerExecutionContext.class};
+ final var method = stateFinalizerLogicObject.getClass().getDeclaredMethod("getStateOutput", classes);
returnValue = (boolean) method.invoke(stateFinalizerLogicObject, getExecutionContext());
} catch (final Exception e) {
LOGGER.error("execute: state finalizer logic failed to run for state finalizer \"" + getSubject().getId()
diff --git a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java
index 736249efd..da6533f17 100644
--- a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java
+++ b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java
@@ -3,6 +3,7 @@
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 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.
@@ -22,7 +23,6 @@
package org.onap.policy.apex.plugins.executor.java;
-import java.lang.reflect.Method;
import java.util.Map;
import java.util.Properties;
import org.onap.policy.apex.context.ContextException;
@@ -83,13 +83,13 @@ public class JavaTaskExecutor extends TaskExecutor {
executePre(executionId, executionProperties, incomingFields);
// Check and execute the Java logic
- boolean returnValue = false;
+ var returnValue = false;
try {
// Find and call the method with the signature "public boolean getEvent(final TaskExecutionContext executor)
// throws ApexException" to invoke the
// task logic in the Java class
- final Method method =
- taskLogicObject.getClass().getDeclaredMethod("getEvent", new Class[] {TaskExecutionContext.class});
+ final var classes = new Class[] {TaskExecutionContext.class};
+ final var method = taskLogicObject.getClass().getDeclaredMethod("getEvent", classes);
returnValue = (boolean) method.invoke(taskLogicObject, getExecutionContext());
} catch (final Exception e) {
LOGGER.error("execute: task logic failed to run for task \"" + getSubject().getKey().getId() + "\"");
diff --git a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java
index ee830ca53..27207a57d 100644
--- a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java
+++ b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications 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.
@@ -21,7 +22,6 @@
package org.onap.policy.apex.plugins.executor.java;
-import java.lang.reflect.Method;
import java.util.Properties;
import org.onap.policy.apex.context.ContextException;
import org.onap.policy.apex.core.engine.event.EnEvent;
@@ -84,13 +84,13 @@ public class JavaTaskSelectExecutor extends TaskSelectExecutor {
executePre(executionId, executionProperties, incomingEvent);
// Check and execute the Java logic
- boolean returnValue = false;
+ var returnValue = false;
try {
// Find and call the method with the signature "public boolean getTask(final TaskSelectionExecutionContext
// executor)" to invoke the task selection
// logic in the Java class
- final Method method = taskSelectionLogicObject.getClass().getDeclaredMethod("getTask",
- new Class[] {TaskSelectionExecutionContext.class});
+ final var classes = new Class[] {TaskSelectionExecutionContext.class};
+ final var method = taskSelectionLogicObject.getClass().getDeclaredMethod("getTask", classes);
returnValue = (boolean) method.invoke(taskSelectionLogicObject, getExecutionContext());
} catch (final Exception e) {
LOGGER.error(
diff --git a/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptExecutor.java b/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptExecutor.java
index 344f8c5ae..18aac64cf 100644
--- a/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptExecutor.java
+++ b/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptExecutor.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.
@@ -67,7 +68,7 @@ public class JavascriptExecutor {
public boolean execute(final Object executionContext) throws StateMachineException {
Object returnObject = null;
- Context context = Context.enter();
+ var context = Context.enter();
try {
// Pass the subject context to the Javascript engine
Scriptable javascriptScope = context.initStandardObjects();
@@ -91,7 +92,7 @@ public class JavascriptExecutor {
}
private Script compile(String id, String javascriptCode) throws StateMachineException {
- Context context = Context.enter();
+ var context = Context.enter();
try {
// Set up the default values of the context
context.setOptimizationLevel(DEFAULT_OPTIMIZATION_LEVEL);
diff --git a/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutorTest.java b/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutorTest.java
index 78ac85366..d2bb852b6 100644
--- a/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutorTest.java
+++ b/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutorTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* 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.
@@ -85,9 +86,8 @@ public class JavascriptTaskSelectExecutorTest {
state.getTaskSelectionLogic().setLogic("java.lang.String");
jtse.prepare();
- assertThatThrownBy(() -> {
- jtse.execute(-1, new Properties(), null);
- }).isInstanceOf(NullPointerException.class);
+ final var props = new Properties();
+ assertThatThrownBy(() -> jtse.execute(-1, props, null)).isInstanceOf(NullPointerException.class);
AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1"));
EnEvent event = new EnEvent(axEvent);
diff --git a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java
index ee172d3ed..10d93e558 100644
--- a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java
+++ b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 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.
@@ -89,7 +90,7 @@ public class JrubyStateFinalizerExecutor extends StateFinalizerExecutor {
container.put("executor", getExecutionContext());
/* Precompiled version */
- boolean returnValue = false;
+ var returnValue = false;
final IRubyObject ret = parsedjruby.run();
if (ret != null) {
final Boolean retbool = ret.toJava(java.lang.Boolean.class);
diff --git a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java
index aa5700433..f54c2d72c 100644
--- a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java
+++ b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java
@@ -3,6 +3,7 @@
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 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.
@@ -90,7 +91,7 @@ public class JrubyTaskExecutor extends TaskExecutor {
container.put("executor", getExecutionContext());
/* Precompiled version */
- boolean returnValue = false;
+ var returnValue = false;
final IRubyObject ret = parsedjruby.run();
if (ret != null) {
final Boolean retbool = ret.toJava(java.lang.Boolean.class);
diff --git a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java
index 97419b0c1..5f2167144 100644
--- a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java
+++ b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 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.
@@ -93,7 +94,7 @@ public class JrubyTaskSelectExecutor extends TaskSelectExecutor {
container.put("executor", getExecutionContext());
/* Precompiled version */
- boolean returnValue = false;
+ var returnValue = false;
final IRubyObject ret = parsedjruby.run();
if (ret != null) {
final Boolean retbool = ret.toJava(java.lang.Boolean.class);
diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java
index 5cf0bbbac..621bc1aa0 100644
--- a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java
+++ b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 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.
@@ -85,7 +86,7 @@ public class MvelStateFinalizerExecutor extends StateFinalizerExecutor {
// Check and execute the MVEL logic
argumentNotNull(compiled, "MVEL state finalizer logic not compiled.");
- boolean returnValue = false;
+ var returnValue = false;
try {
// Execute the MVEL code
returnValue =
diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java
index 07a287f4d..9040b5b44 100644
--- a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java
+++ b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java
@@ -3,6 +3,7 @@
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 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.
@@ -85,7 +86,7 @@ public class MvelTaskExecutor extends TaskExecutor {
// Check and execute the MVEL logic
argumentNotNull(compiled, "MVEL task not compiled.");
- boolean returnValue = false;
+ var returnValue = false;
try {
// Execute the MVEL code
diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java
index 7f1e47582..4f39ae0ca 100644
--- a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java
+++ b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 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.
@@ -86,7 +87,7 @@ public class MvelTaskSelectExecutor extends TaskSelectExecutor {
// Check and execute the MVEL logic
argumentNotNull(compiled, "MVEL task not compiled.");
- boolean returnValue = false;
+ var returnValue = false;
try {
// Execute the MVEL code
returnValue =