@@ -36,11 +36,12 @@ import com.mongodb.internal.selector.ReadPreferenceServerSelector
36
36
import com.mongodb.internal.selector.ServerAddressSelector
37
37
import com.mongodb.internal.selector.WritableServerSelector
38
38
import com.mongodb.internal.time.Timeout
39
- import spock.lang.Specification
40
39
import com.mongodb.spock.Slow
40
+ import spock.lang.Specification
41
41
42
42
import java.util.concurrent.CountDownLatch
43
43
44
+ import static com.mongodb.ClusterFixture.CLIENT_METADATA
44
45
import static com.mongodb.ClusterFixture.OPERATION_CONTEXT
45
46
import static com.mongodb.ClusterFixture.TIMEOUT_SETTINGS
46
47
import static com.mongodb.ClusterFixture.createOperationContext
@@ -68,7 +69,7 @@ class BaseClusterSpecification extends Specification {
68
69
.hosts([firstServer, secondServer, thirdServer])
69
70
.serverSelector(new ServerAddressSelector (firstServer))
70
71
.build()
71
- def cluster = new BaseCluster (new ClusterId (), clusterSettings, factory) {
72
+ def cluster = new BaseCluster (new ClusterId (), clusterSettings, factory, CLIENT_METADATA ) {
72
73
@Override
73
74
protected void connect () {
74
75
}
@@ -114,7 +115,7 @@ class BaseClusterSpecification extends Specification {
114
115
.serverSelectionTimeout(1 , SECONDS )
115
116
.serverSelector(new ServerAddressSelector (firstServer))
116
117
.build()
117
- def cluster = new MultiServerCluster (new ClusterId (), clusterSettings, factory)
118
+ def cluster = new MultiServerCluster (new ClusterId (), clusterSettings, factory, CLIENT_METADATA )
118
119
119
120
expect :
120
121
cluster. getSettings() == clusterSettings
@@ -128,7 +129,7 @@ class BaseClusterSpecification extends Specification {
128
129
.serverSelectionTimeout(1 , SECONDS )
129
130
.serverSelector(new ServerAddressSelector (firstServer))
130
131
.build(),
131
- factory)
132
+ factory, CLIENT_METADATA )
132
133
factory. sendNotification(firstServer, REPLICA_SET_SECONDARY , allServers)
133
134
factory. sendNotification(secondServer, REPLICA_SET_SECONDARY , allServers)
134
135
factory. sendNotification(thirdServer, REPLICA_SET_PRIMARY , allServers)
@@ -144,7 +145,7 @@ class BaseClusterSpecification extends Specification {
144
145
builder(). mode(MULTIPLE )
145
146
.hosts([firstServer, secondServer, thirdServer])
146
147
.build(),
147
- factory)
148
+ factory, CLIENT_METADATA )
148
149
factory. sendNotification(firstServer, REPLICA_SET_SECONDARY , allServers)
149
150
factory. sendNotification(secondServer, REPLICA_SET_SECONDARY , allServers)
150
151
factory. sendNotification(thirdServer, REPLICA_SET_PRIMARY , allServers)
@@ -164,7 +165,7 @@ class BaseClusterSpecification extends Specification {
164
165
.serverSelector(new ReadPreferenceServerSelector (ReadPreference . secondary()))
165
166
.localThreshold(5 , MILLISECONDS )
166
167
.build(),
167
- factory)
168
+ factory, CLIENT_METADATA )
168
169
factory. sendNotification(firstServer, 1 , REPLICA_SET_SECONDARY , allServers)
169
170
factory. sendNotification(secondServer, 7 , REPLICA_SET_SECONDARY , allServers)
170
171
factory. sendNotification(thirdServer, 1 , REPLICA_SET_PRIMARY , allServers)
@@ -182,7 +183,7 @@ class BaseClusterSpecification extends Specification {
182
183
.hosts([firstServer, secondServer, thirdServer])
183
184
.localThreshold(5 , MILLISECONDS )
184
185
.build(),
185
- factory)
186
+ factory, CLIENT_METADATA )
186
187
factory. sendNotification(firstServer, 1 , REPLICA_SET_SECONDARY , allServers)
187
188
factory. sendNotification(secondServer, 7 , REPLICA_SET_SECONDARY , allServers)
188
189
factory. sendNotification(thirdServer, 1 , REPLICA_SET_PRIMARY , allServers)
@@ -198,7 +199,7 @@ class BaseClusterSpecification extends Specification {
198
199
builder(). mode(MULTIPLE )
199
200
.hosts([firstServer, secondServer])
200
201
.build(),
201
- factory)
202
+ factory, CLIENT_METADATA )
202
203
203
204
when :
204
205
factory. sendNotification(firstServer, ServerDescription . builder(). type(ServerType . UNKNOWN )
@@ -229,7 +230,7 @@ class BaseClusterSpecification extends Specification {
229
230
builder(). mode(MULTIPLE )
230
231
.hosts([firstServer, secondServer, thirdServer])
231
232
.build(),
232
- factory)
233
+ factory, CLIENT_METADATA )
233
234
factory. sendNotification(firstServer, REPLICA_SET_SECONDARY , allServers)
234
235
factory. sendNotification(secondServer, REPLICA_SET_SECONDARY , allServers)
235
236
factory. sendNotification(thirdServer, REPLICA_SET_PRIMARY , allServers)
@@ -253,7 +254,7 @@ class BaseClusterSpecification extends Specification {
253
254
builder(). mode(MULTIPLE )
254
255
.hosts([firstServer, secondServer, thirdServer])
255
256
.build(),
256
- factory)
257
+ factory, CLIENT_METADATA )
257
258
258
259
when :
259
260
def latch = new CountDownLatch (1 )
@@ -283,7 +284,7 @@ class BaseClusterSpecification extends Specification {
283
284
builder(). mode(MULTIPLE )
284
285
.hosts([firstServer, secondServer, thirdServer])
285
286
.build(),
286
- factory)
287
+ factory, CLIENT_METADATA )
287
288
factory. sendNotification(firstServer, REPLICA_SET_SECONDARY , allServers)
288
289
289
290
when :
@@ -305,7 +306,7 @@ class BaseClusterSpecification extends Specification {
305
306
builder(). mode(MULTIPLE )
306
307
.hosts([firstServer, secondServer, thirdServer])
307
308
.build(),
308
- factory)
309
+ factory, CLIENT_METADATA )
309
310
310
311
when :
311
312
def secondServerLatch = selectServerAsync(cluster, secondServer, serverSelectionTimeoutMS)
@@ -330,7 +331,7 @@ class BaseClusterSpecification extends Specification {
330
331
builder(). mode(MULTIPLE )
331
332
.hosts([firstServer, secondServer, thirdServer])
332
333
.build(),
333
- factory)
334
+ factory, CLIENT_METADATA )
334
335
335
336
when :
336
337
def serverLatch = selectServerAsync(cluster, firstServer)
@@ -350,7 +351,7 @@ class BaseClusterSpecification extends Specification {
350
351
builder(). mode(MULTIPLE )
351
352
.hosts([firstServer, secondServer, thirdServer])
352
353
.build(),
353
- factory)
354
+ factory, CLIENT_METADATA )
354
355
355
356
when :
356
357
selectServerAsyncAndGet(cluster, firstServer, serverSelectionTimeoutMS)
0 commit comments