Skip to content

Commit 905202f

Browse files
authored
Merge branch 'master' into JAVA-5345
2 parents 12083ad + a461dba commit 905202f

File tree

742 files changed

+66890
-9128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

742 files changed

+66890
-9128
lines changed

.evergreen/.evg.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ functions:
265265
env:
266266
AWS_ACCESS_KEY_ID: ${aws_access_key_id}
267267
AWS_SECRET_ACCESS_KEY: ${aws_secret_access_key}
268+
AWS_ACCESS_KEY_ID_AWS_KMS_NAMED: ${aws_access_key_id_2}
269+
AWS_SECRET_ACCESS_KEY_AWS_KMS_NAMED: ${aws_secret_access_key_2}
268270
AWS_DEFAULT_REGION: us-east-1
269271
AZURE_TENANT_ID: ${azure_tenant_id}
270272
AZURE_CLIENT_ID: ${azure_client_id}
@@ -709,6 +711,8 @@ functions:
709711
env:
710712
AWS_ACCESS_KEY_ID: ${aws_access_key_id}
711713
AWS_SECRET_ACCESS_KEY: ${aws_secret_access_key}
714+
AWS_ACCESS_KEY_ID_AWS_KMS_NAMED: ${aws_access_key_id_2}
715+
AWS_SECRET_ACCESS_KEY_AWS_KMS_NAMED: ${aws_secret_access_key_2}
712716
AWS_DEFAULT_REGION: us-east-1
713717
AZURE_TENANT_ID: ${azure_tenant_id}
714718
AZURE_CLIENT_ID: ${azure_client_id}
@@ -1881,11 +1885,6 @@ axes:
18811885
variables:
18821886
VAULT_NAME: "serverless"
18831887
batchtime: 10080 # 7 days
1884-
- id: "terminating"
1885-
display_name: "Serverless Terminating Proxy"
1886-
variables:
1887-
VAULT_NAME: "serverless_next"
1888-
batchtime: 10080 # 7 days
18891888

18901889
task_groups:
18911890
- name: test_atlas_task_group_search_indexes

.evergreen/run-csfle-tests-with-mongocryptd.sh

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@ set -o xtrace # Write all commands first to stderr
44
set -o errexit # Exit the script with error if any of the commands fail
55

66
# Supported/used environment variables:
7-
# MONGODB_URI Set the suggested connection MONGODB_URI (including credentials and topology info)
8-
# JAVA_VERSION Set the version of java to be used. Java versions can be set from the java toolchain /opt/java
9-
# AWS_ACCESS_KEY_ID The AWS access key identifier for client-side encryption
10-
# AWS_SECRET_ACCESS_KEY The AWS secret access key for client-side encryption
11-
# AWS_TEMP_ACCESS_KEY_ID The temporary AWS access key identifier for client-side encryption
12-
# AWS_TEMP_SECRET_ACCESS_KEY The temporary AWS secret access key for client-side encryption
13-
# AWS_TEMP_SESSION_TOKEN The temporary AWS session token for client-side encryption
14-
# AZURE_TENANT_ID The Azure tenant identifier for client-side encryption
15-
# AZURE_CLIENT_ID The Azure client identifier for client-side encryption
16-
# AZURE_CLIENT_SECRET The Azure client secret for client-side encryption
17-
# GCP_EMAIL The GCP email for client-side encryption
18-
# GCP_PRIVATE_KEY The GCP private key for client-side encryption
19-
# AZUREKMS_KEY_VAULT_ENDPOINT The Azure key vault endpoint for integration tests
20-
# AZUREKMS_KEY_NAME The Azure key name endpoint for integration tests
7+
# MONGODB_URI Set the suggested connection MONGODB_URI (including credentials and topology info)
8+
# JAVA_VERSION Set the version of java to be used. Java versions can be set from the java toolchain /opt/java
9+
# AWS_ACCESS_KEY_ID The AWS access key identifier for client-side encryption
10+
# AWS_SECRET_ACCESS_KEY The AWS secret access key for client-side encryption
11+
# AWS_ACCESS_KEY_ID_AWS_KMS_NAMED The AWS access key identifier for client-side encryption's named KMS provider.
12+
# AWS_SECRET_ACCESS_KEY_AWS_KMS_NAMED The AWS secret access key for client-side encryption's named KMS provider.
13+
# AWS_TEMP_ACCESS_KEY_ID The temporary AWS access key identifier for client-side encryption
14+
# AWS_TEMP_SECRET_ACCESS_KEY The temporary AWS secret access key for client-side encryption
15+
# AWS_TEMP_SESSION_TOKEN The temporary AWS session token for client-side encryption
16+
# AZURE_TENANT_ID The Azure tenant identifier for client-side encryption
17+
# AZURE_CLIENT_ID The Azure client identifier for client-side encryption
18+
# AZURE_CLIENT_SECRET The Azure client secret for client-side encryption
19+
# GCP_EMAIL The GCP email for client-side encryption
20+
# GCP_PRIVATE_KEY The GCP private key for client-side encryption
21+
# AZUREKMS_KEY_VAULT_ENDPOINT The Azure key vault endpoint for integration tests
22+
# AZUREKMS_KEY_NAME The Azure key name endpoint for integration tests
2123

2224
MONGODB_URI=${MONGODB_URI:-}
2325

.evergreen/run-tests.sh

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,30 @@ set -o xtrace # Write all commands first to stderr
44
set -o errexit # Exit the script with error if any of the commands fail
55

66
# Supported/used environment variables:
7-
# AUTH Set to enable authentication. Values are: "auth" / "noauth" (default)
8-
# SSL Set to enable SSL. Values are "ssl" / "nossl" (default)
9-
# NETTY_SSL_PROVIDER The Netty TLS/SSL protocol provider. Ignored unless SSL is "ssl" and STREAM_TYPE is "netty". Values are "JDK", "OPENSSL", null (a.k.a. "" or '') (default).
10-
# MONGODB_URI Set the suggested connection MONGODB_URI (including credentials and topology info)
11-
# TOPOLOGY Allows you to modify variables and the MONGODB_URI based on test topology
12-
# Supported values: "server", "replica_set", "sharded_cluster"
13-
# COMPRESSOR Set to enable compression. Values are "snappy" and "zlib" (default is no compression)
14-
# STREAM_TYPE Set the stream type. Values are "nio2" or "netty". Defaults to "nio2".
15-
# JDK Set the version of java to be used. Java versions can be set from the java toolchain /opt/java
16-
# SLOW_TESTS_ONLY Set to true to only run the slow tests
17-
# AWS_ACCESS_KEY_ID The AWS access key identifier for client-side encryption
18-
# AWS_SECRET_ACCESS_KEY The AWS secret access key for client-side encryption
19-
# AWS_TEMP_ACCESS_KEY_ID The temporary AWS access key identifier for client-side encryption
20-
# AWS_TEMP_SECRET_ACCESS_KEY The temporary AWS secret access key for client-side encryption
21-
# AWS_TEMP_SESSION_TOKEN The temporary AWS session token for client-side encryption
22-
# AZURE_TENANT_ID The Azure tenant identifier for client-side encryption
23-
# AZURE_CLIENT_ID The Azure client identifier for client-side encryption
24-
# AZURE_CLIENT_SECRET The Azure client secret for client-side encryption
25-
# GCP_EMAIL The GCP email for client-side encryption
26-
# GCP_PRIVATE_KEY The GCP private key for client-side encryption
27-
# AZUREKMS_KEY_VAULT_ENDPOINT The Azure key vault endpoint for integration tests
28-
# AZUREKMS_KEY_NAME The Azure key name endpoint for integration tests
7+
# AUTH Set to enable authentication. Values are: "auth" / "noauth" (default)
8+
# SSL Set to enable SSL. Values are "ssl" / "nossl" (default)
9+
# NETTY_SSL_PROVIDER The Netty TLS/SSL protocol provider. Ignored unless SSL is "ssl" and STREAM_TYPE is "netty". Values are "JDK", "OPENSSL", null (a.k.a. "" or '') (default).
10+
# MONGODB_URI Set the suggested connection MONGODB_URI (including credentials and topology info)
11+
# TOPOLOGY Allows you to modify variables and the MONGODB_URI based on test topology
12+
# Supported values: "server", "replica_set", "sharded_cluster"
13+
# COMPRESSOR Set to enable compression. Values are "snappy" and "zlib" (default is no compression)
14+
# STREAM_TYPE Set the stream type. Values are "nio2" or "netty". Defaults to "nio2".
15+
# JDK Set the version of java to be used. Java versions can be set from the java toolchain /opt/java
16+
# SLOW_TESTS_ONLY Set to true to only run the slow tests
17+
# AWS_ACCESS_KEY_ID The AWS access key identifier for client-side encryption
18+
# AWS_SECRET_ACCESS_KEY The AWS secret access key for client-side encryption
19+
# AWS_ACCESS_KEY_ID_AWS_KMS_NAMED The AWS access key identifier for client-side encryption's named KMS provider.
20+
# AWS_SECRET_ACCESS_KEY_AWS_KMS_NAMED The AWS secret access key for client-side encryption's named KMS provider.
21+
# AWS_TEMP_ACCESS_KEY_ID The temporary AWS access key identifier for client-side encryption
22+
# AWS_TEMP_SECRET_ACCESS_KEY The temporary AWS secret access key for client-side encryption
23+
# AWS_TEMP_SESSION_TOKEN The temporary AWS session token for client-side encryption
24+
# AZURE_TENANT_ID The Azure tenant identifier for client-side encryption
25+
# AZURE_CLIENT_ID The Azure client identifier for client-side encryption
26+
# AZURE_CLIENT_SECRET The Azure client secret for client-side encryption
27+
# GCP_EMAIL The GCP email for client-side encryption
28+
# GCP_PRIVATE_KEY The GCP private key for client-side encryption
29+
# AZUREKMS_KEY_VAULT_ENDPOINT The Azure key vault endpoint for integration tests
30+
# AZUREKMS_KEY_NAME The Azure key name endpoint for integration tests
2931

3032
AUTH=${AUTH:-noauth}
3133
SSL=${SSL:-nossl}

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ almost always be binary compatible with prior minor releases from the same major
5454
Patch 5.x.y increments (such as 5.0.0 -> 5.0.1, 5.1.1 -> 5.1.2, etc) will occur for bug fixes only and will always be binary compatible
5555
with prior patch releases of the same minor release branch.
5656

57+
#### @Alpha
58+
59+
APIs marked with the `@Alpha` annotation are in the early stages of development, subject to incompatible changes,
60+
or even removal, in a future release and may lack some intended features. An APIs bearing `@Alpha` annotation may
61+
contain known issues affecting functionality, performance, and stability. They are also exempt from any compatibility
62+
guarantees made by its containing library.
63+
64+
It is inadvisable for <i>applications</i> to use Alpha APIs in production environments or for <i>libraries</i>
65+
(which get included on users' CLASSPATHs, outside the library developers' control) to depend on these APIs. Alpha APIs
66+
are intended for <b>experimental purposes</b> only.
67+
5768
#### @Beta
5869

5970
APIs marked with the `@Beta` annotation at the class or method level are subject to change. They can be modified in any way, or even

THIRD-PARTY-NOTICES

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ https://github.com/mongodb/mongo-java-driver.
3737
See the License for the specific language governing permissions and
3838
limitations under the License.
3939

40-
3) The following files: Beta.java
40+
3) The following files:
41+
42+
Alpha.java (formerly Beta.java)
43+
Beta.java
4144

4245
Copyright 2010 The Guava Authors
4346
Copyright 2011 The Guava Authors

bson-kotlin/src/main/kotlin/org/bson/codecs/kotlin/DataClassCodec.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ package org.bson.codecs.kotlin
1818
import java.lang.reflect.ParameterizedType
1919
import java.lang.reflect.Type
2020
import kotlin.reflect.KClass
21+
import kotlin.reflect.KClassifier
2122
import kotlin.reflect.KFunction
2223
import kotlin.reflect.KParameter
2324
import kotlin.reflect.KProperty1
24-
import kotlin.reflect.KType
2525
import kotlin.reflect.KTypeParameter
2626
import kotlin.reflect.KTypeProjection
2727
import kotlin.reflect.full.createType
@@ -142,7 +142,9 @@ internal data class DataClassCodec<T : Any>(
142142
val primaryConstructor =
143143
kClass.primaryConstructor ?: throw CodecConfigurationException("No primary constructor for $kClass")
144144
val typeMap =
145-
types.mapIndexed { i, k -> primaryConstructor.typeParameters[i].createType() to k }.toMap()
145+
types
146+
.mapIndexed { i, k -> primaryConstructor.typeParameters[i].createType().classifier!! to k }
147+
.toMap()
146148

147149
val propertyModels =
148150
primaryConstructor.parameters.map { kParameter ->
@@ -193,18 +195,20 @@ internal data class DataClassCodec<T : Any>(
193195
@Suppress("UNCHECKED_CAST")
194196
private fun getCodec(
195197
kParameter: KParameter,
196-
typeMap: Map<KType, Type>,
198+
typeMap: Map<KClassifier, Type>,
197199
codecRegistry: CodecRegistry
198200
): Codec<Any> {
199201
return when (kParameter.type.classifier) {
200202
is KClass<*> -> {
201203
codecRegistry.getCodec(
202204
kParameter,
203205
(kParameter.type.classifier as KClass<Any>).javaObjectType,
204-
kParameter.type.arguments.mapNotNull { typeMap[it.type] ?: computeJavaType(it) }.toList())
206+
kParameter.type.arguments
207+
.mapNotNull { typeMap[it.type?.classifier] ?: computeJavaType(it) }
208+
.toList())
205209
}
206210
is KTypeParameter -> {
207-
when (val pType = typeMap[kParameter.type] ?: kParameter.type.javaType) {
211+
when (val pType = typeMap[kParameter.type.classifier] ?: kParameter.type.javaType) {
208212
is Class<*> ->
209213
codecRegistry.getCodec(kParameter, (pType as Class<Any>).kotlin.javaObjectType, emptyList())
210214
is ParameterizedType ->

bson-kotlin/src/test/kotlin/org/bson/codecs/kotlin/DataClassCodecTest.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,17 @@ class DataClassCodecTest {
249249
|"nestedParameterized": {
250250
| "parameterizedDataClass":
251251
| {"number": 4.2, "string": "myString", "parameterizedList": [{"name": "embedded1"}]},
252-
| "other": "myOtherString"
252+
| "other": "myOtherString", "optionalOther": "myOptionalOtherString"
253253
| }
254254
|}"""
255255
.trimMargin()
256256
val dataClass =
257257
DataClassWithNestedParameterizedDataClass(
258258
"myId",
259259
DataClassWithNestedParameterized(
260-
DataClassParameterized(4.2, "myString", listOf(DataClassEmbedded("embedded1"))), "myOtherString"))
260+
DataClassParameterized(4.2, "myString", listOf(DataClassEmbedded("embedded1"))),
261+
"myOtherString",
262+
"myOptionalOtherString"))
261263

262264
assertRoundTrips(expected, dataClass)
263265
}

bson-kotlin/src/test/kotlin/org/bson/codecs/kotlin/samples/DataClasses.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ data class DataClassWithNestedParameterizedDataClass(
8989

9090
data class DataClassWithNestedParameterized<A, B, C : Number>(
9191
val parameterizedDataClass: DataClassParameterized<C, A>,
92-
val other: B
92+
val other: B,
93+
val optionalOther: B?
9394
)
9495

9596
data class DataClassWithPair(val pair: Pair<String, Int>)

bson-kotlinx/src/main/kotlin/org/bson/codecs/kotlinx/BsonDecoder.kt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ import org.bson.BsonType
3636
import org.bson.BsonValue
3737
import org.bson.codecs.BsonValueCodec
3838
import org.bson.codecs.DecoderContext
39+
import org.bson.internal.NumberCodecHelper
40+
import org.bson.internal.StringCodecHelper
3941
import org.bson.types.ObjectId
4042

4143
/**
@@ -154,14 +156,17 @@ internal open class DefaultBsonDecoder(
154156
}
155157
}
156158

157-
override fun decodeByte(): Byte = decodeInt().toByte()
158-
override fun decodeChar(): Char = decodeString().single()
159-
override fun decodeFloat(): Float = decodeDouble().toFloat()
160-
override fun decodeShort(): Short = decodeInt().toShort()
161-
override fun decodeBoolean(): Boolean = readOrThrow({ reader.readBoolean() }, BsonType.BOOLEAN)
162-
override fun decodeDouble(): Double = readOrThrow({ reader.readDouble() }, BsonType.DOUBLE)
163-
override fun decodeInt(): Int = readOrThrow({ reader.readInt32() }, BsonType.INT32)
164-
override fun decodeLong(): Long = readOrThrow({ reader.readInt64() }, BsonType.INT64)
159+
override fun decodeByte(): Byte = NumberCodecHelper.decodeByte(reader)
160+
161+
override fun decodeChar(): Char = StringCodecHelper.decodeChar(reader)
162+
override fun decodeFloat(): Float = NumberCodecHelper.decodeFloat(reader)
163+
164+
override fun decodeShort(): Short = NumberCodecHelper.decodeShort(reader)
165+
override fun decodeBoolean(): Boolean = reader.readBoolean()
166+
167+
override fun decodeDouble(): Double = NumberCodecHelper.decodeDouble(reader)
168+
override fun decodeInt(): Int = NumberCodecHelper.decodeInt(reader)
169+
override fun decodeLong(): Long = NumberCodecHelper.decodeLong(reader)
165170
override fun decodeString(): String = readOrThrow({ reader.readString() }, BsonType.STRING)
166171

167172
override fun decodeNull(): Nothing? {

0 commit comments

Comments
 (0)