/site-tracker

An old Assignment

Primary LanguageJava

site-tracker

An old Assignment

APIs implemented

  1. Create Site
  2. Add Connection
  3. Get Site
  4. Get All Sites
  5. Update Site name

REST API Details

  1. Create Site

POST http://localhost:8080/sitetracker/rest/site/

Request

{
    "siteName" : "SiteA",
    "connections": [
            {
                "siteName": "Augsburg",
                "distance": 10
            },
            {
                "siteName": "Augsburg",
                "distance": 15
            }            
        ]
}

Response

{
    "siteId": "33",
    "siteName": "SiteA",
    "connections": [
        {
            "id": "3",
            "siteName": "Augsburg",
            "distance": 10
        },
        {
            "id": "4",
            "siteName": "Augsburg",
            "distance": 15
        }
    ]
}
  1. Get Site Details

    GET http://localhost:8080/sitetracker/rest/site/{siteId} Response

{
    "siteName": "SiteA",
    "connections": [
        {
            "siteName": "Augsburg",
            "distance": 10
        },
        {
            "siteName": "Augsburg",
            "distance": 15
        }
    ]
}
  1. Update Site Name

    PUT http://localhost:8080/sitetracker/rest/site/{siteId} Request

{
    "siteName": "Edina"
}
  1. Add Connection to Site

PUT http://localhost:8080/sitetracker/rest/site/{siteId}/connection

Request

{
    "siteName": "SiteB",
    "distance": 4
}
  1. Get All Sites

GET http://localhost:8080/sitetracker/rest/site/

Response

[
{
"siteId":null,
"siteName":"Akola"
},
{
"siteId":null,
"siteName":"Allegheny"
}
]

Things to be implemented

  1. Caching. Hibernate Second level cache is not implemented yet
  2. Optimistic lock at Object level to avoid concurrency issues.
  3. More unit and integration test cases
  4. More Logging.
  5. Spring AOP for Application Logging
  6. More data validations

Schema Creation Use the below attached SQL file to create the schema. This is for MySql.