Skip to content

Commit 534543e

Browse files
committed
Sync documentation of main branch
1 parent 91e3273 commit 534543e

20 files changed

+165
-51
lines changed

_generated-doc/main/infra/quarkus-all-build-items.adoc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8955,6 +8955,22 @@ _No Javadoc found_
89558955

89568956

89578957

8958+
a| https://github.com/quarkusio/quarkus/blob/main/extensions/security/spi/src/main/java/io/quarkus/security/spi/SecuredInterfaceAnnotationBuildItem.java[`io.quarkus.security.spi.SecuredInterfaceAnnotationBuildItem`, window="_blank"]
8959+
[.description]
8960+
--
8961+
Security annotations on interfaces are in most cases not inherited by interface implementors. This build item allows to register interfaces whose implementors will inherit security annotations. If this build item is used extensively, it can get very complex, and we would create situations, where users can hardly tell precedence, like what will happen if different repeatable annotation instance (like the `PermissionsAllowed` annotation) is placed on both implemented and interface method. Or does method-level interface annotation take precedence over implementors class-level annotation. Examples could continue, for which reason we aim to support simple cases for now.
8962+
The all the implementors of interfaces matched by this build item annotation will inherit security annotations from interface methods and the interface class-level security annotations only apply directly on the methods declared on the interface. All scenarios that are supposed to work are tested. Any scenario that is not working is not yet supported.
8963+
-- a|`org.jboss.jandex.DotName annotationName`
8964+
8965+
_No Javadoc found_
8966+
8967+
`io.quarkus.security.spi.SecuredAnnotationTargetKind targetKind`
8968+
8969+
_No Javadoc found_
8970+
8971+
8972+
8973+
89588974
a| https://github.com/quarkusio/quarkus/blob/main/extensions/security/spi/src/main/java/io/quarkus/security/spi/SecurityTransformerBuildItem.java[`io.quarkus.security.spi.SecurityTransformerBuildItem`, window="_blank"]
89598975
[.description]
89608976
--
@@ -8971,6 +8987,14 @@ _No Javadoc found_
89718987

89728988
_No Javadoc found_
89738989

8990+
`java.util.function.Predicate<ClassInfo> isInterfaceWithTransformations`
8991+
8992+
_No Javadoc found_
8993+
8994+
`java.util.Set<DotName> securedAnnotations`
8995+
8996+
_No Javadoc found_
8997+
89748998

89758999
|===
89769000
== Security Jakarta Persistence - Common

_versions/main/guides/aws-lambda.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ dependencies {
293293
implementation 'io.quarkus:quarkus-resteasy'
294294
implementation 'io.quarkus:quarkus-amazon-lambda'
295295
296-
testImplementation 'io.quarkus:quarkus-junit5'
296+
testImplementation 'io.quarkus:quarkus-junit'
297297
testImplementation 'io.rest-assured:rest-assured'
298298
}
299299
----

_versions/main/guides/building-my-first-extension.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ Let's have a look at the deployment's `./greeting-extension/deployment/pom.xml`.
263263
</dependency>
264264
<dependency>
265265
<groupId>io.quarkus</groupId>
266-
<artifactId>quarkus-junit5-internal</artifactId>
266+
<artifactId>quarkus-junit-internal</artifactId>
267267
<scope>test</scope>
268268
</dependency>
269269
</dependencies>
@@ -460,7 +460,7 @@ dependencies {
460460
461461
implementation platform("io.quarkus:quarkus-bom:${quarkus.version}")
462462
463-
testImplementation 'io.quarkus:quarkus-junit5-internal'
463+
testImplementation 'io.quarkus:quarkus-junit-internal'
464464
}
465465
----
466466

@@ -666,7 +666,7 @@ Now, Quarkus will process this new task which will result in the bytecode genera
666666
When developing a Quarkus extension, you mainly want to test your feature is properly deployed in an application and works as expected.
667667
That's why the tests will be hosted in the `deployment` module.
668668

669-
Quarkus proposes facilities to test extensions via the `quarkus-junit5-internal` artifact (which should already be in the deployment pom.xml), in particular the `io.quarkus.test.QuarkusUnitTest` runner which starts an application with your extension.
669+
Quarkus proposes facilities to test extensions via the `quarkus-junit-internal` artifact (which should already be in the deployment pom.xml), in particular the `io.quarkus.test.QuarkusUnitTest` runner which starts an application with your extension.
670670

671671
We will use https://rest-assured.io[RestAssured] (massively used in Quarkus) to test our HTTP endpoint.
672672
Let's add the `rest-assured` dependency into the `./greeting-extension/deployment/pom.xml`.

_versions/main/guides/doc-contribute-docs-howto.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ Our builds use https://vale.sh[Vale] to check grammar, style, and word usage in
269269

270270
This approach requires a working container runtime (Docker or xref:podman.adoc[Podman]).
271271

272-
The `docs` module has a JUnit 5 test that will run the Vale linter in a container (using https://www.testcontainers.org/[Testcontainers]).
272+
The `docs` module has a JUnit test that will run the Vale linter in a container (using https://www.testcontainers.org/[Testcontainers]).
273273
It verifies both Quarkus document metadata and Vale style rules.
274274

275275
Run the test in one of the following ways:

_versions/main/guides/getting-started-testing.adoc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ In your build file you should see 2 test dependencies:
5757
----
5858
<dependency>
5959
<groupId>io.quarkus</groupId>
60-
<artifactId>quarkus-junit5</artifactId>
60+
<artifactId>quarkus-junit</artifactId>
6161
<scope>test</scope>
6262
</dependency>
6363
<dependency>
@@ -73,18 +73,18 @@ In your build file you should see 2 test dependencies:
7373
[source,groovy,subs=attributes+]
7474
----
7575
dependencies {
76-
testImplementation("io.quarkus:quarkus-junit5")
76+
testImplementation("io.quarkus:quarkus-junit")
7777
testImplementation("io.rest-assured:rest-assured")
7878
}
7979
----
8080
****
8181

82-
`quarkus-junit5` is required for testing, as it provides the `@QuarkusTest` annotation that controls the testing framework.
82+
`quarkus-junit` is required for testing, as it provides the `@QuarkusTest` annotation that controls the testing framework.
8383
`rest-assured` is not required but is a convenient way to test HTTP endpoints, we also provide integration that automatically
8484
sets the correct URL so no configuration is required.
8585

86-
Because we are using JUnit 5, the version of the https://maven.apache.org/surefire/maven-surefire-plugin/[Surefire Maven Plugin]
87-
must be set, as the default version does not support Junit 5:
86+
Because we are using JUnit, the version of the https://maven.apache.org/surefire/maven-surefire-plugin/[Surefire Maven Plugin]
87+
must be set, as the default version does not support JUnit:
8888

8989
[source,xml,subs=attributes+]
9090
----
@@ -470,11 +470,11 @@ a bit slower, as it adds a shutdown/startup cycle to the test time, but gives a
470470

471471
To reduce the amount of times Quarkus needs to restart, `io.quarkus.test.junit.util.QuarkusTestProfileAwareClassOrderer`
472472
is registered as a global `ClassOrderer` as described in the
473-
link:https://junit.org/junit5/docs/current/user-guide/#writing-tests-test-execution-order-classes[JUnit 5 User Guide].
473+
link:https://docs.junit.org/current/user-guide/#writing-tests-test-execution-order-classes[JUnit User Guide].
474474
The behavior of this `ClassOrderer` is configurable via `application.properties` using the property
475475
`quarkus.test.class-orderer`. The property accepts the FQCN of the `ClassOrderer` to use. If the class cannot be found,
476476
it fallbacks to JUnit default behaviour which does not set a `ClassOrderer` at all. It can also be disabled entirely by
477-
setting another `ClassOrderer` that is provided by JUnit 5 or even your own custom one.
477+
setting another `ClassOrderer` that is provided by JUnit or even your own custom one.
478478

479479
=== Writing a Profile
480480

@@ -704,7 +704,7 @@ matches the value of `quarkus.test.profile.tags`.
704704

705705
== Nested Tests
706706

707-
JUnit 5 https://junit.org/junit5/docs/current/user-guide/#writing-tests-nested[@Nested tests] are useful for structuring more complex test scenarios.
707+
JUnit https://docs.junit.org/current/user-guide/#writing-tests-nested[@Nested tests] are useful for structuring more complex test scenarios.
708708
However, note that it is not possible to assign different test profiles or resources to nested tests within the same parent class.
709709

710710
== Mock Support
@@ -836,12 +836,12 @@ Building on the features provided by `QuarkusMock`, Quarkus also allows users to
836836

837837
[IMPORTANT]
838838
====
839-
This functionality is available with the `@io.quarkus.test.InjectMock` annotation **only if** the `quarkus-junit5-mockito` dependency is present:
839+
This functionality is available with the `@io.quarkus.test.InjectMock` annotation **only if** the `quarkus-junit-mockito` dependency is present:
840840
[source,xml]
841841
----
842842
<dependency>
843843
<groupId>io.quarkus</groupId>
844-
<artifactId>quarkus-junit5-mockito</artifactId>
844+
<artifactId>quarkus-junit-mockito</artifactId>
845845
<scope>test</scope>
846846
</dependency>
847847
----
@@ -958,7 +958,7 @@ This is considered an advanced option and should only be performed if you fully
958958
==== Using Spies instead of Mocks with `@InjectSpy`
959959

960960
Building on the features provided by `InjectMock`, Quarkus also allows users to effortlessly take advantage of link:https://site.mockito.org/[Mockito] for spying on the beans supported by `QuarkusMock`.
961-
This functionality is available via the `@io.quarkus.test.junit.mockito.InjectSpy` annotation which is available in the `quarkus-junit5-mockito` dependency.
961+
This functionality is available via the `@io.quarkus.test.junit.mockito.InjectSpy` annotation which is available in the `quarkus-junit-mockito` dependency.
962962

963963
Sometimes when testing you only need to verify that a certain logical path was taken, or you only need to stub out a single method's response while still executing the rest of the methods on the Spied clone. Please see link:https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#13[Mockito documentation - Spying on real objects] for more details on Spy partial mocks.
964964
In either of those situations a Spy of the object is preferable.
@@ -1484,7 +1484,7 @@ while the latter three can coexist.
14841484
The reason of this restriction is that `@QuarkusTest` starts a Quarkus server for the whole lifetime of the tests execution run,
14851485
thus preventing the other tests to start their own Quarkus server.
14861486

1487-
To alleviate this restriction, the `@QuarkusTest` annotation defines a JUnit 5 `@Tag`: `io.quarkus.test.junit.QuarkusTest`.
1487+
To alleviate this restriction, the `@QuarkusTest` annotation defines a JUnit `@Tag`: `io.quarkus.test.junit.QuarkusTest`.
14881488
You can use this tag to isolate the `@QuarkusTest` test in a specific execution run, for example with the Maven Surefire Plugin:
14891489

14901490
[source,xml]
@@ -1699,7 +1699,7 @@ public @interface QuarkusSecurityTest { <1>
16991699
== Testing Components
17001700

17011701
Quarkus provides the `QuarkusComponentTestExtension`, a JUnit extension to ease the testing of components and mocking of their dependencies.
1702-
This JUnit extension is available in the `quarkus-junit5-component` dependency.
1702+
This JUnit extension is available in the `quarkus-junit-component` dependency.
17031703

17041704
Let's have a component `Foo` - a CDI bean with two injection points.
17051705

_versions/main/guides/getting-started.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ In the generated build file, you can see 2 test dependencies:
313313
----
314314
<dependency>
315315
<groupId>io.quarkus</groupId>
316-
<artifactId>quarkus-junit5</artifactId>
316+
<artifactId>quarkus-junit</artifactId>
317317
<scope>test</scope>
318318
</dependency>
319319
<dependency>
@@ -326,13 +326,13 @@ In the generated build file, you can see 2 test dependencies:
326326
[source,gradle,role="secondary asciidoc-tabs-target-sync-gradle"]
327327
.build.gradle
328328
----
329-
testImplementation("io.quarkus:quarkus-junit5")
329+
testImplementation("io.quarkus:quarkus-junit")
330330
testImplementation("io.rest-assured:rest-assured")
331331
----
332332

333-
Quarkus supports https://junit.org/junit5/[JUnit 5] tests.
333+
Quarkus supports https://docs.junit.org/current/user-guide/[JUnit] tests.
334334

335-
Because of this, in the case of Maven, the version of the https://maven.apache.org/surefire/maven-surefire-plugin/[Surefire Maven Plugin] must be set, as the default version does not support JUnit 5:
335+
Because of this, in the case of Maven, the version of the https://maven.apache.org/surefire/maven-surefire-plugin/[Surefire Maven Plugin] must be set, as the default version does not support JUnit:
336336

337337
[source,xml,subs=attributes+]
338338
----

_versions/main/guides/hibernate-orm-panache.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,14 +1327,14 @@ public class PanacheMockingTest {
13271327

13281328
=== Using the repository pattern
13291329

1330-
If you are using the repository pattern you can use Mockito directly, using the `quarkus-junit5-mockito` module,
1330+
If you are using the repository pattern you can use Mockito directly, using the `quarkus-junit-mockito` module,
13311331
which makes mocking beans much easier:
13321332

13331333
[source,xml]
13341334
----
13351335
<dependency>
13361336
<groupId>io.quarkus</groupId>
1337-
<artifactId>quarkus-junit5-mockito</artifactId>
1337+
<artifactId>quarkus-junit-mockito</artifactId>
13381338
<scope>test</scope>
13391339
</dependency>
13401340
----

_versions/main/guides/hibernate-orm.adoc

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,6 +1949,96 @@ Please refer to the corresponding https://hibernate.org/repositories/[Hibernate
19491949
and https://jakarta.ee/specifications/data/1.0/jakarta-data-1.0[Jakarta Data]
19501950
guides to learn what else they have to offer.
19511951

1952+
==== Secure Jakarta Data repositories
1953+
1954+
Quarkus Security provides an initial support for securing Jakarta Data Repositories with security annotations.
1955+
1956+
.Example Jakarta Data repository with method-level security annotation
1957+
[source,java]
1958+
----
1959+
@Repository
1960+
public interface MyRepository extends CrudRepository<MyEntity, Integer> {
1961+
1962+
@RolesAllowed("admin")
1963+
@Delete
1964+
void delete(String name);
1965+
1966+
}
1967+
----
1968+
1969+
.Example Jakarta Data repository with class-level security annotation
1970+
[source,java]
1971+
----
1972+
@Authenticated
1973+
@Repository
1974+
public interface MyRepository extends CrudRepository<MyEntity, Integer> {
1975+
1976+
@Delete
1977+
void delete(String name);
1978+
1979+
}
1980+
----
1981+
1982+
[WARNING]
1983+
====
1984+
In the example above, only methods directly declared on the `MyRepository` interface are secured.
1985+
Methods inherited from `CrudRepository`, such as `insert`, are not secured because type-level annotations only affect the type they annotate.
1986+
====
1987+
1988+
[IMPORTANT]
1989+
====
1990+
Currently, generic interface methods using type variables or wildcards cannot be secured reliably with standard security annotations.
1991+
Therefore, you must not attempt to secure such methods and instead use two alternatives described below.
1992+
1993+
.Example repository with a generic method using a type variable
1994+
[source,java]
1995+
----
1996+
public interface MyParentRepository<T extends MyEntity> {
1997+
1998+
@Find
1999+
Stream<T> findAll(Order<T> order);
2000+
2001+
}
2002+
2003+
@Repository
2004+
public interface MyRepository extends MyParentRepository<MyEntity> {
2005+
}
2006+
----
2007+
2008+
Alternative 1: Apply a security annotation to the calling method in your REST layer:
2009+
2010+
[source,java]
2011+
----
2012+
@Path("my-entity")
2013+
public class MyEntityResource {
2014+
2015+
@Inject
2016+
MyRepository myRepository;
2017+
2018+
@PermissionsAllowed("find-all")
2019+
@GET
2020+
public List<MyEntity> findAll() {
2021+
return myRepository.findAll(Order.by(Sort.asc(MyEntity_.NAME))).toList();
2022+
}
2023+
2024+
}
2025+
----
2026+
2027+
Alternative 2: Replace the type variable `T` with a concrete type in the repository interface:
2028+
2029+
[source,java]
2030+
----
2031+
@Repository
2032+
public interface MyRepository {
2033+
2034+
@PermissionsAllowed("find-all")
2035+
@Find
2036+
Stream<MyEntity> findAll(Order<MyEntity> order);
2037+
2038+
}
2039+
----
2040+
====
2041+
19522042
[[configuration-reference]]
19532043
== Configuration Reference for Hibernate ORM
19542044

_versions/main/guides/hibernate-reactive-panache.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,23 +1060,23 @@ what mock object to pass.
10601060

10611061
=== Using the repository pattern
10621062

1063-
If you are using the repository pattern you can use Mockito directly, using the `quarkus-junit5-mockito` module,
1063+
If you are using the repository pattern you can use Mockito directly, using the `quarkus-junit-mockito` module,
10641064
which makes mocking beans much easier:
10651065

10661066
[source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"]
10671067
.pom.xml
10681068
----
10691069
<dependency>
10701070
<groupId>io.quarkus</groupId>
1071-
<artifactId>quarkus-junit5-mockito</artifactId>
1071+
<artifactId>quarkus-junit-mockito</artifactId>
10721072
<scope>test</scope>
10731073
</dependency>
10741074
----
10751075

10761076
[source,gradle,role="secondary asciidoc-tabs-target-sync-gradle"]
10771077
.build.gradle
10781078
----
1079-
testImplementation("io.quarkus:quarkus-junit5-mockito")
1079+
testImplementation("io.quarkus:quarkus-junit-mockito")
10801080
----
10811081

10821082
Given this simple entity:

_versions/main/guides/jreleaser.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ As a reference, these are the full contents of the `pom.xml`:
668668
</dependency>
669669
<dependency>
670670
<groupId>io.quarkus</groupId>
671-
<artifactId>quarkus-junit5</artifactId>
671+
<artifactId>quarkus-junit</artifactId>
672672
<scope>test</scope>
673673
</dependency>
674674
</dependencies>

0 commit comments

Comments
 (0)