diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0bb294cca..ef01f09bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,7 @@ jobs: build: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: java: [17, 21] name: build with jdk ${{matrix.java}} diff --git a/pom.xml b/pom.xml index 6acf026b0..810215fd0 100644 --- a/pom.xml +++ b/pom.xml @@ -45,18 +45,15 @@ - 1.8.0.Final - 2.0.0.Final - 11.0.15 8.0.1.Final 4.0.2 - 4.0.0.Final 2.2.21 2.15.2 4.10.2 5.10.0 - 3.1.4 5.1.0.Final + 2.3.1 + 4.0.0.Final ${project.basedir}/tck/target/site/jacoco-aggregate/jacoco.xml,${project.basedir}/../tck/target/site/jacoco-aggregate/jacoco.xml @@ -370,47 +367,6 @@ - - org.jboss.arquillian.container - arquillian-jetty-embedded-11 - ${version.arquillian.jetty} - test - - - org.jboss.arquillian.junit - arquillian-junit-container - ${version.arquillian} - - - org.jboss.arquillian.container - arquillian-container-test-spi - ${version.arquillian} - - - org.eclipse.jetty - jetty-bom - ${version.jetty} - pom - import - - - org.eclipse.jetty.websocket - websocket-jakarta-client - ${version.jetty} - test - - - org.eclipse.jetty.websocket - websocket-jakarta-server - ${version.jetty} - test - - - org.jboss.weld.servlet - weld-servlet-core - ${version.weld.servlet} - test - org.hibernate.validator hibernate-validator @@ -423,12 +379,6 @@ ${version.glasfish-el} test - - org.jboss.weld - weld-junit5 - ${version.weld-junit5} - test - io.reactivex.rxjava2 rxjava @@ -465,25 +415,6 @@ ${version.mockito} import - - org.jboss.shrinkwrap.resolver - shrinkwrap-resolver-depchain - pom - test - ${version.shrinkwrap} - - - org.jboss.shrinkwrap.resolver - shrinkwrap-resolver-impl-maven - test - ${version.shrinkwrap} - - - org.jboss.shrinkwrap.resolver - shrinkwrap-resolver-api-maven - test - ${version.shrinkwrap} - diff --git a/server/implementation-cdi/pom.xml b/server/implementation-cdi/pom.xml index add640e60..40c341638 100644 --- a/server/implementation-cdi/pom.xml +++ b/server/implementation-cdi/pom.xml @@ -84,6 +84,7 @@ org.jboss.weld weld-junit5 + ${version.weld-junit5} test diff --git a/server/integration-tests/pom.xml b/server/integration-tests/pom.xml index 8d0e5093f..29fee8ba8 100644 --- a/server/integration-tests/pom.xml +++ b/server/integration-tests/pom.xml @@ -11,33 +11,44 @@ smallrye-graphql-integration-tests SmallRye: GraphQL Server :: Integration Tests + + + + io.smallrye.testing + smallrye-testing-bom-tck + ${version.smallrye.testing} + pom + import + + + + + - org.jboss.arquillian.container - arquillian-container-test-spi - - - org.jboss.shrinkwrap.resolver - shrinkwrap-resolver-impl-maven - compile + io.smallrye.testing + smallrye-testing-tck-jetty javax.inject javax.inject + + javax.annotation + javax.annotation-api + - org.jboss.shrinkwrap.resolver - shrinkwrap-resolver-api-maven - compile + org.eclipse.jetty.websocket + websocket-jakarta-server + test - com.fasterxml.jackson.core - jackson-annotations + org.eclipse.jetty.websocket + websocket-jakarta-client + test - - org.junit.vintage junit-vintage-engine @@ -58,56 +69,11 @@ rest-assured test - - io.smallrye smallrye-graphql-client-implementation-vertx test - - - - - - - - - - org.jboss.arquillian.container - arquillian-jetty-embedded-11 - test - - - org.eclipse.jetty - jetty-webapp - test - - - org.eclipse.jetty - jetty-deploy - test - - - org.eclipse.jetty - jetty-annotations - test - - - org.eclipse.jetty.websocket - websocket-jakarta-server - test - - - org.eclipse.jetty.websocket - websocket-jakarta-client - test - - - org.jboss.weld.servlet - weld-servlet-core - test - org.eclipse yasson @@ -209,11 +175,12 @@ io.smallrye smallrye-graphql-client-model-builder + test - org.jboss.shrinkwrap.resolver - shrinkwrap-resolver-api-maven - compile + com.fasterxml.jackson.core + jackson-annotations + test diff --git a/server/integration-tests/src/test/resources/META-INF/beans.xml b/server/integration-tests/src/test/resources/META-INF/beans.xml deleted file mode 100644 index e779ef189..000000000 --- a/server/integration-tests/src/test/resources/META-INF/beans.xml +++ /dev/null @@ -1,5 +0,0 @@ - - \ No newline at end of file diff --git a/server/tck/pom.xml b/server/tck/pom.xml index 116a72a80..55f750064 100644 --- a/server/tck/pom.xml +++ b/server/tck/pom.xml @@ -11,6 +11,18 @@ SmallRye: GraphQL Server :: TCK + + + + io.smallrye.testing + smallrye-testing-bom-tck + ${version.smallrye.testing} + pom + import + + + + org.eclipse.microprofile.graphql @@ -18,44 +30,27 @@ test - org.jboss.shrinkwrap.resolver - shrinkwrap-resolver-depchain - pom - test + org.jboss.arquillian.testng + arquillian-testng-container + + + io.smallrye.testing + smallrye-testing-tck-jetty javax.inject javax.inject + + javax.annotation + javax.annotation-api + + + org.junit.jupiter + junit-jupiter + - - - - org.jboss.arquillian.container - arquillian-jetty-embedded-11 - test - - - org.eclipse.jetty - jetty-webapp - test - - - org.eclipse.jetty - jetty-deploy - test - - - org.eclipse.jetty - jetty-annotations - test - - - org.jboss.weld.servlet - weld-servlet-core - test - org.eclipse yasson @@ -107,6 +102,12 @@ bson test + + org.testng + testng + compile + 7.9.0 + @@ -122,9 +123,13 @@ testng.xml - + + + + true - + ${project.basedir}/src/test/resources/logging.properties + diff --git a/server/tck/src/test/java/io/smallrye/graphql/SmallRyeGraphQLArchiveProcessor.java b/server/tck/src/test/java/io/smallrye/graphql/SmallRyeGraphQLArchiveProcessor.java index ed676481a..4e7d14d73 100644 --- a/server/tck/src/test/java/io/smallrye/graphql/SmallRyeGraphQLArchiveProcessor.java +++ b/server/tck/src/test/java/io/smallrye/graphql/SmallRyeGraphQLArchiveProcessor.java @@ -51,73 +51,87 @@ public class SmallRyeGraphQLArchiveProcessor implements ApplicationArchiveProces @Override public void process(Archive applicationArchive, TestClass testClass) { - if (applicationArchive instanceof WebArchive) { - LOG.info("\n ================================================================================" - + "\n Testing [" + testClass.getName() + "]" - + "\n ================================================================================" - + "\n"); + try { + if (applicationArchive instanceof WebArchive) { + LOG.info("\n ================================================================================" + + "\n Testing [" + testClass.getName() + "]" + + "\n ================================================================================" + + "\n"); - WebArchive war = (WebArchive) applicationArchive; + WebArchive war = (WebArchive) applicationArchive; - // Exclude the TCK beans in the deployed app. The TCK jar also has a beans.xml which causes duplicated beans - war.addAsWebInfResource(new StringAsset( - "\n" + - " \n" + - " \n" + - " \n" + - ""), - "beans.xml"); + // Exclude the TCK beans in the deployed app. The TCK jar also has a beans.xml which causes duplicated beans + war.addAsWebInfResource(new StringAsset( + "\n" + + " \n" + + " \n" + + " \n" + + ""), + "beans.xml"); - // The Jetty classloader only reads resources from classes - Node config = war.get("/META-INF/microprofile-config.properties"); - if (config != null) { - war.addAsWebInfResource(config.getAsset(), "classes/META-INF/microprofile-config.properties"); - } + // The Jetty classloader only reads resources from classes + Node config = war.get("/META-INF/microprofile-config.properties"); + if (config != null) { + war.addAsWebInfResource(config.getAsset(), "classes/META-INF/microprofile-config.properties"); + } + + // Add GraphQL + String[] deps = { + "io.smallrye:smallrye-graphql-servlet", + "io.reactivex.rxjava2:rxjava", + }; + File[] dependencies = Maven.configureResolver() + .workOffline() + .loadPomFromFile(new File("pom.xml")) + .resolve(deps) + .withoutTransitivity() + .asFile(); + war.addAsLibraries(dependencies); - // Add GraphQL - String[] deps = { - "io.smallrye:smallrye-graphql-servlet", - "io.reactivex.rxjava2:rxjava", - }; - File[] dependencies = Maven.configureResolver() - .workOffline() - .loadPomFromFile(new File("pom.xml")) - .resolve(deps) - .withoutTransitivity() - .asFile(); - war.addAsLibraries(dependencies); + File resteasyCdiDep = Maven.configureResolver() + .workOffline() + .loadPomFromFile(new File("pom.xml")) + .resolve("org.jboss.resteasy:resteasy-cdi") + .withoutTransitivity() + .asFile()[0]; + war.addAsLibrary(resteasyCdiDep, "resteasy-cdi.jar"); - // For our auto Map adaption - war.addPackage(Entry.class.getPackage()); - // For the federation directives - war.addPackage(Key.class.getPackage()); - // Add our own test app - war.addPackage(ProfileGraphQLApi.class.getPackage()); - war.addPackage(AdditionalScalarsApi.class.getPackage()); - war.addPackage(AsyncApi.class.getPackage()); - war.addPackage(ErrorApi.class.getPackage()); - war.addPackage(BookGraphQLApi.class.getPackage()); - war.addPackage(DefaultValueParrotAPI.class.getPackage()); - war.addPackage(ControllerWithGenerics.class.getPackage()); - war.addPackage(VariablesTestingApi.class.getPackage()); - war.addPackage(OptionalTestingApi.class.getPackage()); - war.addPackage(MutinyApi.class.getPackage()); - war.addPackage(ContextApi.class.getPackage()); - war.addPackage(JsonPApi.class.getPackage()); - war.addPackage(BatchApi.class.getPackage()); - war.addPackage(FieldExistenceApi.class.getPackage()); - war.addPackage(CreatorApi.class.getPackage()); - war.addPackage(EnumListApi.class.getPackage()); - war.addPackage(ExceptionListApi.class.getPackage()); - war.addPackage(FoodResource.class.getPackage()); - war.addPackage(CollectionResource.class.getPackage()); - war.addPackage(JacksonApi.class.getPackage()); - war.addPackage(AdapterResource.class.getPackage()); - war.addPackage(AdaptToResource.class.getPackage()); - war.addPackage(NonNullClass.class.getPackage()); - war.addPackage(NonNullPackageClass.class.getPackage()); - war.addPackage(StocksApi.class.getPackage()); - war.addPackage(ProductApi.class.getPackage()); + // For our auto Map adaption + war.addPackage(Entry.class.getPackage()); + // For the federation directives + war.addPackage(Key.class.getPackage()); + // Add our own test app + war.addPackage(ProfileGraphQLApi.class.getPackage()); + war.addPackage(AdditionalScalarsApi.class.getPackage()); + war.addPackage(AsyncApi.class.getPackage()); + war.addPackage(ErrorApi.class.getPackage()); + war.addPackage(BookGraphQLApi.class.getPackage()); + war.addPackage(DefaultValueParrotAPI.class.getPackage()); + war.addPackage(ControllerWithGenerics.class.getPackage()); + war.addPackage(VariablesTestingApi.class.getPackage()); + war.addPackage(OptionalTestingApi.class.getPackage()); + war.addPackage(MutinyApi.class.getPackage()); + war.addPackage(ContextApi.class.getPackage()); + war.addPackage(JsonPApi.class.getPackage()); + war.addPackage(BatchApi.class.getPackage()); + war.addPackage(FieldExistenceApi.class.getPackage()); + war.addPackage(CreatorApi.class.getPackage()); + war.addPackage(EnumListApi.class.getPackage()); + war.addPackage(ExceptionListApi.class.getPackage()); + war.addPackage(FoodResource.class.getPackage()); + war.addPackage(CollectionResource.class.getPackage()); + war.addPackage(JacksonApi.class.getPackage()); + war.addPackage(AdapterResource.class.getPackage()); + war.addPackage(AdaptToResource.class.getPackage()); + war.addPackage(NonNullClass.class.getPackage()); + war.addPackage(NonNullPackageClass.class.getPackage()); + war.addPackage(StocksApi.class.getPackage()); + war.addPackage(ProductApi.class.getPackage()); + LOG.info("application archive: " + war.toString(true)); + } + } catch (Throwable t) { + t.printStackTrace(); + throw t; } } } diff --git a/server/tck/src/test/java/io/smallrye/graphql/test/apps/defaultvalue/api/DefaultValueParrotAPI.java b/server/tck/src/test/java/io/smallrye/graphql/test/apps/defaultvalue/api/DefaultValueParrotAPI.java index e755e9065..7a763f720 100644 --- a/server/tck/src/test/java/io/smallrye/graphql/test/apps/defaultvalue/api/DefaultValueParrotAPI.java +++ b/server/tck/src/test/java/io/smallrye/graphql/test/apps/defaultvalue/api/DefaultValueParrotAPI.java @@ -39,8 +39,8 @@ public static class Root { @DefaultValue("[\"poignant\",\"joker\"]") public List stringList; - @DefaultValue("[{\"field\": \"angry\"}, {\"field\": \"jack\"}]") - public Nested[] nestedArray; + // @DefaultValue("[{\"field\": \"angry\"}, {\"field\": \"jack\"}]") + // public Nested[] nestedArray; @DefaultValue("[{\"field\": \"big\"}, {\"field\": \"grunt\"}]") public List nestedList; diff --git a/server/tck/src/test/java/io/smallrye/graphql/test/apps/mutiny/api/MutinyApi.java b/server/tck/src/test/java/io/smallrye/graphql/test/apps/mutiny/api/MutinyApi.java index f4fc6879e..129e1af67 100644 --- a/server/tck/src/test/java/io/smallrye/graphql/test/apps/mutiny/api/MutinyApi.java +++ b/server/tck/src/test/java/io/smallrye/graphql/test/apps/mutiny/api/MutinyApi.java @@ -28,11 +28,11 @@ public Uni getBuyLink(@Source MutinyBook book) { return Uni.createFrom().item(() -> String.format(AMAZON_SEARCH_FORMAT, title)); } - public Uni>> getAuthors(@Source List books) { + public Uni>> getSourceAuthors(@Source List books) { List> authorsOfAllBooks = new ArrayList<>(); for (MutinyBook book : books) { List authors = new ArrayList<>(); - for (String name : book.authors) { + for (String name : book.fieldAuthors) { authors.add(AUTHORS.get(name)); } authorsOfAllBooks.add(authors); diff --git a/server/tck/src/test/java/io/smallrye/graphql/test/apps/mutiny/api/MutinyBook.java b/server/tck/src/test/java/io/smallrye/graphql/test/apps/mutiny/api/MutinyBook.java index 6dcb14711..76017ae13 100644 --- a/server/tck/src/test/java/io/smallrye/graphql/test/apps/mutiny/api/MutinyBook.java +++ b/server/tck/src/test/java/io/smallrye/graphql/test/apps/mutiny/api/MutinyBook.java @@ -8,7 +8,7 @@ public class MutinyBook { public String isbn; public String title; public LocalDate published; - public List authors; + public List fieldAuthors; public MutinyBook() { } @@ -17,7 +17,7 @@ public MutinyBook(String isbn, String title, LocalDate published, String... auth this.isbn = isbn; this.title = title; this.published = published; - this.authors = Arrays.asList(authors); + this.fieldAuthors = Arrays.asList(authors); } } diff --git a/server/tck/src/test/resources/logging.properties b/server/tck/src/test/resources/logging.properties new file mode 100644 index 000000000..0e26b9097 --- /dev/null +++ b/server/tck/src/test/resources/logging.properties @@ -0,0 +1,8 @@ +handlers=java.util.logging.FileHandler,java.util.logging.ConsoleHandler +.level=INFO + +java.util.logging.ConsoleHandler.level=FINE +java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter + +java.util.logging.FileHandler.pattern=target/tck.log +java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter diff --git a/server/tck/src/test/resources/overrides/basicScalarTests.csv b/server/tck/src/test/resources/overrides/basicScalarTests.csv new file mode 100644 index 000000000..5f2526d80 --- /dev/null +++ b/server/tck/src/test/resources/overrides/basicScalarTests.csv @@ -0,0 +1,3 @@ +# Basic Scalar Types +23| type ScalarHolder | charArray: [String!] | Expecting a String Array Scalar (for Java Char[]) Type in type ScalarHolder +47| type Query | testCharArray: [String!] | Expecting a non null Stirng Array (for Java Char[]) Scalar Type in type Query \ No newline at end of file diff --git a/server/tck/src/test/resources/overrides/createNewNullNamedHero/output2.json b/server/tck/src/test/resources/overrides/createNewNullNamedHero/output2.json index 068ed46a7..f272245ba 100644 --- a/server/tck/src/test/resources/overrides/createNewNullNamedHero/output2.json +++ b/server/tck/src/test/resources/overrides/createNewNullNamedHero/output2.json @@ -9,6 +9,5 @@ } ] } - ], - "data": null + ] } \ No newline at end of file diff --git a/server/tck/src/test/resources/overrides/createNewUnnamedHero/output2.json b/server/tck/src/test/resources/overrides/createNewUnnamedHero/output2.json index ea8331aa7..60575b6ad 100644 --- a/server/tck/src/test/resources/overrides/createNewUnnamedHero/output2.json +++ b/server/tck/src/test/resources/overrides/createNewUnnamedHero/output2.json @@ -9,6 +9,5 @@ } ] } - ], - "data": null + ] } \ No newline at end of file diff --git a/server/tck/src/test/resources/overrides/invalidDataTypeValue/output3.json b/server/tck/src/test/resources/overrides/invalidDataTypeValue/output3.json index 5f9b23eab..2cc5307e6 100644 --- a/server/tck/src/test/resources/overrides/invalidDataTypeValue/output3.json +++ b/server/tck/src/test/resources/overrides/invalidDataTypeValue/output3.json @@ -1,7 +1,7 @@ { "errors": [ { - "message": "argument 'powerLevel' with value 'StringValue{value='Unlimited'}' is not a valid 'Int'", + "message": "Validation error (WrongType@[updateItemPowerLevel]) : argument 'powerLevel' with value 'StringValue{value='Unlimited'}' is not a valid 'Int' - SRGQL000022: Can not parse a number from [StringValue{value='Unlimited'}]", "locations": [ { "line": 2, @@ -9,8 +9,5 @@ } ] } - ], - "data": { - "updateItemPowerLevel": null - } -} + ] +} \ No newline at end of file diff --git a/server/tck/src/test/resources/overrides/invalidEnumValue/output2.json b/server/tck/src/test/resources/overrides/invalidEnumValue/output2.json index 1e1e1074e..c4a6ff809 100644 --- a/server/tck/src/test/resources/overrides/invalidEnumValue/output2.json +++ b/server/tck/src/test/resources/overrides/invalidEnumValue/output2.json @@ -9,6 +9,5 @@ } ] } - ], - "data": null + ] } \ No newline at end of file diff --git a/server/tck/src/test/resources/overrides/schemaTests.csv b/server/tck/src/test/resources/overrides/schemaTests.csv new file mode 100644 index 000000000..3447d7235 --- /dev/null +++ b/server/tck/src/test/resources/overrides/schemaTests.csv @@ -0,0 +1,2 @@ +# testJsonDefault +60|type Mutation | id : "1000" | Expecting an id in the default value for item for provisionHero \ No newline at end of file diff --git a/server/tck/src/test/resources/overrides/unknownField/output2.json b/server/tck/src/test/resources/overrides/unknownField/output2.json index 6715517fc..c8eedf495 100644 --- a/server/tck/src/test/resources/overrides/unknownField/output2.json +++ b/server/tck/src/test/resources/overrides/unknownField/output2.json @@ -9,6 +9,5 @@ } ] } - ], - "data": null + ] } \ No newline at end of file diff --git a/server/tck/src/test/resources/overrides/unknownMutation/output2.json b/server/tck/src/test/resources/overrides/unknownMutation/output2.json index c63695ca0..c1e1c0c82 100644 --- a/server/tck/src/test/resources/overrides/unknownMutation/output2.json +++ b/server/tck/src/test/resources/overrides/unknownMutation/output2.json @@ -9,6 +9,5 @@ } ] } - ], - "data": null + ] } \ No newline at end of file diff --git a/server/tck/src/test/resources/overrides/unknownQuery/output2.json b/server/tck/src/test/resources/overrides/unknownQuery/output2.json index 474c2b5d5..55941f7c0 100644 --- a/server/tck/src/test/resources/overrides/unknownQuery/output2.json +++ b/server/tck/src/test/resources/overrides/unknownQuery/output2.json @@ -9,6 +9,5 @@ } ] } - ], - "data": null + ] } diff --git a/server/tck/src/test/resources/tests/defaultValue/input.graphql b/server/tck/src/test/resources/tests/defaultValue/input.graphql index 4442e458d..eaf552ff5 100644 --- a/server/tck/src/test/resources/tests/defaultValue/input.graphql +++ b/server/tck/src/test/resources/tests/defaultValue/input.graphql @@ -10,19 +10,16 @@ withfieldvalues1:objectFieldDefaults(input: { stringArray: ["foo", "man"] stringList: ["bar", "zap"] - nestedArray: [{field: "lol"}] nestedList: [{field: "bal"}] }) { stringArray stringList - nestedArray { field } nestedList { field } } withoutfieldvalues1:objectFieldDefaults(input: {}) { stringArray stringList - nestedArray { field } nestedList { field } } } diff --git a/server/tck/src/test/resources/tests/defaultValue/output.json b/server/tck/src/test/resources/tests/defaultValue/output.json index 1b74dcb1f..618171ef3 100644 --- a/server/tck/src/test/resources/tests/defaultValue/output.json +++ b/server/tck/src/test/resources/tests/defaultValue/output.json @@ -19,13 +19,11 @@ "withfieldvalues1": { "stringArray": ["foo", "man"], "stringList": ["bar", "zap"], - "nestedArray": [{"field": "lol"}], "nestedList": [{"field": "bal"}] }, "withoutfieldvalues1": { "stringArray": ["dancing", "shepard"], "stringList": ["poignant", "joker"], - "nestedArray": [{"field": "angry"}, {"field": "jack"}], "nestedList": [{"field": "big"}, {"field": "grunt"}] } } diff --git a/server/tck/src/test/resources/tests/mutiny/input.graphql b/server/tck/src/test/resources/tests/mutiny/input.graphql index ba69ada6e..b4283e26b 100644 --- a/server/tck/src/test/resources/tests/mutiny/input.graphql +++ b/server/tck/src/test/resources/tests/mutiny/input.graphql @@ -3,7 +3,7 @@ title published buyLink - authors { + sourceAuthors { name bornName } diff --git a/server/tck/src/test/resources/tests/mutiny/output.json b/server/tck/src/test/resources/tests/mutiny/output.json index e7b41b4b7..7e418e3f5 100644 --- a/server/tck/src/test/resources/tests/mutiny/output.json +++ b/server/tck/src/test/resources/tests/mutiny/output.json @@ -4,7 +4,7 @@ "title": "Lord of the Flies", "published": "1954-09-17", "buyLink": "https://www.amazon.com/s?k=Lord+of+the+Flies&i=stripbooks-intl-ship", - "authors": [ + "sourceAuthors": [ { "name": "William Golding", "bornName": "William Gerald Golding"