DATAMONGO-2198 - Upgrade to MongoDB Java Driver 3.10
Fix tests failing due to changed String rendering of Document. Original pull request: #643.
This commit is contained in:
committed by
Mark Paluch
parent
9f58c78e43
commit
89fde7f8e9
2
pom.xml
2
pom.xml
@@ -28,7 +28,7 @@
|
||||
<project.type>multi</project.type>
|
||||
<dist.id>spring-data-mongodb</dist.id>
|
||||
<springdata.commons>2.2.0.BUILD-SNAPSHOT</springdata.commons>
|
||||
<mongo>3.8.2</mongo>
|
||||
<mongo>3.10.1</mongo>
|
||||
<mongo.reactivestreams>1.9.2</mongo.reactivestreams>
|
||||
<jmh.version>1.19</jmh.version>
|
||||
</properties>
|
||||
|
||||
@@ -123,6 +123,10 @@ class AsyncInputStreamAdapter implements AsyncInputStream {
|
||||
});
|
||||
}
|
||||
|
||||
public Publisher<Long> skip(long bytesToSkip) {
|
||||
throw new UnsupportedOperationException("Skip is currently not implemented");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.mongodb.reactivestreams.client.gridfs.AsyncInputStream#close()
|
||||
|
||||
@@ -90,7 +90,7 @@ public class DefaultIndexOperationsIntegrationTests {
|
||||
assertThat(info.getIndexFields().get(0).isGeo()).isEqualTo(true);
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1467
|
||||
@Test // DATAMONGO-1467, DATAMONGO-2198
|
||||
public void shouldApplyPartialFilterCorrectly() {
|
||||
|
||||
assumeThat(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO), is(true));
|
||||
@@ -101,10 +101,10 @@ public class DefaultIndexOperationsIntegrationTests {
|
||||
indexOps.ensureIndex(id);
|
||||
|
||||
IndexInfo info = findAndReturnIndexInfo(indexOps.getIndexInfo(), "partial-with-criteria");
|
||||
assertThat(info.getPartialFilterExpression()).isEqualTo("{ \"q-t-y\" : { \"$gte\" : 10 } }");
|
||||
assertThat(Document.parse(info.getPartialFilterExpression())).isEqualTo(Document.parse("{ \"q-t-y\" : { \"$gte\" : 10 } }"));
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1467
|
||||
@Test // DATAMONGO-1467, DATAMONGO-2198
|
||||
public void shouldApplyPartialFilterWithMappedPropertyCorrectly() {
|
||||
|
||||
assumeThat(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO), is(true));
|
||||
@@ -115,10 +115,10 @@ public class DefaultIndexOperationsIntegrationTests {
|
||||
indexOps.ensureIndex(id);
|
||||
|
||||
IndexInfo info = findAndReturnIndexInfo(indexOps.getIndexInfo(), "partial-with-mapped-criteria");
|
||||
assertThat(info.getPartialFilterExpression()).isEqualTo("{ \"qty\" : { \"$gte\" : 10 } }");
|
||||
assertThat(Document.parse(info.getPartialFilterExpression())).isEqualTo(Document.parse("{ \"qty\" : { \"$gte\" : 10 } }"));
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1467
|
||||
@Test // DATAMONGO-1467, DATAMONGO-2198
|
||||
public void shouldApplyPartialDBOFilterCorrectly() {
|
||||
|
||||
assumeThat(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO), is(true));
|
||||
@@ -129,10 +129,10 @@ public class DefaultIndexOperationsIntegrationTests {
|
||||
indexOps.ensureIndex(id);
|
||||
|
||||
IndexInfo info = findAndReturnIndexInfo(indexOps.getIndexInfo(), "partial-with-dbo");
|
||||
assertThat(info.getPartialFilterExpression()).isEqualTo("{ \"qty\" : { \"$gte\" : 10 } }");
|
||||
assertThat(Document.parse(info.getPartialFilterExpression())).isEqualTo(Document.parse("{ \"qty\" : { \"$gte\" : 10 } }"));
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1467
|
||||
@Test // DATAMONGO-1467, DATAMONGO-2198
|
||||
public void shouldFavorExplicitMappingHintViaClass() {
|
||||
|
||||
assumeThat(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO), is(true));
|
||||
@@ -147,7 +147,7 @@ public class DefaultIndexOperationsIntegrationTests {
|
||||
indexOps.ensureIndex(id);
|
||||
|
||||
IndexInfo info = findAndReturnIndexInfo(indexOps.getIndexInfo(), "partial-with-inheritance");
|
||||
assertThat(info.getPartialFilterExpression()).isEqualTo("{ \"a_g_e\" : { \"$gte\" : 10 } }");
|
||||
assertThat(Document.parse(info.getPartialFilterExpression())).isEqualTo(Document.parse("{ \"a_g_e\" : { \"$gte\" : 10 } }"));
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1518
|
||||
|
||||
@@ -133,7 +133,7 @@ public class DefaultReactiveIndexOperationsTests {
|
||||
.verifyComplete();
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1682
|
||||
@Test // DATAMONGO-1682, DATAMONGO-2198
|
||||
public void shouldApplyPartialFilterCorrectly() {
|
||||
|
||||
assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO));
|
||||
@@ -145,12 +145,12 @@ public class DefaultReactiveIndexOperationsTests {
|
||||
|
||||
StepVerifier.create(indexOps.getIndexInfo().filter(this.indexByName("partial-with-criteria"))) //
|
||||
.consumeNextWith(indexInfo -> {
|
||||
assertThat(indexInfo.getPartialFilterExpression()).isEqualTo("{ \"q-t-y\" : { \"$gte\" : 10 } }");
|
||||
assertThat(Document.parse(indexInfo.getPartialFilterExpression())).isEqualTo(Document.parse("{ \"q-t-y\" : { \"$gte\" : 10 } }"));
|
||||
}) //
|
||||
.verifyComplete();
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1682
|
||||
@Test // DATAMONGO-1682, DATAMONGO-2198
|
||||
public void shouldApplyPartialFilterWithMappedPropertyCorrectly() {
|
||||
|
||||
assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO));
|
||||
@@ -162,11 +162,11 @@ public class DefaultReactiveIndexOperationsTests {
|
||||
|
||||
StepVerifier.create(indexOps.getIndexInfo().filter(this.indexByName("partial-with-mapped-criteria"))) //
|
||||
.consumeNextWith(indexInfo -> {
|
||||
assertThat(indexInfo.getPartialFilterExpression()).isEqualTo("{ \"qty\" : { \"$gte\" : 10 } }");
|
||||
assertThat(Document.parse(indexInfo.getPartialFilterExpression())).isEqualTo(Document.parse("{ \"qty\" : { \"$gte\" : 10 } }"));
|
||||
}).verifyComplete();
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1682
|
||||
@Test // DATAMONGO-1682, DATAMONGO-2198
|
||||
public void shouldApplyPartialDBOFilterCorrectly() {
|
||||
|
||||
assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO));
|
||||
@@ -178,13 +178,13 @@ public class DefaultReactiveIndexOperationsTests {
|
||||
|
||||
StepVerifier.create(indexOps.getIndexInfo().filter(this.indexByName("partial-with-dbo"))) //
|
||||
.consumeNextWith(indexInfo -> {
|
||||
assertThat(indexInfo.getPartialFilterExpression()).isEqualTo("{ \"qty\" : { \"$gte\" : 10 } }");
|
||||
assertThat(Document.parse(indexInfo.getPartialFilterExpression())).isEqualTo(Document.parse("{ \"qty\" : { \"$gte\" : 10 } }"));
|
||||
}) //
|
||||
.verifyComplete();
|
||||
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1682
|
||||
@Test // DATAMONGO-1682, DATAMONGO-2198
|
||||
public void shouldFavorExplicitMappingHintViaClass() {
|
||||
|
||||
assumeTrue(mongoVersion.isGreaterThanOrEqualTo(THREE_DOT_TWO));
|
||||
@@ -200,7 +200,7 @@ public class DefaultReactiveIndexOperationsTests {
|
||||
|
||||
StepVerifier.create(indexOps.getIndexInfo().filter(this.indexByName("partial-with-inheritance"))) //
|
||||
.consumeNextWith(indexInfo -> {
|
||||
assertThat(indexInfo.getPartialFilterExpression()).isEqualTo("{ \"a_g_e\" : { \"$gte\" : 10 } }");
|
||||
assertThat(Document.parse(indexInfo.getPartialFilterExpression())).isEqualTo(Document.parse("{ \"a_g_e\" : { \"$gte\" : 10 } }"));
|
||||
}) //
|
||||
.verifyComplete();
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class SerializationUtilsUnitTests {
|
||||
public void writesSimpleDocument() {
|
||||
|
||||
Document document = new Document("foo", "bar");
|
||||
assertThat(serializeToJsonSafely(document), is("{ \"foo\" : \"bar\" }"));
|
||||
assertThat(serializeToJsonSafely(document), is(document.toJson()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1191,11 +1191,16 @@ public class MappingMongoConverterUnitTests {
|
||||
assertThat(((Person) value).lastname, is("converter"));
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-743
|
||||
@Test // DATAMONGO-743, DATAMONGO-2198
|
||||
public void readsIntoStringsOutOfTheBox() {
|
||||
|
||||
org.bson.Document document = new org.bson.Document("firstname", "Dave");
|
||||
assertThat(converter.read(String.class, document), is("{ \"firstname\" : \"Dave\" }"));
|
||||
|
||||
String target = converter.read(String.class, new org.bson.Document("firstname", "Dave"));
|
||||
|
||||
assertThat(target, Matchers.startsWith("{"));
|
||||
assertThat(target, Matchers.endsWith("}"));
|
||||
assertThat(target, Matchers.containsString( "\"firstname\""));
|
||||
assertThat(target, Matchers.containsString( "\"Dave\""));
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-766
|
||||
|
||||
@@ -52,8 +52,8 @@ public class IndexInfoUnitTests {
|
||||
@Test // DATAMONGO-2170
|
||||
public void partialFilterExpressionShouldMatchSource() {
|
||||
|
||||
assertThat(getIndexInfo(INDEX_WITH_PARTIAL_FILTER).getPartialFilterExpression())
|
||||
.isEqualTo("{ \"quantity\" : { \"$gte\" : 10 } }");
|
||||
assertThat(Document.parse(getIndexInfo(INDEX_WITH_PARTIAL_FILTER).getPartialFilterExpression()))
|
||||
.isEqualTo(Document.parse("{ \"quantity\" : { \"$gte\" : 10 } }"));
|
||||
}
|
||||
|
||||
private static IndexInfo getIndexInfo(String documentJson) {
|
||||
|
||||
@@ -204,13 +204,12 @@ public class QueryTests {
|
||||
new Query().with(Sort.by(new Sort.Order("foo").ignoreCase()));
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-709, DATAMONGO-1735
|
||||
@Test // DATAMONGO-709, DATAMONGO-1735, // DATAMONGO-2198
|
||||
@SuppressWarnings("unchecked")
|
||||
public void shouldReturnClassHierarchyOfRestrictedTypes() {
|
||||
|
||||
Query query = new Query(where("name").is("foo")).restrict(SpecialDoc.class);
|
||||
assertThat(query.toString(), is(
|
||||
"Query: { \"name\" : \"foo\", \"_$RESTRICTED_TYPES\" : [ { \"$java\" : class org.springframework.data.mongodb.core.SpecialDoc } ] }, Fields: { }, Sort: { }"));
|
||||
|
||||
assertThat(query.getRestrictedTypes(), is(notNullValue()));
|
||||
assertThat(query.getRestrictedTypes().size(), is(1));
|
||||
assertThat(query.getRestrictedTypes(), hasItems(Arrays.asList(SpecialDoc.class).toArray(new Class<?>[0])));
|
||||
|
||||
@@ -474,11 +474,11 @@ public class UpdateTests {
|
||||
"{ \"$push\" : { \"key\" : { \"$java\" : { \"$position\" : { \"$java\" : { \"$position\" : 0} }, \"$each\" : { \"$java\" : { \"$each\" : [ \"Arya\"]} } } } } }");
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1777
|
||||
@Test // DATAMONGO-1777, DATAMONGO-2198
|
||||
public void toStringConsidersIsolated() {
|
||||
|
||||
assertThat(new Update().set("key", "value").isolated().toString())
|
||||
.isEqualTo("{ \"$set\" : { \"key\" : \"value\" }, \"$isolated\" : 1 }");
|
||||
.contains("\"$isolated\"");
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1778
|
||||
|
||||
Reference in New Issue
Block a user