2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
 
   6  * ================================================================================
 
   7  * Licensed under the Apache License, Version 2.0 (the "License");
 
   8  * you may not use this file except in compliance with the License.
 
   9  * You may obtain a copy of the License at
 
  11  *    http://www.apache.org/licenses/LICENSE-2.0
 
  13  * Unless required by applicable law or agreed to in writing, software
 
  14  * distributed under the License is distributed on an "AS IS" BASIS,
 
  15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  16  * See the License for the specific language governing permissions and
 
  17  * limitations under the License.
 
  18  * ============LICENSE_END=========================================================
 
  20  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
 
  22 package org.onap.aai.rest.search;
 
  26 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 
  27 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 
  28 import org.apache.tinkerpop.gremlin.structure.T;
 
  29 import org.apache.tinkerpop.gremlin.structure.Vertex;
 
  30 import org.junit.Test;
 
  32 import org.onap.aai.exceptions.AAIException;
 
  33 import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
 
  35 public class CloudRegionfromCountryCloudRegionVersionQueryTest extends QueryTest {
 
  36         public CloudRegionfromCountryCloudRegionVersionQueryTest() throws AAIException, NoEdgeRuleFoundException {
 
  46         protected void createGraph() throws AAIException, NoEdgeRuleFoundException {    
 
  48                 Vertex complex = graph.addVertex(T.label, "complex", T.id, "0", "aai-node-type", "complex", "physical-location-id", "physical-location-id-1","country","country1");
 
  49                 Vertex cloudregion = graph.addVertex(T.label, "cloud-region", T.id, "1", "aai-node-type", "cloud-region", "cloud-region-id", "cloud-region-id-1", "cloud-region-owner", "cloud-owner-name-1","cloud-region-version","cloud-region-version-1");
 
  52                 Vertex complex1 = graph.addVertex(T.label, "complex", T.id, "2", "aai-node-type", "complex", "physical-location-id", "physical-location-id-2","country","country2");
 
  53                 Vertex cloudregion1 = graph.addVertex(T.label, "cloud-region", T.id, "3", "aai-node-type", "cloud-region", "cloud-region-id", "cloud-region-id-2", "cloud-region-owner", "cloud-owner-name-2","cloud-region-version","cloud-region-version-2");
 
  55                 GraphTraversalSource g = graph.traversal();
 
  56                 rules.addEdge(g, complex,cloudregion);
 
  58                 rules.addEdge(g, complex1,cloudregion1);
 
  60                 expectedResult.add(cloudregion);
 
  65         protected String getQueryName() {
 
  66                 return  "cloudRegion-fromCountryCloudRegionVersion";
 
  69         protected void addStartNode(GraphTraversal<Vertex, Vertex> g) {
 
  70                 g.has("aai-node-type", "complex").has("country", "country1");
 
  74         protected void addParam(Map<String, Object> params) {
 
  75                 params.put("cloudRegionVersion", "cloud-region-version-1");