Skip to content

Commit

Permalink
Add test to ensure that .env works in Gradle
Browse files Browse the repository at this point in the history
Relates to: quarkusio#9752
  • Loading branch information
geoand committed Jun 4, 2020
1 parent 5c7b352 commit 8074dd7
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 0 deletions.
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");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GREETING_MESSAGE=hey
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")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
quarkusPlatformArtifactId=quarkus-bom
quarkusPlatformGroupId=io.quarkus
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'
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;
}
}

0 comments on commit 8074dd7

Please sign in to comment.