From e35c87ccddcb120805b1b351ec2f2386082d41b9 Mon Sep 17 00:00:00 2001 From: Mahmoud Ben Hassine Date: Mon, 9 Jun 2025 15:43:52 +0200 Subject: [PATCH] Fix tests --- .../annotation/JobLoaderConfigurationTests.java | 6 +++--- .../core/configuration/xml/JobRegistryJobParserTests.java | 6 +++--- .../batch/samples/launch/DefaultJobLoader.java | 8 ++++---- .../batch/samples/misc/jmx/adhoc-job-launcher-context.xml | 4 ---- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/JobLoaderConfigurationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/JobLoaderConfigurationTests.java index 1187f2429..4900882c0 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/JobLoaderConfigurationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/annotation/JobLoaderConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParametersBuilder; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepContribution; -import org.springframework.batch.core.configuration.JobLocator; +import org.springframework.batch.core.configuration.JobRegistry; import org.springframework.batch.core.configuration.support.ApplicationContextFactory; import org.springframework.batch.core.configuration.support.AutomaticJobRegistrar; import org.springframework.batch.core.configuration.support.GenericApplicationContextFactory; @@ -71,7 +71,7 @@ class JobLoaderConfigurationTests { System.arraycopy(config, 0, configs, 1, config.length); configs[0] = DataSourceConfiguration.class; AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(configs); - Job job = jobName == null ? context.getBean(Job.class) : context.getBean(JobLocator.class).getJob(jobName); + Job job = jobName == null ? context.getBean(Job.class) : context.getBean(JobRegistry.class).getJob(jobName); JobLauncher jobLauncher = context.getBean(JobLauncher.class); JobExecution execution = jobLauncher.run(job, new JobParametersBuilder().addLong("run.id", (long) (Math.random() * Long.MAX_VALUE)) diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/JobRegistryJobParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/JobRegistryJobParserTests.java index 9c6f4cf62..f1fdf1363 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/JobRegistryJobParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/JobRegistryJobParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; import org.springframework.batch.core.Job; -import org.springframework.batch.core.configuration.ListableJobLocator; +import org.springframework.batch.core.configuration.JobRegistry; import org.springframework.beans.BeansException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; @@ -34,7 +34,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; public class JobRegistryJobParserTests implements ApplicationContextAware { @Autowired - private ListableJobLocator jobRegistry; + private JobRegistry jobRegistry; private ApplicationContext applicationContext; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/samples/launch/DefaultJobLoader.java b/spring-batch-samples/src/main/java/org/springframework/batch/samples/launch/DefaultJobLoader.java index d7bc149d0..25d372c1b 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/samples/launch/DefaultJobLoader.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/samples/launch/DefaultJobLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2023 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ import java.util.HashMap; import java.util.Map; import org.springframework.batch.core.Job; -import org.springframework.batch.core.configuration.ListableJobLocator; +import org.springframework.batch.core.configuration.JobRegistry; import org.springframework.batch.core.launch.NoSuchJobException; import org.springframework.beans.BeanWrapperImpl; import org.springframework.beans.BeansException; @@ -32,7 +32,7 @@ import org.springframework.util.Assert; public class DefaultJobLoader implements JobLoader, ApplicationContextAware { - private ListableJobLocator registry; + private JobRegistry registry; private ApplicationContext applicationContext; @@ -43,7 +43,7 @@ public class DefaultJobLoader implements JobLoader, ApplicationContextAware { this.applicationContext = applicationContext; } - public void setRegistry(ListableJobLocator registry) { + public void setRegistry(JobRegistry registry) { this.registry = registry; } diff --git a/spring-batch-samples/src/main/resources/org/springframework/batch/samples/misc/jmx/adhoc-job-launcher-context.xml b/spring-batch-samples/src/main/resources/org/springframework/batch/samples/misc/jmx/adhoc-job-launcher-context.xml index f7cd86680..25046703c 100644 --- a/spring-batch-samples/src/main/resources/org/springframework/batch/samples/misc/jmx/adhoc-job-launcher-context.xml +++ b/spring-batch-samples/src/main/resources/org/springframework/batch/samples/misc/jmx/adhoc-job-launcher-context.xml @@ -6,10 +6,6 @@ - - - -