Browse Source

DATAMONGO-2374 - Polishing.

Reformat code.

Original pull request: #791.
pull/793/head
Mark Paluch 6 years ago
parent
commit
801a3645a9
  1. 2
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/PropertyOperations.java
  2. 4
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/query/ReactiveMongoQueryExecution.java
  3. 6
      spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/PersonRepository.java
  4. 6
      spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/ReactiveMongoRepositoryTests.java

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

@ -68,7 +68,7 @@ class PropertyOperations { @@ -68,7 +68,7 @@ class PropertyOperations {
} else {
MongoPersistentEntity<?> entity = mappingContext.getPersistentEntity(targetType);
if(entity != null) {
if (entity != null) {
entity.doWithProperties(
(SimplePropertyHandler) persistentProperty -> projectedFields.append(persistentProperty.getName(), 1));
}

4
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/query/ReactiveMongoQueryExecution.java

@ -36,8 +36,6 @@ import org.springframework.data.util.TypeInformation; @@ -36,8 +36,6 @@ import org.springframework.data.util.TypeInformation;
import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils;
import com.mongodb.client.result.DeleteResult;
/**
* Set of classes to contain query execution strategies. Depending (mostly) on the return type of a
* {@link org.springframework.data.repository.query.QueryMethod} a {@link AbstractReactiveMongoQuery} can be executed in
@ -174,7 +172,7 @@ interface ReactiveMongoQueryExecution { @@ -174,7 +172,7 @@ interface ReactiveMongoQueryExecution {
return source;
}
if(!operations.getConverter().getMappingContext().hasPersistentEntityFor(returnedType.getReturnedType())) {
if (!operations.getConverter().getMappingContext().hasPersistentEntityFor(returnedType.getReturnedType())) {
return source;
}

6
spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/PersonRepository.java

@ -36,7 +36,6 @@ import org.springframework.data.geo.GeoResults; @@ -36,7 +36,6 @@ import org.springframework.data.geo.GeoResults;
import org.springframework.data.geo.Point;
import org.springframework.data.geo.Polygon;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.repository.Person.Sex;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.repository.query.Param;
@ -362,7 +361,8 @@ public interface PersonRepository extends MongoRepository<Person, String>, Query @@ -362,7 +361,8 @@ public interface PersonRepository extends MongoRepository<Person, String>, Query
@Query(value = "{ 'id' : ?0 }", fields = "{ 'fans': { '$slice': [ ?1, ?2 ] } }")
Person findWithSliceInProjection(String id, int skip, int limit);
@Query(value = "{ 'shippingAddresses' : { '$elemMatch' : { 'city' : { '$eq' : 'lnz' } } } }", fields = "{ 'shippingAddresses.$': ?0 }")
@Query(value = "{ 'shippingAddresses' : { '$elemMatch' : { 'city' : { '$eq' : 'lnz' } } } }",
fields = "{ 'shippingAddresses.$': ?0 }")
Person findWithArrayPositionInProjection(int position);
@Query(value = "{ 'fans' : { '$elemMatch' : { '$ref' : 'user' } } }", fields = "{ 'fans.$': ?0 }")
@ -389,6 +389,6 @@ public interface PersonRepository extends MongoRepository<Person, String>, Query @@ -389,6 +389,6 @@ public interface PersonRepository extends MongoRepository<Person, String>, Query
@Aggregation(pipeline = "{ '$group' : { '_id' : null, 'total' : { $sum: '$age' } } }")
AggregationResults<SumAge> sumAgeAndReturnAggregationResultWrapperWithConcreteType();
@Query(value="{_id:?0}")
@Query(value = "{_id:?0}")
Optional<org.bson.Document> findDocumentById(String id);
}

6
spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/ReactiveMongoRepositoryTests.java

@ -318,9 +318,9 @@ public class ReactiveMongoRepositoryTests { @@ -318,9 +318,9 @@ public class ReactiveMongoRepositoryTests {
repository.findByLocationNear(new Point(-73.99, 40.73), //
new Distance(2000, Metrics.KILOMETERS)).as(StepVerifier::create).consumeNextWith(actual -> {
assertThat(actual.getDistance().getValue()).isCloseTo(1, offset(1d));
assertThat(actual.getContent()).isEqualTo(dave);
}).verifyComplete();
assertThat(actual.getDistance().getValue()).isCloseTo(1, offset(1d));
assertThat(actual.getContent()).isEqualTo(dave);
}).verifyComplete();
}
@Test // DATAMONGO-1444

Loading…
Cancel
Save