Skip to content

Commit c1fe541

Browse files
committed
Update seed and parent version to 2.0.0-SNAPSHOT
1 parent abb4a3b commit c1fe541

File tree

9 files changed

+34
-43
lines changed

9 files changed

+34
-43
lines changed

bom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<parent>
1616
<groupId>org.seedstack.seed</groupId>
1717
<artifactId>seed-spring-extensions</artifactId>
18-
<version>2.0.0-M3-SNAPSHOT</version>
18+
<version>2.0.0-SNAPSHOT</version>
1919
</parent>
2020

2121
<artifactId>seed-spring-extensions-bom</artifactId>

doc/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<parent>
1616
<groupId>org.seedstack.seed</groupId>
1717
<artifactId>seed-spring-extensions</artifactId>
18-
<version>2.0.0-M3-SNAPSHOT</version>
18+
<version>2.0.0-SNAPSHOT</version>
1919
</parent>
2020

2121
<artifactId>seed-spring-extensions-doc</artifactId>

pom.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515
<parent>
1616
<groupId>org.seedstack</groupId>
1717
<artifactId>parent</artifactId>
18-
<version>2.0.0-M4-SNAPSHOT</version>
18+
<version>2.0.0-SNAPSHOT</version>
1919
</parent>
2020

2121
<groupId>org.seedstack.seed</groupId>
2222
<artifactId>seed-spring-extensions</artifactId>
23-
<version>2.0.0-M3-SNAPSHOT</version>
23+
<version>2.0.0-SNAPSHOT</version>
2424
<packaging>pom</packaging>
2525

2626
<properties>
27-
<seed.version>2.0.0-M4-SNAPSHOT</seed.version>
27+
<seed.version>2.0.0-SNAPSHOT</seed.version>
2828
</properties>
2929

3030
<modules>
@@ -85,6 +85,7 @@
8585
<licenseMerge>EPL 1.0|Eclipse Public License 1.0</licenseMerge>
8686
<licenseMerge>LGPL 3.0|GNU Lesser Public License</licenseMerge>
8787
<licenseMerge>MIT|MIT License</licenseMerge>
88+
<licenseMerge>LGPL 3.0|GNU Lesser Public License</licenseMerge>
8889
</licenseMerges>
8990
</configuration>
9091
</plugin>

spring-support/core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<parent>
1616
<groupId>org.seedstack.seed</groupId>
1717
<artifactId>seed-spring-support</artifactId>
18-
<version>2.0.0-M3-SNAPSHOT</version>
18+
<version>2.0.0-SNAPSHOT</version>
1919
</parent>
2020

2121
<artifactId>seed-spring-support-core</artifactId>

spring-support/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<parent>
1616
<groupId>org.seedstack.seed</groupId>
1717
<artifactId>seed-spring-extensions</artifactId>
18-
<version>2.0.0-M3-SNAPSHOT</version>
18+
<version>2.0.0-SNAPSHOT</version>
1919
</parent>
2020

2121
<artifactId>seed-spring-support</artifactId>

spring-support/test/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<parent>
1616
<groupId>org.seedstack.seed</groupId>
1717
<artifactId>seed-spring-support</artifactId>
18-
<version>2.0.0-M3-SNAPSHOT</version>
18+
<version>2.0.0-SNAPSHOT</version>
1919
</parent>
2020

2121
<artifactId>seed-spring-support-test</artifactId>

springbatch-support/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<parent>
1616
<groupId>org.seedstack.seed</groupId>
1717
<artifactId>seed-spring-extensions</artifactId>
18-
<version>2.0.0-M3-SNAPSHOT</version>
18+
<version>2.0.0-SNAPSHOT</version>
1919
</parent>
2020

2121
<artifactId>seed-springbatch-support</artifactId>

springbatch-support/src/it/java/org/seedstack/seed/springbatch/internal/SpringBatchCommandHandlerIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,21 @@ public void before() {
3737
}
3838

3939
@Test
40-
@WithCommandLine(value = {"--job", "flatFileJob", "-Pfile=fileTest.csv"}, expectedExitCode = 0)
40+
@WithCommandLine(command = "run-job", value = {"--job", "flatFileJob", "-Pfile=fileTest.csv"}, expectedExitCode = 0)
4141
public void execute_batch_without_error() {
4242
assertThat(passedBefore).isTrue();
4343
assertThat(jobRepository).isNotNull();
4444
}
4545

4646
@Test
47-
@WithCommandLine(value = {"--job", "flatFileJob"}, expectedExitCode = 1)
47+
@WithCommandLine(command = "run-job", value = {"--job", "flatFileJob"}, expectedExitCode = 1)
4848
public void execute_batch_with_error() {
4949
assertThat(passedBefore).isTrue();
5050
assertThat(jobRepository).isNotNull();
5151
}
5252

5353
@Test
54-
@WithCommandLine(value = {"-j", "flatFileJob", "-Pfile2=fileTest1", "--jobParameter", "file=fileTest.csv", "-P file3=fileTest2"}, expectedExitCode = 0)
54+
@WithCommandLine(command = "run-job", value = {"-j", "flatFileJob", "-Pfile2=fileTest1", "--jobParameter", "file=fileTest.csv", "-P file3=fileTest2"}, expectedExitCode = 0)
5555
public void execute_batch_with_multiple_parameters() {
5656
assertThat(passedBefore).isTrue();
5757
assertThat(jobRepository).isNotNull();

springbatch-support/src/main/java/org/seedstack/seed/springbatch/internal/SpringBatchCommandLineHandler.java

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
import com.google.inject.Injector;
1313
import com.google.inject.Key;
1414
import com.google.inject.name.Names;
15-
import org.seedstack.seed.cli.spi.CliOption;
16-
import org.seedstack.seed.cli.spi.CommandLineHandler;
1715
import org.apache.commons.lang.StringUtils;
16+
import org.seedstack.seed.cli.api.CliCommand;
17+
import org.seedstack.seed.cli.api.CliOption;
18+
import org.seedstack.seed.cli.api.CommandLineHandler;
1819
import org.slf4j.Logger;
1920
import org.slf4j.LoggerFactory;
2021
import org.springframework.batch.core.BatchStatus;
@@ -31,16 +32,18 @@
3132
import java.util.Map;
3233

3334
/**
34-
* This {@link CommandLineHandler} can launch Spring Batch jobs with the following arguments:
35+
* This {@link CommandLineHandler} is launched with the run-job command. It support the following arguments:
3536
*
3637
* <ul>
37-
* <li>-j job-name</li>
38-
* <li>-l job-launcher-name</li>
39-
* <li>-P job-parameter-name=job-parameter-value</li>
38+
* <li>-j job-name</li>
39+
* <li>-l job-launcher-name</li>
40+
* <li>-P job-parameter-name=job-parameter-value</li>
4041
* </ul>
4142
*
4243
* @author epo.jemba@ext.mpsa.com
44+
* @author adrien.lauer@mpsa.com
4345
*/
46+
@CliCommand(value = "run-job", description = "Launch Spring Batch jobs")
4447
public class SpringBatchCommandLineHandler implements CommandLineHandler {
4548

4649
private static final String DEFAULT_JOB_LAUNCHER_NAME = "jobLauncher";
@@ -49,23 +52,18 @@ public class SpringBatchCommandLineHandler implements CommandLineHandler {
4952

5053
private static final Logger LOGGER = LoggerFactory.getLogger(SpringBatchCommandLineHandler.class);
5154

52-
@CliOption(opt = "l", longOpt = "jobLauncher", optionalArg = true, description = "Spring Job Launcher Name")
55+
@CliOption(name = "l", longName = "jobLauncher", valueCount = 1, description = "Job launcher name to use")
5356
String optionJobLauncherName;
5457

55-
@CliOption(opt = "j", longOpt = "job", optionalArg = true, description = "Spring Job Name")
58+
@CliOption(name = "j", longName = "job", valueCount = 1, description = "Job name to launch")
5659
String optionJobName;
5760

58-
@CliOption(opt = "P", longOpt = "jobParameter", args = true, valueSeparator = '=', description = "Spring Job parameter")
59-
String[] optionJobParameters;
61+
@CliOption(name = "P", longName = "jobParameter", valueCount = -1, description = "A job parameter")
62+
Map<String, String> optionJobParameters;
6063

6164
@Inject
6265
Injector injector;
6366

64-
@Override
65-
public String name() {
66-
return "spring-batch-cli-handler";
67-
}
68-
6967
@Override
7068
public Integer call() throws JobExecutionException {
7169
Integer batchExitStatus = 0;
@@ -89,25 +87,17 @@ public Integer call() throws JobExecutionException {
8987
}
9088

9189
private JobParameters getJobParameters() {
92-
JobParameters jobParameters;
93-
Map<String, JobParameter> mapJobParameter = optionParameters(optionJobParameters);
94-
if (mapJobParameter != null && !mapJobParameter.isEmpty()) {
95-
jobParameters = new JobParameters(mapJobParameter);
96-
} else {
97-
jobParameters = new JobParameters();
98-
}
99-
return jobParameters;
100-
}
90+
if (optionJobParameters != null && !optionJobParameters.isEmpty()) {
91+
Map<String, JobParameter> mapJobParameter = new HashMap<String, JobParameter>();
10192

102-
private Map<String, JobParameter> optionParameters(String[] optJobParameters) {
103-
Map<String, JobParameter> mapJobParameter = null;
104-
if (optJobParameters != null && optJobParameters.length > 0 && (optJobParameters.length % 2) == 0) {
105-
mapJobParameter = new HashMap<String, JobParameter>();
106-
for (int i = 0; i < optJobParameters.length; i = i + 2) {
107-
mapJobParameter.put(optJobParameters[i], new JobParameter(optJobParameters[i + 1]));
93+
for (Map.Entry<String, String> stringJobParameterEntry : optionJobParameters.entrySet()) {
94+
mapJobParameter.put(stringJobParameterEntry.getKey(), new JobParameter(stringJobParameterEntry.getValue()));
10895
}
96+
97+
return new JobParameters(mapJobParameter);
98+
} else {
99+
return new JobParameters();
109100
}
110-
return mapJobParameter;
111101
}
112102

113103
private Job getJob() {

0 commit comments

Comments
 (0)