Commit Graph

19586 Commits

Author SHA1 Message Date
Sam Brannen 8f38f5c17a Polishing 2019-09-12 11:35:30 +02:00
Sam Brannen 30cff46e7f Prevent improper use of testing framework APIs
Prior to this commit, a lot of work had been done to prevent improper
use of testing Framework APIs throughout the codebase; however, there
were still some loopholes.

This commit addresses these loopholes by introducing additional
Checkstyle rules (and modifying existing rules) to prevent improper use
of testing framework APIs in production code as well as in test code.

- Checkstyle rules for banned imports have been refactored into
  multiple rules specific to JUnit 3, JUnit 4, JUnit Jupiter, and
  TestNG.
- Accidental usage of org.junit.Assume has been switched to
  org.junit.jupiter.api.Assumptions.
- All test classes now reside under org.springframework packages.
- All test classes (including abstract test classes) now conform to the
  `*Tests` naming convention.
  - As an added bonus, tests in the renamed
    ScenariosForSpringSecurityExpressionTests are now included in the
    build.
- Dead JUnit 4 parameterized code has been removed from
  DefaultServerWebExchangeCheckNotModifiedTests.

Closes gh-22962
2019-09-12 11:20:56 +02:00
Stephane Nicoll 92d3f7e7d7 Merge pull request #23620 from wilkinsona
* pr/23620:
  Enable parallel builds by default

Closes gh-23620
2019-09-12 09:48:50 +02:00
Andy Wilkinson 9de4c4aefb Enable parallel builds by default
Previously, all tasks in the build were run sequentially. This
commit updates Gradle's properties to build them in parallel where
possible. When using the daemon (recommended) its default max heap is
not sufficient for the demands on a parallel build, therefore this
commit also increases the daemon's max heap.

See gh-23620
2019-09-12 09:48:45 +02:00
Rossen Stoyanchev cfae20f97d
Update advice on creating issue vs pull request
Closes gh-23427
2019-09-11 16:16:41 +01:00
Andy Wilkinson 2b4316cf24 Upgrade to com.gradle.build-scan 2.4.2
Closes gh-23619
2019-09-11 15:36:19 +02:00
Sam Brannen d759ae772b Rename Spr3896SuiteTests to Spr3896TestSuite
This commit renames Spr3896SuiteTests to comply with our naming
convention for test classes that should be executed via the Gradle
build.

The effect of this commit is that test classes included in that "suite"
are no longer executed twice in the build. Consequently, Gradle and
Bamboo will now report the same number of executed tests for the
spring-test project.
2019-09-11 13:21:19 +02:00
Arjen Poutsma 13ba7ef701 Merge branch '5.1.x' 2019-09-11 10:43:43 +02:00
Arjen Poutsma b159ef6019 Make MockClientHttpResponse uses raw status code
This commit make sure that MockClientHttpResponse does not use
HttpStatus, but the raw status code.

Closes gh-23599
2019-09-11 10:41:01 +02:00
Andy Wilkinson b730597c87 Disable caching of changing modules and dynamic versions
Previously, changing modules (snapshots) and dynamic versions were
cached for Gradle's default period of 24 hours and
--refresh-dependencies was used to pick up the latest artifacts. This
approach has a notable downside. --refresh-dependencies causes all
dependencies to be refreshed, irrespective of whether they are
expected to change. At a minimum, this results in a HEAD request for
every dependency in the build. Running an up-to-date build without
--refresh-dependencies takes in the region of 6 seconds:

$ ./gradlew build

BUILD SUCCESSFUL in 6s
203 actionable tasks: 203 up-to-date

The same build with --refresh-dependencies takes almost ten times as
long:

$ ./gradlew build --refresh-dependencies

BUILD SUCCESSFUL in 58s
203 actionable tasks: 203 up-to-date

This commit replaces the manual usage of --refresh-dependencies on
the command line with a 0 second caching period for changing modules
and dynamic versions. This should remove the need to use
--refresh-dependencies both locally and on CI, saving almost 1 minute
per full build.
2019-09-11 10:00:01 +02:00
Sam Brannen 333711fd36 Convert XmlValidationModeDetectorTests to JUnit Jupiter and AssertJ
See gh-23605
2019-09-09 16:29:00 +02:00
Sam Brannen 22c88d7126 Merge branch '5.1.x' 2019-09-09 16:25:20 +02:00
Sam Brannen 961010055e Support trailing comment in DTD declaration in XML config
Prior to this commit, Spring failed to determine that an XML config file
was DTD-based if the DTD declaration was followed by a comment.

This commit fixes this by modifying the consumeCommentTokens(String)
algorithm in XmlValidationModeDetector so that both leading and trailing
comments are properly consumed without losing any XML content.

Closes gh-23605
2019-09-09 16:18:21 +02:00
Sam Brannen 604eecaf67 Upgrade to JUnit 5.5.2
This commit also removes the testRuntime dependency on Hamcrest which
was a workaround for https://github.com/junit-team/junit5/issues/2004.

Closes gh-23604
2019-09-09 14:20:56 +02:00
Sebastien Deleuze 5bb8c47b14 Rename fromObject to fromValue in BodyInserters
Closes gh-23587
2019-09-09 00:08:55 +02:00
Sam Brannen 665e8aa51c Downgrade to JUnit 4.12
Since it does not appear that JUnit 4.13 will be released before Spring
Framework 5.2 GA, I am reverting back to JUnit 4.12 for the time being.

See gh-22894
2019-09-08 15:22:21 +02:00
Sam Brannen 683fe9ed70 Update comment
See gh-23604
2019-09-08 15:15:30 +02:00
康智冬 0d742cf3d0 Fix typos related to indefinite articles for SQL acronym
Closes gh-23603
2019-09-07 16:04:47 +02:00
Andy Wilkinson df7e4ad023 Tweak detection of Bamboo
When exposed as an environment variable Bamboo's bamboo.resultsUrl
is mapped to bamboo_resultsUrl. This commit updates the build scan
user data script to look for the latter rather than the former.

Closes gh-23597
2019-09-06 19:18:46 +02:00
Sam Brannen d817b591e5 Revert "Tweak detection of Bamboo (#23597)"
This reverts commit 35567678ef, reversing
changes made to 807e1d3367.
2019-09-06 19:16:59 +02:00
Sam Brannen 35567678ef
Tweak detection of Bamboo (#23597)
When exposed as an environment variable Bamboo's bamboo.resultsUrl
is mapped to bamboo_resultsUrl. This commit updates the build scan
user data script to look for the latter rather than the former.
2019-09-06 17:18:10 +02:00
Sam Brannen 807e1d3367 Upgrade to Gradle 5.6.2
See gh-23479
2019-09-06 16:09:01 +02:00
Sam Brannen 5d5f9aceca Avoid accidental usage of JUnit 4 assumptions
This commit also avoids starting a server if an assumption fails.
2019-09-06 16:03:36 +02:00
Sam Brannen 591995ecc8 Polish and revive disabled tests
This commit revives some previously disabled tests and converts
some usage of @Disabled to @EnabledForTestGroups(...).
2019-09-06 15:57:27 +02:00
Andy Wilkinson fcda0fb8d9 Tweak detection of Bamboo
When exposed as an environment variable Bamboo's bamboo.resultsUrl
is mapped to bamboo_resultsUrl. This commit updates the build scan
user data script to look for the latter rather than the former.
2019-09-06 10:08:35 +01:00
Andy Wilkinson 35b967a801 Add opt-in build scan integration with Gradle Enterprise
This commit adds opt-in build scan integration with Gradle Enterprise.
When the GRADLE_ENTERPRISE_URL environment variable is set on a
developer's machine or on CI, a build scan will be automatically
uploaded to Gradle Enterprise at the end of the build.

This initial integration will establish a baseline for Spring
Framework builds. Once that baseline has been established we can use
the build scans to identify ways in which the build can be optimized
and updated to make use of Gradle's build caching which should reduce
build times, significantly so for changes that only affect tasks near
the leaf nodes of the task graph.
2019-09-05 15:16:59 +01:00
Sam Brannen 2b1ae4af60 Remove obsolete Checkstyle suppression entries 2019-09-05 15:54:55 +02:00
Sam Brannen 760f7bed03 Merge branch '5.1.x' 2019-09-05 15:18:43 +02:00
Sebastien Deleuze aa81fdc66f Upgrade to Kotlin Coroutines 1.3.1 2019-09-05 15:09:17 +02:00
Sam Brannen a7aecbb4dc Ensure spring-test test tasks are UP-TO-DATE
See also: 69214429df and eec183ef28
2019-09-05 15:06:12 +02:00
Stephane Nicoll 9afe17a29b Fix static imports handling in IntelliJ IDEA configuration
Closes gh-23588
2019-09-05 14:35:54 +02:00
Sam Brannen 99d88ba14e Document minimum JDK 8 update version
Closes gh-23563
2019-09-05 14:04:43 +02:00
Sam Brannen ef50777535 Polishing 2019-09-05 13:45:38 +02:00
Sam Brannen d9e3b8b9a5 Introduce default constructor in TomcatHttpServer 2019-09-05 13:45:38 +02:00
Sebastien Deleuze 40a55b412d Rename BodyBuilder#bodyAndAwait to bodyValueAndAwait 2019-09-05 13:34:11 +02:00
Sam Brannen 73f5d05fd9 Avoid deprecation warning in RandomHandlerIntegrationTests 2019-09-05 13:29:01 +02:00
Sam Brannen c80705a708 Polishing 2019-09-05 13:20:20 +02:00
Sam Brannen ce178f76eb Add missing Temporal tests in BeanUtilsTests
This change will help to serve as a regression test.
2019-09-05 13:14:39 +02:00
Stephane Nicoll facdbdb7b6 Fix checkstyle violation 2019-09-05 09:18:43 +02:00
Phillip Webb 6fbd4841ec Update checkstyle import rule
Update the checkstyle rule to enforce the blank line between `java`
and `javax`.

Closes gh-23539
2019-09-04 22:06:46 -07:00
Phillip Webb deba2ed1b3 Add blank line between java and javax imports
See gh-23539
2019-09-04 22:05:46 -07:00
Phillip Webb 2f106fbb32 Polishing web socket test to use BDD Mockito 2019-09-04 22:05:13 -07:00
Rossen Stoyanchev bc81fa520e Reject range starting above resource length
Closes: gh-23576
2019-09-04 18:05:59 +01:00
Sebastien Deleuze 70bbe71235 Polishing
See gh-22915
2019-09-04 18:24:35 +02:00
Sebastien Deleuze ff271894fe Detect unsupported suspending handler methods in Spring MVC
closes gh-23585
2019-09-04 18:24:35 +02:00
Sam Brannen f54395b261 Polish BeanUtilsTests 2019-09-04 16:53:29 +02:00
Sam Brannen 803643559a Merge branch '5.1.x' 2019-09-04 16:24:44 +02:00
Brian Clozel 0c7359911a Re-enable StreamingSimpleClientHttpRequestFactoryTests
Since the okhttp3 3.14 downgrade, we don't need to ignore this test
anymore.
2019-09-04 16:02:43 +02:00
Sam Brannen d036b5a283 Do not treat void and Void as simple types in BeanUtils
Prior to this commit, the isSimpleProperty() and isSimpleValueType()
methods in BeanUtils treated void and Void as simple types; however,
doing so does not make sense in this context, since void implies the
lack of a property or value.

This commit addresses this by explicitly excluding void and Void in the
logic in isSimpleValueType().

This commit also simplifies the implementation of
ViewResolutionResultHandler.supports(HandlerResult) to take advantage
of this change.

Closes gh-23573
2019-09-04 15:48:40 +02:00
Brian Clozel cccd9c8bb0 Fix okhttp3 downgrade 2019-09-04 15:07:17 +02:00