DATAMONGO-1770 - Upgrade to MongoDB Java driver 3.5 and reactive driver 1.6.
Fix test failures do to changed Json rendering.
This commit is contained in:
@@ -12,7 +12,7 @@ services:
|
||||
env:
|
||||
matrix:
|
||||
- PROFILE=ci
|
||||
- PROFILE=mongo35-next
|
||||
- PROFILE=mongo36-next
|
||||
|
||||
# Current MongoDB version is 2.4.2 as of 2016-04, see https://github.com/travis-ci/travis-ci/issues/3694
|
||||
# apt-get starts a MongoDB instance so it's not started using before_script
|
||||
|
||||
16
pom.xml
16
pom.xml
@@ -28,8 +28,8 @@
|
||||
<project.type>multi</project.type>
|
||||
<dist.id>spring-data-mongodb</dist.id>
|
||||
<springdata.commons>2.0.0.BUILD-SNAPSHOT</springdata.commons>
|
||||
<mongo>3.4.2</mongo>
|
||||
<mongo.reactivestreams>1.5.0</mongo.reactivestreams>
|
||||
<mongo>3.5.0</mongo>
|
||||
<mongo.reactivestreams>1.6.0</mongo.reactivestreams>
|
||||
<jmh.version>1.19</jmh.version>
|
||||
</properties>
|
||||
|
||||
@@ -115,11 +115,11 @@
|
||||
|
||||
<profiles>
|
||||
|
||||
<profile>
|
||||
<!-- not-yet available profile>
|
||||
|
||||
<id>mongo34-next</id>
|
||||
<id>mongo35-next</id>
|
||||
<properties>
|
||||
<mongo>3.4.3-SNAPSHOT</mongo>
|
||||
<mongo>3.5.1-SNAPSHOT</mongo>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
@@ -129,13 +129,13 @@
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
</profile>
|
||||
</profile -->
|
||||
|
||||
<profile>
|
||||
|
||||
<id>mongo35-next</id>
|
||||
<id>mongo36-next</id>
|
||||
<properties>
|
||||
<mongo>3.5.0-SNAPSHOT</mongo>
|
||||
<mongo>3.6.0-SNAPSHOT</mongo>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
|
||||
@@ -141,7 +141,7 @@ public class QueryTests {
|
||||
Query q = new Query(
|
||||
where("name").regex("^T.*").and("age").gt(20).lt(80).and("city").in("Stockholm", "London", "New York"));
|
||||
Document expected = Document
|
||||
.parse("{ \"name\" : { \"$regex\" : \"^T.*\"} , \"age\" : { \"$gt\" : 20 , \"$lt\" : 80} , "
|
||||
.parse("{ \"name\" : { \"$regex\" : \"^T.*\", \"$options\" : \"\" } , \"age\" : { \"$gt\" : 20 , \"$lt\" : 80} , "
|
||||
+ "\"city\" : { \"$in\" : [ \"Stockholm\" , \"London\" , \"New York\"]}}");
|
||||
|
||||
Assert.assertEquals(expected.toJson(), q.getQueryObject().toJson());
|
||||
@@ -177,7 +177,7 @@ public class QueryTests {
|
||||
@Test
|
||||
public void testQueryWithRegex() {
|
||||
Query q = new Query(where("name").regex("b.*"));
|
||||
Document expected = Document.parse("{ \"name\" : { \"$regex\" : \"b.*\"}}");
|
||||
Document expected = Document.parse("{ \"name\" : { \"$regex\" : \"b.*\", \"$options\" : \"\" }}");
|
||||
Assert.assertEquals(expected.toJson(), q.getQueryObject().toJson());
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import java.util.Map;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
import org.bson.BSON;
|
||||
import org.bson.BsonRegularExpression;
|
||||
import org.bson.Document;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -417,7 +416,7 @@ public class StringBasedMongoQueryUnitTests {
|
||||
assertThat(query.getQueryObject(), is(new Document("lastname", "{ $ne : \"\\\"calamity\\\"\" }")));
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1575
|
||||
@Test // DATAMONGO-1575, DATAMONGO-1770
|
||||
public void shouldTakeBsonParameterAsIs() {
|
||||
|
||||
StringBasedMongoQuery mongoQuery = createQueryForMethod("findByWithBsonArgument", Document.class);
|
||||
@@ -425,17 +424,17 @@ public class StringBasedMongoQueryUnitTests {
|
||||
new Document("$regex", "^calamity$"));
|
||||
|
||||
org.springframework.data.mongodb.core.query.Query query = mongoQuery.createQuery(accessor);
|
||||
assertThat(query.getQueryObject(), is(new Document("arg0", new BsonRegularExpression("^calamity$"))));
|
||||
assertThat(query.getQueryObject(), is(new Document("arg0", new Document("$regex", "^calamity$"))));
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1575
|
||||
@Test // DATAMONGO-1575, DATAMONGO-1770
|
||||
public void shouldReplaceParametersInInQuotedExpressionOfNestedQueryOperator() {
|
||||
|
||||
StringBasedMongoQuery mongoQuery = createQueryForMethod("findByLastnameRegex", String.class);
|
||||
ConvertingParameterAccessor accessor = StubParameterAccessor.getAccessor(converter, "calamity");
|
||||
|
||||
org.springframework.data.mongodb.core.query.Query query = mongoQuery.createQuery(accessor);
|
||||
assertThat(query.getQueryObject(), is(new Document("lastname", new BsonRegularExpression("^(calamity)"))));
|
||||
assertThat(query.getQueryObject(), is(new Document("lastname", new Document("$regex", "^(calamity)"))));
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1603
|
||||
|
||||
Reference in New Issue
Block a user