From cdfa2e2a765a0dd979418f16c0c23298b45ebc86 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 23 Mar 2009 02:29:34 +0000 Subject: [PATCH] generalize report API to cover resources and outjar --- ...IncrementalOutputLocationManagerTests.java | 4 +- .../tools/MoreOutputLocationManagerTests.java | 4 +- .../MultiProjTestOutputLocationManager.java | 4 +- .../tools/MultiProjectIncrementalTests.java | 59 +++++++++++++++++-- .../tools/OutputLocationManagerTests.java | 8 +-- 5 files changed, 63 insertions(+), 16 deletions(-) diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalOutputLocationManagerTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalOutputLocationManagerTests.java index 09cd95474..3a1e246d9 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalOutputLocationManagerTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalOutputLocationManagerTests.java @@ -45,10 +45,10 @@ public class IncrementalOutputLocationManagerTests extends AbstractMultiProjectI this.numberOfSrcDirs = numberOfSrcDirs; } - public void reportClassFileWrite(String outputfile) { + public void reportFileWrite(String outputfile, int filetype) { } - public void reportClassFileRemove(String outputfile) { + public void reportFileRemove(String outputfile, int filetype) { } public File getOutputLocationForClass(File compilationUnit) { diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java index f731b86c1..f8bd9c40c 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java @@ -351,10 +351,10 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen return outputLoc; } - public void reportClassFileWrite(String outputfile) { + public void reportFileWrite(String outputfile, int filetype) { } - public void reportClassFileRemove(String outputfile) { + public void reportFileRemove(String outputfile, int filetype) { } public String getSourceFolderForFile(File sourceFile) { diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestOutputLocationManager.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestOutputLocationManager.java index ca22088eb..3eafcfa60 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestOutputLocationManager.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestOutputLocationManager.java @@ -99,11 +99,11 @@ public class MultiProjTestOutputLocationManager implements IOutputLocationManage } } - public void reportClassFileWrite(String outputfile) { + public void reportFileWrite(String outputfile, int filetype) { // System.err.println(">>>" + outputfile); } - public void reportClassFileRemove(String outputfile) { + public void reportFileRemove(String outputfile, int filetype) { } } diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index 7958dbaba..f40879d4e 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -15,6 +15,7 @@ import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; +import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; @@ -52,6 +53,24 @@ import org.aspectj.util.FileUtil; */ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed { + public void testOutputLocationCallbacks2() { + AjdeInteractionTestbed.VERBOSE = true; + String p = "pr268827_ol_res"; + initialiseProject(p); + Map m = new HashMap(); + m.put("a.txt", new File(getFile(p, "src/a.txt"))); + configureResourceMap(p, m); + CustomOLM olm = new CustomOLM(getProjectRelativePath(p, ".").toString()); + configureOutputLocationManager(p, olm); + build(p); + checkCompileWeaveCount(p, 2, 2); + assertEquals(3, olm.writeCount); + alter(p, "inc1"); // this contains a new B.java that doesn't have the aspect inside it + build(p); + checkCompileWeaveCount(p, 3, 1); + assertEquals(1, olm.removeCount); // B.class removed + } + public void testOutputLocationCallbacks() { String p = "pr268827_ol"; initialiseProject(p); @@ -74,18 +93,46 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa super(testProjectPath); } - public void reportClassFileWrite(String outputfile) { - super.reportClassFileWrite(outputfile); + public void reportFileWrite(String outputfile, int filetype) { + super.reportFileWrite(outputfile, filetype); writeCount++; - // System.out.println("Written " + outputfile); + // System.out.println("Written " + outputfile + " " + filetype); } - public void reportClassFileRemove(String outputfile) { - super.reportClassFileRemove(outputfile); + public void reportFileRemove(String outputfile, int filetype) { + super.reportFileRemove(outputfile, filetype); removeCount++; - // System.out.println("Removed " + outputfile); + // System.out.println("Removed " + outputfile + " " + filetype); + } + + } + + public void testWithJP_pr268522() { + String p = "pr268522"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + + IProgramElement root = getModelFor(p).getHierarchy().getRoot(); + dumptree(root, 0); + PrintWriter pw = new PrintWriter(System.out); + try { + getModelFor(p).dumprels(pw); + pw.flush(); + } catch (Exception e) { } + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + root = getModelFor(p).getHierarchy().getRoot(); + dumptree(root, 0); + pw = new PrintWriter(System.out); + try { + getModelFor(p).dumprels(pw); + pw.flush(); + } catch (Exception e) { + } } public void testBrokenCodeDeca_268611() { diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/OutputLocationManagerTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/OutputLocationManagerTests.java index e840a672a..3d10efaee 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/OutputLocationManagerTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/OutputLocationManagerTests.java @@ -99,10 +99,10 @@ public class OutputLocationManagerTests extends AbstractMultiProjectIncrementalA } - public void reportClassFileWrite(String outputfile) { + public void reportFileWrite(String outputfile, int filetype) { } - public void reportClassFileRemove(String outputfile) { + public void reportFileRemove(String outputfile, int filetype) { } public File getOutputLocationForClass(File compilationUnit) { @@ -145,10 +145,10 @@ public class OutputLocationManagerTests extends AbstractMultiProjectIncrementalA } } - public void reportClassFileWrite(String outputfile) { + public void reportFileWrite(String outputfile, int filetype) { } - public void reportClassFileRemove(String outputfile) { + public void reportFileRemove(String outputfile, int filetype) { } } -- 2.39.5