Skip to content

Commit 3dfd450

Browse files
committed
Adding the suggestions.
1 parent dadf9dd commit 3dfd450

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

marklogic-client-api/src/test/java/com/marklogic/client/test/datamovement/QueryBatcherTest.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
import org.apache.http.util.EntityUtils;
5757
import org.junit.AfterClass;
5858
import org.junit.BeforeClass;
59-
import org.junit.Ignore;
6059
import org.junit.Test;
6160

6261
import com.fasterxml.jackson.databind.JsonNode;
@@ -864,9 +863,10 @@ public void maxUrisTestWithQueryTask() {
864863

865864
DocumentMetadataHandle documentMetadata = new DocumentMetadataHandle().withCollections("maxUrisTest");
866865
WriteBatcher batcher = moveMgr.newWriteBatcher().withDefaultMetadata(documentMetadata);
867-
866+
int forests = batcher.getForestConfig().listForests().length;
867+
int batchSize = 10;
868868
moveMgr.startJob(batcher);
869-
for(int i=0; i<100; i++) {
869+
for(int i=0; i<((forests+2)*batchSize); i++) {
870870
batcher.addAs("test"+i+".txt", new StringHandle().with("Test"+i));
871871
}
872872

@@ -877,9 +877,8 @@ public void maxUrisTestWithQueryTask() {
877877
QueryBatcher queryBatcher = dmManager.newQueryBatcher(new StructuredQueryBuilder().collection("maxUrisTest"));
878878

879879
int forest_count = queryBatcher.getForestConfig().listForests().length;
880-
int maxBatches = forest_count-1;
881-
queryBatcher.setMaxBatches(maxBatches);
882-
queryBatcher.withBatchSize(10)
880+
queryBatcher.setMaxBatches(1);
881+
queryBatcher.withBatchSize(batchSize)
883882
.onUrisReady(batch -> {
884883
outputUris.addAll(Arrays.asList(batch.getItems()));
885884
counter.incrementAndGet();
@@ -891,10 +890,10 @@ public void maxUrisTestWithQueryTask() {
891890
dmManager.startJob(queryBatcher);
892891
queryBatcher.awaitCompletion();
893892
dmManager.stopJob(queryBatcher);
894-
assertTrue("Counter value not as expected", (counter.get() >= maxBatches) && (counter.get()<= (forest_count+maxBatches)));
893+
assertTrue("Counter value not as expected", (counter.get() >= 1) && (counter.get()<= (forest_count+1)));
895894

896895
// The number of documents should be more than maxBatches*batchSize but less than (batchSize*(forest_count+maxBatches))
897-
assertTrue("Output list does not contain expected number of outputs", (outputUris.size() >= (maxBatches*10)) && outputUris.size()<= (10*(forest_count+maxBatches)));
896+
assertTrue("Output list does not contain expected number of outputs", (outputUris.size() >= 10) && outputUris.size()<= (10*(forest_count+1)));
898897
}
899898

900899
static void changeAssignmentPolicy(String value) throws IOException {

0 commit comments

Comments
 (0)