Add the Spring IO plugin

This commit adds the Spring IO plugin, but it is configured such that
it will only take effect when the build is run with
-PplatformVersion=x.y.z

Some redundant exclusions in spring-cloud-spring-service-connector have
been removed and those that only declared a module have been updated to
declare both a module and a group.

The Spring IO Platform currently specifies a newer version (2.12.1) of
the MongoDB driver. This version has changed the behaviour of
Mongo.getAddress() such that calling it now results in an attempt to
initiate the connection. MongoServiceConnectorCreatorTest has been
updated to call Mongo.getAllAddresses() instead. This works on both
2.11.x and 2.12.1.
This commit is contained in:
Andy Wilkinson
2014-05-14 11:06:57 +01:00
parent 45f2803000
commit 5f17f54258
3 changed files with 27 additions and 15 deletions

View File

@@ -8,6 +8,7 @@ buildscript {
}
dependencies {
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.5'
classpath 'org.springframework.build.gradle:spring-io-plugin:0.0.3.RELEASE'
}
}
@@ -59,6 +60,19 @@ subprojects {
apply from: "${rootProject.projectDir}/publish-maven.gradle"
if (project.hasProperty('platformVersion')) {
apply plugin: 'spring-io'
// necessary to resolve the Spring IO versions (which may include snapshots)
repositories {
maven { url "https://repo.spring.io/libs-snapshot" }
}
dependencies {
springIoVersions "io.spring.platform:platform-versions:${platformVersion}@properties"
}
}
sourceCompatibility = 1.6
targetCompatibility = 1.6

View File

@@ -20,26 +20,18 @@ dependencies {
optional("org.apache.tomcat:tomcat-jdbc:$tomcatVersion")
optional("org.apache.tomcat:tomcat-dbcp:$tomcatVersion")
optional("org.apache.commons:commons-dbcp2:$commonDbcp2Version") {
exclude(module: 'commons-logging')
exclude(module: 'xerces')
exclude(module: 'xercesImpl')
exclude(module: 'xml-apis')
}
optional("commons-dbcp:commons-dbcp:$commonDbcpVersion") {
exclude(module: 'commons-logging')
exclude(module: 'xerces')
exclude(module: 'xercesImpl')
exclude(module: 'xml-apis')
exclude(group: 'commons-logging', module: 'commons-logging')
}
optional("commons-dbcp:commons-dbcp:$commonDbcpVersion")
optional("org.springframework.amqp:spring-rabbit:$springAmqpVersion")
optional("org.springframework.data:spring-data-redis:$springDataRedisVersion") {
exclude(module: 'spring-context-support')
exclude(group: 'org.springframework', module: 'spring-context-support')
}
optional("redis.clients:jedis:$jedisVersion")
optional("org.springframework.data:spring-data-mongodb:$springDataMongoVersion") {
exclude(module: 'spring-beans')
exclude(module: 'spring-expression')
exclude(module: 'spring-tx')
exclude(group: 'org.springframework', module: 'spring-beans')
exclude(group: 'org.springframework', module: 'spring-expression')
exclude(group: 'org.springframework', module: 'spring-tx')
}
}

View File

@@ -3,6 +3,8 @@ package org.springframework.cloud.service.mongo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.List;
import org.junit.Test;
import org.springframework.cloud.service.common.MongoServiceInfo;
import org.springframework.cloud.service.document.MongoDbFactoryCreator;
@@ -47,7 +49,11 @@ public class MongoServiceConnectorCreatorTest {
Mongo mongo = (Mongo) ReflectionTestUtils.getField(connector, "mongo");
UserCredentials credentials = (UserCredentials) ReflectionTestUtils.getField(connector, "credentials");
assertNotNull(mongo);
ServerAddress address = mongo.getAddress();
List<ServerAddress> addresses = mongo.getAllAddress();
assertEquals(1, addresses.size());
ServerAddress address = addresses.get(0);
assertEquals(serviceInfo.getHost(), address.getHost());
assertEquals(serviceInfo.getPort(), address.getPort());