Skip to content

Commit 091ccad

Browse files
authored
Merge pull request #1588 from marklogic/feature/155-testing
DEVEXP-155 Added disabled test for setMaxBatches
2 parents d78d459 + e335e18 commit 091ccad

File tree

1 file changed

+36
-0
lines changed
  • marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/fastfunctest/datamovement

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.marklogic.client.fastfunctest.datamovement;
2+
3+
import com.marklogic.client.datamovement.DataMovementManager;
4+
import com.marklogic.client.datamovement.QueryBatcher;
5+
import com.marklogic.client.fastfunctest.AbstractFunctionalTest;
6+
import org.junit.jupiter.api.Disabled;
7+
import org.junit.jupiter.api.Test;
8+
9+
import java.util.concurrent.atomic.AtomicInteger;
10+
11+
import static org.junit.jupiter.api.Assertions.assertEquals;
12+
13+
@Disabled("Getting this test in place to verify that setMaxBatches does not appear to work yet.")
14+
public class SetMaxBatchesTest extends AbstractFunctionalTest {
15+
16+
@Test
17+
void test() {
18+
writeJsonDocs(50, "max-batches-test");
19+
20+
DataMovementManager dmm = client.newDataMovementManager();
21+
AtomicInteger uriCount = new AtomicInteger();
22+
QueryBatcher queryBatcher = dmm
23+
.newQueryBatcher(client.newQueryManager().newStructuredQueryBuilder().collection("max-batches-test"))
24+
.withThreadCount(1)
25+
.withBatchSize(10)
26+
.onUrisReady(batch -> uriCount.addAndGet(batch.getItems().length));
27+
queryBatcher.setMaxBatches(2);
28+
dmm.startJob(queryBatcher);
29+
queryBatcher.awaitCompletion();
30+
dmm.stopJob(queryBatcher);
31+
32+
assertEquals(20, uriCount.get(), "Because the batch size is 10 and we asked for 2 batches back, we only " +
33+
"expect 20 URIs back. But through 6.2.2 (and probably going back much further), all URIs are returned. " +
34+
"Modifying the thread count and batch size do not appear to affect this at all.");
35+
}
36+
}

0 commit comments

Comments
 (0)