Skip to content

Commit

Permalink
Merge pull request #33853 from gsmet/3.1.1-backports-2
Browse files Browse the repository at this point in the history
3.1.1 backports 2
  • Loading branch information
gsmet authored Jun 7, 2023
2 parents fb56c0f + 6b50326 commit d68dd00
Show file tree
Hide file tree
Showing 45 changed files with 742 additions and 138 deletions.
10 changes: 5 additions & 5 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@
<graal-sdk.version>22.3.2</graal-sdk.version>
<graal-svm.version>${graal-sdk.version}</graal-svm.version>
<gizmo.version>1.6.1.Final</gizmo.version>
<jackson-bom.version>2.15.0</jackson-bom.version>
<jackson-bom.version>2.15.2</jackson-bom.version>
<commons-logging-jboss-logging.version>1.0.0.Final</commons-logging-jboss-logging.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<commons-codec.version>1.15</commons-codec.version>
<classmate.version>1.5.1</classmate.version>
<hibernate-orm.version>6.2.1.Final</hibernate-orm.version> <!-- When updating, align bytebuddy.version to Hibernate needs as well (just below): -->
<hibernate-orm.version>6.2.4.Final</hibernate-orm.version> <!-- When updating, align bytebuddy.version to Hibernate needs as well (just below): -->
<bytebuddy.version>1.12.18</bytebuddy.version> <!-- Version controlled by Hibernate ORM's needs -->
<hibernate-commons-annotations.version>6.0.6.Final</hibernate-commons-annotations.version> <!-- version controlled by Hibernate ORM -->
<hibernate-reactive.version>2.0.0.CR1</hibernate-reactive.version>
<hibernate-reactive.version>2.0.0.Final</hibernate-reactive.version>
<hibernate-validator.version>8.0.0.Final</hibernate-validator.version>
<hibernate-search.version>6.1.7.Final</hibernate-search.version>
<narayana.version>6.0.1.Final</narayana.version>
Expand Down Expand Up @@ -159,7 +159,7 @@
<azure-functions-java-spi.version>1.0.0</azure-functions-java-spi.version>
<kotlin.version>1.8.21</kotlin.version>
<kotlin.coroutine.version>1.7.1</kotlin.coroutine.version>
<kotlin-serialization.version>1.5.0</kotlin-serialization.version>
<kotlin-serialization.version>1.5.1</kotlin-serialization.version>
<dekorate.version>3.6.1</dekorate.version> <!-- Please check with Java Operator SDK team before updating -->
<maven-invoker.version>3.2.0</maven-invoker.version>
<awaitility.version>4.2.0</awaitility.version>
Expand Down Expand Up @@ -201,7 +201,7 @@
<log4j2-api.version>2.20.0</log4j2-api.version>
<log4j-jboss-logmanager.version>1.3.0.Final</log4j-jboss-logmanager.version>
<avro.version>1.11.1</avro.version>
<apicurio-registry.version>2.4.2.Final</apicurio-registry.version>
<apicurio-registry.version>2.4.3.Final</apicurio-registry.version>
<apicurio-common-rest-client.version>0.1.15.Final</apicurio-common-rest-client.version> <!-- must be the version Apicurio Registry uses -->
<testcontainers.version>1.18.1</testcontainers.version> <!-- Make sure to also update docker-java.version to match its needs -->
<docker-java.version>3.3.0</docker-java.version> <!-- must be the version Testcontainers use -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@
import java.nio.charset.StandardCharsets;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import org.eclipse.microprofile.config.ConfigProvider;
import org.jboss.logging.Logger;

import io.smallrye.common.os.OS;
import io.smallrye.config.SmallRyeConfig;

public final class ContainerRuntimeUtil {

private static final Logger log = Logger.getLogger(ContainerRuntimeUtil.class);
private static final String CONTAINER_EXECUTABLE = ConfigProvider.getConfig().unwrap(SmallRyeConfig.class)
.getOptionalValue("quarkus.native.container-runtime", String.class).orElse(null);
private static final Pattern PODMAN_PATTERN = Pattern.compile("^podman(?:\\.exe)? version.*", Pattern.DOTALL);

/**
* Static variable is not used because the class gets loaded by different classloaders at
Expand All @@ -44,7 +45,7 @@ public static ContainerRuntime detectContainerRuntime(boolean required) {
return containerRuntime;
}

ContainerRuntime containerRuntimeEnvironment = getContainerRuntimeEnvironment();
final ContainerRuntime containerRuntimeEnvironment = getContainerRuntimeEnvironment();
if (containerRuntimeEnvironment == ContainerRuntime.UNAVAILABLE) {
storeContainerRuntimeInSystemProperty(ContainerRuntime.UNAVAILABLE);

Expand Down Expand Up @@ -83,7 +84,7 @@ private static ContainerRuntime getContainerRuntimeEnvironment() {
}
if (CONTAINER_EXECUTABLE.trim().equalsIgnoreCase("podman")) {
podmanVersionOutput = getVersionOutputFor(ContainerRuntime.PODMAN);
podmanAvailable = podmanVersionOutput.startsWith("podman version");
podmanAvailable = PODMAN_PATTERN.matcher(podmanVersionOutput).matches();
if (podmanAvailable) {
return ContainerRuntime.PODMAN;
}
Expand All @@ -96,15 +97,13 @@ private static ContainerRuntime getContainerRuntimeEnvironment() {
dockerAvailable = dockerVersionOutput.contains("Docker version");
if (dockerAvailable) {
// Check if "docker" is an alias to "podman"
if (dockerVersionOutput.startsWith("podman version") ||
dockerVersionOutput.startsWith("podman.exe version")) {
if (PODMAN_PATTERN.matcher(dockerVersionOutput).matches()) {
return ContainerRuntime.PODMAN;
}
return ContainerRuntime.DOCKER;
}
podmanVersionOutput = getVersionOutputFor(ContainerRuntime.PODMAN);
podmanAvailable = podmanVersionOutput.startsWith("podman version") ||
podmanVersionOutput.startsWith("podman.exe version");
podmanAvailable = PODMAN_PATTERN.matcher(podmanVersionOutput).matches();
if (podmanAvailable) {
return ContainerRuntime.PODMAN;
}
Expand All @@ -130,7 +129,7 @@ private static ContainerRuntime loadContainerRuntimeFromSystemProperty() {
return null;
}

ContainerRuntime containerRuntime = ContainerRuntime.valueOf(runtime);
final ContainerRuntime containerRuntime = ContainerRuntime.of(runtime);

if (containerRuntime == null) {
log.warnf("System property %s contains an unknown value %s. Ignoring it.",
Expand Down Expand Up @@ -225,7 +224,7 @@ public enum ContainerRuntime {
private final boolean rootless;

ContainerRuntime(String executableName, boolean rootless) {
this.executableName = executableName + (OS.current() == OS.WINDOWS ? ".exe" : "");
this.executableName = executableName;
this.rootless = rootless;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class OutputOptionMixin implements MessageWriter {

static final boolean picocliDebugEnabled = "DEBUG".equalsIgnoreCase(System.getProperty("picocli.trace"));

@CommandLine.Option(names = { "-e", "--errors" }, description = "Display error messages.")
@CommandLine.Option(names = { "-e", "--errors" }, description = "Print more context on errors and exceptions.")
boolean showErrors;

@CommandLine.Option(names = { "--verbose" }, description = "Verbose mode.")
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/dev-ui.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include::_attributes.adoc[]
.Dev UI v1
====
This guide covers the Dev UI v1, which has been replaced in Quarkus 3.
You can still access the Dev UI v1 using http://localhost/q/dev-v1/
You can still access the Dev UI v1 using http://localhost:8080/q/dev-v1[/q/dev-v1]
====

This guide covers the Quarkus Dev UI for xref:building-my-first-extension.adoc[extension authors].
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/security-keycloak-admin-client.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ An example using the `client-credentials` grant type needs only a minor adjustme

[source,properties]
----
quarkus.keycloak.admin-client=true
quarkus.keycloak.admin-client.enabled=true
quarkus.keycloak.admin-client.server-url=http://localhost:8081
quarkus.keycloak.admin-client.realm=quarkus
quarkus.keycloak.admin-client.client-id=quarkus-client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ metadata:
categories:
- "data"
status: "stable"
unlisted: true
unlisted: true
config:
- "quarkus.datasource."
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public void enrollBeanValidationTypeSafeActivatorForReflection(Capabilities capa
if (capabilities.isPresent(Capability.HIBERNATE_VALIDATOR)) {
reflectiveClasses.produce(ReflectiveClassBuildItem.builder("org.hibernate.boot.beanvalidation.TypeSafeActivator")
.methods().fields().build());
reflectiveClasses.produce(ReflectiveClassBuildItem.builder(BeanValidationIntegrator.BV_CHECK_CLASS)
reflectiveClasses.produce(ReflectiveClassBuildItem.builder(BeanValidationIntegrator.JAKARTA_BV_CHECK_CLASS)
.constructors(false).build());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ private PrevalidatedQuarkusMetadata trimBootstrapMetadata(MetadataImpl fullMeta)
fullMeta.getMetadataBuildingOptions(), //TODO Replace this
fullMeta.getEntityBindingMap(),
fullMeta.getComposites(),
fullMeta.getGenericComponentsMap(),
fullMeta.getMappedSuperclassMap(),
fullMeta.getCollectionBindingMap(),
fullMeta.getTypeDefinitionMap(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.hibernate.engine.jdbc.internal.SqlStatementLoggerInitiator;
import org.hibernate.event.internal.EntityCopyObserverFactoryInitiator;
import org.hibernate.integrator.spi.Integrator;
import org.hibernate.loader.ast.internal.BatchLoaderFactoryInitiator;
import org.hibernate.persister.internal.PersisterClassResolverInitiator;
import org.hibernate.persister.internal.PersisterFactoryInitiator;
import org.hibernate.property.access.internal.PropertyAccessStrategyResolverInitiator;
Expand Down Expand Up @@ -235,6 +236,9 @@ private static List<StandardServiceInitiator<?>> buildQuarkusServiceInitiatorLis
// Default implementation
serviceInitiators.add(ParameterMarkerStrategyInitiator.INSTANCE);

// Default implementation
serviceInitiators.add(BatchLoaderFactoryInitiator.INSTANCE);

// Default implementation
serviceInitiators.add(SqlStatementLoggerInitiator.INSTANCE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ public void visitRegisteredComponents(Consumer<Component> consumer) {
metadata.visitRegisteredComponents(consumer);
}

@Override
public Component getGenericComponent(Class<?> componentClass) {
return metadata.getGenericComponent(componentClass);
}

public Map<String, PersistentClass> getEntityBindingMap() {
return metadata.getEntityBindingMap();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.hibernate.engine.jdbc.internal.JdbcServicesInitiator;
import org.hibernate.engine.jdbc.internal.SqlStatementLoggerInitiator;
import org.hibernate.event.internal.EntityCopyObserverFactoryInitiator;
import org.hibernate.loader.ast.internal.BatchLoaderFactoryInitiator;
import org.hibernate.persister.internal.PersisterClassResolverInitiator;
import org.hibernate.persister.internal.PersisterFactoryInitiator;
import org.hibernate.property.access.internal.PropertyAccessStrategyResolverInitiator;
Expand Down Expand Up @@ -106,6 +107,9 @@ public List<StandardServiceInitiator<?>> initialInitiatorList() {
// Default implementation
serviceInitiators.add(ParameterMarkerStrategyInitiator.INSTANCE);

// Default implementation
serviceInitiators.add(BatchLoaderFactoryInitiator.INSTANCE);

// Default implementation
serviceInitiators.add(SqlStatementLoggerInitiator.INSTANCE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import jakarta.persistence.PersistenceUnit;

import org.hibernate.reactive.common.spi.Implementor;
import org.hibernate.reactive.common.spi.MutinyImplementor;
import org.hibernate.reactive.mutiny.Mutiny;
import org.hibernate.reactive.mutiny.impl.MutinySessionFactoryImpl;

Expand All @@ -29,7 +28,7 @@ public class ReactiveSessionFactoryProducer {
@ApplicationScoped
@DefaultBean
@Unremovable
@Typed({ Mutiny.SessionFactory.class, MutinyImplementor.class, Implementor.class })
@Typed({ Mutiny.SessionFactory.class, Implementor.class })
public MutinySessionFactoryImpl mutinySessionFactory() {
if (jpaConfig.getDeactivatedPersistenceUnitNames()
.contains(HibernateReactive.DEFAULT_REACTIVE_PERSISTENCE_UNIT_NAME)) {
Expand All @@ -38,7 +37,6 @@ public MutinySessionFactoryImpl mutinySessionFactory() {
+ HibernateReactive.DEFAULT_REACTIVE_PERSISTENCE_UNIT_NAME
+ ": Hibernate Reactive was deactivated through configuration properties");
}
// TODO Remove this cast when we get rid of the dependency to MutinyImplementor
return (MutinySessionFactoryImpl) emf.unwrap(Mutiny.SessionFactory.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.hibernate.property.access.internal.PropertyAccessStrategyResolverInitiator;
import org.hibernate.reactive.engine.jdbc.mutation.internal.ReactiveMutationExecutorServiceInitiator;
import org.hibernate.reactive.id.factory.spi.ReactiveIdentifierGeneratorFactoryInitiator;
import org.hibernate.reactive.loader.ast.internal.ReactiveBatchLoaderFactoryInitiator;
import org.hibernate.reactive.provider.service.NativeParametersHandling;
import org.hibernate.reactive.provider.service.NoJtaPlatformInitiator;
import org.hibernate.reactive.provider.service.ReactiveMarkerServiceInitiator;
Expand Down Expand Up @@ -245,6 +246,9 @@ private static List<StandardServiceInitiator<?>> buildQuarkusServiceInitiatorLis
// Default implementation
serviceInitiators.add(SqlStatementLoggerInitiator.INSTANCE);

// Custom for Hibernate Reactive: BatchLoaderFactory
serviceInitiators.add(ReactiveBatchLoaderFactoryInitiator.INSTANCE);

serviceInitiators.trimToSize();
return serviceInitiators;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.hibernate.persister.internal.PersisterFactoryInitiator;
import org.hibernate.property.access.internal.PropertyAccessStrategyResolverInitiator;
import org.hibernate.reactive.id.factory.spi.ReactiveIdentifierGeneratorFactoryInitiator;
import org.hibernate.reactive.loader.ast.internal.ReactiveBatchLoaderFactoryInitiator;
import org.hibernate.reactive.provider.service.NativeParametersHandling;
import org.hibernate.reactive.provider.service.NoJtaPlatformInitiator;
import org.hibernate.reactive.provider.service.ReactiveMarkerServiceInitiator;
Expand Down Expand Up @@ -127,6 +128,9 @@ public List<StandardServiceInitiator<?>> initialInitiatorList() {
// Default implementation
serviceInitiators.add(SqlStatementLoggerInitiator.INSTANCE);

// Custom for Hibernate Reactive: BatchLoaderFactory
serviceInitiators.add(ReactiveBatchLoaderFactoryInitiator.INSTANCE);

serviceInitiators.trimToSize();
return serviceInitiators;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,27 @@ void build(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
final String driverName = "org.postgresql.Driver";
reflectiveClass.produce(ReflectiveClassBuildItem.builder(driverName).build());

// We want to register these postgresql "object" types since they are used by a driver to build result set elements
// and reflection is used to create their instances. While ORM might only use a `PGInterval` if a @JdbcType(PostgreSQLIntervalSecondJdbcType.class)
// is applied to a Duration property, we still register other types as users might create their own JdbcTypes that
// would rely on some subtype of a PGobject:
final String[] pgObjectClasses = new String[] {
"org.postgresql.util.PGobject",
"org.postgresql.util.PGInterval",
"org.postgresql.util.PGmoney",
"org.postgresql.geometric.PGbox",
"org.postgresql.geometric.PGcircle",
"org.postgresql.geometric.PGline",
"org.postgresql.geometric.PGlseg",
"org.postgresql.geometric.PGpath",
"org.postgresql.geometric.PGpoint",
"org.postgresql.geometric.PGpolygon",
// One more subtype of the PGobject, it doesn't look like that this one will be instantiated through reflection,
// so let's not include it:
// "org.postgresql.jdbc.PgResultSet.NullObject"
};
reflectiveClass.produce(ReflectiveClassBuildItem.builder(pgObjectClasses).build());

// Needed when quarkus.datasource.jdbc.transactions=xa for the setting of the username and password
reflectiveClass.produce(ReflectiveClassBuildItem.builder("org.postgresql.ds.common.BaseDataSource").constructors(false)
.methods().build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,14 +561,17 @@ public AdditionalBeanBuildItem kafkaClientBeans() {
@BuildStep(onlyIf = IsDevelopment.class)
@Record(ExecutionTime.RUNTIME_INIT)
public void registerKafkaUiExecHandler(
Capabilities capabilities,
BuildProducer<DevConsoleRouteBuildItem> routeProducer,
KafkaUiRecorder recorder) {
routeProducer.produce(DevConsoleRouteBuildItem.builder()
.method("POST")
.handler(recorder.kafkaControlHandler())
.path(KAFKA_ADMIN_PATH)
.bodyHandlerRequired()
.build());
if (capabilities.isPresent(Capability.VERTX_HTTP)) {
routeProducer.produce(DevConsoleRouteBuildItem.builder()
.method("POST")
.handler(recorder.kafkaControlHandler())
.path(KAFKA_ADMIN_PATH)
.bodyHandlerRequired()
.build());
}
}

@BuildStep(onlyIf = IsDevelopment.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private TenantConfigContext createStaticTenantContext(Vertx vertx,
public TenantConfigContext apply(Throwable t) {
if (t instanceof OIDCException) {
LOG.warnf("Tenant '%s': '%s'."
+ " OIDC server is not available yet, an attempt to connect will be made duiring the first request."
+ " OIDC server is not available yet, an attempt to connect will be made during the first request."
+ " Access to resources protected by this tenant may fail"
+ " if OIDC server will not become available",
tenantId, t.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import io.quarkus.arc.Arc;
import io.quarkus.arc.ArcContainer;
Expand Down Expand Up @@ -51,8 +52,9 @@ public static Redis create(String name, Vertx vertx, RedisClientConfig config) {
}
} else if (config.hostsProviderName.isPresent()) {
RedisHostsProvider hostsProvider = findProvider(config.hostsProviderName.get());
hosts.addAll(hostsProvider.getHosts());
for (URI uri : hostsProvider.getHosts()) {
Set<URI> computedHosts = hostsProvider.getHosts();
hosts.addAll(computedHosts);
for (URI uri : computedHosts) {
options.addConnectionString(uri.toString());
}
} else {
Expand Down
Loading

0 comments on commit d68dd00

Please sign in to comment.