Skip to content

Commit 995e5bf

Browse files
DATAMONGO-1770 - Upgrade to MongoDB Java driver 3.5 and reactive driver 1.6.
Fix test failures do to changed Json rendering.
1 parent f281ab6 commit 995e5bf

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ services:
1212
env:
1313
matrix:
1414
- PROFILE=ci
15-
- PROFILE=mongo35-next
15+
- PROFILE=mongo36-next
1616

1717
# Current MongoDB version is 2.4.2 as of 2016-04, see https://github.com/travis-ci/travis-ci/issues/3694
1818
# apt-get starts a MongoDB instance so it's not started using before_script

pom.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
<project.type>multi</project.type>
2929
<dist.id>spring-data-mongodb</dist.id>
3030
<springdata.commons>2.0.0.BUILD-SNAPSHOT</springdata.commons>
31-
<mongo>3.4.2</mongo>
32-
<mongo.reactivestreams>1.5.0</mongo.reactivestreams>
31+
<mongo>3.5.0</mongo>
32+
<mongo.reactivestreams>1.6.0</mongo.reactivestreams>
3333
<jmh.version>1.19</jmh.version>
3434
</properties>
3535

@@ -115,11 +115,11 @@
115115

116116
<profiles>
117117

118-
<profile>
118+
<!-- not-yet available profile>
119119

120-
<id>mongo34-next</id>
120+
<id>mongo35-next</id>
121121
<properties>
122-
<mongo>3.4.3-SNAPSHOT</mongo>
122+
<mongo>3.5.1-SNAPSHOT</mongo>
123123
</properties>
124124

125125
<repositories>
@@ -129,13 +129,13 @@
129129
</repository>
130130
</repositories>
131131

132-
</profile>
132+
</profile -->
133133

134134
<profile>
135135

136-
<id>mongo35-next</id>
136+
<id>mongo36-next</id>
137137
<properties>
138-
<mongo>3.5.0-SNAPSHOT</mongo>
138+
<mongo>3.6.0-SNAPSHOT</mongo>
139139
</properties>
140140

141141
<repositories>

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/query/QueryTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public void testComplexQueryWithMultipleChainedCriteria() {
141141
Query q = new Query(
142142
where("name").regex("^T.*").and("age").gt(20).lt(80).and("city").in("Stockholm", "London", "New York"));
143143
Document expected = Document
144-
.parse("{ \"name\" : { \"$regex\" : \"^T.*\"} , \"age\" : { \"$gt\" : 20 , \"$lt\" : 80} , "
144+
.parse("{ \"name\" : { \"$regex\" : \"^T.*\", \"$options\" : \"\" } , \"age\" : { \"$gt\" : 20 , \"$lt\" : 80} , "
145145
+ "\"city\" : { \"$in\" : [ \"Stockholm\" , \"London\" , \"New York\"]}}");
146146

147147
Assert.assertEquals(expected.toJson(), q.getQueryObject().toJson());
@@ -177,7 +177,7 @@ public void testQueryWithIn() {
177177
@Test
178178
public void testQueryWithRegex() {
179179
Query q = new Query(where("name").regex("b.*"));
180-
Document expected = Document.parse("{ \"name\" : { \"$regex\" : \"b.*\"}}");
180+
Document expected = Document.parse("{ \"name\" : { \"$regex\" : \"b.*\", \"$options\" : \"\" }}");
181181
Assert.assertEquals(expected.toJson(), q.getQueryObject().toJson());
182182
}
183183

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/StringBasedMongoQueryUnitTests.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import javax.xml.bind.DatatypeConverter;
3131

3232
import org.bson.BSON;
33-
import org.bson.BsonRegularExpression;
3433
import org.bson.Document;
3534
import org.junit.Before;
3635
import org.junit.Test;
@@ -417,25 +416,25 @@ public void shouldQuotationInQuotedComplexQueryString() {
417416
assertThat(query.getQueryObject(), is(new Document("lastname", "{ $ne : \"\\\"calamity\\\"\" }")));
418417
}
419418

420-
@Test // DATAMONGO-1575
419+
@Test // DATAMONGO-1575, DATAMONGO-1770
421420
public void shouldTakeBsonParameterAsIs() {
422421

423422
StringBasedMongoQuery mongoQuery = createQueryForMethod("findByWithBsonArgument", Document.class);
424423
ConvertingParameterAccessor accessor = StubParameterAccessor.getAccessor(converter,
425424
new Document("$regex", "^calamity$"));
426425

427426
org.springframework.data.mongodb.core.query.Query query = mongoQuery.createQuery(accessor);
428-
assertThat(query.getQueryObject(), is(new Document("arg0", new BsonRegularExpression("^calamity$"))));
427+
assertThat(query.getQueryObject(), is(new Document("arg0", new Document("$regex", "^calamity$"))));
429428
}
430429

431-
@Test // DATAMONGO-1575
430+
@Test // DATAMONGO-1575, DATAMONGO-1770
432431
public void shouldReplaceParametersInInQuotedExpressionOfNestedQueryOperator() {
433432

434433
StringBasedMongoQuery mongoQuery = createQueryForMethod("findByLastnameRegex", String.class);
435434
ConvertingParameterAccessor accessor = StubParameterAccessor.getAccessor(converter, "calamity");
436435

437436
org.springframework.data.mongodb.core.query.Query query = mongoQuery.createQuery(accessor);
438-
assertThat(query.getQueryObject(), is(new Document("lastname", new BsonRegularExpression("^(calamity)"))));
437+
assertThat(query.getQueryObject(), is(new Document("lastname", new Document("$regex", "^(calamity)"))));
439438
}
440439

441440
@Test // DATAMONGO-1603

0 commit comments

Comments
 (0)