|
16 | 16 | import org.springframework.context.annotation.Primary; |
17 | 17 | import org.springframework.lang.Nullable; |
18 | 18 | import org.springframework.stereotype.Component; |
| 19 | +import org.springframework.test.context.ActiveProfiles; |
19 | 20 | import org.springframework.test.context.event.RecordApplicationEvents; |
20 | 21 | import org.springframework.transaction.PlatformTransactionManager; |
21 | 22 | import org.springframework.transaction.support.TransactionTemplate; |
|
26 | 27 | import org.sterl.spring.persistent_tasks.scheduler.SchedulerService; |
27 | 28 | import org.sterl.spring.persistent_tasks.scheduler.component.EditSchedulerStatusComponent; |
28 | 29 | import org.sterl.spring.persistent_tasks.scheduler.config.SchedulerConfig; |
| 30 | +import org.sterl.spring.persistent_tasks.scheduler.config.SchedulerThreadFactory; |
29 | 31 | import org.sterl.spring.persistent_tasks.task.TaskService; |
30 | 32 | import org.sterl.spring.persistent_tasks.test.AsyncAsserts; |
31 | 33 | import org.sterl.spring.persistent_tasks.test.PersistentTaskTestService; |
|
38 | 40 | import jakarta.persistence.EntityManager; |
39 | 41 | import lombok.RequiredArgsConstructor; |
40 | 42 |
|
41 | | -//@ActiveProfiles("mssql") // postgres mssql mariadb mysql |
| 43 | +@ActiveProfiles({"virtual-thread"}) // postgres mssql mariadb mysql |
42 | 44 | @SpringBootTest(classes = SampleApp.class, webEnvironment = WebEnvironment.RANDOM_PORT) |
43 | 45 | @RecordApplicationEvents |
44 | 46 | public class AbstractSpringTest { |
@@ -92,25 +94,26 @@ HibernateAsserts hibernateAsserts(EntityManager entityManager) { |
92 | 94 |
|
93 | 95 | @Primary |
94 | 96 | @Bean("schedulerA") |
95 | | - @SuppressWarnings("resource") |
96 | | - SchedulerService schedulerA(TriggerService triggerService, |
| 97 | + SchedulerService schedulerA( |
| 98 | + TriggerService triggerService, |
97 | 99 | MeterRegistry meterRegistry, |
98 | 100 | EditSchedulerStatusComponent editSchedulerStatus, |
| 101 | + SchedulerThreadFactory threadFactory, |
99 | 102 | TransactionTemplate trx) throws UnknownHostException { |
100 | 103 |
|
101 | 104 | final var name = "schedulerA"; |
102 | | - return SchedulerConfig.newSchedulerService(name, meterRegistry, triggerService, editSchedulerStatus, 10, Duration.ZERO, trx); |
| 105 | + return SchedulerConfig.newSchedulerService(name, meterRegistry, triggerService, editSchedulerStatus, threadFactory, 10, Duration.ZERO, trx); |
103 | 106 | } |
104 | 107 |
|
105 | 108 | @Bean |
106 | | - @SuppressWarnings("resource") |
107 | 109 | SchedulerService schedulerB(TriggerService triggerService, |
108 | 110 | MeterRegistry meterRegistry, |
109 | 111 | EditSchedulerStatusComponent editSchedulerStatus, |
| 112 | + SchedulerThreadFactory threadFactory, |
110 | 113 | TransactionTemplate trx) throws UnknownHostException { |
111 | 114 |
|
112 | 115 | final var name = "schedulerB"; |
113 | | - return SchedulerConfig.newSchedulerService(name, meterRegistry, triggerService, editSchedulerStatus, 20, Duration.ZERO, trx); |
| 116 | + return SchedulerConfig.newSchedulerService(name, meterRegistry, triggerService, editSchedulerStatus, threadFactory, 20, Duration.ZERO, trx); |
114 | 117 | } |
115 | 118 |
|
116 | 119 | /** |
|
0 commit comments