Skip to content

Commit eeceb63

Browse files
authored
JAVA-5767 Support $lookup in CSFLE and QE (#1638)
JAVA-5767
1 parent 3b3ebc9 commit eeceb63

File tree

21 files changed

+481
-36
lines changed

21 files changed

+481
-36
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"_id": {
3+
"$binary": {
4+
"base64": "EjRWeBI0mHYSNBI0VniQEg==",
5+
"subType": "04"
6+
}
7+
},
8+
"keyMaterial": {
9+
"$binary": {
10+
"base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==",
11+
"subType": "00"
12+
}
13+
},
14+
"creationDate": {
15+
"$date": {
16+
"$numberLong": "1648914851981"
17+
}
18+
},
19+
"updateDate": {
20+
"$date": {
21+
"$numberLong": "1648914851981"
22+
}
23+
},
24+
"status": {
25+
"$numberInt": "0"
26+
},
27+
"masterKey": {
28+
"provider": "local"
29+
}
30+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"properties": {
3+
"csfle": {
4+
"encrypt": {
5+
"keyId": [
6+
{
7+
"$binary": {
8+
"base64": "EjRWeBI0mHYSNBI0VniQEg==",
9+
"subType": "04"
10+
}
11+
}
12+
],
13+
"bsonType": "string",
14+
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
15+
}
16+
}
17+
},
18+
"bsonType": "object"
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"properties": {
3+
"csfle2": {
4+
"encrypt": {
5+
"keyId": [
6+
{
7+
"$binary": {
8+
"base64": "EjRWeBI0mHYSNBI0VniQEg==",
9+
"subType": "04"
10+
}
11+
}
12+
],
13+
"bsonType": "string",
14+
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
15+
}
16+
}
17+
},
18+
"bsonType": "object"
19+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"escCollection": "enxcol_.qe.esc",
3+
"ecocCollection": "enxcol_.qe.ecoc",
4+
"fields": [
5+
{
6+
"keyId": {
7+
"$binary": {
8+
"base64": "EjRWeBI0mHYSNBI0VniQEg==",
9+
"subType": "04"
10+
}
11+
},
12+
"path": "qe",
13+
"bsonType": "string",
14+
"queries": {
15+
"queryType": "equality",
16+
"contention": 0
17+
}
18+
}
19+
]
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"escCollection": "enxcol_.qe2.esc",
3+
"ecocCollection": "enxcol_.qe2.ecoc",
4+
"fields": [
5+
{
6+
"keyId": {
7+
"$binary": {
8+
"base64": "EjRWeBI0mHYSNBI0VniQEg==",
9+
"subType": "04"
10+
}
11+
},
12+
"path": "qe2",
13+
"bsonType": "string",
14+
"queries": {
15+
"queryType": "equality",
16+
"contention": 0
17+
}
18+
}
19+
]
20+
}

driver-core/src/test/unit/com/mongodb/client/model/bulk/BaseClientDeleteOptionsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package com.mongodb.client.model.bulk;
1818

19-
import com.mongodb.MongoBaseInterfaceAssertions;
19+
import com.mongodb.testing.MongoBaseInterfaceAssertions;
2020
import org.junit.jupiter.api.Test;
2121

2222
class BaseClientDeleteOptionsTest {

driver-core/src/test/unit/com/mongodb/client/model/bulk/BaseClientUpdateOptionsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package com.mongodb.client.model.bulk;
1818

19-
import com.mongodb.MongoBaseInterfaceAssertions;
19+
import com.mongodb.testing.MongoBaseInterfaceAssertions;
2020
import org.junit.jupiter.api.Test;
2121

2222
class BaseClientUpdateOptionsTest {

driver-core/src/test/unit/com/mongodb/client/model/bulk/BaseClientUpsertableWriteModelOptionsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package com.mongodb.client.model.bulk;
1818

19-
import com.mongodb.MongoBaseInterfaceAssertions;
19+
import com.mongodb.testing.MongoBaseInterfaceAssertions;
2020
import org.junit.jupiter.api.Test;
2121

2222
final class BaseClientUpsertableWriteModelOptionsTest {

driver-core/src/test/unit/com/mongodb/client/model/bulk/BaseClientWriteModelOptionsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package com.mongodb.client.model.bulk;
1818

19-
import com.mongodb.MongoBaseInterfaceAssertions;
19+
import com.mongodb.testing.MongoBaseInterfaceAssertions;
2020
import org.junit.jupiter.api.Test;
2121

2222
final class BaseClientWriteModelOptionsTest {
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright 2008-present MongoDB, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.mongodb.testing;
18+
19+
import org.junit.jupiter.api.function.Executable;
20+
import org.opentest4j.AssertionFailedError;
21+
22+
import static org.junit.jupiter.api.Assertions.assertThrows;
23+
24+
public final class MongoAssertions {
25+
26+
private MongoAssertions() {
27+
//NOP
28+
}
29+
30+
public static <T extends Throwable> void assertCause(
31+
final Class<T> expectedCause, final String expectedMessageFragment, final Executable e) {
32+
Throwable cause = assertThrows(Throwable.class, e);
33+
while (cause.getCause() != null) {
34+
cause = cause.getCause();
35+
}
36+
if (!cause.getMessage().contains(expectedMessageFragment)) {
37+
throw new AssertionFailedError("Unexpected message: " + cause.getMessage(), cause);
38+
}
39+
if (!expectedCause.isInstance(cause)) {
40+
throw new AssertionFailedError("Unexpected cause: " + cause.getClass(), assertThrows(Throwable.class, e));
41+
}
42+
}
43+
}

0 commit comments

Comments
 (0)