Install Postgres v10 or any other.
By default, user and database are named as postgres
.
Change credentials in application.properties
file and other places if needed.
Run com.github.blacky.subscriber_lifecycle.tool.InitDatabase
script
./mvnw clean install -DskipTests
cd target/subscriber-lifecycle/WEB-INF/
java -classpath "lib/*:classes/." com.github.blacky.subscriber_lifecycle.tool.InitDatabase
or execute schema-postgresql.sql
, data-postgresql.sql
scripts under src/main/resources/
directory.
Get subscriber's balance and status:
GET {url:port}/account/{msisdn}
Make a call:
POST {url:port}/call
JSON body: {"to": "target msisdn", "from": "source msisdn"}
Send a SMS:
POST {url:port}/sms
JSON body: {"to": "target msisdn", "from": "source msisdn", "text": "any text message"}
Make a deposit to specific phone number:
PUT {url:port}/account/deposit
JSON body: {"amount": 1, "msisdn": "target msisdn"}
Examples:
curl -i -X GET localhost:8080/account/+12025008080
curl -i -X POST -H "Content-Type: application/json" localhost:8080/call --data '{"to": "+12025008081", "from": "+12025008080"}'
curl -i -X POST -H "Content-Type: application/json" localhost:8080/sms --data '{"to": "+12025008081", "from": "+12025008080", "text", "Good news, everyone!"}'
curl -i -X PUT -H "Content-Type: application/json" localhost:8080/account/deposit --data '{"amount": 100, "msisdn": "+12025008080"}'
Install Lombok plugin and configure:
Intellij Idea -> Settings -> Compiler -> Annotation Processors -> Enable annotation processing
Some tests require the Docker engine so you need to install and configure it before start tests with TestContainer's framework.
These tests use embedded Postgres postgres:10-alpine
version, so you can connect to it in debug mode.
Use -DskipTests
parameter to skip tests while building an app.
./mvnw clean install -DskipTests
mvn -N io.takari:maven:0.7.6:wrapper -Dmaven=3.6.2
./mvnw clean install
./mvnw spring-boot:run