Code Monkey home page Code Monkey logo

jpmcsupersimplestock's Introduction

1. Solution

Design

Simple stock application is implemented with Java 8 spring 4, Maven 3, Junit 4 and Log4j. Spring will take care of dependency injection and it will make the singleton object of repository objects and Service object. Implemented test cases in junit to design the application with TDD approach. Maven to build the application and automate the test cases. Integrated the Log4j framework for the complete logging of the application.

Designed the application with 3 different layers, Model with constants, Business and Repository. The Layered approach is to maintain the code as loosely coupled and to achieve the service oriented architecture. The repository instance can be implemented as a different way of retrieving data from different back end system,

All the business logic for the calculations of stocks are implemented in SimpleStockServiceImpl.java. TheStockRepositoryImpl.java is implemented as a repository object. For the current implementation the data are hardcoded inside the StockRepositoryImpl.java as provided in the Test Doc. SimpleStockAppConfiguration.java has the configuration of generating the SimpleStockService and stockRepository instance. By default the spring will generate the instance as singleton, the spring container will take care of generating singleton object. SimpleStockServicesTest.java has all the test cases. The SimpleStockService and stockRepository instance are injected using auto wired annotation. Also this Junit test case has the support of SpringJUnit4ClassRunner. So we can easily make use of spring in this test case class.

Application Layer structure

Unit Test Cases - TDD

To test the code of the technical test, it has been developed with Test Driven approach provided by Junit frame work combined with maven, coded with junit test cases for each of the requirement.

Try it yourself

The code for the application is built using Eclipse IDE with an embedded version of Maven 3. To compile the code, download the folder JPMCSuperSimpleStock and import the project into Eclipse IDE as a maven project.

Alternatively, Import the application into a folder and run the below command. Provided the maven is installed and the maven repositories completely configured in the system.

$> mvn clean install

This will compile the code and will start execute the unit test cases.

jpmcsupersimplestock's People

Contributors

sureshrajasun avatar

Watchers

c0ns0le avatar James Cloos 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.