Sync logging context changes
[aai/traversal.git] / aai-traversal / src / test / java / org / onap / aai / rest / search / CountVnfByVnfTypeTest.java
1 /**
2 * ============LICENSE_START=======================================================
3 * org.onap.aai
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
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 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
21 */
22 package org.onap.aai.rest.search;
23
24 import static org.junit.Assert.*;
25
26 import java.util.HashMap;
27 import java.util.Map;
28
29 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
30 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
31 import org.apache.tinkerpop.gremlin.structure.T;
32 import org.apache.tinkerpop.gremlin.structure.Vertex;
33 import org.junit.Test;
34 import org.onap.aai.exceptions.AAIException;
35 import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
36
37 public class CountVnfByVnfTypeTest extends QueryTest {
38
39         public CountVnfByVnfTypeTest() throws AAIException, NoEdgeRuleFoundException {
40                 super();
41     }
42
43     @Test
44     public void test() {
45         super.run(true);
46     }
47
48     @Override
49         protected void createGraph() throws AAIException, NoEdgeRuleFoundException {
50                 //Set up the test graph
51             Vertex genericVnfTypeA1 = graph.addVertex(T.label, "genric-vnf", T.id, "1", "aai-node-type", "generic-vnf", "vnf-id", "vnf-id-1", "vnf-name", "vnf-name-1", "vnf-type", "A");
52             Vertex genericVnfTypeB1 = graph.addVertex(T.label, "genric-vnf", T.id, "2", "aai-node-type", "generic-vnf", "vnf-id", "vnf-id-2", "vnf-name", "vnf-name-2", "vnf-type", "B");
53             Vertex genericVnfTypeC1 = graph.addVertex(T.label, "genric-vnf", T.id, "3", "aai-node-type", "generic-vnf", "vnf-id", "vnf-id-3", "vnf-name", "vnf-name-3", "vnf-type", "C");
54             Vertex genericVnfTypeA2 = graph.addVertex(T.label, "genric-vnf", T.id, "4", "aai-node-type", "generic-vnf", "vnf-id", "vnf-id-4", "vnf-name", "vnf-name-4", "vnf-type", "A");
55             Vertex genericVnfTypeB2 = graph.addVertex(T.label, "genric-vnf", T.id, "5", "aai-node-type", "generic-vnf", "vnf-id", "vnf-id-5", "vnf-name", "vnf-name-5", "vnf-type", "B");
56             Vertex genericVnfTypeA3 = graph.addVertex(T.label, "genric-vnf", T.id, "6", "aai-node-type", "generic-vnf", "vnf-id", "vnf-id-6", "vnf-name", "vnf-name-6", "vnf-type", "A");
57             Vertex genericVnfTypeA4 = graph.addVertex(T.label, "genric-vnf", T.id, "7", "aai-node-type", "generic-vnf", "vnf-id", "vnf-id-7", "vnf-name", "vnf-name-7", "vnf-type", "A");
58             
59             GraphTraversalSource g = graph.traversal();
60             
61             expectedResultForMaps = expectedResultForMaps + "[A=4, B=2, C=1]";
62         }
63
64     @Override
65         protected String getQueryName() {
66                 return "count-vnf-byVnfType";
67         }
68
69
70     @Override
71     protected void addStartNode(GraphTraversal<Vertex, Vertex> g) {
72         return;
73     }
74
75     @Override
76     protected void addParam(Map<String, Object> params) {
77         return;
78     }
79
80 }