This project is a backend project developed in Java by using Spring Boot framework.
Dependencies:
- Java version 1.8
- Spring Boot version 2.5.3
- Maven version 3.6.3
The project architecture consists of the following modules as shown in the figure.
- Persistence Layer: Handles data file read/write operations
- In memory cache: Saves and orchestrate data operation during application runtime life cycle
- Web Service: Contains REST API and SOAP WS endpoints to act as client interfaces
- Scheduler: Operates based on provided cron expression to sync cache data to data file
- Log: Logs all the requests coming to web service endpoints
-
app.conffile must be created in the following pathC:\ericsson-java-prototype\conf- An example app.conf file can be found in
src/main/resources/static/app.conf - The template of the app.conf file must be as shown in the following example.
data_file_path={C:/ericsson-java-prototype/data/data.json} scheduler={*/10 * * * * *}- Data file path and cron expression should be written between curly braces.
data_file_pathandschedulerparameters shouldn't be changed.
- An example app.conf file can be found in
-
Filling the data file is optional but the data format should be as follows if it will be filled
{
"subscribers": [
{"id":"1","name":"Stephan King","msisdn":"905552551122"},
{"id":"2","name":" Alice Gracy","msisdn":"905552551133"},
{"id":"3","name":"Glory Wisdom", "msisdn":"905552551144"}
]
}- The log file is produced and located in
C:\ericsson-java-prototype\log\app.logonce the application is started.
In order to build and run the project in your locale run the following commands.
$ mvn clean package$ mvn spring-boot:runOnce package building is completed a executable fat .jar is exported to project's target folder. The application can also be up by running the fat .jar with providing the app.properties file as a spring config file argument. (To do that the app.properties file shall be moved to /target folder and the following command shall be run from the directory)
$ java -jar -Dspring.config.file=app.properties ericsson-java-prototype-0.0.1-SNAPSHOT.jar-
REST Services:
- POST: http://localhost:8080/subscriber
- Request:
{ "id": "1001", "name": "Nikola Tesla", "msisdn": "+905552551122" }
- Request:
- PUT: http://localhost:8080/subscriber
- Request:
{ "id": "1001", "name": "Albert Einstein", "msisdn": "+905552551123" }
- Request:
- DELETE: http://localhost:8080/subscriber
- Request:
{ "id": "1001" }
- Request:
- POST: http://localhost:8080/subscriber
-
SOAP Services:
-
WSDL: http://localhost:8080/subscriber-data/subscribers.wsdl
-
getAllSubscribers:
- Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.ericsson.com/java/prototype/soap/services"> <soapenv:Header/> <soapenv:Body> <ser:getAllSubscribersRequest/> </soapenv:Body> </soapenv:Envelope>
- Request:
-
getSubscriberById:
- Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.ericsson.com/java/prototype/soap/services"> <soapenv:Header/> <soapenv:Body> <ser:getSubscriberByIdRequest> <ser:id>1001</ser:id> </ser:getSubscriberByIdRequest> </soapenv:Body> </soapenv:Envelope>
- Request:
-