Skip to content

Commit

Permalink
Adapt to index.html being dropped from the codestarts
Browse files Browse the repository at this point in the history
  • Loading branch information
fedinskiy committed Apr 10, 2024
1 parent 6671403 commit 3895bf4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
12 changes: 12 additions & 0 deletions app-generated-skeleton/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Landing Page</title>
</head>
<body>
<main>
<h1>Congratulations! You are on a landing page.</h1>
</main>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import static io.quarkus.ts.startstop.utils.Commands.adjustPrettyPrintForJsonLogging;
import static io.quarkus.ts.startstop.utils.Commands.cleanDirOrFile;
import static io.quarkus.ts.startstop.utils.Commands.confAppPropsForSkeleton;
import static io.quarkus.ts.startstop.utils.Commands.confIndexPageForSkeleton;
import static io.quarkus.ts.startstop.utils.Commands.dropEntityAnnotations;
import static io.quarkus.ts.startstop.utils.Commands.getArtifactGeneBaseDir;
import static io.quarkus.ts.startstop.utils.Commands.getBuildCommand;
Expand Down Expand Up @@ -101,6 +102,7 @@ public void testRuntime(TestInfo testInfo, String[] extensions, Set<TestFlags> f

// Config, see app-generated-skeleton/README.md
confAppPropsForSkeleton(appDir.getAbsolutePath());
confIndexPageForSkeleton(appDir.getAbsolutePath());
adjustPrettyPrintForJsonLogging(appDir.getAbsolutePath());
dropEntityAnnotations(appDir.getAbsolutePath());
if (StringUtils.isBlank(System.getProperty("gh.actions"))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ public static String download(Collection<CodeQuarkusExtensions> extensions, Stri
public static String download(Collection<CodeQuarkusExtensions> extensions, String destinationZipFile, int javaVersion) throws IOException {
String downloadURL = getCodeQuarkusURL() + "/api/download?" +
extensions.stream().map(x -> "e=" + x.id).collect(Collectors.joining("&")) +
"&S=3.8" +
"&j=" + javaVersion;
return download(downloadURL, destinationZipFile);
}
Expand Down Expand Up @@ -426,6 +427,14 @@ public static void confAppPropsForSkeleton(String appDir) throws IOException {
copyFileForSkeleton("application.properties", Paths.get(appDir + File.separator + appRelativePath));
}

public static void confIndexPageForSkeleton(String appDir) throws IOException {
final String appRelativePath =
"src" + File.separator + "main" + File.separator + "resources" + File.separator + "META-INF" + File.separator + "resources";
final String appIndexRelativePath = appRelativePath + File.separator + "index.html";
Files.createDirectories(Paths.get(appDir + File.separator + appRelativePath));
copyFileForSkeleton("index.html", Paths.get(appDir + File.separator + appIndexRelativePath));
}

public static void copyFileForSkeleton(String skeletonFileRelativePath, Path destPath)
throws IOException {
final String srcPath = BASE_DIR + File.separator + Apps.GENERATED_SKELETON.dir + File.separator + skeletonFileRelativePath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public enum URLContent {
new String[]{"http://localhost:8080/data/client/test/parameterValue=xxx", "Processed parameter value 'parameterValue=xxx'"}
}),
GENERATED_SKELETON(new String[][]{
new String[]{"http://localhost:8080", "Congratulations"},
new String[]{"http://localhost:8080/", "Congratulations! You are on a landing page."},
new String[]{"http://localhost:8080/hello", "Bye RESTEasy"},
new String[]{"http://localhost:8080/hello-added", "Hello added"},
new String[]{"http://localhost:8080/hello", "Bye from RESTEasy Reactive"},
Expand Down

0 comments on commit 3895bf4

Please sign in to comment.