Resolve issues introduced by Boot 2.6.0.M1 upgrade
Updated versions and fixed jdbc test Updated versions for samples
This commit is contained in:
@@ -26,7 +26,6 @@ import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfigurati
|
||||
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.cloud.task.batch.handler.TaskJobLauncherApplicationRunner;
|
||||
import org.springframework.cloud.task.batch.handler.TaskJobLauncherCommandLineRunner;
|
||||
import org.springframework.cloud.task.batch.listener.TaskBatchExecutionListenerTests;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
@@ -102,7 +101,7 @@ public class TaskJobLauncherAutoConfigurationTests {
|
||||
public void testAutoBuiltDataSourceWithTaskJobLauncherCLRDisabled() {
|
||||
this.contextRunner.run(context -> {
|
||||
assertThat(context).hasSingleBean(JobLauncherApplicationRunner.class);
|
||||
assertThat(context).doesNotHaveBean(TaskJobLauncherCommandLineRunner.class);
|
||||
assertThat(context).doesNotHaveBean(TaskJobLauncherApplicationRunner.class);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ContextConfiguration(
|
||||
classes = { TaskJobLauncherCommandLineRunnerCoreTests.BatchConfiguration.class })
|
||||
public class TaskJobLauncherCommandLineRunnerCoreTests {
|
||||
classes = { TaskJobLauncherApplicationRunnerCoreTests.BatchConfiguration.class })
|
||||
public class TaskJobLauncherApplicationRunnerCoreTests {
|
||||
|
||||
@Autowired
|
||||
private JobRepository jobRepository;
|
||||
@@ -75,7 +75,7 @@ public class TaskJobLauncherCommandLineRunnerCoreTests {
|
||||
@Autowired
|
||||
private PlatformTransactionManager transactionManager;
|
||||
|
||||
private TaskJobLauncherCommandLineRunner runner;
|
||||
private TaskJobLauncherApplicationRunner runner;
|
||||
|
||||
private JobBuilderFactory jobs;
|
||||
|
||||
@@ -92,7 +92,7 @@ public class TaskJobLauncherCommandLineRunnerCoreTests {
|
||||
Tasklet tasklet = (contribution, chunkContext) -> RepeatStatus.FINISHED;
|
||||
this.step = this.steps.get("step").tasklet(tasklet).build();
|
||||
this.job = this.jobs.get("job").start(this.step).build();
|
||||
this.runner = new TaskJobLauncherCommandLineRunner(this.jobLauncher,
|
||||
this.runner = new TaskJobLauncherApplicationRunner(this.jobLauncher,
|
||||
this.jobExplorer, this.jobRepository, new TaskBatchProperties());
|
||||
|
||||
}
|
||||
@@ -67,7 +67,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
/**
|
||||
* @author Glenn Renfro
|
||||
*/
|
||||
public class TaskJobLauncherCommandLineRunnerTests {
|
||||
public class TaskJobLauncherApplicationRunnerTests {
|
||||
|
||||
private static final String DEFAULT_ERROR_MESSAGE = "The following Jobs have failed: \n"
|
||||
+ "Job jobA failed during execution for job instance id 1 with jobExecutionId of 1 \n";
|
||||
@@ -86,7 +86,7 @@ public class TaskJobLauncherCommandLineRunnerTests {
|
||||
String[] enabledArgs = new String[] {
|
||||
"--spring.cloud.task.batch.failOnJobFailure=true" };
|
||||
validateForFail(DEFAULT_ERROR_MESSAGE,
|
||||
TaskJobLauncherCommandLineRunnerTests.JobWithFailureConfiguration.class,
|
||||
TaskJobLauncherApplicationRunnerTests.JobWithFailureConfiguration.class,
|
||||
enabledArgs);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class TaskJobLauncherCommandLineRunnerTests {
|
||||
String[] enabledArgs = new String[] {
|
||||
"--spring.cloud.task.batch.failOnJobFailure=true" };
|
||||
validateForFail(DEFAULT_ERROR_MESSAGE,
|
||||
TaskJobLauncherCommandLineRunnerTests.JobWithFailureAnnotatedConfiguration.class,
|
||||
TaskJobLauncherApplicationRunnerTests.JobWithFailureAnnotatedConfiguration.class,
|
||||
enabledArgs);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public class TaskJobLauncherCommandLineRunnerTests {
|
||||
"--spring.cloud.task.batch.failOnJobFailure=true",
|
||||
"--spring.cloud.task.batch.failOnJobFailurePollInterval=500" };
|
||||
validateForFail(DEFAULT_ERROR_MESSAGE,
|
||||
TaskJobLauncherCommandLineRunnerTests.JobWithFailureTaskExecutorConfiguration.class,
|
||||
TaskJobLauncherApplicationRunnerTests.JobWithFailureTaskExecutorConfiguration.class,
|
||||
enabledArgs);
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class TaskJobLauncherCommandLineRunnerTests {
|
||||
"--spring.cloud.task.batch.failOnJobFailurePollInterval=500",
|
||||
"--spring.batch.job.enabled=false" };
|
||||
this.applicationContext = SpringApplication.run(new Class[] {
|
||||
TaskJobLauncherCommandLineRunnerTests.JobWithFailureConfiguration.class },
|
||||
TaskJobLauncherApplicationRunnerTests.JobWithFailureConfiguration.class },
|
||||
enabledArgs);
|
||||
JobExplorer jobExplorer = this.applicationContext.getBean(JobExplorer.class);
|
||||
assertThat(jobExplorer.getJobNames().size()).isEqualTo(0);
|
||||
@@ -134,7 +134,7 @@ public class TaskJobLauncherCommandLineRunnerTests {
|
||||
boolean isExceptionThrown = false;
|
||||
try {
|
||||
this.applicationContext = SpringApplication.run(new Class[] {
|
||||
TaskJobLauncherCommandLineRunnerTests.JobWithFailureConfiguration.class },
|
||||
TaskJobLauncherApplicationRunnerTests.JobWithFailureConfiguration.class },
|
||||
enabledArgs);
|
||||
}
|
||||
catch (IllegalStateException exception) {
|
||||
@@ -145,22 +145,22 @@ public class TaskJobLauncherCommandLineRunnerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCommandLineRunnerSetToFalse() {
|
||||
public void testApplicationRunnerSetToFalse() {
|
||||
String[] enabledArgs = new String[] {};
|
||||
this.applicationContext = SpringApplication.run(
|
||||
new Class[] {
|
||||
TaskJobLauncherCommandLineRunnerTests.JobConfiguration.class },
|
||||
TaskJobLauncherApplicationRunnerTests.JobConfiguration.class },
|
||||
enabledArgs);
|
||||
validateContext();
|
||||
assertThat(this.applicationContext.getBean(JobLauncherApplicationRunner.class))
|
||||
.isNotNull();
|
||||
|
||||
Executable executable = () -> this.applicationContext
|
||||
.getBean(TaskJobLauncherCommandLineRunner.class);
|
||||
.getBean(TaskJobLauncherApplicationRunner.class);
|
||||
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class)
|
||||
.isThrownBy(executable::execute).withMessage("No qualifying bean of type "
|
||||
+ "'org.springframework.cloud.task.batch.handler.TaskJobLauncherCommandLineRunner' available");
|
||||
+ "'org.springframework.cloud.task.batch.handler.TaskJobLauncherApplicationRunner' available");
|
||||
validateContext();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user