GithubHelp home page GithubHelp logo

yasinaksu / java-spring-h2database-demo Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 187 KB

Dockerfile 0.26% Java 99.74%
builder-pattern chain-of-responsibility-pattern clean-code design-patterns docker factory-pattern h2-database java junit5 mockito

java-spring-h2database-demo's Introduction

Fleet Management System

Summary

This is a small-scale fleet management system application where vehicles make deliveries to predetermined locations along a certain route.

Technologies

  • Java 8
  • Spring boot 2.5.3
  • Spring Data JPA
  • H2 in-memory DB
  • Restful API
  • SwaggerAPI documentation
  • JUnit5
  • Docker
  • Docker compose

Prerequisites

  • Maven
  • Docker

Installation

Git clone

git clone https://github.com/yasinaksu/java-spring-h2database-demo.git

Note

The system can provide test records to the database for a quick start according to the given test case description pdf file. For this, it will be enough to uncomment @Component annotation above the com.fleetmanagament.dataaccess.dataseeder.InitialDataSeed class.

Run & Build

There are 3 ways of run & build the fleet-management-system application.

1. Docker

$PORT 9090         

To build and run fleet-management-system service via docker

$ cd fleet-management-system
$ docker build -t fleet-management-system:1.0 .
$ docker run --name fleet-management-system -d -p $PORT:8080 fleet-management-system:1.0

2. Docker-Compose

$PORT 9191       

To build and run fleet-management-system service via docker-compose

$ cd fleet-management-system
$ docker-compose up

3. Maven

$PORT 8080       

To build and run fleet-management-system service via maven

$ cd fleet-management-system
$ mvn clean install
$ mvn spring-boot:run

Swagger UI will be run on this url

http://localhost:$PORT/swagger-ui.html

H2 Database console will be run on this url

http://localhost:$PORT/h2

jdbc url= jdbc:h2:mem:fleetManagementDb

user name= sa

password = there is no password

Usage of the fleet-management-system

Create Vehicle : HTTP POST method

http://localhost:$PORT/api/v1/vehicles

{
    "licensePlate":"34 TL 34"
}

Create Bag : HTTP POST method

http://localhost:$PORT/api/v1/bags

{
    "barcode": "C999800",
    "deliveryPointValue": 3
}

Create Delivery Point : HTTP POST method

http://localhost:$PORT/api/v1/deliverypoints

{
    "name": "Branch",
    "value": 1
}

Create Package : HTTP POST method

http://localhost:$PORT/api/v1/packages

{
    "barcode": "P7988000121",
    "deliveryPointValue": 1,
    "volumetricWeight":5
}

Assign Package to Bag : HTTP PUT method

http://localhost:$PORT/api/v1/packages/bag

{
    "packageBarcode": "P7988000121",
    "bagBarcode": "C725799"
}

Shipments Distribution : HTTP POST method

http://localhost:$PORT/api/v1/vehicles/shipments

The following Request is copied from test case description pdf file

{
    "plate": "34 TL 34",
    "route": [
        {
            "deliveryPoint": 1,
            "deliveries": [
                {
                    "barcode": "P7988000121"
                },
                {
                    "barcode": "P7988000122"
                },
                {
                    "barcode": "P7988000123"
                },
                {
                    "barcode": "P8988000121"
                },
                {
                    "barcode": "C725799"
                }
            ]
        },
        {
            "deliveryPoint": 2,
            "deliveries": [
                {
                    "barcode": "P8988000123"
                },
                {
                    "barcode": "P8988000124"
                },
                {
                    "barcode": "P8988000125"
                },
                {
                    "barcode": "C725799"
                }
            ]
        },
        {
            "deliveryPoint": 3,
            "deliveries": [
                {
                    "barcode": "P9988000126"
                },
                {
                    "barcode": "P9988000127"
                },
                {
                    "barcode": "P9988000128"
                },
                {
                    "barcode": "P9988000129"
                },
                {
                    "barcode": "P9988000130"
                }
            ]
        }
    ]
}

java-spring-h2database-demo's People

Contributors

yasinaksu avatar yasinaksuu avatar

Stargazers

 avatar

Watchers

 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.