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