From 5bf11a7500944b8b306c5d4f478e4bc45ef1fb51 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Wed, 21 Aug 2019 09:39:44 +0000 Subject: Fix checkstyle warnings in apex-pdp Unit tests introduced some checkstyle warnings, this review resolves those warnings. Issue-ID: POLICY-1942 Change-Id: I16438621c1db0adfbe70bc8b237d05bd7cc72697 Signed-off-by: liamfallon --- .../integration/uservice/adapt/kafka/KafkaEventProducer.java | 10 +++++----- .../uservice/adapt/kafka/KafkaEventSubscriber.java | 8 ++++---- .../uservice/adapt/restclient/TestExecutionPropertyRest.java | 12 +++++++----- .../uservice/adapt/restclient/TestRestClientEndpoint.java | 1 + 4 files changed, 17 insertions(+), 14 deletions(-) (limited to 'testsuites/integration/integration-uservice-test/src/test/java') diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java index bafce8d06..dd46f7f74 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java @@ -5,15 +5,15 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -22,7 +22,7 @@ package org.onap.policy.apex.testsuites.integration.uservice.adapt.kafka; import com.salesforce.kafka.test.junit4.SharedKafkaTestResource; -import java.util.concurrent.TimeUnit; +import java.time.Duration; import org.apache.kafka.clients.producer.Producer; import org.apache.kafka.clients.producer.ProducerRecord; @@ -85,7 +85,7 @@ public class KafkaEventProducer implements Runnable { } } - producer.close(1000, TimeUnit.MILLISECONDS); + producer.close(Duration.ofMillis(1000)); } /** diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java index 8db6919f0..dbe8d0294 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java @@ -5,15 +5,15 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -82,7 +82,7 @@ public class KafkaEventSubscriber implements Runnable { while (subscriberThread.isAlive() && !subscriberThread.isInterrupted()) { try { - final ConsumerRecords records = consumer.poll(POLL_DURATION.toMillis()); + final ConsumerRecords records = consumer.poll(POLL_DURATION); for (final ConsumerRecord record : records) { eventsReceivedCount++; System.out.println("****** Received event No. " + eventsReceivedCount + " ******"); diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java index 0ba41db81..bc5b602e3 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java @@ -21,6 +21,7 @@ package org.onap.policy.apex.testsuites.integration.uservice.adapt.restclient; import static org.junit.Assert.assertTrue; + import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.net.URI; @@ -118,7 +119,7 @@ public class TestExecutionPropertyRest { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = {"src/test/resources/testdata/executionproperties/RESTEventBadUrl.json"}; + final String[] args = { "src/test/resources/testdata/executionproperties/RESTEventBadUrl.json" }; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(500); @@ -142,7 +143,7 @@ public class TestExecutionPropertyRest { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = {"src/test/resources/testdata/executionproperties/RESTEventNoValueSetForTag.json"}; + final String[] args = { "src/test/resources/testdata/executionproperties/RESTEventNoValueSetForTag.json" }; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(1000); @@ -167,7 +168,7 @@ public class TestExecutionPropertyRest { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = {"src/test/resources/testdata/executionproperties/RESTEventBadHttpCodeFilter.json"}; + final String[] args = { "src/test/resources/testdata/executionproperties/RESTEventBadHttpCodeFilter.json" }; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(500); @@ -190,7 +191,8 @@ public class TestExecutionPropertyRest { public void testReplaceUrlTag() throws Exception { final Client client = ClientBuilder.newClient(); - final String[] args = {"src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToTagUrlOK.json"}; + final String[] args = + { "src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToTagUrlOK.json" }; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(1000); apexMain.shutdown(); @@ -215,7 +217,7 @@ public class TestExecutionPropertyRest { public void testReplaceUrlMultiTag() throws Exception { final Client client = ClientBuilder.newClient(); final String[] args = - {"src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToMultiTagUrlOK.json"}; + { "src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToMultiTagUrlOK.json" }; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(1500); apexMain.shutdown(); diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRestClientEndpoint.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRestClientEndpoint.java index f19410fb5..dc8d962dd 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRestClientEndpoint.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRestClientEndpoint.java @@ -23,6 +23,7 @@ package org.onap.policy.apex.testsuites.integration.uservice.adapt.restclient; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; + import com.google.gson.Gson; import java.util.Map; import java.util.Random; -- cgit 1.2.3-korg