-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLI: look for maven/gradle wrapper in parent dirs
- Loading branch information
1 parent
84fd435
commit 79eb372
Showing
3 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
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
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
43 changes: 43 additions & 0 deletions
43
devtools/cli/src/test/java/io/quarkus/cli/build/ExecuteUtilTest.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,43 @@ | ||
package io.quarkus.cli.build; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.io.TempDir; | ||
|
||
public class ExecuteUtilTest { | ||
|
||
private final static String MVNW = "mvnw.junittest"; | ||
private final static String[] WINDOWS_WRAPPER = new String[] { MVNW }; | ||
|
||
@TempDir | ||
Path tempDir; | ||
|
||
@Test | ||
public void findWrapperRecursionTest() throws IOException { | ||
File wrapper = ExecuteUtil.findWrapper(tempDir, WINDOWS_WRAPPER, MVNW); | ||
assertThat(wrapper).isNull(); | ||
|
||
wrapper = ExecuteUtil.findWrapper(tempDir.resolve("subproject/nestedSubproject"), WINDOWS_WRAPPER, MVNW); | ||
assertThat(wrapper).isNull(); | ||
|
||
// create a file representing the maven wrapper | ||
Path wrapperLocation = tempDir.resolve(MVNW); | ||
assertThat(wrapperLocation.toFile().createNewFile()).isTrue(); | ||
|
||
wrapper = ExecuteUtil.findWrapper(tempDir, WINDOWS_WRAPPER, MVNW); | ||
assertThat(wrapper).isNotNull(); | ||
assertThat(wrapper).isEqualTo(wrapperLocation.toFile()); | ||
|
||
wrapper = ExecuteUtil.findWrapper(tempDir.resolve("subproject/nestedSubproject"), WINDOWS_WRAPPER, MVNW); | ||
assertThat(wrapper).isNotNull(); | ||
assertThat(wrapper).isEqualTo(wrapperLocation.toFile()); | ||
|
||
wrapper = ExecuteUtil.findWrapper(tempDir.resolve(".."), WINDOWS_WRAPPER, MVNW); | ||
assertThat(wrapper).isNull(); | ||
} | ||
} |