diff options
author | aclement <aclement> | 2009-04-07 22:20:18 +0000 |
---|---|---|
committer | aclement <aclement> | 2009-04-07 22:20:18 +0000 |
commit | fc60b23c788601d1d44ac01dd20fa9f2eded51d6 (patch) | |
tree | 665242b23c5b46acee2b0ae1e91c0df83c87bd34 /tests | |
parent | fad0301cb8a9f460faef883cda7384c8261d46bb (diff) | |
download | aspectj-fc60b23c788601d1d44ac01dd20fa9f2eded51d6.tar.gz aspectj-fc60b23c788601d1d44ac01dd20fa9f2eded51d6.zip |
271201: inpath handles for jars
Diffstat (limited to 'tests')
5 files changed, 81 insertions, 40 deletions
diff --git a/tests/model/expected/pr141730_4.txt b/tests/model/expected/pr141730_4.txt index 714d1fba0..805c0fc29 100644 --- a/tests/model/expected/pr141730_4.txt +++ b/tests/model/expected/pr141730_4.txt @@ -23,10 +23,10 @@ NewClass [class] TEST_SANDBOX\NewClass.java:3: === END OF MODEL REPORT ========= === RELATIONSHIPS REPORT ========= After a batch build -(targets=1) <bar*MyBar.aj}MyBar`declare \@type!3 (annotates) {MyFoo.java -(targets=1) <bar*MyBar.aj}MyBar`declare parents!2 (declared on) {MyFoo.java (targets=1) {MyFoo.java (annotated by) <bar*MyBar.aj}MyBar`declare \@type!3 -(targets=1) {MyFoo.java (aspect declarations) <bar*MyBar.aj}MyBar`declare parents!2 +(targets=1) <bar*MyBar.aj}MyBar`declare parents!2 (declared on) /,<foo(MyFoo.class[MyFoo +(targets=1) <bar*MyBar.aj}MyBar`declare \@type!3 (annotates) {MyFoo.java +(targets=1) /,<foo(MyFoo.class[MyFoo (aspect declarations) <bar*MyBar.aj}MyBar`declare parents!2 === END OF RELATIONSHIPS REPORT == === Properties of the model and relationships map ===== import reference=4 @@ -39,7 +39,7 @@ declare @constructor=1 advice=1 annotation=1 class=1 -RelationshipMapSize=3 +RelationshipMapSize=4 package declaration=3 FileMapSize=3 package=1 diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 9d04205c8..37a04d362 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -4807,7 +4807,7 @@ </compile> <compile files="A2.aj" inpath="code.jar" options="-1.5,-showWeaveInfo"> <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A1' (A1.aj:'java.util.List<java.lang.String> BaseClass.list1')"/> - <message kind="weave" text="Type 'BaseClass' (BaseClass.java:12) advised by after advice from 'A1' (A1.aj:7)"/> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java:12) advised by after advice from 'A1' (code.jar!A1.class:7(from A1.aj))"/> <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A2' (A2.aj:'java.util.List<N> BaseClass.list2')"/> <message kind="weave" text="Type 'BaseClass' (BaseClass.java:13) advised by after advice from 'A2' (A2.aj:8)"/> </compile> diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java index b528c36c3..101ad0302 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java @@ -121,6 +121,13 @@ public class AjdeInteractionTestbed extends TestCase { ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setInpath(inpath); } + public static void configureInPath(String projectName, File inpath) { + Set s = new HashSet(); + s.add(inpath); + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setInpath(s); + } + public static void configureOutputLocationManager(String projectName, IOutputLocationManager mgr) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setOutputLocationManager(mgr); diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java index 610e6ba81..3299ee833 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java @@ -308,7 +308,7 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen private void addInpathEntry(String entry) { if (entry == null) { - configureInPath("inpathTesting", null); + configureInPath("inpathTesting", (Set)null); return; } File f = new File(entry); diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index f88dc7ebc..4900c7194 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -2898,42 +2898,76 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa assertNotNull(l); } + private void printModelAndRelationships(String p) { + 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) { + } + } + + public void testInpathHandles_IncrementalCompilation_RemovingInpathEntries_271201() throws Exception { + AjdeInteractionTestbed.VERBOSE=true; + String p = "inpathHandles2"; + initialiseProject(p); + + String inpathDir = getWorkingDir() + File.separator + "inpathHandles2" + File.separator + "binpath"; + + // set up the inpath to have the directory on it's path + File f = new File(inpathDir); + configureInPath(p, f); + + // This build will weave a declare parents into the inpath class codep.A and codep.B + build(p); + assertNotNull(getModelFor(p).getRelationshipMap().get("=inpathHandles2/,<codep(A.class[A")); + + // Not let us delete one of the inpath .class files + assertTrue(new File(inpathDir,"codep"+File.separator+"A.class").delete()); + setNextChangeResponse(p, ICompilerConfiguration.EVERYTHING); + build(p); +// printModelAndRelationships(p); + } + // warning about cant change parents of Object is fine -// public void testInpathJars_271201() throws Exception { -// AjdeInteractionTestbed.VERBOSE=true; -// String p = "inpathJars"; -// initialiseProject(p); -// -// String inpathTestingDir = getWorkingDir() + File.separator + "inpathJars"; -// String inpathDir = inpathTestingDir + File.separator + "code.jar"; -// // String expectedOutputDir = inpathTestingDir + File.separator + "bin"; -// -// // set up the inpath to have the directory on it's path -// System.out.println(inpathDir); -// File f = new File(inpathDir); -// Set s = new HashSet(); -// s.add(f); -// Map m = new HashMap(); -// m.put(f,"Gibble"); -// configureOutputLocationManager(p,new TestOutputLocationManager(getProjectRelativePath(p, ".").toString(),m)); -// configureInPath(p, s); + public void testInpathJars_271201() throws Exception { + AjdeInteractionTestbed.VERBOSE=true; + String p = "inpathJars"; + initialiseProject(p); + + String inpathTestingDir = getWorkingDir() + File.separator + "inpathJars"; + String inpathDir = inpathTestingDir + File.separator + "code.jar"; + // String expectedOutputDir = inpathTestingDir + File.separator + "bin"; + + // set up the inpath to have the directory on it's path + System.out.println(inpathDir); + File f = new File(inpathDir); + Set s = new HashSet(); + s.add(f); + Map m = new HashMap(); + m.put(f,"Gibble"); + configureOutputLocationManager(p,new TestOutputLocationManager(getProjectRelativePath(p, ".").toString(),m)); + configureInPath(p, s); + build(p); + + IProgramElement root = getModelFor(p).getHierarchy().getRoot(); + +// alter(p,"inc1"); // build(p); -// -// IProgramElement root = getModelFor(p).getHierarchy().getRoot(); -// -//// alter(p,"inc1"); -//// build(p); -// dumptree(root, 0); -// PrintWriter pw = new PrintWriter(System.out); -// try { -// getModelFor(p).dumprels(pw); -// pw.flush(); -// } catch (Exception e) { -// } -// List l = getModelFor(p).getRelationshipMap().get("=inpathJars/;Gibble<codep(Code.class[Code"); -// assertNotNull(l); -// System.out.println(l.get(0)); -// } + dumptree(root, 0); + PrintWriter pw = new PrintWriter(System.out); + try { + getModelFor(p).dumprels(pw); + pw.flush(); + } catch (Exception e) { + } + List l = getModelFor(p).getRelationshipMap().get("=inpathJars/,Gibble<codep(Code.class[Code"); + assertNotNull(l); + System.out.println(l.get(0)); + } // --- helper code --- |