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 b1c980d
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bom/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<properties>
<aesh.version>1.11</aesh.version>
<jandex.version>2.1.3.Final</jandex.version>
<resteasy.version>4.5.3.Final</resteasy.version>
<resteasy.version>4.5.4-SNAPSHOT</resteasy.version>
<opentracing.version>0.31.0</opentracing.version>
<opentracing-jaxrs.version>0.4.1</opentracing-jaxrs.version>
<opentracing-web-servlet-filter.version>0.2.3</opentracing-web-servlet-filter.version>
Expand Down
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 b1c980d

Please sign in to comment.