|
1 | 1 | /* |
2 | | - * Copyright (c) 2023, 2024 Oracle and/or its affiliates. |
| 2 | + * Copyright (c) 2023, 2025 Oracle and/or its affiliates. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
32 | 32 | import org.junit.jupiter.api.condition.EnabledOnOs; |
33 | 33 | import org.junit.jupiter.api.condition.OS; |
34 | 34 |
|
| 35 | +import static io.helidon.build.common.FileUtils.ensureFile; |
35 | 36 | import static io.helidon.build.common.FileUtils.list; |
36 | 37 | import static io.helidon.build.common.FileUtils.newZipFileSystem; |
37 | 38 | import static io.helidon.build.common.FileUtils.unique; |
38 | 39 | import static io.helidon.build.common.FileUtils.unzip; |
39 | 40 | import static io.helidon.build.common.FileUtils.zip; |
| 41 | +import static io.helidon.build.common.FileUtils.isSubModule; |
40 | 42 | import static io.helidon.build.common.Unchecked.unchecked; |
41 | 43 | import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; |
42 | 44 | import static java.nio.file.attribute.PosixFilePermission.GROUP_EXECUTE; |
@@ -155,6 +157,16 @@ void testE2ePermissions2() throws IOException { |
155 | 157 | zipAndUnzip(zipDir); |
156 | 158 | } |
157 | 159 |
|
| 160 | + @Test |
| 161 | + void testIsSubmodule() throws IOException { |
| 162 | + Path blue = TestFiles.targetDir(FileUtilsTest.class).resolve("test-classes/vfs/blue"); |
| 163 | + Path submodule = ensureFile(outputDir.resolve("submodule")); |
| 164 | + Files.write(submodule, "[submodule ...".getBytes()); |
| 165 | + |
| 166 | + assertThat(isSubModule(submodule), is(true)); |
| 167 | + assertThat(isSubModule(blue), is(false)); |
| 168 | + } |
| 169 | + |
158 | 170 | private static void readZipFileContent(Path zip, Consumer<Path> consumer) { |
159 | 171 | try (FileSystem fs = newZipFileSystem(zip)) { |
160 | 172 | Path root = fs.getRootDirectories().iterator().next(); |
|
0 commit comments