Skip to content

Commit

Permalink
Merge pull request quarkusio#20450 from jmartisk/smallrye-graphql-1.3.4
Browse files Browse the repository at this point in the history
SmallRye GraphQL 1.3.4
  • Loading branch information
phillip-kruger authored Sep 29, 2021
2 parents 04801d9 + f2bfd9c commit b6a313c
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<smallrye-health.version>3.1.1</smallrye-health.version>
<smallrye-metrics.version>3.0.1</smallrye-metrics.version>
<smallrye-open-api.version>2.1.15</smallrye-open-api.version>
<smallrye-graphql.version>1.3.3</smallrye-graphql.version>
<smallrye-graphql.version>1.3.4</smallrye-graphql.version>
<smallrye-opentracing.version>2.0.1</smallrye-opentracing.version>
<smallrye-fault-tolerance.version>5.2.1</smallrye-fault-tolerance.version>
<smallrye-jwt.version>3.3.0</smallrye-jwt.version>
Expand Down
17 changes: 17 additions & 0 deletions integration-tests/smallrye-graphql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-graphql</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-fault-tolerance</artifactId>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
Expand All @@ -46,6 +50,19 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-fault-tolerance-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package io.quarkus.it.smallrye.graphql;

import java.util.concurrent.TimeUnit;

import javax.inject.Singleton;

import org.eclipse.microprofile.faulttolerance.Timeout;

@Singleton
public class FaultTolerantService {

@Timeout(10)
public void causeTimeout() {
try {
TimeUnit.MILLISECONDS.sleep(2500);
} catch (InterruptedException e) {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import java.util.Collection;
import java.util.List;

import javax.inject.Inject;

import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.eclipse.microprofile.graphql.GraphQLApi;
import org.eclipse.microprofile.graphql.Mutation;
Expand Down Expand Up @@ -52,4 +54,13 @@ public Collection<Greeting> buildInOptionsCollection(@Source Greeting greeting)
public Farewell farewell() {
return new Farewell();
}

@Inject
FaultTolerantService service;

@Query
public String faultTolerance() {
service.causeTimeout();
return "PASSED";
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
message=Production
message=Production
quarkus.smallrye-graphql.show-runtime-exception-message=org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.quarkus.it.smallrye.graphql;

import io.quarkus.test.junit.NativeImageTest;

@NativeImageTest
public class GraphQLAndFaultToleranceIT extends GraphQLAndFaultToleranceTest {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package io.quarkus.it.smallrye.graphql;

import static io.quarkus.it.smallrye.graphql.PayloadCreator.MEDIATYPE_JSON;
import static io.quarkus.it.smallrye.graphql.PayloadCreator.getPayload;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsString;

import org.junit.jupiter.api.Test;

import io.quarkus.test.junit.QuarkusTest;

@QuarkusTest
public class GraphQLAndFaultToleranceTest {

@Test
public void testGraphQLAndFaultToleranceTogether() {
String helloRequest = getPayload("{\n" +
" faultTolerance\n" +
"}");

given()
.when()
.accept(MEDIATYPE_JSON)
.contentType(MEDIATYPE_JSON)
.body(helloRequest)
.post("/graphql")
.then()
.statusCode(200)
.body("errors[0].message", containsString("Timeout"));
}
}

0 comments on commit b6a313c

Please sign in to comment.