Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.14.2 backports 2 #29416

Merged
merged 5 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<smallrye-health.version>3.3.0</smallrye-health.version>
<smallrye-metrics.version>3.0.5</smallrye-metrics.version>
<smallrye-open-api.version>2.3.1</smallrye-open-api.version>
<smallrye-graphql.version>1.8.2</smallrye-graphql.version>
<smallrye-graphql.version>1.8.3</smallrye-graphql.version>
<smallrye-opentracing.version>2.1.1</smallrye-opentracing.version>
<smallrye-fault-tolerance.version>5.5.0</smallrye-fault-tolerance.version>
<smallrye-jwt.version>3.5.4</smallrye-jwt.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,10 @@ private void computeArtifactCoords(ObjectNode extObject) {
private void computeSourceLocation(ObjectNode extObject) {
Map<String, String> repo = ScmInfoProvider.getSourceRepo();
if (repo != null) {
ObjectNode scm = extObject.putObject("scm");
ObjectNode metadata = getMetadataNode(extObject);

for (Map.Entry<String, String> e : repo.entrySet()) {
scm.put(e.getKey(), e.getValue());
metadata.put("scm-" + e.getKey(), e.getValue());

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,9 @@ public void shouldGenerateScmInformation() throws IOException {
File extensionDescriptorFile = new File(testProjectDir, "build/resources/main/META-INF/quarkus-extension.yaml");
assertThat(extensionDescriptorFile).exists();
ObjectNode extensionDescriptor = TestUtils.readExtensionFile(extensionDescriptorFile.toPath());
assertThat(extensionDescriptor.get("scm")).isNotNull();
assertThat(extensionDescriptor.get("scm").get("url")).isNotNull();
assertThat(extensionDescriptor.get("scm").get("url").asText())
.as("Check source location %s", extensionDescriptor.get("scm"))
assertThat(extensionDescriptor.get("metadata").get("scm-url")).isNotNull();
assertThat(extensionDescriptor.get("metadata").get("scm-url").asText())
.as("Check source location %s", extensionDescriptor.get("scm-url"))
.isEqualTo("https://github.com/some/repo");
}

Expand Down
2 changes: 1 addition & 1 deletion devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ private void addQuarkusDevModeDeps(MavenDevModeLauncher.Builder builder, Applica
final List<Exclusion> exclusions;
if (!d.getExclusions().isEmpty()) {
exclusions = new ArrayList<>(d.getExclusions().size());
d.getExclusions().forEach(e -> exclusions.add(new Exclusion(e.getGroupId(), e.getArtifactId(), null, null)));
d.getExclusions().forEach(e -> exclusions.add(new Exclusion(e.getGroupId(), e.getArtifactId(), "*", "*")));
} else {
exclusions = List.of();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
- "jpa"
- "orm"
- "panache"
guide: "https://quarkus.io/guides/security-jpa"
guide: "https://quarkus.io/guides/security-getting-started"
categories:
- "security"
status: "stable"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import io.quarkus.smallrye.graphql.client.runtime.GraphQLClientSupport;
import io.quarkus.smallrye.graphql.client.runtime.GraphQLClientsConfig;
import io.quarkus.smallrye.graphql.client.runtime.SmallRyeGraphQLClientRecorder;
import io.quarkus.vertx.core.deployment.CoreVertxBuildItem;

public class SmallRyeGraphQLClientProcessor {

Expand Down Expand Up @@ -205,4 +206,11 @@ ServiceProviderBuildItem overrideErrorMessageProvider() {
return ServiceProviderBuildItem.allProvidersFromClassPath("io.smallrye.graphql.client.impl.ErrorMessageProvider");
}

@BuildStep
@Record(RUNTIME_INIT)
void setGlobalVertxInstance(CoreVertxBuildItem vertxBuildItem,
SmallRyeGraphQLClientRecorder recorder) {
recorder.setGlobalVertxInstance(vertxBuildItem.getVertx());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import io.quarkus.runtime.annotations.Recorder;
import io.smallrye.graphql.client.impl.GraphQLClientsConfiguration;
import io.smallrye.graphql.client.typesafe.api.TypesafeGraphQLClientBuilder;
import io.smallrye.graphql.client.vertx.VertxManager;
import io.vertx.core.Vertx;

@Recorder
public class SmallRyeGraphQLClientRecorder {
Expand Down Expand Up @@ -48,4 +50,8 @@ public void initializeConfigurationMergerBean() {
merger.nothing();
}

public void setGlobalVertxInstance(Supplier<Vertx> vertx) {
VertxManager.setFromGlobal(vertx.get());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -660,10 +660,9 @@ public boolean visitLeave(DependencyNode node) {
private void addSource(ObjectNode extObject) throws MojoExecutionException {
Map<String, String> repo = getSourceRepo();
if (repo != null) {
ObjectNode scm = extObject.putObject("scm");
ObjectNode metadata = getMetadataNode(extObject);
for (Map.Entry<String, String> e : repo.entrySet()) {
scm.put(e.getKey(), e.getValue());

metadata.put("scm-" + e.getKey(), e.getValue());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,10 @@ public boolean visitLeave(DependencyNode node) {
private void addSource(ObjectNode extObject) throws MojoExecutionException {
Map<String, String> repo = ScmInfoProvider.getSourceRepo();
if (repo != null) {
ObjectNode scm = extObject.putObject("scm");
ObjectNode metadata = getMetadataNode(extObject);
for (Map.Entry<String, String> e : repo.entrySet()) {
scm.put(e.getKey(), e.getValue());
// Tools may not be able to handle nesting in metadata, so do fake-nesting
metadata.put("scm-" + e.getKey(), e.getValue());

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ public void shouldCreateMetadata()
// From maven this property should be set, running in an IDE it won't be unless specially configured
if (System.getenv("GITHUB_REPOSITORY") != null) {
// Lazily test that the scm is there but is an object
assertYamlContainsObject(fileContents, "scm");
assertYamlContains(fileContents, "url", "https://github.com/some/repo");
assertYamlContains(fileContents, "scm-url", "https://github.com/some/repo");
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ public void handle(ResteasyReactiveRequestContext requestContext) throws Excepti
responseBuilder = fromResponse(existing);
responseBuilder.entity(genericEntity.getEntity());
} else {
// TCK says to use the entity type as generic type if we return a response
if (existing.hasEntity() && (existing.getEntity() != null))
requestContext.setGenericReturnType(existing.getEntity().getClass());
//TODO: super inefficient
responseBuilder = fromResponse(existing);
if ((result instanceof RestResponseImpl)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import io.quarkus.it.kotser.model.Person
import io.quarkus.it.kotser.model.Person2
import io.quarkus.runtime.annotations.RegisterForReflection
import kotlinx.coroutines.flow.flowOf
import org.jboss.resteasy.reactive.RestResponse
import java.lang.reflect.Method
import javax.ws.rs.Consumes
import javax.ws.rs.GET
Expand All @@ -28,6 +29,16 @@ class GreetingResource {
return Person("Jim Halpert")
}

@Path("restResponse")
@GET
@Produces(MediaType.APPLICATION_JSON)
fun restResponse() = RestResponse.ok(Person("Jim Halpert"))

@Path("restResponseList")
@GET
@Produces(MediaType.APPLICATION_JSON)
fun restResponseList() = RestResponse.ok(mutableListOf(Person("Jim Halpert")))

@Path("unknownType")
@GET
@Produces(MediaType.APPLICATION_JSON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,26 @@ open class ResourceTest {
}
}

@Test
fun testRestResponse() {
When {
get("/restResponse")
} Then {
statusCode(200)
body(`is`("""{"name":"Jim Halpert","defaulted":"hi there!"}"""))
}
}

@Test
fun testRestResponseList() {
When {
get("/restResponseList")
} Then {
statusCode(200)
body(`is`("""[{"name":"Jim Halpert","defaulted":"hi there!"}]"""))
}
}

@Test
fun testGetUnknownType() {
When {
Expand Down
2 changes: 1 addition & 1 deletion jakarta/rewrite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ recipeList:
newValue: 6.0.0-RC4
- org.openrewrite.maven.ChangePropertyValue:
key: smallrye-graphql.version
newValue: 2.0.0.RC12
newValue: 2.0.0.RC13
- org.openrewrite.maven.ChangePropertyValue:
key: smallrye-health.version
newValue: 4.0.0
Expand Down