# Order Parser
Test task
Console application that parses input .csv and .json files. Multi-threading parsing mechanism was implemented based on Spring-Batch job.
Number of threads is 10 and can be changed in application.properties.
Number of step chunks is 10 too.
Implementation details:
Basic logic is implemented with following components
- FlatFileItemReader was used as default file reader. It is used by spring batch job as ItemReader
- LineNumberMapper - custom line mapper that maps each line to the line number to create instance of Line class.
- LineProcessor - class implementing ItemProcessor to parse and transform the lines to required format.
- ConsoleWriter - stands for ItemWriter. Component that writes to console.
- Extensions - extendable enum containg all supported file extensions. Extension of input file is checked against Extension enum when parsing.
- OrderProcessorConfiguration - Spring application context where Spring Batch job is configured.
Automatic tests run the two jobs for parsing sample.csv and sample.json files consequently. Tests then check that correpsonding jobs complete successfully and compares the output with files expected_json.txt and expected_csv.txt.