Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static <T extends Resource> Flux<? extends IDocumentQueryExecutionContext

// return proxy
Flux<DocumentCollection> collectionObs = Flux.empty();

if (resourceTypeEnum.isCollectionChild()) {
collectionObs = resolveCollection(client, query, resourceTypeEnum, resourceLink).flux();
}
Expand Down Expand Up @@ -108,8 +108,8 @@ public static <T extends Resource> Flux<? extends IDocumentQueryExecutionContext

int initialPageSize = Utils.getValueOrDefault(feedOptions.maxItemCount(), ParallelQueryConfig.ClientInternalPageSize);

BadRequestException validationError = Utils.checkRequestOrReturnException
(initialPageSize > 0, "MaxItemCount", "INVALID MaxItemCount %s", initialPageSize);
BadRequestException validationError = Utils.checkRequestOrReturnException(
initialPageSize > 0 || initialPageSize == -1, "MaxItemCount", "Invalid MaxItemCount %s", initialPageSize);
if (validationError != null) {
return Flux.error(validationError);
}
Expand Down Expand Up @@ -144,7 +144,7 @@ public static <T extends Resource> Flux<? extends IDocumentQueryExecutionContext
// initialPageSize = Math.Min(
// (int)Math.Ceiling(initialPageSize / (double)targetRanges.Count) * PageSizeFactorForTop,
// initialPageSize);
// }
// }
}

return PipelinedDocumentQueryExecutionContext.createAsync(
Expand All @@ -160,6 +160,6 @@ public static <T extends Resource> Flux<? extends IDocumentQueryExecutionContext
initialPageSize,
isContinuationExpected,
getLazyFeedResponse,
correlatedActivityId);
correlatedActivityId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,34 +104,35 @@ public void conflictResolutionPolicyCRUD() {
}

// Tests the following scenarios
// 1. CUSTOM with valid sprocLink
// 2. CUSTOM with null sprocLink, should default to empty string
// 3. CUSTOM with empty sprocLink, should default to empty string
testConflictResolutionPolicyRequiringPath(ConflictResolutionMode.CUSTOM,
new String[] { "randomSprocName", null, "" }, new String[] { "randomSprocName", "", "" });
// 1. Custom with valid sprocLink
// 2. Custom with null sprocLink, should default to empty string
// 3. Custom with empty sprocLink, should default to empty string
testConflictResolutionPolicyRequiringPath(ConflictResolutionMode.CUSTOM, new String[] { "dbs/mydb/colls" +
"/mycoll/sprocs/randomSprocName", null, "" }, new String[] { "dbs/mydb/colls/mycoll/sprocs" +
"/randomSprocName", "", "" });
}

private void testConflictResolutionPolicyRequiringPath(ConflictResolutionMode conflictResolutionMode,
String[] paths, String[] expectedPaths) {
for (int i = 0; i < paths.length; i++) {
for (int i = 0; i < paths.length; i++) {
CosmosContainerProperties collectionSettings = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef);

if (conflictResolutionMode == ConflictResolutionMode.LAST_WRITER_WINS) {
collectionSettings.conflictResolutionPolicy(ConflictResolutionPolicy.createLastWriterWinsPolicy(paths[i]));
} else {
collectionSettings.conflictResolutionPolicy(ConflictResolutionPolicy.createCustomPolicy(paths[i]));
}
collectionSettings = database.createContainer(collectionSettings, new CosmosContainerRequestOptions()).block().properties();
assertThat(collectionSettings.conflictResolutionPolicy().mode()).isEqualTo(conflictResolutionMode);

if (conflictResolutionMode == ConflictResolutionMode.LAST_WRITER_WINS) {
assertThat(collectionSettings.conflictResolutionPolicy().conflictResolutionPath()).isEqualTo(expectedPaths[i]);
} else {
assertThat(collectionSettings.conflictResolutionPolicy().conflictResolutionProcedure()).isEqualTo(expectedPaths[i]);
}
}
}

@Test(groups = "multi-master", timeOut = TIMEOUT)
public void invalidConflictResolutionPolicy_LastWriterWinsWithStoredProc() throws Exception {
CosmosContainerProperties collection = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef);
Expand Down