Skip to content

Commit 71350fa

Browse files
committed
Rename to "appendMetadata".
JAVA-5870
1 parent 8ade58b commit 71350fa

File tree

12 files changed

+23
-24
lines changed

12 files changed

+23
-24
lines changed

driver-kotlin-coroutine/src/integrationTest/kotlin/com/mongodb/kotlin/client/coroutine/syncadapter/SyncMongoClient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal class SyncMongoClient(override val wrapped: MongoClient) : SyncMongoClu
2525

2626
override fun getClusterDescription(): ClusterDescription = wrapped.getClusterDescription()
2727

28-
override fun updateMetadata(mongoDriverInformation: MongoDriverInformation) {
28+
override fun appendMetadata(mongoDriverInformation: MongoDriverInformation) {
2929
throw UnsupportedOperationException("TODO-JAVA-5871")
3030
}
3131
}

driver-kotlin-coroutine/src/test/kotlin/com/mongodb/kotlin/client/coroutine/MongoClientTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ class MongoClientTest {
4848
JMongoClient::class
4949
.declaredFunctions
5050
.map { it.name }
51-
// TODO-JAVA-5871 remove .filterNot { it == "updateMetadata" }
52-
.filterNot { it == "updateMetadata" }
51+
// TODO-JAVA-5871 remove .filterNot { it == "appendMetadata" }
52+
.filterNot { it == "appendMetadata" }
5353
.toSet()
5454
val kMongoClientFunctions = MongoClient::class.declaredFunctions.map { it.name }.toSet()
5555

driver-kotlin-sync/src/integrationTest/kotlin/com/mongodb/kotlin/client/syncadapter/SyncMongoClient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ internal class SyncMongoClient(override val wrapped: MongoClient) : SyncMongoClu
2424
override fun close(): Unit = wrapped.close()
2525

2626
override fun getClusterDescription(): ClusterDescription = wrapped.clusterDescription
27-
override fun updateMetadata(mongoDriverInformation: MongoDriverInformation) {
27+
override fun appendMetadata(mongoDriverInformation: MongoDriverInformation) {
2828
throw UnsupportedOperationException("TODO-JAVA-5871")
2929
}
3030
}

driver-kotlin-sync/src/test/kotlin/com/mongodb/kotlin/client/MongoClientTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class MongoClientTest {
4747
JMongoClient::class
4848
.declaredFunctions
4949
.map { it.name }
50-
// TODO-JAVA-5871 remove .filterNot { it == "updateMetadata" }
51-
.filterNot { it == "updateMetadata" }
50+
// TODO-JAVA-5871 remove .filterNot { it == "appendMetadata" }
51+
.filterNot { it == "appendMetadata" }
5252
.toSet()
5353

5454
val kMongoClientFunctions =

driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/MongoClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ public interface MongoClient extends MongoCluster, Closeable {
6161
ClusterDescription getClusterDescription();
6262

6363
/**
64-
* Updates the {@link MongoClient} metadata by appending the provided {@link MongoDriverInformation}
65-
* to the existing metadata.
64+
* Appends the provided {@link MongoDriverInformation} to the existing metadata.
65+
*
6666
* <p>
6767
* This enables frameworks and libraries to include identifying metadata (e.g., name, version, platform) which might be visible in
6868
* the MongoD/MongoS logs. This can assist with diagnostics by making client identity visible to the server.
@@ -72,5 +72,5 @@ public interface MongoClient extends MongoCluster, Closeable {
7272
* @param mongoDriverInformation the driver information to append to the existing metadata
7373
* @since 5.6
7474
*/
75-
void updateMetadata(MongoDriverInformation mongoDriverInformation);
75+
void appendMetadata(MongoDriverInformation mongoDriverInformation);
7676
}

driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/internal/MongoClientImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ public ClusterDescription getClusterDescription() {
327327
}
328328

329329
@Override
330-
public void updateMetadata(final MongoDriverInformation mongoDriverInformation) {
330+
public void appendMetadata(final MongoDriverInformation mongoDriverInformation) {
331331
getCluster().getClientMetadata().append(mongoDriverInformation);
332332
}
333333
}

driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/syncadapter/SyncMongoClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ public ClusterDescription getClusterDescription() {
313313
}
314314

315315
@Override
316-
public void updateMetadata(final MongoDriverInformation mongoDriverInformation) {
317-
wrapped.updateMetadata(mongoDriverInformation);
316+
public void appendMetadata(final MongoDriverInformation mongoDriverInformation) {
317+
wrapped.appendMetadata(mongoDriverInformation);
318318
}
319319
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.mongodb.scala.syncadapter
22

33
import com.mongodb.MongoDriverInformation
4-
import com.mongodb.client.{ MongoClient => JMongoClient }
4+
import com.mongodb.client.{MongoClient => JMongoClient}
55
import org.mongodb.scala.MongoClient
66

77
case class SyncMongoClient(wrapped: MongoClient) extends SyncMongoCluster(wrapped) with JMongoClient {
@@ -10,6 +10,6 @@ case class SyncMongoClient(wrapped: MongoClient) extends SyncMongoCluster(wrappe
1010

1111
override def getClusterDescription = throw new UnsupportedOperationException
1212

13-
override def updateMetadata(mongoDriverInformation: MongoDriverInformation): Unit =
13+
override def appendMetadata(mongoDriverInformation: MongoDriverInformation): Unit =
1414
throw new UnsupportedOperationException("TODO-JAVA-5871")
1515
}

driver-scala/src/test/scala/org/mongodb/scala/MongoClientSpec.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
package org.mongodb.scala
1818

19-
import com.mongodb.reactivestreams.client.{ MongoClient => JMongoClient }
19+
import com.mongodb.reactivestreams.client.{MongoClient => JMongoClient}
2020
import org.bson.BsonDocument
2121
import org.mockito.Mockito.verify
22-
import org.mongodb.scala.model.bulk.{ ClientBulkWriteOptions, ClientNamespacedWriteModel }
22+
import org.mongodb.scala.model.bulk.{ClientBulkWriteOptions, ClientNamespacedWriteModel}
2323
import org.scalatestplus.mockito.MockitoSugar
2424

2525
import scala.collection.JavaConverters._
@@ -37,7 +37,7 @@ class MongoClientSpec extends BaseSpec with MockitoSugar {
3737

3838
wrapped.foreach((name: String) => {
3939
// TODO-JAVA-5871 remove this if statement, but leave the body.
40-
if (!name.equals("updateMetadata")) {
40+
if (!name.equals("appendMetadata")) {
4141
val cleanedName = name.stripPrefix("get")
4242
assert(local.contains(name) | local.contains(cleanedName.head.toLower + cleanedName.tail), s"Missing: $name")
4343
}

driver-sync/src/main/com/mongodb/client/MongoClient.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ public interface MongoClient extends MongoCluster, Closeable {
6464
ClusterDescription getClusterDescription();
6565

6666
/**
67-
* Updates the {@link MongoClient} metadata by appending the provided {@link MongoDriverInformation}
68-
* to the existing metadata.
67+
* Appends the provided {@link MongoDriverInformation} to the existing metadata.
6968
* <p>
7069
* This enables frameworks and libraries to include identifying metadata (e.g., name, version, platform) which might be visible in
7170
* the MongoD/MongoS logs. This can assist with diagnostics by making client identity visible to the server.
@@ -75,5 +74,5 @@ public interface MongoClient extends MongoCluster, Closeable {
7574
* @param mongoDriverInformation the driver information to append to the existing metadata
7675
* @since 5.6
7776
*/
78-
void updateMetadata(MongoDriverInformation mongoDriverInformation);
77+
void appendMetadata(MongoDriverInformation mongoDriverInformation);
7978
}

driver-sync/src/main/com/mongodb/client/internal/MongoClientImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public ClusterDescription getClusterDescription() {
136136
}
137137

138138
@Override
139-
public void updateMetadata(final MongoDriverInformation mongoDriverInformation) {
139+
public void appendMetadata(final MongoDriverInformation mongoDriverInformation) {
140140
delegate.getCluster().getClientMetadata().append(mongoDriverInformation);
141141
}
142142

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ void shouldAppendToDefaultClientMetadataWhenUpdatedAfterInitialization(@Nullable
169169
}
170170

171171
@Test
172-
void shouldNotCloseExistingConnectionsToUpdateMetadata() {
172+
void shouldNotCloseExistingConnectionsToAppendMetadata() {
173173
//given
174174
MongoDriverInformation initialWrappingLibraryDriverInformation = MongoDriverInformation.builder()
175175
.driverName("library")
@@ -186,7 +186,7 @@ void shouldNotCloseExistingConnectionsToUpdateMetadata() {
186186
assertNotNull(driverInformation);
187187

188188
//when
189-
mongoClient.updateMetadata(initialWrappingLibraryDriverInformation);
189+
mongoClient.appendMetadata(initialWrappingLibraryDriverInformation);
190190

191191
//then
192192
assertThat(executePingAndCaptureMetadataHandshake(mongoClient)).isEmpty();
@@ -260,7 +260,7 @@ private static void updateClientMetadata(@Nullable final String driverVersion,
260260
ofNullable(driverName).ifPresent(builder::driverName);
261261
ofNullable(driverVersion).ifPresent(builder::driverVersion);
262262
ofNullable(driverPlatform).ifPresent(builder::driverPlatform);
263-
mongoClient.updateMetadata(builder.build());
263+
mongoClient.appendMetadata(builder.build());
264264
}
265265
}
266266

0 commit comments

Comments
 (0)