Skip to content

Commit

Permalink
Merge pull request #26142 from gsmet/2.10.0-backports-2
Browse files Browse the repository at this point in the history
2.10.0 backports 2
  • Loading branch information
gsmet authored Jun 15, 2022
2 parents 8c509ae + edb1b33 commit be1763e
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 25 deletions.
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<microprofile-jwt.version>1.2</microprofile-jwt.version>
<microprofile-lra.version>1.0</microprofile-lra.version>
<smallrye-common.version>1.12.0</smallrye-common.version>
<smallrye-config.version>2.10.0</smallrye-config.version>
<smallrye-config.version>2.10.1</smallrye-config.version>
<smallrye-health.version>3.2.1</smallrye-health.version>
<smallrye-metrics.version>3.0.5</smallrye-metrics.version>
<smallrye-open-api.version>2.1.22</smallrye-open-api.version>
Expand Down
6 changes: 3 additions & 3 deletions docs/src/main/asciidoc/config-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ the value `youshallnotpass` to the attribute `quarkus.datasource.password`.
NOTE: Environment variables names follow the conversion rules specified by
link:https://github.com/eclipse/microprofile-config/blob/master/spec/src/main/asciidoc/configsources.asciidoc#default-configsources[MicroProfile Config].

NOTE: SmallRye Config specifies link:https://smallrye.io/smallrye-config/latest/config/environment-variables/[additional conversion rules].

[[env-file]]
=== `.env` file in the current working directory

Expand Down Expand Up @@ -501,8 +503,6 @@ The indexed property is sorted by their index before being added to the target `
indexes do not resolve to the target `Collection`, which means that the `Collection` result will store all values
without any gaps.

IMPORTANT: Indexed Properties are not supported in Environment Variables.

[[configuring_quarkus]]
== Configuring Quarkus

Expand Down Expand Up @@ -555,7 +555,7 @@ Quarkus relies on link:https://github.com/smallrye/smallrye-config/[SmallRye Con
* Hide secrets

For more information, please check the
link:https://smallrye.io/docs/smallrye-config/index.html[SmallRye Config documentation].
link:https://smallrye.io/smallrye-config/latest[SmallRye Config documentation].

== Configuration Reference

Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public String hello() {
----

TIP: Use `@io.smallrye.config.ConfigMapping` annotation to group multiple configurations in a single interface. Please,
check the https://smallrye.io/docs/smallrye-config/main/mapping/mapping.html[Config Mappings] documentation.
check the https://smallrye.io/smallrye-config/latest/config/mappings/[Config Mappings] documentation.

== Update the test

Expand Down Expand Up @@ -240,4 +240,4 @@ Quarkus relies on link:https://github.com/smallrye/smallrye-config/[SmallRye Con
* Hide secrets

For more information, please check the
link:https://smallrye.io/docs/smallrye-config/index.html[SmallRye Config documentation].
link:https://smallrye.io/smallrye-config/latest/[SmallRye Config documentation].
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ public void handleCustomAnnotatedMethods(
generated.getGeneratedClassName())
.setRegisterAsBean(false)// it has already been made a bean
.setPriority(generated.getPriority());
if (!generated.getNameBindingNames().isEmpty()) {
builder.setNameBindingNames(generated.getNameBindingNames());
}
additionalContainerResponseFilters.produce(builder.build());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ public JavaArchive get() {

@Test
public void testFilters() {
Headers headers = RestAssured.given().header("some-input", "bar").get("/custom/req")
Headers responseHeaders = RestAssured.given().header("some-input", "bar").get("/custom/req")
.then().statusCode(200).body(Matchers.containsString("/custom/req-bar-null")).extract().headers();
assertThat(headers.getValues("java-method")).containsOnly("filters");
assertThat(responseHeaders.getValues("java-method")).containsOnly("filters");
Assertions.assertEquals(3, AssertContainerFilter.COUNT.get());
assertThat(responseHeaders.getValues("very")).isEmpty();

headers = RestAssured.given().header("some-input", "bar").get("/custom/metal")
responseHeaders = RestAssured.given().header("some-input", "bar").get("/custom/metal")
.then().statusCode(200).body(Matchers.containsString("/custom/metal-bar-metal")).extract().headers();
assertThat(headers.getValues("java-method")).containsOnly("metal");
assertThat(responseHeaders.getValues("very")).containsOnly("heavy");
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
package io.quarkus.resteasy.reactive.server.test.customproviders;

import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;

import org.jboss.resteasy.reactive.server.ServerRequestFilter;
import org.jboss.resteasy.reactive.server.ServerResponseFilter;

public class MetalFilter {

@Metal
@ServerRequestFilter
public void headBang(ContainerRequestContext requestContext) {
public void headBangIn(ContainerRequestContext requestContext) {
requestContext.getHeaders().putSingle("heavy", "metal");
}

@Metal
@ServerResponseFilter
public void headBangOut(ContainerResponseContext responseContext) {
responseContext.getHeaders().putSingle("very", "heavy");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.quarkus.bootstrap.resolver.maven.workspace.LocalWorkspace;
import io.quarkus.bootstrap.util.DependencyNodeUtils;
import io.quarkus.fs.util.ZipUtils;
import io.quarkus.maven.ExtensionDescriptorMojo.RemovedResources;
import io.quarkus.maven.capabilities.CapabilitiesConfig;
import io.quarkus.maven.capabilities.CapabilityConfig;
import io.quarkus.maven.dependency.ArtifactCoords;
Expand Down Expand Up @@ -91,6 +92,11 @@
@Mojo(name = "extension-descriptor", defaultPhase = LifecyclePhase.PROCESS_RESOURCES, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true)
public class ExtensionDescriptorMojo extends AbstractMojo {

public static class RemovedResources {
String key;
String resources;
}

private static final String GROUP_ID = "group-id";
private static final String ARTIFACT_ID = "artifact-id";
private static final String METADATA = "metadata";
Expand Down Expand Up @@ -164,7 +170,7 @@ public class ExtensionDescriptorMojo extends AbstractMojo {
* but in the `META-INF/quarkus-extension.properties`.
*/
@Parameter
Map<String, String> removedResources = Map.of();
List<RemovedResources> removedResources = List.of();

/**
* Artifacts that are always loaded parent first when running in dev or test mode. This is an advanced option
Expand Down Expand Up @@ -321,18 +327,18 @@ public void execute() throws MojoExecutionException {
}

if (!removedResources.isEmpty()) {
for (Map.Entry<String, String> entry : removedResources.entrySet()) {
for (RemovedResources entry : removedResources) {
final ArtifactKey key;
try {
key = ArtifactKey.fromString(entry.getKey());
key = ArtifactKey.fromString(entry.key);
} catch (IllegalArgumentException e) {
throw new MojoExecutionException(
"Failed to parse removed resource '" + entry.getKey() + '=' + entry.getValue() + "'", e);
"Failed to parse removed resource '" + entry.key + '=' + entry.resources + "'", e);
}
if (entry.getValue() == null || entry.getValue().isBlank()) {
if (entry.resources == null || entry.resources.isBlank()) {
continue;
}
final String[] resources = entry.getValue().split(",");
final String[] resources = entry.resources.split(",");
if (resources.length == 0) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@
@Mojo(name = "extension-descriptor", defaultPhase = LifecyclePhase.PROCESS_RESOURCES, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true)
public class ExtensionDescriptorMojo extends AbstractMojo {

public static class RemovedResources {
String key;
String resources;
}

private static final String GROUP_ID = "group-id";
private static final String ARTIFACT_ID = "artifact-id";
private static final String METADATA = "metadata";
Expand Down Expand Up @@ -169,7 +174,7 @@ public class ExtensionDescriptorMojo extends AbstractMojo {
* but in the `META-INF/quarkus-extension.properties`.
*/
@Parameter
Map<String, String> removedResources = Map.of();
List<RemovedResources> removedResources = List.of();

/**
* Artifacts that are always loaded parent first when running in dev or test mode. This is an advanced option
Expand Down Expand Up @@ -336,18 +341,18 @@ public void execute() throws MojoExecutionException {
}

if (!removedResources.isEmpty()) {
for (Map.Entry<String, String> entry : removedResources.entrySet()) {
for (RemovedResources entry : removedResources) {
final ArtifactKey key;
try {
key = ArtifactKey.fromString(entry.getKey());
key = ArtifactKey.fromString(entry.key);
} catch (IllegalArgumentException e) {
throw new MojoExecutionException(
"Failed to parse removed resource '" + entry.getKey() + '=' + entry.getValue() + "'", e);
"Failed to parse removed resource '" + entry.key + '=' + entry.resources + "'", e);
}
if (entry.getValue() == null || entry.getValue().isBlank()) {
if (entry.resources == null || entry.resources.isBlank()) {
continue;
}
final String[] resources = entry.getValue().split(",");
final String[] resources = entry.resources.split(",");
if (resources.length == 0) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
<configuration>
<deployment>\${project.groupId}:\${project.artifactId}-deployment:\${project.version}</deployment>
<removedResources>
<org.acme:acme-resources>META-INF/a</org.acme:acme-resources>
<artifact>
<key>org.acme:acme-resources</key>
<resources>META-INF/a</resources>
</artifact>
</removedResources>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ private void checkSingleTokenCookie(Cookie tokenCookie, String type, boolean dec
token = OidcUtils.decryptString(token, KeyUtils.createSecretKeyFromSecret("eUk1p7UB3nFiXZGUXi0uph1Y9p34YhBU"));
tokenParts = token.split("\\.");
} catch (Exception ex) {
fail("Token descryption has failed");
fail("Token decryption has failed");
}
}
assertEquals(3, tokenParts.length);
Expand Down

0 comments on commit be1763e

Please sign in to comment.