daf8bb15c6cf0d2fc172ea70b6cb8644c70b2589
[aai/sparky-fe.git] / test / tierSupport / autoCompleteSearchBar / autoCompleteSearchBarTestConstants.js
1 /*
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017 Amdocs
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *       http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  *
21  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  */
23 const validResponseJsonForRequestFromFetchWithHitsType1 = {
24         "took": 5,
25         "timed_out": false,
26         "_shards": {
27                 "total": 5,
28                 "successful": 5,
29                 "failed": 0
30         },
31         "hits": {
32                 "total": 9376,
33                 "max_score": 3.3899312,
34                 "hits": [
35                         {
36                                 "_index": "entitysearchindex-localhost",
37                                 "_type": "aaiEntities",
38                                 "_id": "4785c7ec8ae11be12ca742248713346ea03a473ef65aa84bbea102c67fa5d",
39                                 "_score": 3.3899312,
40                                 "_source": {
41                                         "entityType": "service-instance",
42                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
43                                         "edgeTagQueryEntityFieldValue": "a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1",
44                                         "searchTagIDs": "0",
45                                         "searchTags": "service-instance-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1"
46                                 }
47                         },
48                         {
49                                 "_index": "entitysearchindex-localhost",
50                                 "_type": "aaiEntities",
51                                 "_id": "8e9baedcbf1cb2f9439f6b8b5eeaf0b8fa364086c8ef5ee6edcf6f5da114",
52                                 "_score": 3.1589103,
53                                 "_source": {
54                                         "entityType": "service-instance",
55                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
56                                         "edgeTagQueryEntityFieldValue": "d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8",
57                                         "searchTagIDs": "0",
58                                         "searchTags": "service-instance-id=d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8"
59                                 }
60                         },
61                         {
62                                 "_index": "entitysearchindex-localhost",
63                                 "_type": "aaiEntities",
64                                 "_id": "dd4bdbf810f5c1bc7be7d91f241b0221d75617a45f574f2ed6207e9c8ceb9e",
65                                 "_score": 3.147036,
66                                 "_source": {
67                                         "entityType": "service-instance",
68                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
69                                         "edgeTagQueryEntityFieldValue": "6c27a7cb-d8e1-45a8-aa12-61a694201cca",
70                                         "searchTagIDs": "0",
71                                         "searchTags": "service-instance-id=6c27a7cb-d8e1-45a8-aa12-61a694201cca"
72                                 }
73                         },
74                         {
75                                 "_index": "entitysearchindex-localhost2",
76                                 "_type": "aaiEntities",
77                                 "_id": "4785c7ec8ae11be12ca742248713346ea03a473ef65aa84bbea102c67fa5d",
78                                 "_score": 3.3899312,
79                                 "_source": {
80                                         "entityType": "service-instance",
81                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
82                                         "edgeTagQueryEntityFieldValue": "a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1",
83                                         "searchTagIDs": "0",
84                                         "searchTags": "service-instance-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1"
85                                 }
86                         },
87                         {
88                                 "_index": "entitysearchindex-localhost2",
89                                 "_type": "aaiEntities",
90                                 "_id": "8e9baedcbf1cb2f9439f6b8b5eeaf0b8fa364086c8ef5ee6edcf6f5da114",
91                                 "_score": 3.1589103,
92                                 "_source": {
93                                         "entityType": "service-instance",
94                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
95                                         "edgeTagQueryEntityFieldValue": "d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8",
96                                         "searchTagIDs": "0",
97                                         "searchTags": "service-instance-id=d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8"
98                                 }
99                         },
100                         {
101                                 "_index": "entitysearchindex-localhost2",
102                                 "_type": "aaiEntities",
103                                 "_id": "dd4bdbf810f5c1bc7be7d91f241b0221d75617a45f574f2ed6207e9c8ceb9e",
104                                 "_score": 3.147036,
105                                 "_source": {
106                                         "entityType": "service-instance",
107                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
108                                         "edgeTagQueryEntityFieldValue": "6c27a7cb-d8e1-45a8-aa12-61a694201cca",
109                                         "searchTagIDs": "0",
110                                         "searchTags": "service-instance-id=6c27a7cb-d8e1-45a8-aa12-61a694201cca"
111                                 }
112                         }
113                 ]
114         }
115 };
116
117 const validResponseJsonForRequestFromFetchWithHitsType2 = {
118         "took": 5,
119         "timed_out": false,
120         "_shards": {
121                 "total": 5,
122                 "successful": 5,
123                 "failed": 0
124         },
125         "hits": {
126                 "total": 9376,
127                 "max_score": 3.3899312,
128                 "hits": [
129                         {
130                                 "_index": "entitysearchindex-localhost",
131                                 "_type": "aaiEntities",
132                                 "_id": "4785c7ec8ae11be12ca742248713346ea03a473ef65aa84bbea102c67fa5d",
133                                 "_score": 3.3899312,
134                                 "_source": {
135                                         "entityType": "service-instance",
136                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
137                                         "entityPrimaryKeyValue": "a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1",
138                                         "searchTagIDs": "0",
139                                         "searchTags": "hostname-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1"
140                                 }
141                         },
142                         {
143                                 "_index": "entitysearchindex-localhost",
144                                 "_type": "aaiEntities",
145                                 "_id": "8e9baedcbf1cb2f9439f6b8b5eeaf0b8fa364086c8ef5ee6edcf6f5da114",
146                                 "_score": 3.1589103,
147                                 "_source": {
148                                         "entityType": "service-instance",
149                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
150                                         "edgeTagQueryEntityFieldValue": "d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8",
151                                         "searchTagIDs": "0",
152                                         "searchTags": "hostname-id=d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8"
153                                 }
154                         },
155                         {
156                                 "_index": "entitysearchindex-localhost",
157                                 "_type": "aaiEntities",
158                                 "_id": "dd4bdbf810f5c1bc7be7d91f241b0221d75617a45f574f2ed6207e9c8ceb9e",
159                                 "_score": 3.147036,
160                                 "_source": {
161                                         "entityType": "service-instance",
162                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
163                                         "edgeTagQueryEntityFieldValue": "6c27a7cb-d8e1-45a8-aa12-61a694201cca",
164                                         "searchTagIDs": "0",
165                                         "searchTags": "hostname-id=6c27a7cb-d8e1-45a8-aa12-61a694201cca"
166                                 }
167                         }
168                 ]
169         }
170 };
171
172 const validResponseJsonForRequestFromFetchWithOutHits = {
173         "took": 5,
174         "timed_out": false,
175         "_shards": {
176                 "total": 5,
177                 "successful": 5,
178                 "failed": 0
179         },
180         "hits": {
181                 "total": 0,
182                 "max_score": 3.3899312,
183                 "hits": []
184         }
185 };
186
187 const networkError = {
188         "error": "Network Error"
189 };
190
191 const validResponseJsonForNodeSearchFromFetchWithHits = {
192         "graphMeta":{},
193         "nodes" : [ {
194                 "id" : "service-instance.PRUCPEHOST0627002",
195                 "itemType" : "service-instance",
196                 "itemNameKey" : "service-instance.PRUCPEHOST0627002",
197                 "itemNameValue" : "PRUCPEHOST0627002",
198                 "itemProperties" : {
199                         "resource-version" : "1467233099",
200                         "service-instance-id" : "PRUCPEHOST0627002"
201                 },
202                 "nodeMeta" : {
203                         "className" : "selectedSearchedNodeClass",
204                         "nodeDebug" : null,
205                         "selfLinkResponseTimeInMs" : 131,
206                         "relationshipNode" : false,
207                         "searchTarget" : true,
208                         "enrichableNode" : false
209                 }
210         } ]
211 };
212
213 const inValidResponseJsonForNodeSearchFromFetchWithHits = {
214         "graphMeta":{},
215         "nodes" : []
216 };
217
218 const nodeSearchKeyword = 'service-instance-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1';
219 const nodeSearchKeywordWithOutEqualSign = 'a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1';
220 const multipleNodeSearchKeyword = 'service-instance-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1, service-instance-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1';
221 const mockRequestTimeOut = 1;
222 export default{
223         validResponseJsonForRequestFromFetchWithHitsType1: validResponseJsonForRequestFromFetchWithHitsType1,
224         validResponseJsonForRequestFromFetchWithHitsType2: validResponseJsonForRequestFromFetchWithHitsType2,
225         validResponseJsonForRequestFromFetchWithOutHits: validResponseJsonForRequestFromFetchWithOutHits,
226         networkError: networkError,
227         validResponseJsonForNodeSearchFromFetchWithHits: validResponseJsonForNodeSearchFromFetchWithHits,
228         inValidResponseJsonForNodeSearchFromFetchWithHits: inValidResponseJsonForNodeSearchFromFetchWithHits,
229         nodeSearchKeyword: nodeSearchKeyword,
230         nodeSearchKeywordWithOutEqualSign: nodeSearchKeywordWithOutEqualSign,
231         multipleNodeSearchKeyword: multipleNodeSearchKeyword,
232         mockRequestTimeOut: mockRequestTimeOut
233 };