Full Stack Software Development Blog
In my last blog I wrote about mocking dependencies when running tests. Since then I've added Apache's Qpid (https://qpid.apache.org/) to mock out RabbitMQ.
The following is from the top of the readme in my github repository for the PoC (see https://github.com/gpratte/spring-boot-acceptance-test-mocks)
A Spring Boot project that connects to various resources (database, mongo, rest calls, JMS messaging, Rabbit messaging, legacy). Mock the connections for acceptance testing.
Listen to JMS message flow...
The server is setup
The following is from the top of the readme in my github repository for the PoC (see https://github.com/gpratte/spring-boot-acceptance-test-mocks)
A Spring Boot project that connects to various resources (database, mongo, rest calls, JMS messaging, Rabbit messaging, legacy). Mock the connections for acceptance testing.
Embedded servers
When running tests the server uses
- An embedded ActiveMQ server (to mock JMS)
- Wiremock to mock the REST calls
- An embedded H2 in-memory database
- An embedded Qpid server (to mock RabbitMQ)
- Receive a Todo JMS message
- Make a REST call (for no good reason)
- Persist the Todo in a relational database
- Listen to the mailbox queue of an external JMS ActiveMQ server
- Makes a REST call to http://worldclockapi.com/api/json/utc/now
- Inserts into a Postgres database
- Expose a POST endpoint to create a Todo
- Persist the Todo in a relational database
- Send the Todo as JSON to RabbitMQ
The server is setup
- With a RestController with a PostMapping on /api/todos
- The controller calls a service which calls the repository to insert into a Postgres database
- The service also sends JSON to RabbitMQ
No comments:
Post a Comment