Update the license for 2017-2018 license
[aai/traversal.git] / aai-traversal / src / test / java / org / onap / aai / rest / search / CloudRegionfromCountryQueryTest.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017-2018 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
10  *
11  *    http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  */
20 package org.onap.aai.rest.search;
21
22 import java.util.Map;
23
24 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
25 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
26 import org.apache.tinkerpop.gremlin.structure.T;
27 import org.apache.tinkerpop.gremlin.structure.Vertex;
28 import org.junit.Test;
29
30 import org.onap.aai.exceptions.AAIException;
31 import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
32
33 public class CloudRegionfromCountryQueryTest extends QueryTest {
34         public CloudRegionfromCountryQueryTest() throws AAIException, NoEdgeRuleFoundException {
35                 super();
36         }
37
38         @Test
39         public void run() {
40                 super.run();
41         }
42
43         @Override
44         protected void createGraph() throws AAIException, NoEdgeRuleFoundException {    
45                 
46                 Vertex complex = graph.addVertex(T.label, "complex", T.id, "0", "aai-node-type", "complex", "physical-location-id", "physical-location-id-1");
47                 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");
48                 
49                 
50                 Vertex complex1 = graph.addVertex(T.label, "complex", T.id, "2", "aai-node-type", "complex", "physical-location-id", "physical-location-id-2");
51                 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");
52                 
53                 GraphTraversalSource g = graph.traversal();
54                 rules.addEdge(g, complex,cloudregion);
55                 
56                 rules.addEdge(g, complex1,cloudregion1);
57                 
58                 expectedResult.add(cloudregion);
59                 
60         }
61
62         @Override
63         protected String getQueryName() {
64                 return  "cloudRegion-fromCountry";
65         }
66         @Override
67         protected void addStartNode(GraphTraversal<Vertex, Vertex> g) {
68                 g.has("physical-location-id", "physical-location-id-1");
69                 
70         }
71         @Override
72         protected void addParam(Map<String, Object> params) {
73                 return;
74         }
75 }