Skip to content

Commit 3ed2042

Browse files
mminellacppwfs
authored andcommitted
Updates
1 parent 7e76cb0 commit 3ed2042

File tree

5 files changed

+12
-37
lines changed

5 files changed

+12
-37
lines changed

spring-cloud-starter-single-step-batch-job/pom.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@
3939
<scope>test</scope>
4040
</dependency>
4141
<dependency>
42-
<groupId>org.hsqldb</groupId>
43-
<artifactId>hsqldb</artifactId>
44-
<version>2.4.0</version>
42+
<groupId>com.h2database</groupId>
43+
<artifactId>h2</artifactId>
4544
<scope>test</scope>
4645
</dependency>
4746
</dependencies>

spring-cloud-starter-single-step-batch-job/src/main/java/org/springframework/cloud/task/batch/autoconfigure/FlatFileItemWriterProperties.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ public void setDelimited(boolean delimited) {
140140
}
141141

142142
/**
143-
* . When a file is delimited, this {@code String} will be used as the delimiter
144-
* between fields
143+
* When a file is delimited, this {@code String} will be used as the delimiter between
144+
* fields.
145145
* @return delimiter
146146
*/
147147
public String getDelimiter() {
@@ -192,7 +192,7 @@ public void setAppend(boolean append) {
192192

193193
/**
194194
* Indicates that the output file will use String formatting to generate the output.
195-
* @return true if the file will contain formatted records
195+
* @return true if the file will contain formatted records defaults to true
196196
*/
197197
public boolean isFormatted() {
198198
return formatted;
@@ -348,7 +348,7 @@ public void setLocale(Locale locale) {
348348

349349
/**
350350
* The longest a record is allowed to be. If 0, the maximum is unlimited.
351-
* @return the max record length allowed
351+
* @return the max record length allowed. Defaults to 0.
352352
*/
353353
public int getMaximumLength() {
354354
return maximumLength;

spring-cloud-starter-single-step-batch-job/src/main/java/org/springframework/cloud/task/batch/autoconfigure/SingleStepJobAutoConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.springframework.batch.item.ItemReader;
2828
import org.springframework.batch.item.ItemWriter;
2929
import org.springframework.beans.factory.annotation.Autowired;
30-
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
30+
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
3131
import org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration;
3232
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
3333
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -45,7 +45,7 @@
4545
*/
4646
@Configuration
4747
@EnableConfigurationProperties(SingleStepJobProperties.class)
48-
@AutoConfigureAfter(BatchAutoConfiguration.class)
48+
@AutoConfigureBefore(BatchAutoConfiguration.class)
4949
public class SingleStepJobAutoConfiguration {
5050

5151
private JobBuilderFactory jobBuilderFactory;

spring-cloud-starter-single-step-batch-job/src/test/java/org/springframework/cloud/task/batch/autoconfigure/FlatFileItemReaderAutoConfigurationTests.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -349,15 +349,6 @@ public FieldSetMapper<Map<Object, Object>> fieldSetMapper() {
349349
@Configuration
350350
public static class JobConfiguration {
351351

352-
@Autowired
353-
private JobBuilderFactory jobBuilderFactory;
354-
355-
@Autowired
356-
private StepBuilderFactory stepBuilderFactory;
357-
358-
@Autowired
359-
private FlatFileItemReader itemReader;
360-
361352
@Bean
362353
public ListItemWriter<Map> itemWriter() {
363354
return new ListItemWriter<>();
@@ -369,15 +360,6 @@ public ListItemWriter<Map> itemWriter() {
369360
@Configuration
370361
public static class RecordSeparatorAndSkippedLinesJobConfiguration {
371362

372-
@Autowired
373-
private JobBuilderFactory jobBuilderFactory;
374-
375-
@Autowired
376-
private StepBuilderFactory stepBuilderFactory;
377-
378-
@Autowired
379-
private FlatFileItemReader itemReader;
380-
381363
@Bean
382364
public RecordSeparatorPolicy recordSeparatorPolicy() {
383365
return new RecordSeparatorPolicy() {
@@ -423,15 +405,6 @@ public ListItemWriter<Map> itemWriter() {
423405
@Configuration
424406
public static class CustomLineMapperConfiguration {
425407

426-
@Autowired
427-
private JobBuilderFactory jobBuilderFactory;
428-
429-
@Autowired
430-
private StepBuilderFactory stepBuilderFactory;
431-
432-
@Autowired
433-
private FlatFileItemReader itemReader;
434-
435408
@Bean
436409
public LineMapper<Map<Object, Object>> lineMapper() {
437410
return (line, lineNumber) -> {

spring-cloud-starter-single-step-batch-job/src/test/java/org/springframework/cloud/task/batch/autoconfigure/FlatFileItemWriterAutoConfigurationTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public void testValidation() {
8585

8686
try {
8787
configuration.itemWriter();
88+
fail("Exception should have been thrown when both formatted and delimited are selected");
8889
}
8990
catch (IllegalStateException ise) {
9091
assertThat(ise.getMessage()).isEqualTo(
@@ -103,6 +104,7 @@ public void testValidation() {
103104

104105
try {
105106
configuration.itemWriter();
107+
fail("Exception should have been thrown when a LineAggregator and one of the autocreated options are selected");
106108
}
107109
catch (IllegalStateException ise) {
108110
assertThat(ise.getMessage())
@@ -118,6 +120,7 @@ public void testValidation() {
118120

119121
try {
120122
configuration.itemWriter();
123+
fail("Exception should have been thrown when a LineAggregator and one of the autocreated options are selected");
121124
}
122125
catch (IllegalStateException ise) {
123126
assertThat(ise.getMessage())
@@ -238,7 +241,7 @@ public void testFormattedFieldExtractorFileGeneration() {
238241
SingleStepJobAutoConfiguration.class,
239242
FlatFileItemWriterAutoConfiguration.class))
240243
.withPropertyValues("spring.batch.job.jobName=job",
241-
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=2",
244+
"spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5",
242245
"spring.batch.job.flatfilewriter.name=fooWriter",
243246
String.format(
244247
"spring.batch.job.flatfilewriter.resource=file://%s",

0 commit comments

Comments
 (0)