Start building against Spring Data Kay snapshots

See gh-7461
pull/8047/merge
Andy Wilkinson 8 years ago
parent 0acfee44c5
commit d4c4bc35fd

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2015 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -48,7 +48,8 @@ public class CassandraHealthIndicator extends AbstractHealthIndicator {
try { try {
Select select = QueryBuilder.select("release_version").from("system", Select select = QueryBuilder.select("release_version").from("system",
"local"); "local");
ResultSet results = this.cassandraOperations.query(select); ResultSet results = this.cassandraOperations.getCqlOperations()
.queryForResultSet(select);
if (results.isExhausted()) { if (results.isExhausted()) {
builder.up(); builder.up();
return; return;

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2014 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,7 +16,7 @@
package org.springframework.boot.actuate.health; package org.springframework.boot.actuate.health;
import com.mongodb.CommandResult; import org.bson.Document;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@ -39,7 +39,7 @@ public class MongoHealthIndicator extends AbstractHealthIndicator {
@Override @Override
protected void doHealthCheck(Health.Builder builder) throws Exception { protected void doHealthCheck(Health.Builder builder) throws Exception {
CommandResult result = this.mongoTemplate.executeCommand("{ buildInfo: 1 }"); Document result = this.mongoTemplate.executeCommand("{ buildInfo: 1 }");
builder.up().withDetail("version", result.getString("version")); builder.up().withDetail("version", result.getString("version"));
} }

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,8 +16,8 @@
package org.springframework.boot.actuate.health; package org.springframework.boot.actuate.health;
import com.mongodb.CommandResult;
import com.mongodb.MongoException; import com.mongodb.MongoException;
import org.bson.Document;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;
@ -65,7 +65,7 @@ public class MongoHealthIndicatorTests {
@Test @Test
public void mongoIsUp() throws Exception { public void mongoIsUp() throws Exception {
CommandResult commandResult = mock(CommandResult.class); Document commandResult = mock(Document.class);
given(commandResult.getString("version")).willReturn("2.6.4"); given(commandResult.getString("version")).willReturn("2.6.4");
MongoTemplate mongoTemplate = mock(MongoTemplate.class); MongoTemplate mongoTemplate = mock(MongoTemplate.class);
given(mongoTemplate.executeCommand("{ buildInfo: 1 }")).willReturn(commandResult); given(mongoTemplate.executeCommand("{ buildInfo: 1 }")).willReturn(commandResult);

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,6 +22,7 @@ import java.util.Collections;
import com.mongodb.DB; import com.mongodb.DB;
import com.mongodb.Mongo; import com.mongodb.Mongo;
import com.mongodb.MongoClient; import com.mongodb.MongoClient;
import com.mongodb.client.MongoDatabase;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactory;
@ -161,7 +162,7 @@ public class MongoDataAutoConfiguration {
} }
@Override @Override
public DB getDb() throws DataAccessException { public MongoDatabase getDb() throws DataAccessException {
String gridFsDatabase = this.properties.getGridFsDatabase(); String gridFsDatabase = this.properties.getGridFsDatabase();
if (StringUtils.hasText(gridFsDatabase)) { if (StringUtils.hasText(gridFsDatabase)) {
return this.mongoDbFactory.getDb(gridFsDatabase); return this.mongoDbFactory.getDb(gridFsDatabase);
@ -170,7 +171,7 @@ public class MongoDataAutoConfiguration {
} }
@Override @Override
public DB getDb(String dbName) throws DataAccessException { public MongoDatabase getDb(String dbName) throws DataAccessException {
return this.mongoDbFactory.getDb(dbName); return this.mongoDbFactory.getDb(dbName);
} }
@ -179,6 +180,11 @@ public class MongoDataAutoConfiguration {
return this.mongoDbFactory.getExceptionTranslator(); return this.mongoDbFactory.getExceptionTranslator();
} }
@Override
public DB getLegacyDb() {
return this.mongoDbFactory.getLegacyDb();
}
} }
} }

@ -19,11 +19,11 @@ package org.springframework.boot.autoconfigure.mongo.embedded;
import java.io.File; import java.io.File;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import com.mongodb.CommandResult;
import com.mongodb.MongoClient; import com.mongodb.MongoClient;
import de.flapdoodle.embed.mongo.config.IMongodConfig; import de.flapdoodle.embed.mongo.config.IMongodConfig;
import de.flapdoodle.embed.mongo.config.Storage; import de.flapdoodle.embed.mongo.config.Storage;
import de.flapdoodle.embed.mongo.distribution.Feature; import de.flapdoodle.embed.mongo.distribution.Feature;
import org.bson.Document;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;
@ -82,8 +82,8 @@ public class EmbeddedMongoAutoConfigurationTests {
load(); load();
assertThat(this.context.getBeansOfType(MongoClient.class)).hasSize(1); assertThat(this.context.getBeansOfType(MongoClient.class)).hasSize(1);
MongoClient client = this.context.getBean(MongoClient.class); MongoClient client = this.context.getBean(MongoClient.class);
Integer mongoPort = Integer.valueOf( Integer mongoPort = Integer
this.context.getEnvironment().getProperty("local.mongo.port")); .valueOf(this.context.getEnvironment().getProperty("local.mongo.port"));
assertThat(client.getAddress().getPort()).isEqualTo(mongoPort); assertThat(client.getAddress().getPort()).isEqualTo(mongoPort);
} }
@ -92,8 +92,8 @@ public class EmbeddedMongoAutoConfigurationTests {
load("spring.data.mongodb.port=0"); load("spring.data.mongodb.port=0");
assertThat(this.context.getBeansOfType(MongoClient.class)).hasSize(1); assertThat(this.context.getBeansOfType(MongoClient.class)).hasSize(1);
MongoClient client = this.context.getBean(MongoClient.class); MongoClient client = this.context.getBean(MongoClient.class);
Integer mongoPort = Integer.valueOf( Integer mongoPort = Integer
this.context.getEnvironment().getProperty("local.mongo.port")); .valueOf(this.context.getEnvironment().getProperty("local.mongo.port"));
assertThat(client.getAddress().getPort()).isEqualTo(mongoPort); assertThat(client.getAddress().getPort()).isEqualTo(mongoPort);
} }
@ -101,8 +101,8 @@ public class EmbeddedMongoAutoConfigurationTests {
public void randomlyAllocatedPortIsAvailableWhenCreatingMongoClient() { public void randomlyAllocatedPortIsAvailableWhenCreatingMongoClient() {
load(MongoClientConfiguration.class); load(MongoClientConfiguration.class);
MongoClient client = this.context.getBean(MongoClient.class); MongoClient client = this.context.getBean(MongoClient.class);
Integer mongoPort = Integer.valueOf( Integer mongoPort = Integer
this.context.getEnvironment().getProperty("local.mongo.port")); .valueOf(this.context.getEnvironment().getProperty("local.mongo.port"));
assertThat(client.getAddress().getPort()).isEqualTo(mongoPort); assertThat(client.getAddress().getPort()).isEqualTo(mongoPort);
} }
@ -172,7 +172,7 @@ public class EmbeddedMongoAutoConfigurationTests {
MongoDataAutoConfiguration.class, EmbeddedMongoAutoConfiguration.class); MongoDataAutoConfiguration.class, EmbeddedMongoAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
MongoTemplate mongo = this.context.getBean(MongoTemplate.class); MongoTemplate mongo = this.context.getBean(MongoTemplate.class);
CommandResult buildInfo = mongo.executeCommand("{ buildInfo: 1 }"); Document buildInfo = mongo.executeCommand("{ buildInfo: 1 }");
assertThat(buildInfo.getString("version")).isEqualTo(expectedVersion); assertThat(buildInfo.getString("version")).isEqualTo(expectedVersion);
} }
@ -187,8 +187,7 @@ public class EmbeddedMongoAutoConfigurationTests {
ctx.register(config); ctx.register(config);
} }
EnvironmentTestUtils.addEnvironment(ctx, environment); EnvironmentTestUtils.addEnvironment(ctx, environment);
ctx.register(EmbeddedMongoAutoConfiguration.class, ctx.register(EmbeddedMongoAutoConfiguration.class, MongoAutoConfiguration.class,
MongoAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class); PropertyPlaceholderAutoConfiguration.class);
ctx.refresh(); ctx.refresh();
this.context = ctx; this.context = ctx;

@ -132,6 +132,7 @@
<mariadb.version>1.5.6</mariadb.version> <mariadb.version>1.5.6</mariadb.version>
<mssql-jdbc.version>6.1.0.jre8</mssql-jdbc.version> <mssql-jdbc.version>6.1.0.jre8</mssql-jdbc.version>
<mockito.version>2.5.4</mockito.version> <mockito.version>2.5.4</mockito.version>
<mongo-driver-reactivestreams.version>1.2.0</mongo-driver-reactivestreams.version>
<mongodb.version>3.4.1</mongodb.version> <mongodb.version>3.4.1</mongodb.version>
<mysql.version>5.1.40</mysql.version> <mysql.version>5.1.40</mysql.version>
<narayana.version>5.5.0.Final</narayana.version> <narayana.version>5.5.0.Final</narayana.version>
@ -153,7 +154,7 @@
<spring-amqp.version>2.0.0.BUILD-SNAPSHOT</spring-amqp.version> <spring-amqp.version>2.0.0.BUILD-SNAPSHOT</spring-amqp.version>
<spring-cloud-connectors.version>1.2.3.RELEASE</spring-cloud-connectors.version> <spring-cloud-connectors.version>1.2.3.RELEASE</spring-cloud-connectors.version>
<spring-batch.version>4.0.0.BUILD-SNAPSHOT</spring-batch.version> <spring-batch.version>4.0.0.BUILD-SNAPSHOT</spring-batch.version>
<spring-data-releasetrain.version>Ingalls-BUILD-SNAPSHOT</spring-data-releasetrain.version> <spring-data-releasetrain.version>Kay-BUILD-SNAPSHOT</spring-data-releasetrain.version>
<spring-hateoas.version>0.23.0.RELEASE</spring-hateoas.version> <spring-hateoas.version>0.23.0.RELEASE</spring-hateoas.version>
<spring-integration.version>5.0.0.M2</spring-integration.version> <spring-integration.version>5.0.0.M2</spring-integration.version>
<spring-kafka.version>1.1.2.RELEASE</spring-kafka.version> <spring-kafka.version>1.1.2.RELEASE</spring-kafka.version>
@ -1764,6 +1765,11 @@
<artifactId>mongodb-driver-core</artifactId> <artifactId>mongodb-driver-core</artifactId>
<version>${mongodb.version}</version> <version>${mongodb.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-reactivestreams</artifactId>
<version>${mongo-driver-reactivestreams.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.mongodb</groupId> <groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId> <artifactId>mongo-java-driver</artifactId>

Loading…
Cancel
Save