Integrate aai-schema-ingest library into aai-core
[aai/aai-common.git] / aai-core / src / test / java / org / onap / aai / parsers / query / GraphTraversalTest.java
index 968adb3..d452b00 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,15 +27,15 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
 import org.onap.aai.AAISetup;
 import org.onap.aai.db.props.AAIProperties;
 import org.onap.aai.exceptions.AAIException;
-import org.onap.aai.introspection.LoaderFactory;
 import org.onap.aai.introspection.ModelType;
-import org.onap.aai.introspection.Version;
 import org.onap.aai.rest.RestTokens;
 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.MultivaluedHashMap;
@@ -46,6 +44,8 @@ import javax.ws.rs.core.UriBuilder;
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.List;
 
 import static org.hamcrest.CoreMatchers.containsString;
@@ -53,13 +53,25 @@ import static org.hamcrest.Matchers.hasProperty;
 import static org.hamcrest.Matchers.is;
 import static org.junit.Assert.assertEquals;
 
+@RunWith(value = Parameterized.class)
 public class GraphTraversalTest extends AAISetup {
 
        private TransactionalGraphEngine dbEngine;
        private TransactionalGraphEngine dbEnginev9;
+
+       @Parameterized.Parameter(value = 0)
+       public QueryStyle queryStyle;
+
+       @Parameterized.Parameters(name = "QueryStyle.{0}")
+       public static Collection<Object[]> data() {
+               return Arrays.asList(new Object[][]{
+                               {QueryStyle.TRAVERSAL},
+                               {QueryStyle.TRAVERSAL_URI}
+               });
+       }
+
+       @Rule public ExpectedException thrown = ExpectedException.none();
        
-       @Rule
-       public ExpectedException thrown = ExpectedException.none();
        
        /**
         * Configure.
@@ -70,13 +82,13 @@ public class GraphTraversalTest extends AAISetup {
        @Before
        public void configure() throws Exception {
                dbEngine =
-                               new TitanDBEngine(QueryStyle.TRAVERSAL, 
-                                       LoaderFactory.createLoaderForVersion(ModelType.MOXY, AAIProperties.LATEST),
+                               new JanusGraphDBEngine(queryStyle,
+                                       loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion()),
                                        false);
                
                dbEnginev9 = 
-                               new TitanDBEngine(QueryStyle.TRAVERSAL, 
-                                       LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v9),
+                               new JanusGraphDBEngine(queryStyle,
+                                       loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDepthVersion()),
                                        false);
        }