This commit is contained in:
Michael Minella
2020-04-13 16:18:46 -05:00
committed by Glenn Renfro
parent 7e76cb00f3
commit 3ed2042ca0
5 changed files with 12 additions and 37 deletions

View File

@@ -39,9 +39,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.4.0</version>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

View File

@@ -140,8 +140,8 @@ public class FlatFileItemWriterProperties {
}
/**
* . When a file is delimited, this {@code String} will be used as the delimiter
* between fields
* When a file is delimited, this {@code String} will be used as the delimiter between
* fields.
* @return delimiter
*/
public String getDelimiter() {
@@ -192,7 +192,7 @@ public class FlatFileItemWriterProperties {
/**
* Indicates that the output file will use String formatting to generate the output.
* @return true if the file will contain formatted records
* @return true if the file will contain formatted records defaults to true
*/
public boolean isFormatted() {
return formatted;
@@ -348,7 +348,7 @@ public class FlatFileItemWriterProperties {
/**
* The longest a record is allowed to be. If 0, the maximum is unlimited.
* @return the max record length allowed
* @return the max record length allowed. Defaults to 0.
*/
public int getMaximumLength() {
return maximumLength;

View File

@@ -27,7 +27,7 @@ import org.springframework.batch.item.ItemProcessor;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemWriter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -45,7 +45,7 @@ import org.springframework.util.Assert;
*/
@Configuration
@EnableConfigurationProperties(SingleStepJobProperties.class)
@AutoConfigureAfter(BatchAutoConfiguration.class)
@AutoConfigureBefore(BatchAutoConfiguration.class)
public class SingleStepJobAutoConfiguration {
private JobBuilderFactory jobBuilderFactory;

View File

@@ -349,15 +349,6 @@ public class FlatFileItemReaderAutoConfigurationTests {
@Configuration
public static class JobConfiguration {
@Autowired
private JobBuilderFactory jobBuilderFactory;
@Autowired
private StepBuilderFactory stepBuilderFactory;
@Autowired
private FlatFileItemReader itemReader;
@Bean
public ListItemWriter<Map> itemWriter() {
return new ListItemWriter<>();
@@ -369,15 +360,6 @@ public class FlatFileItemReaderAutoConfigurationTests {
@Configuration
public static class RecordSeparatorAndSkippedLinesJobConfiguration {
@Autowired
private JobBuilderFactory jobBuilderFactory;
@Autowired
private StepBuilderFactory stepBuilderFactory;
@Autowired
private FlatFileItemReader itemReader;
@Bean
public RecordSeparatorPolicy recordSeparatorPolicy() {
return new RecordSeparatorPolicy() {
@@ -423,15 +405,6 @@ public class FlatFileItemReaderAutoConfigurationTests {
@Configuration
public static class CustomLineMapperConfiguration {
@Autowired
private JobBuilderFactory jobBuilderFactory;
@Autowired
private StepBuilderFactory stepBuilderFactory;
@Autowired
private FlatFileItemReader itemReader;
@Bean
public LineMapper<Map<Object, Object>> lineMapper() {
return (line, lineNumber) -> {

View File

@@ -85,6 +85,7 @@ public class FlatFileItemWriterAutoConfigurationTests {
try {
configuration.itemWriter();
fail("Exception should have been thrown when both formatted and delimited are selected");
}
catch (IllegalStateException ise) {
assertThat(ise.getMessage()).isEqualTo(
@@ -103,6 +104,7 @@ public class FlatFileItemWriterAutoConfigurationTests {
try {
configuration.itemWriter();
fail("Exception should have been thrown when a LineAggregator and one of the autocreated options are selected");
}
catch (IllegalStateException ise) {
assertThat(ise.getMessage())
@@ -118,6 +120,7 @@ public class FlatFileItemWriterAutoConfigurationTests {
try {
configuration.itemWriter();
fail("Exception should have been thrown when a LineAggregator and one of the autocreated options are selected");
}
catch (IllegalStateException ise) {
assertThat(ise.getMessage())
@@ -238,7 +241,7 @@ public class FlatFileItemWriterAutoConfigurationTests {
SingleStepJobAutoConfiguration.class,
FlatFileItemWriterAutoConfiguration.class))
.withPropertyValues("spring.batch.job.jobName=job",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=2",
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
"spring.batch.job.flatfilewriter.name=fooWriter",
String.format(
"spring.batch.job.flatfilewriter.resource=file://%s",