Update the license for 2017-2018 license
[aai/traversal.git] / aai-traversal / src / test / java / org / onap / aai / rest / search / PserversWithNoComplexTest.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 import org.onap.aai.exceptions.AAIException;
30 import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
31
32 public class PserversWithNoComplexTest extends QueryTest {
33
34         public PserversWithNoComplexTest() 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                 Vertex pserver1 = graph.addVertex(T.label, "pserver", T.id, "1", "aai-node-type", "pserver", "hostname", "pservername1");
46                 Vertex pserver2 = graph.addVertex(T.label, "pserver", T.id, "2", "aai-node-type", "pserver", "hostname", "pservername2");
47                 Vertex pserver3 = graph.addVertex(T.label, "pserver", T.id, "3", "aai-node-type", "pserver", "hostname", "pservername3");
48                 Vertex pserver4 = graph.addVertex(T.label, "pserver", T.id, "4", "aai-node-type", "pserver", "hostname", "pservername4");
49                 Vertex pserver5 = graph.addVertex(T.label, "pserver", T.id, "5", "aai-node-type", "pserver", "hostname", "pservername5");
50                 Vertex complex1 = graph.addVertex(T.label, "complex", T.id, "6", "aai-node-type", "complex",
51                                 "physical-location-id", "physical-location-id-1", "country", "US");
52                 Vertex complex2 = graph.addVertex(T.label, "complex", T.id, "7", "aai-node-type", "complex",
53                                 "physical-location-id", "physical-location-id-2", "country", "USA");
54                 
55                 GraphTraversalSource g = graph.traversal();
56                 rules.addEdge(g, pserver4,complex1);
57                 rules.addEdge(g, pserver5,complex2);
58                 
59                 expectedResult.add(pserver1);
60                 expectedResult.add(pserver2);
61                 expectedResult.add(pserver3);
62         }
63
64         @Override
65         protected String getQueryName() {
66                 return "pservers-withNoComplex";
67         }
68
69         @Override
70         protected void addStartNode(GraphTraversal<Vertex, Vertex> g) {
71                 return;
72                 
73         }
74
75         @Override
76         protected void addParam(Map<String, Object> params) {
77                 return;
78         }
79
80 }