cppwfs / batchtaskschemaexporter40

Exports contents from schema tables for Batch 4.x Task 2.x apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spring Batch 4.x Task 2.x Boot 2.7.x Test Data generator

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.

Requirements:

  • Java 8 or Above

Create load files:

mvn clean package

Configuration

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:

  1. 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 variable prefixval to V3 then TASK_EXECUTION would become V3_EXECUTION.

  2. 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.

  3. sequenceval - sequence start: The number for which the sequences will be defaulted as their start value. Defaults to 9000.

Test Execution

For example to create the singleJobSingleStep.load file with the V4 prefix for the POSTGRESQL database type starting at sequence id 505 you would run the following.

export sequenceval=505
export prefixval=V4
export databasetypeval=POSTGRESQL
mvn -Dtest=SingleJobSingleStepTest test

Load Files Test purpose

  • 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.

Empty MariaDB Docker image to test your load files would be started as follows:

This will start a mariadb task database.

docker run -p 3306:3306 --name mariadb  -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=task -d mariadb:latest

About

Exports contents from schema tables for Batch 4.x Task 2.x apps


Languages

Language:Java 97.5%Language:Shell 2.5%