Port the build to Gradle
Closes gh-19609 Closes gh-19608
This commit is contained in:
@@ -96,12 +96,14 @@ public class CliTester implements BeforeEachCallback, AfterEachCallback {
|
||||
for (String arg : args) {
|
||||
if (arg.startsWith("--classpath=")) {
|
||||
arg = arg + ":" + this.buildOutput.getTestClassesLocation().getAbsolutePath();
|
||||
arg = arg + ":" + this.buildOutput.getTestResourcesLocation().getAbsolutePath();
|
||||
classpathUpdated = true;
|
||||
}
|
||||
updatedArgs.add(arg);
|
||||
}
|
||||
if (!classpathUpdated) {
|
||||
updatedArgs.add("--classpath=.:" + this.buildOutput.getTestClassesLocation().getAbsolutePath());
|
||||
updatedArgs.add("--classpath=.:" + this.buildOutput.getTestClassesLocation().getAbsolutePath() + ":"
|
||||
+ this.buildOutput.getTestResourcesLocation().getAbsolutePath());
|
||||
}
|
||||
Future<RunCommand> future = submitCommand(new RunCommand(), StringUtils.toStringArray(updatedArgs));
|
||||
this.commands.add(future.get(this.timeout, TimeUnit.MILLISECONDS));
|
||||
@@ -134,6 +136,8 @@ public class CliTester implements BeforeEachCallback, AfterEachCallback {
|
||||
"org.springframework.boot.cli.CliTesterSpringApplication");
|
||||
this.serverPortFile = new File(this.temp, "server.port");
|
||||
System.setProperty("portfile", this.serverPortFile.getAbsolutePath());
|
||||
String userHome = System.getProperty("user.home");
|
||||
System.setProperty("user.home", "src/test/resources/cli-tester");
|
||||
try {
|
||||
command.run(sources);
|
||||
return command;
|
||||
@@ -142,6 +146,7 @@ public class CliTester implements BeforeEachCallback, AfterEachCallback {
|
||||
System.clearProperty("server.port");
|
||||
System.clearProperty("spring.application.class.name");
|
||||
System.clearProperty("portfile");
|
||||
System.setProperty("user.home", userHome);
|
||||
Thread.currentThread().setContextClassLoader(loader);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -57,15 +57,12 @@ class GrabCommandIntegrationTests {
|
||||
|
||||
@Test
|
||||
void grab() throws Exception {
|
||||
|
||||
System.setProperty("grape.root", this.cli.getTemp().getAbsolutePath());
|
||||
System.setProperty("groovy.grape.report.downloads", "true");
|
||||
|
||||
// Use --autoconfigure=false to limit the amount of downloaded dependencies
|
||||
String output = this.cli.grab("grab.groovy", "--autoconfigure=false");
|
||||
assertThat(new File(this.cli.getTemp(), "repository/joda-time/joda-time")).isDirectory();
|
||||
// Should be resolved from local repository cache
|
||||
assertThat(output.contains("Downloading: file:")).isTrue();
|
||||
assertThat(output).contains("Downloading: ");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -42,7 +42,7 @@ class RunCommandIntegrationTests {
|
||||
CliTester cli;
|
||||
|
||||
RunCommandIntegrationTests(CapturedOutput output) {
|
||||
this.cli = new CliTester("src/it/resources/run-command/", output);
|
||||
this.cli = new CliTester("src/test/resources/run-command/", output);
|
||||
}
|
||||
|
||||
private Properties systemProperties = new Properties();
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.boot.cli.compiler.dependencies;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.hamcrest.Matchers.empty;
|
||||
|
||||
/**
|
||||
* Tests for {@link SpringBootDependenciesDependencyManagement}
|
||||
@@ -45,7 +44,7 @@ class SpringBootDependenciesDependencyManagementTests {
|
||||
|
||||
@Test
|
||||
void getDependencies() {
|
||||
assertThat(this.dependencyManagement.getDependencies()).isNotEqualTo(empty());
|
||||
assertThat(this.dependencyManagement.getDependencies()).isNotEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,9 +47,12 @@ class AetherGrapeEngineTests {
|
||||
|
||||
private final GroovyClassLoader groovyClassLoader = new GroovyClassLoader();
|
||||
|
||||
private final RepositoryConfiguration springMilestones = new RepositoryConfiguration("spring-milestones",
|
||||
private final RepositoryConfiguration springMilestone = new RepositoryConfiguration("spring-milestone",
|
||||
URI.create("https://repo.spring.io/milestone"), false);
|
||||
|
||||
private final RepositoryConfiguration springSnaphot = new RepositoryConfiguration("spring-snapshot",
|
||||
URI.create("https://repo.spring.io/snapshot"), true);
|
||||
|
||||
private AetherGrapeEngine createGrapeEngine(RepositoryConfiguration... additionalRepositories) {
|
||||
List<RepositoryConfiguration> repositoryConfigurations = new ArrayList<>();
|
||||
repositoryConfigurations
|
||||
@@ -64,7 +67,7 @@ class AetherGrapeEngineTests {
|
||||
@Test
|
||||
void dependencyResolution() {
|
||||
Map<String, Object> args = new HashMap<>();
|
||||
createGrapeEngine(this.springMilestones).grab(args,
|
||||
createGrapeEngine(this.springMilestone, this.springSnaphot).grab(args,
|
||||
createDependency("org.springframework", "spring-jdbc", null));
|
||||
assertThat(this.groovyClassLoader.getURLs()).hasSize(5);
|
||||
}
|
||||
@@ -104,7 +107,7 @@ class AetherGrapeEngineTests {
|
||||
Map<String, Object> args = new HashMap<>();
|
||||
args.put("excludes", Arrays.asList(createExclusion("org.springframework", "spring-core")));
|
||||
|
||||
createGrapeEngine(this.springMilestones).grab(args,
|
||||
createGrapeEngine(this.springMilestone, this.springSnaphot).grab(args,
|
||||
createDependency("org.springframework", "spring-jdbc", "3.2.4.RELEASE"),
|
||||
createDependency("org.springframework", "spring-beans", "3.2.4.RELEASE"));
|
||||
|
||||
@@ -126,7 +129,7 @@ class AetherGrapeEngineTests {
|
||||
GroovyClassLoader customClassLoader = new GroovyClassLoader();
|
||||
args.put("classLoader", customClassLoader);
|
||||
|
||||
createGrapeEngine(this.springMilestones).grab(args,
|
||||
createGrapeEngine(this.springMilestone, this.springSnaphot).grab(args,
|
||||
createDependency("org.springframework", "spring-jdbc", null));
|
||||
|
||||
assertThat(this.groovyClassLoader.getURLs()).isEmpty();
|
||||
|
||||
Reference in New Issue
Block a user