Integrate aai-schema-ingest library into aai-core
[aai/aai-common.git] / aai-core / src / test / java / org / onap / aai / parsers / query / UniqueURIQueryTest.java
index 84e9c6b..5c31fd0 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.parsers.query;
 
@@ -29,12 +27,11 @@ import org.junit.Ignore;
 import org.junit.Test;
 import org.onap.aai.AAISetup;
 import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.introspection.LoaderFactory;
-import org.onap.aai.introspection.ModelInjestor;
+
 import org.onap.aai.introspection.ModelType;
-import org.onap.aai.introspection.Version;
+import org.onap.aai.setup.SchemaVersion;
 import org.onap.aai.serialization.engines.QueryStyle;
-import org.onap.aai.serialization.engines.TitanDBEngine;
+import org.onap.aai.serialization.engines.JanusGraphDBEngine;
 import org.onap.aai.serialization.engines.TransactionalGraphEngine;
 
 import javax.ws.rs.core.UriBuilder;
@@ -46,13 +43,10 @@ import static org.junit.Assert.assertEquals;
 @Ignore
 public class UniqueURIQueryTest extends AAISetup {
 
-       private ModelInjestor injestor = ModelInjestor.getInstance();
-       private TransactionalGraphEngine dbEngine = 
-                       new TitanDBEngine(QueryStyle.GREMLIN_UNIQUE, 
-                               LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8),
-                               false);
-       private final Version version = Version.v8;
-       private DynamicJAXBContext context = injestor.getContextForVersion(version);
+
+       private TransactionalGraphEngine dbEngine;
+       private SchemaVersion version;
+       private DynamicJAXBContext context = nodeIngestor.getContextForVersion(version);
        
        /**
         * Parent query.
@@ -62,6 +56,10 @@ public class UniqueURIQueryTest extends AAISetup {
         */
        @Test
     public void parentQuery() throws UnsupportedEncodingException, AAIException {
+           version = new SchemaVersion("v8");
+           dbEngine = new JanusGraphDBEngine(QueryStyle.GREMLIN_UNIQUE,
+                               loaderFactory.createLoaderForVersion(ModelType.MOXY, version),
+                               false);
                URI uri = UriBuilder.fromPath("cloud-infrastructure/complexes/complex/key1").build();
                String key = "complex/key1";
                QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri);
@@ -150,7 +148,7 @@ public class UniqueURIQueryTest extends AAISetup {
                String parentKey = "vce/key1/port-group/key2";
                URI uri = UriBuilder.fromPath(parentURI + "/cvlan-tags").build();
                QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri);
-               GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start().has("aai-unique-key", parentKey).out("hasCTag").has("aai-node-type", "cvlan-tag");
+               GraphTraversal<Vertex, Vertex> expected = __.<Vertex>start().has("aai-unique-key", parentKey).in("org.onap.relationships.inventory.BelongsTo").has("aai-node-type", "cvlan-tag");
                GraphTraversal<Vertex, Vertex> parentExpected = __.<Vertex>start().has("aai-unique-key",parentKey);
                String parentResultType = "port-group";
                String resultType = "cvlan-tag";