Merge branch '6.0.x'
This commit is contained in:
commit
d1867f1b73
|
|
@ -156,12 +156,10 @@ public class FilePatternResourceHintsRegistrar {
|
||||||
|
|
||||||
private final List<String> fileExtensions = new ArrayList<>();
|
private final List<String> fileExtensions = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
private Builder() {
|
private Builder() {
|
||||||
// no-op
|
// no-op
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Consider the specified classpath locations.
|
* Consider the specified classpath locations.
|
||||||
* <p>A location can either be a special {@value ResourceUtils#CLASSPATH_URL_PREFIX}
|
* <p>A location can either be a special {@value ResourceUtils#CLASSPATH_URL_PREFIX}
|
||||||
|
|
@ -254,7 +252,6 @@ public class FilePatternResourceHintsRegistrar {
|
||||||
public void registerHints(ResourceHints hints, @Nullable ClassLoader classLoader) {
|
public void registerHints(ResourceHints hints, @Nullable ClassLoader classLoader) {
|
||||||
build().registerHints(hints, classLoader);
|
build().registerHints(hints, classLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,9 +120,9 @@ class ClassPathResourceTests {
|
||||||
Resource relative = resource.createRelative("subdir");
|
Resource relative = resource.createRelative("subdir");
|
||||||
assertThat(relative).isEqualTo(new ClassPathResource("dir/subdir"));
|
assertThat(relative).isEqualTo(new ClassPathResource("dir/subdir"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class GetInputStream {
|
class GetInputStream {
|
||||||
|
|
||||||
|
|
@ -151,9 +151,9 @@ class ClassPathResourceTests {
|
||||||
.isThrownBy(resource::getInputStream)
|
.isThrownBy(resource::getInputStream)
|
||||||
.withMessageContaining(ABSOLUTE_PATH_TO_NONEXISTENT_RESOURCE);
|
.withMessageContaining(ABSOLUTE_PATH_TO_NONEXISTENT_RESOURCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class GetDescription {
|
class GetDescription {
|
||||||
|
|
||||||
|
|
@ -190,9 +190,9 @@ class ClassPathResourceTests {
|
||||||
private static void assertDescription(ClassPathResource resource) {
|
private static void assertDescription(ClassPathResource resource) {
|
||||||
assertThat(resource.getDescription()).isEqualTo("class path resource [%s]", ABSOLUTE_PATH_TO_NONEXISTENT_RESOURCE);
|
assertThat(resource.getDescription()).isEqualTo("class path resource [%s]", ABSOLUTE_PATH_TO_NONEXISTENT_RESOURCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class GetPath {
|
class GetPath {
|
||||||
|
|
||||||
|
|
@ -209,9 +209,9 @@ class ClassPathResourceTests {
|
||||||
assertThat(((ClassPathResource) new ClassPathResource("", getClass()).createRelative("/test.html")).getPath()).isEqualTo("test.html");
|
assertThat(((ClassPathResource) new ClassPathResource("", getClass()).createRelative("/test.html")).getPath()).isEqualTo("test.html");
|
||||||
assertThat(((ClassPathResource) new ClassPathResource("", getClass()).createRelative("test.html")).getPath()).isEqualTo(PACKAGE_PATH + "/test.html");
|
assertThat(((ClassPathResource) new ClassPathResource("", getClass()).createRelative("test.html")).getPath()).isEqualTo(PACKAGE_PATH + "/test.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void directoryNotReadable() throws Exception {
|
void directoryNotReadable() throws Exception {
|
||||||
Resource fileDir = new ClassPathResource("example/type");
|
Resource fileDir = new ClassPathResource("example/type");
|
||||||
|
|
|
||||||
|
|
@ -174,9 +174,9 @@ class ResourceTests {
|
||||||
Resource resource = new ByteArrayResource("testString".getBytes(), "my description");
|
Resource resource = new ByteArrayResource("testString".getBytes(), "my description");
|
||||||
assertThat(resource.getDescription().contains("my description")).isTrue();
|
assertThat(resource.getDescription().contains("my description")).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class InputStreamResourceTests {
|
class InputStreamResourceTests {
|
||||||
|
|
||||||
|
|
@ -216,6 +216,7 @@ class ResourceTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class FileSystemResourceTests {
|
class FileSystemResourceTests {
|
||||||
|
|
||||||
|
|
@ -287,6 +288,7 @@ class ResourceTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class UrlResourceTests {
|
class UrlResourceTests {
|
||||||
|
|
||||||
|
|
@ -435,6 +437,7 @@ class ResourceTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class AbstractResourceTests {
|
class AbstractResourceTests {
|
||||||
|
|
||||||
|
|
@ -479,7 +482,6 @@ class ResourceTests {
|
||||||
};
|
};
|
||||||
assertThat(resource.contentLength()).isEqualTo(3L);
|
assertThat(resource.contentLength()).isEqualTo(3L);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2019 the original author or authors.
|
* Copyright 2002-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -39,6 +39,7 @@ class PooledDataBufferTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class UnpooledByteBufAllocatorWithPreferDirectFalseTests implements PooledDataBufferTestingTrait {
|
class UnpooledByteBufAllocatorWithPreferDirectFalseTests implements PooledDataBufferTestingTrait {
|
||||||
|
|
||||||
|
|
@ -48,6 +49,7 @@ class PooledDataBufferTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class PooledByteBufAllocatorWithPreferDirectTrueTests implements PooledDataBufferTestingTrait {
|
class PooledByteBufAllocatorWithPreferDirectTrueTests implements PooledDataBufferTestingTrait {
|
||||||
|
|
||||||
|
|
@ -57,6 +59,7 @@ class PooledDataBufferTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class PooledByteBufAllocatorWithPreferDirectFalseTests implements PooledDataBufferTestingTrait {
|
class PooledByteBufAllocatorWithPreferDirectFalseTests implements PooledDataBufferTestingTrait {
|
||||||
|
|
||||||
|
|
@ -66,6 +69,7 @@ class PooledDataBufferTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
interface PooledDataBufferTestingTrait {
|
interface PooledDataBufferTestingTrait {
|
||||||
|
|
||||||
DataBufferFactory createDataBufferFactory();
|
DataBufferFactory createDataBufferFactory();
|
||||||
|
|
@ -92,7 +96,6 @@ class PooledDataBufferTests {
|
||||||
buffer.release();
|
buffer.release();
|
||||||
assertThatIllegalStateException().isThrownBy(buffer::release);
|
assertThatIllegalStateException().isThrownBy(buffer::release);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,9 @@ class PropertySourceProcessorTests {
|
||||||
private static final String PROPS_FILE = ClassUtils.classPackageAsResourcePath(PropertySourceProcessorTests.class) + "/test.properties";
|
private static final String PROPS_FILE = ClassUtils.classPackageAsResourcePath(PropertySourceProcessorTests.class) + "/test.properties";
|
||||||
|
|
||||||
private final StandardEnvironment environment = new StandardEnvironment();
|
private final StandardEnvironment environment = new StandardEnvironment();
|
||||||
|
|
||||||
private final ResourceLoader resourceLoader = new DefaultResourceLoader();
|
private final ResourceLoader resourceLoader = new DefaultResourceLoader();
|
||||||
|
|
||||||
private final PropertySourceProcessor processor = new PropertySourceProcessor(environment, resourceLoader);
|
private final PropertySourceProcessor processor = new PropertySourceProcessor(environment, resourceLoader);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -59,12 +61,14 @@ class PropertySourceProcessorTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void processorRegistersPropertySource() throws Exception {
|
void processorRegistersPropertySource() throws Exception {
|
||||||
PropertySourceDescriptor descriptor = new PropertySourceDescriptor(List.of(PROPS_FILE), false, null, DefaultPropertySourceFactory.class, null);
|
PropertySourceDescriptor descriptor = new PropertySourceDescriptor(
|
||||||
|
List.of(PROPS_FILE), false, null, DefaultPropertySourceFactory.class, null);
|
||||||
processor.processPropertySource(descriptor);
|
processor.processPropertySource(descriptor);
|
||||||
assertThat(environment.getPropertySources()).hasSize(3);
|
assertThat(environment.getPropertySources()).hasSize(3);
|
||||||
assertThat(environment.getProperty("enigma")).isEqualTo("42");
|
assertThat(environment.getProperty("enigma")).isEqualTo("42");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class FailOnErrorTests {
|
class FailOnErrorTests {
|
||||||
|
|
||||||
|
|
@ -86,9 +90,9 @@ class PropertySourceProcessorTests {
|
||||||
assertThatExceptionOfType(exceptionType).isThrownBy(() -> processor.processPropertySource(descriptor));
|
assertThatExceptionOfType(exceptionType).isThrownBy(() -> processor.processPropertySource(descriptor));
|
||||||
assertThat(environment.getPropertySources()).hasSize(2);
|
assertThat(environment.getPropertySources()).hasSize(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class IgnoreResourceNotFoundTests {
|
class IgnoreResourceNotFoundTests {
|
||||||
|
|
||||||
|
|
@ -127,7 +131,6 @@ class PropertySourceProcessorTests {
|
||||||
assertThatNoException().isThrownBy(() -> processor.processPropertySource(descriptor));
|
assertThatNoException().isThrownBy(() -> processor.processPropertySource(descriptor));
|
||||||
assertThat(environment.getPropertySources()).hasSize(2);
|
assertThat(environment.getPropertySources()).hasSize(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,6 @@ class SpringFactoriesLoaderTests {
|
||||||
assertThat(messages).hasSize(1);
|
assertThat(messages).hasSize(1);
|
||||||
assertThat(messages.get(0)).startsWith("Unable to instantiate factory class");
|
assertThat(messages.get(0)).startsWith("Unable to instantiate factory class");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -292,9 +291,9 @@ class SpringFactoriesLoaderTests {
|
||||||
assertThat(resolver.resolve(Integer.class)).isEqualTo(123);
|
assertThat(resolver.resolve(Integer.class)).isEqualTo(123);
|
||||||
assertThat(resolver.resolve(Long.class)).isEqualTo(234L);
|
assertThat(resolver.resolve(Long.class)).isEqualTo(234L);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class FactoryInstantiatorTests {
|
class FactoryInstantiatorTests {
|
||||||
|
|
||||||
|
|
@ -350,14 +349,12 @@ class SpringFactoriesLoaderTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DefaultConstructor {
|
static class DefaultConstructor {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class SingleConstructor {
|
static class SingleConstructor {
|
||||||
|
|
||||||
SingleConstructor(String arg) {
|
SingleConstructor(String arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class MultiplePrivateAndSinglePublicConstructor {
|
static class MultiplePrivateAndSinglePublicConstructor {
|
||||||
|
|
@ -368,7 +365,6 @@ class SpringFactoriesLoaderTests {
|
||||||
|
|
||||||
private MultiplePrivateAndSinglePublicConstructor(String arg, boolean extra) {
|
private MultiplePrivateAndSinglePublicConstructor(String arg, boolean extra) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class MultiplePackagePrivateAndSinglePublicConstructor {
|
static class MultiplePackagePrivateAndSinglePublicConstructor {
|
||||||
|
|
@ -379,22 +375,18 @@ class SpringFactoriesLoaderTests {
|
||||||
|
|
||||||
MultiplePackagePrivateAndSinglePublicConstructor(String arg, boolean extra) {
|
MultiplePackagePrivateAndSinglePublicConstructor(String arg, boolean extra) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static class SinglePackagePrivateConstructor {
|
static class SinglePackagePrivateConstructor {
|
||||||
|
|
||||||
SinglePackagePrivateConstructor(String arg) {
|
SinglePackagePrivateConstructor(String arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class SinglePrivateConstructor {
|
static class SinglePrivateConstructor {
|
||||||
|
|
||||||
private SinglePrivateConstructor(String arg) {
|
private SinglePrivateConstructor(String arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class MultiplePackagePrivateConstructors {
|
static class MultiplePackagePrivateConstructors {
|
||||||
|
|
@ -405,11 +397,10 @@ class SpringFactoriesLoaderTests {
|
||||||
|
|
||||||
MultiplePackagePrivateConstructors(String arg, boolean extra) {
|
MultiplePackagePrivateConstructors(String arg, boolean extra) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static class LimitedClassLoader extends URLClassLoader {
|
private static class LimitedClassLoader extends URLClassLoader {
|
||||||
|
|
||||||
private static final ClassLoader constructorArgumentFactories = new LimitedClassLoader("constructor-argument-factories");
|
private static final ClassLoader constructorArgumentFactories = new LimitedClassLoader("constructor-argument-factories");
|
||||||
|
|
@ -428,7 +419,6 @@ class SpringFactoriesLoaderTests {
|
||||||
throw new IllegalStateException(ex);
|
throw new IllegalStateException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue