From c8fe02e48ee7557447888e72c6b06a6412d937a3 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 8 Apr 2016 11:28:20 +0200 Subject: [PATCH] DATAMONGO-1411 - Enable build on TravisCI. We now start MongoDB server via apt-get instead of relying on the TravisCI managed 2.4.2 installation. Doing this we altered tests to just check on the port and not the host part of the URIs. Additionally we upgraded build profiles, removed promoted snapshot-versions, renamed mongo32-next to mongo32 and added mongo33-next build profile. Original pull request: #358 --- .travis.yml | 19 +++++++++++++++-- pom.xml | 17 +++++++++++---- .../config/MongoNamespaceReplicaSetTests.java | 21 ++++++++++++++----- 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0e651dc58..fd3e646ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,13 +3,28 @@ language: java jdk: - oraclejdk8 -services: - - mongodb +before_script: + - mongod --version env: matrix: - PROFILE=ci - PROFILE=mongo-next + - PROFILE=mongo3 + - PROFILE=mongo3-next + - PROFILE=mongo31 + - PROFILE=mongo32 + - PROFILE=mongo33-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 +addons: + apt: + sources: + - mongodb-3.2-precise + packages: + - mongodb-org-server + - mongodb-org-shell sudo: false diff --git a/pom.xml b/pom.xml index 37964a878..3733f9601 100644 --- a/pom.xml +++ b/pom.xml @@ -107,7 +107,7 @@ mongo-next - 2.14.0-SNAPSHOT + 2.15.0-SNAPSHOT @@ -148,16 +148,25 @@ mongo31 - 3.1.0 + 3.1.1 - mongo32-next + mongo32 - 3.2.0-SNAPSHOT + 3.2.2 + + + + + + + mongo33-next + + 3.3.0-SNAPSHOT diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoNamespaceReplicaSetTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoNamespaceReplicaSetTests.java index f3e15aec4..f76e76893 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoNamespaceReplicaSetTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/config/MongoNamespaceReplicaSetTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2012 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. @@ -20,6 +20,7 @@ import static org.hamcrest.Matchers.*; import static org.junit.Assert.*; import java.net.InetAddress; +import java.util.ArrayList; import java.util.List; import org.junit.Ignore; @@ -37,6 +38,13 @@ import com.mongodb.CommandResult; import com.mongodb.Mongo; import com.mongodb.ServerAddress; +/** + * + * @author Mark Pollack + * @author Oliver Gierke + * @author Thomas Darimont + * @author Mark Paluch + */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration public class MongoNamespaceReplicaSetTests { @@ -70,10 +78,13 @@ public class MongoNamespaceReplicaSetTests { assertThat(replicaSetSeeds, is(notNullValue())); assertThat(replicaSetSeeds, hasSize(3)); - assertThat( - replicaSetSeeds, - hasItems(new ServerAddress("192.168.174.130", 27017), new ServerAddress("192.168.174.130", 27018), - new ServerAddress("192.168.174.130", 27019))); + + List ports = new ArrayList(); + for (ServerAddress replicaSetSeed : replicaSetSeeds) { + ports.add(replicaSetSeed.getPort()); + } + + assertThat(ports, hasItems(27017, 27018, 27019)); } @Test