diff options
author | Vijay VK <vv770d@att.com> | 2018-09-10 19:04:05 +0100 |
---|---|---|
committer | VENKATESH KUMAR <vv770d@att.com> | 2018-09-11 11:35:17 -0400 |
commit | 84b25b7ab2019a558fad92e21c4cc44c242e4461 (patch) | |
tree | 301c79fe2edf786e2c6137149db50c99476f2a7b /src/test | |
parent | 4026d98bc9802e41146ff6ef727d349c7ac1e89e (diff) |
Fix build warnings & CLM scan issue3.0.0-ONAP1.3.1
Change-Id: I43629917f2d7bafb15258bdbba1cd45478595edb
Signed-off-by: VENKATESH KUMAR <vv770d@att.com>
Issue-ID: DCAEGEN2-603, DCAEGEN2-767
Signed-off-by: VENKATESH KUMAR <vv770d@att.com>
Diffstat (limited to 'src/test')
13 files changed, 73 insertions, 51 deletions
diff --git a/src/test/java/org/onap/dcae/ApplicationSettingsTest.java b/src/test/java/org/onap/dcae/ApplicationSettingsTest.java index 67b9cb64..55160ff5 100644 --- a/src/test/java/org/onap/dcae/ApplicationSettingsTest.java +++ b/src/test/java/org/onap/dcae/ApplicationSettingsTest.java @@ -1,10 +1,9 @@ -package org.onap.dcae; - /*- * ============LICENSE_START======================================================= * org.onap.dcaegen2.collectors.ves * ================================================================================ * Copyright (C) 2018 Nokia. All rights reserved. + * Copyright (C) 2018 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. @@ -20,14 +19,23 @@ package org.onap.dcae; * ============LICENSE_END========================================================= */ +package org.onap.dcae; + +import static java.util.Collections.singletonList; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.onap.dcae.CLIUtils.processCmdLine; +import static org.onap.dcae.TestingUtilities.createTemporaryFile; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.fge.jsonschema.core.exceptions.ProcessingException; import com.github.fge.jsonschema.main.JsonSchema; import io.vavr.collection.HashMap; import io.vavr.collection.Map; -import org.junit.Test; - import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -35,11 +43,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import java.util.Objects; - -import static java.util.Collections.singletonList; -import static org.junit.Assert.*; -import static org.onap.dcae.CLIUtils.processCmdLine; -import static org.onap.dcae.TestingUtilities.createTemporaryFile; +import org.junit.Test; public class ApplicationSettingsTest { @@ -290,12 +294,12 @@ public class ApplicationSettingsTest { @Test public void shouldReturnJSONSchema() throws IOException, ProcessingException { // when - String sampleJsonSchema = "{" + - " \"type\": \"object\"," + - " \"properties\": {" + - " \"state\": { \"type\": \"string\" }" + - " }" + - "}"; + String sampleJsonSchema = "{" + + " \"type\": \"object\"," + + " \"properties\": {" + + " \"state\": { \"type\": \"string\" }" + + " }" + + "}"; Path temporarySchemaFile = createTemporaryFile(sampleJsonSchema); // when diff --git a/src/test/java/org/onap/dcae/TestingUtilities.java b/src/test/java/org/onap/dcae/TestingUtilities.java index 21edfc88..bd05c4ea 100644 --- a/src/test/java/org/onap/dcae/TestingUtilities.java +++ b/src/test/java/org/onap/dcae/TestingUtilities.java @@ -3,6 +3,7 @@ * org.onap.dcaegen2.collectors.ves * ================================================================================ * Copyright (C) 2018 Nokia. All rights reserved. + * Copyright (C) 2018 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. @@ -19,18 +20,17 @@ */ package org.onap.dcae; -import io.vavr.control.Try; -import org.assertj.core.api.AbstractThrowableAssert; -import org.assertj.core.api.Java6Assertions; -import org.json.JSONObject; +import static java.nio.file.Files.readAllBytes; +import static org.assertj.core.api.Assertions.assertThat; +import io.vavr.control.Try; import java.io.File; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; - -import static java.nio.file.Files.readAllBytes; -import static org.assertj.core.api.Assertions.assertThat; +import org.assertj.core.api.AbstractThrowableAssert; +import org.assertj.core.api.Java6Assertions; +import org.json.JSONObject; /** * @author Pawel Szalapski (pawel.szalapski@nokia.com) diff --git a/src/test/java/org/onap/dcae/WiremockBasedTest.java b/src/test/java/org/onap/dcae/WiremockBasedTest.java index 58626340..3b4bdc39 100644 --- a/src/test/java/org/onap/dcae/WiremockBasedTest.java +++ b/src/test/java/org/onap/dcae/WiremockBasedTest.java @@ -3,6 +3,7 @@ * org.onap.dcaegen2.collectors.ves * ================================================================================ * Copyright (C) 2018 Nokia. All rights reserved. + * Copyright (C) 2018 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. @@ -20,14 +21,17 @@ package org.onap.dcae; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; +import static io.vavr.API.Map; + import com.github.tomakehurst.wiremock.junit.WireMockRule; import io.vavr.collection.Map; import org.junit.Rule; -import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; -import static io.vavr.API.Map; - /** * @author Pawel Szalapski (pawel.szalapski@nokia.com) */ diff --git a/src/test/java/org/onap/dcae/commonFunction/ApiExceptionTest.java b/src/test/java/org/onap/dcae/commonFunction/ApiExceptionTest.java index ef5b477c..a63e97f1 100644 --- a/src/test/java/org/onap/dcae/commonFunction/ApiExceptionTest.java +++ b/src/test/java/org/onap/dcae/commonFunction/ApiExceptionTest.java @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.dcae.commonFunction; import static org.junit.Assert.assertEquals; diff --git a/src/test/java/org/onap/dcae/commonFunction/ConfigProcessorAdapterTest.java b/src/test/java/org/onap/dcae/commonFunction/ConfigProcessorAdapterTest.java index 180dfcf1..1ad55897 100644 --- a/src/test/java/org/onap/dcae/commonFunction/ConfigProcessorAdapterTest.java +++ b/src/test/java/org/onap/dcae/commonFunction/ConfigProcessorAdapterTest.java @@ -19,6 +19,11 @@ // package org.onap.dcae.commonFunction; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import org.json.JSONObject; import org.junit.Test; import org.junit.runner.RunWith; @@ -26,11 +31,6 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class ConfigProcessorAdapterTest { diff --git a/src/test/java/org/onap/dcae/commonFunction/EventProcessorTest.java b/src/test/java/org/onap/dcae/commonFunction/EventProcessorTest.java index 3e358466..697510c4 100644 --- a/src/test/java/org/onap/dcae/commonFunction/EventProcessorTest.java +++ b/src/test/java/org/onap/dcae/commonFunction/EventProcessorTest.java @@ -18,10 +18,20 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.dcae.commonFunction; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.onap.dcae.commonFunction.EventProcessor.EVENT_LIST_TYPE; + import com.google.gson.Gson; -import io.vavr.collection.Map; +import java.util.List; import org.json.JSONObject; import org.junit.Before; import org.junit.Test; @@ -30,13 +40,6 @@ import org.onap.dcae.ApplicationSettings; import org.onap.dcae.CLIUtils; import org.onap.dcae.commonFunction.event.publishing.EventPublisher; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.*; -import static org.onap.dcae.commonFunction.EventProcessor.EVENT_LIST_TYPE; public class EventProcessorTest { diff --git a/src/test/java/org/onap/dcae/controller/ConfigCBSSourceTest.java b/src/test/java/org/onap/dcae/controller/ConfigCBSSourceTest.java index bee2ccee..bfec3d97 100644 --- a/src/test/java/org/onap/dcae/controller/ConfigCBSSourceTest.java +++ b/src/test/java/org/onap/dcae/controller/ConfigCBSSourceTest.java @@ -18,17 +18,22 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.dcae.controller; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static org.assertj.core.api.Java6Assertions.assertThat; +import static org.onap.dcae.TestingUtilities.assertFailureHasInfo; +import static org.onap.dcae.controller.ConfigSource.getAppConfig; + import io.vavr.control.Try; import org.json.JSONObject; import org.junit.Test; import org.onap.dcae.WiremockBasedTest; -import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static org.assertj.core.api.Java6Assertions.assertThat; -import static org.onap.dcae.TestingUtilities.assertFailureHasInfo; -import static org.onap.dcae.controller.ConfigSource.getAppConfig; public class ConfigCBSSourceTest extends WiremockBasedTest { diff --git a/src/test/java/org/onap/dcae/controller/ConfigParsingTest.java b/src/test/java/org/onap/dcae/controller/ConfigParsingTest.java index a00a3d3b..5d8d4efa 100644 --- a/src/test/java/org/onap/dcae/controller/ConfigParsingTest.java +++ b/src/test/java/org/onap/dcae/controller/ConfigParsingTest.java @@ -18,6 +18,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.dcae.controller; diff --git a/src/test/java/org/onap/dcae/controller/EnvPropertiesReaderTest.java b/src/test/java/org/onap/dcae/controller/EnvPropertiesReaderTest.java index 581f6eae..6c358024 100644 --- a/src/test/java/org/onap/dcae/controller/EnvPropertiesReaderTest.java +++ b/src/test/java/org/onap/dcae/controller/EnvPropertiesReaderTest.java @@ -18,6 +18,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.dcae.controller; import static io.vavr.API.Map; diff --git a/src/test/java/org/onap/dcae/vestest/AnyNodeTest.java b/src/test/java/org/onap/dcae/vestest/AnyNodeTest.java index 9400e46d..52f81271 100644 --- a/src/test/java/org/onap/dcae/vestest/AnyNodeTest.java +++ b/src/test/java/org/onap/dcae/vestest/AnyNodeTest.java @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.dcae.vestest; import static org.assertj.core.api.Assertions.assertThat; diff --git a/src/test/java/org/onap/dcae/vestest/TestConfigProcessor.java b/src/test/java/org/onap/dcae/vestest/TestConfigProcessor.java index eaf59410..79ae9efb 100644 --- a/src/test/java/org/onap/dcae/vestest/TestConfigProcessor.java +++ b/src/test/java/org/onap/dcae/vestest/TestConfigProcessor.java @@ -22,16 +22,14 @@ package org.onap.dcae.vestest; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
-import com.google.gson.JsonParser;
import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
import java.io.FileReader;
import java.io.IOException;
import org.json.JSONObject;
import org.junit.Test;
-
import org.onap.dcae.commonFunction.ConfigProcessors;
-
public class TestConfigProcessor {
private JSONObject getFileAsJsonObject() {
diff --git a/src/test/java/org/onap/dcae/vestest/TestVESLogger.java b/src/test/java/org/onap/dcae/vestest/TestVESLogger.java index 848f2b76..a1b3e7df 100644 --- a/src/test/java/org/onap/dcae/vestest/TestVESLogger.java +++ b/src/test/java/org/onap/dcae/vestest/TestVESLogger.java @@ -17,18 +17,20 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.dcae.vestest; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; +import static org.onap.dcae.commonFunction.VESLogger.REQUEST_ID; + import com.att.nsa.logging.LoggingContext; import com.att.nsa.logging.log4j.EcompFields; +import java.util.UUID; import org.junit.Test; import org.onap.dcae.commonFunction.VESLogger; -import java.util.UUID; - -import static org.junit.Assert.*; -import static org.onap.dcae.commonFunction.VESLogger.REQUEST_ID; - public class TestVESLogger { @Test diff --git a/src/test/resources/.gitignore b/src/test/resources/.gitignore new file mode 100644 index 00000000..84ac2eb1 --- /dev/null +++ b/src/test/resources/.gitignore @@ -0,0 +1,2 @@ +/controller-config_formatted_op.json +/DmaapConfig-op.json |