Updates from the JSR 352 v1.0 Maintenance Release 20140214 Draft 2
* Per added section 9.3.2 - do not automatically make job properties available to artifacts when using @BatchProperty. Job properties are only available to artifacts when using the jobProperties substitution mechanism. * Update tests to reflect changes
This commit is contained in:
committed by
Michael Minella
parent
319c751432
commit
fe05e0daaf
@@ -144,11 +144,9 @@ public class BatchPropertyContextTests {
|
||||
batchPropertyContext.setStepProperties(stepProperties);
|
||||
|
||||
Properties artifactProperties = batchPropertyContext.getArtifactProperties("decider1");
|
||||
assertEquals(4, artifactProperties.size());
|
||||
assertEquals(2, artifactProperties.size());
|
||||
assertEquals("deciderProperty1value", artifactProperties.getProperty("deciderProperty1"));
|
||||
assertEquals("deciderProperty2value", artifactProperties.getProperty("deciderProperty2"));
|
||||
assertEquals("jobProperty1value", artifactProperties.getProperty("jobProperty1"));
|
||||
assertEquals("jobProperty2value", artifactProperties.getProperty("jobProperty2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -160,13 +158,11 @@ public class BatchPropertyContextTests {
|
||||
batchPropertyContext.setStepArtifactProperties(stepArtifactProperties);
|
||||
|
||||
Properties artifactProperties = batchPropertyContext.getStepArtifactProperties("step1", "reader");
|
||||
assertEquals(6, artifactProperties.size());
|
||||
assertEquals(4, artifactProperties.size());
|
||||
assertEquals("readerProperty1value", artifactProperties.getProperty("readerProperty1"));
|
||||
assertEquals("readerProperty2value", artifactProperties.getProperty("readerProperty2"));
|
||||
assertEquals("step1PropertyValue1", artifactProperties.getProperty("step1PropertyName1"));
|
||||
assertEquals("step1PropertyValue2", artifactProperties.getProperty("step1PropertyName2"));
|
||||
assertEquals("jobProperty1value", artifactProperties.getProperty("jobProperty1"));
|
||||
assertEquals("jobProperty2value", artifactProperties.getProperty("jobProperty2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -181,11 +177,9 @@ public class BatchPropertyContextTests {
|
||||
batchPropertyContext.setJobProperties(jobProperties);
|
||||
|
||||
Properties step1 = batchPropertyContext.getArtifactProperties("decider1");
|
||||
assertEquals(4, step1.size());
|
||||
assertEquals(2, step1.size());
|
||||
assertEquals("deciderProperty1value", step1.getProperty("deciderProperty1"));
|
||||
assertEquals("deciderProperty2value", step1.getProperty("deciderProperty2"));
|
||||
assertEquals("jobProperty1value", step1.getProperty("jobProperty1"));
|
||||
assertEquals("jobProperty2value", step1.getProperty("jobProperty2"));
|
||||
|
||||
Properties job = batchPropertyContext.getJobProperties();
|
||||
assertEquals(3, job.size());
|
||||
@@ -204,14 +198,12 @@ public class BatchPropertyContextTests {
|
||||
batchPropertyContext.setStepArtifactProperties(partitionProperties);
|
||||
|
||||
Properties artifactProperties = batchPropertyContext.getStepArtifactProperties("step2:partition0", "writer");
|
||||
assertEquals(8, artifactProperties.size());
|
||||
assertEquals(6, artifactProperties.size());
|
||||
assertEquals("writerProperty1", artifactProperties.getProperty("writerProperty1Step"));
|
||||
assertEquals("writerProperty2", artifactProperties.getProperty("writerProperty2Step"));
|
||||
assertEquals("writerProperty1valuePartition0", artifactProperties.getProperty("writerProperty1"));
|
||||
assertEquals("writerProperty2valuePartition0", artifactProperties.getProperty("writerProperty2"));
|
||||
assertEquals("step2PropertyValue1", artifactProperties.getProperty("step2PropertyName1"));
|
||||
assertEquals("step2PropertyValue2", artifactProperties.getProperty("step2PropertyName2"));
|
||||
assertEquals("jobProperty1value", artifactProperties.getProperty("jobProperty1"));
|
||||
assertEquals("jobProperty2value", artifactProperties.getProperty("jobProperty2"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,8 +81,6 @@ public class JobPropertyTests {
|
||||
org.springframework.util.Assert.isTrue(stepContext.getProperties().get("step1PropertyName2").equals("step1PropertyValue2"));
|
||||
org.springframework.util.Assert.isTrue(stepContext.getProperties().get("jobPropertyName1") == null);
|
||||
org.springframework.util.Assert.isTrue(stepContext.getProperties().get("jobPropertyName2") == null);
|
||||
org.springframework.util.Assert.isTrue("jobPropertyValue1".equals(jobPropertyName1));
|
||||
org.springframework.util.Assert.isTrue("jobPropertyValue2".equals(jobPropertyName2));
|
||||
org.springframework.util.Assert.isTrue("readerPropertyValue1".equals(readerPropertyName1));
|
||||
org.springframework.util.Assert.isTrue("readerPropertyValue2".equals(readerPropertyName2));
|
||||
org.springframework.util.Assert.isTrue("annotationNamedReaderPropertyValue".equals(annotationNamedProperty));
|
||||
@@ -92,6 +90,14 @@ public class JobPropertyTests {
|
||||
org.springframework.util.Assert.notNull(injectAnnotatedOnlyField);
|
||||
org.springframework.util.Assert.isTrue("job1".equals(injectAnnotatedOnlyField.getJobName()));
|
||||
org.springframework.util.Assert.isNull(readerPropertyName3);
|
||||
|
||||
Properties jobProperties = injectAnnotatedOnlyField.getProperties();
|
||||
org.springframework.util.Assert.isTrue(jobProperties.size() == 5);
|
||||
org.springframework.util.Assert.isTrue(jobProperties.get("jobPropertyName1").equals("jobPropertyValue1"));
|
||||
org.springframework.util.Assert.isTrue(jobProperties.get("jobPropertyName2").equals("jobPropertyValue2"));
|
||||
org.springframework.util.Assert.isTrue(jobProperties.get("step2name").equals("step2"));
|
||||
org.springframework.util.Assert.isTrue(jobProperties.get("filestem").equals("postings"));
|
||||
org.springframework.util.Assert.isTrue(jobProperties.get("x").equals("xVal"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -242,6 +248,9 @@ public class JobPropertyTests {
|
||||
@Inject @BatchProperty String notDefinedProperty;
|
||||
@Inject @BatchProperty(name = "notDefinedAnnotationNamedProperty") String notDefinedAnnotationNamedProperty;
|
||||
@Inject javax.batch.runtime.context.StepContext stepContext;
|
||||
@Inject @BatchProperty(name = "infile.name") String infile;
|
||||
@Inject @BatchProperty(name = "y") String y;
|
||||
@Inject @BatchProperty(name = "x") String x;
|
||||
|
||||
@Override
|
||||
public String process() throws Exception {
|
||||
@@ -256,8 +265,11 @@ public class JobPropertyTests {
|
||||
org.springframework.util.Assert.isTrue("batchletPropertyValue1".equals(batchletPropertyName1));
|
||||
org.springframework.util.Assert.isTrue("batchletPropertyValue2".equals(batchletPropertyName2));
|
||||
org.springframework.util.Assert.isTrue("annotationNamedBatchletPropertyValue".equals(annotationNamedProperty));
|
||||
org.springframework.util.Assert.isTrue("postings.txt".equals(infile));
|
||||
org.springframework.util.Assert.isTrue("xVal".equals(y));
|
||||
org.springframework.util.Assert.isNull(notDefinedProperty);
|
||||
org.springframework.util.Assert.isNull(notDefinedAnnotationNamedProperty);
|
||||
org.springframework.util.Assert.isNull(x);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user