#125 - Adapt to changes in Spring Boot R2DBC.
Simplify R2DBC fixture. Add password override.
This commit is contained in:
@@ -15,21 +15,15 @@
|
||||
*/
|
||||
package org.springframework.data.microbenchmark.r2dbc;
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.r2dbc.R2dbcProperties;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.data.microbenchmark.FixtureUtils;
|
||||
import org.springframework.data.r2dbc.connectionfactory.init.ResourceDatabasePopulator;
|
||||
|
||||
import io.r2dbc.spi.ConnectionFactory;
|
||||
import lombok.Getter;
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.data.microbenchmark.FixtureUtils;
|
||||
|
||||
/**
|
||||
* Test fixture for JDBC and Spring Data JDBC benchmarks.
|
||||
*
|
||||
*
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
public class R2dbcFixture {
|
||||
@@ -37,22 +31,9 @@ public class R2dbcFixture {
|
||||
private final @Getter ConfigurableApplicationContext context;
|
||||
|
||||
public R2dbcFixture(String database) {
|
||||
|
||||
this.context = FixtureUtils.createContext(R2dbcApplication.class, "r2dbc", database);
|
||||
|
||||
R2dbcProperties properties = context.getBean(R2dbcProperties.class);
|
||||
String platform = properties.getPlatform();
|
||||
|
||||
Resource schema = new ClassPathResource(String.format("schema-%s.sql", platform));
|
||||
Resource data = new ClassPathResource(String.format("data-%s.sql", platform));
|
||||
|
||||
ResourceDatabasePopulator populator = new ResourceDatabasePopulator(schema, data);
|
||||
populator.execute(context.getBean(ConnectionFactory.class)).block();
|
||||
}
|
||||
|
||||
|
||||
@SpringBootApplication (exclude = {
|
||||
DataSourceAutoConfiguration.class
|
||||
})
|
||||
@SpringBootApplication
|
||||
static class R2dbcApplication {}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,6 @@ spring.datasource.initialization-mode=always
|
||||
|
||||
spring.r2dbc.url=r2dbc:postgresql://localhost:5432/benchmark
|
||||
spring.r2dbc.platform=postgres
|
||||
spring.r2dbc.initialization-mode=always
|
||||
spring.r2dbc.username=postgres
|
||||
spring.r2dbc.password=
|
||||
spring.r2dbc.initialization-mode=always
|
||||
|
||||
Reference in New Issue
Block a user