From e5c96b945d5407bf0d2a1a77bf0d68b65c8bebc8 Mon Sep 17 00:00:00 2001 From: Marek Skacelik Date: Mon, 25 Nov 2024 09:31:35 +0100 Subject: [PATCH] Moved JDK16 tests to normal tests --- .github/workflows/release.yml | 9 +- pom.xml | 15 -- server/integration-tests-jdk16/pom.xml | 246 ------------------ .../SmallRyeGraphQLArchiveProcessor.java | 39 --- .../tests/SmallRyeGraphQLExtension.java | 17 -- ...boss.arquillian.core.spi.LoadableExtension | 1 - .../src/test/resources/META-INF/beans.xml | 5 - .../client/dynamic/NestedRecordsTest.java | 91 +++++-- .../RecordAsInputToDynamicClientTest.java | 17 +- .../tests/client/dynamic/RecordTest.java | 37 +-- .../RecordAsInputToTypesafeClientTest.java | 13 +- 11 files changed, 103 insertions(+), 387 deletions(-) delete mode 100644 server/integration-tests-jdk16/pom.xml delete mode 100644 server/integration-tests-jdk16/src/main/java/io/smallrye/graphql/tests/SmallRyeGraphQLArchiveProcessor.java delete mode 100644 server/integration-tests-jdk16/src/main/java/io/smallrye/graphql/tests/SmallRyeGraphQLExtension.java delete mode 100644 server/integration-tests-jdk16/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension delete mode 100644 server/integration-tests-jdk16/src/test/resources/META-INF/beans.xml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9716578ff..a0b44e18a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,7 +37,7 @@ jobs: - name: Install graphviz run: sudo apt install graphviz - + - name: maven release ${{steps.metadata.outputs.current-version}} env: MAVEN_DEPLOY_USERNAME: ${{secrets.MAVEN_DEPLOY_USERNAME}} @@ -52,11 +52,10 @@ jobs: echo "version=${{steps.metadata.outputs.current-version}}" > tools/gradle-plugin/gradle.properties git add tools/gradle-plugin/gradle.properties git commit -m "Update Gradle plugin version" - # make sure the server/integration-tests-jdk16 gets its version updated too: include the jdk16plus profile - mvn -X -e -B release:prepare -Prelease -Pjdk16plus -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}} + mvn -X -e -B release:prepare -Prelease -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}} git checkout ${{github.base_ref}} git rebase release - mvn -X -e -B release:perform -Prelease -Pjdk16plus + mvn -X -e -B release:perform -Prelease git push git push --tags @@ -69,4 +68,4 @@ jobs: name: milestone release with: github-token: ${{secrets.GITHUB_TOKEN}} - milestone-title: ${{steps.metadata.outputs.current-version}} + milestone-title: ${{steps.metadata.outputs.current-version}} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 8dcf05dfc..6acf026b0 100644 --- a/pom.xml +++ b/pom.xml @@ -568,21 +568,6 @@ - - - jdk16plus - - [16,) - - - - server/integration-tests-jdk16 - - - release diff --git a/server/integration-tests-jdk16/pom.xml b/server/integration-tests-jdk16/pom.xml deleted file mode 100644 index 31ecc3c58..000000000 --- a/server/integration-tests-jdk16/pom.xml +++ /dev/null @@ -1,246 +0,0 @@ - - - - smallrye-graphql-server-parent - io.smallrye - 2.11.1-SNAPSHOT - - 4.0.0 - - smallrye-graphql-integration-tests-jdk16 - SmallRye: GraphQL Server :: Integration Tests :: Java 16+ tests - - - 16 - 16 - UTF-8 - - - - - org.jboss.arquillian.container - arquillian-container-test-spi - - - org.jboss.shrinkwrap.resolver - shrinkwrap-resolver-api-maven - compile - - - org.jboss.shrinkwrap.resolver - shrinkwrap-resolver-impl-maven - test - - - javax.inject - javax.inject - - - - - - - org.junit.vintage - junit-vintage-engine - test - - - org.jboss.arquillian.junit - arquillian-junit-container - test - - - org.assertj - assertj-core - test - - - io.rest-assured - 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 - test - - - jakarta.validation - jakarta.validation-api - test - - - org.eclipse.microprofile.config - microprofile-config-api - test - - - io.smallrye.config - smallrye-config - test - - - org.eclipse.microprofile.metrics - microprofile-metrics-api - test - - - io.smallrye - smallrye-metrics - test - - - org.eclipse.microprofile.context-propagation - microprofile-context-propagation-api - test - - - io.smallrye - smallrye-context-propagation - test - - - io.smallrye.reactive - mutiny - test - - - io.smallrye.reactive - mutiny-smallrye-context-propagation - test - - - org.hibernate.validator - hibernate-validator - test - - - org.glassfish - jakarta.el - test - - - org.eclipse.microprofile.graphql - microprofile-graphql-api - test - - - io.smallrye - smallrye-graphql-servlet - test - - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - - true - - - - org.apache.maven.plugins - maven-surefire-plugin - - false - 1 - - - - - net.revelc.code - impsort-maven-plugin - - true - - - - org.apache.maven.plugins - maven-compiler-plugin - - 16 - - true - - - - - - - - - release - - - - org.apache.maven.plugins - maven-compiler-plugin - - true - true - - - - - - - - - diff --git a/server/integration-tests-jdk16/src/main/java/io/smallrye/graphql/tests/SmallRyeGraphQLArchiveProcessor.java b/server/integration-tests-jdk16/src/main/java/io/smallrye/graphql/tests/SmallRyeGraphQLArchiveProcessor.java deleted file mode 100644 index ddb1c5b76..000000000 --- a/server/integration-tests-jdk16/src/main/java/io/smallrye/graphql/tests/SmallRyeGraphQLArchiveProcessor.java +++ /dev/null @@ -1,39 +0,0 @@ -package io.smallrye.graphql.tests; - -import java.io.File; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.Set; - -import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor; -import org.jboss.arquillian.test.spi.TestClass; -import org.jboss.shrinkwrap.api.Archive; -import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.jboss.shrinkwrap.resolver.api.maven.Maven; - -/** - * Creates the deployable unit with all the needed dependencies. - * - * @author Phillip Kruger (phillip.kruger@redhat.com) - */ -public class SmallRyeGraphQLArchiveProcessor implements ApplicationArchiveProcessor { - - @Override - public void process(Archive applicationArchive, TestClass testClass) { - - if (applicationArchive instanceof WebArchive) { - WebArchive testDeployment = (WebArchive) applicationArchive; - - final File[] dependencies = Maven.resolver() - .loadPomFromFile("pom.xml") - .resolve("io.smallrye:smallrye-graphql-servlet") - .withoutTransitivity() - .asFile(); - // Make sure it's unique - Set dependenciesSet = new LinkedHashSet<>(Arrays.asList(dependencies)); - testDeployment.addAsLibraries(dependenciesSet.toArray(new File[] {})); - } - - System.out.println(applicationArchive.toString(true)); - } -} diff --git a/server/integration-tests-jdk16/src/main/java/io/smallrye/graphql/tests/SmallRyeGraphQLExtension.java b/server/integration-tests-jdk16/src/main/java/io/smallrye/graphql/tests/SmallRyeGraphQLExtension.java deleted file mode 100644 index cdeb46137..000000000 --- a/server/integration-tests-jdk16/src/main/java/io/smallrye/graphql/tests/SmallRyeGraphQLExtension.java +++ /dev/null @@ -1,17 +0,0 @@ -package io.smallrye.graphql.tests; - -import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor; -import org.jboss.arquillian.core.spi.LoadableExtension; - -/** - * Activating the extension - * - * @author Phillip Kruger (phillip.kruger@redhat.com) - */ -public class SmallRyeGraphQLExtension implements LoadableExtension { - @Override - public void register(ExtensionBuilder builder) { - builder.service(ApplicationArchiveProcessor.class, SmallRyeGraphQLArchiveProcessor.class); - } - -} diff --git a/server/integration-tests-jdk16/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/server/integration-tests-jdk16/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension deleted file mode 100644 index a78f12fd9..000000000 --- a/server/integration-tests-jdk16/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension +++ /dev/null @@ -1 +0,0 @@ -io.smallrye.graphql.tests.SmallRyeGraphQLExtension \ No newline at end of file diff --git a/server/integration-tests-jdk16/src/test/resources/META-INF/beans.xml b/server/integration-tests-jdk16/src/test/resources/META-INF/beans.xml deleted file mode 100644 index e779ef189..000000000 --- a/server/integration-tests-jdk16/src/test/resources/META-INF/beans.xml +++ /dev/null @@ -1,5 +0,0 @@ - - \ No newline at end of file diff --git a/server/integration-tests/src/test/java/io/smallrye/graphql/tests/client/dynamic/NestedRecordsTest.java b/server/integration-tests/src/test/java/io/smallrye/graphql/tests/client/dynamic/NestedRecordsTest.java index d0edf7762..17ad8025b 100644 --- a/server/integration-tests/src/test/java/io/smallrye/graphql/tests/client/dynamic/NestedRecordsTest.java +++ b/server/integration-tests/src/test/java/io/smallrye/graphql/tests/client/dynamic/NestedRecordsTest.java @@ -1,10 +1,22 @@ -package io.smallrye.graphql.tests.records; +package io.smallrye.graphql.tests.client.dynamic; + +import static io.smallrye.graphql.client.core.Argument.arg; +import static io.smallrye.graphql.client.core.Argument.args; +import static io.smallrye.graphql.client.core.Document.document; +import static io.smallrye.graphql.client.core.Field.field; +import static io.smallrye.graphql.client.core.InputObject.inputObject; +import static io.smallrye.graphql.client.core.InputObjectField.prop; +import static io.smallrye.graphql.client.core.Operation.operation; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.net.URL; +import java.util.List; + +import jakarta.json.JsonArray; +import jakarta.json.JsonValue; +import jakarta.json.bind.annotation.JsonbCreator; -import io.smallrye.graphql.client.Response; -import io.smallrye.graphql.client.core.Document; -import io.smallrye.graphql.client.core.InputObject; -import io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClient; -import io.smallrye.graphql.client.vertx.dynamic.VertxDynamicGraphQLClientBuilder; import org.eclipse.microprofile.graphql.GraphQLApi; import org.eclipse.microprofile.graphql.Query; import org.jboss.arquillian.container.test.api.Deployment; @@ -12,27 +24,16 @@ import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import jakarta.json.JsonArray; -import jakarta.json.JsonObject; -import jakarta.json.JsonValue; -import jakarta.json.bind.annotation.JsonbCreator; -import java.net.URL; -import java.util.List; - -import static io.smallrye.graphql.client.core.Argument.arg; -import static io.smallrye.graphql.client.core.Argument.args; -import static io.smallrye.graphql.client.core.Document.document; -import static io.smallrye.graphql.client.core.Field.field; -import static io.smallrye.graphql.client.core.InputObject.inputObject; -import static io.smallrye.graphql.client.core.InputObjectField.prop; -import static io.smallrye.graphql.client.core.Operation.operation; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import io.smallrye.graphql.client.Response; +import io.smallrye.graphql.client.core.Document; +import io.smallrye.graphql.client.core.InputObject; +import io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClient; +import io.smallrye.graphql.client.vertx.dynamic.VertxDynamicGraphQLClientBuilder; @RunWith(Arquillian.class) @RunAsClient @@ -41,7 +42,7 @@ public class NestedRecordsTest { @Deployment public static WebArchive deployment() { return ShrinkWrap.create(WebArchive.class) - .addClasses(ParentRecord.class, ParentRecordWithList.class, TestRecord.class); + .addClasses(ParentRecord.class, ParentRecordWithList.class, ParentRecordWithArray.class, TestRecord.class); } @ArquillianResource @@ -68,6 +69,7 @@ public void testNestedRecordWithMissingFieldInQuery() throws Exception { } } + @Ignore("In Java 21 this test fails due to a bug (presumably) in the JSON-B implementation – Yasson)") @Test public void testNestedRecordWithListWithMissingFieldInQuery() throws Exception { try (DynamicGraphQLClient client = new VertxDynamicGraphQLClientBuilder() @@ -85,9 +87,6 @@ public void testNestedRecordWithListWithMissingFieldInQuery() throws Exception { field("needed"), field("notNeeded"))))); Response response = client.executeSync(query); - System.err.println("====================================="); - System.err.println(response); - System.err.println("====================================="); JsonArray echoedRecords = response.getData().getJsonObject("testParentWithList").getJsonArray("testRecords"); assertEquals("bla", echoedRecords.get(0).asJsonObject().getString("needed")); @@ -97,6 +96,32 @@ public void testNestedRecordWithListWithMissingFieldInQuery() throws Exception { } } + @Test + public void testNestedRecordWithArrayWithMissingFieldInQuery() throws Exception { + try (DynamicGraphQLClient client = new VertxDynamicGraphQLClientBuilder() + .url(testingURL.toString() + "graphql").build()) { + Document query = document(operation( + field("testParentWithArray", + args(arg("parent", + inputObject( + prop("testRecords", + new InputObject[] { + inputObject(prop("needed", "bla")), + inputObject(prop("needed", "bla2")) + })))), + field("testRecords", + field("needed"), + field("notNeeded"))))); + Response response = client.executeSync(query); + JsonArray echoedRecords = response.getData().getJsonObject("testParentWithArray").getJsonArray("testRecords"); + + assertEquals("bla", echoedRecords.get(0).asJsonObject().getString("needed")); + assertEquals(JsonValue.NULL, echoedRecords.get(0).asJsonObject().get("notNeeded")); + assertEquals("bla2", echoedRecords.get(1).asJsonObject().getString("needed")); + assertEquals(JsonValue.NULL, echoedRecords.get(1).asJsonObject().get("notNeeded")); + } + } + @Test public void testSimpleRecordWithMissingFieldInQuery() throws Exception { try (DynamicGraphQLClient client = new VertxDynamicGraphQLClientBuilder() @@ -127,6 +152,11 @@ public ParentRecordWithList testParentWithList(ParentRecordWithList parent) { return parent; } + @Query + public ParentRecordWithArray testParentWithArray(ParentRecordWithArray parent) { + return parent; + } + @Query public TestRecord echo(TestRecord testRecord) { return testRecord; @@ -148,6 +178,13 @@ public record ParentRecordWithList(String s, } } + public record ParentRecordWithArray(String s, + TestRecord[] testRecords) { + @JsonbCreator + public ParentRecordWithArray { + } + } + public record TestRecord(String needed, String notNeeded) { @JsonbCreator diff --git a/server/integration-tests/src/test/java/io/smallrye/graphql/tests/client/dynamic/RecordAsInputToDynamicClientTest.java b/server/integration-tests/src/test/java/io/smallrye/graphql/tests/client/dynamic/RecordAsInputToDynamicClientTest.java index 8780bafd5..540998a80 100644 --- a/server/integration-tests/src/test/java/io/smallrye/graphql/tests/client/dynamic/RecordAsInputToDynamicClientTest.java +++ b/server/integration-tests/src/test/java/io/smallrye/graphql/tests/client/dynamic/RecordAsInputToDynamicClientTest.java @@ -1,8 +1,10 @@ -package io.smallrye.graphql.tests.client; +package io.smallrye.graphql.tests.client.dynamic; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.net.URL; -import io.smallrye.graphql.client.Response; -import io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClient; -import io.smallrye.graphql.client.vertx.dynamic.VertxDynamicGraphQLClientBuilder; import org.eclipse.microprofile.graphql.GraphQLApi; import org.eclipse.microprofile.graphql.Query; import org.jboss.arquillian.container.test.api.Deployment; @@ -14,10 +16,9 @@ import org.junit.Test; import org.junit.runner.RunWith; -import java.net.URL; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import io.smallrye.graphql.client.Response; +import io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClient; +import io.smallrye.graphql.client.vertx.dynamic.VertxDynamicGraphQLClientBuilder; /** * Verify that dynamic clients can parse Java records from responses diff --git a/server/integration-tests/src/test/java/io/smallrye/graphql/tests/client/dynamic/RecordTest.java b/server/integration-tests/src/test/java/io/smallrye/graphql/tests/client/dynamic/RecordTest.java index d1eda39b5..1bbca0d5a 100644 --- a/server/integration-tests/src/test/java/io/smallrye/graphql/tests/client/dynamic/RecordTest.java +++ b/server/integration-tests/src/test/java/io/smallrye/graphql/tests/client/dynamic/RecordTest.java @@ -1,9 +1,19 @@ -package io.smallrye.graphql.tests.records; +package io.smallrye.graphql.tests.client.dynamic; + +import static io.smallrye.graphql.client.core.Argument.arg; +import static io.smallrye.graphql.client.core.Argument.args; +import static io.smallrye.graphql.client.core.Document.document; +import static io.smallrye.graphql.client.core.Field.field; +import static io.smallrye.graphql.client.core.InputObject.inputObject; +import static io.smallrye.graphql.client.core.InputObjectField.prop; +import static io.smallrye.graphql.client.core.Operation.operation; +import static org.junit.Assert.assertEquals; + +import java.net.URL; +import java.util.Set; + +import jakarta.json.bind.annotation.JsonbCreator; -import io.smallrye.graphql.client.Response; -import io.smallrye.graphql.client.core.Document; -import io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClient; -import io.smallrye.graphql.client.vertx.dynamic.VertxDynamicGraphQLClientBuilder; import org.eclipse.microprofile.graphql.GraphQLApi; import org.eclipse.microprofile.graphql.NonNull; import org.eclipse.microprofile.graphql.Query; @@ -12,23 +22,14 @@ import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; -import jakarta.json.bind.annotation.JsonbCreator; -import java.net.URL; -import java.util.Set; - -import static io.smallrye.graphql.client.core.Argument.arg; -import static io.smallrye.graphql.client.core.Argument.args; -import static io.smallrye.graphql.client.core.Document.document; -import static io.smallrye.graphql.client.core.Field.field; -import static io.smallrye.graphql.client.core.InputObject.inputObject; -import static io.smallrye.graphql.client.core.InputObjectField.prop; -import static io.smallrye.graphql.client.core.Operation.operation; -import static org.junit.Assert.assertEquals; +import io.smallrye.graphql.client.Response; +import io.smallrye.graphql.client.core.Document; +import io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClient; +import io.smallrye.graphql.client.vertx.dynamic.VertxDynamicGraphQLClientBuilder; /** * This test verifies that the server side can handle Java records in GraphQL apis, both as input and as output types. diff --git a/server/integration-tests/src/test/java/io/smallrye/graphql/tests/client/typesafe/RecordAsInputToTypesafeClientTest.java b/server/integration-tests/src/test/java/io/smallrye/graphql/tests/client/typesafe/RecordAsInputToTypesafeClientTest.java index 7fc7970dd..594d8f55a 100644 --- a/server/integration-tests/src/test/java/io/smallrye/graphql/tests/client/typesafe/RecordAsInputToTypesafeClientTest.java +++ b/server/integration-tests/src/test/java/io/smallrye/graphql/tests/client/typesafe/RecordAsInputToTypesafeClientTest.java @@ -1,7 +1,9 @@ -package io.smallrye.graphql.tests.client; +package io.smallrye.graphql.tests.client.typesafe; + +import static org.junit.Assert.assertEquals; + +import java.net.URL; -import io.smallrye.graphql.client.typesafe.api.GraphQLClientApi; -import io.smallrye.graphql.client.typesafe.api.TypesafeGraphQLClientBuilder; import org.eclipse.microprofile.graphql.GraphQLApi; import org.eclipse.microprofile.graphql.Query; import org.jboss.arquillian.container.test.api.Deployment; @@ -13,9 +15,8 @@ import org.junit.Test; import org.junit.runner.RunWith; -import java.net.URL; - -import static org.junit.Assert.assertEquals; +import io.smallrye.graphql.client.typesafe.api.GraphQLClientApi; +import io.smallrye.graphql.client.typesafe.api.TypesafeGraphQLClientBuilder; @RunWith(Arquillian.class) @RunAsClient