Skip to content

Commit

Permalink
Merge pull request #38864 from gsmet/3.7.4-backports-1
Browse files Browse the repository at this point in the history
3.7.4 backports 1
  • Loading branch information
gsmet committed Feb 21, 2024
2 parents 1dbf5d3 + 4611ba6 commit bc84000
Show file tree
Hide file tree
Showing 85 changed files with 1,581 additions and 187 deletions.
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
<scram-client.version>2.1</scram-client.version>
<picocli.version>4.7.5</picocli.version>
<google-cloud-functions.version>1.1.0</google-cloud-functions.version>
<commons-compress.version>1.25.0</commons-compress.version>
<commons-compress.version>1.26.0</commons-compress.version>
<commons-text.version>1.11.0</commons-text.version>
<gson.version>2.10.1</gson.version>
<log4j2-jboss-logmanager.version>1.1.2.Final</log4j2-jboss-logmanager.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ private void registerTasks(Project project, QuarkusExtensionConfiguration quarku
Configuration runtimeModuleClasspath = project.getConfigurations()
.getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME);

TaskProvider<ValidateExtensionTask> validateExtensionTask = tasks.register(VALIDATE_EXTENSION_TASK_NAME,
ValidateExtensionTask.class, quarkusExt, runtimeModuleClasspath);

TaskProvider<ExtensionDescriptorTask> extensionDescriptorTask = tasks.register(EXTENSION_DESCRIPTOR_TASK_NAME,
ExtensionDescriptorTask.class, quarkusExt, mainSourceSet, runtimeModuleClasspath);

TaskProvider<ValidateExtensionTask> validateExtensionTask = tasks.register(VALIDATE_EXTENSION_TASK_NAME,
ValidateExtensionTask.class, quarkusExt, runtimeModuleClasspath);
extensionDescriptorTask.configure(task -> task.dependsOn(validateExtensionTask));

project.getPlugins().withType(
JavaPlugin.class,
Expand Down
1 change: 1 addition & 0 deletions devtools/gradle/gradle-model/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {

dependencies {
compileOnly(libs.kotlin.gradle.plugin.api)
gradleApi()
}

group = "io.quarkus"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,6 @@ private void collectConditionalDependencies(Set<ResolvedArtifact> runtimeArtifac
queueConditionalDependency(extension, conditionalDep);
}
}

// If the extension doesn't have any conditions we just enable it by default
if (extension.getDependencyConditions().isEmpty()) {
extension.setConditional(true);
enableConditionalDependency(extension.getExtensionId());
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions devtools/gradle/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ quarkus-project-core-extension-codestarts = { module = "io.quarkus:quarkus-proje

kotlin-gradle-plugin-api = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin-api", version.ref = "kotlin" }
smallrye-config-yaml = { module = "io.smallrye.config:smallrye-config-source-yaml", version.ref = "smallrye-config" }
jackson-databind = {module="com.fasterxml.jackson.core:jackson-databind"}
jackson-dataformat-yaml = {module="com.fasterxml.jackson.dataformat:jackson-dataformat-yaml"}
jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind" }
jackson-dataformat-yaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml" }

junit-bom = { module = "org.junit:junit-bom", version.ref = "junit5" }
junit-api = { module = "org.junit.jupiter:junit-jupiter-api" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,10 @@ public void execute() throws MojoExecutionException {
}

askTheUserForMissingValues();
if (projectArtifactId != DEFAULT_ARTIFACT_ID && !OK_ID.matcher(projectArtifactId).matches()) {
if (!DEFAULT_ARTIFACT_ID.equals(projectArtifactId) && !OK_ID.matcher(projectArtifactId).matches()) {
throw new MojoExecutionException(String.format(BAD_IDENTIFIER, "artifactId", projectArtifactId));
}
if (projectGroupId != DEFAULT_GROUP_ID && !OK_ID.matcher(projectGroupId).matches()) {
if (!DEFAULT_GROUP_ID.equals(projectGroupId) && !OK_ID.matcher(projectGroupId).matches()) {
throw new MojoExecutionException(String.format(BAD_IDENTIFIER, "groupId", projectGroupId));
}

Expand Down Expand Up @@ -389,16 +389,7 @@ private void askTheUserForMissingValues() throws MojoExecutionException {
// If the user has disabled the interactive mode or if the user has specified the artifactId, disable the
// user interactions.
if (!session.getRequest().isInteractiveMode() || shouldUseDefaults()) {
if (isBlank(projectArtifactId)) {
// we need to set it for the project directory
projectArtifactId = DEFAULT_ARTIFACT_ID;
}
if (isBlank(projectGroupId)) {
projectGroupId = DEFAULT_GROUP_ID;
}
if (isBlank(projectVersion)) {
projectVersion = DEFAULT_VERSION;
}
setProperDefaults();
return;
}

Expand Down Expand Up @@ -427,12 +418,27 @@ private void askTheUserForMissingValues() throws MojoExecutionException {
input -> noCode = input.startsWith("n"));

prompter.collectInput();
} else {
setProperDefaults();
}
} catch (IOException e) {
throw new MojoExecutionException("Unable to get user input", e);
}
}

private void setProperDefaults() {
if (isBlank(projectArtifactId)) {
// we need to set it for the project directory
projectArtifactId = DEFAULT_ARTIFACT_ID;
}
if (isBlank(projectGroupId)) {
projectGroupId = DEFAULT_GROUP_ID;
}
if (isBlank(projectVersion)) {
projectVersion = DEFAULT_VERSION;
}
}

private boolean shouldUseDefaults() {
// Must be called before user input
return projectArtifactId != null;
Expand Down
3 changes: 2 additions & 1 deletion devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ private String handleAutoCompile() throws MojoExecutionException {
if (!e.getGoals().isEmpty()) {
goalPrefix = getMojoDescriptor(p, e.getGoals().get(0)).getPluginDescriptor().getGoalPrefix();
pluginPrefixes.put(goalPrefix, p);
pluginPrefixes.put(p.getId(), p);
}
if (e.getPhase() != null) {
phaseExecutions.computeIfAbsent(e.getPhase(), k -> new ArrayList<>()).add(new PluginExec(p, goalPrefix, e));
Expand Down Expand Up @@ -630,7 +631,7 @@ private String handleAutoCompile() throws MojoExecutionException {
if (goal.endsWith(currentGoal)) {
break;
}
var colon = goal.indexOf(':');
var colon = goal.lastIndexOf(':');
if (colon >= 0) {
var plugin = pluginPrefixes.get(goal.substring(0, colon));
if (plugin == null) {
Expand Down
10 changes: 0 additions & 10 deletions docs/src/main/asciidoc/hibernate-orm.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1350,11 +1350,6 @@ and annotating the implementation with the appropriate qualifiers:
@JsonFormat // <1>
@PersistenceUnitExtension // <2>
public class MyJsonFormatMapper implements FormatMapper { // <3>
@Override
public String inspect(String sql) {
// ...
return sql;
}
@Override
public <T> T fromString(CharSequence charSequence, JavaType<T> javaType, WrapperOptions wrapperOptions) {
// ...
Expand Down Expand Up @@ -1382,11 +1377,6 @@ In case of a custom XML format mapper, a different CDI qualifier must be applied
@XmlFormat // <1>
@PersistenceUnitExtension // <2>
public class MyJsonFormatMapper implements FormatMapper { // <3>
@Override
public String inspect(String sql) {
// ...
return sql;
}
@Override
public <T> T fromString(CharSequence charSequence, JavaType<T> javaType, WrapperOptions wrapperOptions) {
// ...
Expand Down
25 changes: 21 additions & 4 deletions docs/src/main/asciidoc/kafka.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2048,14 +2048,31 @@ mp.messaging.incoming.data.tracing-enabled=false
If the xref:telemetry-micrometer.adoc[Micrometer extension] is present,
then Kafka producer and consumer clients metrics are exposed as Micrometer meters.

Per channel metrics are also exposed as Micrometer meters.
The number of messages produced or received per channel, acknowledgments and duration of processing are exposed.
=== Channel metrics

The messaging meters can be disabled:
Per channel metrics can also be gathered and exposed as Micrometer meters.
Following metrics can be gathered per channel, identified with the _channel_ tag:

* `quarkus.messaging.message.count` : The number of messages produced or received
* `quarkus.messaging.message.acks` : The number of messages processed successfully
* `quarkus.messaging.message.failures` : The number of messages processed with failures
* `quarkus.messaging.message.duration` : The duration of the message processing.

For backwards compatibility reasons channel metrics are not enabled by default and can be enabled with:

[IMPORTANT]
====
The https://smallrye.io/smallrye-reactive-messaging/latest/concepts/observability/[message observation]
depends on intercepting messages and therefore doesn't support channels consuming messages with
a custom message type such as `IncomingKafkaRecord`, `KafkaRecord`, `IncomingKafkaRecordBatch` or `KafkaRecordBatch`.
The message interception, and observation, still work with channels consuming the generic `Message` type,
or custom payloads enabled by https://smallrye.io/smallrye-reactive-messaging/latest/concepts/converters/[converters].
====

[source, properties]
----
quarkus.micrometer.binder.messaging.enabled=false
smallrye.messaging.observation.enabled=true
----


Expand Down
10 changes: 5 additions & 5 deletions docs/src/main/asciidoc/writing-extensions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,12 @@ Your extension project should be setup as a multi-module project with two submod

Your runtime artifact should depend on `io.quarkus:quarkus-core`, and possibly the runtime artifacts of other Quarkus
modules if you want to use functionality provided by them.

Your deployment time module should depend on `io.quarkus:quarkus-core-deployment`, your runtime artifact,
and possibly the deployment artifacts of other Quarkus modules if you want to use functionality provided by them.
and the deployment artifacts of any other Quarkus extensions your own extension depends on. This is essential, otherwise any transitively
pulled in extensions will not provide their full functionality.

NOTE: The Maven and Gradle plugins will validate this for you and alert you to any deployment artifacts you might have forgotten to add.

[WARNING]
====
Expand Down Expand Up @@ -573,10 +577,6 @@ dependencies {
}
----

[WARNING]
====
This plugin is still experimental, it does not validate the extension dependencies as the equivalent Maven plugin does.
====

[[build-step-processors]]
=== Build Step Processors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,9 @@ public void withSasl(CombinedIndexBuildItem index,
reflectiveClassCondition.produce(new ReflectiveClassConditionBuildItem(
"org.apache.kafka.common.security.oauthbearer.secured.OAuthBearerValidatorCallbackHandler",
"org.jose4j.keys.resolvers.VerificationKeyResolver"));
reflectiveClassCondition.produce(new ReflectiveClassConditionBuildItem(
"org.apache.kafka.common.security.oauthbearer.OAuthBearerValidatorCallbackHandler",
"org.jose4j.keys.resolvers.VerificationKeyResolver"));
}

private void registerJDKLoginModules(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
public class ResteasyReactiveClientProvider implements ResteasyClientProvider {

private static final List<String> HANDLED_MEDIA_TYPES = List.of(MediaType.APPLICATION_JSON);
private static final int PROVIDER_PRIORITY = Priorities.USER + 100; // ensures that it will be used first
private static final int WRITER_PROVIDER_PRIORITY = Priorities.USER + 100; // ensures that it will be used first
private static final int READER_PROVIDER_PRIORITY = Priorities.USER - 100; // ensures that it will be used first

private final boolean tlsTrustAll;

Expand Down Expand Up @@ -77,9 +78,9 @@ private ClientBuilderImpl registerJacksonProviders(ClientBuilderImpl clientBuild
clientBuilder = clientBuilder
.registerMessageBodyReader(new JacksonBasicMessageBodyReader(newObjectMapper), Object.class,
HANDLED_MEDIA_TYPES, true,
PROVIDER_PRIORITY)
READER_PROVIDER_PRIORITY)
.registerMessageBodyWriter(new ClientJacksonMessageBodyWriter(newObjectMapper), Object.class,
HANDLED_MEDIA_TYPES, true, PROVIDER_PRIORITY);
HANDLED_MEDIA_TYPES, true, WRITER_PROVIDER_PRIORITY);
}
InstanceHandle<ClientLogger> clientLogger = arcContainer.instance(ClientLogger.class);
if (clientLogger.isAvailable()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import io.fabric8.kubernetes.api.model.KubeSchema;
import io.fabric8.kubernetes.api.model.KubernetesResource;
import io.fabric8.kubernetes.api.model.KubernetesResourceList;
import io.fabric8.kubernetes.api.model.ValidationSchema;
import io.fabric8.kubernetes.client.Config;
import io.fabric8.kubernetes.client.CustomResource;
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
Expand Down Expand Up @@ -66,6 +67,7 @@ public class KubernetesClientProcessor {
private static final DotName RESOURCE_EVENT_HANDLER = DotName
.createSimple(io.fabric8.kubernetes.client.informers.ResourceEventHandler.class.getName());
private static final DotName KUBERNETES_RESOURCE = DotName.createSimple(KubernetesResource.class.getName());
private static final DotName VALIDATION_SCHEMA = DotName.createSimple(ValidationSchema.class.getName());
private static final DotName KUBERNETES_RESOURCE_LIST = DotName
.createSimple(KubernetesResourceList.class.getName());
private static final DotName KUBE_SCHEMA = DotName.createSimple(KubeSchema.class.getName());
Expand Down Expand Up @@ -190,6 +192,7 @@ public void process(ApplicationIndexBuildItem applicationIndex, CombinedIndexBui
ignoredJsonDeserializationClasses.produce(
new IgnoreJsonDeserializeClassBuildItem(KUBERNETES_RESOURCE_LIST));
ignoredJsonDeserializationClasses.produce(new IgnoreJsonDeserializeClassBuildItem(KUBERNETES_RESOURCE));
ignoredJsonDeserializationClasses.produce(new IgnoreJsonDeserializeClassBuildItem(VALIDATION_SCHEMA));

final String[] deserializerClasses = combinedIndexBuildItem.getIndex()
.getAllKnownSubclasses(DotName.createSimple("com.fasterxml.jackson.databind.JsonDeserializer"))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package io.quarkus.oidc.client;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.runtime.configuration.ConfigurationException;
import io.quarkus.test.QuarkusUnitTest;

public class OidcClientPasswordGrantSecretIsMissingTestCase {

@RegisterExtension
static final QuarkusUnitTest test = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
.addAsResource(new StringAsset(
"quarkus.oidc-client.token-path=http://localhost:8180/oidc/tokens\n"
+ "quarkus.oidc-client.client-id=quarkus\n"
+ "quarkus.oidc-client.credentials.secret=secret\n"
+ "quarkus.oidc-client.grant.type=password\n"
+ "quarkus.oidc-client.grant-options.password.user=alice\n"),
"application.properties"))
.assertException(t -> {
Throwable e = t;
ConfigurationException te = null;
while (e != null) {
if (e instanceof ConfigurationException) {
te = (ConfigurationException) e;
break;
}
e = e.getCause();
}
assertNotNull(te);
assertTrue(
te.getMessage()
.contains("Username and password must be set when a password grant is used"),
te.getMessage());
});

@Test
public void test() {
Assertions.fail();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
Expand Down Expand Up @@ -170,10 +171,16 @@ public OidcClient apply(OidcConfigurationMetadata metadata, Throwable t) {
// Without this block `password` will be listed first, before `username`
// which is not a technical problem but might affect Wiremock tests or the endpoints
// which expect a specific order.
tokenGrantParams.add(OidcConstants.PASSWORD_GRANT_USERNAME,
grantOptions.get(OidcConstants.PASSWORD_GRANT_USERNAME));
tokenGrantParams.add(OidcConstants.PASSWORD_GRANT_PASSWORD,
grantOptions.get(OidcConstants.PASSWORD_GRANT_PASSWORD));
final String userName = grantOptions.get(OidcConstants.PASSWORD_GRANT_USERNAME);
final String userPassword = grantOptions.get(OidcConstants.PASSWORD_GRANT_PASSWORD);
if (userName == null || userPassword == null) {
throw new ConfigurationException(
"Username and password must be set when a password grant is used",
Set.of("quarkus.oidc-client.grant.type",
"quarkus.oidc-client.grant-options"));
}
tokenGrantParams.add(OidcConstants.PASSWORD_GRANT_USERNAME, userName);
tokenGrantParams.add(OidcConstants.PASSWORD_GRANT_PASSWORD, userPassword);
for (Map.Entry<String, String> entry : grantOptions.entrySet()) {
if (!OidcConstants.PASSWORD_GRANT_USERNAME.equals(entry.getKey())
&& !OidcConstants.PASSWORD_GRANT_PASSWORD.equals(entry.getKey())) {
Expand Down
Loading

0 comments on commit bc84000

Please sign in to comment.