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