Speed up grab command test

The autoconfiguration transformations (and loads of grabs
of spring-boot snapshots) were making the grab command
tests run really slowly. Snapshots are particularly bad.

Fixed by adding a --autoconfigure=false option to the
compiler configuration and using it in that test.
This commit is contained in:
Dave Syer
2013-11-20 09:58:05 +00:00
parent fce48c00c7
commit 89332e230e
11 changed files with 78 additions and 27 deletions

View File

@@ -98,7 +98,12 @@ public class CliTester implements TestRule {
final String[] sources = new String[args.length];
for (int i = 0; i < args.length; i++) {
String arg = args[i];
sources[i] = this.prefix + arg;
if (arg.startsWith("--")) {
sources[i] = arg;
}
else {
sources[i] = this.prefix + arg;
}
}
return sources;
}

View File

@@ -31,6 +31,7 @@ import static org.junit.Assert.assertTrue;
* Integration tests for {@link GrabCommand}
*
* @author Andy Wilkinson
* @author Dave Syer
*/
public class GrabCommandIntegrationTests {
@@ -41,22 +42,21 @@ public class GrabCommandIntegrationTests {
@After
public void deleteLocalRepository() {
FileSystemUtils.deleteRecursively(new File("target/repository"));
System.clearProperty("grape.root");
System.clearProperty("groovy.grape.report.downloads");
}
@Test
public void grab() throws Exception {
System.setProperty("grape.root", "target");
System.setProperty("groovy.grape.report.downloads", "true");
try {
String output = this.cli.grab("grab.groovy");
assertTrue(output.contains("Downloading: file:"));
assertTrue(new File("target/repository/org/springframework/spring-jdbc")
.isDirectory());
}
finally {
System.clearProperty("grape.root");
System.clearProperty("groovy.grape.report.downloads");
}
// Use --autoconfigure=false to limit the amount of downloaded dependencies
String output = this.cli.grab("grab.groovy", "--autoconfigure=false");
assertTrue(output.contains("Downloading: file:"));
assertTrue(new File("target/repository/net/sf/jopt-simple/jopt-simple")
.isDirectory());
}
}