-
Notifications
You must be signed in to change notification settings - Fork 0
/
QuarkusCliPomIntegrityIT.java
47 lines (37 loc) · 1.64 KB
/
QuarkusCliPomIntegrityIT.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package io.quarkus;
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 String NEW_EXTENSION = "quarkus-kafka-client";
private static final String COMMENT = "<!-- Disable native build on this module -->";
private static final String APP_NAME = "my-quarkus-app";
@Inject
static QuarkusCliClient cliClient;
@Test
public void shouldKeepCommentInPomAfterAddAndRemoveExtension() throws IOException {
final Path POM_PATH = Paths.get("target", QuarkusCliPomIntegrityIT.class.getSimpleName(), APP_NAME, "pom.xml");
QuarkusCliRestService app = cliClient.createApplication(APP_NAME,
QuarkusCliClient.CreateApplicationRequest.defaults());
List<String> initialPomContent = Files.readAllLines(POM_PATH);
initialPomContent.add(1, COMMENT);
Files.write(POM_PATH, 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");
}
}