Skip to content

Commit

Permalink
Merge pull request #37495 from gsmet/3.6.1-backports-2
Browse files Browse the repository at this point in the history
3.6.1 backports 2
  • Loading branch information
gsmet authored Dec 5, 2023
2 parents f433cb0 + d89dde3 commit abdc647
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 19 deletions.
2 changes: 1 addition & 1 deletion build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<supported-maven-versions>[3.8.2,)</supported-maven-versions>

<!-- These 2 properties are used by CreateProjectMojo to add the Maven Wrapper -->
<proposed-maven-version>3.9.5</proposed-maven-version>
<proposed-maven-version>3.9.6</proposed-maven-version>
<maven-wrapper.version>3.2.0</maven-wrapper.version>
<gradle-wrapper.version>8.5</gradle-wrapper.version>
<quarkus-gradle-plugin.version>${project.version}</quarkus-gradle-plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,6 @@ void build(List<StaticBytecodeRecorderBuildItem> staticInitTasks,
startupContext, mv.getMethodParam(0));

mv.invokeStaticMethod(CONFIGURE_STEP_TIME_ENABLED);
ResultHandle profiles = mv
.invokeStaticMethod(ofMethod(ConfigUtils.class, "getProfiles", List.class));

tryBlock = mv.tryBlock();
tryBlock.invokeStaticMethod(CONFIGURE_STEP_TIME_START);
Expand Down Expand Up @@ -298,7 +296,7 @@ void build(List<StaticBytecodeRecorderBuildItem> staticInitTasks,
tryBlock.load(applicationInfo.getVersion()),
tryBlock.load(Version.getVersion()),
featuresHandle,
profiles,
tryBlock.invokeStaticMethod(ofMethod(ConfigUtils.class, "getProfiles", List.class)),
tryBlock.load(LaunchMode.DEVELOPMENT.equals(launchMode.getLaunchMode())),
tryBlock.load(launchMode.isAuxiliaryApplication()));

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package io.quarkus.arc.test.config.staticinit;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.fail;

import java.util.Optional;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.Initialized;
import jakarta.enterprise.event.Observes;
import jakarta.inject.Singleton;

import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusUnitTest;

public class StaticInitConfigInjectionMissingValueFailureTest {

static final String PROPERTY_NAME = "static.init.missing.apfelstrudel";

@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.withApplicationRoot(root -> root
.addClasses(StaticInitBean.class))
.assertException(t -> {
assertThat(t).isInstanceOf(IllegalStateException.class)
.hasMessageContainingAll(
"A runtime config property value differs from the value that was injected during the static intialization phase",
"the runtime value of '" + PROPERTY_NAME
+ "' is [gizmo] but the value [null] was injected into io.quarkus.arc.test.config.staticinit.StaticInitConfigInjectionMissingValueFailureTest$StaticInitBean#value");
});

@Test
public void test() {
fail();
}

@Singleton
public static class StaticInitBean {

@ConfigProperty(name = PROPERTY_NAME)
Optional<String> value;

// bean is instantiated during STATIC_INIT
void onInit(@Observes @Initialized(ApplicationScoped.class) Object event) {
System.setProperty(PROPERTY_NAME, "gizmo");
}

}

@AfterAll
static void afterAll() {
System.clearProperty(PROPERTY_NAME);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ static void recordConfigValue(InjectionPoint injectionPoint, ConfigStaticInitVal
value = getDefaultValue(injectionPoint, configProperty);
}
if (value == null) {
LOG.debugf("No config value found for %s", propertyName);
return;
LOG.debugf("No config value found for %s - recording <null> value", propertyName);
}
if (configValues == null) {
configValues = Arc.container().instance(ConfigStaticInitValues.class).get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

import jakarta.annotation.Priority;
import jakarta.enterprise.event.Observes;
Expand Down Expand Up @@ -43,7 +44,9 @@ void onStart(@Observes @Priority(Integer.MIN_VALUE) StartupEvent event) {
List<String> mismatches = new ArrayList<>();
for (InjectedValue injectedValue : injectedValues) {
ConfigValue currentValue = config.getConfigValue(injectedValue.name);
if (currentValue.getValue() != null && !injectedValue.value.equals(currentValue.getValue())) {
if (currentValue.getValue() != null
&& !Objects.equals(currentValue.getValue(), injectedValue.value)) {
// Config property is set at runtime and the value differs from the value injected during STATIC_INIT bootstrap phase
mismatches.add(
" - the runtime value of '" + injectedValue.name + "' is [" + currentValue.getValue()
+ "] but the value [" + injectedValue.value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
artifact: ${project.groupId}:${project.artifactId}:${project.version}
name: "RESTEasy Classic Qute"
metadata:
unlisted: true
keywords:
- "templating"
- "templates"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: "RESTEasy Reactive Qute"
artifact: ${project.groupId}:${project.artifactId}:${project.version}
metadata:
unlisted: true
keywords:
- "templating"
- "templates"
Expand Down
8 changes: 4 additions & 4 deletions independent-projects/bootstrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
<eclipse-minimal-json.version>0.9.5</eclipse-minimal-json.version>
<jboss-logging.version>3.5.3.Final</jboss-logging.version>
<junit.jupiter.version>5.10.0</junit.jupiter.version>
<maven-core.version>3.9.5</maven-core.version><!-- Keep in sync with sisu.version -->
<sisu.version>0.3.5</sisu.version><!-- Keep in sync with maven-core.version -->
<maven-plugin-annotations.version>3.7.1</maven-plugin-annotations.version>
<maven-resolver.version>1.9.13</maven-resolver.version>
<maven-core.version>3.9.6</maven-core.version><!-- Keep in sync with sisu.version -->
<sisu.version>0.9.0.M2</sisu.version><!-- Keep in sync with maven-core.version -->
<maven-plugin-annotations.version>3.10.2</maven-plugin-annotations.version>
<maven-resolver.version>1.9.18</maven-resolver.version>
<maven-shared-utils.version>3.3.4</maven-shared-utils.version> <!-- Keep in sync with maven-core.version (force this version on maven-invoker) -->
<maven-wagon.version>3.5.3</maven-wagon.version>
<httpcore.version>4.4.16</httpcore.version><!-- Keep in sync with maven-wagon.version (wagon-http 3.4.3 brings in 4.4.13 and 4.4.14) -->
Expand Down
2 changes: 1 addition & 1 deletion independent-projects/enforcer-rules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<!-- Keeping 3.0.0.M3 because 3.2.1 requires class changes -->
<enforcer-api.version>3.0.0-M3</enforcer-api.version>
<maven-invoker-plugin.version>3.6.0</maven-invoker-plugin.version>
<maven-core.version>3.9.5</maven-core.version>
<maven-core.version>3.9.6</maven-core.version>

<!--
Supported Maven versions, interpreted as a version range (Also defined in build-parent)
Expand Down
4 changes: 2 additions & 2 deletions independent-projects/extension-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.release>11</maven.compiler.release>
<maven-core.version>3.9.5</maven-core.version>
<maven-core.version>3.9.6</maven-core.version>
<version.compiler.plugin>3.11.0</version.compiler.plugin>
<version.enforcer.plugin>3.2.1</version.enforcer.plugin>
<version.surefire.plugin>3.1.2</version.surefire.plugin>
<maven-plugin-plugin.version>3.8.1</maven-plugin-plugin.version>
<maven-plugin-plugin.version>3.10.2</maven-plugin-plugin.version>
<jackson-bom.version>2.15.3</jackson-bom.version>
<smallrye-beanbag.version>1.3.2</smallrye-beanbag.version>
<junit.jupiter.version>5.10.0</junit.jupiter.version>
Expand Down
2 changes: 1 addition & 1 deletion independent-projects/resteasy-reactive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<jandex.version>3.1.6</jandex.version>
<bytebuddy.version>1.12.12</bytebuddy.version>
<junit5.version>5.10.0</junit5.version>
<maven.version>3.9.5</maven.version>
<maven.version>3.9.6</maven.version>
<assertj.version>3.24.2</assertj.version>
<jboss-logging.version>3.5.3.Final</jboss-logging.version>
<jakarta.annotation-api.version>2.1.1</jakarta.annotation-api.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@
"supported-maven-versions": "[3.6.2,)",
"minimum-java-version": "11",
"recommended-java-version": "17",
"proposed-maven-version": "3.9.5",
"proposed-maven-version": "3.9.6",
"maven-wrapper-version": "3.2.0",
"gradle-wrapper-version": "8.5"
}
Expand Down
2 changes: 1 addition & 1 deletion independent-projects/tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<maven.compiler.release>11</maven.compiler.release>

<!-- These properties are used by CreateProjectMojo to add the Maven Wrapper -->
<proposed-maven-version>3.9.5</proposed-maven-version>
<proposed-maven-version>3.9.6</proposed-maven-version>
<maven-wrapper.version>3.2.0</maven-wrapper.version>
<gradle-wrapper.version>8.5</gradle-wrapper.version>

Expand Down

0 comments on commit abdc647

Please sign in to comment.