Commit Graph

376 Commits

Author SHA1 Message Date
Stephane Nicoll 6817856e7d Add test slice for Spring Data R2DBC
This commit adds a test slice for Spring Data R2DBC. When
`DataR2dbcTest` is added on a test, only Spring Data R2DBC repositories
and the infrastructure that they need is auto-configured.

Contrary to the JDBC counterpart, the `ConnectionFactory` is not swapped
by an embedded database.

See gh-19988

Co-authored-by: Mark Paluch <mpaluch@pivotal.io>
2020-02-25 09:21:47 -05:00
Johnny Lim 8be8a8421d Polish
See gh-20226
2020-02-19 09:34:46 +01:00
dreis2211 aa0360e1ba Fix some deprecation warnings
See gh-20108
2020-02-10 15:28:30 +01:00
Madhura Bhave 0a377647ca Import OAuth2 auto-configurations in web slice tests
Fixes gh-19823
2020-02-03 18:03:52 -08:00
Stephane Nicoll c4daff7225 Polish "Upgrade to MongoDB Java Driver 4.0 beta1"
See gh-19960
2020-02-03 14:12:46 +01:00
Christoph Strobl d2d6dbdc00 Upgrade to MongoDB Java Driver 4.0 beta1
See gh-19960
2020-02-03 10:59:30 +01:00
Stephane Nicoll bae1d8d780 Polish "Use new AssertJ duration assertions"
See gh-19985
2020-01-30 08:20:49 +01:00
dreis2211 fac6f08ca3 Use new AssertJ duration assertions
See gh-19985
2020-01-30 08:14:49 +01:00
Phillip Webb e0013454b5 Use parentheses when declaring dependencies
Update all dependencies declarations to use the form `scope(reference)`
rather than `scope reference`.

Prior to this commit we declared dependencies without parentheses unless
we were forced to add them due to an `exclude`.
2020-01-22 16:02:38 -08:00
Phillip Webb 0209cd3e4c Polish quote form used in Gradle scripts
Replace Gradle single quote strings with the double quote form
whenever possible. The change helps to being consistency to the
dependencies section where mostly single quotes were used, but
occasionally double quotes were required due to `${}` references.
2020-01-22 15:49:52 -08:00
Scott Frederick 288889685d Change default BootstrapMode for JPA repositories
Change the default `BootstrapMode` for auto-configured `JpaRepositories`
to `BootstrapMode.DEFERRED` to allow the initialization of
`EntityManagerFactory` to be parallelized for increased startup efficiency.

Prior to this change, the default BootstrapMode for all auto-configured
Spring Data repositories was `BootstrapMode.DEFAULT`.

Closes gh-16230
2020-01-22 10:55:51 -08:00
Phillip Webb bfd2ca7fd9 Polish Gradle expression references
Expand all expression `$` references to the full `${...}` form.
2020-01-21 18:33:33 -08:00
Scott Frederick 8f102aee68 Remove deprecated 2.2 code
See gh-19699
2020-01-16 14:44:52 +01:00
Andy Wilkinson 714a187d8f Rework dep mgmt again to avoid consumers picking up strict constraints
This paves the way for publishing Gradle module metadata once the
problem caused by snapshot versions and our two-step publication
process has been addressed.

See gh-19609
2020-01-15 12:33:18 +00:00
Andy Wilkinson aefe52e4d0 Revert "Rework dep management to avoid consumers picking up strict constraints"
This reverts commit b34a311d02 as,
having disabled the publishing of Gradle's module metadata (4f75ab5),
the changes are no longer needed.

See gh-19609
2020-01-14 12:15:53 +00:00
Phillip Webb 862462b791 Update copyright year of changed files 2020-01-13 17:04:19 -08:00
Andy Wilkinson b34a311d02 Rework dep management to avoid consumers picking up strict constraints
Previously, enforcedPlatform dependencies were using to pull in the
constraints defined in spring-boot-dependencies and
spring-boot-parent and applied them strictly so that the constrained
version had to be used. This worked as intended in Spring Boot's own
build but incorrectly enforced those same strict version requirements
on external consumers of Spring Boot's modules.

This commit reworks how Spring Boot defines its internal dependency
management so that platform dependencies are exposed to external
consumers while enforced platform dependencies are using internally.

See gh-19609
2020-01-13 19:59:56 +00:00
Stephane Nicoll f13ff3b939 Merge branch '2.2.x'
Closes gh-19686
2020-01-13 17:45:06 +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
Andy Wilkinson ce99db1902 Port the build to Gradle
Closes gh-19609
Closes gh-19608
2020-01-10 14:15:35 +00: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
Stephane Nicoll 08afbe286c Merge branch '2.1.x'
Closes gh-17580
2019-07-19 10:35:01 +02:00
Stephane Nicoll b8d92cb0ae Fix @DataJdbcTest to be transactional as advertized
Closes gh-17513
2019-07-19 10:33:59 +02:00
Stephane Nicoll 5903e9a57a Polish 2019-07-19 10:33:52 +02:00
Phillip Webb 30b5ba87ae Merge branch '2.0.x' into 2.1.x 2019-07-17 21:48:01 +01:00
Andy Wilkinson 808b373def Merge branch '2.1.x'
Closes gh-17552
2019-07-17 12:45:48 +01:00
Andy Wilkinson 9dabc0e14d Cleared deferred lines after each test
Previously, DeferredLinesWriter would collect MockMvc output from
every test that has executed. If a test eventually failed, the
output from every test up to including the one that had failed would
be output, rather than just the output for the test that has just
failed.

This commit clears the deferred lines after each test, thereby
ensuring that when a failure occurs only the lines from the failing
test are output.

Fixes gh-17551
2019-07-17 12:29:41 +01:00
Stephane Nicoll a3e94f4412 Harmonize component scan in slice tests
This commit updates ConfigurationPropertiesScanRegistrar to apply the
same component scan filters than the ones applied on standard classpath
scanning.

As a result, configuration properties scanning is automatically disabled
in slice tests and can be included by an explicit import or a dedicated
TypeFilter implementation if necessary.

Closes gh-16659
2019-07-15 15:05:12 +02:00
Phillip Webb eff1147ccc Rename classpath runner package
Remove `runner` since we're no longer tied to JUnit 4.

See gh-17491
2019-07-15 13:40:26 +01:00
Phillip Webb 1117fdb2b3 Make ModifiedClassPathExtension package private
Meta-annotate `ClassPathExclusions` and `ClassPathOverrides` with
so that the `ModifiedClassPathExtension` no longer needs to be
used directly.

See gh-17491
2019-07-15 13:38:26 +01:00
Phillip Webb 4fe5e9e31e Remove direct junit-platform-launcher dependency
Replace any direct `junit-platform-launcher` dependencies and instead
rely on the test runner providing it. Launcher related class are not
handled via reflection.

This update allows us to workaround SUREFIRE-1679.

Closes gh-17517
2019-07-15 13:35:08 +01:00
dreis2211 0f0278e69b Migrate ModifiedClassPath tests to JUnit 5
Migrate the remaining JUnit 4 tests to JUnit 5, making use of the
new `ModifiedClassPathExtension`.

See gh-17491
2019-07-15 00:31:03 +01:00
dreis2211 ca1808ecae Migrate to MockRestServiceServer
Migrate `RestClientTestWithoutJacksonIntegrationTests` to use
Spring's `MockRestServiceServer`.

See gh-17491
2019-07-15 00:26:16 +01:00
Phillip Webb 01933f9b06 Merge previously split strings
Merge some string lines that were previously split because of the
90 chars wide formatting.
2019-07-15 00:24:19 +01:00
Phillip Webb c3816bfe7b Polish output capture names 2019-07-15 00:24:18 +01:00
Phillip Webb a66c4d3096 Unify method visibility of private classes
Apply checkstyle rule to ensure that private and package private
classes do not have unnecessary public methods. Test classes have
also been unified as much as possible to use default scoped
inner-classes.

Closes gh-7316
2019-07-03 11:39:47 -07:00
Phillip Webb 605599138e Merge branch '2.1.x' 2019-06-28 23:56:02 -07:00
Phillip Webb 92bff3c328 Merge branch '2.0.x' into 2.1.x 2019-06-28 23:42:28 -07:00
Phillip Webb cfeb0239b7 Merge branch '1.5.x' into 2.0.x 2019-06-28 23:28:34 -07:00
Phillip Webb c62b6b4ccd Merge branch '2.1.x' 2019-06-28 12:22:45 -07:00
Phillip Webb de35efd1ef Merge branch '2.0.x' into 2.1.x 2019-06-28 12:21:57 -07:00
Phillip Webb bb34846630 Merge branch '1.5.x' into 2.0.x 2019-06-28 12:19:46 -07:00
Stephane Nicoll e560b7f6ba Remove public modifier on JUnit5 lifecycle methods
See gh-17292
2019-06-21 18:09:05 +02:00
Andy Wilkinson a189e4cf96 Merge branch '2.1.x'
Closes gh-17220
2019-06-17 14:05:16 +01:00
Andy Wilkinson 645514f848 Polish "Honour base path from @WebAppConfiguration in @WebMvcTest"
See gh-16485
2019-06-17 13:54:41 +01:00
Lorenzo Dee 7340d546b8 Honour base path from @WebAppConfiguration in @WebMvcTest
See gh-16485
2019-06-17 13:37:55 +01:00
Andy Wilkinson 78f51a490c Merge branch '2.1.x'
Closes gh-17213
2019-06-17 10:59:16 +01:00
Andy Wilkinson c2a4a3f630 Polish "Auto-configure caching in jOOQ sliced tests"
See gh-17066
2019-06-17 10:55:35 +01:00
Dmytro Nosan 4701d8f82a Auto-configure caching in jOOQ sliced tests
See gh-17066
2019-06-17 10:55:35 +01:00
Phillip Webb b3d5cd538d Add JUnit 5 checkstyle rules
Add a rule to enforce JUnit 5 usage and conventions.

Closes gh-17093
2019-06-10 16:16:45 -07:00
Andy Wilkinson b18fffaf14 Move tests to JUnit 5 wherever possible 2019-06-07 12:25:54 +01:00
Andy Wilkinson aef92b9295 Merge branch '2.1.x'
Closes gh-17079
2019-06-07 11:00:44 +01:00
Andy Wilkinson 24925c3dae Merge branch '2.0.x' into 2.1.x
Closes gh-17078
2019-06-07 10:50:34 +01:00
Andy Wilkinson c6c139d980 Merge branch '1.5.x' into 2.0.x 2019-06-07 10:46:31 +01:00
Phillip Webb d306b31ce9 Merge branch '2.1.x' 2019-06-04 02:08:00 -07:00
Phillip Webb ccfbd03482 Merge branch '2.0.x' into 2.1.x 2019-06-04 02:07:14 -07:00
Phillip Webb 5fba43aa31 Merge branch '1.5.x' into 2.0.x 2019-06-04 00:05:57 -07:00
fidel 2ec0996a6f Fix typo in javadoc
See gh-17044
2019-06-02 09:54:11 +02:00
Phillip Webb 0fcc561163 Update copyright header of changed files 2019-05-31 22:41:00 -07:00
Andy Wilkinson 0644a79401 Repackage output capture and always use extension declaratively
Closes gh-17029
2019-05-31 18:33:10 +01:00
Phillip Webb ad5e905bd7 Update copyright header of changed files 2019-05-30 11:30:43 -07:00
Phillip Webb 68aec8b6ee Polish 2019-05-30 11:30:27 -07:00
Andy Wilkinson 080a2f5c3b Align with Framework’s removal of charset attribute from application/json
Closes gh-16979
2019-05-28 10:58:23 +01:00
Andy Wilkinson 23f803c6b6 Upgrade to Hamcrest 2.1, switch to hamcrest artifact from -core and -library
Closes gh-15555
2019-05-22 14:50:15 +01:00
Johnny Lim 652906ec7c Use MergedAnnotation.getRoot() in PropertyMappingCheckBeanPostProcessor
Closes gh-16745
2019-05-21 09:26:27 +02:00
Phillip Webb 3a9ca5fa30 Update copyright header of changed files 2019-05-14 21:05:53 -07:00