Skip to content

Commit

Permalink
KOGITO-9415 Added disabled test for AsyncAPI
Browse files Browse the repository at this point in the history
Signed-off-by: Helber Belmiro <[email protected]>
  • Loading branch information
hbelmiro committed Jul 19, 2023
1 parent 2a72d21 commit c3f3b23
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi</artifactId>
</dependency>

<dependency>
<groupId>io.quarkiverse.asyncapi</groupId>
<artifactId>quarkus-asyncapi</artifactId>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging-kafka</artifactId>
</dependency>

<dependency>
<groupId>io.grpc</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
asyncapi: '2.0.0'
id: 'oneConsumer'
info:
title: Kafka Application
version: '1.0.0'
description: Kafka Application
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
servers:
production:
url: localhost:9092
description: Development server
protocol: kafka
protocolVersion: '1.0.0'
channels:
wait:
description: A message channel
subscribe:
operationId: wait
summary: Get messages
message:
$ref: '#/components/messages/message'
publish:
operationId: sendWait
summary: Send messages
message:
$ref: '#/components/messages/message'
components:
messages:
message:
name: message
title: A message
summary: A message
contentType: application/json
payload:
$ref: "#/components/schemas/message"
schemas:
message:
type: object
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.kie.kogito.test.utils.SocketUtils;
Expand All @@ -35,6 +37,7 @@
import io.restassured.http.ContentType;

import static io.restassured.RestAssured.given;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.CoreMatchers.containsString;

public class LiveReloadProcessorTest {
Expand Down Expand Up @@ -117,4 +120,31 @@ void testGrpc() throws InterruptedException, IOException {
server.awaitTermination();
}
}

@Test
@Disabled("Disabled until https://issues.redhat.com/browse/KOGITO-9614 is resolved")
void testAsyncApi() throws IOException {
given()
.contentType(ContentType.JSON)
.when()
.body(Collections.singletonMap("workflowdata", Collections.emptyMap()))
.post("/asyncEventPublisher")
.then()
.statusCode(404);

try (FileInputStream inputStream = new FileInputStream("src/test/resources/asyncPublisher.sw.json")) {
test.addResourceFile("asyncPublisher.sw.json", new String(Objects.requireNonNull(inputStream).readAllBytes()));
}

String id = given()
.contentType(ContentType.JSON)
.when()
.body(Collections.singletonMap("workflowdata", Collections.emptyMap()))
.post("/asyncEventPublisher")
.then()
.statusCode(201)
.extract().path("id");

assertThat(id).isNotBlank();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"id": "asyncEventPublisher",
"version": "1.0",
"name": "Workflow async consumer test",
"description": "An test that verifies an async api spec file with a publish channel is really publishing",
"start": "publishEvent",
"functions": [
{
"name": "publishEvent",
"type": "asyncapi",
"operation": "specs/asyncAPI.yaml#sendWait"
}
],
"states": [
{
"name": "publishEvent",
"type": "operation",
"actions": [
{
"name": "publishEvent",
"functionRef": "publishEvent"
}
],
"end": true
}
]
}

0 comments on commit c3f3b23

Please sign in to comment.