Skip to content

Commit

Permalink
Fixed an issue where annotations were not part of the Jandex index, i…
Browse files Browse the repository at this point in the history
…f given in an external JAR
  • Loading branch information
mskacelik committed Jan 3, 2025
1 parent 33c6b36 commit cf4b111
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void dynamicClientInjection(BuildProducer<AdditionalBeanBuildItem> additionalBea

@BuildStep
@Record(STATIC_INIT)
void initializeTypesafeClient(BeanArchiveIndexBuildItem index,
void initializeTypesafeClient(CombinedIndexBuildItem index,
BuildProducer<SyntheticBeanBuildItem> syntheticBeans,
SmallRyeGraphQLClientRecorder recorder,
BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package io.quarkus.smallrye.graphql.client.deployment;

import io.quarkus.smallrye.graphql.client.deployment.model.Person;
import io.quarkus.smallrye.graphql.client.deployment.model.PersonDto;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLApi;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLClientApiWithNoConfigKey;
import io.quarkus.test.QuarkusUnitTest;
import jakarta.inject.Inject;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;


public class TypesafeGraphQLClientAsAnOutsideDependencyTest {


static String url = "http://" + System.getProperty("quarkus.http.host", "localhost") + ":" +
System.getProperty("quarkus.http.test-port", "8081") + "/graphql";

static JavaArchive dependency = ShrinkWrap.create(JavaArchive.class)
.addClasses(TestingGraphQLClientApiWithNoConfigKey.class, Person.class);

@RegisterExtension
static QuarkusUnitTest test = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
.addClasses(PersonDto.class, TestingGraphQLApi.class)
.addAsResource(
new StringAsset(
"quarkus.smallrye-graphql-client.\"io.quarkus.smallrye.graphql." +
"client.deployment.model.TestingGraphQLClientApiWithNoConfigKey\".url="
+ url),
"application.properties")
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"))
.addAdditionalDependency(dependency);
@Inject
TestingGraphQLClientApiWithNoConfigKey client;

@Test
public void performQuery() {
List<Person> people = client.people();
assertEquals(2, people.size());
assertEquals("John", people.get(0).getFirstName());
assertEquals("Arthur", people.get(1).getFirstName());
}

}

0 comments on commit cf4b111

Please sign in to comment.