-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add coverage for testing 'Preserve POM format when extensions are add…
…ed/removed'
- Loading branch information
1 parent
e63fecc
commit 16db8ab
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
quarkus-cli/src/test/java/io/quarkus/ts/quarkus/cli/QuarkusCliPomIntegrityIT.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,49 @@ | ||
package io.quarkus.ts.quarkus.cli; | ||
|
||
import io.quarkus.test.bootstrap.QuarkusCliClient; | ||
import io.quarkus.test.bootstrap.QuarkusCliRestService; | ||
import io.quarkus.test.scenarios.QuarkusScenario; | ||
import jakarta.inject.Inject; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import java.util.List; | ||
|
||
|
||
@QuarkusScenario | ||
public class QuarkusCliPomIntegrityIT { | ||
/* | ||
* This scenario is related to the backport https://github.com/quarkusio/quarkus/issues/39088 | ||
* | ||
* */ | ||
private static final Path POM_PATH = Paths.get("target/QuarkusCliPomKeepBeSameIT/my-quarkus-app/pom.xml"); | ||
private static final String NEW_EXTENSION = "quarkus-kafka-client"; | ||
private static final String COMMENT = "<!-- Disable native build on this module -->"; | ||
|
||
@Inject | ||
static QuarkusCliClient cliClient; | ||
|
||
|
||
@Test | ||
public void shouldKeepCommentInPomAfterAddAndRemoveExtension() throws IOException { | ||
QuarkusCliRestService app = cliClient.createApplication("my-quarkus-app", QuarkusCliClient.CreateApplicationRequest.defaults()); | ||
|
||
List<String> initialPomContent = Files.readAllLines(POM_PATH); | ||
initialPomContent.add(1, COMMENT); | ||
System.out.println(initialPomContent); | ||
|
||
// Add extension | ||
app.installExtension(NEW_EXTENSION); | ||
List<String> 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<String> finalPomContent = Files.readAllLines(POM_PATH); | ||
Assertions.assertTrue(finalPomContent.contains(COMMENT), "The comment after remove extension still should be there"); | ||
} | ||
} |