// Path: spring-cloud-starter-single-step-batch-job/src/main/java/org/springframework/cloud/task/batch/autoconfigure/SingleStepJobAutoConfiguration.java
// @Configuration(proxyBeanMethods = false)
// @EnableConfigurationProperties(SingleStepJobProperties.class)
// @AutoConfigureBefore(BatchAutoConfiguration.class)
// public class SingleStepJobAutoConfiguration {
// 
// 	private JobBuilderFactory jobBuilderFactory;
// 
// 	private StepBuilderFactory stepBuilderFactory;
// 
// 	private SingleStepJobProperties properties;
// 
// 	@Autowired(required = false)
// 	private ItemProcessor<Map<String, Object>, Map<String, Object>> itemProcessor;
// 
// 	public SingleStepJobAutoConfiguration(JobBuilderFactory jobBuilderFactory,
// 			StepBuilderFactory stepBuilderFactory, SingleStepJobProperties properties,
// 			ApplicationContext context) {
// 
// 		validateProperties(properties);
// 
// 		this.jobBuilderFactory = jobBuilderFactory;
// 		this.stepBuilderFactory = stepBuilderFactory;
// 		this.properties = properties;
// 	}
// 
// 	private void validateProperties(SingleStepJobProperties properties) {
// 		Assert.hasText(properties.getJobName(), "A job name is required");
// 		Assert.hasText(properties.getStepName(), "A step name is required");
// 		Assert.notNull(properties.getChunkSize(), "A chunk size is required");
// 		Assert.isTrue(properties.getChunkSize() > 0,
// 				"A chunk size greater than zero is required");
// 	}
// 
// 	@Bean
// 	@ConditionalOnMissingBean
// 	@ConditionalOnProperty(prefix = "spring.batch.job", name = "job-name")
// 	public Job job(ItemReader<Map<String, Object>> itemReader,
// 			ItemWriter<Map<String, Object>> itemWriter) {
// 
// 		SimpleStepBuilder<Map<String, Object>, Map<String, Object>> stepBuilder = this.stepBuilderFactory
// 				.get(this.properties.getStepName())
// 				.<Map<String, Object>, Map<String, Object>>chunk(
// 						this.properties.getChunkSize())
// 				.reader(itemReader);
// 
// 		stepBuilder.processor(this.itemProcessor);
// 
// 		Step step = stepBuilder.writer(itemWriter).build();
// 
// 		return this.jobBuilderFactory.get(this.properties.getJobName()).start(step)
// 				.build();
// 	}
// }


import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
import org.h2.tools.Server;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.batch.core.explore.JobExplorer;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.item.database.ItemPreparedStatementSetter;
import org.springframework.batch.item.database.ItemSqlParameterSourceProvider;
import org.springframework.batch.item.database.JdbcBatchItemWriter;
import org.springframework.batch.item.support.ListItemReader;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.cloud.task.batch.autoconfigure.SingleStepJobAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.SqlTypeValue;
import org.springframework.jdbc.core.StatementCreatorUtils;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.util.SocketUtils;
import static org.assertj.core.api.Assertions.assertThat;
		jdbcTemplate.execute("DELETE FROM BATCH_JOB_INSTANCE");
	}

	@Test
	public void baseTest() {
		ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner()
				.withUserConfiguration(
					TaskLauncherConfiguration.class,
					JdbcBatchItemWriterAutoConfigurationTests.DelimitedJobConfiguration.class
						)
				.withConfiguration(
						AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
								BatchAutoConfiguration.class,
								SingleStepJobAutoConfiguration.class,
								JdbcBatchItemWriterAutoConfiguration.class));
		applicationContextRunner = updatePropertiesForTest(applicationContextRunner);

		runTest(applicationContextRunner);
	}

	@Test
	public void customSqlParameterSourceTest() {
		ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner()
				.withUserConfiguration(
						TaskLauncherConfiguration.class,
						JdbcBatchItemWriterAutoConfigurationTests.DelimitedDifferentKeyNameJobConfiguration.class,
						CustomSqlParameterSourceProviderConfiguration.class)
				.withConfiguration(
						AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
								BatchAutoConfiguration.class,
// Path: spring-cloud-starter-single-step-batch-job/src/main/java/org/springframework/cloud/task/batch/autoconfigure/SingleStepJobAutoConfiguration.java
// @Configuration(proxyBeanMethods = false)
// @EnableConfigurationProperties(SingleStepJobProperties.class)
// @AutoConfigureBefore(BatchAutoConfiguration.class)
// public class SingleStepJobAutoConfiguration {
// 
// 	private JobBuilderFactory jobBuilderFactory;
// 
// 	private StepBuilderFactory stepBuilderFactory;
// 
// 	private SingleStepJobProperties properties;
// 
// 	@Autowired(required = false)
// 	private ItemProcessor<Map<String, Object>, Map<String, Object>> itemProcessor;
// 
// 	public SingleStepJobAutoConfiguration(JobBuilderFactory jobBuilderFactory,
// 			StepBuilderFactory stepBuilderFactory, SingleStepJobProperties properties,
// 			ApplicationContext context) {
// 
// 		validateProperties(properties);
// 
// 		this.jobBuilderFactory = jobBuilderFactory;
// 		this.stepBuilderFactory = stepBuilderFactory;
// 		this.properties = properties;
// 	}
// 
// 	private void validateProperties(SingleStepJobProperties properties) {
// 		Assert.hasText(properties.getJobName(), "A job name is required");
// 		Assert.hasText(properties.getStepName(), "A step name is required");
// 		Assert.notNull(properties.getChunkSize(), "A chunk size is required");
// 		Assert.isTrue(properties.getChunkSize() > 0,
// 				"A chunk size greater than zero is required");
// 	}
// 
// 	@Bean
// 	@ConditionalOnMissingBean
// 	@ConditionalOnProperty(prefix = "spring.batch.job", name = "job-name")
// 	public Job job(ItemReader<Map<String, Object>> itemReader,
// 			ItemWriter<Map<String, Object>> itemWriter) {
// 
// 		SimpleStepBuilder<Map<String, Object>, Map<String, Object>> stepBuilder = this.stepBuilderFactory
// 				.get(this.properties.getStepName())
// 				.<Map<String, Object>, Map<String, Object>>chunk(
// 						this.properties.getChunkSize())
// 				.reader(itemReader);
// 
// 		stepBuilder.processor(this.itemProcessor);
// 
// 		Step step = stepBuilder.writer(itemWriter).build();
// 
// 		return this.jobBuilderFactory.get(this.properties.getJobName()).start(step)
// 				.build();
// 	}
// }


// Path: spring-cloud-starter-single-step-batch-job/src/test/java/org/springframework/cloud/task/batch/autoconfigure/jdbc/JdbcBatchItemWriterAutoConfigurationTests.java
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
import org.h2.tools.Server;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.batch.core.explore.JobExplorer;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.item.database.ItemPreparedStatementSetter;
import org.springframework.batch.item.database.ItemSqlParameterSourceProvider;
import org.springframework.batch.item.database.JdbcBatchItemWriter;
import org.springframework.batch.item.support.ListItemReader;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.cloud.task.batch.autoconfigure.SingleStepJobAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.SqlTypeValue;
import org.springframework.jdbc.core.StatementCreatorUtils;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.util.SocketUtils;
import static org.assertj.core.api.Assertions.assertThat;

		jdbcTemplate.execute("DELETE FROM BATCH_JOB_INSTANCE");
	}

	@Test
	public void baseTest() {
		ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner()
				.withUserConfiguration(
					TaskLauncherConfiguration.class,
					JdbcBatchItemWriterAutoConfigurationTests.DelimitedJobConfiguration.class
						)
				.withConfiguration(
						AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
								BatchAutoConfiguration.class,
								SingleStepJobAutoConfiguration.class,
								JdbcBatchItemWriterAutoConfiguration.class));
		applicationContextRunner = updatePropertiesForTest(applicationContextRunner);

		runTest(applicationContextRunner);
	}

	@Test
	public void customSqlParameterSourceTest() {
		ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner()
				.withUserConfiguration(
						TaskLauncherConfiguration.class,
						JdbcBatchItemWriterAutoConfigurationTests.DelimitedDifferentKeyNameJobConfiguration.class,
						CustomSqlParameterSourceProviderConfiguration.class)
				.withConfiguration(
						AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
								BatchAutoConfiguration.class,
								SingleStepJobAutoConfiguration.class,