From 5c2e24008d5b093f86aa5dce8db1336d9211d1d2 Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Wed, 11 Dec 2024 09:21:34 +0100 Subject: Reduce org.json usage in aai-common - org.json [is slow](https://github.com/fabienrenaud/java-json-benchmark?tab=readme-ov-file#users-model) - Jackson should be consistently used everywhere - only XmlFormatTransformer is left, but that warrants a dedicated change with (likely) further tests since it appears to be quite a critical execution path - remove unused imports - update org.json to a non-vulnerable version Issue-ID: AAI-4085 Change-Id: I84610523447d70a1729348392ffd302d17e9379d Signed-off-by: Fiete Ostkamp --- .../src/main/java/org/onap/aai/config/RestConfiguration.java | 5 ++++- .../src/main/java/org/onap/aai/config/TranslatorConfiguration.java | 2 +- aai-schema-ingest/src/main/java/org/onap/aai/setup/Translator.java | 3 ++- .../src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java | 3 ++- .../src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java | 2 +- aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java | 2 +- .../src/test/java/org/onap/aai/edges/JsonIngestorTest.java | 2 +- .../src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java | 2 +- .../src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java | 2 +- .../java/org/onap/aai/validation/CheckEverythingStrategyTest.java | 3 ++- .../src/test/java/org/onap/aai/validation/FailFastStrategyTest.java | 3 ++- .../java/org/onap/aai/validation/VersionValidatorRainyDayTest.java | 3 ++- .../java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java | 2 +- .../aai/validation/edges/CousinDefaultingValidationModuleTest.java | 2 +- .../aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java | 2 +- .../org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java | 3 ++- .../org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java | 2 +- .../aai/validation/edges/SingleContainmentValidationModuleTest.java | 2 +- .../onap/aai/validation/edges/UniqueLabelValidationModuleTest.java | 2 +- .../org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java | 3 ++- 20 files changed, 30 insertions(+), 20 deletions(-) (limited to 'aai-schema-ingest') diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/config/RestConfiguration.java b/aai-schema-ingest/src/main/java/org/onap/aai/config/RestConfiguration.java index c46ab78d..01e265fa 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/config/RestConfiguration.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/config/RestConfiguration.java @@ -22,7 +22,10 @@ package org.onap.aai.config; -import org.onap.aai.restclient.*; +import org.onap.aai.restclient.RestClient; +import org.onap.aai.restclient.SchemaServiceNoAuthClient; +import org.onap.aai.restclient.SchemaServiceOneWayClient; +import org.onap.aai.restclient.SchemaServiceRestClient; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/config/TranslatorConfiguration.java b/aai-schema-ingest/src/main/java/org/onap/aai/config/TranslatorConfiguration.java index d49e6ec7..8498d908 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/config/TranslatorConfiguration.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/config/TranslatorConfiguration.java @@ -22,7 +22,7 @@ package org.onap.aai.config; -import org.onap.aai.setup.*; +import org.onap.aai.setup.ConfigTranslator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Configuration; diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/setup/Translator.java b/aai-schema-ingest/src/main/java/org/onap/aai/setup/Translator.java index 45ca0cd6..a9144a6c 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/setup/Translator.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/setup/Translator.java @@ -20,7 +20,8 @@ package org.onap.aai.setup; -import java.io.*; +import java.io.IOException; +import java.io.InputStream; import java.util.List; /** diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java index fa7f04cd..e780b2e5 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeIngestorWiringTest.java @@ -20,7 +20,8 @@ package org.onap.aai.edges; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.common.collect.Multimap; import org.junit.jupiter.api.Test; diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java index 3396b93c..ecca4c8d 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleQueryTest.java @@ -20,7 +20,7 @@ package org.onap.aai.edges; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.jayway.jsonpath.DocumentContext; import com.jayway.jsonpath.JsonPath; diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java index 798a32f6..59561f60 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/EdgeRuleTest.java @@ -20,7 +20,7 @@ package org.onap.aai.edges; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.HashMap; import java.util.Map; diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java index 66fbcceb..106ac15c 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/JsonIngestorTest.java @@ -22,7 +22,7 @@ package org.onap.aai.edges; import static com.jayway.jsonpath.Criteria.where; import static com.jayway.jsonpath.Filter.filter; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.jayway.jsonpath.DocumentContext; import com.jayway.jsonpath.Filter; diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java index b1063107..d6de1c4e 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/edges/TypeAlphabetizerTest.java @@ -20,7 +20,7 @@ package org.onap.aai.edges; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java index 07631ce2..fa7d001a 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/nodes/NodeIngestorWiringTest.java @@ -20,7 +20,7 @@ package org.onap.aai.nodes; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.persistence.dynamic.DynamicEntity; import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext; diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java index 0022e151..d78976d7 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/CheckEverythingStrategyTest.java @@ -20,7 +20,8 @@ package org.onap.aai.validation; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java index 043e9c71..9aef2c45 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/FailFastStrategyTest.java @@ -20,7 +20,8 @@ package org.onap.aai.validation; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java index bcf79d2d..49dcbe5d 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorRainyDayTest.java @@ -20,7 +20,8 @@ package org.onap.aai.validation; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; import org.onap.aai.config.NodesConfiguration; diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java index f2bb85a3..d3012c8f 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/VersionValidatorSunnyDayTest.java @@ -20,7 +20,7 @@ package org.onap.aai.validation; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; import org.onap.aai.config.NodesConfiguration; diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java index 466e4b90..6a5b162c 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/CousinDefaultingValidationModuleTest.java @@ -20,7 +20,7 @@ package org.onap.aai.validation.edges; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.jayway.jsonpath.DocumentContext; diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java index 08298f2f..1f25b810 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/DefaultEdgeFieldsValidationModuleTest.java @@ -20,7 +20,7 @@ package org.onap.aai.validation.edges; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.HashMap; import java.util.Map; diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java index 53cad53c..42dd8595 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/EdgeRuleValidatorSunnyDayTest.java @@ -20,7 +20,8 @@ package org.onap.aai.validation.edges; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; import org.onap.aai.config.NodesConfiguration; diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java index 191a10d0..78e8e258 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/NodeTypesValidationModuleTest.java @@ -20,7 +20,7 @@ package org.onap.aai.validation.edges; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.List; diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java index d34772e3..619831d8 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/SingleContainmentValidationModuleTest.java @@ -20,7 +20,7 @@ package org.onap.aai.validation.edges; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.jayway.jsonpath.DocumentContext; diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java index 22553b9e..04b5802e 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/edges/UniqueLabelValidationModuleTest.java @@ -20,7 +20,7 @@ package org.onap.aai.validation.edges; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.jayway.jsonpath.DocumentContext; diff --git a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java index d8a69333..e478da1b 100644 --- a/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java +++ b/aai-schema-ingest/src/test/java/org/onap/aai/validation/nodes/NodeValidatorSunnyDayTest.java @@ -20,7 +20,8 @@ package org.onap.aai.validation.nodes; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; import org.onap.aai.config.NodesConfiguration; -- cgit 1.2.3-korg