Commit Graph

2005 Commits

Author SHA1 Message Date
Sam Brannen dc0f0c77c9 Merge branch '5.3.x' 2022-07-12 13:05:24 +02:00
Sam Brannen 31a9694fc8 Improve Javadoc for ContextCache#clearStatistics()
See gh-28795
2022-07-12 13:04:34 +02:00
Marc Wrobel 92b8e99cbc Fix and improve Javadoc in spring-test
Closes gh-28795
2022-07-12 12:55:59 +02:00
Sam Brannen 2af08cf163 Merge branch '5.3.x'
# Conflicts:
#	spring-core/src/test/java/org/springframework/core/annotation/TypeMappedAnnotationTests.java
#	spring-test/src/test/java/org/springframework/test/context/junit4/TimedSpringRunnerTests.java
#	spring-test/src/test/java/org/springframework/test/util/MetaAnnotationUtilsTests.java
#	spring-test/src/test/java/org/springframework/test/util/OverriddenMetaAnnotationAttributesTests.java
2022-07-09 16:24:04 +02:00
Sam Brannen d274e893a6 Remove superfluous static declaration for enum, annotation, & interface 2022-07-09 16:16:13 +02:00
Sam Brannen 0beee7dc69 Stop using convention-based attribute overrides in tests in spring-test and spring-mvc
See gh-28760
2022-07-06 14:01:28 +02:00
Sam Brannen 033d9d09e4 Merge branch '5.3.x' 2022-06-30 16:56:43 +02:00
Sam Brannen 9ea45697ac Support cookie comments in MockHttpServletResponse and MockCookie
Prior to this commit, if a cookie was added to MockHttpServletResponse,
the comment attribute was not included in the generated Set-Cookie
header. In addition, MockCookie.parse(String) did not support the
Comment attribute.

This commit addresses both of these issues.

Closes gh-28730
2022-06-30 16:51:43 +02:00
rstoyanchev b312eca391 Deprecate and set trailingSlash option to false
Closes gh-28552
2022-06-29 16:09:10 +01:00
rstoyanchev 14fd2605a3 Deprecate UrlPathHelper shortcuts on AbstractHandlerMapping
Given the availability of two alternatives mechanisms for URL path
matching, PathPatternParser and AntPathMatcher, and now that
parsed patterns are enabled by default, it makes sense to reduce the
proliferation of options on AbstractHandlerMapping by deprecating
shortcuts related to String path matching. Most applications rely
on Boot and on the MVC config to do all this.

See gh-28607
2022-06-29 13:04:22 +01:00
rstoyanchev 92cf1e13e8 Enable use of parsed patterns by default in Spring MVC
Closes gh-28607
2022-06-29 10:17:27 +01:00
rstoyanchev 8a9b082d8a Improve MappingMatch determination in mock request
MockHttpServletRequest now checks the requestURI and servletPath to
check whether they imply a Servlet path mapping, which is the case
when the requestURI is longer than the contextPath + servletPath.

This is essential when parsed patterns are in use in which case the
request path is parsed taking into account only the requestURI and
the contextPath. However, if the MappingMatch indicates a match by
Servlet path, then the servletPath is also taken into account.

See gh-28607
2022-06-29 10:17:07 +01:00
rstoyanchev 9c2ad4a1b1 Improve forwarded URL support in HtmlUnit integration
Closes gh-28722
2022-06-29 10:16:45 +01:00
Sam Brannen 730d6c95fc Merge branch '5.3.x'
# Conflicts:
#	spring-core/src/main/java/org/springframework/core/annotation/TypeMappedAnnotation.java
2022-06-25 20:14:27 +02:00
Sam Brannen d6768ccc18 Ensure meta-annotations are not unnecessarily synthesized
Prior to this commit, meta-annotations were unnecessarily synthesized
when attempting to synthesize a MergedAnnotation retrieved via the
MergedAnnotations.from(AnnotatedElement, ...).get(<annotationType>) API.

This is a regression in our merged annotation support that was
introduced when the MergedAnnotations API replaced our previous support.

This commit fixes this by revising the logic in TypeMappedAnnotation's
createSynthesizedAnnotation() method so that a meta-annotation is
returned unmodified if it is not synthesizable.

This commit also updates BootstrapUtilsTests, since @BootstrapWith
should never have been synthesized, and Class#getCanonicalName() is
only used in the toString() implementation of an annotation synthesized
by Spring or normal annotations on Java 19+ (see
https://bugs.openjdk.org/browse/JDK-8281462).

Closes gh-28704
2022-06-25 20:02:04 +02:00
Sam Brannen 661996471e Polishing 2022-06-25 19:24:51 +02:00
Sam Brannen d1b65f6d3e Stop using SpringFactoriesLoader.loadFactoryNames() in spring-test
Since SpringFactoriesLoader.loadFactoryNames() will be deprecated in
gh-27954, this commit removes the use of it in the spring-test module.

Specifically, this commit removes the protected
getDefaultTestExecutionListenerClasses() and
getDefaultTestExecutionListenerClassNames() methods from
AbstractTestContextBootstrapper and replaces them with a new protected
getDefaultTestExecutionListeners() method that makes use of new APIs
introduced in SpringFactoriesLoader for 6.0.

Third-party subclasses of AbstractTestContextBootstrapper that have
overridden or used getDefaultTestExecutionListenerClasses() or
getDefaultTestExecutionListenerClassNames() will therefore need to
migrate to getDefaultTestExecutionListeners() in Spring Framework 6.0.

Closes gh-28666
2022-06-24 20:03:50 +02:00
Sam Brannen b5c0c6d53d Merge branch '5.3.x'
# Conflicts:
#	spring-test/src/main/java/org/springframework/test/web/servlet/request/MockMvcRequestBuilders.java
2022-06-15 15:12:34 +02:00
Sam Brannen fb1fa073a6 Polishing 2022-06-15 15:07:58 +02:00
Sam Brannen e9806a96dc Polish contribution and introduce test
See gh-28631
2022-06-15 15:07:58 +02:00
Johnny Lim 9b93508374 Add MockMvcRequestBuilders.multipart(HttpMethod, String, Object...)
See gh-28545
Closes gh-28631
2022-06-15 14:09:59 +02:00
rstoyanchev 875ee546e5 Merge branch '5.3.x' 2022-06-08 10:43:36 +01:00
rstoyanchev 7c47b470ff MockMvc allows HttpMethod input for multipart request
Closes gh-28545
2022-06-08 10:07:52 +01:00
Sam Brannen 90e0bd146a Merge branch '5.3.x'
# Conflicts:
#	spring-test/src/main/java/org/springframework/test/context/ContextConfiguration.java
#	spring-test/src/main/java/org/springframework/test/context/TestPropertySource.java
#	spring-test/src/main/java/org/springframework/test/context/jdbc/Sql.java
#	spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java
2022-06-08 10:01:01 +02:00
Sam Brannen 479ef3f3fd Update documentation regarding nested test class support
Closes gh-28579
2022-06-08 09:52:42 +02:00
Sam Brannen ee209de9cf Merge branch '5.3.x'
# Conflicts:
#	spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java
#	spring-context/src/test/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptorTests.java
#	spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptorTests.java
#	spring-web/src/test/java/org/springframework/remoting/jaxws/JaxWsSupportTests.java
#	spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ViewResolutionIntegrationTests.java
2022-05-31 14:15:36 +02:00
Sam Brannen 1beb7068f6 Use new AssertJ exception assertions 2022-05-31 14:08:28 +02:00
Sam Brannen 720261db26 Use List.of() and Set.of() where feasible 2022-05-30 18:42:48 +02:00
Sam Brannen b629487b44 Polish Javadoc for MockFilterChain 2022-05-30 18:41:25 +02:00
Sam Brannen bf8a54decf Switch focus to JUnit Jupiter in testing examples 2022-05-16 10:05:37 +02:00
Sam Brannen 5220410768 Update copyright date 2022-05-15 19:19:04 +02:00
Eddú Meléndez Gonzales 506b78f469
Use getHost instead of getContainerIpAddress in Redis examples
getContainerIpAddress is deprecated.

Closes gh-28461
2022-05-15 15:12:03 +02:00
Sam Brannen eb50a6f4a0 Further polishing regarding JDK baseline upgrade
See gh-28440
2022-05-10 17:01:40 +02:00
Sam Brannen 91441ba653 Update copyright date 2022-05-09 20:27:32 +02:00
CharlieYu 432fce9db3
Polish Javadoc and inline comments
Closes gh-28426
2022-05-09 20:26:06 +02:00
rstoyanchev 8378af9e39 Polishing
See gh-28189
2022-05-09 19:01:10 +01:00
Sam Brannen 437b35b336 Merge branch '5.3.x' 2022-05-03 12:15:45 +02:00
Sam Brannen afa799b4f0 Suppress warning in test 2022-05-03 11:46:47 +02:00
rstoyanchev b4e6014a14 Merge branch '5.3.x' into main 2022-04-28 11:40:11 +01:00
rstoyanchev f0d149b330 Polishing contribution
Closes gh-27830
2022-04-28 11:26:50 +01:00
binchoo caaf83b8e6 Add tests for binding to a Part field
See gh-27830
2022-04-28 10:45:09 +01:00
Sam Brannen e90225336a Use JPA from Jakarta 2022-03-27 17:01:26 +02:00
Sam Brannen 5eff9f8d7e Merge branch '5.3.x' 2022-03-27 16:53:31 +02:00
Sam Brannen 1d302bf384 Introduce tests for gh-28228 2022-03-27 16:29:45 +02:00
Sam Brannen 1fe394f11d Introduce predicate for searching enclosing classes in MergedAnnotations
Due to the deprecation of the TYPE_HIERARCHY_AND_ENCLOSING_CLASSES
search strategy (see gh-28079), this commit introduces a way for users
to provide a Predicate<Class<?>> that is used to decide when the
enclosing class for the class supplied to the predicate should be
searched.

This gives the user complete control over the "enclosing classes"
aspect of the search algorithm in MergedAnnotations.

- To achieve the same behavior as TYPE_HIERARCHY_AND_ENCLOSING_CLASSES,
  a user can provide `clazz -> true` as the predicate.

- To limit the enclosing class search to inner classes, a user can
  provide `ClassUtils::isInnerClass` as the predicate.

- To limit the enclosing class search to static nested classes, a user
  can provide `ClassUtils::isStaticClass` as the predicate.

- For more advanced use cases, the user can provide a custom predicate.

For example, the following performs a search on MyInnerClass within the
entire type hierarchy and enclosing class hierarchy of that class.

MergedAnnotations mergedAnnotations =
   MergedAnnotations.search(TYPE_HIERARCHY)
      .withEnclosingClasses(ClassUtils::isInnerClass)
      .from(MyInnerClass.class);

In addition, TestContextAnnotationUtils in spring-test has been
revised to use this new feature where feasible.

Closes gh-28207
2022-03-24 15:40:44 +01:00
Arjen Poutsma 28ac0d3883 Use HttpStatusCode interface
This commit contains changes made because of the introduction of
HttpStatusCode. In general, methods that used to return a HttpStatus
now return HttpStatusCode instead, and methods that returned raw status
codes are now deprecated.

See gh-28214
2022-03-23 12:49:38 +01:00
Sam Brannen 9764f0e59b Merge branch '5.3.x'
# Conflicts:
#	spring-test/src/test/java/org/springframework/mock/http/server/reactive/MockServerHttpRequestTests.java
#	spring-web/src/test/java/org/springframework/http/server/reactive/HeadersAdaptersTests.java
#	spring-web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java
#	spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientIntegrationTests.java
#	spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java
#	spring-webmvc/src/test/java/org/springframework/web/servlet/handler/MappedInterceptorTests.java
#	spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/HandlerMethodAnnotationDetectionTests.java
#	spring-websocket/src/test/java/org/springframework/web/socket/AbstractWebSocketIntegrationTests.java
2022-03-16 15:07:53 +01:00
Sam Brannen c462fe30ed Use Named arguments in parameterized tests 2022-03-16 14:45:47 +01:00
rstoyanchev e7b97f5be7 Merge branch '5.3.x' into main 2022-03-16 09:27:43 +00:00
rstoyanchev ee7f60000e Polishing contribution
Closes gh-28105
2022-03-16 05:56:47 +00:00