METRON-1503 Alerts are not getting populated in alerts UI when search engine is Solr...
[metron.git] / metron-platform / metron-solr / src / test / java / org / apache / metron / solr / dao / SolrSearchDaoTest.java
1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package org.apache.metron.solr.dao;
19
20 import org.apache.metron.common.Constants;
21 import org.apache.metron.indexing.dao.AccessConfig;
22 import org.apache.metron.indexing.dao.search.GetRequest;
23 import org.apache.metron.indexing.dao.search.Group;
24 import org.apache.metron.indexing.dao.search.GroupOrder;
25 import org.apache.metron.indexing.dao.search.GroupRequest;
26 import org.apache.metron.indexing.dao.search.GroupResponse;
27 import org.apache.metron.indexing.dao.search.GroupResult;
28 import org.apache.metron.indexing.dao.search.InvalidSearchException;
29 import org.apache.metron.indexing.dao.search.SearchRequest;
30 import org.apache.metron.indexing.dao.search.SearchResponse;
31 import org.apache.metron.indexing.dao.search.SearchResult;
32 import org.apache.metron.indexing.dao.search.SortField;
33 import org.apache.metron.indexing.dao.update.Document;
34 import org.apache.metron.solr.matcher.ModifiableSolrParamsMatcher;
35 import org.apache.metron.solr.matcher.SolrQueryMatcher;
36 import org.apache.solr.client.solrj.SolrClient;
37 import org.apache.solr.client.solrj.SolrQuery;
38 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
39 import org.apache.solr.client.solrj.response.FacetField;
40 import org.apache.solr.client.solrj.response.FieldStatsInfo;
41 import org.apache.solr.client.solrj.response.PivotField;
42 import org.apache.solr.client.solrj.response.QueryResponse;
43 import org.apache.solr.common.SolrDocument;
44 import org.apache.solr.common.SolrDocumentList;
45 import org.apache.solr.common.params.ModifiableSolrParams;
46 import org.apache.solr.common.util.NamedList;
47 import org.junit.Before;
48 import org.junit.Rule;
49 import org.junit.Test;
50 import org.junit.rules.ExpectedException;
51 import org.junit.runner.RunWith;
52 import org.powermock.core.classloader.annotations.PrepareForTest;
53 import org.powermock.modules.junit4.PowerMockRunner;
54
55 import java.util.Arrays;
56 import java.util.Collection;
57 import java.util.Collections;
58 import java.util.HashMap;
59 import java.util.List;
60 import java.util.Map;
61 import java.util.Optional;
62
63 import static org.hamcrest.MatcherAssert.assertThat;
64 import static org.hamcrest.core.IsCollectionContaining.hasItems;
65 import static org.junit.Assert.assertEquals;
66 import static org.junit.Assert.assertNull;
67 import static org.mockito.Matchers.any;
68 import static org.mockito.Matchers.argThat;
69 import static org.mockito.Mockito.doReturn;
70 import static org.mockito.Mockito.mock;
71 import static org.mockito.Mockito.spy;
72 import static org.mockito.Mockito.verify;
73 import static org.mockito.Mockito.verifyNoMoreInteractions;
74 import static org.mockito.Mockito.when;
75 import static org.powermock.api.mockito.PowerMockito.mockStatic;
76
77 @RunWith(PowerMockRunner.class)
78 @PrepareForTest({CollectionAdminRequest.class})
79 public class SolrSearchDaoTest {
80
81 @Rule
82 public final ExpectedException exception = ExpectedException.none();
83
84 private SolrClient client;
85 private AccessConfig accessConfig;
86 private SolrSearchDao solrSearchDao;
87
88 @SuppressWarnings("unchecked")
89 @Before
90 public void setUp() throws Exception {
91 client = mock(SolrClient.class);
92 accessConfig = mock(AccessConfig.class);
93 solrSearchDao = new SolrSearchDao(client, accessConfig);
94 mockStatic(CollectionAdminRequest.class);
95 when(CollectionAdminRequest.listCollections(client)).thenReturn(Arrays.asList("bro", "snort"));
96 }
97
98 @Test
99 public void searchShouldProperlyReturnSearchResponse() throws Exception {
100 SearchRequest searchRequest = mock(SearchRequest.class);
101 SearchResponse searchResponse = mock(SearchResponse.class);
102 SolrQuery solrQuery = mock(SolrQuery.class);
103 QueryResponse queryResponse = mock(QueryResponse.class);
104
105 solrSearchDao = spy(new SolrSearchDao(client, accessConfig));
106 when(searchRequest.getQuery()).thenReturn("query");
107 doReturn(solrQuery).when(solrSearchDao).buildSearchRequest(searchRequest);
108 when(client.query(solrQuery)).thenReturn(queryResponse);
109 doReturn(searchResponse).when(solrSearchDao).buildSearchResponse(searchRequest, queryResponse);
110
111 assertEquals(searchResponse, solrSearchDao.search(searchRequest));
112 verify(solrSearchDao).buildSearchRequest(searchRequest);
113 verify(client).query(solrQuery);
114 verify(solrSearchDao).buildSearchResponse(searchRequest, queryResponse);
115 verifyNoMoreInteractions(client);
116 }
117
118 @Test
119 public void searchShouldThrowInvalidSearchExceptionOnEmptyQuery() throws Exception {
120 exception.expect(InvalidSearchException.class);
121 exception.expectMessage("Search query is invalid: null");
122
123 solrSearchDao.search(new SearchRequest());
124 }
125
126 @Test
127 public void searchShouldThrowInvalidSearchExceptionOnEmptyClient() throws Exception {
128 exception.expect(InvalidSearchException.class);
129 exception.expectMessage("Uninitialized Dao! You must call init() prior to use.");
130
131 SearchRequest searchRequest = new SearchRequest();
132 searchRequest.setQuery("query");
133 new SolrSearchDao(null, accessConfig).search(searchRequest);
134 }
135
136 @Test
137 public void searchShouldThrowSearchResultSizeException() throws Exception {
138 exception.expect(InvalidSearchException.class);
139 exception.expectMessage("Search result size must be less than 100");
140
141 when(accessConfig.getMaxSearchResults()).thenReturn(100);
142 SearchRequest searchRequest = new SearchRequest();
143 searchRequest.setQuery("query");
144 searchRequest.setSize(200);
145 solrSearchDao.search(searchRequest);
146 }
147
148 @Test
149 public void groupShouldProperlyReturnGroupResponse() throws Exception {
150 GroupRequest groupRequest = mock(GroupRequest.class);
151 QueryResponse queryResponse = mock(QueryResponse.class);
152 GroupResponse groupResponse = mock(GroupResponse.class);
153
154 solrSearchDao = spy(new SolrSearchDao(client, accessConfig));
155 Group group1 = new Group();
156 group1.setField("field1");
157 Group group2 = new Group();
158 group2.setField("field2");
159 when(groupRequest.getQuery()).thenReturn("query");
160 when(groupRequest.getGroups()).thenReturn(Arrays.asList(group1, group2));
161 when(groupRequest.getScoreField()).thenReturn(Optional.of("scoreField"));
162 when(groupRequest.getIndices()).thenReturn(Arrays.asList("bro", "snort"));
163 when(client.query(any())).thenReturn(queryResponse);
164 doReturn(groupResponse).when(solrSearchDao).buildGroupResponse(groupRequest, queryResponse);
165 SolrQuery expectedSolrQuery = new SolrQuery()
166 .setStart(0)
167 .setRows(0)
168 .setQuery("query");
169 expectedSolrQuery.set("collection", "bro,snort");
170 expectedSolrQuery.set("stats", true);
171 expectedSolrQuery.set("stats.field", "{!tag=piv1 sum=true}scoreField");
172 expectedSolrQuery.set("facet", true);
173 expectedSolrQuery.set("facet.pivot", "{!stats=piv1}field1,field2");
174
175 assertEquals(groupResponse, solrSearchDao.group(groupRequest));
176 verify(client).query(argThat(new SolrQueryMatcher(expectedSolrQuery)));
177 verify(solrSearchDao).buildGroupResponse(groupRequest, queryResponse);
178
179 verifyNoMoreInteractions(client);
180 }
181
182 @Test
183 public void getLatestShouldProperlyReturnDocument() throws Exception {
184 SolrDocument solrDocument = mock(SolrDocument.class);
185 Document document = mock(Document.class);
186
187 solrSearchDao = spy(new SolrSearchDao(client, accessConfig));
188 when(client.getById("collection", "guid")).thenReturn(solrDocument);
189 doReturn(document).when(solrSearchDao).toDocument(solrDocument);
190
191 assertEquals(document, solrSearchDao.getLatest("guid", "collection"));
192
193 verify(client).getById("collection", "guid");
194 verify(solrSearchDao).toDocument(solrDocument);
195 verifyNoMoreInteractions(client);
196 }
197
198 @Test
199 public void getAllLatestShouldProperlyReturnDocuments() throws Exception {
200 GetRequest broRequest1 = new GetRequest("bro-1", "bro");
201 GetRequest broRequest2 = new GetRequest("bro-2", "bro");
202 GetRequest snortRequest1 = new GetRequest("snort-1", "snort");
203 GetRequest snortRequest2 = new GetRequest("snort-2", "snort");
204 SolrDocument broSolrDoc1 = mock(SolrDocument.class);
205 SolrDocument broSolrDoc2 = mock(SolrDocument.class);
206 SolrDocument snortSolrDoc1 = mock(SolrDocument.class);
207 SolrDocument snortSolrDoc2 = mock(SolrDocument.class);
208 Document broDoc1 = mock(Document.class);
209 Document broDoc2 = mock(Document.class);
210 Document snortDoc1 = mock(Document.class);
211 Document snortDoc2 = mock(Document.class);
212
213 solrSearchDao = spy(new SolrSearchDao(client, accessConfig));
214 doReturn(broDoc1).when(solrSearchDao).toDocument(broSolrDoc1);
215 doReturn(broDoc2).when(solrSearchDao).toDocument(broSolrDoc2);
216 doReturn(snortDoc1).when(solrSearchDao).toDocument(snortSolrDoc1);
217 doReturn(snortDoc2).when(solrSearchDao).toDocument(snortSolrDoc2);
218 SolrDocumentList broList = new SolrDocumentList();
219 broList.add(broSolrDoc1);
220 broList.add(broSolrDoc2);
221 SolrDocumentList snortList = new SolrDocumentList();
222 snortList.add(snortSolrDoc1);
223 snortList.add(snortSolrDoc2);
224 when(client.getById((Collection<String>) argThat(hasItems("bro-1", "bro-2")),
225 argThat(new ModifiableSolrParamsMatcher(new ModifiableSolrParams().set("collection", "bro"))))).thenReturn(broList);
226 when(client.getById((Collection<String>) argThat(hasItems("snort-1", "snort-2")),
227 argThat(new ModifiableSolrParamsMatcher(new ModifiableSolrParams().set("collection", "snort"))))).thenReturn(snortList);
228 assertEquals(Arrays.asList(broDoc1, broDoc2, snortDoc1, snortDoc2), solrSearchDao.getAllLatest(Arrays.asList(broRequest1, broRequest2, snortRequest1, snortRequest2)));
229 }
230
231 @Test
232 public void buildSearchRequestShouldReturnSolrQuery() throws Exception {
233 SearchRequest searchRequest = new SearchRequest();
234 searchRequest.setIndices(Arrays.asList("bro", "snort"));
235 searchRequest.setSize(5);
236 searchRequest.setFrom(10);
237 searchRequest.setQuery("query");
238 SortField sortField = new SortField();
239 sortField.setField("sortField");
240 sortField.setSortOrder("ASC");
241 searchRequest.setSort(Collections.singletonList(sortField));
242 searchRequest.setFields(Arrays.asList("field1", "field2"));
243 searchRequest.setFacetFields(Arrays.asList("facetField1", "facetField2"));
244
245 SolrQuery exceptedSolrQuery = new SolrQuery()
246 .setStart(10)
247 .setRows(5)
248 .setQuery("query")
249 .addSort("sortField", SolrQuery.ORDER.asc)
250 .addField("field1").addField("field2")
251 .addFacetField("facetField1", "facetField2");
252 exceptedSolrQuery.set("collection", "bro,snort");
253
254 SolrQuery solrQuery = solrSearchDao.buildSearchRequest(searchRequest);
255 assertThat(solrQuery, new SolrQueryMatcher(exceptedSolrQuery));
256 }
257
258 @Test
259 public void buildSearchResponseShouldReturnSearchResponse() throws Exception {
260 SearchRequest searchRequest = new SearchRequest();
261 searchRequest.setFields(Collections.singletonList("id"));
262 searchRequest.setFacetFields(Collections.singletonList("facetField"));
263 QueryResponse queryResponse = mock(QueryResponse.class);
264 SolrDocument solrDocument1 = mock(SolrDocument.class);
265 SolrDocument solrDocument2 = mock(SolrDocument.class);
266
267 solrSearchDao = spy(new SolrSearchDao(client, accessConfig));
268 SolrDocumentList solrDocumentList = new SolrDocumentList();
269 solrDocumentList.add(solrDocument1);
270 solrDocumentList.add(solrDocument2);
271 solrDocumentList.setNumFound(100);
272 when(queryResponse.getResults()).thenReturn(solrDocumentList);
273 SearchResult searchResult1 = new SearchResult();
274 searchResult1.setId("id1");
275 SearchResult searchResult2 = new SearchResult();
276 searchResult2.setId("id2");
277 doReturn(searchResult1).when(solrSearchDao).getSearchResult(solrDocument1,
278 Optional.of(Collections.singletonList("id")));
279 doReturn(searchResult2).when(solrSearchDao).getSearchResult(solrDocument2,
280 Optional.of(Collections.singletonList("id")));
281 Map<String, Map<String, Long>> facetCounts = new HashMap<String, Map<String, Long>>() {{
282 put("id", new HashMap<String, Long>() {{
283 put("id1", 1L);
284 put("id2", 1L);
285 }});
286 }};
287 doReturn(facetCounts).when(solrSearchDao).getFacetCounts(Collections.singletonList("facetField"), queryResponse);
288 SearchResponse expectedSearchResponse = new SearchResponse();
289 SearchResult expectedSearchResult1 = new SearchResult();
290 expectedSearchResult1.setId("id1");
291 SearchResult expectedSearchResult2 = new SearchResult();
292 expectedSearchResult2.setId("id2");
293 expectedSearchResponse.setResults(Arrays.asList(expectedSearchResult1, expectedSearchResult2));
294 expectedSearchResponse.setTotal(100);
295 expectedSearchResponse.setFacetCounts(facetCounts);
296
297 assertEquals(expectedSearchResponse, solrSearchDao.buildSearchResponse(searchRequest, queryResponse));
298 }
299
300 @Test
301 public void getSearchResultShouldProperlyReturnResults() throws Exception {
302 SolrDocument solrDocument = mock(SolrDocument.class);
303
304 when(solrDocument.getFieldValue(Constants.GUID)).thenReturn("guid");
305 when(solrDocument.getFieldValue("field1")).thenReturn("value1");
306 when(solrDocument.getFieldValue("field2")).thenReturn("value2");
307 when(solrDocument.getFieldNames()).thenReturn(Arrays.asList("field1", "field2"));
308
309 SearchResult expectedSearchResult = new SearchResult();
310 expectedSearchResult.setId("guid");
311 expectedSearchResult.setSource(new HashMap<String, Object>() {{
312 put("field1", "value1");
313 }});
314
315 assertEquals(expectedSearchResult, solrSearchDao.getSearchResult(solrDocument,
316 Optional.of(Collections.singletonList("field1"))));
317
318 SearchResult expectedSearchResultAllFields = new SearchResult();
319 expectedSearchResultAllFields.setId("guid");
320 expectedSearchResultAllFields.setSource(new HashMap<String, Object>() {{
321 put("field1", "value1");
322 put("field2", "value2");
323 }});
324
325 assertEquals(expectedSearchResultAllFields, solrSearchDao.getSearchResult(solrDocument, Optional.empty()));
326 }
327
328 @Test
329 public void getFacetCountsShouldProperlyReturnFacetCounts() throws Exception {
330 QueryResponse queryResponse = mock(QueryResponse.class);
331
332 FacetField facetField1 = new FacetField("field1");
333 facetField1.add("value1", 1);
334 facetField1.add("value2", 2);
335 FacetField facetField2 = new FacetField("field2");
336 facetField2.add("value3", 3);
337 facetField2.add("value4", 4);
338 when(queryResponse.getFacetField("field1")).thenReturn(facetField1);
339 when(queryResponse.getFacetField("field2")).thenReturn(facetField2);
340
341 Map<String, Map<String, Long>> expectedFacetCounts = new HashMap<String, Map<String, Long>>() {{
342 put("field1", new HashMap<String, Long>() {{
343 put("value1", 1L);
344 put("value2", 2L);
345 }});
346 put("field2", new HashMap<String, Long>() {{
347 put("value3", 3L);
348 put("value4", 4L);
349 }});
350 }};
351
352 assertEquals(expectedFacetCounts, solrSearchDao.getFacetCounts(Arrays.asList("field1", "field2"), queryResponse));
353 }
354
355 @Test
356 public void buildGroupResponseShouldProperlyReturnGroupReponse() throws Exception {
357 GroupRequest groupRequest = mock(GroupRequest.class);
358 QueryResponse queryResponse = mock(QueryResponse.class);
359 NamedList namedList = mock(NamedList.class);
360 List pivotFields = mock(List.class);
361 List groupResults = mock(List.class);
362
363 solrSearchDao = spy(new SolrSearchDao(client, accessConfig));
364 Group group1 = new Group();
365 group1.setField("field1");
366 Group group2 = new Group();
367 group2.setField("field2");
368 when(groupRequest.getGroups()).thenReturn(Arrays.asList(group1, group2));
369 when(queryResponse.getFacetPivot()).thenReturn(namedList);
370 when(namedList.get("field1,field2")).thenReturn(pivotFields);
371 doReturn(groupResults).when(solrSearchDao).getGroupResults(groupRequest, 0, pivotFields);
372
373 GroupResponse groupResponse = solrSearchDao.buildGroupResponse(groupRequest, queryResponse);
374 assertEquals("field1", groupResponse.getGroupedBy());
375 verify(namedList).get("field1,field2");
376 verify(solrSearchDao).getGroupResults(groupRequest, 0, pivotFields);
377
378 }
379
380 @Test
381 public void getGroupResultsShouldProperlyReturnGroupResults() throws Exception {
382 GroupRequest groupRequest = new GroupRequest();
383 Group group1 = new Group();
384 group1.setField("field1");
385 GroupOrder groupOrder1 = new GroupOrder();
386 groupOrder1.setSortOrder("ASC");
387 groupOrder1.setGroupOrderType("TERM");
388 group1.setOrder(groupOrder1);
389 Group group2 = new Group();
390 group2.setField("field2");
391 GroupOrder groupOrder2 = new GroupOrder();
392 groupOrder2.setSortOrder("DESC");
393 groupOrder2.setGroupOrderType("COUNT");
394 group2.setOrder(groupOrder2);
395 groupRequest.setGroups(Arrays.asList(group1, group2));
396 groupRequest.setScoreField("scoreField");
397
398 PivotField level1Pivot1 = mock(PivotField.class);
399 PivotField level1Pivot2 = mock(PivotField.class);
400 PivotField level2Pivot1 = mock(PivotField.class);
401 PivotField level2Pivot2 = mock(PivotField.class);
402 FieldStatsInfo level1Pivot1FieldStatsInfo = mock(FieldStatsInfo.class);
403 FieldStatsInfo level1Pivot2FieldStatsInfo = mock(FieldStatsInfo.class);
404 FieldStatsInfo level2Pivot1FieldStatsInfo = mock(FieldStatsInfo.class);
405 FieldStatsInfo level2Pivot2FieldStatsInfo = mock(FieldStatsInfo.class);
406 List<PivotField> level1Pivots = Arrays.asList(level1Pivot1, level1Pivot2);
407 List<PivotField> level2Pivots = Arrays.asList(level2Pivot1, level2Pivot2);
408
409 when(level1Pivot1.getValue()).thenReturn("field1value1");
410 when(level1Pivot1.getCount()).thenReturn(1);
411 when(level1Pivot1FieldStatsInfo.getSum()).thenReturn(1.0);
412 when(level1Pivot1.getFieldStatsInfo()).thenReturn(new HashMap<String, FieldStatsInfo>(){{
413 put("score", level1Pivot1FieldStatsInfo);
414 }});
415 when(level1Pivot2.getValue()).thenReturn("field1value2");
416 when(level1Pivot2.getCount()).thenReturn(2);
417 when(level1Pivot2FieldStatsInfo.getSum()).thenReturn(2.0);
418 when(level1Pivot2.getFieldStatsInfo()).thenReturn(new HashMap<String, FieldStatsInfo>(){{
419 put("score", level1Pivot2FieldStatsInfo);
420 }});
421 when(level2Pivot1.getValue()).thenReturn("field2value1");
422 when(level2Pivot1.getCount()).thenReturn(3);
423 when(level2Pivot1FieldStatsInfo.getSum()).thenReturn(3.0);
424 when(level2Pivot1.getFieldStatsInfo()).thenReturn(new HashMap<String, FieldStatsInfo>(){{
425 put("score", level2Pivot1FieldStatsInfo);
426 }});
427 when(level2Pivot2.getValue()).thenReturn("field2value2");
428 when(level2Pivot2.getCount()).thenReturn(4);
429 when(level2Pivot2FieldStatsInfo.getSum()).thenReturn(4.0);
430 when(level2Pivot2.getFieldStatsInfo()).thenReturn(new HashMap<String, FieldStatsInfo>(){{
431 put("score", level2Pivot2FieldStatsInfo);
432 }});
433 when(level1Pivot1.getPivot()).thenReturn(level2Pivots);
434
435 List<GroupResult> level1GroupResults = solrSearchDao.getGroupResults(groupRequest, 0, level1Pivots);
436
437 assertEquals("field1value1", level1GroupResults.get(0).getKey());
438 assertEquals(1, level1GroupResults.get(0).getTotal());
439 assertEquals(1.0, level1GroupResults.get(0).getScore(), 0.00001);
440 assertEquals("field2", level1GroupResults.get(0).getGroupedBy());
441 assertEquals("field1value2", level1GroupResults.get(1).getKey());
442 assertEquals(2, level1GroupResults.get(1).getTotal());
443 assertEquals(2.0, level1GroupResults.get(1).getScore(), 0.00001);
444 assertEquals("field2", level1GroupResults.get(1).getGroupedBy());
445 assertEquals(0, level1GroupResults.get(1).getGroupResults().size());
446
447 List<GroupResult> level2GroupResults = level1GroupResults.get(0).getGroupResults();
448 assertEquals("field2value2", level2GroupResults.get(0).getKey());
449 assertEquals(4, level2GroupResults.get(0).getTotal());
450 assertEquals(4.0, level2GroupResults.get(0).getScore(), 0.00001);
451 assertNull(level2GroupResults.get(0).getGroupedBy());
452 assertNull(level2GroupResults.get(0).getGroupResults());
453 assertEquals("field2value1", level2GroupResults.get(1).getKey());
454 assertEquals(3, level2GroupResults.get(1).getTotal());
455 assertEquals(3.0, level2GroupResults.get(1).getScore(), 0.00001);
456 assertNull(level2GroupResults.get(1).getGroupedBy());
457 assertNull(level2GroupResults.get(1).getGroupResults());
458 }
459
460 @Test
461 public void toDocumentShouldProperlyReturnDocument() throws Exception {
462 SolrDocument solrDocument = new SolrDocument();
463 solrDocument.addField(SolrDao.VERSION_FIELD, 1.0);
464 solrDocument.addField(Constants.GUID, "guid");
465 solrDocument.addField(Constants.SENSOR_TYPE, "bro");
466 solrDocument.addField("field", "value");
467
468 Document expectedDocument = new Document(new HashMap<String, Object>(){{
469 put("field", "value");
470 put(Constants.GUID, "guid");
471 put(Constants.SENSOR_TYPE, "bro");
472 }}, "guid", "bro", 0L);
473
474 Document actualDocument = solrSearchDao.toDocument(solrDocument);
475 assertEquals(expectedDocument, actualDocument);
476 }
477
478 }