]> source.dussan.org Git - aspectj.git/commitdiff
possible test for 138171 - i worry about it failing on some configurations tho.....
authoraclement <aclement>
Thu, 18 May 2006 08:05:04 +0000 (08:05 +0000)
committeraclement <aclement>
Thu, 18 May 2006 08:05:04 +0000 (08:05 +0000)
tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java

index 582d8ecc8edb072413a94ac8bf6dd3d1b2b5ffbf..a8c02397106e209a4f487121ae08c9783b9e6729 100644 (file)
@@ -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() {
index 4cba5106af0679a52abac2b2bcfefed2d4d0eb62..936945575763b87821455fe3306c44364f5f2cb3 100644 (file)
@@ -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);
+       }
        
 }