Skip to content

Commit

Permalink
Add standalone smallrye test
Browse files Browse the repository at this point in the history
  • Loading branch information
jmini committed Oct 7, 2024
1 parent d834e19 commit 7eaae3b
Show file tree
Hide file tree
Showing 26 changed files with 1,098 additions and 0 deletions.
32 changes: 32 additions & 0 deletions quarkus43756_smallrye-graphql-client/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="bin/main" path="src/main/java">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/main" path="src/main/resources">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/test" path="src/test/java">
<attributes>
<attribute name="gradle_scope" value="test"/>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/test" path="src/test/resources">
<attributes>
<attribute name="gradle_scope" value="test"/>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>
12 changes: 12 additions & 0 deletions quarkus43756_smallrye-graphql-client/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

# Binary files should be left untouched
*.jar binary

5 changes: 5 additions & 0 deletions quarkus43756_smallrye-graphql-client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build
23 changes: 23 additions & 0 deletions quarkus43756_smallrye-graphql-client/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tmp-smallrye-graphql-client</name>
<comment>Project tmp-smallrye-graphql-client created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=
jvm.arguments=
offline.mode=false
override.workspace.settings=false
show.console.view=false
show.executions.view=false
46 changes: 46 additions & 0 deletions quarkus43756_smallrye-graphql-client/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
== quarkus43756_smallrye-graphql-client

Investigations for issue https://github.com/quarkusio/quarkus/issues/43756[quarkusio/quarkus#43756]

Same implementation as link:../superheroes-graphql-client[superheroes-graphql-client] but without quarkus.

To run it:

```
./gradlew run
```

The main class is link:src/main/java/run/Client.java[Client.java]
The client model classes and interface are the same as in the quarkus application (packages `superheroes.api` and `superheroes.model`)

Use `gradle.properties` to change the smallrye version.

=== With 2.9.2

```
> Task :run
response: [City [name=Gotham City, symbol=GC], City [name=New York City, symbol=NYC]]
Exception in thread "main" GraphQlClientException: errors from service
errors:
- Error{message=Unparseable input document, locations=[], path=null, extensions={classification=DataFetchingException}})
at io.smallrye.graphql.client.impl.typesafe.ResultBuilder.readErrors(ResultBuilder.java:111)
at io.smallrye.graphql.client.impl.typesafe.ResultBuilder.read(ResultBuilder.java:67)
at io.smallrye.graphql.client.vertx.typesafe.VertxTypesafeGraphQLClientProxy.executeSingleResultOperationOverHttpSync(VertxTypesafeGraphQLClientProxy.java:178)
at io.smallrye.graphql.client.vertx.typesafe.VertxTypesafeGraphQLClientProxy.invoke(VertxTypesafeGraphQLClientProxy.java:160)
at io.smallrye.graphql.client.vertx.typesafe.VertxTypesafeGraphQLClientBuilder.invoke(VertxTypesafeGraphQLClientBuilder.java:231)
at io.smallrye.graphql.client.vertx.typesafe.VertxTypesafeGraphQLClientBuilder.lambda$build$0(VertxTypesafeGraphQLClientBuilder.java:191)
at jdk.proxy2/jdk.proxy2.$Proxy2.allSuperheroes(Unknown Source)
at run.Client.main(Client.java:22)
```

Same error as with Quarkus.

=== With 2.10.0

```
> Task :run
response: [City [name=Gotham City, symbol=GC], City [name=New York City, symbol=NYC]]
response: [Superhero [abilities=[Superpower [name=Genius-Level Intellect], Superpower [name=Expert Martial Artist], Superpower [name=Master Detective], Superpower [name=Peak Human Conditioning], Superpower [name=Expert in Stealth], Superpower [name=Proficient in Various Weapons], Superpower [name=Access to Advanced Technology], Attribute [motivation=Genius-level intellect with vast knowledge in various fields, name=Intelligence, rating=100], Attribute [motivation=Peak human strength, trained to physical perfection, name=Strength, rating=85], Attribute [motivation=Highly trained agility and quick reflexes, name=Speed, rating=70], Attribute [motivation=Strategic mind with considerable influence in combat, name=Power, rating=75], Attribute [motivation=Expert martial artist, skilled in various forms of combat, name=Combat, rating=95], Attribute [motivation=High endurance, capable of withstanding significant physical punishment, name=Durability, rating=80]], city=City [name=Gotham City, symbol=GC], gender=MALE, name=Batman], Superhero [abilities=[Superpower [name=Agility], Superpower [name=Enhanced Reflexes], Superpower [name=Acrobatics], Superpower [name=Stealth], Superpower [name=Expert Hand-to-Hand Combatant], Superpower [name=Cat-Like Reflexes], Superpower [name=Master Thief], Attribute [motivation=Clever and resourceful, often outsmarts opponents, name=Intelligence, rating=85], Attribute [motivation=Strong for a human, with above-average physical capabilities, name=Strength, rating=60], Attribute [motivation=Known for agility and quick reflexes, name=Speed, rating=80], Attribute [motivation=Relies on skills and cunning rather than raw power, name=Power, rating=50], Attribute [motivation=Proficient in hand-to-hand combat and acrobatics, name=Combat, rating=75], Attribute [motivation=Can endure physical punishment, though still vulnerable, name=Durability, rating=65]], city=City [name=Gotham City, symbol=GC], gender=FEMALE, name=Catwoman], Superhero [abilities=[Superpower [name=Superhuman Strength], Superpower [name=Wall-Crawling], Superpower [name=Spider-Sense], Superpower [name=Enhanced Reflexes], Superpower [name=Web-Shooting], Superpower [name=Agility], Superpower [name=Stealth], Attribute [motivation=Highly intelligent, especially in science and technology, name=Intelligence, rating=85], Attribute [motivation=Superhuman strength, able to lift several tons, name=Strength, rating=80], Attribute [motivation=Quick reflexes and agility, allowing for rapid movement, name=Speed, rating=75], Attribute [motivation=High-level powers, including web-slinging and wall-crawling, name=Power, rating=90], Attribute [motivation=Skilled in hand-to-hand combat but relies more on agility and reflexes, name=Combat, rating=70], Attribute [motivation=Able to withstand injuries better than an average human, thanks to his powers, name=Durability, rating=70]], city=City [name=New York City, symbol=NYC], gender=MALE, name=Spider Man]]
```

Ok.
37 changes: 37 additions & 0 deletions quarkus43756_smallrye-graphql-client/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
plugins {
id 'application'
}

repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}

dependencies {
implementation 'org.eclipse.microprofile.graphql:microprofile-graphql-api:2.0'
implementation "io.smallrye:smallrye-graphql-client-implementation-vertx:$smallrye_graphql_version"
implementation "io.smallrye:smallrye-graphql-api:$smallrye_graphql_version"
implementation "io.smallrye:smallrye-graphql-client-api:$smallrye_graphql_version"
implementation 'org.eclipse:yasson:2.0.4' // should no longer be necessary with version after '2.10.0' see https://github.com/smallrye/smallrye-graphql/pull/2196
implementation 'jakarta.json.bind:jakarta.json.bind-api:3.0.1'
//implementation("jakarta.json:jakarta.json-api:2.0.1")

testImplementation libs.junit.jupiter
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}

application {
mainClass = 'run.Client'
}
5 changes: 5 additions & 0 deletions quarkus43756_smallrye-graphql-client/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# not working
smallrye_graphql_version=2.9.2

# working:
# smallrye_graphql_version=2.10.0
12 changes: 12 additions & 0 deletions quarkus43756_smallrye-graphql-client/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file was generated by the Gradle 'init' task.
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format

[versions]
commons-math3 = "3.6.1"
guava = "33.2.1-jre"
junit-jupiter = "5.10.3"

[libraries]
commons-math3 = { module = "org.apache.commons:commons-math3", version.ref = "commons-math3" }
guava = { module = "com.google.guava:guava", version.ref = "guava" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 7eaae3b

Please sign in to comment.