-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISPN-15738 Test max results with distributed iterators
In particular if the state transfer chunk size is larger and smaller than the max results
- Loading branch information
1 parent
4535e2e
commit 392dfbe
Showing
2 changed files
with
60 additions
and
2 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
58 changes: 58 additions & 0 deletions
58
query/src/test/java/org/infinispan/query/maxresult/DistributedMaxResultTest.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,58 @@ | ||
package org.infinispan.query.maxresult; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.infinispan.configuration.cache.IndexStorage.LOCAL_HEAP; | ||
|
||
import org.infinispan.Cache; | ||
import org.infinispan.configuration.cache.CacheMode; | ||
import org.infinispan.configuration.cache.ConfigurationBuilder; | ||
import org.infinispan.query.Search; | ||
import org.infinispan.query.dsl.Query; | ||
import org.infinispan.query.dsl.QueryFactory; | ||
import org.infinispan.query.dsl.QueryResult; | ||
import org.infinispan.query.model.Game; | ||
import org.infinispan.test.MultipleCacheManagersTest; | ||
import org.testng.annotations.Test; | ||
|
||
@Test(groups = "functional", testName = "query.maxresult.DistributedMaxResultTest") | ||
public class DistributedMaxResultTest extends MultipleCacheManagersTest { | ||
|
||
private Cache<Integer, Game> node1; | ||
|
||
@Override | ||
protected void createCacheManagers() throws Throwable { | ||
ConfigurationBuilder config = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false); | ||
config | ||
.clustering() | ||
.hash().numOwners(2) | ||
.stateTransfer().chunkSize(100) | ||
.indexing().enable() | ||
.storage(LOCAL_HEAP) | ||
.addIndexedEntity("org.infinispan.query.model.Game") | ||
.query().defaultMaxResults(50); | ||
|
||
createClusteredCaches(2, config); | ||
node1 = cache(0); | ||
cache(1); | ||
} | ||
|
||
public void executeSmokeTest() { | ||
for (int i = 1; i <= 110; i++) { | ||
node1.put(i, new Game("Game " + i, "This is the game " + i + "# of a series")); | ||
} | ||
|
||
QueryFactory factory = Search.getQueryFactory(node1); | ||
Query<Game> query = factory.create("from org.infinispan.query.model.Game"); | ||
QueryResult<Game> result = query.execute(); | ||
|
||
assertThat(result.hitCount()).hasValue(110); | ||
assertThat(result.list()).hasSize(50); // use custom default | ||
|
||
query = factory.create("from org.infinispan.query.model.Game"); | ||
query.maxResults(200); // raise it | ||
result = query.execute(); | ||
|
||
assertThat(result.hitCount()).hasValue(110); | ||
assertThat(result.list()).hasSize(110); | ||
} | ||
} |