Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stager plugin example of a map variable nested under a list #976

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import io.helidon.build.common.test.utils.JUnitLauncher
import io.helidon.build.maven.stager.ProjectsTestIT

JUnitLauncher.builder()
.select(ProjectsTestIT.class, "test1", String.class)
.select(ProjectsTestIT.class, "testArchive", String.class)
.parameter("basedir", basedir.getAbsolutePath())
.reportsDir(basedir)
.outputFile(new File(basedir, "test.log"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"versions": [
{{#versions}}
"{{value}}"{{^last}},{{/last}}
{{/versions}}
{{#versions}}
"{{value}}"{{^last}},{{/last}}
{{/versions}}
],
"latest": "3.0.0-SNAPSHOT"
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import io.helidon.build.maven.stager.ProjectsTestIT

//noinspection GroovyAssignabilityCheck,GrUnresolvedAccess
JUnitLauncher.builder()
.select(ProjectsTestIT.class, "test3", String.class)
.select(ProjectsTestIT.class, "testCopyArtifact", String.class)
.parameter("basedir", basedir.getAbsolutePath())
.reportsDir(basedir)
.outputFile(new File(basedir, "test.log"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import io.helidon.build.maven.stager.ProjectsTestIT

//noinspection GroovyAssignabilityCheck,GrUnresolvedAccess
JUnitLauncher.builder()
.select(ProjectsTestIT.class, "test4", String.class)
.select(ProjectsTestIT.class, "testDownload", String.class)
.parameter("basedir", basedir.getAbsolutePath())
.reportsDir(basedir)
.outputFile(new File(basedir, "test.log"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import io.helidon.build.maven.stager.ProjectsTestIT

//noinspection GroovyAssignabilityCheck,GrUnresolvedAccess
JUnitLauncher.builder()
.select(ProjectsTestIT.class, "test5", String.class)
.select(ProjectsTestIT.class, "testFile", String.class)
.parameter("basedir", basedir.getAbsolutePath())
.reportsDir(basedir)
.outputFile(new File(basedir, "test.log"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import io.helidon.build.maven.stager.ProjectsTestIT

//noinspection GroovyAssignabilityCheck,GrUnresolvedAccess
JUnitLauncher.builder()
.select(ProjectsTestIT.class, "test6", String.class)
.select(ProjectsTestIT.class, "testSymlink", String.class)
.parameter("basedir", basedir.getAbsolutePath())
.reportsDir(basedir)
.outputFile(new File(basedir, "test.log"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--

Copyright (c) 2020, 2022 Oracle and/or its affiliates.
Copyright (c) 2020, 2023 Oracle and/or its affiliates.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -58,6 +58,16 @@
<value>2.0.1</value>
<value>2.0.0</value>
</variable>
<variable name="preview-versions">
<value>
<variable name="order" value="199" />
<variable name="version" value="4.0.0-M1" />
</value>
<value>
<variable name="order" value="200" />
<variable name="version" value="4.0.0-ALPHA6" />
</value>
</variable>
<variable name="latest" value="3.0.0-SNAPSHOT"/>
</variables>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import io.helidon.build.common.test.utils.JUnitLauncher
import io.helidon.build.maven.stager.ProjectsTestIT

JUnitLauncher.builder()
.select(ProjectsTestIT.class, "test2", String.class)
.select(ProjectsTestIT.class, "testTemplate", String.class)
.parameter("basedir", basedir.getAbsolutePath())
.reportsDir(basedir)
.outputFile(new File(basedir, "test.log"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
{
"versions": [
{{#versions}}
"{{value}}"{{^last}},{{/last}}
{{/versions}}
{{#versions}}
"{{value}}"{{^last}},{{/last}}
{{/versions}}
],
"preview-versions": [
{{#preview-versions}}
{
"order": {{value.order}},
"version": "{{value.version}}"
}{{^last}},{{/last}}
{{/preview-versions}}
],
"latest": "{{latest}}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import io.helidon.build.maven.stager.ProjectsTestIT

//noinspection GroovyAssignabilityCheck,GrUnresolvedAccess
JUnitLauncher.builder()
.select(ProjectsTestIT.class, "test7", String.class)
.select(ProjectsTestIT.class, "testUnpackArtifact", String.class)
.parameter("basedir", basedir.getAbsolutePath())
.reportsDir(basedir)
.outputFile(new File(basedir, "test.log"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import io.helidon.build.common.Strings;
import io.helidon.build.common.test.utils.ConfigurationParameterSource;

import org.junit.jupiter.params.ParameterizedTest;

import static io.helidon.build.common.FileUtils.newZipFileSystem;
Expand All @@ -33,7 +34,7 @@ public class ProjectsTestIT {

@ParameterizedTest
@ConfigurationParameterSource("basedir")
void test1(String basedir) throws IOException {
void testArchive(String basedir) throws IOException {
Path stageDir = Path.of(basedir).resolve("target/stage");
assertExist(stageDir);

Expand All @@ -44,54 +45,65 @@ void test1(String basedir) throws IOException {
Path file1 = fs.getPath("/").resolve("versions.json");
assertExist(file1);

assertEquals(Files.readString(file1),"{\n" +
" \"versions\": [\n" +
" \"3.0.0-SNAPSHOT\",\n" +
" \"2.5.0\",\n" +
" \"2.4.2\",\n" +
" \"2.4.0\",\n" +
" \"2.0.1\",\n" +
" \"2.0.0\"\n" +
" ],\n" +
" \"latest\": \"3.0.0-SNAPSHOT\"\n" +
"}\n");
assertEquals(Files.readString(file1), "{\n"
+ " \"versions\": [\n"
+ " \"3.0.0-SNAPSHOT\",\n"
+ " \"2.5.0\",\n"
+ " \"2.4.2\",\n"
+ " \"2.4.0\",\n"
+ " \"2.0.1\",\n"
+ " \"2.0.0\"\n"
+ " ],\n"
+ " \"latest\": \"3.0.0-SNAPSHOT\"\n"
+ "}\n");
}
}

@ParameterizedTest
@ConfigurationParameterSource("basedir")
void test2(String basedir) throws IOException {
void testTemplate(String basedir) throws IOException {
Path stageDir = Path.of(basedir).resolve("target/stage");
assertExist(stageDir);

Path file1 = stageDir.resolve("versions1.json");
assertExist(file1);

assertEquals(Files.readString(file1), "{\n" +
" \"versions\": [\n" +
" \"3.0.0-SNAPSHOT\",\n" +
" \"2.5.0\",\n" +
" \"2.4.2\",\n" +
" \"2.4.0\",\n" +
" \"2.0.1\",\n" +
" \"2.0.0\"\n" +
" ],\n" +
" \"latest\": \"3.0.0-SNAPSHOT\"\n" +
"}\n");
assertEquals(Files.readString(file1), "{\n"
+ " \"versions\": [\n"
+ " \"3.0.0-SNAPSHOT\",\n"
+ " \"2.5.0\",\n"
+ " \"2.4.2\",\n"
+ " \"2.4.0\",\n"
+ " \"2.0.1\",\n"
+ " \"2.0.0\"\n"
+ " ],\n"
+ " \"preview-versions\": [\n"
+ " {\n"
+ " \"order\": 199,\n"
+ " \"version\": \"4.0.0-M1\"\n"
+ " },\n"
+ " {\n"
+ " \"order\": 200,\n"
+ " \"version\": \"4.0.0-ALPHA6\"\n"
+ " }\n"
+ " ],\n"
+ " \"latest\": \"3.0.0-SNAPSHOT\"\n"
+ "}\n");

Path file2 = stageDir.resolve("versions2.json");
assertEquals(Files.readString(file2), "{\n" +
" \"versions\": [\n" +
" \"4.0.0-SNAPSHOT\",\n" +
" \"3.0.0\"\n" +
" ],\n" +
" \"latest\": \"4.0.0-SNAPSHOT\"\n" +
"}\n");
assertEquals(Files.readString(file2), "{\n"
+ " \"versions\": [\n"
+ " \"4.0.0-SNAPSHOT\",\n"
+ " \"3.0.0\"\n"
+ " ],\n"
+ " \"preview-versions\": [\n"
+ " ],\n"
+ " \"latest\": \"4.0.0-SNAPSHOT\"\n"
+ "}\n");
}

@ParameterizedTest
@ConfigurationParameterSource("basedir")
void test3(String basedir) {
void testCopyArtifact(String basedir) {
Path stageDir = Path.of(basedir).resolve("target/stage");
assertExist(stageDir);
assertExist(stageDir.resolve("helidon-bare-mp-2.0.0-RC1.jar"));
Expand All @@ -101,7 +113,7 @@ void test3(String basedir) {

@ParameterizedTest
@ConfigurationParameterSource("basedir")
void test4(String basedir) {
void testDownload(String basedir) {
Path stageDir = Path.of(basedir).resolve("target/stage");
assertExist(stageDir);
assertExist(stageDir.resolve("cli/2.0.0-RC1/darwin/helidon"));
Expand All @@ -112,7 +124,7 @@ void test4(String basedir) {

@ParameterizedTest
@ConfigurationParameterSource("basedir")
void test5(String basedir) throws IOException {
void testFile(String basedir) throws IOException {
Path stageDir = Path.of(basedir).resolve("target/stage");
assertExist(stageDir);

Expand All @@ -127,7 +139,7 @@ void test5(String basedir) throws IOException {

@ParameterizedTest
@ConfigurationParameterSource("basedir")
void test6(String basedir) {
void testSymlink(String basedir) {
Path stageDir = Path.of(basedir).resolve("target/stage");
assertExist(stageDir);

Expand All @@ -146,7 +158,7 @@ void test6(String basedir) {

@ParameterizedTest
@ConfigurationParameterSource("basedir")
void test7(String basedir) {
void testUnpackArtifact(String basedir) {
Path stageDir = Path.of(basedir).resolve("target/stage");
assertExist(stageDir);

Expand Down