This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push: new f882231 Fix #901 GraphQLResource should read from the classpath instead from the filesystem new 3924e16 Merge pull request #902 from ppalaga/i901 f882231 is described below commit f8822312e39115338a9827525aa6646aebce576f Author: Peter Palaga <ppal...@redhat.com> AuthorDate: Wed Mar 18 11:38:28 2020 +0100 Fix #901 GraphQLResource should read from the classpath instead from the filesystem --- .../camel/quarkus/component/graphql/it/GraphQLResource.java | 13 +++++++++++-- .../graphql/src/main/resources/application.properties | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/integration-tests/graphql/src/main/java/org/apache/camel/quarkus/component/graphql/it/GraphQLResource.java b/integration-tests/graphql/src/main/java/org/apache/camel/quarkus/component/graphql/it/GraphQLResource.java index 1f85652..e419119 100644 --- a/integration-tests/graphql/src/main/java/org/apache/camel/quarkus/component/graphql/it/GraphQLResource.java +++ b/integration-tests/graphql/src/main/java/org/apache/camel/quarkus/component/graphql/it/GraphQLResource.java @@ -16,7 +16,10 @@ */ package org.apache.camel.quarkus.component.graphql.it; -import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.List; import java.util.concurrent.CompletableFuture; @@ -58,7 +61,13 @@ public class GraphQLResource { public void setupRouter(@Observes Router router) { SchemaParser schemaParser = new SchemaParser(); - TypeDefinitionRegistry typeDefinitionRegistry = schemaParser.parse(new File("target/classes/graphql/schema.graphql")); + final TypeDefinitionRegistry typeDefinitionRegistry; + try (Reader r = new InputStreamReader(getClass().getClassLoader().getResourceAsStream("graphql/schema.graphql"), + StandardCharsets.UTF_8)) { + typeDefinitionRegistry = schemaParser.parse(r); + } catch (IOException e) { + throw new RuntimeException(e); + } DataFetcher<CompletionStage<Book>> dataFetcher = environment -> { CompletableFuture<Book> completableFuture = new CompletableFuture<>(); diff --git a/integration-tests/graphql/src/main/resources/application.properties b/integration-tests/graphql/src/main/resources/application.properties index adb4df9..6431a6e 100644 --- a/integration-tests/graphql/src/main/resources/application.properties +++ b/integration-tests/graphql/src/main/resources/application.properties @@ -16,3 +16,4 @@ ## --------------------------------------------------------------------------- quarkus.camel.graphql.query-files=classpath:graphql/bookQuery.graphql +quarkus.native.additional-build-args = -H:IncludeResources=graphql/schema.graphql