-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add test to ensure that .env works in Gradle
- Loading branch information
Showing
6 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
.../functionalTest/java/io/quarkus/gradle/devmode/DotEnvQuarkusDevModeConfigurationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.quarkus.gradle.devmode; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class DotEnvQuarkusDevModeConfigurationTest extends QuarkusDevGradleTestBase { | ||
@Override | ||
protected String projectDirectoryName() { | ||
return "dotenv-config-java-module"; | ||
} | ||
|
||
@Override | ||
protected void testDevMode() throws Exception { | ||
assertThat(getHttpResponse("/hello")).contains("hey"); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
devtools/gradle/src/functionalTest/resources/dotenv-config-java-module/.env
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
GREETING_MESSAGE=hey |
33 changes: 33 additions & 0 deletions
33
devtools/gradle/src/functionalTest/resources/dotenv-config-java-module/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
plugins { | ||
id 'java' | ||
id 'io.quarkus' | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}") | ||
implementation 'io.quarkus:quarkus-resteasy' | ||
|
||
testImplementation 'io.quarkus:quarkus-junit5' | ||
testImplementation 'io.rest-assured:rest-assured' | ||
} | ||
|
||
group 'org.acme' | ||
version '1.0.0-SNAPSHOT' | ||
|
||
compileJava { | ||
options.encoding = 'UTF-8' | ||
options.compilerArgs << '-parameters' | ||
} | ||
|
||
compileTestJava { | ||
options.encoding = 'UTF-8' | ||
} | ||
|
||
quarkusDev { | ||
workingDir = System.getProperty("java.io.tmpdir") | ||
} |
2 changes: 2 additions & 0 deletions
2
devtools/gradle/src/functionalTest/resources/dotenv-config-java-module/gradle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
quarkusPlatformArtifactId=quarkus-bom | ||
quarkusPlatformGroupId=io.quarkus |
11 changes: 11 additions & 0 deletions
11
devtools/gradle/src/functionalTest/resources/dotenv-config-java-module/settings.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
pluginManagement { | ||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
plugins { | ||
id 'io.quarkus' version "${quarkusPluginVersion}" | ||
} | ||
} | ||
rootProject.name='code-with-quarkus' |
21 changes: 21 additions & 0 deletions
21
...onalTest/resources/dotenv-config-java-module/src/main/java/org/acme/GreetingResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.acme; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import org.eclipse.microprofile.config.inject.ConfigProperty; | ||
|
||
@Path("/hello") | ||
public class GreetingResource { | ||
|
||
@ConfigProperty(name = "greeting.message") | ||
String message; | ||
|
||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String hello() { | ||
return message; | ||
} | ||
} |