Skip to content

Commit 390cd0c

Browse files
authored
Tests: Add support for crud tests bypassDocumentationValidation.json (#1687)
JAVA-5827
1 parent 4caca7b commit 390cd0c

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

driver-sync/src/test/functional/com/mongodb/client/unified/UnifiedCrudHelper.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,9 @@ OperationResult executeFindOneAndUpdate(final BsonDocument operation) {
638638
case "arrayFilters":
639639
options.arrayFilters(cur.getValue().asArray().stream().map(BsonValue::asDocument).collect(toList()));
640640
break;
641+
case "bypassDocumentValidation":
642+
options.bypassDocumentValidation(cur.getValue().asBoolean().getValue());
643+
break;
641644
default:
642645
throw new UnsupportedOperationException("Unsupported argument: " + cur.getKey());
643646
}
@@ -714,6 +717,9 @@ OperationResult executeFindOneAndReplace(final BsonDocument operation) {
714717
case "collation":
715718
options.collation(asCollation(cur.getValue().asDocument()));
716719
break;
720+
case "bypassDocumentValidation":
721+
options.bypassDocumentValidation(cur.getValue().asBoolean().getValue());
722+
break;
717723
default:
718724
throw new UnsupportedOperationException("Unsupported argument: " + cur.getKey());
719725
}
@@ -831,6 +837,9 @@ OperationResult executeAggregate(final BsonDocument operation) {
831837
case "maxAwaitTimeMS":
832838
iterable.maxAwaitTime(cur.getValue().asNumber().longValue(), TimeUnit.MILLISECONDS);
833839
break;
840+
case "bypassDocumentValidation":
841+
iterable.bypassDocumentValidation(cur.getValue().asBoolean().getValue());
842+
break;
834843
default:
835844
throw new UnsupportedOperationException("Unsupported argument: " + cur.getKey());
836845
}
@@ -981,6 +990,9 @@ OperationResult executeInsertOne(final BsonDocument operation) {
981990
case "comment":
982991
options.comment(cur.getValue());
983992
break;
993+
case "bypassDocumentValidation":
994+
options.bypassDocumentValidation(cur.getValue().asBoolean().getValue());
995+
break;
984996
default:
985997
throw new UnsupportedOperationException("Unsupported argument: " + cur.getKey());
986998
}
@@ -1018,6 +1030,9 @@ OperationResult executeInsertMany(final BsonDocument operation) {
10181030
case "comment":
10191031
options.comment(cur.getValue());
10201032
break;
1033+
case "bypassDocumentValidation":
1034+
options.bypassDocumentValidation(cur.getValue().asBoolean().getValue());
1035+
break;
10211036
default:
10221037
throw new UnsupportedOperationException("Unsupported argument: " + cur.getKey());
10231038
}
@@ -1062,6 +1077,9 @@ OperationResult executeBulkWrite(final BsonDocument operation) {
10621077
case "let":
10631078
options.let(cur.getValue().asDocument());
10641079
break;
1080+
case "bypassDocumentValidation":
1081+
options.bypassDocumentValidation(cur.getValue().asBoolean().getValue());
1082+
break;
10651083
default:
10661084
throw new UnsupportedOperationException("Unsupported argument: " + cur.getKey());
10671085
}
@@ -1192,6 +1210,9 @@ private UpdateOptions getUpdateOptions(final BsonDocument arguments) {
11921210
case "sort":
11931211
options.sort(cur.getValue().asDocument());
11941212
break;
1213+
case "bypassDocumentValidation":
1214+
options.bypassDocumentValidation(cur.getValue().asBoolean().getValue());
1215+
break;
11951216
default:
11961217
throw new UnsupportedOperationException("Unsupported argument: " + cur.getKey());
11971218
}
@@ -1229,6 +1250,9 @@ private ReplaceOptions getReplaceOptions(final BsonDocument arguments) {
12291250
case "sort":
12301251
options.sort(cur.getValue().asDocument());
12311252
break;
1253+
case "bypassDocumentValidation":
1254+
options.bypassDocumentValidation(cur.getValue().asBoolean().getValue());
1255+
break;
12321256
default:
12331257
throw new UnsupportedOperationException("Unsupported argument: " + cur.getKey());
12341258
}

driver-sync/src/test/functional/com/mongodb/client/unified/UnifiedTestModifications.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,6 @@ public static void applyCustomizations(final TestDef def) {
164164
.when(() -> def.isReactive() && UnifiedTest.Language.KOTLIN.equals(def.getLanguage()))
165165
.file("crud", "findOne");
166166

167-
def.skipJira("https://jira.mongodb.org/browse/JAVA-5827")
168-
.file("crud", "bypassDocumentValidation");
169167
def.skipNoncompliant("Updates and Replace bulk operations are split in the java driver")
170168
.file("crud", "bulkWrite-comment");
171169

0 commit comments

Comments
 (0)