aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-09-01 11:45:05 -0400
committerJim Hahn <jrh3@att.com>2021-09-01 12:13:08 -0400
commit51f1fffd687e53c858685ec41fd3ab8cfd4fcdf1 (patch)
tree8002add6eb9acf0ca5d668ef44550fc7c1170ef6
parent9ee4561bcd28b7199fd1ffed118f122a8435203a (diff)
Fix sonars in apex-pdp #3
Fixed: - use "var" - use assertEquals instead of assertTrue(xxx.equals()) - separate assertions Issue-ID: POLICY-3093 Change-Id: Id4db62626948681cd267e68a56dda65fa355c6f8 Signed-off-by: Jim Hahn <jrh3@att.com>
-rw-r--r--core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingUtilsTest.java5
-rw-r--r--core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTest.java (renamed from core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java)2
-rw-r--r--examples/examples-servlet/src/main/java/org/onap/policy/apex/examples/servlet/ApexServletListener.java6
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java4
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProducerFactory.java4
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java3
-rw-r--r--testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java12
-rw-r--r--testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextUpdate.java6
-rw-r--r--testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatch.java10
-rw-r--r--testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatchStats.java5
-rw-r--r--testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGenerator.java6
-rw-r--r--testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorEndpoint.java4
-rw-r--r--testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorParameterHandler.java11
13 files changed, 42 insertions, 36 deletions
diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingUtilsTest.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingUtilsTest.java
index a3c7ea419..6d5915ce8 100644
--- a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingUtilsTest.java
+++ b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingUtilsTest.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.
@@ -40,7 +41,7 @@ public class MessagingUtilsTest {
@Test(expected = IllegalArgumentException.class)
public void testIllegalArgumentException() {
- assertEquals(1, MessagingUtils.findPort(65536));
+ MessagingUtils.findPort(65536);
}
@Test
@@ -58,7 +59,7 @@ public class MessagingUtilsTest {
@Test(expected = IllegalArgumentException.class)
public void testInvalidAllocateAddress() {
- assertEquals(1, MessagingUtils.allocateAddress(1));
+ MessagingUtils.allocateAddress(1);
}
@Test
diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTest.java
index 7bc352025..8b19059b5 100644
--- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java
+++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTest.java
@@ -33,7 +33,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
/**
* Test of the abstract Message class.
*/
-public class SupportMessageTester {
+public class SupportMessageTest {
@Test
public void testMessage() {
diff --git a/examples/examples-servlet/src/main/java/org/onap/policy/apex/examples/servlet/ApexServletListener.java b/examples/examples-servlet/src/main/java/org/onap/policy/apex/examples/servlet/ApexServletListener.java
index 80ef7354b..c1b7fbc11 100644
--- a/examples/examples-servlet/src/main/java/org/onap/policy/apex/examples/servlet/ApexServletListener.java
+++ b/examples/examples-servlet/src/main/java/org/onap/policy/apex/examples/servlet/ApexServletListener.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. 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.
@@ -57,7 +58,7 @@ public class ApexServletListener implements ServletContextListener {
// Check that a configuration file have been specified
if (servletContextEvent.getServletContext().getInitParameter("config-file") == null) {
- final String errorMessage =
+ final var errorMessage =
"Apex servlet start failed, servlet parameter \"config-file\" has not been specified";
LOGGER.error("Apex servlet start failed, servlet parameter \"config-file\" has not been specified");
throw new ApexRuntimeException(errorMessage);
@@ -89,8 +90,7 @@ public class ApexServletListener implements ServletContextListener {
apexMain.shutdown();
apexMain = null;
} catch (final ApexException e) {
- final String errorMessage = "Apex servlet stop did not execute normally";
- LOGGER.error(errorMessage, e);
+ LOGGER.error("Apex servlet stop did not execute normally", e);
}
LOGGER.info("Apex Servliet has been stopped");
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java
index 2f6922a2b..acf49e385 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.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.
@@ -23,7 +24,6 @@ package org.onap.policy.apex.service.engine.event.impl;
import org.onap.policy.apex.service.engine.event.ApexEventConsumer;
import org.onap.policy.apex.service.engine.event.ApexEventException;
-import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -48,7 +48,7 @@ public class EventConsumerFactory {
public ApexEventConsumer createConsumer(final String name, final EventHandlerParameters consumerParameters)
throws ApexEventException {
// Get the carrier technology parameters
- final CarrierTechnologyParameters technologyParameters = consumerParameters.getCarrierTechnologyParameters();
+ final var technologyParameters = consumerParameters.getCarrierTechnologyParameters();
// Get the class for the event consumer using reflection
final String consumerPluginClass = technologyParameters.getEventConsumerPluginClass();
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProducerFactory.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProducerFactory.java
index e87e2fd78..7139625ab 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProducerFactory.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProducerFactory.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.
@@ -23,7 +24,6 @@ package org.onap.policy.apex.service.engine.event.impl;
import org.onap.policy.apex.service.engine.event.ApexEventException;
import org.onap.policy.apex.service.engine.event.ApexEventProducer;
-import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -48,7 +48,7 @@ public class EventProducerFactory {
public ApexEventProducer createProducer(final String name, final EventHandlerParameters producerParameters)
throws ApexEventException {
// Get the carrier technology parameters
- final CarrierTechnologyParameters technologyParameters = producerParameters.getCarrierTechnologyParameters();
+ final var technologyParameters = producerParameters.getCarrierTechnologyParameters();
// Get the class for the event producer using reflection
final String producerPluginClass = technologyParameters.getEventProducerPluginClass();
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java
index 13cefaa58..a62d348f2 100644
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.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.
@@ -101,7 +102,7 @@ public class TestContextDateItem implements Serializable {
public void setDateValue(final long dateValue) {
this.time = dateValue;
- final Calendar calendar = Calendar.getInstance();
+ final var calendar = Calendar.getInstance();
calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
calendar.setTimeInMillis(time);
diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java
index 5561dbece..fa3612fe9 100644
--- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java
+++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.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.
@@ -21,6 +22,7 @@
package org.onap.policy.apex.testsuites.integration.context.distribution;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -274,16 +276,16 @@ public class ContextInstantiation {
externalContextOther.setTestExternalContextItem002(new TestContextIntItem());
externalContextOther.getTestExternalContextItem002().setIntValue(INT_VAL_2);
- assertTrue(externalContextAlbum.put(EXTERNAL_CONTEXT, externalContextOther).equals(externalContext));
+ assertThat(externalContextAlbum.put(EXTERNAL_CONTEXT, externalContextOther)).isEqualTo(externalContext);
externalContextItem = (TestExternalContextItem) externalContextAlbum.get(EXTERNAL_CONTEXT);
assertEquals(INT_VAL_2, externalContextItem.getTestExternalContextItem002().getIntValue());
- assertTrue(externalContextAlbum.put(EXTERNAL_CONTEXT, externalContext).equals(externalContextOther));
+ assertThat(externalContextAlbum.put(EXTERNAL_CONTEXT, externalContext)).isEqualTo(externalContextOther);
externalContextItem = (TestExternalContextItem) externalContextAlbum.get(EXTERNAL_CONTEXT);
assertEquals(INT_VAL_3, externalContextItem.getTestExternalContextItem002().getIntValue());
assertThatThrownBy(() -> externalContextAlbum.put("TestExternalContextItem00A", null))
.hasMessageContaining(NULL_ILLEGAL + "\"TestExternalContextItem00A\" for put()");
- assertTrue(externalContextAlbum.get(EXTERNAL_CONTEXT).equals(externalContext));
+ assertThat(externalContextAlbum.get(EXTERNAL_CONTEXT)).isEqualTo(externalContext);
assertThatThrownBy(() -> externalContextAlbum.put("TestExternalContextItemFFF", null))
.hasMessageContaining(NULL_ILLEGAL + "\"TestExternalContextItemFFF\" for put()");
@@ -477,11 +479,11 @@ public class ContextInstantiation {
}
private void assertFloat(final float actual, final float expected) {
- assertTrue(Float.compare(actual, expected) == 0);
+ assertThat(actual).isEqualTo(expected);
}
private void assertDouble(final double actual, final double expected) {
- assertTrue(Double.compare(actual, expected) == 0);
+ assertThat(actual).isEqualTo(expected);
}
private Distributor getDistributor() throws ContextException {
diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextUpdate.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextUpdate.java
index ae662f293..b0370c5d9 100644
--- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextUpdate.java
+++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextUpdate.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.
@@ -21,6 +22,7 @@
package org.onap.policy.apex.testsuites.integration.context.distribution;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -97,10 +99,10 @@ public class ContextUpdate {
.hasMessage("album \"LongContextAlbum:0.0.1\" null keys are illegal on keys for put()");
assertNull(dateContextAlbum.put("date0", tciA));
- assertTrue(dateContextAlbum.put("date0", tciA).equals(tciA));
+ assertThat(dateContextAlbum.put("date0", tciA)).isEqualTo(tciA);
assertNull(mapContextAlbum.put("map0", tciC));
- assertTrue(mapContextAlbum.put("map0", tciC).equals(tciC));
+ assertThat(mapContextAlbum.put("map0", tciC)).isEqualTo(tciC);
contextDistributor.clear();
}
diff --git a/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatch.java b/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatch.java
index 99f480b6c..3e3658349 100644
--- a/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatch.java
+++ b/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatch.java
@@ -55,8 +55,8 @@ public class EventBatch {
this.apexClient = apexClient;
// Create the events for the batch of events
- for (int eventNumber = 0; eventNumber < batchSize; eventNumber++) {
- InputEvent inputEvent = new InputEvent();
+ for (var eventNumber = 0; eventNumber < batchSize; eventNumber++) {
+ var inputEvent = new InputEvent();
inputEvent.setTestSlogan(getEventSlogan(eventNumber));
inputEventMap.put(eventNumber, inputEvent);
}
@@ -72,9 +72,9 @@ public class EventBatch {
return inputEventMap.get(0).asJson();
}
- StringBuilder jsonBuilder = new StringBuilder();
+ var jsonBuilder = new StringBuilder();
jsonBuilder.append("[\n");
- boolean first = true;
+ var first = true;
for (InputEvent inputEvent : inputEventMap.values()) {
if (first) {
first = false;
@@ -95,7 +95,7 @@ public class EventBatch {
* @return the event slogan
*/
private String getEventSlogan(final int eventNumber) {
- StringBuilder testSloganBuilder = new StringBuilder();
+ var testSloganBuilder = new StringBuilder();
testSloganBuilder.append(batchNumber);
testSloganBuilder.append('-');
testSloganBuilder.append(eventNumber);
diff --git a/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatchStats.java b/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatchStats.java
index fa5083ed0..d7b9daf14 100644
--- a/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatchStats.java
+++ b/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventBatchStats.java
@@ -26,7 +26,6 @@ import java.util.List;
import lombok.Getter;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
-import org.onap.policy.apex.testsuites.performance.benchmark.eventgenerator.events.OutputEvent;
/**
* This POJO class returns statistics on a event batch execution in Apex.
@@ -85,7 +84,7 @@ public class EventBatchStats {
long accumulatedRoundTripTime = 0;
long accumulatedApexExecutionTime = 0;
- for (int eventNo = 0; eventNo < batchSize; eventNo++) {
+ for (var eventNo = 0; eventNo < batchSize; eventNo++) {
Pair<Long, Long> eventTimings = calculateEventTimings(eventBatch, eventNo);
if (eventTimings == null) {
// The event has not been sent yet or the response has not been received yet
@@ -154,7 +153,7 @@ public class EventBatchStats {
// If an event is in a batch, it has been sent
eventsSent++;
- OutputEvent outputEvent = eventBatch.getOutputEvent(eventNo);
+ var outputEvent = eventBatch.getOutputEvent(eventNo);
if (outputEvent == null) {
eventsNotReceived++;
diff --git a/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGenerator.java b/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGenerator.java
index 91f84b66b..51b6c7cae 100644
--- a/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGenerator.java
+++ b/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGenerator.java
@@ -65,7 +65,7 @@ public class EventGenerator {
LOGGER.info("Event generator REST server starting");
- final ResourceConfig rc = new ResourceConfig(EventGeneratorEndpoint.class);
+ final var rc = new ResourceConfig(EventGeneratorEndpoint.class);
eventGeneratorServer = GrizzlyHttpServerFactory.createHttpServer(getBaseUri(), rc);
// Wait for the HTTP server to come up
@@ -147,7 +147,7 @@ public class EventGenerator {
LOGGER.info("Starting event generator with arguments: {}", Arrays.toString(args));
}
- EventGeneratorParameterHandler parameterHandler = new EventGeneratorParameterHandler();
+ var parameterHandler = new EventGeneratorParameterHandler();
EventGeneratorParameters parameters = null;
@@ -166,7 +166,7 @@ public class EventGenerator {
}
// Start the event generator
- EventGenerator eventGenerator = new EventGenerator(parameters);
+ var eventGenerator = new EventGenerator(parameters);
LOGGER.info("Event generator started");
// Wait for event generation to finish
diff --git a/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorEndpoint.java b/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorEndpoint.java
index 6cbee6935..53e57f295 100644
--- a/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorEndpoint.java
+++ b/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorEndpoint.java
@@ -115,7 +115,7 @@ public class EventGeneratorEndpoint {
return Response.status(204).build();
}
- EventBatch batch = new EventBatch(parameters.get().getBatchSize(), getApexClient());
+ var batch = new EventBatch(parameters.get().getBatchSize(), getApexClient());
batchMap.put(batch.getBatchNumber(), batch);
return Response.status(200).entity(batch.getBatchAsJsonString()).build();
@@ -130,7 +130,7 @@ public class EventGeneratorEndpoint {
@Path("/PostEvent")
@POST
public Response postEventResponse(final String jsonString) {
- final OutputEvent outputEvent = new Gson().fromJson(jsonString, OutputEvent.class);
+ final var outputEvent = new Gson().fromJson(jsonString, OutputEvent.class);
EventBatch batch = batchMap.get(outputEvent.findBatchNumber());
diff --git a/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorParameterHandler.java b/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorParameterHandler.java
index 912290097..16e72a2b9 100644
--- a/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorParameterHandler.java
+++ b/testsuites/performance/performance-benchmark-test/src/main/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorParameterHandler.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 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.
@@ -99,7 +100,7 @@ public class EventGeneratorParameterHandler {
* @throws ParseException on parse errors
*/
public EventGeneratorParameters parse(final String[] args) throws ParseException {
- CommandLine commandLine = new DefaultParser().parse(options, args);
+ var commandLine = new DefaultParser().parse(options, args);
final String[] remainingArgs = commandLine.getArgs();
if (remainingArgs.length > 0) {
@@ -110,7 +111,7 @@ public class EventGeneratorParameterHandler {
return null;
}
- EventGeneratorParameters parameters = new EventGeneratorParameters();
+ var parameters = new EventGeneratorParameters();
if (commandLine.hasOption('c')) {
parameters = getParametersFromJsonFile(commandLine.getOptionValue(CONFIGURATION_FILE));
@@ -200,10 +201,10 @@ public class EventGeneratorParameterHandler {
* @return help string
*/
public String getHelp(final String mainClassName) {
- final StringWriter stringWriter = new StringWriter();
- final PrintWriter stringPrintWriter = new PrintWriter(stringWriter);
+ final var stringWriter = new StringWriter();
+ final var stringPrintWriter = new PrintWriter(stringWriter);
- final HelpFormatter helpFormatter = new HelpFormatter();
+ final var helpFormatter = new HelpFormatter();
helpFormatter.printHelp(stringPrintWriter, MAX_HELP_LINE_LENGTH, mainClassName + " [options...] ", "", options,
0, 0, "");