diff --git a/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/CryptoConfigTest.java b/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/CryptoConfigTest.java new file mode 100644 index 00000000000000..302551934e8db1 --- /dev/null +++ b/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/CryptoConfigTest.java @@ -0,0 +1,33 @@ +package io.quarkus.gradle.tasks; + +import java.io.File; +import java.net.URL; +import java.nio.file.Path; + +import org.apache.commons.io.FileUtils; +import org.gradle.testkit.runner.GradleRunner; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +public class CryptoConfigTest { + + @TempDir + Path testProjectDir; + + @Test + @Disabled("To be fixed via https://github.com/quarkusio/quarkus/issues/38007") + void smallryeCrypto() throws Exception { + URL url = getClass().getClassLoader().getResource("io/quarkus/gradle/tasks/crypto/main"); + FileUtils.copyDirectory(new File(url.toURI()), testProjectDir.toFile()); + FileUtils.copyFile(new File("../gradle.properties"), testProjectDir.resolve("gradle.properties").toFile()); + + GradleRunner.create() + .withPluginClasspath() + .withProjectDir(testProjectDir.toFile()) + .withArguments("build", "--info", "--stacktrace", "--build-cache", "--configuration-cache") + // .build() checks whether the build failed, which is good enough for this test + .build(); + + } +} diff --git a/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/EffectiveConfigTest.java b/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/EffectiveConfigTest.java index ad239fe7fc39f3..078f4ad582fc60 100644 --- a/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/EffectiveConfigTest.java +++ b/devtools/gradle/gradle-application-plugin/src/test/java/io/quarkus/gradle/tasks/EffectiveConfigTest.java @@ -12,10 +12,14 @@ import org.assertj.core.api.SoftAssertions; import org.assertj.core.api.junit.jupiter.InjectSoftAssertions; import org.assertj.core.api.junit.jupiter.SoftAssertionsExtension; +import org.eclipse.microprofile.config.spi.ConfigSource; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import io.smallrye.config.SmallRyeConfig; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; @ExtendWith(SoftAssertionsExtension.class) public class EffectiveConfigTest { @@ -49,6 +53,15 @@ void fromForcedProperties() { soft.assertThat(effectiveConfig.configMap()).containsEntry("quarkus.foo", "bar"); } + @Test + @Disabled("To be fixed via https://github.com/quarkusio/quarkus/issues/38007") + void crypto() { + EffectiveConfig effectiveConfig = EffectiveConfig.builder() + .withTaskProperties(Map.of("quarkus.foo", "${aes-gcm-nopadding::superSecret}")).build(); + + soft.assertThat(effectiveConfig.configMap()).containsEntry("quarkus.foo", "superSecret"); + } + @Test void appPropsOverload() throws Exception { URL url1 = getClass().getClassLoader().getResource("io/quarkus/gradle/tasks/effectiveConfig/overload/1/"); diff --git a/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/tasks/crypto/main/build.gradle.kts b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/tasks/crypto/main/build.gradle.kts new file mode 100644 index 00000000000000..c74f8645525148 --- /dev/null +++ b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/tasks/crypto/main/build.gradle.kts @@ -0,0 +1,21 @@ +plugins { + java + id("io.quarkus") +} + +buildscript { + repositories { + mavenLocal() + mavenCentral() + } +} + +repositories { + mavenLocal() + mavenCentral() +} + +dependencies { + implementation(enforcedPlatform("io.quarkus:quarkus-bom:${project.property("version")}")) + implementation("jakarta.inject:jakarta.inject-api:2.0.1") +} diff --git a/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/tasks/crypto/main/settings.gradle.kts b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/tasks/crypto/main/settings.gradle.kts new file mode 100644 index 00000000000000..738e4e47476c93 --- /dev/null +++ b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/tasks/crypto/main/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "gradle-build-caching" diff --git a/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/tasks/crypto/main/src/main/java/org/acme/Foo.java b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/tasks/crypto/main/src/main/java/org/acme/Foo.java new file mode 100644 index 00000000000000..8f4e8542598f49 --- /dev/null +++ b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/tasks/crypto/main/src/main/java/org/acme/Foo.java @@ -0,0 +1,4 @@ +package org.acme; + +public class Foo { +} \ No newline at end of file diff --git a/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/tasks/crypto/main/src/main/resources/application.properties b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/tasks/crypto/main/src/main/resources/application.properties new file mode 100644 index 00000000000000..9a04fd5f9b2824 --- /dev/null +++ b/devtools/gradle/gradle-application-plugin/src/test/resources/io/quarkus/gradle/tasks/crypto/main/src/main/resources/application.properties @@ -0,0 +1 @@ +someValue = ${aes-gcm-nopadding::superSecret}