Skip to content

Commit 3e23e09

Browse files
michalvavrikrsvoboda
authored andcommitted
Hibernate Offline Startup: drop CDI req ctx workaround
1 parent fb577d3 commit 3e23e09

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

hibernate/hibernate-offline-startup/README.MD

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,3 @@ Tests are motivated by the [QUARKUS-3363](https://issues.redhat.com/browse/QUARK
2323
* We create a schema using the Hibernate ORM SchemaManager, which is not supported for multitenancy (but works like a charm...). However, if we disable telemetry for the req_scope_credentials datasource and keep it for the app_scope_credentials datasource while both datasources are used by the same Hibernate persistence unit, traces for both schemes generation are present. I have tried to create a reproducer with supported scenarios and couldn’t. Therefore, we test telemetry for all tenants (datasources) resolved for the default persistence unit.
2424
* Detection of build-time configuration properties for forced dependencies
2525
* Current mechanism used by our framework to detect build-time properties relies on a classpath during the testing framework bootstrap. Thus, we either need to hardcode a list of build-time properties for these dependencies in our framework or put the build-time properties in our application.properties file. That’s the reason for having the `quarkus.hibernate-orm.dialect.mariadb.bytes-per-character` configuration property defined for all the test classes.
26-
* CDI Request Context
27-
* Due to the https://github.com/quarkusio/quarkus/issues/50154, test that should verify credentials propagation using CDI Request Context is storing state in static variables. This would not work in a concurrent environment.

hibernate/hibernate-offline-startup/src/main/java/io/quarkus/ts/hibernate/startup/offline/pu/defaults/orm/CustomCredentialsProvider.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.util.concurrent.ConcurrentHashMap;
55

66
import jakarta.enterprise.context.ApplicationScoped;
7-
import jakarta.enterprise.context.control.ActivateRequestContext;
87

98
import io.quarkus.credentials.CredentialsProvider;
109
import io.quarkus.logging.Log;
@@ -22,8 +21,6 @@ private record UsernameAndPassword(String username, String password) {
2221
this.requestScopedData = requestScopedData;
2322
}
2423

25-
// TODO: drop the activation when https://github.com/quarkusio/quarkus/issues/50154 is fixed
26-
@ActivateRequestContext
2724
@Override
2825
public Map<String, String> getCredentials(String credentialsProviderName) {
2926
if (requestScopedData.foundCredentials()) {

hibernate/hibernate-offline-startup/src/main/java/io/quarkus/ts/hibernate/startup/offline/pu/defaults/orm/RequestScopedData.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
@RequestScoped
99
public final class RequestScopedData {
1010

11-
// TODO: make this member variables instead when https://github.com/quarkusio/quarkus/issues/50154 is fixed
12-
// or get the credentials directly from the RoutingContext instead
13-
private static volatile String user;
14-
private static volatile String password;
11+
private volatile String user;
12+
private volatile String password;
1513

1614
@Inject
1715
RoutingContext routingContext;

0 commit comments

Comments
 (0)