Skip to content

Commit 4ede211

Browse files
committed
Merge pull request #232 from radcortez/master
Documentation clarifications and typos.
2 parents 119b49a + 07f8b5a commit 4ede211

File tree

14 files changed

+63
-47
lines changed

14 files changed

+63
-47
lines changed

batch/batch-listeners/src/test/java/org/javaee7/batch/batch/listeners/BatchListenersTest.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import static org.junit.Assert.assertTrue;
2222

2323
/**
24-
* The Batch specification, provides several listeners to notify about specific event ocurring during the batch
24+
* The Batch specification, provides several listeners to notify about specific event occurring during the batch
2525
* processing execution.
2626
*
2727
* Events can be caught via extending the following classes, for the appropriate batch lifecycle event:
@@ -47,7 +47,7 @@
4747
* The Chunk Listener:
4848
* include::MyChunkListener[]
4949
*
50-
* Allows you to execude code before and after the chunk processing. Useful to setup and clear resources needed by the
50+
* Allows you to execute code before and after the chunk processing. Useful to setup and clear resources needed by the
5151
* chunk.
5252
*
5353
* The Read Listener:
@@ -71,7 +71,10 @@
7171
* Useful to setup additional resources and add additional information to the object writing. You can also provide
7272
* some logic to treat a failed object write.
7373
*
74-
* Remember that listeners need to be configured in the job xml file (+myjob.xml+).
74+
* The +listeners+ element can be used at the +step+ level or the +job+ level to define which listeners to run for each
75+
* batch processing event.
76+
*
77+
* include::myJob.xml[]
7578
*
7679
* @author Roberto Cortez
7780
*/
@@ -82,10 +85,10 @@ public class BatchListenersTest {
8285
*
8386
* [source,file]
8487
* ----
85-
* /META-INF/batch-jobs/myjob.xml
88+
* /META-INF/batch-jobs/myJob.xml
8689
* ----
8790
*
88-
* The +myjob.xml+ file is needed for running the batch definition.
91+
* The +myJob.xml+ file is needed for running the batch definition.
8992
*/
9093
@Deployment
9194
public static WebArchive createDeployment() {

batch/batchlet-simple/src/test/java/org/javaee7/batch/batchlet/simple/MyBatchletTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public void testBatchletProcess() throws Exception {
7575

7676
BatchTestHelper.keepTestAlive(jobExecution);
7777

78+
// <1> Job should be completed.
7879
assertEquals(jobExecution.getBatchStatus(), BatchStatus.COMPLETED);
7980
}
8081
}

batch/chunk-checkpoint/src/test/java/org/javaee7/batch/chunk/checkpoint/BatchChunkCheckpointTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
*
3434
* include::myJob.xml[]
3535
*
36-
* A very simple job is defined in the +myJob.xml+ file. Just a single step with a reader, a processor and writer. For
36+
* A very simple job is defined in the +myJob.xml+ file. Just a single step with a reader, a processor and a writer. For
3737
* this sample, a custom checkpoint policy is going to be used. The custom policy needs to implement
3838
* +javax.batch.api.chunk.CheckpointAlgorithm+ or in alternative extend
3939
* +javax.batch.api.chunk.AbstractCheckpointAlgorithm+ that already provides empty implementations for all methods.
@@ -52,10 +52,10 @@ public class BatchChunkCheckpointTest {
5252
*
5353
* [source,file]
5454
* ----
55-
* /META-INF/batch-jobs/myjob.xml
55+
* /META-INF/batch-jobs/myJob.xml
5656
* ----
5757
*
58-
* The +myjob.xml+ file is needed for running the batch definition.
58+
* The +myJob.xml+ file is needed for running the batch definition.
5959
*/
6060
@Deployment
6161
public static WebArchive createDeployment() {

batch/chunk-csv-database/src/test/java/org/javaee7/batch/chunk/csv/database/BatchCSVDatabaseTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* Process the data by transforming it into a +Person+ object:
3939
* include::MyItemProcessor#processItem[]
4040
*
41-
* Finally write the data using JPA to a database:
41+
* And finally write the data using JPA to a database:
4242
* include::MyItemWriter#writeItems[]
4343
*
4444
* @author Roberto Cortez
@@ -53,14 +53,14 @@ public class BatchCSVDatabaseTest {
5353
*
5454
* [source,file]
5555
* ----
56-
* /META-INF/batch-jobs/myjob.xml
56+
* /META-INF/batch-jobs/myJob.xml
5757
* /META-INF/persistence.xml
5858
* /META-INF/create.sql
59-
* /META-INF/drop-sql
59+
* /META-INF/drop.sql
6060
* /META-INF/mydata.csv
6161
* ----
6262
*
63-
* * The +myjob.xml+ file is needed for running the batch definition.
63+
* * The +myJob.xml+ file is needed for running the batch definition.
6464
* * The +persistence.xml+ file is needed for JPA configuration, create schema, load-data and drop schema.
6565
* * The +create.sql+ file has the necessary database schema for the data.
6666
* * The +drop.sql+ file has the required commands to drop the database schema created.
@@ -81,8 +81,6 @@ public static WebArchive createDeployment() {
8181
return war;
8282
}
8383

84-
@SuppressWarnings("unchecked")
85-
@Test
8684
/**
8785
* In the test, we're just going to invoke the batch execution and wait for completion. To validate the test
8886
* expected behaviour we need to query the +Metric[]+ object available in the step execution.
@@ -92,6 +90,8 @@ public static WebArchive createDeployment() {
9290
*
9391
* @throws Exception an exception if the batch could not complete successfully.
9492
*/
93+
@SuppressWarnings("unchecked")
94+
@Test
9595
public void testBatchCSVDatabase() throws Exception {
9696
JobOperator jobOperator = BatchRuntime.getJobOperator();
9797
Long executionId = jobOperator.start("myJob", new Properties());
@@ -106,7 +106,7 @@ public void testBatchCSVDatabase() throws Exception {
106106

107107
// <1> The read count should be 7 elements. Check +MyItemReader+.
108108
assertEquals(7L, metricsMap.get(Metric.MetricType.READ_COUNT).longValue());
109-
// <2> The write count should be same 7 read elements.
109+
// <2> The write count should be the same 7 read elements.
110110
assertEquals(7L, metricsMap.get(Metric.MetricType.WRITE_COUNT).longValue());
111111
// <3> The commit count should be 4. Checkpoint is on every 3rd read, 4 commits for read elements.
112112
assertEquals(3L, metricsMap.get(Metric.MetricType.COMMIT_COUNT).longValue());

batch/chunk-exception/src/test/java/org/javaee7/batch/chunk/exception/BatchChunkExceptionTest.java

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@
2121
import static org.junit.Assert.assertTrue;
2222

2323
/**
24-
* In this sample we're going to process a few record and mix some exceptions during read, processing and write of the
25-
* chunk. Exceptions are a natural part of batch processing, and the batch itself should be prepared to deal with
26-
* exceptions during processing. These exceptions are configured in the job xml file (+myjob.xml+).
24+
* Exceptions are a natural part of Batch Processing, and the batch itself should be prepared to deal with
25+
* exceptions during processing.
2726
*
28-
* Batch processing deals with two kinds of exceptions: skippable and retryable. Skippable Exceptions are used to skip
27+
* Batch Processing deals with two kinds of exceptions: skippable and retryable. Skippable Exceptions are used to skip
2928
* elements during reading, processing and writing and continue to the next element. Retryable Exceptions on the other
30-
* hand when thrown will try to retry the chunk on which the exceptiong occurred.
29+
* hand when thrown will try to retry the chunk on which the exception occurred.
3130
*
32-
* When the same exception is specified as both retryable and skippable, retryable takes precedence over skippable during
33-
* regular processing of the chunk. While the chunk is retrying, skippable takes precedence over retryable since the exception
34-
* is already being retried.
31+
* When the same exception is specified as both retryable and skippable, retryable takes precedence over skippable
32+
* during regular processing of the chunk. While the chunk is retrying, skippable takes precedence over retryable since
33+
* the exception is already being retried.
3534
*
3635
* The Reader:
3736
* include::MyItemReader[]
@@ -58,6 +57,15 @@
5857
* * +MyRetryProcessorListener+
5958
* * +MyRetryWriteListener+
6059
*
60+
* include::myJob.xml[]
61+
*
62+
* A very simple job is defined in the +myJob.xml+ file. Just a single step with a reader, a processor and a writer. For
63+
* this sample we are going to process a few records and mix some exceptions during read, processing and write of the
64+
* chunk. Batch exception handling is achieved by defining the elements +skippable-exception-classes+ and
65+
* +retryable-exception-classes+ into the +chunk+. Both elements should indicate the full qualified name of the
66+
* exceptions that we are trying to catch. The +listeners+ element can be used at the +step+ level to define which
67+
* listeners to run for each batch processing event.
68+
*
6169
* @author Roberto Cortez
6270
*/
6371
@RunWith(Arquillian.class)
@@ -67,10 +75,10 @@ public class BatchChunkExceptionTest {
6775
*
6876
* [source,file]
6977
* ----
70-
* /META-INF/batch-jobs/myjob.xml
78+
* /META-INF/batch-jobs/myJob.xml
7179
* ----
7280
*
73-
* The +myjob.xml+ file is needed for running the batch definition.
81+
* The +myJob.xml+ file is needed for running the batch definition.
7482
*/
7583
@Deployment
7684
public static WebArchive createDeployment() {

batch/chunk-mapper/src/test/java/org/javaee7/batch/sample/chunk/mapper/BatchChunkMapperTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ public class BatchChunkMapperTest {
5959
*
6060
* [source,file]
6161
* ----
62-
* /META-INF/batch-jobs/myjob.xml
62+
* /META-INF/batch-jobs/myJob.xml
6363
* ----
6464
*
65-
* The +myjob.xml+ file is needed for running the batch definition.
65+
* The +myJob.xml+ file is needed for running the batch definition.
6666
*/
6767
@Deployment
6868
public static WebArchive createDeployment() {

batch/chunk-optional-processor/src/test/java/org/javaee7/batch/chunk/optional/processor/BatchChunkOptionalProcessorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public class BatchChunkOptionalProcessorTest {
3838
*
3939
* [source,file]
4040
* ----
41-
* /META-INF/batch-jobs/myjob.xml
41+
* /META-INF/batch-jobs/myJob.xml
4242
* ----
4343
*
44-
* The +myjob.xml+ file is needed for running the batch definition.
44+
* The +myJob.xml+ file is needed for running the batch definition.
4545
*/
4646
@Deployment
4747
public static WebArchive createDeployment() {

batch/chunk-partition/src/test/java/org/javaee7/batch/sample/chunk/partition/BatchChunkPartitionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ public class BatchChunkPartitionTest {
5454
*
5555
* [source,file]
5656
* ----
57-
* /META-INF/batch-jobs/myjob.xml
57+
* /META-INF/batch-jobs/myJob.xml
5858
* ----
5959
*
60-
* The +myjob.xml+ file is needed for running the batch definition.
60+
* The +myJob.xml+ file is needed for running the batch definition.
6161
*/
6262
@Deployment
6363
public static WebArchive createDeployment() {

batch/chunk-simple-nobeans/src/test/java/org/javaee7/batch/samples/chunk/simple/nobeans/BatchChunkSimpleNoBeansTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*
2525
* include::myJob.xml[]
2626
*
27-
* A very simple job is defined in the +myJob.xml+ file. Just a single step with a reader, a processor and writer.
27+
* A very simple job is defined in the +myJob.xml+ file. Just a single step with a reader, a processor and a writer.
2828
*
2929
* @author Roberto Cortez
3030
*/
@@ -35,10 +35,10 @@ public class BatchChunkSimpleNoBeansTest {
3535
*
3636
* [source,file]
3737
* ----
38-
* /META-INF/batch-jobs/myjob.xml
38+
* /META-INF/batch-jobs/myJob.xml
3939
* ----
4040
*
41-
* The +myjob.xml+ file is needed for running the batch definition. This sample is also missing the +beans.xml+ for
41+
* The +myJob.xml+ file is needed for running the batch definition. This sample is also missing the +beans.xml+ for
4242
* CDI discovery, since for Java EE 7 this file is now optional, but you need to annotated batch dependent beans
4343
* with +@Dependent+.
4444
*/

batch/chunk-simple/src/test/java/org/javaee7/batch/chunk/simple/ChunkSimpleTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
* include::myJob.xml[]
2828
*
29-
* A very simple job is defined in the +myJob.xml+ file. Just a single step with a reader, a processor and writer.
29+
* A very simple job is defined in the +myJob.xml+ file. Just a single step with a reader, a processor and a writer.
3030
*
3131
* @author Roberto Cortez
3232
*/
@@ -37,10 +37,10 @@ public class ChunkSimpleTest {
3737
*
3838
* [source,file]
3939
* ----
40-
* /META-INF/batch-jobs/myjob.xml
40+
* /META-INF/batch-jobs/myJob.xml
4141
* ----
4242
*
43-
* The +myjob.xml+ file is needed for running the batch definition.
43+
* The +myJob.xml+ file is needed for running the batch definition.
4444
*/
4545
@Deployment
4646
public static WebArchive createDeployment() {

0 commit comments

Comments
 (0)