Convert Sparky to Spring-Boot
[aai/sparky-be.git] / sparkybe-onap-service / src / test / java / org / onap / aai / sparky / dal / sas / entity / SearchAbstractionEntityBuilder.java
1 /**
2  * ============LICENSE_START===================================================
3  * SPARKY (AAI UI service)
4  * ============================================================================
5  * Copyright © 2017 AT&T Intellectual Property.
6  * Copyright © 2017 Amdocs
7  * All rights reserved.
8  * ============================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=====================================================
21  *
22  * ECOMP and OpenECOMP are trademarks
23  * and service marks of AT&T Intellectual Property.
24  */
25 package org.onap.aai.sparky.dal.sas.entity;
26
27 import java.util.ArrayList;
28 import java.util.List;
29
30 public class SearchAbstractionEntityBuilder {
31
32    
33   public static HitEntity getHitSample1() {
34  
35     HitEntity hitEntity = new HitEntity();
36     DocumentEntity doc = new DocumentEntity();
37
38     hitEntity.setDocument(doc);
39     hitEntity.setScore("17.073963");
40
41     doc.addContent("entityPrimaryKeyValue", "example-vnf-id-val-4394");
42     doc.addContent("entityType",            "vpe");
43     doc.addContent("searchTags",            "example-vnf-id-val-4394;example-vnf-name-val-4394;example-vnf-name2-val-4394");
44     doc.addContent("link",                  "https://ext1.test.onap.com:8443/aai/v9/network/vpes/vpe/example-vnf-id-val-4394");
45     doc.addContent("searchTagIDs",          "0;1;2");
46     doc.addContent("lastmodTimestamp",      "2017-04-18T17:20:48.072-0400");
47
48     doc.setUrl("services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/e317a35256717f10e88d1b2c995efcdddfc911bf350c73e37e8afca6dfb11553");
49     doc.setEtag("1");
50
51
52     return hitEntity;
53
54   }
55   
56   public static HitEntity getHitSample2() {
57
58     HitEntity hitEntity = new HitEntity();
59     DocumentEntity doc = new DocumentEntity();
60
61     hitEntity.setDocument(doc);
62     hitEntity.setScore("17.073963");
63
64     doc.addContent("entityPrimaryKeyValue", "vpe-vnf-id-team4-11");
65     doc.addContent("entityType",            "vpe");
66     doc.addContent("searchTags",            "vpe-vnf-id-team4-11;example-vnf-name-val-9512;example-vnf-name2-val-9512");
67     doc.addContent("link",                  "https://ext1.test.onap.com:8443/aai/v9/network/vpes/vpe/vpe-vnf-id-team4-11");
68     doc.addContent("searchTagIDs",          "0;1;2");
69     doc.addContent("lastmodTimestamp",      "2017-04-18T17:20:48.175-0400");
70
71     doc.setUrl("services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/80f6d1a252e047e50e0adbeb90ad30876bb5b63cf70c9dd53f3fe46aeb50c74b");
72     doc.setEtag("1");
73
74
75     return hitEntity;
76
77   }
78   
79   public static HitEntity getHitSample3() {
80
81     HitEntity hitEntity = new HitEntity();
82     DocumentEntity doc = new DocumentEntity();
83
84     hitEntity.setDocument(doc);
85     hitEntity.setScore("17.030035");
86
87     doc.addContent("entityPrimaryKeyValue", "example-vnf-id-val-6176");
88     doc.addContent("entityType",            "generic-vnf");
89     doc.addContent("searchTags",            "example-vnf-id-val-6176;example-vnf-name-val-6176;example-vnf-name2-val-6176");
90     doc.addContent("link",                  "https://ext1.test.onap.com:8443/aai/v9/network/generic-vnfs/generic-vnf/example-vnf-id-val-6176");
91     doc.addContent("searchTagIDs",          "0;1;2");
92     doc.addContent("lastmodTimestamp",      "2017-04-18T17:29:39.889-0400");
93
94     doc.setUrl("services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/8dfd1136f943296508fee11efcda35a0719aa490aa60e9abffecce0b220d8c94");
95     doc.setEtag("1");
96
97
98     return hitEntity;
99
100   }
101   
102   public static HitEntity getHitSample4() {
103
104     HitEntity hitEntity = new HitEntity();
105     DocumentEntity doc = new DocumentEntity();
106
107     hitEntity.setDocument(doc);
108     hitEntity.setScore("17.01174");
109
110     doc.addContent("entityPrimaryKeyValue", "vnf-id-team4-11");
111     doc.addContent("entityType",            "newvce");
112     doc.addContent("searchTags",            "vnf-id-team4-11;example-vnf-name-val-5313;example-vnf-name2-val-5313");
113     doc.addContent("link",                  "https://ext1.test.onap.com:8443/aai/v9/network/newvces/newvce/vnf-id-team4-11");
114     doc.addContent("searchTagIDs",          "0;1;2");
115     doc.addContent("lastmodTimestamp",      "2017-04-18T17:21:08.142-0400");
116
117     doc.setUrl("services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/83dcab92d75b20eb94578039c8cec5e7b6b4717791e3c367d8af5069ce76dc90");
118     doc.setEtag("1");
119
120
121     return hitEntity;
122
123   }
124   
125   public static HitEntity getHitSample5() {
126
127     HitEntity hitEntity = new HitEntity();
128     DocumentEntity doc = new DocumentEntity();
129
130     hitEntity.setDocument(doc);
131     hitEntity.setScore("17.01174");
132
133     doc.addContent("entityPrimaryKeyValue", "example-vnf-id2-val-9501");
134     doc.addContent("entityType",            "newvce");
135     doc.addContent("searchTags",            "example-vnf-id2-val-9501;example-vnf-name-val-9501;example-vnf-name2-val-9501");
136     doc.addContent("link",                  "https://ext1.test.onap.com:8443/aai/v9/network/newvces/newvce/example-vnf-id2-val-9501");
137     doc.addContent("searchTagIDs",          "0;1;2");
138     doc.addContent("lastmodTimestamp",      "2017-04-18T17:21:23.323-0400");
139
140     doc.setUrl("services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/461816ba8aa94d01f2c978999b843dbaf10e0509db58d1945d6f5999d6db8f5e");
141     doc.setEtag("1");
142
143
144     return hitEntity;
145
146   }
147   
148   public static HitEntity getHitSample6() {
149
150     HitEntity hitEntity = new HitEntity();
151     DocumentEntity doc = new DocumentEntity();
152
153     hitEntity.setDocument(doc);
154     hitEntity.setScore("17.01174");
155
156     doc.addContent("entityPrimaryKeyValue", "vnf-id-dm-auto-10");
157     doc.addContent("entityType",            "vce");
158     doc.addContent("searchTags",            "vpe-id-dm-auto-10;vnf-id-dm-auto-10;vnf-name-dm-auto-10;vnf-name2-dm-auto-10");
159     doc.addContent("link",                  "https://ext1.test.onap.com:8443/aai/v9/network/vces/vce/vnf-id-dm-auto-10");
160     doc.addContent("searchTagIDs",          "0;1;2;3");
161     doc.addContent("lastmodTimestamp",      "2017-04-18T17:24:57.209-0400");
162
163     doc.setUrl("services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/1ead4512e65ee0eafb24e0156cc1abdf97368f08dfe065f02580aa09661bbcd8");
164     doc.setEtag("1");
165
166
167     return hitEntity;
168
169   }
170   
171   public static HitEntity getHitSample7() {
172
173     HitEntity hitEntity = new HitEntity();
174     DocumentEntity doc = new DocumentEntity();
175
176     hitEntity.setDocument(doc);
177     hitEntity.setScore("13.940832");
178
179     doc.addContent("entityPrimaryKeyValue", "e3e59c5b-ad48-44d0-b3e4-80eacdcee4c7");
180     doc.addContent("entityType",            "generic-vnf");
181     doc.addContent("searchTags",            "e3e59c5b-ad48-44d0-b3e4-80eacdcee4c7;VNF_Test_vNF_modules_01");
182     doc.addContent("link",                  "https://ext1.test.onap.com:8443/aai/v9/network/generic-vnfs/generic-vnf/e3e59c5b-ad48-44d0-b3e4-80eacdcee4c7");
183     doc.addContent("searchTagIDs",          "0;1");
184     doc.addContent("lastmodTimestamp",      "2017-04-18T17:26:34.603-0400");
185
186     doc.setUrl("services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/1462582e8fd7786f72f26548e4247b72ab6cd101cca0bbb68a60dd3ad16500d0");
187     doc.setEtag("1");
188
189
190     return hitEntity;
191
192   }
193   
194   public static HitEntity getHitSample8() {
195
196     HitEntity hitEntity = new HitEntity();
197     DocumentEntity doc = new DocumentEntity();
198
199     hitEntity.setDocument(doc);
200     hitEntity.setScore("13.940832");
201
202     doc.addContent("entityPrimaryKeyValue", "fusion-jitsi-vnf-001");
203     doc.addContent("entityType",            "generic-vnf");
204     doc.addContent("searchTags",            "fusion-jitsi-vnf-001;fusion-jitsi-vnf");
205     doc.addContent("link",                  "https://ext1.test.onap.com:8443/aai/v9/network/generic-vnfs/generic-vnf/fusion-jitsi-vnf-001");
206     doc.addContent("searchTagIDs",          "0;1");
207     doc.addContent("lastmodTimestamp",      "2017-04-18T17:28:14.293-0400");
208
209     doc.setUrl("services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/b79ddfec9a00184445174c91e7490a0d407f351983bba4ae53bfec0584f73ee3");
210     doc.setEtag("1");
211
212
213     return hitEntity;
214
215   }
216   
217   public static HitEntity getHitSample9() {
218
219     HitEntity hitEntity = new HitEntity();
220     DocumentEntity doc = new DocumentEntity();
221
222     hitEntity.setDocument(doc);
223     hitEntity.setScore("13.940832");
224
225     doc.addContent("entityPrimaryKeyValue", "vnfm0003v");
226     doc.addContent("entityType",            "generic-vnf");
227     doc.addContent("searchTags",            "vnfm0003v;vnfm0003v");
228     doc.addContent("link",                  "https://ext1.test.onap.com:8443/aai/v9/network/generic-vnfs/generic-vnf/vnfm0003v");
229     doc.addContent("searchTagIDs",          "0;1");
230     doc.addContent("lastmodTimestamp",      "2017-04-18T17:29:39.594-0400");
231
232     doc.setUrl("services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/52ae232ea5506d6de8ef35c4f46a1ceafe35f3717ff578b83531bc7615870b12");
233     doc.setEtag("1");
234
235
236     return hitEntity;
237
238   }
239   
240   public static HitEntity getHitSample10() {
241
242     HitEntity hitEntity = new HitEntity();
243     DocumentEntity doc = new DocumentEntity();
244
245     hitEntity.setDocument(doc);
246     hitEntity.setScore("13.928098");
247
248     doc.addContent("entityPrimaryKeyValue", "amist456vnf");
249     doc.addContent("entityType",            "generic-vnf");
250     doc.addContent("searchTags",            "amist456vnf;amist456vnf");
251     doc.addContent("link",                  "https://ext1.test.onap.com:8443/aai/v9/network/generic-vnfs/generic-vnf/amist456vnf");
252     doc.addContent("searchTagIDs",          "0;1");
253     doc.addContent("lastmodTimestamp",      "2017-04-18T17:28:28.163-0400");
254
255     doc.setUrl("services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/3424afea5963696380a0fdc78ee5320cf5fa9bc0459f1f9376db208d31196434");
256     doc.setEtag("1");
257
258
259     return hitEntity;
260
261   }
262   
263   
264   
265   public static SearchAbstractionResponse getSuccessfulEntitySearchResponse() {
266     
267     SearchAbstractionResponse sasResponse = new SearchAbstractionResponse();
268     
269     SearchResult searchResult = new SearchResult();
270     sasResponse.setSearchResult(searchResult);
271     
272     searchResult.setTotalHits(3257);
273     
274     List<HitEntity> hits = new ArrayList<HitEntity>();
275     
276     hits.add(getHitSample1());
277     hits.add(getHitSample2());
278     hits.add(getHitSample3());
279     hits.add(getHitSample4());
280     hits.add(getHitSample5());
281     hits.add(getHitSample6());
282     hits.add(getHitSample7());
283     hits.add(getHitSample8());
284     hits.add(getHitSample9());
285     hits.add(getHitSample10());
286     
287     searchResult.setHits(hits);
288     
289     return sasResponse;
290     
291   }
292   
293
294 }