Skip to content

Commit

Permalink
Merge pull request quarkusio#29079 from gsmet/2.13.4-backports-4
Browse files Browse the repository at this point in the history
2.13.4 backports 4
  • Loading branch information
gsmet authored Nov 7, 2022
2 parents 6654cc2 + 37ff6e7 commit 488e06d
Show file tree
Hide file tree
Showing 20 changed files with 674 additions and 23 deletions.
9 changes: 7 additions & 2 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
<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>5.6.12.Final</hibernate-orm.version> <!-- When updating, align bytebuddy.version to Hibernate needs as well (just below): -->
<bytebuddy.version>1.12.9</bytebuddy.version> <!-- Version controlled by Hibernate ORM's needs -->
<hibernate-orm.version>5.6.14.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-reactive.version>1.1.8.Final</hibernate-reactive.version>
<hibernate-validator.version>6.2.5.Final</hibernate-validator.version>
<hibernate-search.version>6.1.7.Final</hibernate-search.version>
Expand Down Expand Up @@ -4580,6 +4580,11 @@
<artifactId>resteasy-reactive-common-processor</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus.resteasy.reactive</groupId>
<artifactId>resteasy-reactive-common-types</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus.resteasy.reactive</groupId>
<artifactId>resteasy-reactive-client</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions core/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@
<parentFirstArtifact>au.com.dius.pact.core:matcher</parentFirstArtifact>
<parentFirstArtifact>au.com.dius.pact.consumer:junit5</parentFirstArtifact>
<parentFirstArtifact>au.com.dius.pact:consumer</parentFirstArtifact>

<!-- Make use of byteman frictionless -->
<parentFirstArtifact>org.jboss.byteman:byteman</parentFirstArtifact>
</parentFirstArtifacts>
<runnerParentFirstArtifacts>
<runnerParentFirstArtifact>org.graalvm.sdk:graal-sdk</runnerParentFirstArtifact>
Expand All @@ -231,6 +234,8 @@
<runnerParentFirstArtifact>io.smallrye.common:smallrye-common-io</runnerParentFirstArtifact>
<!-- QuarkusEntryPoint needs org-crac class definition -->
<runnerParentFirstArtifact>io.github.crac:org-crac</runnerParentFirstArtifact>
<!-- Make use of byteman frictionless -->
<runnerParentFirstArtifact>org.jboss.byteman:byteman</runnerParentFirstArtifact>
</runnerParentFirstArtifacts>
<excludedArtifacts>
<excludedArtifact>io.smallrye:smallrye-config</excludedArtifact>
Expand Down
8 changes: 6 additions & 2 deletions devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,12 @@ && isNativeProfileEnabled(mavenProject())) {
}
}
if (uberJarWithSuffix) {
projectHelper.attachArtifact(mavenProject(), result.getJar().getPath().toFile(),
result.getJar().getClassifier());
if (result.getJar().getClassifier().isEmpty()) {
original.setFile(result.getJar().getPath().toFile());
} else {
projectHelper.attachArtifact(mavenProject(), result.getJar().getPath().toFile(),
result.getJar().getClassifier());
}
}
}
} finally {
Expand Down
16 changes: 11 additions & 5 deletions docs/src/main/asciidoc/class-loading-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ This document explains the Quarkus class loading architecture. It is intended fo
authors and advanced users who want to understand exactly how Quarkus works.

The Quarkus class loading architecture is slightly different depending on the mode that
the application is run in. When running a production application everything is loaded
in the system ClassLoader, so it is a completely flat class path. This also applies to
native image mode which does not really support multiple ClassLoaders, and is based on
a normal production Quarkus application.
the application is run in.

When running a production application using the `fast-jar` package type
(which is the default), almost all dependencies are loaded via the `io.quarkus.bootstrap.runner.RunnerClassLoader`
which indexes class at build time, while a small set of dependencies is loaded from the system ClassLoader.

When running a production application using the `legacy-jar` package type everything is loaded
in the system ClassLoader, so it is a completely flat classpath.

The flat classpath strategy is also used for GraalVM native images, since GraalVM does not really support multiple ClassLoaders.

For all other use cases (e.g. tests, dev mode, and building the application) Quarkus
uses the class loading architecture outlined here.
uses the class loading architecture outlined in following section.


== Bootstrapping Quarkus
Expand Down
1 change: 0 additions & 1 deletion docs/src/main/asciidoc/grpc-getting-started.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ Create the `src/main/java/org/acme/HelloService.java` file with the following co
----
package org.acme;
import io.grpc.stub.StreamObserver;
import io.quarkus.example.Greeter;
import io.quarkus.example.HelloReply;
import io.quarkus.example.HelloRequest;
Expand Down
4 changes: 3 additions & 1 deletion docs/src/main/asciidoc/infinispan-client.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ This command adds the following dependency to your build file:
[source,gradle,role="secondary asciidoc-tabs-target-sync-gradle"]
.build.gradle
----
implementation("io.quarkus:quarkus-infinispan-client")
implementation 'io.quarkus:quarkus-infinispan-client'
annotationProcessor 'org.infinispan.protostream:protostream-processor:4.5.0.Final' <1>
----
<1> Mandatory in the gradle build to enable the generation of the files in the annotation based serialization

== Configuring the Infinispan client

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
import io.quarkus.container.spi.ContainerImageInfoBuildItem;
import io.quarkus.container.spi.ContainerImageLabelBuildItem;
import io.quarkus.container.spi.ContainerImagePushRequestBuildItem;
import io.quarkus.container.util.PathsUtil;
import io.quarkus.deployment.IsNormal;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
Expand Down Expand Up @@ -756,7 +755,6 @@ private Map<String, String> getEnvironmentVariables(JibConfig jibConfig) {
*/
private void handleExtraFiles(OutputTargetBuildItem outputTarget, JibContainerBuilder jibContainerBuilder) {
Path outputDirectory = outputTarget.getOutputDirectory();
PathsUtil.findMainSourcesRoot(outputTarget.getOutputDirectory());
Map.Entry<Path, Path> mainSourcesRoot = findMainSourcesRoot(outputDirectory);
if (mainSourcesRoot == null) { // this should never happen
return;
Expand Down Expand Up @@ -810,4 +808,4 @@ public boolean test(Path path) {
return path.getFileName().toString().endsWith(".class");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
package io.quarkus.hibernate.orm.lazyloading;

import static io.quarkus.hibernate.orm.TransactionTestUtils.inTransaction;

import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.transaction.UserTransaction;

import org.junit.jupiter.api.Test;

public abstract class AbstractLazyBasicTest {

@Inject
EntityManager em;

@Inject
UserTransaction transaction;

private final AccessDelegate delegate;
private Long entityId;

public AbstractLazyBasicTest(AccessDelegate delegate) {
this.delegate = delegate;
}

@Test
public void update_all_nullToNonNull() {
initNull();
inTransaction(transaction, () -> {
delegate.updateAllProperties(em, entityId, "updated1", "updated2", "updated3");
});
inTransaction(transaction, () -> {
delegate.testLazyLoadingAndPersistedValues(em, entityId, "updated1", "updated2", "updated3");
});
}

@Test
public void update_allLazy_nullToNonNull() {
initNull();
inTransaction(transaction, () -> {
delegate.updateAllLazyProperties(em, entityId, "updated1", "updated2");
});
inTransaction(transaction, () -> {
delegate.testLazyLoadingAndPersistedValues(em, entityId, null, "updated1", "updated2");
});
}

@Test
public void update_oneEager_nullToNonNull() {
initNull();
inTransaction(transaction, () -> {
delegate.updateOneEagerProperty(em, entityId, "updated1");
});
inTransaction(transaction, () -> {
delegate.testLazyLoadingAndPersistedValues(em, entityId, "updated1", null, null);
});
}

@Test
public void update_oneLazy_nullToNonNull() {
initNull();
inTransaction(transaction, () -> {
delegate.updateOneLazyProperty(em, entityId, "updated2");
});
inTransaction(transaction, () -> {
delegate.testLazyLoadingAndPersistedValues(em, entityId, null, "updated2", null);
});
}

@Test
public void update_all_nonNullToNonNull() {
initNonNull();
inTransaction(transaction, () -> {
delegate.updateAllProperties(em, entityId, "updated1", "updated2", "updated3");
});
inTransaction(transaction, () -> {
delegate.testLazyLoadingAndPersistedValues(em, entityId, "updated1", "updated2", "updated3");
});
}

@Test
public void update_allLazy_nonNullToNonNull() {
initNonNull();
inTransaction(transaction, () -> {
delegate.updateAllLazyProperties(em, entityId, "updated1", "updated2");
});
inTransaction(transaction, () -> {
delegate.testLazyLoadingAndPersistedValues(em, entityId, "initial1", "updated1", "updated2");
});
}

@Test
public void update_oneEager_nonNullToNonNull() {
initNonNull();
inTransaction(transaction, () -> {
delegate.updateOneEagerProperty(em, entityId, "updated1");
});
inTransaction(transaction, () -> {
delegate.testLazyLoadingAndPersistedValues(em, entityId, "updated1", "initial2", "initial3");
});
}

@Test
public void update_oneLazy_nonNullToNonNull() {
initNonNull();
inTransaction(transaction, () -> {
delegate.updateOneLazyProperty(em, entityId, "updated2");
});
inTransaction(transaction, () -> {
delegate.testLazyLoadingAndPersistedValues(em, entityId, "initial1", "updated2", "initial3");
});
}

@Test
public void update_all_nonNullToNull() {
initNonNull();
inTransaction(transaction, () -> {
delegate.updateAllProperties(em, entityId, null, null, null);
});
inTransaction(transaction, () -> {
delegate.testLazyLoadingAndPersistedValues(em, entityId, null, null, null);
});
}

@Test
public void update_allLazy_nonNullToNull() {
initNonNull();
inTransaction(transaction, () -> {
delegate.updateAllLazyProperties(em, entityId, null, null);
});
inTransaction(transaction, () -> {
delegate.testLazyLoadingAndPersistedValues(em, entityId, "initial1", null, null);
});
}

@Test
public void update_oneEager_nonNullToNull() {
initNonNull();
inTransaction(transaction, () -> {
delegate.updateOneEagerProperty(em, entityId, null);
});
inTransaction(transaction, () -> {
delegate.testLazyLoadingAndPersistedValues(em, entityId, null, "initial2", "initial3");
});
}

@Test
public void update_oneLazy_nonNullToNull() {
initNonNull();
inTransaction(transaction, () -> {
delegate.updateOneLazyProperty(em, entityId, null);
});
inTransaction(transaction, () -> {
delegate.testLazyLoadingAndPersistedValues(em, entityId, "initial1", null, "initial3");
});
}

private void initNull() {
inTransaction(transaction, () -> {
entityId = delegate.create(em, null, null, null);
});
inTransaction(transaction, () -> {
delegate.testLazyLoadingAndPersistedValues(em, entityId, null, null, null);
});
}

private void initNonNull() {
inTransaction(transaction, () -> {
entityId = delegate.create(em, "initial1", "initial2", "initial3");
});
inTransaction(transaction, () -> {
delegate.testLazyLoadingAndPersistedValues(em, entityId, "initial1", "initial2", "initial3");
});
}

/**
* An interface for delegate classes,
* classes whose bytecode is transformed by Quarkus to replace public field access with getter/setter access.
* <p>
* (Test bytecode was not transformed by Quarkus when using QuarkusUnitTest last time I checked).
*/
interface AccessDelegate {

long create(EntityManager entityManager, String eagerProperty1, String lazyProperty1, String lazyProperty2);

void updateAllProperties(EntityManager entityManager, long entityId, String eagerProperty1, String lazyProperty1,
String lazyProperty2);

void updateAllLazyProperties(EntityManager entityManager, long entityId, String lazyProperty1, String lazyProperty2);

void updateOneEagerProperty(EntityManager entityManager, long entityId, String eagerProperty1);

void updateOneLazyProperty(EntityManager entityManager, long entityId, String lazyProperty1);

void testLazyLoadingAndPersistedValues(EntityManager entityManager, long entityId,
String expectedEagerProperty1,
String expectedLazyProperty1,
String expectedLazyProperty2);
}
}
Loading

0 comments on commit 488e06d

Please sign in to comment.