2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * Copyright © 2017 Amdocs
\r
7 * ================================================================================
\r
8 * Licensed under the Apache License, Version 2.0 (the "License");
\r
9 * you may not use this file except in compliance with the License.
\r
10 * You may obtain a copy of the License at
\r
12 * http://www.apache.org/licenses/LICENSE-2.0
\r
14 * Unless required by applicable law or agreed to in writing, software
\r
15 * distributed under the License is distributed on an "AS IS" BASIS,
\r
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
17 * See the License for the specific language governing permissions and
\r
18 * limitations under the License.
\r
19 * ============LICENSE_END=========================================================
\r
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
23 package org.onap.aai.sparky.search;
\r
25 import java.util.HashMap;
\r
26 import java.util.Map;
\r
28 import javax.json.JsonArray;
\r
29 import javax.json.JsonObject;
\r
31 import org.junit.Assert;
\r
32 import org.junit.Test;
\r
33 import org.onap.aai.sparky.search.VnfSearchQueryBuilder;
\r
35 public class VnfSearchQueryBuilderTest {
\r
38 public void testCreateSuggestionsQuery() {
\r
39 String maxResults = "maxResults-1";
\r
40 String queryStr = "queryStr-1";
\r
41 JsonObject object = VnfSearchQueryBuilder.createSuggestionsQuery(maxResults, queryStr);
\r
42 Assert.assertNotNull(object);
\r
46 public void testSortCriteria() {
\r
47 JsonArray array = VnfSearchQueryBuilder.getSortCriteria("field-1", "sortOrder-1");
\r
48 Assert.assertNotNull(array);
\r
52 public void testCreateEntityCountsQuery_SingleAttribute() {
\r
53 Map<String, String> attributes = new HashMap<>();
\r
54 attributes.put("key-1", "value-1");
\r
55 JsonObject object = VnfSearchQueryBuilder.createEntityCountsQuery(attributes);
\r
56 Assert.assertNotNull(object);
\r
60 public void testCreateSummaryByEntityTypeQuery_Single() {
\r
61 Map<String, String> attributes = new HashMap<>();
\r
62 attributes.put("key-1", "value-1");
\r
64 VnfSearchQueryBuilder.createSummaryByEntityTypeQuery(attributes, "groupkey-1");
\r
65 Assert.assertNotNull(object);
\r
69 public void testCreateSummaryByEntityTypeQuery_Multiple() {
\r
70 Map<String, String> attributes = new HashMap<>();
\r
71 attributes.put("key-1", "value-1");
\r
72 attributes.put("key-2", "value-2");
\r
74 VnfSearchQueryBuilder.createSummaryByEntityTypeQuery(attributes, "groupkey-1");
\r
75 Assert.assertNotNull(object);
\r