Commit Graph

321 Commits

Author SHA1 Message Date
Phillip Webb
837fc83527 Fix checkstyle header violations
See gh-24337
2020-12-04 18:05:53 -08:00
Andy Wilkinson
28ccf54b21 Ignore schema username when auto-configuring a test DB
Previously, when an embedded test database was being auto-configured
any schema username and password specified by the user would result
in a separate embedded test database being created to load the schema.
This then left the actual test database without the schema causing
test failures.

This commit updates the test database auto-configuration to set the
schema username to an empty string in a property source that's added
first to the environment's property sources. This causes any schema
username configured by the user to be ignored, preventing the creation
of a separate database for schema.sql processing.

Fixes gh-19321
2020-11-04 09:30:19 +00:00
Andy Wilkinson
622606d85a Make it clearer that only the main DataSource bean may be replaced
Closes gh-23808
2020-11-03 10:24:44 +00:00
Brian Clozel
5eb1e26e10 Add HttpEncodingAutoConfiguration to WebMvcTest
Prior to this commit, tests using the `@WebMvcTest` annotation would not
include the `HttpEncodingAutoConfiguration`. This means that, even if
configured, the encoding filter would not be configured in MVC tests,
resulting in an inconsistency with `@SpringBootTest` tests.

This commit ensures that the `HttpEncodingAutoConfiguration` is included
when `@WebMvcTest` is used.

Fixes gh-23749
2020-10-22 20:02:45 +02:00
Andy Wilkinson
5cd910c7ce Replace Embedded Mongo with Testcontainers' MongoDB support
Closes gh-23090
2020-08-28 12:00:31 +01:00
Phillip Webb
3271542d98 Add @Interited to @TypeExcludeFilters
Update `@TypeExcludeFilters` so that it is also annotated with
`@Inherited`.

Closes gh-22939
2020-08-14 17:12:31 -07:00
Johnny Lim
68e2dd626d Mention configuration customizers for WebTestClient and RestAssured
See gh-22765
2020-08-12 13:13:11 +01:00
Andy Wilkinson
22dc4e7608 Clarify documentation on @AutoConfigureRestDocs with WebTestClient
Closes gh-15977
2020-07-30 12:12:10 +01:00
Andy Wilkinson
1c3528f5a4 Include Jackson Modules in WebMvcTest and WebFluxTest
Fixes gh-22530
2020-07-27 10:11:29 +01:00
Andy Wilkinson
48acaa4bd9 Make AutoConfigureMockMvc use SecurityProperties' filter ordering
Previously, AutoConfigureMockMvc used Spring Security's default filter
ordering, ignoring the value configured by SecurityProperties that is
used at runtime. This resulted in different ordering at runtime and in
tests.

This commit updates the configuration for AutoConfigureMockMvc to
import the Spring Security filter auto-configuration, thereby ensuring
that the ordering configured via SecurityProperties is applied.

Fixes gh-21801
2020-06-10 09:51:05 +01:00
Stephane Nicoll
77981ac2ae Polish "Use the container IP address for tests using TestContainer"
See gh-21480
2020-05-25 14:29:24 +02:00
olivier lamy
0c2bf70bb8 Use the container IP address for tests using TestContainer
See gh-21480
2020-05-25 14:03:18 +02:00
Andy Wilkinson
ce95fd6825 Polish "Use @DynamicPropertySource for Neo4J and Redis data tests"
See gh-20676
2020-03-31 11:31:05 +01:00
dreis2211
d84422a41c Use @DynamicPropertySource for Neo4J and Redis data tests
See gh-20676
2020-03-31 11:31:05 +01:00
Stephane Nicoll
101fd14286 Merge branch '2.1.x' into 2.2.x
Closes gh-19685
2020-01-13 17:44:45 +01:00
Stephane Nicoll
8b8a4ee65e Polish "Make equality checks defensive to null reference"
See gh-19540
2020-01-13 17:38:38 +01:00
liuhuan
6d8b849361 Make equality checks defensive to null reference
See gh-19540
2020-01-13 17:38:26 +01:00
dreis2211
6ffe47cd06 Remove deprecated usage of WebTestClientBuilderCustomizer
See gh-19536
2020-01-06 12:59:12 +01:00
Andy Wilkinson
e26d5d95a8 Do not enable @ConfigurationPropertiesScan be default
In 2.2.0, @ConfigurationPropertiesScan was enabled by default.
Unfortunately, this had the unexpected side-effect of breaking
conditional enablement of a @ConfigurationProperties class via
@EnableConfigurationProperties if the @ConfigurationProperties class
was in a package covered by scanning.

This commit remove @ConfigurationPropertiesScan from
@SpringBootApplication so that it is no longer enabled by default.
2.1.x users who rely upon such conditional enablement of
@ConfigurationProperties classes can now upgrade to 2.2.x without
having to make any changes. Users who do not have such a need and are
in a position to use configuration properties scanning can now opt-in
by adding @ConfigurationPropertiesScan to their main application class
alongside @SpringBootApplication.

Closes gh-18674
2019-11-04 14:09:33 +00:00
Andy Wilkinson
9ed4207f0c Make TypeExcludeFilters public so they can be composed with user's own
Previously, all of the type exclude filters in
spring-boot-test-autoconfigure were package-private. This prevent a
user who was creating their own test slice from composing their own
TypeExcludeFilter with one of Boot's.

This commit updates all of the TypeExcludeFilters in the
test-autoconfigure module to make them public. The intention is only
to allow them to be composed with other type exclude filters when
referenced in a @TypeExcludeFilters annotation. Therefore, each
filter class is declared final and their constructors remain
package-private.

Closes gh-18746
2019-11-04 12:12:56 +00:00
Stephane Nicoll
2ceffcee14 Start building against Spring Data Moore-SR1 snapshots
See gh-18744
2019-10-29 10:36:35 +01:00
Stephane Nicoll
a315d4229d Start building against Spring Data Lovelace-SR12 snapshots
See gh-18743
2019-10-29 10:31:00 +01:00
dreis2211
8ecdf919f8 Fix Mockito deprecations
See gh-18689
2019-10-23 09:49:33 +02:00
Stephane Nicoll
fd94608f73 Polish "Restore proxying of @Bean methods in @TestConfiguration"
See gh-18675
2019-10-22 09:13:00 +02:00
Andy Wilkinson
c75b06c76c Remove @ImmutableConfigurationProperties
Closes gh-18563
2019-10-14 11:29:09 +01:00
Stephane Nicoll
32a1cdf4d3 Polish "Use dedicated method to turn off authentication"
See gh-18538
2019-10-08 11:13:51 -05:00
Michael Simons
04a01a49c2 Use dedicated method to turn off authentication
See gh-18538
2019-10-08 11:08:48 -05:00
Andy Wilkinson
96f85a40de Support customization of WebTestClient.Builder when using @SpringBootTest
Closes gh-15132
2019-10-02 17:51:00 +01:00
Andy Wilkinson
46c30d6bb0 Merge branch '2.1.x'
Closes gh-18476
2019-10-02 10:48:57 +01:00
Andy Wilkinson
3d4157ad6d Correct SCM URLs in published poms
Previously, Maven's default behaviour was relied up which resulted
in the artifact ID being appended to each URL as it was inherited.
This behaviour can only be disabled in Maven 3.6 and later, a version
that we cannot use due to an incompatibility with the Flatten Plugin.

This commit works around Maven's default behaviour by defining
properties for the SCM URL, connection, and developer connection and
then explicitly defining the settings in each pom using these
properties. The explicit definition of the properties in each pom
prevents them being inherited from the parent, thereby disabling the
unwanted appending of the artifact ID to the URL.

Fixes gh-18328
2019-10-02 10:48:30 +01:00
Phillip Webb
b65ba60980 Polish 'Simplify some code'
See gh-18438
2019-10-01 22:08:20 -07:00
Phillip Webb
e41c5a4327 Require annotation signal for constructor binding
Update `@ConfigurationProperties` constructor binding support to only
apply when a `@ConstructorBinding` annotation is present on either the
type or the specific constructor to use.

Prior to this commit we didn't have a good way to tell when constructor
binding should be used vs regular autowiring.

For convenience, an `@ImmutableConfigurationProperties` meta-annotation
has also been added which is composed of `@ConfigurationProperties` and
`@ConstructorBinding`.

Closes gh-18469
2019-10-01 21:56:09 -07:00
Phillip Webb
ecf751e7eb Polish 2019-10-01 20:51:54 -07:00
Andy Wilkinson
79d8089cd0 Remove redundant spring-plugin-core dependencies
Closes gh-18317
2019-09-23 14:11:03 +01:00
Andy Wilkinson
6534047fcf Rework test slice annotation javadoc to reflect JUnit 5 default
Closes gh-18178
2019-09-17 17:32:29 +01:00
dreis2211
07b857e57a Use disabledWithoutDocker option for @Testcontainers
See gh-18095
2019-09-03 09:51:53 +02:00
dreis2211
b4350a9d96 Remove unnecessary blank lines
See gh-18089
2019-09-03 08:48:10 +02:00
freekry
e1611287c8 Simplify some code
See gh-18077
2019-09-01 09:05:53 +02:00
Andy Wilkinson
2d2e3b3d8b Support parallel test execution with @AutoConfigureMockMvc
Previously, the deferred line writing that is used, to print MockMvc
results to the console assumed that each DeferredLinesWriter would
only be used by a single thread at a time. This assumption does not
hold true when using JUnit 5's parallel test exection if the tests
running in parallel share an application context. This resulted in
a concurrent modification exception if one thread was adding lines
to the output while another was iterating over them.

This commit updates DeferredLinesWriter so that it uses thread local
storage for the deferred lines. This ensures that each List of lines
is only ever accessed by a single thread.

Closes gh-16179
2019-08-23 14:12:54 +01:00
Phillip Webb
94b5ad0f7e Fixup tests following upstream HATEOAS changes
See gh-17755
2019-08-01 15:32:39 +01:00
Phillip Webb
da4f436140 Change SearchStrategy EXHAUSTIVE to TYPE_HIERARCHY
Fixup references following upstream Spring Framework change.
2019-07-31 15:11:43 +01:00
Phillip Webb
6675f49334 Switch to multi-line security configuration
Now that we have lambda style security configuration we can further
improve readability by switching to one statement per line.

See gh-17525
2019-07-29 11:28:51 +01:00
Madhura Bhave
39a7b9da38 Switch to lambda style security configuration
Closes gh-17525
2019-07-26 14:41:49 -07:00
Phillip Webb
8bc780762a Merge branch '2.1.x' 2019-07-24 11:42:48 +01:00
Phillip Webb
fb1dd8fe93 Merge branch '2.0.x' into 2.1.x 2019-07-24 11:41:32 +01:00
Phillip Webb
913e831f4e Merge '1.5.x' into 2.0.x 2019-07-24 11:39:58 +01:00
Dmytro Nosan
9d052bbe5e Include WebFilter beans in WebFluxTest slice
See gh-17601
2019-07-22 12:38:48 -07:00
Dmytro Nosan
6859a89cf3 Include HandlerInterceptor beans in WebMvcTest slice
See gh-17600
2019-07-22 12:34:11 -07:00
Stephane Nicoll
e5ca9df478 Merge branch '2.1.x' 2019-07-19 11:33:16 +02:00
Stephane Nicoll
8eb6886388 Fix code formating 2019-07-19 11:29:12 +02:00