diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2022-11-10 11:03:00 +0000 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2022-11-10 11:03:00 +0000 |
commit | f8c058b2be718ab825f88e10e43ed59d5ca75de2 (patch) | |
tree | 7078532cf899cc9d618345aac2c865e233663e01 /aai-queries/src | |
parent | a8e838713d168e7cd81c9765d5e5a56b88e48def (diff) |
Reduce the number of problems in schema-service
Issue-ID: AAI-3590
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Change-Id: I7a5d3e5a4db75efb8a8fcc6c8598d6cab80dca4a
Diffstat (limited to 'aai-queries/src')
3 files changed, 8 insertions, 18 deletions
diff --git a/aai-queries/src/main/java/org/onap/aai/queries/GetCustomQueryConfig.java b/aai-queries/src/main/java/org/onap/aai/queries/GetCustomQueryConfig.java index 07f7724..f9cebf2 100644 --- a/aai-queries/src/main/java/org/onap/aai/queries/GetCustomQueryConfig.java +++ b/aai-queries/src/main/java/org/onap/aai/queries/GetCustomQueryConfig.java @@ -20,7 +20,11 @@ package org.onap.aai.queries; -import com.google.gson.*; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import com.google.gson.reflect.TypeToken; import java.lang.reflect.Type; @@ -38,16 +42,12 @@ public class GetCustomQueryConfig { private final static String STORED_QUERIES_CONFIG = "stored-queries"; private final static String STORED_QUERY_CONFIG = "stored-query"; - // public static final String AAI_HOME_ETC_QUERY_JSON = AAIConstants.AAI_HOME_ETC + "query" + - // AAIConstants.AAI_FILESEP + "stored-queries.json"; - public GetCustomQueryConfig(String customQueryJson) { init(customQueryJson); } private void init(String customQueryJson) { - JsonParser parser = new JsonParser(); - JsonObject queriesObject = parser.parse(customQueryJson).getAsJsonObject(); + JsonObject queriesObject = JsonParser.parseString(customQueryJson).getAsJsonObject(); if (queriesObject.has(STORED_QUERIES_CONFIG)) { storedQueries = queriesObject.getAsJsonArray(STORED_QUERIES_CONFIG); diff --git a/aai-queries/src/test/java/org/onap/aai/queries/AAISetup.java b/aai-queries/src/test/java/org/onap/aai/queries/AAISetup.java index 2ca90ea..99d74a1 100644 --- a/aai-queries/src/test/java/org/onap/aai/queries/AAISetup.java +++ b/aai-queries/src/test/java/org/onap/aai/queries/AAISetup.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertNotNull; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.Charset; import java.util.Map; import org.apache.commons.io.IOUtils; @@ -108,7 +109,7 @@ public abstract class AAISetup { String message = String.format("Unable to find the %s in src/test/resources", filename); assertNotNull(message, inputStream); - String resource = IOUtils.toString(inputStream); + String resource = IOUtils.toString(inputStream, Charset.defaultCharset()); return resource; } } diff --git a/aai-queries/src/test/java/org/onap/aai/queries/OnapQueryTest.java b/aai-queries/src/test/java/org/onap/aai/queries/OnapQueryTest.java index 7c766c9..84051b0 100644 --- a/aai-queries/src/test/java/org/onap/aai/queries/OnapQueryTest.java +++ b/aai-queries/src/test/java/org/onap/aai/queries/OnapQueryTest.java @@ -24,16 +24,7 @@ import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; import static org.mockito.Mockito.when; -import com.google.gson.Gson; -import com.google.gson.stream.JsonReader; -import com.jayway.jsonpath.JsonPath; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; import java.io.IOException; -import java.nio.charset.Charset; -import java.nio.file.Files; import java.util.*; import java.util.stream.Collectors; @@ -42,7 +33,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; -import org.json.JSONObject; import org.junit.Before; import org.junit.BeforeClass; import org.junit.ClassRule; @@ -61,7 +51,6 @@ import org.onap.aai.introspection.Loader; import org.onap.aai.introspection.LoaderFactory; import org.onap.aai.introspection.ModelType; import org.onap.aai.nodes.NodeIngestor; -import org.onap.aai.queries.GremlinServerSingleton; import org.onap.aai.query.builder.GremlinTraversal; import org.onap.aai.restcore.search.GremlinGroovyShell; import org.onap.aai.restcore.search.GroovyQueryBuilder; |