# R11-MockedServices
Mockup service for middleware testing.

Available scripts:

### Running the application on a local machine
For Intellij:
Plugins:
settings -> plugins -> install lombok plugin
settings -> annotation processors -> enable annotation processing

A connection to a Redis database is expected to run the application successfully. You need to download and run Redis DB on
your local machine with default values localhost 6379.

You can also run the application via Docker.
#### docker-compose up --build -d

However, you need either to run it with Docker-compose ensuring that all containers are within a network or start application locally.
In order to change environment two properties must be changed.

1) data-access.properties - property redis.host
2) logback.xml - configuration/appender/host element value

If application is to be run locally, both of above should be set to "localhost"
If application is to be run in docker environment, both should be set to name of a redis container (by default "redis")

Docker automaticly translates container name to IP address, considering all containers are within same network.
Try to avoid using any symbols in names of containers, because it may cause that URL exception to be thrown. Instead use letters only.

### Operations on Redis DB

Use Redis CLI or attach to Redis docker image in order to manually operate on DB.

#### docker exec -it mockedservices_redis-server redis-cli
Attach to redis server image and open a redis client. 

Useful redis-cli commands:
###### KEYS *
Show all keys in the db.
###### TYPE key
Show key type.
###### LRANGE key start stop
Display elements from the list.
###### LLEN key
Display list length.
###### SMEMBERS key
Display elements from hashSet.
Logs can be found in lists with names logstash_yyyy-mm-dd.