|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2020 the original author or authors. |
| 2 | + * Copyright 2012-2021 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
34 | 34 | import org.springframework.boot.autoconfigure.rsocket.RSocketRequesterAutoConfiguration;
|
35 | 35 | import org.springframework.boot.autoconfigure.rsocket.RSocketServerAutoConfiguration;
|
36 | 36 | import org.springframework.boot.autoconfigure.rsocket.RSocketStrategiesAutoConfiguration;
|
| 37 | +import org.springframework.boot.autoconfigure.task.TaskSchedulingAutoConfiguration; |
37 | 38 | import org.springframework.boot.jdbc.DataSourceInitializationMode;
|
38 | 39 | import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
39 | 40 | import org.springframework.context.annotation.Bean;
|
|
42 | 43 | import org.springframework.integration.annotation.IntegrationComponentScan;
|
43 | 44 | import org.springframework.integration.annotation.MessagingGateway;
|
44 | 45 | import org.springframework.integration.config.IntegrationManagementConfigurer;
|
| 46 | +import org.springframework.integration.context.IntegrationContextUtils; |
45 | 47 | import org.springframework.integration.core.MessageSource;
|
46 | 48 | import org.springframework.integration.endpoint.MessageProcessorMessageSource;
|
47 | 49 | import org.springframework.integration.gateway.RequestReplyExchanger;
|
|
56 | 58 | import org.springframework.jmx.export.MBeanExporter;
|
57 | 59 | import org.springframework.messaging.Message;
|
58 | 60 | import org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler;
|
| 61 | +import org.springframework.scheduling.TaskScheduler; |
59 | 62 |
|
60 | 63 | import static org.assertj.core.api.Assertions.assertThat;
|
61 | 64 | import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
|
71 | 74 | class IntegrationAutoConfigurationTests {
|
72 | 75 |
|
73 | 76 | private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
74 |
| - .withConfiguration(AutoConfigurations.of(JmxAutoConfiguration.class, IntegrationAutoConfiguration.class)); |
| 77 | + .withConfiguration(AutoConfigurations.of(JmxAutoConfiguration.class, IntegrationAutoConfiguration.class, |
| 78 | + TaskSchedulingAutoConfiguration.class)); |
75 | 79 |
|
76 | 80 | @Test
|
77 | 81 | void integrationIsAvailable() {
|
@@ -221,6 +225,17 @@ void rsocketSupportEnabled() {
|
221 | 225 | });
|
222 | 226 | }
|
223 | 227 |
|
| 228 | + @Test |
| 229 | + void taskSchedulerAutoConfigured() { |
| 230 | + this.contextRunner |
| 231 | + .withPropertyValues("spring.task.scheduling.thread-name-prefix=integration-scheduling-", |
| 232 | + "spring.task.scheduling.pool.size=3") |
| 233 | + .run((context) -> assertThat(context) |
| 234 | + .getBean(IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME, TaskScheduler.class) |
| 235 | + .hasFieldOrPropertyWithValue("threadNamePrefix", "integration-scheduling-") |
| 236 | + .hasFieldOrPropertyWithValue("scheduledExecutor.corePoolSize", 3)); |
| 237 | + } |
| 238 | + |
224 | 239 | @Configuration(proxyBeanMethods = false)
|
225 | 240 | static class CustomMBeanExporter {
|
226 | 241 |
|
|
0 commit comments