Skip to content
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

Introduce TestSliceTestContextBootstrapper for test slices #44354

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
Expand All @@ -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
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
Expand All @@ -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
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
Expand All @@ -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
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
Expand All @@ -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
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
Expand All @@ -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
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
Expand All @@ -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
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
Expand All @@ -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
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
Expand All @@ -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
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
Expand All @@ -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
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2023 the original author or authors.
* Copyright 2020-2025 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.
Expand All @@ -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
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
Expand All @@ -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
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 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.
Expand All @@ -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> {

}
Loading