Skip to content
Closed
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
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "specifications"]
path = testing/resources/specifications
url = https://github.com/mongodb/specifications
# TODO DRIVERS-3547: revert to https://github.com/mongodb/specifications once PR #1952 is merged
url = https://github.com/rozza/specifications
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import static com.mongodb.fixture.EncryptionFixture.getKmsProviders;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeFalse;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import static util.JsonPoweredTestHelper.getTestDocument;
Expand All @@ -73,6 +72,7 @@ public void setUp() {

MongoNamespace dataKeysNamespace = new MongoNamespace("keyvault.datakeys");
BsonDocument encryptedFields = bsonDocumentFromPath("encryptedFields.json");
BsonDocument encryptedFieldsC10 = bsonDocumentFromPath("encryptedFields-c10.json");
BsonDocument key1Document = bsonDocumentFromPath("keys/key1-document.json");

MongoDatabase explicitEncryptionDatabase = getDefaultDatabase();
Expand All @@ -81,6 +81,11 @@ public void setUp() {
explicitEncryptionDatabase.createCollection("explicit_encryption",
new CreateCollectionOptions().encryptedFields(encryptedFields));

explicitEncryptionDatabase.getCollection("explicit_encryption_c10")
.drop(new DropCollectionOptions().encryptedFields(encryptedFieldsC10));
explicitEncryptionDatabase.createCollection("explicit_encryption_c10",
new CreateCollectionOptions().encryptedFields(encryptedFieldsC10));

MongoCollection<BsonDocument> dataKeysCollection = getMongoClient()
.getDatabase(dataKeysNamespace.getDatabaseName())
.getCollection(dataKeysNamespace.getCollectionName(), BsonDocument.class)
Expand Down Expand Up @@ -140,26 +145,18 @@ public void canInsertEncryptedIndexedAndFind() {
public void canInsertEncryptedIndexedAndFindWithNonZeroContention() {
EncryptOptions encryptOptions = new EncryptOptions("Indexed").keyId(key1Id).contentionFactor(10L);
MongoCollection<BsonDocument> coll = encryptedClient.getDatabase(getDefaultDatabaseName())
.getCollection("explicit_encryption", BsonDocument.class);
.getCollection("explicit_encryption_c10", BsonDocument.class);

for (int i = 0; i < 10; i++) {
BsonBinary insertPayload = clientEncryption.encrypt(ENCRYPTED_INDEXED_VALUE, encryptOptions);
coll.insertOne(new BsonDocument("encryptedIndexed", insertPayload));
}

encryptOptions = new EncryptOptions("Indexed").keyId(key1Id).queryType("equality").contentionFactor(0L);
// Find with matching contentionFactor returns all 10 documents.
encryptOptions = new EncryptOptions("Indexed").keyId(key1Id).contentionFactor(10L).queryType("equality");
BsonBinary findPayload = clientEncryption.encrypt(ENCRYPTED_INDEXED_VALUE, encryptOptions);

List<BsonDocument> values = coll.find(new BsonDocument("encryptedIndexed", findPayload)).into(new ArrayList<>());
assertTrue(values.size() < 10);
values.forEach(v ->
assertEquals(ENCRYPTED_INDEXED_VALUE, v.get("encryptedIndexed"))
);

encryptOptions = new EncryptOptions("Indexed").keyId(key1Id).contentionFactor(10L).queryType("equality");
BsonBinary findPayload2 = clientEncryption.encrypt(ENCRYPTED_INDEXED_VALUE, encryptOptions);

values = coll.find(new BsonDocument("encryptedIndexed", findPayload2)).into(new ArrayList<>());

assertEquals(10, values.size());
values.forEach(v ->
Expand Down
2 changes: 1 addition & 1 deletion testing/resources/specifications
Submodule specifications updated 36 files
+7 −1 .github/CODEOWNERS
+12 −7 source/benchmarking/benchmarking.md
+ source/benchmarking/data/extended_bson.tgz
+19 −15 source/causal-consistency/causal-consistency.md
+151 −0 source/causal-consistency/tests/causal-consistency-clientBulkWrite.json
+75 −0 source/causal-consistency/tests/causal-consistency-clientBulkWrite.yml
+1,396 −0 source/causal-consistency/tests/causal-consistency-write-commands.json
+472 −0 source/causal-consistency/tests/causal-consistency-write-commands.yml
+36 −23 source/client-side-encryption/client-side-encryption.md
+30 −0 source/client-side-encryption/etc/data/encryptedFields-c10.json
+40 −0 source/client-side-encryption/etc/data/encryptedFields-prefix-suffix-ci-di.json
+11 −5 source/client-side-encryption/etc/data/encryptedFields-prefix-suffix.json
+31 −0 source/client-side-encryption/etc/data/encryptedFields-substring-ci-di.json
+3 −0 source/client-side-encryption/etc/data/encryptedFields-substring.json
+305 −64 source/client-side-encryption/tests/README.md
+3 −4 source/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.json
+3 −4 source/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.yml
+4 −5 source/client-side-encryption/tests/unified/QE-Text-compactStructuredEncryptionData.json
+3 −4 source/client-side-encryption/tests/unified/QE-Text-compactStructuredEncryptionData.yml
+5 −6 source/client-side-encryption/tests/unified/QE-Text-prefix.json
+5 −6 source/client-side-encryption/tests/unified/QE-Text-prefix.yml
+6 −7 source/client-side-encryption/tests/unified/QE-Text-suffix.json
+6 −7 source/client-side-encryption/tests/unified/QE-Text-suffix.yml
+5 −3 source/collation/collation.md
+6 −9 source/message/OP_MSG.md
+15 −16 source/mongodb-handshake/handshake.md
+25 −0 source/read-write-concern/read-write-concern.md
+5 −3 source/transactions-convenient-api/tests/unified/callback-aborts.json
+2 −1 source/transactions-convenient-api/tests/unified/callback-aborts.yml
+5 −3 source/transactions-convenient-api/tests/unified/callback-commits.json
+2 −1 source/transactions-convenient-api/tests/unified/callback-commits.yml
+18 −2 source/transactions/tests/unified/commit.json
+8 −2 source/transactions/tests/unified/commit.yml
+6 −2 source/transactions/tests/unified/retryable-writes.json
+4 −2 source/transactions/tests/unified/retryable-writes.yml
+5 −0 source/unified-test-format/tests/Makefile