From df006154d06da833835790a6892b4c749805c2a1 Mon Sep 17 00:00:00 2001 From: jcarranzan Date: Thu, 23 May 2024 12:54:57 +0200 Subject: [PATCH] Add test coverage for POM format when extensions are added/removed' fix style --- .../ts/http/restclient/GzipMaxInputIT.java | 2 +- .../quarkus/cli/QuarkusCliPomIntegrityIT.java | 53 +++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliPomIntegrityIT.java diff --git a/http/rest-client/src/test/java/io/quarkus/ts/http/restclient/GzipMaxInputIT.java b/http/rest-client/src/test/java/io/quarkus/ts/http/restclient/GzipMaxInputIT.java index a8cb28a081..954e6624f7 100644 --- a/http/rest-client/src/test/java/io/quarkus/ts/http/restclient/GzipMaxInputIT.java +++ b/http/rest-client/src/test/java/io/quarkus/ts/http/restclient/GzipMaxInputIT.java @@ -100,7 +100,7 @@ void testGzipOverTheMaxLimit() throws IOException { assertEquals(HttpStatus.SC_REQUEST_TOO_LONG, response.statusCode()); } - @Disabled ("Because https://github.com/quarkusio/quarkus/issues/40806") + @Disabled("Because https://github.com/quarkusio/quarkus/issues/40806") @Test void testGzipBelowMaxLimit() throws IOException { byte[] compressedData = generateCompressedData(gzip_bellow_1K_limit_max); diff --git a/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliPomIntegrityIT.java b/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliPomIntegrityIT.java new file mode 100644 index 0000000000..8326c037e6 --- /dev/null +++ b/quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliPomIntegrityIT.java @@ -0,0 +1,53 @@ +package io.quarkus.ts.quarkus.cli; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; + +import jakarta.inject.Inject; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import io.quarkus.test.bootstrap.QuarkusCliClient; +import io.quarkus.test.bootstrap.QuarkusCliRestService; +import io.quarkus.test.scenarios.QuarkusScenario; + +@QuarkusScenario +public class QuarkusCliPomIntegrityIT { + /* + * This scenario is related to the backport https://github.com/quarkusio/quarkus/issues/39088 + * + */ + private static final String NEW_EXTENSION = "quarkus-kafka-client"; + private static final String COMMENT = ""; + + private static final String APP_NAME = "my-quarkus-app"; + + @Inject + static QuarkusCliClient cliClient; + + @Disabled + @Test + public void shouldKeepCommentInPomAfterAddAndRemoveExtension() throws IOException { + final Path POM_PATH = Paths.get("target", QuarkusCliPomIntegrityIT.class.getSimpleName(), APP_NAME, "pom.xml"); + QuarkusCliRestService app = cliClient.createApplication("my-quarkus-app", + QuarkusCliClient.CreateApplicationRequest.defaults()); + + List initialPomContent = Files.readAllLines(POM_PATH); + initialPomContent.add(1, COMMENT); + + // Add extension + app.installExtension(NEW_EXTENSION); + List updatedPomContent = Files.readAllLines(POM_PATH); + Assertions.assertTrue(updatedPomContent.contains(COMMENT), "The comment after add extension still should be there"); + + // Remove extension + app.removeExtension(NEW_EXTENSION); + List finalPomContent = Files.readAllLines(POM_PATH); + Assertions.assertTrue(finalPomContent.contains(COMMENT), "The comment after remove extension still should be there"); + } +}