Skip to content

Commit

Permalink
fully reset
Browse files Browse the repository at this point in the history
  • Loading branch information
danglotb committed Dec 12, 2016
1 parent c626bdf commit 224ff47
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public static Random getRandom() {
public static void reset() {
cloneNumber = 1;
ampTestToParent = new HashMap<>();
importByClass = new HashMap<>();
}

public static Map<CtMethod, CtMethod> getAmpTestToParent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;

/**
Expand Down Expand Up @@ -66,6 +65,13 @@ private List<String> findFailedTest(Collection<CtType> tests) throws IOException
}

MavenBuilder builder = new MavenBuilder(inputProgram.getProgramDir());

if (new File(mvnHome).exists()) {
System.out.println();
} else {
System.exit(0);
}

builder.setBuilderPath(mvnHome);

String[] phases = new String[]{"clean", "test"};
Expand All @@ -74,4 +80,5 @@ private List<String> findFailedTest(Collection<CtType> tests) throws IOException

return builder.getFailedTests();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ public void testFilterTests() throws Exception, InvalidSdkException {
3 of them failed (on purpose), only one has to be keep.
*/

String mavenHome = System.getenv().get("MAVEN_HOME");
if (mavenHome == null) {
mavenHome = "/usr/share/maven/";
Log.warn("Using default installation of Maven : " + mavenHome);
}
final String mavenHome = buildMavenHome();
System.out.println(mavenHome);

Log.warn("Using default installation of Maven : " + mavenHome);
InputProgram inputProgram = Utils.getInputProgram();
RemoveBadTest removeBadTest = new RemoveBadTest(inputProgram, mavenHome);

Expand All @@ -53,6 +51,11 @@ public void testFilterTests() throws Exception, InvalidSdkException {
assertEquals("testKeep", ((CtMethod)(ctTypes.get(0).getMethods().stream().findFirst().get())).getSimpleName());
}

private String buildMavenHome() {
return System.getenv().get("MAVEN_HOME") != null ? System.getenv().get("MAVEN_HOME") :
System.getenv().get("M2_HOME") != null ? System.getenv().get("M2_HOME") : "/usr/share/maven/";
}

@AfterClass
public static void tearDown() throws InvalidSdkException, Exception {
FileUtils.forceDelete(Utils.getCompiler().getBinaryOutputDirectory());
Expand Down

0 comments on commit 224ff47

Please sign in to comment.