Previously building with JDK > 1.8 b88 caused test failures due to errors
with custom compilers like Jibx and Jasper reports.
This commit adds a new TestGroup named CUSTOM_COMPILATION that allows the
CI server to continue to run these tests but allow committers to ignore
these tests.
Add ByteBufferConverter that is registered by default with the
DefaultConversionService. Allows conversion from/to a ByteBuffer and
byte[] or to any type that can be converted via a byte[].
Issue: SPR-10712
Prior to this commit the Spring Framework did not provide a public means
for scanning for available server ports. However, the Spring Framework
internally used a FreePortScanner in integration tests within its own
test suite. Furthermore, Spring Integration 2.2 provides similar support
in a SocketUtils class in the spring-integration-test module.
This commit introduces SocketUtils in spring-core to replace the
FreePortScanner which was previously only used internally within
Spring's test suite. This new implementation is inspired by both Spring
Framework's FreePortScanner and Spring Integration's SocketUtils and
consequently attempts to merge the best of both previous
implementations.
Issue: SPR-8032
Develop new org.springframework.core.io.Resource implementation
backed by java.nio.file.Path. Primarily developed to allow custom
file system implementations to be used with Spring.
Since the minimum requirement for Spring is still Java 6 the
existing FileSystemResource can't be retrofitted (and no #getPath
method can be added to the Resource interface).
Unlike FileSystemResource, PathResource delegates to the underlying
file system instead of StringUtils. It has therefore slightly
different semantics. First, when building relative resources via
createRelative the relative path will apply to this path (like URL or
Unix). Second, equality is delegated to the underlying file system
provider so it's case-insensitive on Windows.
Issue: SPR-10608
JOpt 4.4 has enumerable options, so this change can be made
if we upgrade. The only awkward thing is that JOpt allows
aliases for options, so we have to pick one to avoid double
counting. This implementation picks the last one in the list
which is the alphebtically last of the long options, if there
are any (e.g. "o1", "option1" returns "option1"). Most of the
time there will only be one or two aliases for each option so
it won't matter.
Issue: SPR-10579
Update AnnotationMetadata and MethodMetadata to extend from a new
AnnotatedTypeMetadata base interface containing the methods that are
common to both. Also introduce new getAllAnnotationAttributes methods
providing MultiValueMap access to both annotation and meta-annotation
attributes.
Existing classreading and standard implementations have been
refactored to support the new interface.
Add temporary Assume.canLoadNativeDirFonts() method allowing failing
jasper report tests to be bypassed on OSX.
This should be revisited when JDK 8 is released.
Issue: SPR-10537
Specifically, we need to avoid "... ? this.method : this.constructor" expressions since those potentially select java.lang.reflect.Executable (which is only available on JDK 8) as common type and hardcode this into the generated bytecode (which therefore becomes JDK 8 dependent).
Aiming for the JdkVersion class to support one generation ahead now, in order for the test suite to properly detect 1.7/1.8+ JVMs even when running against a JDK 1.9 preview at some point.
ASM has been patched to accept 1.8 bytecode simply through removing an assertion. As a consequence, we have an embedded copy of the ASM sources now instead of jarjar'ing the original ASM jar. The sources originate from ASM 4.1; for CGLIB 3.0 compatibility, a further assertion has been removed.
Issue: SPR-9639
In particular, avoid accidental usage of ASM for core JDK types - which will fail in case of a new bytecode version in the JDK, even if the application itself has been compiled with an earlier bytecode target.
Issue: SPR-10292
Prior to this commit the Spring TestContext Framework supported creating
only flat, non-hierarchical contexts. There was no easy way to create
contexts with parent-child relationships.
This commit addresses this issue by introducing a new @ContextHierarchy
annotation that can be used in conjunction with @ContextConfiguration
for declaring hierarchies of application contexts, either within a
single test class or within a test class hierarchy. In addition,
@DirtiesContext now supports a new 'hierarchyMode' attribute for
controlling context cache clearing for context hierarchies.
- Introduced a new @ContextHierarchy annotation.
- Introduced 'name' attribute in @ContextConfiguration.
- Introduced 'name' property in ContextConfigurationAttributes.
- TestContext is now aware of @ContextHierarchy in addition to
@ContextConfiguration.
- Introduced findAnnotationDeclaringClassForTypes() in AnnotationUtils.
- Introduced resolveContextHierarchyAttributes() in ContextLoaderUtils.
- Introduced buildContextHierarchyMap() in ContextLoaderUtils.
- @ContextConfiguration and @ContextHierarchy may not be used as
top-level, class-level annotations simultaneously.
- Introduced reference to the parent configuration in
MergedContextConfiguration and WebMergedContextConfiguration.
- Introduced overloaded buildMergedContextConfiguration() methods in
ContextLoaderUtils in order to handle context hierarchies separately
from conventional, non-hierarchical contexts.
- Introduced hashCode() and equals() in ContextConfigurationAttributes.
- ContextLoaderUtils ensures uniqueness of @ContextConfiguration
elements within a single @ContextHierarchy declaration.
- Introduced CacheAwareContextLoaderDelegate that can be used for
loading contexts with transparent support for interacting with the
context cache -- for example, for retrieving the parent application
context in a context hierarchy.
- TestContext now delegates to CacheAwareContextLoaderDelegate for
loading contexts.
- Introduced getParentApplicationContext() in MergedContextConfiguration
- The loadContext(MergedContextConfiguration) methods in
AbstractGenericContextLoader and AbstractGenericWebContextLoader now
set the parent context as appropriate.
- Introduced 'hierarchyMode' attribute in @DirtiesContext with a
corresponding HierarchyMode enum that defines EXHAUSTIVE and
CURRENT_LEVEL cache removal modes.
- ContextCache now internally tracks the relationships between contexts
that make up a context hierarchy. Furthermore, when a context is
removed, if it is part of a context hierarchy all corresponding
contexts will be removed from the cache according to the supplied
HierarchyMode.
- AbstractGenericWebContextLoader will set a loaded context as the
ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE in the MockServletContext when
context hierarchies are used if the context has no parent or if the
context has a parent that is not a WAC.
- Where appropriate, updated Javadoc to refer to the
ServletTestExecutionListener, which was introduced in 3.2.0.
- Updated Javadoc to avoid and/or suppress warnings in spring-test.
- Suppressed remaining warnings in code in spring-test.
Issue: SPR-5613, SPR-9863
Before this fix AntPathMatcher had a special rule for combining
patterns with wildcards and extensions as follows:
"/*.*" + "/*.html" => "/*.html"
This change ensures this rule never applies if the first pattern
contains URI variables.
Issue: SPR-10062
This commit introduces TestGroup#JMXMP and adds assumptions to related
tests accordingly. These tests require the jmxoptional_remote jar on the
classpath, and are run nightly in the SPR-PERF build.
Issue: SPR-8089
Update StringToEnumConverterFactory to search superclasses until
Class.isEnum() returns true. This allows conversion when the
enum class is obtained from the enum value:
public static enum SubFoo {
BAR { String s() { return "x"; } };
abstract String s();
}
conversionService.convert("BAR", SubFoo.BAR.getClass())
This fix is particularly important when converting collections of
enums.
Issue: SPR-10329
Prior to this commit several HTTP classes made use of FileCopyUtils
when reading from or writing to streams. This has the unfortunate
side effect of closing streams that should really be left open.
The problem is particularly noticeable when dealing with a
FormHttpMessageConverter that is writing a multi-part response.
Relevant HTTP classes have now been refactored to make use of a new
StreamUtils class that works in a similar way FileCopyUtils but does
not close streams.
The NonClosingOutputStream class from SimpleStreamingClientHttpRequest
has also been refactored to a StreamUtils method.
Issue: SPR-10095