From 3d92cc4e889d0c8326eb237001449f8fd1d6a591 Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 18 May 2006 08:05:04 +0000 Subject: [PATCH] possible test for 138171 - i worry about it failing on some configurations tho.. (linux/mac...) --- .../tools/AjdeInteractionTestbed.java | 10 ++++- .../tools/MultiProjectIncrementalTests.java | 38 ++++++++++++++++++- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java index 582d8ecc8..a8c023971 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java @@ -372,17 +372,19 @@ public class AjdeInteractionTestbed extends TestCase { static MyProjectPropertiesAdapter _instance = new MyProjectPropertiesAdapter(); private MyProjectPropertiesAdapter() {} - public static ProjectPropertiesAdapter getInstance() { + public static MyProjectPropertiesAdapter getInstance() { return _instance; } public static void reset() { _instance.aspectPath=null; + _instance.sourcePathResources=null; } private String projectName = null; private String classPath = ""; private Set aspectPath = null; + private Map sourcePathResources = null; public static void setActiveProject(String n) { _instance.projectName = n; @@ -400,6 +402,10 @@ public class AjdeInteractionTestbed extends TestCase { l.add(projectItDependsOn); } } + + public void setSourcePathResources(Map m) { + this.sourcePathResources = m; + } public void setClasspath(String path) { this.classPath = path; @@ -518,7 +524,7 @@ public class AjdeInteractionTestbed extends TestCase { public Map getSourcePathResources() { log("MyProjectProperties.getSourcePathResources()"); - return null; + return sourcePathResources; } public String getOutJar() { diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index 4cba5106a..936945575 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -187,6 +187,33 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed { } + /** + * Build a project containing a resource - then mark the resource readOnly(), then + * do an inc-compile, it will report an error about write access to the resource + * in the output folder being denied + */ + /*public void testProblemCopyingResources_pr138171() { + initialiseProject("PR138171"); + + File f=getProjectRelativePath("PR138171","res.txt"); + Map m = new HashMap(); + m.put("res.txt",f); + AjdeInteractionTestbed.MyProjectPropertiesAdapter.getInstance().setSourcePathResources(m); + build("PR138171"); + File f2 = getProjectOutputRelativePath("PR138171","res.txt"); + boolean successful = f2.setReadOnly(); + + alter("PR138171","inc1"); + AjdeInteractionTestbed.MyProjectPropertiesAdapter.getInstance().setSourcePathResources(m); + build("PR138171"); + List msgs = MyTaskListManager.getErrorMessages(); + assertTrue("there should be one message but there are "+(msgs==null?0:msgs.size())+":\n"+msgs,msgs!=null && msgs.size()==1); + IMessage msg = (IMessage)msgs.get(0); + String exp = "unable to copy resource to output folder: 'res.txt'"; + assertTrue("Expected message to include this text ["+exp+"] but it does not: "+msg,msg.toString().indexOf(exp)!=-1); + }*/ + + // Make simple changes to a project, adding a class public void testSimpleChanges() { initialiseProject("P1"); @@ -1561,6 +1588,15 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed { System.out.println("End of AJDE structure model"); //$NON-NLS-1$ System.out.println("======================================");//$NON-NLS-1$ } - + + private File getProjectRelativePath(String p,String filename) { + File projDir = new File(getWorkingDir(),p); + return new File(projDir,filename); + } + + private File getProjectOutputRelativePath(String p,String filename) { + File projDir = new File(getWorkingDir(),p); + return new File(projDir,"bin"+File.separator+filename); + } } -- 2.39.5