Initial coomit for AAI-UI(sparky-fe)
[aai/sparky-fe.git] / test / tierSupport / autoCompleteSearchBar / autoCompleteSearchBarTestConstants.js
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
26 const validResponseJsonForRequestFromFetchWithHitsType1 = {
27         "took": 5,
28         "timed_out": false,
29         "_shards": {
30                 "total": 5,
31                 "successful": 5,
32                 "failed": 0
33         },
34         "hits": {
35                 "total": 9376,
36                 "max_score": 3.3899312,
37                 "hits": [
38                         {
39                                 "_index": "entitysearchindex-localhost",
40                                 "_type": "aaiEntities",
41                                 "_id": "4785c7ec8ae11be12ca742248713346ea03a473ef65aa84bbea102c67fa5d",
42                                 "_score": 3.3899312,
43                                 "_source": {
44                                         "entityType": "service-instance",
45                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
46                                         "edgeTagQueryEntityFieldValue": "a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1",
47                                         "searchTagIDs": "0",
48                                         "searchTags": "service-instance-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1"
49                                 }
50                         },
51                         {
52                                 "_index": "entitysearchindex-localhost",
53                                 "_type": "aaiEntities",
54                                 "_id": "8e9baedcbf1cb2f9439f6b8b5eeaf0b8fa364086c8ef5ee6edcf6f5da114",
55                                 "_score": 3.1589103,
56                                 "_source": {
57                                         "entityType": "service-instance",
58                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
59                                         "edgeTagQueryEntityFieldValue": "d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8",
60                                         "searchTagIDs": "0",
61                                         "searchTags": "service-instance-id=d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8"
62                                 }
63                         },
64                         {
65                                 "_index": "entitysearchindex-localhost",
66                                 "_type": "aaiEntities",
67                                 "_id": "dd4bdbf810f5c1bc7be7d91f241b0221d75617a45f574f2ed6207e9c8ceb9e",
68                                 "_score": 3.147036,
69                                 "_source": {
70                                         "entityType": "service-instance",
71                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
72                                         "edgeTagQueryEntityFieldValue": "6c27a7cb-d8e1-45a8-aa12-61a694201cca",
73                                         "searchTagIDs": "0",
74                                         "searchTags": "service-instance-id=6c27a7cb-d8e1-45a8-aa12-61a694201cca"
75                                 }
76                         },
77                         {
78                                 "_index": "entitysearchindex-localhost2",
79                                 "_type": "aaiEntities",
80                                 "_id": "4785c7ec8ae11be12ca742248713346ea03a473ef65aa84bbea102c67fa5d",
81                                 "_score": 3.3899312,
82                                 "_source": {
83                                         "entityType": "service-instance",
84                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
85                                         "edgeTagQueryEntityFieldValue": "a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1",
86                                         "searchTagIDs": "0",
87                                         "searchTags": "service-instance-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1"
88                                 }
89                         },
90                         {
91                                 "_index": "entitysearchindex-localhost2",
92                                 "_type": "aaiEntities",
93                                 "_id": "8e9baedcbf1cb2f9439f6b8b5eeaf0b8fa364086c8ef5ee6edcf6f5da114",
94                                 "_score": 3.1589103,
95                                 "_source": {
96                                         "entityType": "service-instance",
97                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
98                                         "edgeTagQueryEntityFieldValue": "d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8",
99                                         "searchTagIDs": "0",
100                                         "searchTags": "service-instance-id=d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8"
101                                 }
102                         },
103                         {
104                                 "_index": "entitysearchindex-localhost2",
105                                 "_type": "aaiEntities",
106                                 "_id": "dd4bdbf810f5c1bc7be7d91f241b0221d75617a45f574f2ed6207e9c8ceb9e",
107                                 "_score": 3.147036,
108                                 "_source": {
109                                         "entityType": "service-instance",
110                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
111                                         "edgeTagQueryEntityFieldValue": "6c27a7cb-d8e1-45a8-aa12-61a694201cca",
112                                         "searchTagIDs": "0",
113                                         "searchTags": "service-instance-id=6c27a7cb-d8e1-45a8-aa12-61a694201cca"
114                                 }
115                         }
116                 ]
117         }
118 };
119
120 const validResponseJsonForRequestFromFetchWithHitsType2 = {
121         "took": 5,
122         "timed_out": false,
123         "_shards": {
124                 "total": 5,
125                 "successful": 5,
126                 "failed": 0
127         },
128         "hits": {
129                 "total": 9376,
130                 "max_score": 3.3899312,
131                 "hits": [
132                         {
133                                 "_index": "entitysearchindex-localhost",
134                                 "_type": "aaiEntities",
135                                 "_id": "4785c7ec8ae11be12ca742248713346ea03a473ef65aa84bbea102c67fa5d",
136                                 "_score": 3.3899312,
137                                 "_source": {
138                                         "entityType": "service-instance",
139                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
140                                         "entityPrimaryKeyValue": "a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1",
141                                         "searchTagIDs": "0",
142                                         "searchTags": "hostname-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1"
143                                 }
144                         },
145                         {
146                                 "_index": "entitysearchindex-localhost",
147                                 "_type": "aaiEntities",
148                                 "_id": "8e9baedcbf1cb2f9439f6b8b5eeaf0b8fa364086c8ef5ee6edcf6f5da114",
149                                 "_score": 3.1589103,
150                                 "_source": {
151                                         "entityType": "service-instance",
152                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
153                                         "edgeTagQueryEntityFieldValue": "d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8",
154                                         "searchTagIDs": "0",
155                                         "searchTags": "hostname-id=d1f3c3be-7a7f-42ea-a9ac-ca20af1588b8"
156                                 }
157                         },
158                         {
159                                 "_index": "entitysearchindex-localhost",
160                                 "_type": "aaiEntities",
161                                 "_id": "dd4bdbf810f5c1bc7be7d91f241b0221d75617a45f574f2ed6207e9c8ceb9e",
162                                 "_score": 3.147036,
163                                 "_source": {
164                                         "entityType": "service-instance",
165                                         "edgeTagQueryEntityFieldName": "service-instance.service-instance-id",
166                                         "edgeTagQueryEntityFieldValue": "6c27a7cb-d8e1-45a8-aa12-61a694201cca",
167                                         "searchTagIDs": "0",
168                                         "searchTags": "hostname-id=6c27a7cb-d8e1-45a8-aa12-61a694201cca"
169                                 }
170                         }
171                 ]
172         }
173 };
174
175 const validResponseJsonForRequestFromFetchWithOutHits = {
176         "took": 5,
177         "timed_out": false,
178         "_shards": {
179                 "total": 5,
180                 "successful": 5,
181                 "failed": 0
182         },
183         "hits": {
184                 "total": 0,
185                 "max_score": 3.3899312,
186                 "hits": []
187         }
188 };
189
190 const networkError = {
191         "error": "Network Error"
192 };
193
194 const validResponseJsonForNodeSearchFromFetchWithHits = {
195         "graphMeta":{},
196         "nodes" : [ {
197                 "id" : "service-instance.PRUCPEHOST0627002",
198                 "itemType" : "service-instance",
199                 "itemNameKey" : "service-instance.PRUCPEHOST0627002",
200                 "itemNameValue" : "PRUCPEHOST0627002",
201                 "itemProperties" : {
202                         "resource-version" : "1467233099",
203                         "service-instance-id" : "PRUCPEHOST0627002"
204                 },
205                 "nodeMeta" : {
206                         "className" : "selectedSearchedNodeClass",
207                         "nodeDebug" : null,
208                         "selfLinkResponseTimeInMs" : 131,
209                         "relationshipNode" : false,
210                         "searchTarget" : true,
211                         "enrichableNode" : false
212                 }
213         } ]
214 };
215
216 const inValidResponseJsonForNodeSearchFromFetchWithHits = {
217         "graphMeta":{},
218         "nodes" : []
219 };
220
221 const nodeSearchKeyword = 'service-instance-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1';
222 const nodeSearchKeywordWithOutEqualSign = 'a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1';
223 const multipleNodeSearchKeyword = 'service-instance-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1, service-instance-id=a162a2a2-ea7e-4e94-afc3-e9d064a3c2a1';
224 const mockRequestTimeOut = 1;
225 export default{
226         validResponseJsonForRequestFromFetchWithHitsType1: validResponseJsonForRequestFromFetchWithHitsType1,
227         validResponseJsonForRequestFromFetchWithHitsType2: validResponseJsonForRequestFromFetchWithHitsType2,
228         validResponseJsonForRequestFromFetchWithOutHits: validResponseJsonForRequestFromFetchWithOutHits,
229         networkError: networkError,
230         validResponseJsonForNodeSearchFromFetchWithHits: validResponseJsonForNodeSearchFromFetchWithHits,
231         inValidResponseJsonForNodeSearchFromFetchWithHits: inValidResponseJsonForNodeSearchFromFetchWithHits,
232         nodeSearchKeyword: nodeSearchKeyword,
233         nodeSearchKeywordWithOutEqualSign: nodeSearchKeywordWithOutEqualSign,
234         multipleNodeSearchKeyword: multipleNodeSearchKeyword,
235         mockRequestTimeOut: mockRequestTimeOut
236 };