diff options
author | aclement <aclement> | 2006-12-21 13:22:43 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-12-21 13:22:43 +0000 |
commit | d101ea2c756451cff2ed0462cd13581e2a746661 (patch) | |
tree | a7d496dfff0fdfa7723105fea7d33e17161efe2b | |
parent | e5f15ac120710e8a08c9af3795d5a1e75ea69ebc (diff) | |
download | aspectj-d101ea2c756451cff2ed0462cd13581e2a746661.tar.gz aspectj-d101ea2c756451cff2ed0462cd13581e2a746661.zip |
test and fix for 168840: incremental compilation and inpath
8 files changed, 90 insertions, 2 deletions
diff --git a/tests/multiIncremental/inpathTesting/README.txt b/tests/multiIncremental/inpathTesting/README.txt new file mode 100644 index 000000000..34e5f7798 --- /dev/null +++ b/tests/multiIncremental/inpathTesting/README.txt @@ -0,0 +1,11 @@ +To regenerate the class file in injarBin\pkg: + + javac origInpathClass\InpathClass.java + +and copy it to injarBin\pkg. + +To regenerate the class copied over as part of the test: + + javac newInpathClass\InpathClass.java + + diff --git a/tests/multiIncremental/inpathTesting/base/injarBin/pkg/InpathClass.class b/tests/multiIncremental/inpathTesting/base/injarBin/pkg/InpathClass.class Binary files differnew file mode 100644 index 000000000..01c5f472a --- /dev/null +++ b/tests/multiIncremental/inpathTesting/base/injarBin/pkg/InpathClass.class diff --git a/tests/multiIncremental/inpathTesting/base/src/pack/A.aj b/tests/multiIncremental/inpathTesting/base/src/pack/A.aj new file mode 100644 index 000000000..d05ac12aa --- /dev/null +++ b/tests/multiIncremental/inpathTesting/base/src/pack/A.aj @@ -0,0 +1,9 @@ +package pack; + +public aspect A { + + pointcut execEverything() : execution(* *.*(..)); + + declare warning : execEverything() : "blah"; + +} diff --git a/tests/multiIncremental/inpathTesting/newInpathClass/InpathClass.class b/tests/multiIncremental/inpathTesting/newInpathClass/InpathClass.class Binary files differnew file mode 100644 index 000000000..2d7c2091c --- /dev/null +++ b/tests/multiIncremental/inpathTesting/newInpathClass/InpathClass.class diff --git a/tests/multiIncremental/inpathTesting/newInpathClass/InpathClass.java b/tests/multiIncremental/inpathTesting/newInpathClass/InpathClass.java new file mode 100644 index 000000000..c93a73938 --- /dev/null +++ b/tests/multiIncremental/inpathTesting/newInpathClass/InpathClass.java @@ -0,0 +1,13 @@ +package pkg; + +public class InpathClass { + + public void boo() { + + } + + public void goo() { + + } + +}
\ No newline at end of file diff --git a/tests/multiIncremental/inpathTesting/origInpathClass/InpathClass.java b/tests/multiIncremental/inpathTesting/origInpathClass/InpathClass.java new file mode 100644 index 000000000..9c2af4d79 --- /dev/null +++ b/tests/multiIncremental/inpathTesting/origInpathClass/InpathClass.java @@ -0,0 +1,9 @@ +package pkg; + +public class InpathClass { + + public void boo() { + + } + +} diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java index be6b2c78e..61d84f4b8 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java @@ -75,6 +75,10 @@ public class AjdeInteractionTestbed extends TestCase { MyProjectPropertiesAdapter.setAspectpath(aspectpath); } + public static void configureInPath(Set inpath) { + MyProjectPropertiesAdapter.setInpath(inpath); + } + public static void configureOutputLocationManager(OutputLocationManager mgr) { MyProjectPropertiesAdapter.setOutputLocationManager(mgr); } @@ -357,12 +361,14 @@ public class AjdeInteractionTestbed extends TestCase { static MyProjectPropertiesAdapter _instance = new MyProjectPropertiesAdapter(); private MyProjectPropertiesAdapter() {} + public static MyProjectPropertiesAdapter getInstance() { return _instance; } public static void reset() { _instance.aspectPath=null; + _instance.inpath = null; _instance.sourcePathResources=null; _instance.outputLocationManager=null; } @@ -370,6 +376,7 @@ public class AjdeInteractionTestbed extends TestCase { private String projectName = null; private String classPath = ""; private Set aspectPath = null; + private Set inpath = null; private Map sourcePathResources = null; private OutputLocationManager outputLocationManager = null; @@ -402,6 +409,11 @@ public class AjdeInteractionTestbed extends TestCase { _instance.aspectPath = path; } + public static void setInpath(Set inpath) { + _instance.inpath = inpath; + } + + // interface impl below // DOESSOMETHING @@ -509,8 +521,8 @@ public class AjdeInteractionTestbed extends TestCase { } public Set getInpath() { - log("MyProjectProperties.getInPath()"); - return null; + log("MyProjectProperties.getInPath(" + inpath +")"); + return inpath; } public Map getSourcePathResources() { diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index 88cbff058..04a464750 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -38,6 +38,7 @@ import org.aspectj.bridge.IMessage; import org.aspectj.bridge.IMessageHandler; import org.aspectj.bridge.IMessageHolder; import org.aspectj.tools.ajc.Ajc; +import org.aspectj.util.FileUtil; import org.aspectj.weaver.LintMessage; /** @@ -1672,6 +1673,39 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa " error but only found that one",errors.size() > 1); } } + + public void testPr168840() throws Exception { + initialiseProject("inpathTesting"); + + String inpathTestingDir = getWorkingDir() + File.separator + "inpathTesting"; + String inpathDir = inpathTestingDir + File.separator + "injarBin" + File.separator + "pkg"; + String expectedOutputDir = inpathTestingDir + File.separator + "bin"; + + // set up the inpath to have the directory on it's path + File f = new File(inpathDir); + Set s = new HashSet(); + s.add(f); + configureInPath(s); + build("inpathTesting"); + // the declare warning matches one place so expect one warning message + assertTrue("Expected there to be one warning message but found " + + MyTaskListManager.getWarningMessages().size() + ": " + MyTaskListManager.getWarningMessages(), + MyTaskListManager.getWarningMessages().size() == 1); + + // copy over the updated version of the inpath class file + File from = new File(testdataSrcDir+File.separatorChar+"inpathTesting" + +File.separatorChar+"newInpathClass" + File.separatorChar + "InpathClass.class"); + File destination = new File(inpathDir + File.separatorChar + "InpathClass.class"); + FileUtil.copyFile(from,destination); + + build("inpathTesting"); + checkWasntFullBuild(); + // the newly copied inpath class means the declare warning now matches two + // places, therefore expect two warning messages + assertTrue("Expected there to be two warning message but found " + + MyTaskListManager.getWarningMessages().size() + ": " + MyTaskListManager.getWarningMessages(), + MyTaskListManager.getWarningMessages().size() == 2); + } // --- helper code --- |