Skip to content

Introduce TestSliceTestContextBootstrapper for test slices #44354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

package org.springframework.boot.test.autoconfigure.data.cassandra;

import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.test.context.TestContextAnnotationUtils;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;

/**
Expand All @@ -26,13 +25,6 @@
*
* @author Artsiom Yudovin
*/
class DataCassandraTestContextBootstrapper extends SpringBootTestContextBootstrapper {

@Override
protected String[] getProperties(Class<?> testClass) {
DataCassandraTest dataCassandraTest = TestContextAnnotationUtils.findMergedAnnotation(testClass,
DataCassandraTest.class);
return (dataCassandraTest != null) ? dataCassandraTest.properties() : null;
}
class DataCassandraTestContextBootstrapper extends TestSliceTestContextBootstrapper<DataCassandraTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

package org.springframework.boot.test.autoconfigure.data.couchbase;

import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.test.context.TestContextAnnotationUtils;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;

/**
Expand All @@ -26,13 +25,6 @@
*
* @author Eddú Meléndez
*/
class DataCouchbaseTestContextBootstrapper extends SpringBootTestContextBootstrapper {

@Override
protected String[] getProperties(Class<?> testClass) {
DataCouchbaseTest dataCouchbaseTest = TestContextAnnotationUtils.findMergedAnnotation(testClass,
DataCouchbaseTest.class);
return (dataCouchbaseTest != null) ? dataCouchbaseTest.properties() : null;
}
class DataCouchbaseTestContextBootstrapper extends TestSliceTestContextBootstrapper<DataCouchbaseTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

package org.springframework.boot.test.autoconfigure.data.elasticsearch;

import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.test.context.TestContextAnnotationUtils;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;

/**
Expand All @@ -26,13 +25,6 @@
*
* @author Eddú Meléndez
*/
class DataElasticsearchTestContextBootstrapper extends SpringBootTestContextBootstrapper {

@Override
protected String[] getProperties(Class<?> testClass) {
DataElasticsearchTest dataElasticsearchTest = TestContextAnnotationUtils.findMergedAnnotation(testClass,
DataElasticsearchTest.class);
return (dataElasticsearchTest != null) ? dataElasticsearchTest.properties() : null;
}
class DataElasticsearchTestContextBootstrapper extends TestSliceTestContextBootstrapper<DataElasticsearchTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,14 @@

package org.springframework.boot.test.autoconfigure.data.jdbc;

import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.test.context.TestContextAnnotationUtils;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;

/**
* {@link TestContextBootstrapper} for {@link DataJdbcTest @DataJdbcTest} support.
*
* @author Andy Wilkinson
*/
class DataJdbcTestContextBootstrapper extends SpringBootTestContextBootstrapper {

@Override
protected String[] getProperties(Class<?> testClass) {
DataJdbcTest dataJdbcTest = TestContextAnnotationUtils.findMergedAnnotation(testClass, DataJdbcTest.class);
return (dataJdbcTest != null) ? dataJdbcTest.properties() : null;
}
class DataJdbcTestContextBootstrapper extends TestSliceTestContextBootstrapper<DataJdbcTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,14 @@

package org.springframework.boot.test.autoconfigure.data.ldap;

import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.test.context.TestContextAnnotationUtils;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;

/**
* {@link TestContextBootstrapper} for {@link DataLdapTest @DataLdapTest} support.
*
* @author Artsiom Yudovin
*/
class DataLdapTestContextBootstrapper extends SpringBootTestContextBootstrapper {

@Override
protected String[] getProperties(Class<?> testClass) {
DataLdapTest dataLdapTest = TestContextAnnotationUtils.findMergedAnnotation(testClass, DataLdapTest.class);
return (dataLdapTest != null) ? dataLdapTest.properties() : null;
}
class DataLdapTestContextBootstrapper extends TestSliceTestContextBootstrapper<DataLdapTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,14 @@

package org.springframework.boot.test.autoconfigure.data.mongo;

import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.test.context.TestContextAnnotationUtils;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;

/**
* {@link TestContextBootstrapper} for {@link DataMongoTest @DataMongoTest} support.
*
* @author Artsiom Yudovin
*/
class DataMongoTestContextBootstrapper extends SpringBootTestContextBootstrapper {

@Override
protected String[] getProperties(Class<?> testClass) {
DataMongoTest dataMongoTest = TestContextAnnotationUtils.findMergedAnnotation(testClass, DataMongoTest.class);
return (dataMongoTest != null) ? dataMongoTest.properties() : null;
}
class DataMongoTestContextBootstrapper extends TestSliceTestContextBootstrapper<DataMongoTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,14 @@

package org.springframework.boot.test.autoconfigure.data.neo4j;

import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.test.context.TestContextAnnotationUtils;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;

/**
* {@link TestContextBootstrapper} for {@link DataNeo4jTest @DataNeo4jTest} support.
*
* @author Artsiom Yudovin
*/
class DataNeo4jTestContextBootstrapper extends SpringBootTestContextBootstrapper {

@Override
protected String[] getProperties(Class<?> testClass) {
DataNeo4jTest dataNeo4jTest = TestContextAnnotationUtils.findMergedAnnotation(testClass, DataNeo4jTest.class);
return (dataNeo4jTest != null) ? dataNeo4jTest.properties() : null;
}
class DataNeo4jTestContextBootstrapper extends TestSliceTestContextBootstrapper<DataNeo4jTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,14 @@

package org.springframework.boot.test.autoconfigure.data.r2dbc;

import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.test.context.TestContextAnnotationUtils;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;

/**
* {@link TestContextBootstrapper} for {@link DataR2dbcTest @DataR2dbcTest} support.
*
* @author Mark Paluch
*/
class DataR2dbcTestContextBootstrapper extends SpringBootTestContextBootstrapper {

@Override
protected String[] getProperties(Class<?> testClass) {
DataR2dbcTest dataR2dbcTest = TestContextAnnotationUtils.findMergedAnnotation(testClass, DataR2dbcTest.class);
return (dataR2dbcTest != null) ? dataR2dbcTest.properties() : null;
}
class DataR2dbcTestContextBootstrapper extends TestSliceTestContextBootstrapper<DataR2dbcTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,14 @@

package org.springframework.boot.test.autoconfigure.data.redis;

import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.test.context.TestContextAnnotationUtils;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;

/**
* {@link TestContextBootstrapper} for {@link DataRedisTest @DataRedisTest} support.
*
* @author Artsiom Yudovin
*/
class DataRedisTestContextBootstrapper extends SpringBootTestContextBootstrapper {

@Override
protected String[] getProperties(Class<?> testClass) {
DataRedisTest dataRedisTest = TestContextAnnotationUtils.findMergedAnnotation(testClass, DataRedisTest.class);
return (dataRedisTest != null) ? dataRedisTest.properties() : null;
}
class DataRedisTestContextBootstrapper extends TestSliceTestContextBootstrapper<DataRedisTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,14 @@

package org.springframework.boot.test.autoconfigure.graphql;

import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.test.context.TestContextAnnotationUtils;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;

/**
* {@link TestContextBootstrapper} for {@link GraphQlTest @GraphQlTest}.
*
* @author Brian Clozel
*/
class GraphQlTestContextBootstrapper extends SpringBootTestContextBootstrapper {

@Override
protected String[] getProperties(Class<?> testClass) {
GraphQlTest graphQlTest = TestContextAnnotationUtils.findMergedAnnotation(testClass, GraphQlTest.class);
return (graphQlTest != null) ? graphQlTest.properties() : null;
}
class GraphQlTestContextBootstrapper extends TestSliceTestContextBootstrapper<GraphQlTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,15 @@

package org.springframework.boot.test.autoconfigure.jdbc;

import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.test.context.TestContextAnnotationUtils;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;

/**
* {@link TestContextBootstrapper} for {@link JdbcTest @JdbcTest} support.
*
* @author Artsiom Yudovin
* @author Yanming Zhou
*/
class JdbcTestContextBootstrapper extends SpringBootTestContextBootstrapper {

@Override
protected String[] getProperties(Class<?> testClass) {
JdbcTest jdbcTest = TestContextAnnotationUtils.findMergedAnnotation(testClass, JdbcTest.class);
return (jdbcTest != null) ? jdbcTest.properties() : null;
}
class JdbcTestContextBootstrapper extends TestSliceTestContextBootstrapper<JdbcTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,14 @@

package org.springframework.boot.test.autoconfigure.jooq;

import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.test.context.TestContextAnnotationUtils;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;

/**
* {@link TestContextBootstrapper} for {@link JooqTest @JooqTest} support.
*
* @author Artsiom Yudovin
*/
class JooqTestContextBootstrapper extends SpringBootTestContextBootstrapper {

@Override
protected String[] getProperties(Class<?> testClass) {
JooqTest jooqTest = TestContextAnnotationUtils.findMergedAnnotation(testClass, JooqTest.class);
return (jooqTest != null) ? jooqTest.properties() : null;
}
class JooqTestContextBootstrapper extends TestSliceTestContextBootstrapper<JooqTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,14 @@

package org.springframework.boot.test.autoconfigure.json;

import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.test.context.TestContextAnnotationUtils;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;

/**
* {@link TestContextBootstrapper} for {@link JsonTest @JsonTest} support.
*
* @author Artsiom Yudovin
*/
class JsonTestContextBootstrapper extends SpringBootTestContextBootstrapper {

@Override
protected String[] getProperties(Class<?> testClass) {
JsonTest jsonTest = TestContextAnnotationUtils.findMergedAnnotation(testClass, JsonTest.class);
return (jsonTest != null) ? jsonTest.properties() : null;
}
class JsonTestContextBootstrapper extends TestSliceTestContextBootstrapper<JsonTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,14 @@

package org.springframework.boot.test.autoconfigure.orm.jpa;

import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.test.context.TestContextAnnotationUtils;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;

/**
* {@link TestContextBootstrapper} for {@link DataJpaTest @DataJpaTest} support.
*
* @author Artsiom Yudovin
*/
class DataJpaTestContextBootstrapper extends SpringBootTestContextBootstrapper {

@Override
protected String[] getProperties(Class<?> testClass) {
DataJpaTest dataJpaTest = TestContextAnnotationUtils.findMergedAnnotation(testClass, DataJpaTest.class);
return (dataJpaTest != null) ? dataJpaTest.properties() : null;
}
class DataJpaTestContextBootstrapper extends TestSliceTestContextBootstrapper<DataJpaTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,14 @@

package org.springframework.boot.test.autoconfigure.web.client;

import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.test.context.TestContextAnnotationUtils;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.test.context.TestContextBootstrapper;

/**
* {@link TestContextBootstrapper} for {@link RestClientTest @RestClientTest} support.
*
* @author Artsiom Yudovin
*/
class RestClientTestContextBootstrapper extends SpringBootTestContextBootstrapper {

@Override
protected String[] getProperties(Class<?> testClass) {
RestClientTest restClientTest = TestContextAnnotationUtils.findMergedAnnotation(testClass,
RestClientTest.class);
return (restClientTest != null) ? restClientTest.properties() : null;
}
class RestClientTestContextBootstrapper extends TestSliceTestContextBootstrapper<RestClientTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
package org.springframework.boot.test.autoconfigure.web.reactive;

import org.springframework.boot.test.context.ReactiveWebMergedContextConfiguration;
import org.springframework.boot.test.context.SpringBootTestContextBootstrapper;
import org.springframework.boot.test.context.TestSliceTestContextBootstrapper;
import org.springframework.test.context.MergedContextConfiguration;
import org.springframework.test.context.TestContextAnnotationUtils;
import org.springframework.test.context.TestContextBootstrapper;

/**
Expand All @@ -28,17 +27,11 @@
* @author Stephane Nicoll
* @author Artsiom Yudovin
*/
class WebFluxTestContextBootstrapper extends SpringBootTestContextBootstrapper {
class WebFluxTestContextBootstrapper extends TestSliceTestContextBootstrapper<WebFluxTest> {

@Override
protected MergedContextConfiguration processMergedContextConfiguration(MergedContextConfiguration mergedConfig) {
return new ReactiveWebMergedContextConfiguration(super.processMergedContextConfiguration(mergedConfig));
}

@Override
protected String[] getProperties(Class<?> testClass) {
WebFluxTest webFluxTest = TestContextAnnotationUtils.findMergedAnnotation(testClass, WebFluxTest.class);
return (webFluxTest != null) ? webFluxTest.properties() : null;
}

}
Loading