Skip to content

Commit e9aafc7

Browse files
committed
Now that MongoDB 3.6 release candidates are available, replace server version check for 3.5 with 3.6
1 parent 62a10dd commit e9aafc7

File tree

11 files changed

+28
-31
lines changed

11 files changed

+28
-31
lines changed

driver-core/src/main/com/mongodb/connection/CommandMessage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ private static OpCode getOpCode(final MessageSettings settings) {
190190
}
191191

192192
private static boolean isServerVersionAtLeastThreeDotSix(final MessageSettings settings) {
193-
return settings.getServerVersion().compareTo(new ServerVersion(3, 5)) >= 0;
193+
return settings.getServerVersion().compareTo(new ServerVersion(3, 6)) >= 0;
194194
}
195195

196196
}

driver-core/src/main/com/mongodb/operation/OperationHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ static boolean serverIsAtLeastVersionThreeDotFour(final ConnectionDescription de
380380
}
381381

382382
static boolean serverIsAtLeastVersionThreeDotSix(final ConnectionDescription description) {
383-
return serverIsAtLeastVersion(description, new ServerVersion(3, 5));
383+
return serverIsAtLeastVersion(description, new ServerVersion(3, 6));
384384
}
385385

386386
static boolean serverIsAtLeastVersion(final ConnectionDescription description, final ServerVersion serverVersion) {

driver-core/src/test/functional/com/mongodb/operation/AggregateOperationSpecification.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class AggregateOperationSpecification extends OperationFunctionalSpecification {
191191
async << [true, false]
192192
}
193193

194-
@IgnoreIf({ !(serverVersionAtLeast(3, 5) && isDiscoverableReplicaSet()) })
194+
@IgnoreIf({ !(serverVersionAtLeast(3, 6) && isDiscoverableReplicaSet()) })
195195
def 'should support changeStreams'() {
196196
given:
197197
def expected = [createExpectedChangeNotification(namespace, 0), createExpectedChangeNotification(namespace, 1)]

driver-core/src/test/functional/com/mongodb/operation/ChangeStreamOperationSpecification.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import static com.mongodb.ClusterFixture.serverVersionAtLeast
4343
import static java.util.concurrent.TimeUnit.MILLISECONDS
4444
import static org.bson.codecs.configuration.CodecRegistries.fromProviders
4545

46-
@IgnoreIf({ !(serverVersionAtLeast(3, 5) && !isStandalone()) })
46+
@IgnoreIf({ !(serverVersionAtLeast(3, 6) && !isStandalone()) })
4747
class ChangeStreamOperationSpecification extends OperationFunctionalSpecification {
4848

4949
def 'should have the correct defaults'() {

driver-core/src/test/functional/com/mongodb/operation/FindAndUpdateOperationSpecification.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ class FindAndUpdateOperationSpecification extends OperationFunctionalSpecificati
355355
async << [true, false]
356356
}
357357

358-
@IgnoreIf({ !serverVersionAtLeast(3, 5) })
358+
@IgnoreIf({ !serverVersionAtLeast(3, 6) })
359359
def 'should support array filters'() {
360360
given:
361361
def documentOne = Document.parse('{_id: 1, y: [ {b: 3}, {b: 1}]}')

driver-core/src/test/functional/com/mongodb/operation/FindOperationSpecification.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ import static com.mongodb.CursorType.TailableAwait
6767
import static com.mongodb.ExplainVerbosity.QUERY_PLANNER
6868
import static com.mongodb.connection.ServerType.STANDALONE
6969
import static com.mongodb.operation.ReadConcernHelper.appendReadConcernToCommand
70-
import static java.util.Arrays.asList
7170
import static java.util.concurrent.TimeUnit.MILLISECONDS
7271
import static java.util.concurrent.TimeUnit.SECONDS
7372
import static org.junit.Assert.assertEquals
@@ -471,7 +470,7 @@ class FindOperationSpecification extends OperationFunctionalSpecification {
471470

472471
then:
473472
Document profileDocument = profileCollectionHelper.find().get(0)
474-
if (serverVersionAtLeast(asList(3, 5, 8))) {
473+
if (serverVersionAtLeast(3, 6)) {
475474
assertEquals(expectedComment, ((Document) profileDocument.get('command')).get('comment'))
476475
} else if (serverVersionAtLeast(3, 2)) {
477476
assertEquals(expectedComment, ((Document) profileDocument.get('query')).get('comment'))

driver-core/src/test/functional/com/mongodb/operation/MixedBulkWriteOperationSpecification.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ class MixedBulkWriteOperationSpecification extends OperationFunctionalSpecificat
881881
async << [true, false]
882882
}
883883

884-
@IgnoreIf({ !serverVersionAtLeast(3, 5) })
884+
@IgnoreIf({ !serverVersionAtLeast(3, 6) })
885885
def 'should support array filters'() {
886886
given:
887887
def documentOne = BsonDocument.parse('{_id: 1, y: [ {b: 3}, {b: 1}]}')

driver/src/examples/documentation/DocumentationSamples.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@
2020
import com.mongodb.DatabaseTestCase;
2121
import com.mongodb.client.FindIterable;
2222
import com.mongodb.client.MongoCollection;
23-
import com.mongodb.client.MongoDatabase;
24-
// imports required for change streams
2523
import com.mongodb.client.MongoCursor;
24+
import com.mongodb.client.MongoDatabase;
2625
import com.mongodb.client.model.changestream.ChangeStreamDocument;
2726
import com.mongodb.client.model.changestream.FullDocument;
2827
import org.bson.BsonDocument;
29-
// end required change streams imports
3028
import org.bson.BsonType;
3129
import org.bson.Document;
3230
import org.junit.After;
@@ -41,8 +39,6 @@
4139
import static com.mongodb.ClusterFixture.serverVersionAtLeast;
4240
import static com.mongodb.Fixture.getDefaultDatabaseName;
4341
import static com.mongodb.Fixture.getMongoClient;
44-
45-
// imports required for filters, projections and updates
4642
import static com.mongodb.client.model.Filters.all;
4743
import static com.mongodb.client.model.Filters.and;
4844
import static com.mongodb.client.model.Filters.elemMatch;
@@ -64,14 +60,17 @@
6460
import static com.mongodb.client.model.Updates.combine;
6561
import static com.mongodb.client.model.Updates.currentDate;
6662
import static com.mongodb.client.model.Updates.set;
67-
// end required filters, projections and updates imports
68-
6963
import static java.util.Arrays.asList;
7064
import static java.util.Collections.singletonList;
7165
import static org.junit.Assert.assertEquals;
7266
import static org.junit.Assert.assertTrue;
7367
import static org.junit.Assume.assumeTrue;
7468

69+
// imports required for change streams
70+
// end required change streams imports
71+
// imports required for filters, projections and updates
72+
// end required filters, projections and updates imports
73+
7574

7675
public final class DocumentationSamples extends DatabaseTestCase {
7776

@@ -615,7 +614,7 @@ public void testDeletions() {
615614

616615
@Test
617616
public void testWatch() {
618-
assumeTrue(isDiscoverableReplicaSet() && serverVersionAtLeast(3, 5));
617+
assumeTrue(isDiscoverableReplicaSet() && serverVersionAtLeast(3, 6));
619618

620619
final MongoCollection<Document> inventory = collection;
621620
final AtomicBoolean stop = new AtomicBoolean(false);

driver/src/test/functional/com/mongodb/DBCursorTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import static com.mongodb.ClusterFixture.enableMaxTimeFailPoint;
3131
import static com.mongodb.ClusterFixture.isSharded;
3232
import static com.mongodb.ClusterFixture.serverVersionAtLeast;
33-
import static java.util.Arrays.asList;
3433
import static org.hamcrest.CoreMatchers.not;
3534
import static org.hamcrest.core.Is.is;
3635
import static org.junit.Assert.assertEquals;
@@ -418,7 +417,7 @@ public void testSettingACommentInsertsCommentIntoProfileCollectionWhenProfilingI
418417
assertEquals(1, profileCollection.count());
419418

420419
DBObject profileDocument = profileCollection.findOne();
421-
if (serverVersionAtLeast(asList(3, 5, 8))) {
420+
if (serverVersionAtLeast(3, 6)) {
422421
assertEquals(expectedComment, ((DBObject) profileDocument.get("command")).get("comment"));
423422
} else if (serverVersionAtLeast(3, 2)) {
424423
assertEquals(expectedComment, ((DBObject) profileDocument.get("query")).get("comment"));

driver/src/test/functional/com/mongodb/MongoClientSessionSpecification.groovy

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import static com.mongodb.MongoCredential.createCredential
3939

4040
class MongoClientSessionSpecification extends FunctionalSpecification {
4141

42-
@IgnoreIf({ serverVersionAtLeast(3, 5) })
42+
@IgnoreIf({ serverVersionAtLeast(3, 6) })
4343
def 'should throw MongoClientException starting a session when sessions are not supported'() {
4444
when:
4545
Fixture.getMongoClient().startSession(ClientSessionOptions.builder().build())
@@ -48,7 +48,7 @@ class MongoClientSessionSpecification extends FunctionalSpecification {
4848
thrown(MongoClientException)
4949
}
5050

51-
@IgnoreIf({ !serverVersionAtLeast(3, 5) })
51+
@IgnoreIf({ !serverVersionAtLeast(3, 6) })
5252
def 'should create session with correct defaults'() {
5353
when:
5454
def options = ClientSessionOptions.builder().build()
@@ -64,7 +64,7 @@ class MongoClientSessionSpecification extends FunctionalSpecification {
6464
clientSession.getServerSession() != null
6565
}
6666

67-
@IgnoreIf({ !serverVersionAtLeast(3, 5) })
67+
@IgnoreIf({ !serverVersionAtLeast(3, 6) })
6868
def 'cluster time should advance'() {
6969
given:
7070
def firstOperationTime = new BsonTimestamp(42, 1)
@@ -105,7 +105,7 @@ class MongoClientSessionSpecification extends FunctionalSpecification {
105105
clientSession.getClusterTime() == secondClusterTime
106106
}
107107

108-
@IgnoreIf({ !serverVersionAtLeast(3, 5) })
108+
@IgnoreIf({ !serverVersionAtLeast(3, 6) })
109109
def 'operation time should advance'() {
110110
given:
111111
def firstOperationTime = new BsonTimestamp(42, 1)
@@ -143,7 +143,7 @@ class MongoClientSessionSpecification extends FunctionalSpecification {
143143
clientSession.getOperationTime() == secondOperationTime
144144
}
145145

146-
@IgnoreIf({ !serverVersionAtLeast(3, 5) })
146+
@IgnoreIf({ !serverVersionAtLeast(3, 6) })
147147
def 'methods that use the session should throw if the session is closed'() {
148148
given:
149149
def options = ClientSessionOptions.builder().build()
@@ -175,7 +175,7 @@ class MongoClientSessionSpecification extends FunctionalSpecification {
175175
thrown(IllegalStateException)
176176
}
177177

178-
@IgnoreIf({ !serverVersionAtLeast(3, 5) })
178+
@IgnoreIf({ !serverVersionAtLeast(3, 6) })
179179
def 'informational methods should not throw if the session is closed'() {
180180
given:
181181
def options = ClientSessionOptions.builder().build()
@@ -192,7 +192,7 @@ class MongoClientSessionSpecification extends FunctionalSpecification {
192192
true
193193
}
194194

195-
@IgnoreIf({ !serverVersionAtLeast(3, 5) })
195+
@IgnoreIf({ !serverVersionAtLeast(3, 6) })
196196
def 'should apply causally consistent session option to client session'() {
197197
when:
198198
def clientSession = Fixture.getMongoClient().startSession(ClientSessionOptions.builder()
@@ -207,7 +207,7 @@ class MongoClientSessionSpecification extends FunctionalSpecification {
207207
causallyConsistent << [true, false]
208208
}
209209

210-
@IgnoreIf({ !serverVersionAtLeast(3, 5) })
210+
@IgnoreIf({ !serverVersionAtLeast(3, 6) })
211211
def 'client session should have server session with valid identifier'() {
212212
given:
213213
def clientSession = Fixture.getMongoClient().startSession(ClientSessionOptions.builder().build())
@@ -223,7 +223,7 @@ class MongoClientSessionSpecification extends FunctionalSpecification {
223223
identifier.getBinary('id').data.length == 16
224224
}
225225

226-
@IgnoreIf({ !serverVersionAtLeast(3, 5) })
226+
@IgnoreIf({ !serverVersionAtLeast(3, 6) })
227227
def 'should use a default session'() {
228228
given:
229229
def commandListener = new TestCommandListener()
@@ -243,7 +243,7 @@ class MongoClientSessionSpecification extends FunctionalSpecification {
243243
client?.close()
244244
}
245245

246-
@IgnoreIf({ serverVersionAtLeast(3, 5) })
246+
@IgnoreIf({ serverVersionAtLeast(3, 6) })
247247
def 'should not use a default session when sessions are not supported'() {
248248
given:
249249
def commandListener = new TestCommandListener()
@@ -268,7 +268,7 @@ class MongoClientSessionSpecification extends FunctionalSpecification {
268268
// This test is inherently racy as it's possible that the server _does_ replicate fast enough and therefore the test passes anyway
269269
// even if causal consistency was not actually in effect. For that reason the test iterates a number of times in order to increase
270270
// confidence that it's really causal consistency that is causing the test to succeed
271-
@IgnoreIf({ !serverVersionAtLeast(3, 5) || isStandalone() })
271+
@IgnoreIf({ !serverVersionAtLeast(3, 6) || isStandalone() })
272272
@Category(Slow)
273273
def 'should find inserted document on a secondary when causal consistency is enabled'() {
274274
given:
@@ -300,7 +300,7 @@ class MongoClientSessionSpecification extends FunctionalSpecification {
300300
readConcern << [ReadConcern.DEFAULT, ReadConcern.LOCAL, ReadConcern.MAJORITY]
301301
}
302302

303-
@IgnoreIf({ !serverVersionAtLeast(3, 5) || !isAuthenticated() })
303+
@IgnoreIf({ !serverVersionAtLeast(3, 6) || !isAuthenticated() })
304304
@SuppressWarnings('deprecation')
305305
def 'should not use a default session when there is more than one authenticated user'() {
306306
given:

0 commit comments

Comments
 (0)