diff --git a/.travis.yml b/.travis.yml index 38387dada7..ed1d391663 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ env: - PROFILE=mongo31 - PROFILE=mongo32 - PROFILE=mongo33 + - PROFILE=mongo34-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 diff --git a/pom.xml b/pom.xml index dfb64f9ba3..be4b236540 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-mongodb-parent - 1.10.0.BUILD-SNAPSHOT + 1.10.0.DATAMONGO-1504-SNAPSHOT pom Spring Data MongoDB @@ -178,6 +178,22 @@ + + + mongo34-next + + 3.4.0-SNAPSHOT + + + + + mongo-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + + + + release diff --git a/spring-data-mongodb-cross-store/pom.xml b/spring-data-mongodb-cross-store/pom.xml index ae0a5d6c8f..c985488830 100644 --- a/spring-data-mongodb-cross-store/pom.xml +++ b/spring-data-mongodb-cross-store/pom.xml @@ -6,7 +6,7 @@ org.springframework.data spring-data-mongodb-parent - 1.10.0.BUILD-SNAPSHOT + 1.10.0.DATAMONGO-1504-SNAPSHOT ../pom.xml @@ -48,7 +48,7 @@ org.springframework.data spring-data-mongodb - 1.10.0.BUILD-SNAPSHOT + 1.10.0.DATAMONGO-1504-SNAPSHOT diff --git a/spring-data-mongodb-distribution/pom.xml b/spring-data-mongodb-distribution/pom.xml index 2d02722262..76ac30e044 100644 --- a/spring-data-mongodb-distribution/pom.xml +++ b/spring-data-mongodb-distribution/pom.xml @@ -13,7 +13,7 @@ org.springframework.data spring-data-mongodb-parent - 1.10.0.BUILD-SNAPSHOT + 1.10.0.DATAMONGO-1504-SNAPSHOT ../pom.xml diff --git a/spring-data-mongodb-log4j/pom.xml b/spring-data-mongodb-log4j/pom.xml index ee5e3336db..03cf2b24c1 100644 --- a/spring-data-mongodb-log4j/pom.xml +++ b/spring-data-mongodb-log4j/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-mongodb-parent - 1.10.0.BUILD-SNAPSHOT + 1.10.0.DATAMONGO-1504-SNAPSHOT ../pom.xml diff --git a/spring-data-mongodb-log4j/src/main/java/org/springframework/data/mongodb/log4j/MongoLog4jAppender.java b/spring-data-mongodb-log4j/src/main/java/org/springframework/data/mongodb/log4j/MongoLog4jAppender.java index 10883f5835..165061e6bd 100644 --- a/spring-data-mongodb-log4j/src/main/java/org/springframework/data/mongodb/log4j/MongoLog4jAppender.java +++ b/spring-data-mongodb-log4j/src/main/java/org/springframework/data/mongodb/log4j/MongoLog4jAppender.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2013 the original author or authors. + * Copyright 2011-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ import com.mongodb.BasicDBObject; import com.mongodb.DB; import com.mongodb.Mongo; +import com.mongodb.MongoClient; import com.mongodb.WriteConcern; /** @@ -37,6 +38,7 @@ * * @author Jon Brisbin * @author Oliver Gierke + * @auhtor Christoph Strobl */ public class MongoLog4jAppender extends AppenderSkeleton { @@ -58,8 +60,8 @@ public class MongoLog4jAppender extends AppenderSkeleton { protected String collectionPattern = "%c"; protected PatternLayout collectionLayout = new PatternLayout(collectionPattern); protected String applicationId = System.getProperty("APPLICATION_ID", null); - protected WriteConcern warnOrHigherWriteConcern = WriteConcern.SAFE; - protected WriteConcern infoOrLowerWriteConcern = WriteConcern.NORMAL; + protected WriteConcern warnOrHigherWriteConcern = WriteConcern.ACKNOWLEDGED; + protected WriteConcern infoOrLowerWriteConcern = WriteConcern.UNACKNOWLEDGED; protected Mongo mongo; protected DB db; @@ -128,7 +130,7 @@ public void setInfoOrLowerWriteConcern(String wc) { } protected void connectToMongo() throws UnknownHostException { - this.mongo = new Mongo(host, port); + this.mongo = new MongoClient(host, port); this.db = mongo.getDB(database); } diff --git a/spring-data-mongodb-log4j/src/test/java/org/springframework/data/mongodb/log4j/MongoLog4jAppenderIntegrationTests.java b/spring-data-mongodb-log4j/src/test/java/org/springframework/data/mongodb/log4j/MongoLog4jAppenderIntegrationTests.java index e8109d093b..6862b054dd 100644 --- a/spring-data-mongodb-log4j/src/test/java/org/springframework/data/mongodb/log4j/MongoLog4jAppenderIntegrationTests.java +++ b/spring-data-mongodb-log4j/src/test/java/org/springframework/data/mongodb/log4j/MongoLog4jAppenderIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2013 the original author or authors. + * Copyright 2011-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,37 +22,44 @@ import org.apache.log4j.Logger; import org.apache.log4j.MDC; +import org.junit.After; import org.junit.Before; import org.junit.Test; +import com.mongodb.BasicDBObject; import com.mongodb.DB; import com.mongodb.DBCursor; -import com.mongodb.Mongo; +import com.mongodb.MongoClient; /** * Integration tests for {@link MongoLog4jAppender}. * * @author Jon Brisbin * @author Oliver Gierke + * @author Christoph Strobl */ public class MongoLog4jAppenderIntegrationTests { static final String NAME = MongoLog4jAppenderIntegrationTests.class.getName(); private static final Logger log = Logger.getLogger(NAME); - Mongo mongo; + MongoClient mongo; DB db; String collection; @Before public void setUp() throws Exception { - mongo = new Mongo("localhost", 27017); + mongo = new MongoClient("localhost", 27017); db = mongo.getDB("logs"); Calendar now = Calendar.getInstance(); collection = String.valueOf(now.get(Calendar.YEAR)) + String.format("%1$02d", now.get(Calendar.MONTH) + 1); - db.getCollection(collection).drop(); + } + + @After + public void tearDown() { + db.getCollection(collection).remove(new BasicDBObject()); } @Test @@ -64,7 +71,6 @@ public void testLogging() { log.error("ERROR message"); DBCursor msgs = db.getCollection(collection).find(); - assertThat(msgs.count(), is(4)); } diff --git a/spring-data-mongodb/pom.xml b/spring-data-mongodb/pom.xml index 8072d3f665..99b6c7d608 100644 --- a/spring-data-mongodb/pom.xml +++ b/spring-data-mongodb/pom.xml @@ -11,7 +11,7 @@ org.springframework.data spring-data-mongodb-parent - 1.10.0.BUILD-SNAPSHOT + 1.10.0.DATAMONGO-1504-SNAPSHOT ../pom.xml diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java index 11960330b4..619b3bb0a1 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java @@ -2182,7 +2182,7 @@ public FindCallback(DBObject query) { } public FindCallback(DBObject query, DBObject fields) { - this.query = query; + this.query = query == null ? new BasicDBObject() : query; this.fields = fields; } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsTemplate.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsTemplate.java index 20781134ec..e523e8855a 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsTemplate.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2014 the original author or authors. + * Copyright 2011-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,6 +45,7 @@ * @author Philipp Schneider * @author Thomas Darimont * @author Martin Baumgartner + * @author Christoph Strobl */ public class GridFsTemplate implements GridFsOperations, ResourcePatternResolver { @@ -182,7 +183,7 @@ public GridFSFile store(InputStream content, String filename, String contentType public List find(Query query) { if (query == null) { - return getGridFs().find((DBObject) null); + return getGridFs().find(new BasicDBObject()); } DBObject queryObject = getMappedQuery(query.getQueryObject()); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/performance/PerformanceTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/performance/PerformanceTests.java index 47cf1eec96..9155721216 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/performance/PerformanceTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/performance/PerformanceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,7 +74,7 @@ public class PerformanceTests { private static final int ITERATIONS = 50; private static final StopWatch watch = new StopWatch(); private static final Collection IGNORED_WRITE_CONCERNS = Arrays.asList("MAJORITY", "REPLICAS_SAFE", - "FSYNC_SAFE", "FSYNCED", "JOURNAL_SAFE", "JOURNALED", "REPLICA_ACKNOWLEDGED"); + "FSYNC_SAFE", "FSYNCED", "JOURNAL_SAFE", "JOURNALED", "REPLICA_ACKNOWLEDGED", "W2", "W3"); private static final int COLLECTION_SIZE = 1024 * 1024 * 256; // 256 MB private static final Collection COLLECTION_NAMES = Arrays.asList("template", "driver", "person");