Create a simple command line JAVA application with database access;
Based on an input from the command line provide the following functionality;
Provide help
- Add Person (id, firstName, surname)
- Edit Person (firstName, surname)
- Delete Person (id)
- Count Number of Persons
- List Persons
Additional Requirements (nice to have, but not required);
- Ability to Add Person from XML (Senior Only) ☑
- Test coverage ☑ (90%+)
- Maven or Gradle Build ☑ (Maven)
- Executable Jar ☑
Show us what you know, use any third party frameworks that you think will help you complete the exercise. Keep it simple.
Please supply the source code and instructions on how to build and run your application.
Please upload your all or your code & work into Github, Dropbox or Drive etc... and send us the link.
Please spend no more than 4 hrs on this.
- Person records are unique based on firstname, surname (case insensitive)
- Volumes will be low (not using reactive patterns, e.g., for file loading, metrics)
- The application will be deployed and used in a secured environment (e.g., the user's own laptop), so no access control or data encryption has been provided
- This app is the only client updating the data store, so no locking mechanism is required
- i18n is not a requirement (English text only will be used in interface)
- Using Spring-boot CommandLineRunner as application framework
- Storage is Mongodb: simple 'schema-less' object store, good Spring support, embedded version facilitates testing
- Fasterxml XML parsing library used
- ManifestService does not implement an interface - considered over-engineering
Top-level element (list element) name is not significant, nor is element order in the item body; all fields are mandatory and the id must be numeric
<users>
<person>
<id>123456</id>
<surname>Schmo</surname>
<firstName>Joe</firstName>
</person>
<person>
<id>123460</id>
<surname>Schwachsin</surname>
<firstName>Susan</firstName>
</person>
</users>
% mvn clean package spring-boot:repackage
if installed locally, start daemon:
% mongod
or run in docker:
% docker run -d -p 27017:27017 -v ~/data:/data/db mongo1
alternative, configure host/port for db instance in application.properties
% java -jar target/umf-0.0.1-SNAPSHOT.jar
% mongo
> use manifest
switched to db manifest
> db.person.find( {} )
{ "_id" : "10001", "firstName" : "otto", "surname" : "normalverbraucher", "_class" : "org.anized.umf.model.Person" }
{ "_id" : "10002", "firstName" : "hans", "surname" : "mustermann", "_class" : "org.anized.umf.model.Person" }
{ "_id" : "10004", "firstName" : "ivor", "surname" : "driver", "_class" : "org.anized.umf.model.Person" }
{ "_id" : "1234", "firstName" : "freddy", "surname" : "finkelstein", "_class" : "org.anized.umf.model.Person" }
% mvn install dockerfile:build
% docker run --interactive sothach/umf