This page documents how to get CLAMP up and running on a local machine and also how to get CLAMP loaded and set up in an IDE. We may use the information on this page as input for a page in the CLAMP documentation.
Checking out and building CLAMP
Check CLAMP out of its repo
git clone "https://gerrit.onap.org/r/clamp"
- Change into the "clamp" directory
Build CLAMP
mvn clean install
You may get the following error (See - CLAMP-944Getting issue details... STATUS )
[ERROR] DOCKER> I/O Error [[docker.io/python:2-slim] "python": Timeout after 120088 ms while waiting on tcp port '[/172.17.0.3:8080]']
If so, then run the following command to skip integration tests
mvn clean install -DskipITs
Getting CLAMP set up locally in your IDE
- Import the CLAMP project into your IDE
Eclipse only: Add the following Eclipse profile to pom.xml for Eclipse m2e support, then run Maven->Update
Running unit tests locally
In order to run the unit tests locally, you need to run an instance of MariaDB and an instance of the emulator for the REST endpoints CLAMP uses. You also need to set the values some variables in a number of configuration files. These values are automatically generated in the maven build but need to be set manually when running tests locally.
If you follow the steps here, all the tests will pass in a Linux environment. In Windows and Mac environments, the Robot test case will not pass because Host Networking is not supported in Docker on WIndows and Mac. The robot test framework cannot reach "localhost" endpoints on the host machine.
Open a console and go into the directory extra/bin-for-dev
cd extra/bin-for-dev
Start an instance of the CLAMP MaraDB database in Docker using the helper script. This script uses docker-compose to bring up an instance of the CLAMP MariaDB.
./start-db.sh
Start an instance of the CLAMP endpoint emulator in Docker using the helper script. This script uses docker-compose to bring up an instance of the CLAMP endpoint emulator.
./start-emulator.sh
Check that the database and emulator are running
docker ps
You should see the two images running
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 93cffd7e7d2e python:2-slim "/bin/sh -c 'pip ins…" 7 seconds ago Up 7 seconds 0.0.0.0:8085->8085/tcp clamp_third-party-proxy_1 0b26d68f4048 mariadb:10.5.4 "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:3306->3306/tcp clamp_db_1
- In the file src/test/resources/application.properties:
- Change all occurrences of the string "${clamp.it.tests.http}" to "8080"
- Change all occurrences of the string "${docker.http-cache.port.host}" to "8085"
- Change all occurrences of the string "${docker.mariadb.port.host}" to "3306"
- In the file src/test/resources/https/https-test.properties:
- In the file src/test/resources/robotframework/robotframework-test.properties:
- Change all occurrences of the string "${clamp.it.tests.robotframework.http}" to "8080" (Any free port value)
- Change all occurrences of the string "${docker.http-cache.port.host}" to "8085"
- Change all occurrences of the string "${docker.mariadb.port.host}" to "3306"