Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9d9010b
use autoconfig instead of manual config: 999
pinguin3245678 Jan 5, 2025
6dc43b3
max_line_length = 140
pinguin3245678 Jan 5, 2025
0057f06
Bump strimzi-test-container version from 0.107.0 to 0.109.1
ozangunalp Jan 14, 2025
cf6c2cd
Use VertxLogDelegateFactory for internal Vert.x logging
geoand Jan 15, 2025
4217cdb
Switch to runtime initialization instead of rerun
zakkak Feb 15, 2024
ec2b9ba
Runtime reinitialize NioSocketImpl for backward compatibility
zakkak Jan 15, 2025
68c5071
Deprecate `RuntimeReinitializedClassBuildItem`
zakkak Jan 15, 2025
a18d095
avoid star imports
pinguin3245678 Jan 14, 2025
788d381
add more
pinguin3245678 Jan 15, 2025
1e54448
add more
pinguin3245678 Jan 15, 2025
985c5a3
feat(oidc): Reuse Vert.x in DEV and Test mode when possible
michalvavrik Jan 15, 2025
1d9029d
Added helper methods for manual spans in mutiny pipelines.
arn-ivu Jan 8, 2025
d88dc63
Fix import format gaps
pinguin3245678 Jan 16, 2025
1e499cf
Merge pull request #45478 from arn-ivu/mutiny-tracing-helper
ozangunalp Jan 16, 2025
efe5f24
Merge pull request #45607 from ozangunalp/bump_strimzi_test_container
ozangunalp Jan 16, 2025
ad0a86b
Merge pull request #45613 from geoand/vertx-logging
geoand Jan 16, 2025
7d664bd
Enable io.netty.allocator.disableCacheFinalizersForFastThreadLocalThr…
gsmet Jul 4, 2024
beee3db
Merge pull request #45621 from michalvavrik/feature/oidc-dev-test-reu…
sberyozkin Jan 16, 2025
e227b9c
docs,tests(oidc): Use OidcTestClient with Dev Svc for OIDC
michalvavrik Jan 16, 2025
930d0f2
Enable public access to OidcProviderClientImpl#getWebClient
sberyozkin Jan 16, 2025
c59377e
Merge pull request #45628 from michalvavrik/feature/use-oidctestclien…
sberyozkin Jan 16, 2025
e4c8488
Merge pull request #45611 from zakkak/2024-02-15-no-runtime-rerun
zakkak Jan 16, 2025
c40e974
Update .editorconfig
Jan 16, 2025
3b7c7fb
max_line_length = 128
pinguin3245678 Jan 16, 2025
378e0d5
editorconfig
pinguin3245678 Jan 16, 2025
f55a6de
Merge pull request #45648 from sberyozkin/oidc_provider_client_impl_w…
gastaldi Jan 16, 2025
4e6245c
Merge branch 'fix-import-format-gaps' into add-editorconfig
pinguin3245678 Jan 16, 2025
c0759c3
Merge pull request #41686 from gsmet/netty-avoid-finalizers
gsmet Jan 16, 2025
41fa412
Merge branch 'avoid-star-imports' into add-editorconfig
pinguin3245678 Jan 16, 2025
57f9b7f
wip
pinguin3245678 Jan 16, 2025
bd0a225
use autoconfig instead of manual config: 999
pinguin3245678 Jan 5, 2025
8881407
max_line_length = 140
pinguin3245678 Jan 5, 2025
f69438a
Update .editorconfig
Jan 16, 2025
56b3b5c
max_line_length = 128
pinguin3245678 Jan 16, 2025
7cf83e0
editorconfig
pinguin3245678 Jan 16, 2025
8faa042
Fix import format gaps
pinguin3245678 Jan 16, 2025
5d6e52d
avoid star imports
pinguin3245678 Jan 14, 2025
6ff88b6
add more
pinguin3245678 Jan 15, 2025
86bf7a8
add more
pinguin3245678 Jan 15, 2025
d405759
wip
pinguin3245678 Jan 16, 2025
6ca95bf
add
Jan 16, 2025
70ac391
wip
Jan 16, 2025
4b3a808
Merge remote-tracking branch 'f/add-editorconfig' into add-editorconfig
Jan 16, 2025
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
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# [*]
# charset = utf-8
# end_of_line = lf
# indent_style = space
# insert_final_newline = false
# max_line_length = 128

[*.java]
ij_java_names_count_to_use_import_on_demand = 999
ij_java_class_count_to_use_import_on_demand = 999
6 changes: 5 additions & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
<kafka3.version>3.7.2</kafka3.version>
<lz4.version>1.8.0</lz4.version> <!-- dependency of the kafka-clients that could be overridden by other imported BOMs in the platform -->
<snappy.version>1.1.10.5</snappy.version>
<strimzi-test-container.version>0.107.0</strimzi-test-container.version>
<strimzi-test-container.version>0.109.1</strimzi-test-container.version>
<!-- Scala is used by Kafka so we need to choose a compatible version -->
<scala.version>2.13.16</scala.version>
<aws-lambda-java.version>1.2.3</aws-lambda-java.version>
Expand Down Expand Up @@ -4501,6 +4501,10 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down
6 changes: 5 additions & 1 deletion bom/test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<jaxb-api.version>2.3.1</jaxb-api.version>

<rxjava1.version>1.3.8</rxjava1.version>
<strimzi-test-container.version>0.107.0</strimzi-test-container.version>
<strimzi-test-container.version>0.109.1</strimzi-test-container.version>

<opentelemetry-proto.version>1.0.0-alpha</opentelemetry-proto.version>
</properties>
Expand Down Expand Up @@ -67,6 +67,10 @@
<groupId>com.github.docker-java</groupId>
<artifactId>docker-java-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.quarkus.builder;

import static io.quarkus.builder.Execution.*;
import static io.quarkus.builder.Execution.log;

import java.time.LocalTime;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
package io.quarkus.deployment;

import java.util.*;

import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.TreeMap;
import java.util.TreeSet;

public class CollectionClassProcessor {
@BuildStep
ReflectiveClassBuildItem setupCollectionClasses() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package io.quarkus.deployment;

import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem;

public class NioSocketImplProcessor {

// Workaround till https://github.com/oracle/graal/pull/10431 gets merged and backported to all supported versions
@BuildStep
RuntimeInitializedClassBuildItem reinitializeClass() {
return new RuntimeInitializedClassBuildItem("sun.nio.ch.NioSocketImpl");
RuntimeReinitializedClassBuildItem reinitializeClass() {
return new RuntimeReinitializedClassBuildItem("sun.nio.ch.NioSocketImpl");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
/**
* A class that will be reinitialized at runtime in native mode. This will result in the static
* initializer running twice.
*
* @deprecated Starting with Mandrel/GraalVM 23.1 for JDK 21 this is functionally the same with
* {@link RuntimeInitializedClassBuildItem}.
*/
@Deprecated(since = "3.18")
public final class RuntimeReinitializedClassBuildItem extends MultiBuildItem {

private final String className;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.quarkus.deployment.pkg.builditem;

import static io.quarkus.deployment.pkg.PackageConfig.JarConfig.JarType.*;
import static io.quarkus.deployment.pkg.PackageConfig.JarConfig.JarType.MUTABLE_JAR;

import java.nio.file.Path;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.quarkus.deployment.pkg.steps;

import static io.quarkus.deployment.pkg.PackageConfig.JarConfig.JarType.*;
import static io.quarkus.deployment.pkg.PackageConfig.JarConfig.JarType.FAST_JAR;
import static io.quarkus.deployment.pkg.steps.LinuxIDUtil.getLinuxID;
import static io.quarkus.deployment.util.ContainerRuntimeUtil.detectContainerRuntime;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.quarkus.deployment.pkg.steps;

import static io.quarkus.commons.classloading.ClassLoaderHelper.fromClassNameToResourceName;
import static io.quarkus.deployment.pkg.PackageConfig.JarConfig.JarType.LEGACY_JAR;
import static io.quarkus.deployment.pkg.PackageConfig.JarConfig.JarType.MUTABLE_JAR;
import static io.quarkus.deployment.pkg.PackageConfig.JarConfig.JarType.UBER_JAR;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.UnsafeAccessedFieldBuildItem;
import io.quarkus.deployment.pkg.NativeConfig;
import io.quarkus.gizmo.AssignableResultHandle;
import io.quarkus.gizmo.BranchResult;
import io.quarkus.gizmo.BytecodeCreator;
import io.quarkus.gizmo.CatchBlockCreator;
Expand Down Expand Up @@ -176,29 +177,50 @@ public void write(String s, byte[] bytes) {
// hack in reinitialization of process info classes
if (!runtimeReinitializedClassBuildItems.isEmpty()) {
MethodCreator runtimeReinitializedClasses = file
.getMethodCreator("runtimeReinitializedClasses", void.class)
.getMethodCreator("runtimeReinitializedClasses", Class[].class)
.setModifiers(Modifier.PRIVATE | Modifier.STATIC);

ResultHandle thisClass = runtimeReinitializedClasses.loadClassFromTCCL(GRAAL_FEATURE);
ResultHandle cl = runtimeReinitializedClasses.invokeVirtualMethod(
ofMethod(Class.class, "getClassLoader", ClassLoader.class),
thisClass);
ResultHandle quarkus = runtimeReinitializedClasses.load("Quarkus");
ResultHandle imageSingleton = runtimeReinitializedClasses.invokeStaticMethod(IMAGE_SINGLETONS_LOOKUP,
runtimeReinitializedClasses.loadClassFromTCCL(RUNTIME_CLASS_INITIALIZATION_SUPPORT));
for (RuntimeReinitializedClassBuildItem runtimeReinitializedClass : runtimeReinitializedClassBuildItems) {
ResultHandle classesArray = runtimeReinitializedClasses.newArray(Class.class,
runtimeReinitializedClasses.load(runtimeReinitializedClassBuildItems.size()));
for (int i = 0; i < runtimeReinitializedClassBuildItems.size(); i++) {
TryBlock tc = runtimeReinitializedClasses.tryBlock();
ResultHandle clazz = tc.invokeStaticMethod(
ofMethod(Class.class, "forName", Class.class, String.class, boolean.class, ClassLoader.class),
tc.load(runtimeReinitializedClass.getClassName()), tc.load(false), cl);
tc.invokeInterfaceMethod(RERUN_INITIALIZATION, imageSingleton, clazz, quarkus);

tc.load(runtimeReinitializedClassBuildItems.get(i).getClassName()), tc.load(false), cl);
tc.writeArrayValue(classesArray, i, clazz);
CatchBlockCreator cc = tc.addCatch(Throwable.class);
cc.invokeVirtualMethod(ofMethod(Throwable.class, "printStackTrace", void.class), cc.getCaughtException());
}
runtimeReinitializedClasses.returnVoid();
runtimeReinitializedClasses.returnValue(classesArray);

overallCatch.invokeStaticMethod(runtimeReinitializedClasses.getMethodDescriptor());
ResultHandle classes = overallCatch.invokeStaticMethod(runtimeReinitializedClasses.getMethodDescriptor());

ResultHandle graalVMVersion = overallCatch.invokeStaticMethod(GRAALVM_VERSION_GET_CURRENT);
BranchResult graalVm23_1Test = overallCatch
.ifGreaterEqualZero(overallCatch.invokeVirtualMethod(GRAALVM_VERSION_COMPARE_TO, graalVMVersion,
overallCatch.marshalAsArray(int.class, overallCatch.load(23), overallCatch.load(1))));
/* GraalVM >= 23.1 */
try (BytecodeCreator greaterEqual23_1 = graalVm23_1Test.trueBranch()) {
greaterEqual23_1.invokeStaticMethod(INITIALIZE_CLASSES_AT_RUN_TIME, classes);
}
/* GraalVM < 23.1 */
try (BytecodeCreator less23_1 = graalVm23_1Test.falseBranch()) {
ResultHandle quarkus = less23_1.load("Quarkus");
ResultHandle imageSingleton = less23_1.invokeStaticMethod(IMAGE_SINGLETONS_LOOKUP,
less23_1.loadClassFromTCCL(RUNTIME_CLASS_INITIALIZATION_SUPPORT));
ResultHandle arraySize = less23_1.arrayLength(classes);
AssignableResultHandle index = less23_1.createVariable(int.class);
less23_1.assign(index, less23_1.load(0));
try (BytecodeCreator loop = less23_1.whileLoop(c -> c.ifIntegerLessThan(index, arraySize)).block()) {
loop.invokeInterfaceMethod(RERUN_INITIALIZATION, imageSingleton, loop.readArrayValue(classes, index),
quarkus);
loop.assign(index, loop.increment(index));
}
}
}

// Ensure registration of fields being accessed through unsafe is done last to ensure that the class
Expand Down
8 changes: 8 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,12 @@
<module>class-change-agent</module>
<module>junit4-mock</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.ec4j.maven</groupId>
<artifactId>editorconfig-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.acme;

import io.quarkus.runtime.StartupEvent;
import org.eclipse.microprofile.reactive.messaging.*;
import java.util.stream.Stream;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.event.Observes;
import jakarta.inject.Inject;
import java.util.stream.Stream;

import io.quarkus.runtime.StartupEvent;

@ApplicationScoped
public class MyMessagingApplication {
Expand Down
54 changes: 54 additions & 0 deletions docs/src/main/asciidoc/opentelemetry-tracing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,60 @@ public void tracedWork() {
}
----

=== Mutiny
Methods returning reactive types can also be annotated with `@WithSpan` and `@AddingSpanAttributes` to create a new span or add attributes to the current span.

If you need to create spans manually within a mutiny pipeline, use `wrapWithSpan` method from `io.quarkus.opentelemetry.runtime.tracing.mutiny.MutinyTracingHelper`.

Example. Assuming you have the following pipeline:
[source,java]
----
Uni<String> uni = Uni.createFrom().item("hello")
//start trace here
.onItem().transform(item -> item + " world")
.onItem().transform(item -> item + "!")
//end trace here
.subscribe().with(
item -> System.out.println("Received: " + item),
failure -> System.out.println("Failed with " + failure)
);
----
wrap it like this:
[source,java]
----
import static io.quarkus.opentelemetry.runtime.tracing.mutiny.MutinyTracingHelper.wrapWithSpan;
...
@Inject
Tracer tracer;
...
Context context = Context.current();
Uni<String> uni = Uni.createFrom().item("hello")
.transformToUni(m -> wrapWithSpan(tracer, Optional.of(context), "my-span-name",
Uni.createFrom().item(m)
.onItem().transform(item -> item + " world")
.onItem().transform(item -> item + "!")
))
.subscribe().with(
item -> System.out.println("Received: " + item),
failure -> System.out.println("Failed with " + failure)
);

----
for multi-pipelines it works similarly:
[source,java]
----
Multi.createFrom().items("Alice", "Bob", "Charlie")
.transformToMultiAndConcatenate(m -> TracingHelper.withTrace("my-span-name",
Multi.createFrom().item(m)
.onItem().transform(name -> "Hello " + name)
))
.subscribe().with(
item -> System.out.println("Received: " + item),
failure -> System.out.println("Failed with " + failure)
);
----
Instead of `transformToMultiAndConcatenate` you can use `transformToMultiAndMerge` if you don't care about the order of the items.

=== Quarkus Messaging - Kafka

When using the Quarkus Messaging extension for Kafka,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,48 @@ For a test like this to work, the test `Auth0` application must have the `passwo
This example code also shows how to pass additional parameters.
For `Auth0`, these are the `audience` and `scope` parameters.

===== Test OIDC DevService

You can also use `OidcTestClient` to test Quarkus endpoints supported by xref:security-openid-connect-dev-services.adoc#dev-services-for-oidc[Dev Services for OIDC].
No configuration in the `application.properties` file is needed, Quarkus will configure `OidcTestClient` for you:

[source, java]
----
package org.acme;

import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test;

import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.oidc.client.OidcTestClient;

@QuarkusTest
public class GreetingResourceTest {

static final OidcTestClient oidcTestClient = new OidcTestClient();

@AfterAll
public static void close() {
oidcTestClient.close();
}

@Test
public void testHelloEndpoint() {
String accessToken = oidcTestClient.getAccessToken("alice", "alice");
given()
.auth().oauth2(accessToken)
.when().get("/hello")
.then()
.statusCode(200)
.body(is("Hello, Alice"));
}

}
----

ifndef::no-deprecated-test-resource[]
[[bearer-token-integration-testing-keycloak]]
==== `KeycloakTestResourceLifecycleManager`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ This document refers to the `http://localhost:8080/q/dev-ui` Dev UI URL in sever
If you customize `quarkus.http.root-path` or `quarkus.http.non-application-root-path` properties, then replace `q` accordingly.
For more information, see the https://quarkus.io/blog/path-resolution-in-quarkus/[Path resolution in Quarkus] blog post.

[[dev-services-for-oidc]]
== Dev Services for OIDC

When you work with Keycloak in production, <<dev-services-for-keycloak>> provides the best dev mode experience.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ${package};

import static io.quarkus.vertx.web.Route.HttpMethod.*;
import static io.quarkus.vertx.web.Route.HttpMethod.GET;

import io.quarkus.vertx.web.Route;
import io.vertx.ext.web.RoutingContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
package io.quarkus.azure.functions.resteasy.runtime;

import static com.microsoft.azure.functions.HttpMethod.*;
import static com.microsoft.azure.functions.HttpMethod.CONNECT;
import static com.microsoft.azure.functions.HttpMethod.DELETE;
import static com.microsoft.azure.functions.HttpMethod.GET;
import static com.microsoft.azure.functions.HttpMethod.HEAD;
import static com.microsoft.azure.functions.HttpMethod.OPTIONS;
import static com.microsoft.azure.functions.HttpMethod.PATCH;
import static com.microsoft.azure.functions.HttpMethod.POST;
import static com.microsoft.azure.functions.HttpMethod.PUT;
import static com.microsoft.azure.functions.HttpMethod.TRACE;

import java.util.Optional;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.Properties;
import java.util.TreeMap;

import org.apache.commons.lang3.StringUtils;
import org.apache.maven.model.MailingList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ public interface OidcDevServicesConfig {
/**
* A map of roles for OIDC identity provider users.
* <p>
* If empty, default roles are assigned: `alice` receives `admin` and `user` roles, while other users receive
* `user` role.
* This map is used for role creation when no realm file is found at the `realm-path`.
* If empty, default roles are assigned: user `alice` receives `admin` and `user` roles and user `bob` receives role `user`.
*/
@ConfigDocMapKey("role-name")
Map<String, List<String>> roles();
Expand Down
Loading
Loading