Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HSEARCH-3323 Test basic scrolling with mapper orm
- Loading branch information
Showing
2 changed files
with
60 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...search/integrationtest/mapper/orm/search/loading/SearchQueryEntityLoadingScrollingIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Hibernate Search, full-text search for your domain model | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.search.integrationtest.mapper.orm.search.loading; | ||
|
||
import java.util.List; | ||
|
||
import org.hibernate.search.engine.backend.common.DocumentReference; | ||
import org.hibernate.search.engine.search.query.SearchQuery; | ||
import org.hibernate.search.engine.search.query.SearchScroll; | ||
import org.hibernate.search.engine.search.query.SearchScrollResult; | ||
import org.hibernate.search.util.impl.integrationtest.common.rule.StubSearchWorkBehavior; | ||
|
||
public class SearchQueryEntityLoadingScrollingIT extends SearchQueryEntityLoadingBaseIT { | ||
|
||
public SearchQueryEntityLoadingScrollingIT(SingleTypeLoadingModelPrimitives primitives) { | ||
super( primitives ); | ||
} | ||
|
||
@Override | ||
protected <T> List<T> getHits(List<String> targetIndexes, SearchQuery<T> query, List<DocumentReference> hitDocumentReferences) { | ||
backendMock.expectScrollObjects( | ||
targetIndexes, | ||
hitDocumentReferences.size(), | ||
b -> { } | ||
); | ||
|
||
backendMock.expectNextScroll( | ||
targetIndexes, | ||
StubSearchWorkBehavior.of( | ||
hitDocumentReferences.size(), | ||
hitDocumentReferences | ||
) | ||
); | ||
|
||
backendMock.expectCloseScroll( targetIndexes ); | ||
|
||
try ( SearchScroll<T> scroll = query.scroll( hitDocumentReferences.size() ) ) { | ||
SearchScrollResult<T> next = scroll.next(); | ||
return next.hits(); | ||
} | ||
} | ||
} |