Adding UI extensibility
[aai/sparky-be.git] / 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",
44         "example-vnf-id-val-4394;example-vnf-name-val-4394;example-vnf-name2-val-4394");
45     doc.addContent("link",
46         "https://aai-ext1.test.att.com:8443/aai/v9/network/vpes/vpe/example-vnf-id-val-4394");
47     doc.addContent("searchTagIDs", "0;1;2");
48     doc.addContent("lastmodTimestamp", "2017-04-18T17:20:48.072-0400");
49
50     doc.setUrl(
51         "services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/e317a35256717f10e88d1b2c995efcdddfc911bf350c73e37e8afca6dfb11553");
52     doc.setEtag("1");
53
54
55     return hitEntity;
56
57   }
58
59   public static HitEntity getHitSample2() {
60
61     HitEntity hitEntity = new HitEntity();
62     DocumentEntity doc = new DocumentEntity();
63
64     hitEntity.setDocument(doc);
65     hitEntity.setScore("17.073963");
66
67     doc.addContent("entityPrimaryKeyValue", "vpe-vnf-id-team4-11");
68     doc.addContent("entityType", "vpe");
69     doc.addContent("searchTags",
70         "vpe-vnf-id-team4-11;example-vnf-name-val-9512;example-vnf-name2-val-9512");
71     doc.addContent("link",
72         "https://aai-ext1.test.att.com:8443/aai/v9/network/vpes/vpe/vpe-vnf-id-team4-11");
73     doc.addContent("searchTagIDs", "0;1;2");
74     doc.addContent("lastmodTimestamp", "2017-04-18T17:20:48.175-0400");
75
76     doc.setUrl(
77         "services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/80f6d1a252e047e50e0adbeb90ad30876bb5b63cf70c9dd53f3fe46aeb50c74b");
78     doc.setEtag("1");
79
80
81     return hitEntity;
82
83   }
84
85   public static HitEntity getHitSample3() {
86
87     HitEntity hitEntity = new HitEntity();
88     DocumentEntity doc = new DocumentEntity();
89
90     hitEntity.setDocument(doc);
91     hitEntity.setScore("17.030035");
92
93     doc.addContent("entityPrimaryKeyValue", "example-vnf-id-val-6176");
94     doc.addContent("entityType", "generic-vnf");
95     doc.addContent("searchTags",
96         "example-vnf-id-val-6176;example-vnf-name-val-6176;example-vnf-name2-val-6176");
97     doc.addContent("link",
98         "https://aai-ext1.test.att.com:8443/aai/v9/network/generic-vnfs/generic-vnf/example-vnf-id-val-6176");
99     doc.addContent("searchTagIDs", "0;1;2");
100     doc.addContent("lastmodTimestamp", "2017-04-18T17:29:39.889-0400");
101
102     doc.setUrl(
103         "services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/8dfd1136f943296508fee11efcda35a0719aa490aa60e9abffecce0b220d8c94");
104     doc.setEtag("1");
105
106
107     return hitEntity;
108
109   }
110
111   public static HitEntity getHitSample4() {
112
113     HitEntity hitEntity = new HitEntity();
114     DocumentEntity doc = new DocumentEntity();
115
116     hitEntity.setDocument(doc);
117     hitEntity.setScore("17.01174");
118
119     doc.addContent("entityPrimaryKeyValue", "vnf-id-team4-11");
120     doc.addContent("entityType", "newvce");
121     doc.addContent("searchTags",
122         "vnf-id-team4-11;example-vnf-name-val-5313;example-vnf-name2-val-5313");
123     doc.addContent("link",
124         "https://aai-ext1.test.att.com:8443/aai/v9/network/newvces/newvce/vnf-id-team4-11");
125     doc.addContent("searchTagIDs", "0;1;2");
126     doc.addContent("lastmodTimestamp", "2017-04-18T17:21:08.142-0400");
127
128     doc.setUrl(
129         "services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/83dcab92d75b20eb94578039c8cec5e7b6b4717791e3c367d8af5069ce76dc90");
130     doc.setEtag("1");
131
132
133     return hitEntity;
134
135   }
136
137   public static HitEntity getHitSample5() {
138
139     HitEntity hitEntity = new HitEntity();
140     DocumentEntity doc = new DocumentEntity();
141
142     hitEntity.setDocument(doc);
143     hitEntity.setScore("17.01174");
144
145     doc.addContent("entityPrimaryKeyValue", "example-vnf-id2-val-9501");
146     doc.addContent("entityType", "newvce");
147     doc.addContent("searchTags",
148         "example-vnf-id2-val-9501;example-vnf-name-val-9501;example-vnf-name2-val-9501");
149     doc.addContent("link",
150         "https://aai-ext1.test.att.com:8443/aai/v9/network/newvces/newvce/example-vnf-id2-val-9501");
151     doc.addContent("searchTagIDs", "0;1;2");
152     doc.addContent("lastmodTimestamp", "2017-04-18T17:21:23.323-0400");
153
154     doc.setUrl(
155         "services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/461816ba8aa94d01f2c978999b843dbaf10e0509db58d1945d6f5999d6db8f5e");
156     doc.setEtag("1");
157
158
159     return hitEntity;
160
161   }
162
163   public static HitEntity getHitSample6() {
164
165     HitEntity hitEntity = new HitEntity();
166     DocumentEntity doc = new DocumentEntity();
167
168     hitEntity.setDocument(doc);
169     hitEntity.setScore("17.01174");
170
171     doc.addContent("entityPrimaryKeyValue", "vnf-id-dm-auto-10");
172     doc.addContent("entityType", "vce");
173     doc.addContent("searchTags",
174         "vpe-id-dm-auto-10;vnf-id-dm-auto-10;vnf-name-dm-auto-10;vnf-name2-dm-auto-10");
175     doc.addContent("link",
176         "https://aai-ext1.test.att.com:8443/aai/v9/network/vces/vce/vnf-id-dm-auto-10");
177     doc.addContent("searchTagIDs", "0;1;2;3");
178     doc.addContent("lastmodTimestamp", "2017-04-18T17:24:57.209-0400");
179
180     doc.setUrl(
181         "services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/1ead4512e65ee0eafb24e0156cc1abdf97368f08dfe065f02580aa09661bbcd8");
182     doc.setEtag("1");
183
184
185     return hitEntity;
186
187   }
188
189   public static HitEntity getHitSample7() {
190
191     HitEntity hitEntity = new HitEntity();
192     DocumentEntity doc = new DocumentEntity();
193
194     hitEntity.setDocument(doc);
195     hitEntity.setScore("13.940832");
196
197     doc.addContent("entityPrimaryKeyValue", "e3e59c5b-ad48-44d0-b3e4-80eacdcee4c7");
198     doc.addContent("entityType", "generic-vnf");
199     doc.addContent("searchTags", "e3e59c5b-ad48-44d0-b3e4-80eacdcee4c7;VNF_Test_vNF_modules_01");
200     doc.addContent("link",
201         "https://aai-ext1.test.att.com:8443/aai/v9/network/generic-vnfs/generic-vnf/e3e59c5b-ad48-44d0-b3e4-80eacdcee4c7");
202     doc.addContent("searchTagIDs", "0;1");
203     doc.addContent("lastmodTimestamp", "2017-04-18T17:26:34.603-0400");
204
205     doc.setUrl(
206         "services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/1462582e8fd7786f72f26548e4247b72ab6cd101cca0bbb68a60dd3ad16500d0");
207     doc.setEtag("1");
208
209
210     return hitEntity;
211
212   }
213
214   public static HitEntity getHitSample8() {
215
216     HitEntity hitEntity = new HitEntity();
217     DocumentEntity doc = new DocumentEntity();
218
219     hitEntity.setDocument(doc);
220     hitEntity.setScore("13.940832");
221
222     doc.addContent("entityPrimaryKeyValue", "fusion-jitsi-vnf-001");
223     doc.addContent("entityType", "generic-vnf");
224     doc.addContent("searchTags", "fusion-jitsi-vnf-001;fusion-jitsi-vnf");
225     doc.addContent("link",
226         "https://aai-ext1.test.att.com:8443/aai/v9/network/generic-vnfs/generic-vnf/fusion-jitsi-vnf-001");
227     doc.addContent("searchTagIDs", "0;1");
228     doc.addContent("lastmodTimestamp", "2017-04-18T17:28:14.293-0400");
229
230     doc.setUrl(
231         "services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/b79ddfec9a00184445174c91e7490a0d407f351983bba4ae53bfec0584f73ee3");
232     doc.setEtag("1");
233
234
235     return hitEntity;
236
237   }
238
239   public static HitEntity getHitSample9() {
240
241     HitEntity hitEntity = new HitEntity();
242     DocumentEntity doc = new DocumentEntity();
243
244     hitEntity.setDocument(doc);
245     hitEntity.setScore("13.940832");
246
247     doc.addContent("entityPrimaryKeyValue", "vnfm0003v");
248     doc.addContent("entityType", "generic-vnf");
249     doc.addContent("searchTags", "vnfm0003v;vnfm0003v");
250     doc.addContent("link",
251         "https://aai-ext1.test.att.com:8443/aai/v9/network/generic-vnfs/generic-vnf/vnfm0003v");
252     doc.addContent("searchTagIDs", "0;1");
253     doc.addContent("lastmodTimestamp", "2017-04-18T17:29:39.594-0400");
254
255     doc.setUrl(
256         "services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/52ae232ea5506d6de8ef35c4f46a1ceafe35f3717ff578b83531bc7615870b12");
257     doc.setEtag("1");
258
259
260     return hitEntity;
261
262   }
263
264   public static HitEntity getHitSample10() {
265
266     HitEntity hitEntity = new HitEntity();
267     DocumentEntity doc = new DocumentEntity();
268
269     hitEntity.setDocument(doc);
270     hitEntity.setScore("13.928098");
271
272     doc.addContent("entityPrimaryKeyValue", "amist456vnf");
273     doc.addContent("entityType", "generic-vnf");
274     doc.addContent("searchTags", "amist456vnf;amist456vnf");
275     doc.addContent("link",
276         "https://aai-ext1.test.att.com:8443/aai/v9/network/generic-vnfs/generic-vnf/amist456vnf");
277     doc.addContent("searchTagIDs", "0;1");
278     doc.addContent("lastmodTimestamp", "2017-04-18T17:28:28.163-0400");
279
280     doc.setUrl(
281         "services/search-data-service/v1/search/indexes/entitysearchindex-localhost-ist-apr18/documents/3424afea5963696380a0fdc78ee5320cf5fa9bc0459f1f9376db208d31196434");
282     doc.setEtag("1");
283
284
285     return hitEntity;
286
287   }
288
289
290
291   public static SearchAbstractionResponse getSuccessfulEntitySearchResponse() {
292
293     SearchAbstractionResponse sasResponse = new SearchAbstractionResponse();
294
295     SearchResult searchResult = new SearchResult();
296     sasResponse.setSearchResult(searchResult);
297
298     searchResult.setTotalHits(3257);
299
300     List<HitEntity> hits = new ArrayList<HitEntity>();
301
302     hits.add(getHitSample1());
303     hits.add(getHitSample2());
304     hits.add(getHitSample3());
305     hits.add(getHitSample4());
306     hits.add(getHitSample5());
307     hits.add(getHitSample6());
308     hits.add(getHitSample7());
309     hits.add(getHitSample8());
310     hits.add(getHitSample9());
311     hits.add(getHitSample10());
312
313     searchResult.setHits(hits);
314
315     return sasResponse;
316
317   }
318
319
320 }