diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-02-23 17:01:49 +0100 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-02-26 09:01:48 +0100 |
commit | e5b5a5e4d7cae28a72641aae6f5f6099db1ed695 (patch) | |
tree | a6038e4ae2abd00465697c4e2d2dcdef45aa9dc0 /aai-traversal/src/test/java/org/onap | |
parent | 26c4ef2510d0736ae9a18c8eac2ea2406a83092d (diff) |
Do not use reflection for injecting the DslQueryProcessors
- trade terseness for easier understanding of the code and maintainability
- Split up DslQueryProcessor in two separate classes (v1 and v2)
Issue-ID: AAI-3786
Change-Id: I7fe0411f6b694eb82616ac4a61a5376c630b5b2a
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'aai-traversal/src/test/java/org/onap')
4 files changed, 20 insertions, 10 deletions
diff --git a/aai-traversal/src/test/java/org/onap/aai/AAISetup.java b/aai-traversal/src/test/java/org/onap/aai/AAISetup.java index e1cbe45..7849671 100644 --- a/aai-traversal/src/test/java/org/onap/aai/AAISetup.java +++ b/aai-traversal/src/test/java/org/onap/aai/AAISetup.java @@ -37,6 +37,9 @@ import org.onap.aai.introspection.MoxyLoader; import org.onap.aai.nodes.NodeIngestor; import org.onap.aai.rest.db.HttpEntry; import org.onap.aai.rest.dsl.DslQueryProcessor; +import org.onap.aai.rest.dsl.V1DslQueryProcessor; +import org.onap.aai.rest.dsl.V2DslQueryProcessor; +import org.onap.aai.rest.dsl.v1.DslListener; import org.onap.aai.rest.search.GremlinServerSingleton; import org.onap.aai.serialization.db.EdgeSerializer; import org.onap.aai.setup.AAIConfigTranslator; @@ -53,9 +56,8 @@ import org.springframework.test.context.junit4.rules.SpringMethodRule; @ContextConfiguration( classes = {ConfigConfiguration.class, AAIConfigTranslator.class, EdgeIngestor.class, EdgeSerializer.class, NodeIngestor.class, SpringContextAware.class, - IntrospectionConfig.class, RestBeanConfig.class, SearchConfiguration.class, - DslConfiguration.class, XmlFormatTransformerConfiguration.class, - GremlinServerSingleton.class}) + IntrospectionConfig.class, RestBeanConfig.class, SearchConfiguration.class, XmlFormatTransformerConfiguration.class, + GremlinServerSingleton.class, V1DslQueryProcessor.class, V2DslQueryProcessor.class, DslListener.class, org.onap.aai.rest.dsl.v2.DslListener.class}) @TestPropertySource( properties = {"schema.uri.base.path = /aai", "schema.ingest.file = src/test/resources/application-test.properties"}) @@ -85,9 +87,6 @@ public abstract class AAISetup { protected EdgeIngestor edgeIngestor; @Autowired - protected DslQueryProcessor dslQueryProcessor; - - @Autowired protected SchemaVersions schemaVersions; @Autowired diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/dsl/DslQueryProcessorV1Test.java b/aai-traversal/src/test/java/org/onap/aai/rest/dsl/DslQueryProcessorV1Test.java index 8d90b5e..d25596d 100644 --- a/aai-traversal/src/test/java/org/onap/aai/rest/dsl/DslQueryProcessorV1Test.java +++ b/aai-traversal/src/test/java/org/onap/aai/rest/dsl/DslQueryProcessorV1Test.java @@ -22,10 +22,6 @@ package org.onap.aai.rest.dsl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; @@ -33,11 +29,16 @@ import org.junit.rules.ExpectedException; import org.onap.aai.AAISetup; import org.onap.aai.exceptions.AAIException; import org.onap.aai.rest.enums.QueryVersion; +import org.springframework.beans.factory.annotation.Autowired; /** * The Class DslMain. */ public class DslQueryProcessorV1Test extends AAISetup { + + @Autowired + V1DslQueryProcessor dslQueryProcessor; + @Rule public ExpectedException expectedEx = ExpectedException.none(); diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/dsl/DslQueryProcessorV2Test.java b/aai-traversal/src/test/java/org/onap/aai/rest/dsl/DslQueryProcessorV2Test.java index 6d3d69c..944ada3 100644 --- a/aai-traversal/src/test/java/org/onap/aai/rest/dsl/DslQueryProcessorV2Test.java +++ b/aai-traversal/src/test/java/org/onap/aai/rest/dsl/DslQueryProcessorV2Test.java @@ -28,11 +28,16 @@ import org.junit.rules.ExpectedException; import org.onap.aai.AAISetup; import org.onap.aai.exceptions.AAIException; import org.onap.aai.rest.enums.QueryVersion; +import org.springframework.beans.factory.annotation.Autowired; /** * The Class DslMain. */ public class DslQueryProcessorV2Test extends AAISetup { + + @Autowired + V2DslQueryProcessor dslQueryProcessor; + @Rule public ExpectedException expectedEx = ExpectedException.none(); diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/dsl/ProdDslTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/dsl/ProdDslTest.java index a78bcde..0eccab9 100644 --- a/aai-traversal/src/test/java/org/onap/aai/rest/dsl/ProdDslTest.java +++ b/aai-traversal/src/test/java/org/onap/aai/rest/dsl/ProdDslTest.java @@ -26,11 +26,16 @@ import org.junit.Test; import org.onap.aai.AAISetup; import org.onap.aai.exceptions.AAIException; import org.onap.aai.rest.enums.QueryVersion; +import org.springframework.beans.factory.annotation.Autowired; // TODO: Change this to read queries and their builder equivalent from a file // TODO: Add queries run by SEs public class ProdDslTest extends AAISetup { + + @Autowired + protected V1DslQueryProcessor dslQueryProcessor; + @Ignore @Test public void msoQueryTest1() throws AAIException { |