Skip to content

Commit

Permalink
chore: switch examples to application properties configuration (#466)
Browse files Browse the repository at this point in the history
* chore: switch examples to application properties configuration

Remove usage of AsyncApiDocket bean configuration

* chore: update build.gradle dependencies in examples
  • Loading branch information
timonback authored Nov 24, 2023
1 parent 491e1aa commit cf978b4
Show file tree
Hide file tree
Showing 16 changed files with 9 additions and 1,049 deletions.
3 changes: 1 addition & 2 deletions springwolf-examples/springwolf-amqp-example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ dependencies {
implementation "org.springframework.amqp:spring-rabbit"
implementation "org.slf4j:slf4j-api:${slf4jApiVersion}"
implementation "io.swagger.core.v3:swagger-annotations:${swaggerVersion}"
implementation "com.asyncapi:asyncapi-core:${asyncapiCoreVersion}"

implementation "org.springframework.amqp:spring-amqp"
implementation "org.springframework.boot:spring-boot-autoconfigure"
implementation "org.springframework.boot:spring-boot"
implementation "org.springframework:spring-beans"
implementation "org.springframework:spring-context"

testRuntimeOnly "org.junit.jupiter:junit-jupiter:${junitJupiterVersion}"
Expand All @@ -38,6 +36,7 @@ dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"

testImplementation "org.springframework.boot:spring-boot-test"
testImplementation "org.springframework:spring-beans"
testImplementation "org.springframework:spring-web"
testImplementation "org.springframework:spring-test"

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,10 @@

public class SpringContextIntegrationTest {

@Nested
@SpringBootTest(classes = SpringwolfAmqpExampleApplication.class)
class AsyncApiDocketTest {

@Autowired
private ApplicationContext context;

@Autowired
private AsyncApiService asyncApiService;

@Test
void testContextWithAsyncApiDocketBean() {
assertNotNull(context);

assertThat(asyncApiService.getAsyncAPI()).isNotNull();
}

@Test
void testAllChannelsAreFound() {
assertThat(asyncApiService.getAsyncAPI().getChannels()).hasSize(7);
}
}

@Nested
@SpringBootTest(classes = SpringwolfAmqpExampleApplication.class)
@TestPropertySource(
properties = {
"customAsyncApiDocketBean=false",
"springwolf.enabled=true",
"springwolf.docket.info.title=Info title was loaded from spring properties",
"springwolf.docket.info.version=1.0.0",
Expand All @@ -66,7 +42,6 @@ void testContextWithApplicationProperties() {

@Test
void testAllChannelsAreFound() {
// 2 channels defined in the AsyncDocket are not found (7 - 2 = 5)
assertThat(asyncApiService.getAsyncAPI().getChannels()).hasSize(5);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,88 +74,6 @@
}
}
},
"example-manual-consumer-channel": {
"publish": {
"operationId": "example-manual-consumer-channel_publish",
"description": "example-manual-consumer-channel-description",
"bindings": {
"amqp": {
"cc": [
"example-consumer-topic-routing-key"
],
"bindingVersion": "0.2.0"
}
},
"message": {
"schemaFormat": "application/vnd.oai.openapi+json;version=3.0.0",
"name": "io.github.stavshamir.springwolf.example.amqp.dtos.AnotherPayloadDto",
"title": "AnotherPayloadDto",
"description": "Another payload model",
"payload": {
"$ref": "#/components/schemas/io.github.stavshamir.springwolf.example.amqp.dtos.AnotherPayloadDto"
},
"headers": {
"$ref": "#/components/schemas/HeadersNotDocumented"
},
"bindings": {
"amqp": {
"bindingVersion": "0.2.0"
}
}
}
},
"bindings": {
"amqp": {
"is": "routingKey",
"exchange": {
"name": "example-consumer-topic-exchange",
"vhost": "/"
},
"bindingVersion": "0.2.0"
}
}
},
"example-producer-channel": {
"subscribe": {
"operationId": "example-producer-channel_subscribe",
"description": "example-producer-channel-description",
"bindings": {
"amqp": {
"cc": [
"example-topic-routing-key"
],
"bindingVersion": "0.2.0"
}
},
"message": {
"schemaFormat": "application/vnd.oai.openapi+json;version=3.0.0",
"name": "io.github.stavshamir.springwolf.example.amqp.dtos.AnotherPayloadDto",
"title": "AnotherPayloadDto",
"description": "Another payload model",
"payload": {
"$ref": "#/components/schemas/io.github.stavshamir.springwolf.example.amqp.dtos.AnotherPayloadDto"
},
"headers": {
"$ref": "#/components/schemas/HeadersNotDocumented"
},
"bindings": {
"amqp": {
"bindingVersion": "0.2.0"
}
}
}
},
"bindings": {
"amqp": {
"is": "routingKey",
"exchange": {
"name": "example-topic-exchange",
"vhost": "/"
},
"bindingVersion": "0.2.0"
}
}
},
"example-producer-channel-publisher": {
"subscribe": {
"operationId": "example-producer-channel-publisher_subscribe",
Expand Down
Loading

0 comments on commit cf978b4

Please sign in to comment.