diff --git a/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliCreateJvmApplicationIT.java b/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliCreateJvmApplicationIT.java index 5a951b533..38089722e 100644 --- a/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliCreateJvmApplicationIT.java +++ b/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliCreateJvmApplicationIT.java @@ -6,7 +6,9 @@ import static io.quarkus.test.utils.AwaitilityUtils.untilAsserted; import static io.quarkus.ts.quarkus.cli.QuarkusCliUtils.defaultWithFixedStream; import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; @@ -14,7 +16,9 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; +import java.nio.file.Files; import java.nio.file.Path; +import java.time.Duration; import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -27,6 +31,7 @@ import org.apache.http.HttpStatus; import org.apache.maven.model.Model; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.awaitility.core.ConditionTimeoutException; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Tag; @@ -264,6 +269,27 @@ public void verifyRestEasyReactiveAndClassicResteasyCollisionUserMsg() { assertBuildError(buildResult, "io.quarkus:quarkus-resteasy"); } + @Test + public void devModeIgnoresPomPackaging() throws IOException { + QuarkusCliRestService app = cliClient.createApplication("pomApp", defaultWithFixedStream()); + {//set packaging to POM + Path pom = getFileFromApplication(app, ROOT_FOLDER, "pom.xml").toPath(); + List content = Files.readAllLines(pom); + for (int i = 0; i < content.size(); i++) { + String line = content.get(i); + if (line.endsWith("pomApp")) { + content.set(i, line + "pom"); + break; + } + } + Files.write(pom, content); + } + // Start using DEV mode + assertEquals(Duration.ofSeconds(2), app.getConfiguration().getAsDuration("startup.timeout", null)); + assertThrows(ConditionTimeoutException.class, app::start, "That application shouldn't start!"); + app.logs().assertContains("Type of the artifact is POM, skipping dev goal"); + } + private void assertBuildError(Result result, String expectedError) { assertTrue(result.getOutput().contains(expectedError), "Unexpected build error message"); } @@ -300,7 +326,6 @@ private void assertDockerJavaVersion(File dockerFile, String expectedVersion) { Assertions.assertTrue(line.contains("openjdk-" + expectedVersion), DOCKERFILE_JVM + " doesn't contains expected version " + expectedVersion); - } catch (FileNotFoundException e) { fail(e.getMessage()); } diff --git a/quarkus-cli/src/test/resources/test.properties b/quarkus-cli/src/test/resources/test.properties index d21d539da..b3e5317df 100644 --- a/quarkus-cli/src/test/resources/test.properties +++ b/quarkus-cli/src/test/resources/test.properties @@ -1 +1,4 @@ ts.global.generated-service.enabled=false +#this app is not expected to start, so let's fail right after +ts.pomApp.startup.timeout=PT2s +ts.pomApp.startup.check-poll-interval=PT1s