Code Monkey home page Code Monkey logo

umf's Introduction

UMF : Person Manifest App

Build Status Coverage Status Codacy Badge

Task

Create a simple command line JAVA application with database access;

Based on an input from the command line provide the following functionality;

Provide help

  1. Add Person (id, firstName, surname)
  2. Edit Person (firstName, surname)
  3. Delete Person (id)
  4. Count Number of Persons
  5. List Persons

Additional Requirements (nice to have, but not required);

  1. Ability to Add Person from XML (Senior Only) ☑
  2. Test coverage ☑ (90%+)
  3. Maven or Gradle Build ☑ (Maven)
  4. 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.

Assumptions

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

Design decisions

  • 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

XML File format

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>

Build me

% mvn clean package spring-boot:repackage

Set-up: MongoDB

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

Run me

% java -jar target/umf-0.0.1-SNAPSHOT.jar

Query Database

% 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" }

Build Docker image

% mvn install dockerfile:build

Run Docker locally

% docker run --interactive sothach/umf

umf's People

Contributors

sothach avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.