Tool to be used by developers and QA's to help in the troubleshooting of data consistency.
Data is incosistent when it makes no sense, return wrong results or can cause problem in the application (backend failures).
"SELECT COUNT(*) FROM recurring_operations WHERE rec_currency IS NULL"
We try to get BAD things!
git clone ssh://git@stash.strands.com:7999/labs/pfm-data-consistency.git
cd pfm-data-consistency
mvn clean install
cd target
cd pfm-data-consistency-0.0.1-SNAPSHOT
sh bin/run-consistency.sh
bin folder: has the script to run the module.
lib folder: has the libraries needed to run.
cfg folder: All the important configurable files to run the module.
suites folder
base-context
consistency.properties
One suite per module or per project.
Copy forecast-suite.xml file
Rename it as "yourname"-suite.xml
Open your new suite
· bean:
- Define the query to launch and the error message.
- Extend consistencyReader
- Must have unique id
<bean id="testUserNameBean" parent="consistencyReader">
<property name="sql"
value="SELECT COUNT(*) FROM users WHERE usr_username IS NULL"/>
<property name="errorMessage"
value="There are users with no username"/>
</bean>
<bean id="testUserIdBean" parent="consistencyReader">
<property name="sql"
value="SELECT COUNT(*) FROM users WHERE usr_id IS NULL"/>
<property name="errorMessage"
value="There are users with no ID"/>
</bean>
· flow:
- Defines a set of steps to be executed.
- Each step launches a reader, processor and writer.
- Each step extends partstep.
- Must add a bean to each reader step
- Must have unique id
<batch:flow id="borjaFlow">
<batch:step id="testStep1" parent="parstep" next="testStep2">
<batch:tasklet>
<batch:chunk reader="testUserNameBean"/>
</batch:tasklet>
</batch:step>
<batch:step id="testStep2" parent="parstep">
<batch:tasklet>
<batch:chunk reader="testUserIdBean"/>
</batch:tasklet>
</batch:step>
</batch:flow>
· job:
- Define a list of flows
- By default we will use only one flow per job
- Jobs can be run launched separately
<batch:job id="borja-job">
<batch:flow id="test.borjaFlow" parent="borjaFlow"/>
</batch:job>
Module file imports all suites to be lanched and adds all the flows that will be launched in the main job
Add the import of your suite
Add your flow to the main job
<import resource="suites/borja-suite.xml"/>
<batch:job id="main-job">
<batch:split id="main-split" task-executor="asyncTaskExecutor">
<batch:flow parent="transactionsFlow"/>
<batch:flow parent="forecastFlow"/>
<batch:flow parent="borjaFlow"/>
</batch:split>
</batch:job>
Defines the parent writer, processor and reader.
Defines the parent step with the consistency processor and the consistencyWriter
· Each step can be deactivated from a flow from here.
· Also the database parameters are set here
consistency.active.testStep1=0
consistency.active.testStep2=0
· Add everything we have modified to the src/main/resources folder