Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ascendcorp/spring-restdocs-amqp
Rest docs extension for generate snippet from Spring Cloud Contract
https://github.com/ascendcorp/spring-restdocs-amqp
Last synced: about 1 month ago
JSON representation
Rest docs extension for generate snippet from Spring Cloud Contract
- Host: GitHub
- URL: https://github.com/ascendcorp/spring-restdocs-amqp
- Owner: ascendcorp
- License: apache-2.0
- Created: 2020-08-24T08:51:10.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-24T08:53:24.000Z (over 4 years ago)
- Last Synced: 2023-06-29T21:42:46.847Z (over 1 year ago)
- Language: Java
- Size: 9.77 KB
- Stars: 1
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spring Rest Docs AMQP
[![Apache 2.0](https://img.shields.io/github/license/micrometer-metrics/micrometer.svg)](http://www.apache.org/licenses/LICENSE-2.0)
Spring Rest Docs AMQP is extension for Spring Rest Docs and Spring Cloud Contract to generate snippet files from Contract, and we don't want repeat our self steps to manual create document specification of message schema.
This way, the message schema (snippet) is generated from Spring Cloud Contract testing in Aciidoctor format, and you can compile it to beautiful HTML or PDF document.
## Pre-Requisite
Your application implement Spring Cloud Contract with stub AMQP message configure.
## Add test dependency
```xml
com.ascendcorp
spring-restdocs-amqp
1.0.0
test```
## Bind message processor
Initial AMQP message post processor and bind with RabbitTemplate in contract test base class
```java
@Rule
public JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation("target/generated-snippets");@Autowired
RabbitTemplate rabbitTemplate;@Rule
public TestName testName = new TestName();
``
@Before
public void setup() {
String testName = this.testName.getMethodName();AmqpMessagePostProcessor amqpMessagePostProcessor = new AmqpMessagePostProcessor(testName, restDocumentation, rabbitTemplate);
rabbitTemplate.setBeforePublishPostProcessors(amqpMessagePostProcessor);
}
```After run contract testing, the snippet file will be generated to target/generated-snippets/{methodName} folder
-------------------------------------
_Licensed under [Apache Software License 2.0](https://www.apache.org/licenses/LICENSE-2.0)_