Integrate aai-schema-ingest library into aai-core
[aai/aai-common.git] / aai-core / src / test / java / org / onap / aai / query / builder / SimplePathTest.java
index 4dfe2db..68340fd 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-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.
@@ -16,8 +16,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
  */
 package org.onap.aai.query.builder;
 
@@ -29,25 +27,30 @@ import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.aai.AAISetup;
+import org.onap.aai.edges.enums.EdgeType;
 import org.onap.aai.exceptions.AAIException;
 import org.onap.aai.introspection.Loader;
-import org.onap.aai.introspection.LoaderFactory;
 import org.onap.aai.introspection.ModelType;
-import org.onap.aai.introspection.Version;
-import org.onap.aai.serialization.db.EdgeRules;
-import org.onap.aai.serialization.db.EdgeType;
 
+import org.onap.aai.serialization.db.EdgeSerializer;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.annotation.DirtiesContext;
 import java.util.List;
 
 import static org.junit.Assert.assertTrue;
 
+
+@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
 public class SimplePathTest extends AAISetup {
 
        public Loader loader;
        
+       @Autowired
+       EdgeSerializer edgeSer;
+       
        @Before
        public void setup() throws Exception {
-               loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.getLatest());
+               loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion());
        }
 
        private QueryBuilder<Vertex> buildTestQuery(QueryBuilder<Vertex> qb) throws AAIException {
@@ -65,7 +68,6 @@ public class SimplePathTest extends AAISetup {
        private GraphTraversalSource setupGraph() throws AAIException{
                Graph graph = TinkerGraph.open();
                GraphTraversalSource g = graph.traversal();
-               EdgeRules rules = EdgeRules.getInstance();
                
                Vertex gvnf1 = graph.addVertex(T.label, "generic-vnf", T.id, "00", "aai-node-type", "generic-vnf", 
                                "vnf-id", "gvnf1", "vnf-name", "genvnfname1", "nf-type", "sample-nf-type");
@@ -85,11 +87,11 @@ public class SimplePathTest extends AAISetup {
                Vertex gvnf2 = graph.addVertex(T.label, "generic-vnf", T.id, "01", "aai-node-type", "generic-vnf", 
                                "vnf-id", "gvnf2", "vnf-name", "genvnfname2", "nf-type", "sample-nf-type");
                
-               rules.addTreeEdge(g, gvnf1, lint1);
-               rules.addEdge(g, lint1, loglink1);
-               rules.addEdge(g, loglink1, lint2);
-               rules.addEdge(g, loglink1, lint3);
-               rules.addTreeEdge(g, gvnf2, lint3);
+               edgeSer.addTreeEdge(g, gvnf1, lint1);
+               edgeSer.addEdge(g, lint1, loglink1);
+               edgeSer.addEdge(g, loglink1, lint2);
+               edgeSer.addEdge(g, loglink1, lint3);
+               edgeSer.addTreeEdge(g, gvnf2, lint3);
                
                return g;
        }