Browse Source

DATAMONGO-2423 - Polishing.

Update nullability annotations and reduce visibility in tests.

Original pull request: #815.
pull/819/head
Christoph Strobl 6 years ago committed by Mark Paluch
parent
commit
1393f23f3b
No known key found for this signature in database
GPG Key ID: 51A00FA751B91849
  1. 1
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/GeospatialIndex.java
  2. 2
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/CachingMongoPersistentProperty.java
  3. 1
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapreduce/MapReduceResults.java
  4. 32
      spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateUpdateTests.java

1
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/GeospatialIndex.java

@ -184,7 +184,6 @@ public class GeospatialIndex implements IndexDefinition {
return document; return document;
} }
@Nullable
public Document getIndexOptions() { public Document getIndexOptions() {
Document document = new Document(); Document document = new Document();

2
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/CachingMongoPersistentProperty.java

@ -30,7 +30,7 @@ public class CachingMongoPersistentProperty extends BasicMongoPersistentProperty
private @Nullable Boolean isIdProperty; private @Nullable Boolean isIdProperty;
private @Nullable Boolean isAssociation; private @Nullable Boolean isAssociation;
private @Nullable boolean dbRefResolved; private boolean dbRefResolved;
private @Nullable DBRef dbref; private @Nullable DBRef dbref;
private @Nullable String fieldName; private @Nullable String fieldName;
private @Nullable Class<?> fieldType; private @Nullable Class<?> fieldType;

1
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapreduce/MapReduceResults.java

@ -101,6 +101,7 @@ public class MapReduceResults<T> implements Iterable<T> {
return outputCollection; return outputCollection;
} }
@Nullable
public Document getRawResults() { public Document getRawResults() {
return rawResults; return rawResults;
} }

32
spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateUpdateTests.java

@ -48,8 +48,7 @@ import com.mongodb.client.MongoCollection;
* @author Christoph Strobl * @author Christoph Strobl
*/ */
@ExtendWith(MongoServerCondition.class) @ExtendWith(MongoServerCondition.class)
@EnableIfMongoServerVersion(isGreaterThanEqual = "4.2") class MongoTemplateUpdateTests {
public class MongoTemplateUpdateTests {
static final String DB_NAME = "update-test"; static final String DB_NAME = "update-test";
@ -68,7 +67,8 @@ public class MongoTemplateUpdateTests {
} }
@Test // DATAMONGO-2331 @Test // DATAMONGO-2331
public void aggregateUpdateWithSet() { @EnableIfMongoServerVersion(isGreaterThanEqual = "4.2")
void aggregateUpdateWithSet() {
Score score1 = new Score(1, "Maya", Arrays.asList(10, 5, 10), Arrays.asList(10, 8), 0); Score score1 = new Score(1, "Maya", Arrays.asList(10, 5, 10), Arrays.asList(10, 8), 0);
Score score2 = new Score(2, "Ryan", Arrays.asList(5, 6, 5), Arrays.asList(8, 8), 8); Score score2 = new Score(2, "Ryan", Arrays.asList(5, 6, 5), Arrays.asList(8, 8), 8);
@ -92,7 +92,8 @@ public class MongoTemplateUpdateTests {
} }
@Test // DATAMONGO-2331 @Test // DATAMONGO-2331
public void aggregateUpdateWithSetToValue() { @EnableIfMongoServerVersion(isGreaterThanEqual = "4.2")
void aggregateUpdateWithSetToValue() {
Book one = new Book(); Book one = new Book();
one.id = 1; one.id = 1;
@ -109,7 +110,8 @@ public class MongoTemplateUpdateTests {
} }
@Test // DATAMONGO-2331 @Test // DATAMONGO-2331
public void versionedAggregateUpdateWithSet() { @EnableIfMongoServerVersion(isGreaterThanEqual = "4.2")
void versionedAggregateUpdateWithSet() {
Versioned source = template.insert(Versioned.class).one(new Versioned("id-1", "value-0")); Versioned source = template.insert(Versioned.class).one(new Versioned("id-1", "value-0"));
@ -123,7 +125,8 @@ public class MongoTemplateUpdateTests {
} }
@Test // DATAMONGO-2331 @Test // DATAMONGO-2331
public void versionedAggregateUpdateTouchingVersionProperty() { @EnableIfMongoServerVersion(isGreaterThanEqual = "4.2")
void versionedAggregateUpdateTouchingVersionProperty() {
Versioned source = template.insert(Versioned.class).one(new Versioned("id-1", "value-0")); Versioned source = template.insert(Versioned.class).one(new Versioned("id-1", "value-0"));
@ -138,7 +141,8 @@ public class MongoTemplateUpdateTests {
} }
@Test // DATAMONGO-2331 @Test // DATAMONGO-2331
public void aggregateUpdateWithUnset() { @EnableIfMongoServerVersion(isGreaterThanEqual = "4.2")
void aggregateUpdateWithUnset() {
Book antelopeAntics = new Book(); Book antelopeAntics = new Book();
antelopeAntics.id = 1; antelopeAntics.id = 1;
@ -171,7 +175,8 @@ public class MongoTemplateUpdateTests {
} }
@Test // DATAMONGO-2331 @Test // DATAMONGO-2331
public void aggregateUpdateWithReplaceWith() { @EnableIfMongoServerVersion(isGreaterThanEqual = "4.2")
void aggregateUpdateWithReplaceWith() {
Book one = new Book(); Book one = new Book();
one.id = 1; one.id = 1;
@ -194,7 +199,8 @@ public class MongoTemplateUpdateTests {
} }
@Test // DATAMONGO-2331 @Test // DATAMONGO-2331
public void aggregateUpdateWithReplaceWithNewObject() { @EnableIfMongoServerVersion(isGreaterThanEqual = "4.2")
void aggregateUpdateWithReplaceWithNewObject() {
Book one = new Book(); Book one = new Book();
one.id = 1; one.id = 1;
@ -217,7 +223,8 @@ public class MongoTemplateUpdateTests {
} }
@Test // DATAMONGO-2331 @Test // DATAMONGO-2331
public void aggregationUpdateUpsertsCorrectly() { @EnableIfMongoServerVersion(isGreaterThanEqual = "4.2")
void aggregationUpdateUpsertsCorrectly() {
AggregationUpdate update = AggregationUpdate.update().set("title").toValue("The Burning White"); AggregationUpdate update = AggregationUpdate.update().set("title").toValue("The Burning White");
@ -228,7 +235,8 @@ public class MongoTemplateUpdateTests {
} }
@Test // DATAMONGO-2331 @Test // DATAMONGO-2331
public void aggregateUpdateFirstMatch() { @EnableIfMongoServerVersion(isGreaterThanEqual = "4.2")
void aggregateUpdateFirstMatch() {
Book one = new Book(); Book one = new Book();
one.id = 1; one.id = 1;
@ -250,7 +258,7 @@ public class MongoTemplateUpdateTests {
@Test // DATAMONGO-2331 @Test // DATAMONGO-2331
@Disabled("https://jira.mongodb.org/browse/JAVA-3432") @Disabled("https://jira.mongodb.org/browse/JAVA-3432")
public void findAndModifyAppliesAggregationUpdateCorrectly() { void findAndModifyAppliesAggregationUpdateCorrectly() {
Book one = new Book(); Book one = new Book();
one.id = 1; one.id = 1;

Loading…
Cancel
Save