2 * ============LICENSE_START=======================================================
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
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=========================================================
21 * ============LICENSE_START=======================================================
23 * ================================================================================
24 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
25 * ================================================================================
26 * Licensed under the Apache License, Version 2.0 (the "License");
27 * you may not use this file except in compliance with the License.
28 * You may obtain a copy of the License at
30 * http://www.apache.org/licenses/LICENSE-2.0
32 * Unless required by applicable law or agreed to in writing, software
33 * distributed under the License is distributed on an "AS IS" BASIS,
34 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35 * See the License for the specific language governing permissions and
36 * limitations under the License.
37 * ============LICENSE_END=========================================================
39 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
41 package org.onap.aai.rest.search;
43 import static org.junit.Assert.*;
45 import java.util.HashMap;
48 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
49 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
50 import org.apache.tinkerpop.gremlin.structure.T;
51 import org.apache.tinkerpop.gremlin.structure.Vertex;
52 import org.junit.Test;
53 import org.onap.aai.exceptions.AAIException;
54 import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
56 public class CountVnfByVnfTypeTest extends QueryTest {
58 public CountVnfByVnfTypeTest() throws AAIException, NoEdgeRuleFoundException {
68 protected void createGraph() throws AAIException, NoEdgeRuleFoundException {
69 //Set up the test graph
70 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");
71 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");
72 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");
73 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");
74 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");
75 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");
76 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");
78 GraphTraversalSource g = graph.traversal();
80 expectedResultForMaps = expectedResultForMaps + "[A=4, B=2, C=1]";
84 protected String getQueryName() {
85 return "count-vnf-byVnfType";
90 protected void addStartNode(GraphTraversal<Vertex, Vertex> g) {
95 protected void addParam(Map<String, Object> params) {