Follow the steps below to setup the CPS environment.
Checkout the features project
Checkout https://gerrit.onap.org/r/admin/repos/cps
Run a Postgres 13 container instance and create 'cpsdb' database.
docker run -d \ --name postgres-instance \ -e POSTGRES_DB=cpsdb \ -e POSTGRES_USER=cps \ -e POSTGRES_PASSWORD=cps \ postgres:13.0
NB. On Linux the IP address of the Docker container (DB_HOST) can be determined using following command
('postgres-instance' is a container name)
docker inspect postgres-instance | grep IPAddress
Setup schema in DB
The spring-boot application auto creates the schema on startup via a script run by JPA.
Set environment variables with relevant connection details which can be found in application.yaml
Building the project
When building the project run from the root cps folder :
mvn clean install
Running the project
From the features\cps\ folder run the following command :
java -DDB_HOST=localhost -DDB_USERNAME=cps -DDB_PASSWORD=cps -jar cps-rest/target/cps-rest-1.1.0-SNAPSHOT.jar
NB. On Linux use IP address of a container instead of localhost
OR
From the features\cps\cps-rest folder run the following command :
mvn spring-boot:run
FAQ
How to fix "Error: could not open `{argLine}'
when running unit tests from Intellij IDE ?
If not able to run unit tests from Intellj unit tests tool because of this error
Error: could not open `{argLine}' Process finished with exit code 1
Then review maven-surefire-plugin integration with Intellij:
- Go to Settings-> Build,Execution,Deployment -> Build Tools -> Maven -> Running Tests
- Uncheck argLine