Closes gh-13130
pull/13066/merge
Johnny Lim 7 years ago committed by Stephane Nicoll
parent 4683940423
commit 75e591e76e

@ -51,14 +51,14 @@ public class AutoConfigurationImportSelectorIntegrationTests {
} }
@Test @Test
public void multipleSelectorShouldMergeAndSortCorrectly() { public void multipleSelectorsShouldMergeAndSortCorrectly() {
this.contextRunner.withUserConfiguration(Config.class, AnotherConfig.class) this.contextRunner.withUserConfiguration(Config.class, AnotherConfig.class)
.run((context) -> assertThat(getImportedConfigBeans(context)) .run((context) -> assertThat(getImportedConfigBeans(context))
.containsExactly("ConfigA", "ConfigB", "ConfigC", "ConfigD")); .containsExactly("ConfigA", "ConfigB", "ConfigC", "ConfigD"));
} }
@Test @Test
public void multipleSelectorWithRedundantImportsShouldMergeAndSortCorrectly() { public void multipleSelectorsWithRedundantImportsShouldMergeAndSortCorrectly() {
this.contextRunner this.contextRunner
.withUserConfiguration(SingleConfig.class, Config.class, .withUserConfiguration(SingleConfig.class, Config.class,
AnotherConfig.class) AnotherConfig.class)

@ -20,7 +20,7 @@ content into your application. Rather, pick only the properties that you need.
# COMMON SPRING BOOT PROPERTIES # COMMON SPRING BOOT PROPERTIES
# #
# This sample file is provided as a guideline. Do NOT copy it in its # This sample file is provided as a guideline. Do NOT copy it in its
# entirety to your own application. ^^^ # entirety to your own application. ^^^
# =================================================================== # ===================================================================
@ -1101,7 +1101,7 @@ content into your application. Rather, pick only the properties that you need.
spring.rabbitmq.listener.simple.retry.enabled=false # Whether publishing retries are enabled. spring.rabbitmq.listener.simple.retry.enabled=false # Whether publishing retries are enabled.
spring.rabbitmq.listener.simple.retry.initial-interval=1000ms # Duration between the first and second attempt to deliver a message. spring.rabbitmq.listener.simple.retry.initial-interval=1000ms # Duration between the first and second attempt to deliver a message.
spring.rabbitmq.listener.simple.retry.max-attempts=3 # Maximum number of attempts to deliver a message. spring.rabbitmq.listener.simple.retry.max-attempts=3 # Maximum number of attempts to deliver a message.
spring.rabbitmq.listener.simple.retry.max-interval=10000ms # Maximum duration between attempts. spring.rabbitmq.listener.simple.retry.max-interval=10000ms # Maximum duration between attempts.
spring.rabbitmq.listener.simple.retry.multiplier=1 # Multiplier to apply to the previous retry interval. spring.rabbitmq.listener.simple.retry.multiplier=1 # Multiplier to apply to the previous retry interval.
spring.rabbitmq.listener.simple.retry.stateless=true # Whether retries are stateless or stateful. spring.rabbitmq.listener.simple.retry.stateless=true # Whether retries are stateless or stateful.
spring.rabbitmq.listener.simple.transaction-size= # Number of messages to be processed in a transaction. That is, the number of messages between acks. For best results, it should be less than or equal to the prefetch count. spring.rabbitmq.listener.simple.transaction-size= # Number of messages to be processed in a transaction. That is, the number of messages between acks. For best results, it should be less than or equal to the prefetch count.

@ -136,7 +136,7 @@ do as they were designed before this was clarified.
| https://www.mulesoft.com/platform/soa/mule-esb-open-source-esb[Mule ESB] | https://www.mulesoft.com/platform/soa/mule-esb-open-source-esb[Mule ESB]
| https://github.com/denschu/mule-spring-boot-starter | https://github.com/denschu/mule-spring-boot-starter
| http://mybatis.org/mybatis-3/[Mybatis] | http://mybatis.org/mybatis-3/[MyBatis]
| https://github.com/mybatis/mybatis-spring-boot | https://github.com/mybatis/mybatis-spring-boot
| https://github.com/facebook/nifty[Nifty] (Thrift on Netty) | https://github.com/facebook/nifty[Nifty] (Thrift on Netty)

@ -289,9 +289,9 @@ public class RepackagerTests {
public void libraries() throws Exception { public void libraries() throws Exception {
TestJarFile libJar = new TestJarFile(this.temporaryFolder); TestJarFile libJar = new TestJarFile(this.temporaryFolder);
libJar.addClass("a/b/C.class", ClassWithoutMainMethod.class, JAN_1_1985); libJar.addClass("a/b/C.class", ClassWithoutMainMethod.class, JAN_1_1985);
final File libJarFile = libJar.getFile(); File libJarFile = libJar.getFile();
final File libJarFileToUnpack = libJar.getFile(); File libJarFileToUnpack = libJar.getFile();
final File libNonJarFile = this.temporaryFolder.newFile(); File libNonJarFile = this.temporaryFolder.newFile();
FileCopyUtils.copy(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, libNonJarFile); FileCopyUtils.copy(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, libNonJarFile);
this.testJarFile.addClass("a/b/C.class", ClassWithMainMethod.class); this.testJarFile.addClass("a/b/C.class", ClassWithMainMethod.class);
this.testJarFile.addFile("BOOT-INF/lib/" + libJarFileToUnpack.getName(), this.testJarFile.addFile("BOOT-INF/lib/" + libJarFileToUnpack.getName(),
@ -319,7 +319,7 @@ public class RepackagerTests {
public void duplicateLibraries() throws Exception { public void duplicateLibraries() throws Exception {
TestJarFile libJar = new TestJarFile(this.temporaryFolder); TestJarFile libJar = new TestJarFile(this.temporaryFolder);
libJar.addClass("a/b/C.class", ClassWithoutMainMethod.class); libJar.addClass("a/b/C.class", ClassWithoutMainMethod.class);
final File libJarFile = libJar.getFile(); File libJarFile = libJar.getFile();
this.testJarFile.addClass("a/b/C.class", ClassWithMainMethod.class); this.testJarFile.addClass("a/b/C.class", ClassWithMainMethod.class);
File file = this.testJarFile.getFile(); File file = this.testJarFile.getFile();
Repackager repackager = new Repackager(file); Repackager repackager = new Repackager(file);
@ -335,12 +335,12 @@ public class RepackagerTests {
public void customLayout() throws Exception { public void customLayout() throws Exception {
TestJarFile libJar = new TestJarFile(this.temporaryFolder); TestJarFile libJar = new TestJarFile(this.temporaryFolder);
libJar.addClass("a/b/C.class", ClassWithoutMainMethod.class); libJar.addClass("a/b/C.class", ClassWithoutMainMethod.class);
final File libJarFile = libJar.getFile(); File libJarFile = libJar.getFile();
this.testJarFile.addClass("a/b/C.class", ClassWithMainMethod.class); this.testJarFile.addClass("a/b/C.class", ClassWithMainMethod.class);
File file = this.testJarFile.getFile(); File file = this.testJarFile.getFile();
Repackager repackager = new Repackager(file); Repackager repackager = new Repackager(file);
Layout layout = mock(Layout.class); Layout layout = mock(Layout.class);
final LibraryScope scope = mock(LibraryScope.class); LibraryScope scope = mock(LibraryScope.class);
given(layout.getLauncherClassName()).willReturn("testLauncher"); given(layout.getLauncherClassName()).willReturn("testLauncher");
given(layout.getLibraryDestination(anyString(), eq(scope))).willReturn("test/"); given(layout.getLibraryDestination(anyString(), eq(scope))).willReturn("test/");
given(layout.getLibraryDestination(anyString(), eq(LibraryScope.COMPILE))) given(layout.getLibraryDestination(anyString(), eq(LibraryScope.COMPILE)))
@ -359,12 +359,12 @@ public class RepackagerTests {
public void customLayoutNoBootLib() throws Exception { public void customLayoutNoBootLib() throws Exception {
TestJarFile libJar = new TestJarFile(this.temporaryFolder); TestJarFile libJar = new TestJarFile(this.temporaryFolder);
libJar.addClass("a/b/C.class", ClassWithoutMainMethod.class); libJar.addClass("a/b/C.class", ClassWithoutMainMethod.class);
final File libJarFile = libJar.getFile(); File libJarFile = libJar.getFile();
this.testJarFile.addClass("a/b/C.class", ClassWithMainMethod.class); this.testJarFile.addClass("a/b/C.class", ClassWithMainMethod.class);
File file = this.testJarFile.getFile(); File file = this.testJarFile.getFile();
Repackager repackager = new Repackager(file); Repackager repackager = new Repackager(file);
Layout layout = mock(Layout.class); Layout layout = mock(Layout.class);
final LibraryScope scope = mock(LibraryScope.class); LibraryScope scope = mock(LibraryScope.class);
given(layout.getLauncherClassName()).willReturn("testLauncher"); given(layout.getLauncherClassName()).willReturn("testLauncher");
repackager.setLayout(layout); repackager.setLayout(layout);
repackager.repackage( repackager.repackage(
@ -625,12 +625,12 @@ public class RepackagerTests {
public void layoutCanOmitLibraries() throws IOException { public void layoutCanOmitLibraries() throws IOException {
TestJarFile libJar = new TestJarFile(this.temporaryFolder); TestJarFile libJar = new TestJarFile(this.temporaryFolder);
libJar.addClass("a/b/C.class", ClassWithoutMainMethod.class); libJar.addClass("a/b/C.class", ClassWithoutMainMethod.class);
final File libJarFile = libJar.getFile(); File libJarFile = libJar.getFile();
this.testJarFile.addClass("a/b/C.class", ClassWithMainMethod.class); this.testJarFile.addClass("a/b/C.class", ClassWithMainMethod.class);
File file = this.testJarFile.getFile(); File file = this.testJarFile.getFile();
Repackager repackager = new Repackager(file); Repackager repackager = new Repackager(file);
Layout layout = mock(Layout.class); Layout layout = mock(Layout.class);
final LibraryScope scope = mock(LibraryScope.class); LibraryScope scope = mock(LibraryScope.class);
repackager.setLayout(layout); repackager.setLayout(layout);
repackager.repackage( repackager.repackage(
(callback) -> callback.library(new Library(libJarFile, scope))); (callback) -> callback.library(new Library(libJarFile, scope)));

@ -34,7 +34,6 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException; import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder; import org.junit.rules.TemporaryFolder;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.loader.archive.Archive; import org.springframework.boot.loader.archive.Archive;
import org.springframework.boot.loader.archive.ExplodedArchive; import org.springframework.boot.loader.archive.ExplodedArchive;
@ -67,7 +66,6 @@ public class PropertiesLauncherTests {
@Before @Before
public void setup() { public void setup() {
this.contextClassLoader = Thread.currentThread().getContextClassLoader(); this.contextClassLoader = Thread.currentThread().getContextClassLoader();
MockitoAnnotations.initMocks(this);
System.setProperty("loader.home", System.setProperty("loader.home",
new File("src/test/resources").getAbsolutePath()); new File("src/test/resources").getAbsolutePath());
} }

@ -33,7 +33,7 @@ class RunArguments {
private static final String[] NO_ARGS = {}; private static final String[] NO_ARGS = {};
private final LinkedList<String> args = new LinkedList<>(); private final Deque<String> args = new LinkedList<>();
RunArguments(String arguments) { RunArguments(String arguments) {
this(parseArgs(arguments)); this(parseArgs(arguments));

@ -57,7 +57,7 @@ class SpringConfigurationPropertySources
private ConfigurationPropertySource adapt(PropertySource<?> source) { private ConfigurationPropertySource adapt(PropertySource<?> source) {
ConfigurationPropertySource result = this.cache.get(source); ConfigurationPropertySource result = this.cache.get(source);
// Most PropertySource test quality only using the source name, we need to // Most PropertySources test equality only using the source name, so we need to
// check the actual source hasn't also changed. // check the actual source hasn't also changed.
if (result != null && result.getUnderlyingSource() == source) { if (result != null && result.getUnderlyingSource() == source) {
return result; return result;
@ -70,7 +70,7 @@ class SpringConfigurationPropertySources
private static class SourcesIterator private static class SourcesIterator
implements Iterator<ConfigurationPropertySource> { implements Iterator<ConfigurationPropertySource> {
private Deque<Iterator<PropertySource<?>>> iterators; private final Deque<Iterator<PropertySource<?>>> iterators;
private ConfigurationPropertySource next; private ConfigurationPropertySource next;
@ -91,10 +91,10 @@ class SpringConfigurationPropertySources
@Override @Override
public ConfigurationPropertySource next() { public ConfigurationPropertySource next() {
ConfigurationPropertySource next = fetchNext(); ConfigurationPropertySource next = fetchNext();
this.next = null;
if (next == null) { if (next == null) {
throw new NoSuchElementException(); throw new NoSuchElementException();
} }
this.next = null;
return next; return next;
} }

@ -70,9 +70,8 @@ public class BindConverterTests {
@Test @Test
public void createWhenPropertyEditorInitializerIsNullShouldCreate() { public void createWhenPropertyEditorInitializerIsNullShouldCreate() {
BindConverter bindConverter = new BindConverter( new BindConverter(
ApplicationConversionService.getSharedInstance(), null); ApplicationConversionService.getSharedInstance(), null);
assertThat(bindConverter).isNotNull();
} }
@Test @Test
@ -142,7 +141,6 @@ public class BindConverterTests {
Class<?> converted = bindConverter.convert("java.lang.RuntimeException", Class<?> converted = bindConverter.convert("java.lang.RuntimeException",
ResolvableType.forClass(Class.class)); ResolvableType.forClass(Class.class));
assertThat(converted).isEqualTo(RuntimeException.class); assertThat(converted).isEqualTo(RuntimeException.class);
} }
@Test @Test
@ -168,7 +166,7 @@ public class BindConverterTests {
this::registerSampleTypeEditor); this::registerSampleTypeEditor);
List<SampleType> converted = bindConverter.convert("test", List<SampleType> converted = bindConverter.convert("test",
ResolvableType.forClassWithGenerics(List.class, SampleType.class)); ResolvableType.forClassWithGenerics(List.class, SampleType.class));
assertThat(converted).isNotEmpty(); assertThat(converted).hasSize(1);
assertThat(converted.get(0).getText()).isEqualTo("test"); assertThat(converted.get(0).getText()).isEqualTo("test");
} }

@ -94,7 +94,7 @@ public class DelimitedStringToArrayConverterTests {
} }
@Test @Test
public void convertWhenHasDelimiterOfNoneShouldReturnTrimmedStringElement() { public void convertWhenHasDelimiterOfNoneShouldReturnWholeString() {
TypeDescriptor sourceType = TypeDescriptor.valueOf(String.class); TypeDescriptor sourceType = TypeDescriptor.valueOf(String.class);
TypeDescriptor targetType = TypeDescriptor TypeDescriptor targetType = TypeDescriptor
.nested(ReflectionUtils.findField(Values.class, "delimiterNone"), 0); .nested(ReflectionUtils.findField(Values.class, "delimiterNone"), 0);

@ -117,7 +117,7 @@ public class DelimitedStringToCollectionConverterTests {
@Test @Test
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void convertWhenHasDelimiterOfNoneShouldReturnTrimmedStringElement() { public void convertWhenHasDelimiterOfNoneShouldReturnWholeString() {
TypeDescriptor sourceType = TypeDescriptor.valueOf(String.class); TypeDescriptor sourceType = TypeDescriptor.valueOf(String.class);
TypeDescriptor targetType = TypeDescriptor TypeDescriptor targetType = TypeDescriptor
.nested(ReflectionUtils.findField(Values.class, "delimiterNone"), 0); .nested(ReflectionUtils.findField(Values.class, "delimiterNone"), 0);
@ -131,8 +131,8 @@ public class DelimitedStringToCollectionConverterTests {
TypeDescriptor sourceType = TypeDescriptor.valueOf(String.class); TypeDescriptor sourceType = TypeDescriptor.valueOf(String.class);
TypeDescriptor targetType = TypeDescriptor TypeDescriptor targetType = TypeDescriptor
.nested(ReflectionUtils.findField(Values.class, "specificType"), 0); .nested(ReflectionUtils.findField(Values.class, "specificType"), 0);
Object converted = this.conversionService.convert("a*b", sourceType, targetType); MyCustomList<String> converted = (MyCustomList<String>) this.conversionService.convert("a*b", sourceType, targetType);
assertThat(converted).isInstanceOf(MyCustomList.class); assertThat(converted).containsExactly("a", "b");
} }
@Parameters(name = "{0}") @Parameters(name = "{0}")

Loading…
Cancel
Save