diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/document/mongodb/GeoSpatialTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/document/mongodb/GeoSpatialTests.java index 2403ae65b..db16d16fb 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/document/mongodb/GeoSpatialTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/document/mongodb/GeoSpatialTests.java @@ -19,6 +19,7 @@ package org.springframework.data.document.mongodb; import static org.hamcrest.Matchers.*; import static org.junit.Assert.assertThat; +import java.util.Collection; import java.util.List; import org.apache.commons.logging.Log; @@ -39,6 +40,8 @@ import org.springframework.data.document.mongodb.monitor.ServerInfo; import org.springframework.data.document.mongodb.query.Criteria; import org.springframework.data.document.mongodb.query.GeospatialIndex; import org.springframework.data.document.mongodb.query.Query; +import org.springframework.expression.ExpressionParser; +import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -61,6 +64,8 @@ public class GeoSpatialTests { ApplicationContext applicationContext; MongoTemplate template; ServerInfo serverInfo; + + ExpressionParser parser; @Before public void setUp() throws Exception { @@ -76,6 +81,7 @@ public class GeoSpatialTests { template.ensureIndex(new GeospatialIndex("location")); indexCreated(); addVenues(); + parser = new SpelExpressionParser(); } private void addVenues() { @@ -149,8 +155,12 @@ public class GeoSpatialTests { Venue foundVenue = template.findOne( new Query(Criteria.where("name").is("Penn Station")), Venue.class); assertThat(foundVenue, notNullValue()); - List venues = template.getCollection(Venue.class); + List venues = template.getCollection(Venue.class); assertThat(venues.size(), equalTo(12)); + Collection names = (Collection)parser.parseExpression("![name]").getValue(venues); + assertThat(names.size(), equalTo(12)); + org.springframework.util.Assert.notEmpty(names); + } public void indexCreated() { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/document/mongodb/PersonExample.java b/spring-data-mongodb/src/test/java/org/springframework/data/document/mongodb/PersonExample.java index db46a22c4..6a9413ebf 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/document/mongodb/PersonExample.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/document/mongodb/PersonExample.java @@ -15,6 +15,7 @@ */ package org.springframework.data.document.mongodb; +import java.util.Iterator; import java.util.List; import org.apache.commons.logging.Log; @@ -49,6 +50,15 @@ public class PersonExample { p.setAge(22); mongoOps.save(p); + + + PersonWithIdPropertyOfTypeString p2 = new PersonWithIdPropertyOfTypeString(); + p2.setFirstName("Jon"); + p2.setAge(23); + + mongoOps.save(p2); + + log.debug("Saved: " + p); p = mongoOps.findOne(query(whereId().is(p.getId())), PersonWithIdPropertyOfTypeString.class); @@ -64,6 +74,14 @@ public class PersonExample { log.debug("Updated: " + p); + List folks = mongoOps.getCollection(PersonWithIdPropertyOfTypeString.class); + log.debug("Querying for all people..."); + for (Iterator iterator = folks.iterator(); iterator.hasNext();) { + PersonWithIdPropertyOfTypeString personWithIdPropertyOfTypeString = (PersonWithIdPropertyOfTypeString) iterator + .next(); + log.debug(personWithIdPropertyOfTypeString); + } + //mongoOps.remove( query(whereId().is(p.getId())), p.getClass()); mongoOps.remove(p); diff --git a/spring-data-mongodb/src/test/resources/server-jmx.xml b/spring-data-mongodb/src/test/resources/server-jmx.xml index 406a0a1a0..4b264fc83 100644 --- a/spring-data-mongodb/src/test/resources/server-jmx.xml +++ b/spring-data-mongodb/src/test/resources/server-jmx.xml @@ -1,11 +1,11 @@