Explorar el Código

tests for 133532 - also tidied up the statelistener code

tags/V1_5_1_final
aclement hace 18 años
padre
commit
24d3c4539e

+ 10
- 6
tests/src/org/aspectj/systemtest/incremental/IncrementalTests.java Ver fichero

@@ -133,12 +133,16 @@ public class IncrementalTests extends org.aspectj.testing.XMLBasedAjcTestCase {
public void buildSuccessful(boolean wasFullBuild) {}
};
MyStateListener sl = new MyStateListener();
AjState.stateListener = sl;
runTest("change source");
nextIncrement(false);
copyFileAndDoIncrementalBuild("changes/Main.20.java","src/app/Main.java");
assertTrue("Did not expect a path change to be detected ",!sl.pathChange);
run("app.Main");
try {
AjState.stateListener = sl;
runTest("change source");
nextIncrement(false);
copyFileAndDoIncrementalBuild("changes/Main.20.java","src/app/Main.java");
assertTrue("Did not expect a path change to be detected ",!sl.pathChange);
run("app.Main");
} finally {
AjState.stateListener=null;
}
}

public void test009() throws Exception {

+ 22
- 1
tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java Ver fichero

@@ -80,6 +80,7 @@ public class AjdeInteractionTestbed extends TestCase {
protected void setUp() throws Exception {
super.setUp();
if (AjState.stateListener==null) AjState.stateListener=MyStateListener.getInstance();
MyStateListener.reset();
MyBuildProgressMonitor.reset();
MyTaskListManager.reset();
@@ -89,6 +90,11 @@ public class AjdeInteractionTestbed extends TestCase {
createEmptySandbox();
}
protected void tearDown() throws Exception {
super.tearDown();
AjState.stateListener=null;
}
/** Drives a build */
public boolean build(String projectName,String configFile) {
return AjdeManager.build(projectName,configFile);
@@ -452,6 +458,10 @@ public class AjdeInteractionTestbed extends TestCase {
File.pathSeparator + this.classPath +
File.pathSeparator + System.getProperty("aspectjrt.path") +
File.pathSeparator + "../lib/junit/junit.jar" +
"c:/batik/batik-1.6/lib/batik-util.jar;"+
"c:/batik/batik-1.6/lib/batik-awt-util.jar;"+
"c:/batik/batik-1.6/lib/batik-dom.jar;"+
"c:/batik/batik-1.6/lib/batik-svggen.jar;"+
File.pathSeparator+".."+File.separator+"lib" + File.separator+"test"+File.separator+"aspectjrt.jar";
// look at dependant projects
@@ -801,10 +811,11 @@ public class AjdeInteractionTestbed extends TestCase {
public static boolean informedAboutKindOfBuild;
public static boolean fullBuildOccurred;
public static List detectedDeletions = new ArrayList();
public static StringBuffer decisions = new StringBuffer();
public static void reset() {
informedAboutKindOfBuild=false;
decisions = new StringBuffer();
fullBuildOccurred=false;
if (detectedDeletions!=null) detectedDeletions.clear();
}
@@ -823,9 +834,19 @@ public class AjdeInteractionTestbed extends TestCase {
fullBuildOccurred=wasFullBuild;
}
public static String getDecisions() {
return decisions.toString();
}
public static boolean wasFullBuild() {
if (!informedAboutKindOfBuild) throw new RuntimeException("I never heard about what kind of build it was!!");
return fullBuildOccurred;
}

// not needed just yet...
// public void recordInformation(String s) { decisions.append(s).append("\n");}
public void recordDecision(String s) {
decisions.append(s).append("\n");
}
};
}

+ 23
- 0
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java Ver fichero

@@ -822,6 +822,29 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
checkXMLAspectCount("PR131505","pkg.A",1);
}
public void testPr133532() {
initialiseProject("PR133532");
build("PR133532");
alter("PR133532","inc1");
build("PR133532");
alter("PR133532","inc2");
build("PR133532");
assertTrue("There should be no errors reported:\n"+MyTaskListManager.getErrorMessages(),
MyTaskListManager.getErrorMessages().isEmpty());
}
public void testPr133532_2() {
initialiseProject("pr133532_2");
build("pr133532_2");
alter("pr133532_2","inc2");
build("pr133532_2");
assertTrue("There should be no errors reported:\n"+MyTaskListManager.getErrorMessages(),
MyTaskListManager.getErrorMessages().isEmpty());
String decisions = AjdeInteractionTestbed.MyStateListener.getDecisions();
String expect="Need to recompile 'A.aj'";
assertTrue("Couldn't find build decision: '"+expect+"' in the list of decisions made:\n"+decisions,
decisions.indexOf(expect)!=-1);
}
// other possible tests:
// - memory usage (freemem calls?)

Cargando…
Cancelar
Guardar