Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Install MockServer docker on Robot VM

>sudo docker pull jamesdbloom/mockserver
>sudo docker run --name mockserver -d -p 1080:1080 jamesdbloom/mockserver


You can restart MockServer container or reset it anytime with the following commands:

ubuntu@onap-robot:~/mockserverclient$ sudo docker restart mockserver
ubuntu@onap-robot:~/mockserverclient$ curl -v -X PUT "http://localhost:1080/reset"

Configuration

You can set the expectations in MockServer with REST APIs, e.g.:

...

Verify all requests received by MockServer with REST API. e.g.:

ubuntu@onap-robot:~/mockserverclient$ curl -X PUT "http://localhost:1080/retrieve?type=REQUESTS&format=JSON"

or a particular request filtered by url, e.g.:

ubuntu@onap-robot:~/mockserverclient$ curl -X PUT "http://localhost:1080/retrieve?type=REQUESTS&format=JSON" -d '{
    "path""/controller/v2/tokens"
}'

Also, you can tail the log file inside MockServer container:

Code Block
ubuntu@onap-robot:~/mockserverclient$ sudo docker exec -it mockserver bash
bash-4.4# tail -f mockserver.lo