summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites')
-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
8 files changed, 31 insertions, 26 deletions
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, "");