The tests create the DB load files for Spring Batch 4.x and Spring Cloud Task 2.x tables for a set of scenarios. Considerations for creating tests are the following:
-
Allow users to specify the database type. First databases to be supported will be MariaDB and Postgres.
-
Allow users to specify a prefix for the tables generated.
-
Allow users to specify where the sequence or sequence tables should start.
The load files will contain generic SQL inserts however the creation of the sequences are database specific.
Users are allowed to configure the output of each test via environment variables. There are 3 configurations that allow you to change the behavior of what is produced for the load file for each test:
-
prefixval- prefix: Allows you to set the prefix for the task and batch tables. Its default is
default
which means that the load scripts will use batch and task’s default prefixes. For example if you set the value environment variableprefixval
toV3
thenTASK_EXECUTION
would becomeV3_EXECUTION
. -
databasetypeval - database type: Allows you to specify the type of database for which the load data will be created. It defaults to MARIADB, but POSTGRES is also supported.
-
sequenceval - sequence start: The number for which the sequences will be defaulted as their start value. Defaults to 9000.
-
simplefailedtask.load - Contains an entry for a task execution that failed
-
simplesuccesstask.load - Contains an entry for a task execution that succeeds.
-
singleJobMultiStep.load - Contains the entries for a task execution with batch job that has 2 steps that ran successfully.
-
singleJobMultiStepFailedSecondStep.load - Contains the entries for a task execution with batch job that has 2 steps, step one succeeds but the second step fails thus causing the job to fail. However, the task succeeds. (Default behavior of a batch boot application)
-
singleJobMultiStepFailedSecondStepExitCode.load - Contains the entries for a task execution with batch job that has 2 steps, step one succeeds but the second step fails thus causing the job to fail as well as the task execution. This is because
spring.cloud.task.batch.fail-on-job-failure
is set to true. -
singleJobSingleStep.load - Contains the entries for a task execution with batch job that has one step that runs successfully.
-
singleJobSingleStepJobParam.load - Contains the entries for a task execution with batch job with a single job param that has one step that runs successfully.