From d4d9ca53eb0d22797f0c386747d46fe8ef057d4b Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 28 Aug 2008 23:59:44 +0000 Subject: [PATCH] 245566: testcode for incremental magic --- .../org/aspectj/systemtest/AllTests15.java | 13 +- .../tools/AjdeInteractionTestbed.java | 317 +-- .../tools/IncrementalPerformanceTests.java | 128 ++ .../MultiProjTestCompilerConfiguration.java | 104 +- .../tools/MultiProjectIncrementalTests.java | 1981 ++++++++--------- 5 files changed, 1295 insertions(+), 1248 deletions(-) create mode 100644 tests/src/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java diff --git a/tests/src/org/aspectj/systemtest/AllTests15.java b/tests/src/org/aspectj/systemtest/AllTests15.java index 290d4d21b..c8a2ce89a 100644 --- a/tests/src/org/aspectj/systemtest/AllTests15.java +++ b/tests/src/org/aspectj/systemtest/AllTests15.java @@ -13,6 +13,7 @@ import org.aspectj.systemtest.ajc152.AllTestsAspectJ152; import org.aspectj.systemtest.ajc153.AllTestsAspectJ153; import org.aspectj.systemtest.ajc154.AllTestsAspectJ154; import org.aspectj.systemtest.incremental.tools.IncrementalOutputLocationManagerTests; +import org.aspectj.systemtest.incremental.tools.IncrementalPerformanceTests; import org.aspectj.systemtest.incremental.tools.MoreOutputLocationManagerTests; import org.aspectj.systemtest.incremental.tools.MultiProjectIncrementalTests; import org.aspectj.systemtest.model.Model5Tests; @@ -22,7 +23,7 @@ public class AllTests15 { public static Test suite() { TestSuite suite = new TestSuite("AspectJ System Test Suite - JDK 1.5"); - //$JUnit-BEGIN$ + // $JUnit-BEGIN$ suite.addTest(AllTests14.suite()); suite.addTest(AllTestsAspectJ150.suite()); suite.addTest(AllTestsAspectJ151.suite()); @@ -31,16 +32,16 @@ public class AllTests15 { suite.addTest(AllTestsAspectJ154.suite()); suite.addTest(AtAjAnnotationGenTests.suite()); suite.addTest(Model5Tests.suite()); - /* FIXME maw Many of these tests do not depend on Java 5 but they - * cannot be executed in Eclipse with 1.3 because of XML issues and - * are excluded on the build machine so moving them here loses nothing - * for the moment. + /* + * FIXME maw Many of these tests do not depend on Java 5 but they cannot be executed in Eclipse with 1.3 because of XML + * issues and are excluded on the build machine so moving them here loses nothing for the moment. */ suite.addTestSuite(MultiProjectIncrementalTests.class); + suite.addTestSuite(IncrementalPerformanceTests.class); suite.addTestSuite(MoreOutputLocationManagerTests.class); suite.addTestSuite(IncrementalOutputLocationManagerTests.class); suite.addTest(XLint5Tests.suite()); - //$JUnit-END$ + // $JUnit-END$ return suite; } } diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java index 639f29fb4..cf9751915 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java @@ -24,6 +24,7 @@ import junit.framework.TestCase; import org.aspectj.ajde.core.AjCompiler; import org.aspectj.ajde.core.IBuildMessageHandler; +import org.aspectj.ajde.core.ICompilerConfiguration; import org.aspectj.ajde.core.IOutputLocationManager; import org.aspectj.ajdt.internal.core.builder.AbstractStateListener; import org.aspectj.ajdt.internal.core.builder.AjState; @@ -35,64 +36,72 @@ import org.aspectj.tools.ajc.Ajc; /** * This class uses Ajde in the same way that an IDE (e.g. AJDT) does. * - * The build is driven through 'doBuild(projectName)' but the - * build can be configured by the methods beginning 'configure***'. - * Information about what happened during a build is accessible - * through the get*, was*, print* public methods... + * The build is driven through 'doBuild(projectName)' but the build can be configured by the methods beginning 'configure***'. + * Information about what happened during a build is accessible through the get*, was*, print* public methods... * */ public class AjdeInteractionTestbed extends TestCase { public static boolean VERBOSE = false; // do you want the gory details? - + public static String testdataSrcDir = "../tests/multiIncremental"; protected static File sandboxDir; - + private static boolean buildModel; // Methods for configuring the build public void configureNewProjectDependency(String fromProjectName, String projectItDependsOn) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + fromProjectName); - ((MultiProjTestCompilerConfiguration)compiler.getCompilerConfiguration()).addDependancy(projectItDependsOn); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).addDependancy(projectItDependsOn); } - + + public void setNextChangeResponse(String projName, int flags) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).changed = flags; + } + + public void addProjectSourceFileChanged(String projectName, File changedFile) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).addProjectSourceFileChanged(changedFile); + } + public void configureNonStandardCompileOptions(String projectName, String options) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); - ((MultiProjTestCompilerConfiguration)compiler.getCompilerConfiguration()).setNonStandardOptions(options); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setNonStandardOptions(options); } - + public void configureAspectPath(String projectName, Set aspectpath) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); - ((MultiProjTestCompilerConfiguration)compiler.getCompilerConfiguration()).setAspectPath(aspectpath); - } + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setAspectPath(aspectpath); + } public void configureAspectPath(String projectName, File aspectpath) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); Set s = new HashSet(); s.add(aspectpath); - ((MultiProjTestCompilerConfiguration)compiler.getCompilerConfiguration()).setAspectPath(s); - } - + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setAspectPath(s); + } + public void configureResourceMap(String projectName, Map resourcesMap) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); - ((MultiProjTestCompilerConfiguration)compiler.getCompilerConfiguration()).setSourcePathResources(resourcesMap); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setSourcePathResources(resourcesMap); } - + public void configureJavaOptionsMap(String projectName, Map options) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); - ((MultiProjTestCompilerConfiguration)compiler.getCompilerConfiguration()).setJavaOptions(options); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setJavaOptions(options); } - + public static void configureInPath(String projectName, Set inpath) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); - ((MultiProjTestCompilerConfiguration)compiler.getCompilerConfiguration()).setInpath(inpath); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setInpath(inpath); } - + public static void configureOutputLocationManager(String projectName, IOutputLocationManager mgr) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); - ((MultiProjTestCompilerConfiguration)compiler.getCompilerConfiguration()).setOutputLocationManager(mgr); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setOutputLocationManager(mgr); } - + public void configureShowWeaveInfoMessages(String projectName, boolean showWeaveInfo) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); IBuildMessageHandler handler = compiler.getMessageHandler(); @@ -102,48 +111,50 @@ public class AjdeInteractionTestbed extends TestCase { handler.ignore(IMessage.WEAVEINFO); } } - + // End of methods for configuring the build - + public AjCompiler getCompilerForProjectWithName(String projectName) { return CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); } - - protected File getWorkingDir() { return sandboxDir; } - + + protected File getWorkingDir() { + return sandboxDir; + } + protected void setUp() throws Exception { super.setUp(); // need this line because otherwise reset in previous tests AsmManager.attemptIncrementalModelRepairs = true; - if (AjState.stateListener==null) { - AjState.stateListener=MyStateListener.getInstance(); - + if (AjState.stateListener == null) { + AjState.stateListener = MyStateListener.getInstance(); + } MyStateListener.reset(); // Create a sandbox in which to work sandboxDir = Ajc.createEmptySandbox(); } - + protected void tearDown() throws Exception { super.tearDown(); - AjState.stateListener=null; + AjState.stateListener = null; CompilerFactory.clearCompilerMap(); IncrementalStateManager.clearIncrementalStates(); } - + /** Drives a build */ public boolean doBuild(String projectName) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); resetCompilerRecords(compiler); addSourceFilesToBuild(projectName, compiler); pause(1000); // delay to allow previous runs build stamps to be OK - lognoln("Building project '"+projectName+"'"); + lognoln("Building project '" + projectName + "'"); compiler.build(); log(""); checkForErrors(compiler); - log("Build finished, time taken = " +((MultiProjTestBuildProgressMonitor) - compiler.getBuildProgressMonitor()).getTimeTaken()+"ms"); - return true; + log("Build finished, time taken = " + + ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getTimeTaken() + "ms"); + return true; } /** Drives a full build **/ @@ -152,58 +163,71 @@ public class AjdeInteractionTestbed extends TestCase { resetCompilerRecords(compiler); addSourceFilesToBuild(projectName, compiler); pause(1000); // delay to allow previous runs build stamps to be OK - lognoln("Building project '"+projectName+"'"); + lognoln("Building project '" + projectName + "'"); compiler.buildFresh(); log(""); checkForErrors(compiler); - log("Build finished, time taken = " +((MultiProjTestBuildProgressMonitor) - compiler.getBuildProgressMonitor()).getTimeTaken()+"ms"); - return true; + log("Build finished, time taken = " + + ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getTimeTaken() + "ms"); + return true; } - + /** * Clears any maps associated with the compiler */ private void resetCompilerRecords(AjCompiler compiler) { - ((MultiProjTestBuildProgressMonitor)compiler.getBuildProgressMonitor()).reset(); - ((MultiProjTestMessageHandler)compiler.getMessageHandler()).reset(); + ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).reset(); + ((MultiProjTestMessageHandler) compiler.getMessageHandler()).reset(); } - + /** - * Find the source files associated with the given project and add them to the - * list of projectSourceFiles in the MultiProjTestCompilerConfiguration to be - * used in the subsequent build + * Find the source files associated with the given project and add them to the list of projectSourceFiles in the + * MultiProjTestCompilerConfiguration to be used in the subsequent build */ private void addSourceFilesToBuild(String pname, AjCompiler compiler) { - File projectBase = new File(sandboxDir,pname); + File projectBase = new File(sandboxDir, pname); + ICompilerConfiguration icc = compiler.getCompilerConfiguration(); + List currentFiles = icc.getProjectSourceFiles(); List filesForCompilation = new ArrayList(); - collectUpFiles(projectBase,projectBase,filesForCompilation); - ((MultiProjTestCompilerConfiguration)compiler.getCompilerConfiguration()).setProjectSourceFiles(filesForCompilation); + collectUpFiles(projectBase, projectBase, filesForCompilation); + boolean changed = false; + for (int i = 0; i < filesForCompilation.size(); i++) { + if (!currentFiles.contains(filesForCompilation.get(i))) + changed = true; + } + for (int i = 0; i < currentFiles.size(); i++) { + if (!filesForCompilation.contains(currentFiles.get(i))) + changed = true; + } + if (changed) { + ((MultiProjTestCompilerConfiguration) icc).setProjectSourceFiles(filesForCompilation); + } } - + private void collectUpFiles(File location, File base, List collectionPoint) { String contents[] = location.list(); - if (contents==null) return; + if (contents == null) + return; for (int i = 0; i < contents.length; i++) { String string = contents[i]; - File f = new File(location,string); + File f = new File(location, string); if (f.isDirectory()) { - collectUpFiles(f,base,collectionPoint); + collectUpFiles(f, base, collectionPoint); } else if (f.isFile() && (f.getName().endsWith(".aj") || f.getName().endsWith(".java"))) { String fileFound; try { fileFound = f.getCanonicalPath(); collectionPoint.add(fileFound); -// String toRemove = base.getCanonicalPath(); -// if (!fileFound.startsWith(toRemove)) throw new RuntimeException("eh? "+fileFound+" "+toRemove); -// collectionPoint.add(fileFound.substring(toRemove.length()+1));//+1 captures extra separator + // String toRemove = base.getCanonicalPath(); + // if (!fileFound.startsWith(toRemove)) throw new RuntimeException("eh? "+fileFound+" "+toRemove); + // collectionPoint.add(fileFound.substring(toRemove.length()+1));//+1 captures extra separator } catch (IOException e) { e.printStackTrace(); } } } } - + /** * Make sure no errors have been recorded */ @@ -215,192 +239,207 @@ public class AjdeInteractionTestbed extends TestCase { IMessage element = (IMessage) iter.next(); System.err.println(element); } - System.err.println("---------"); + System.err.println("---------"); } } - + public List getErrorMessages(String projectName) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); return ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getErrorMessages(); } - + public List getWarningMessages(String projectName) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); return ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getWarningMessages(); } - + public List getWeavingMessages(String projectName) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); return ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getWeavingMessages(); } - + public List getCompilerErrorMessages(String projectName) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); return ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getCompilerErrors(); } - + public void checkForError(String projectName, String anError) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); - List messages = ((MultiProjTestMessageHandler)compiler.getMessageHandler()).getErrorMessages(); + List messages = ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getErrorMessages(); for (Iterator iter = messages.iterator(); iter.hasNext();) { IMessage element = (IMessage) iter.next(); - if (element.getMessage().indexOf(anError)!=-1) return; + if (element.getMessage().indexOf(anError) != -1) + return; } - fail("Didn't find the error message:\n'"+anError+"'.\nErrors that occurred:\n"+messages); + fail("Didn't find the error message:\n'" + anError + "'.\nErrors that occurred:\n" + messages); } - + private void pause(int millis) { try { Thread.sleep(millis); - } catch (InterruptedException ie) {} + } catch (InterruptedException ie) { + } } // Methods for querying what happened during a build and accessing information // about the build: - + /** - * Helper method for dumping info about which files were compiled and - * woven during the last build. + * Helper method for dumping info about which files were compiled and woven during the last build. */ public String printCompiledAndWovenFiles(String projectName) { StringBuffer sb = new StringBuffer(); - if (getCompiledFiles(projectName).size()==0 && getWovenClasses(projectName).size()==0) + if (getCompiledFiles(projectName).size() == 0 && getWovenClasses(projectName).size() == 0) sb.append("No files were compiled or woven\n"); for (Iterator iter = getCompiledFiles(projectName).iterator(); iter.hasNext();) { Object element = (Object) iter.next(); - sb.append("compiled: "+element+"\n"); + sb.append("compiled: " + element + "\n"); } for (Iterator iter = getWovenClasses(projectName).iterator(); iter.hasNext();) { Object element = (Object) iter.next(); - sb.append("woven: "+element+"\n"); + sb.append("woven: " + element + "\n"); } return sb.toString(); } - + /** * Summary report on what happened in the most recent build */ public void printBuildReport(String projectName) { - System.out.println("\n====== BUILD REPORT (Project "+projectName+") ==========="); - System.out.println("Build took: "+getTimeTakenForBuild(projectName)+"ms"); - List compiled=getCompiledFiles(projectName); - System.out.println("Compiled: "+compiled.size()+" files"); + System.out.println("\n====== BUILD REPORT (Project " + projectName + ") ==========="); + System.out.println("Build took: " + getTimeTakenForBuild(projectName) + "ms"); + List compiled = getCompiledFiles(projectName); + System.out.println("Compiled: " + compiled.size() + " files"); for (Iterator iter = compiled.iterator(); iter.hasNext();) { - System.out.println(" :"+iter.next()); + System.out.println(" :" + iter.next()); } - List woven=getWovenClasses(projectName); - System.out.println("Wove: "+woven.size()+" files"); + List woven = getWovenClasses(projectName); + System.out.println("Wove: " + woven.size() + " files"); for (Iterator iter = woven.iterator(); iter.hasNext();) { - System.out.println(" :"+iter.next()); + System.out.println(" :" + iter.next()); } - if (wasFullBuild()) System.out.println("It was a batch (full) build"); + if (wasFullBuild()) + System.out.println("It was a batch (full) build"); System.out.println("============================================="); } /** - * Check we compiled/wove the right number of files, passing '-1' indicates you don't care about - * that number. + * Check we compiled/wove the right number of files, passing '-1' indicates you don't care about that number. */ - public void checkCompileWeaveCount(String projectName,int expCompile,int expWoven) { - if (expCompile!=-1 && getCompiledFiles(projectName).size()!=expCompile) - fail("Expected compilation of "+expCompile+" files but compiled "+getCompiledFiles(projectName).size()+ - "\n"+printCompiledAndWovenFiles(projectName)); - if (expWoven!=-1 && getWovenClasses(projectName).size()!=expWoven) - fail("Expected weaving of "+expWoven+" files but wove "+getWovenClasses(projectName).size()+ - "\n"+printCompiledAndWovenFiles(projectName)); - } - + public void checkCompileWeaveCount(String projectName, int expCompile, int expWoven) { + if (expCompile != -1 && getCompiledFiles(projectName).size() != expCompile) + fail("Expected compilation of " + expCompile + " files but compiled " + getCompiledFiles(projectName).size() + "\n" + + printCompiledAndWovenFiles(projectName)); + if (expWoven != -1 && getWovenClasses(projectName).size() != expWoven) + fail("Expected weaving of " + expWoven + " files but wove " + getWovenClasses(projectName).size() + "\n" + + printCompiledAndWovenFiles(projectName)); + } + public void checkWasntFullBuild() { - assertTrue("Shouldn't have been a full (batch) build",!wasFullBuild()); + assertTrue("Shouldn't have been a full (batch) build", !wasFullBuild()); } - + public void checkWasFullBuild() { - assertTrue("Should have been a full (batch) build",wasFullBuild()); + assertTrue("Should have been a full (batch) build", wasFullBuild()); } - + public boolean wasFullBuild() { - // alternatives: statelistener is debug interface, progressmonitor is new proper interface (see pr145689) -// return MyBuildProgressMonitor.wasFullBuild(); + // alternatives: statelistener is debug interface, progressmonitor is new proper interface (see pr145689) + // return MyBuildProgressMonitor.wasFullBuild(); return MyStateListener.wasFullBuild(); } - public long getTimeTakenForBuild(String projectName) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); - return ((MultiProjTestBuildProgressMonitor)compiler.getBuildProgressMonitor()).getTimeTaken(); + return ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getTimeTaken(); } - + public List getCompiledFiles(String projectName) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); - return ((MultiProjTestBuildProgressMonitor)compiler.getBuildProgressMonitor()).getCompiledFiles(); + return ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getCompiledFiles(); } public List getWovenClasses(String projectName) { AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); - return ((MultiProjTestBuildProgressMonitor)compiler.getBuildProgressMonitor()).getWovenClasses(); + return ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getWovenClasses(); } - + // Infrastructure below here - + private static void log(String msg) { - if (VERBOSE) System.out.println(msg); + if (VERBOSE) + System.out.println(msg); } - + private static void lognoln(String msg) { - if (VERBOSE) System.out.print(msg); + if (VERBOSE) + System.out.print(msg); } - - /** Return the *full* path to this file which is taken relative to the project dir*/ + + /** Return the *full* path to this file which is taken relative to the project dir */ protected static String getFile(String projectName, String path) { - return new File(sandboxDir,projectName+File.separatorChar + path).getAbsolutePath(); + return new File(sandboxDir, projectName + File.separatorChar + path).getAbsolutePath(); } - + static class MyStateListener extends AbstractStateListener { - + private static MyStateListener _instance = new MyStateListener(); - private MyStateListener() {reset();} - - public static MyStateListener getInstance() { return _instance;} - + + private MyStateListener() { + reset(); + } + + public static MyStateListener getInstance() { + return _instance; + } + public static boolean informedAboutKindOfBuild; public static boolean fullBuildOccurred; public static List detectedDeletions = new ArrayList(); public static StringBuffer decisions = new StringBuffer(); - + public static void reset() { - informedAboutKindOfBuild=false; + informedAboutKindOfBuild = false; decisions = new StringBuffer(); - fullBuildOccurred=false; - if (detectedDeletions!=null) detectedDeletions.clear(); + fullBuildOccurred = false; + if (detectedDeletions != null) + detectedDeletions.clear(); + } + + public boolean pathChange = false; + + public void pathChangeDetected() { + pathChange = true; + } + + public void aboutToCompareClasspaths(List oldClasspath, List newClasspath) { } - - public boolean pathChange = false; - public void pathChangeDetected() {pathChange = true;} - public void aboutToCompareClasspaths(List oldClasspath, List newClasspath) {} + public void detectedClassChangeInThisDir(File f) { - recordDecision("Detected class change in this directory: "+f.toString()); + recordDecision("Detected class change in this directory: " + f.toString()); } - + public void detectedAspectDeleted(File f) { detectedDeletions.add(f.toString()); } public void buildSuccessful(boolean wasFullBuild) { - informedAboutKindOfBuild= true; - fullBuildOccurred=wasFullBuild; + informedAboutKindOfBuild = true; + fullBuildOccurred = wasFullBuild; } - + public static String getDecisions() { return decisions.toString(); } - + public static boolean wasFullBuild() { - if (!informedAboutKindOfBuild) throw new RuntimeException("I never heard about what kind of build it was!!"); + if (!informedAboutKindOfBuild) + throw new RuntimeException("I never heard about what kind of build it was!!"); return fullBuildOccurred; } // not needed just yet... -// public void recordInformation(String s) { decisions.append(s).append("\n");} + // public void recordInformation(String s) { decisions.append(s).append("\n");} public void recordDecision(String s) { decisions.append(s).append("\n"); log(s); diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java new file mode 100644 index 000000000..32faf78fd --- /dev/null +++ b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java @@ -0,0 +1,128 @@ +/******************************************************************** + * Copyright (c) 2008 Contributors. All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement initial implementation + *******************************************************************/ +package org.aspectj.systemtest.incremental.tools; + +import java.io.File; +import java.io.IOException; + +/** + * Testing the performance of incremental compilation as it would be in AJDT. + * + * @author AndyClement + */ +public class IncrementalPerformanceTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed { + + /** + * Build a project of 64 source files and no aspects.
+ * + * + *

+ * 162-dev, 28Aug08 times: Thinkpad T61p: 3203/3140/3234/3156 173/172/172/172 313/297/297/312 + */ + public void testBuildingProject64Files() { + String proj = "Proj64"; + + // A full build: + initialiseProject(proj); + build(proj); + checkWasFullBuild(); + long fullbuildtime = getTimeTakenForBuild(proj); + System.out.println("Full build time: " + fullbuildtime + "ms"); + + // An incremental build with no source file changes at all. What should happen? + // We need to determine that nothing has to be done as fast as possible, this is all about + // determining from the configuration that nothing has changed and returning as fast as possible. Any + // delays here are unnecessary burden that will hurt every other kind of compilation. + build(proj); + checkWasntFullBuild(); + checkCompileWeaveCount(proj, 0, 0); + long nochangebuild = getTimeTakenForBuild(proj); + System.out.println("Incr build time for no changes at all: " + nochangebuild + "ms"); + + addProjectSourceFileChanged(proj, null); + build(proj); + checkWasntFullBuild(); + checkCompileWeaveCount(proj, 0, 0); + long nochangebuildandDoTellCompiler = getTimeTakenForBuild(proj); + System.out.println("Incr build time for no changes at all and telling the compiler that: " + nochangebuildandDoTellCompiler + + "ms"); + + // Now we touch a file (C0.java) and call build. What should happen? + // We need to determine what has changed, we'll do that by walking over the set of input files and + // checking their last modified stamps. So although we won't rebuild a buildConfig object, we will + // call lastModifiedTime() a lot to determine which file has changed. + alter(proj, "inc1"); + build(proj); + checkWasntFullBuild(); + checkCompileWeaveCount(proj, 1, 1); + long whitespacechangeDontTellCompiler = getTimeTakenForBuild(proj); + System.out.println("Incr build time for whitespace change: " + whitespacechangeDontTellCompiler + "ms"); + + // Similar to previous test, touch that file, but this time tell the compiler which file has changed. What should happen? + // As we are telling the compiler what has changed, it will not jump through hoops checking the last mod time of + // every source file in the project configuration. + alter(proj, "inc1"); + addProjectSourceFileChanged(proj, getProjectRelativePath(proj, "src/out/C0.java")); + build(proj); + checkWasntFullBuild(); + checkCompileWeaveCount(proj, 1, 1); + long whitespacechangeDoTellCompiler = getTimeTakenForBuild(proj); + System.out.println("Incr build time for whitespace change (where we tell the compiler what changed): " + + whitespacechangeDoTellCompiler + "ms"); + + // Lets assert what really ought to be true + assertTrue(nochangebuild < fullbuildtime); + assertTrue(whitespacechangeDontTellCompiler < fullbuildtime); + assertTrue(whitespacechangeDoTellCompiler < fullbuildtime); + + assertTrue(nochangebuild < whitespacechangeDontTellCompiler); + assertTrue(nochangebuild < whitespacechangeDoTellCompiler); + + assertTrue(whitespacechangeDoTellCompiler < whitespacechangeDontTellCompiler); + } + + // --- helper code --- + + private void waitFor10() { + try { + Thread.sleep(10000); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void waitForReturn() { + try { + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + protected void setUp() throws Exception { + super.setUp(); + testdataSrcDir = "../tests/incrementalPerformance"; + } + + protected void tearDown() throws Exception { + super.tearDown(); + testdataSrcDir = "../tests/multiIncremental"; + } + + private File getProjectRelativePath(String p, String filename) { + File projDir = new File(getWorkingDir(), p); + return new File(projDir, filename); + } +} \ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java index 67d8ffce3..18946cfb1 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java @@ -22,14 +22,13 @@ import org.aspectj.ajde.core.ICompilerConfiguration; import org.aspectj.ajde.core.IOutputLocationManager; /** - * ICompilerConfiguration which mirrors the way AJDT behaves. Always returns - * that its 1.5 compliant and enables the setting of all options except - * output jar. + * ICompilerConfiguration which mirrors the way AJDT behaves. Always returns that its 1.5 compliant and enables the setting of all + * options except output jar. */ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguration { private boolean verbose = false; - + private String classPath = ""; private Set aspectPath = null; private Map sourcePathResources = null; @@ -39,15 +38,18 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio private Set inpath; private String outjar; private String nonstandardoptions; + private List modifiedFiles; private List projectSourceFiles = new ArrayList(); private String projectPath; + int changed; + public MultiProjTestCompilerConfiguration(String projectPath) { this.projectPath = projectPath; } - + public Set getAspectPath() { - log("ICompilerConfiguration.getAspectPath("+aspectPath+")"); + log("ICompilerConfiguration.getAspectPath(" + aspectPath + ")"); return aspectPath; } @@ -60,27 +62,21 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio File dir = (File) iterator.next(); sb.append(File.pathSeparator + dir.getAbsolutePath()); } - String cp = - sb.toString() + File.pathSeparator + - new File(AjdeInteractionTestbed.testdataSrcDir) + File.pathSeparator + - System.getProperty("sun.boot.class.path") + - File.pathSeparator + "../runtime/bin" + - File.pathSeparator + this.classPath + - File.pathSeparator + System.getProperty("aspectjrt.path") + - File.pathSeparator + "../lib/junit/junit.jar" + - "c:/batik/batik-1.6/lib/batik-util.jar;"+ - "c:/batik/batik-1.6/lib/batik-awt-util.jar;"+ - "c:/batik/batik-1.6/lib/batik-dom.jar;"+ - "c:/batik/batik-1.6/lib/batik-svggen.jar;"+ - File.pathSeparator+".."+File.separator+"lib" + File.separator+"test"+File.separator+"aspectjrt.jar"; - + String cp = sb.toString() + File.pathSeparator + new File(AjdeInteractionTestbed.testdataSrcDir) + File.pathSeparator + + System.getProperty("sun.boot.class.path") + File.pathSeparator + "../runtime/bin" + File.pathSeparator + + this.classPath + File.pathSeparator + System.getProperty("aspectjrt.path") + File.pathSeparator + + "../lib/junit/junit.jar" + "c:/batik/batik-1.6/lib/batik-util.jar;" + + "c:/batik/batik-1.6/lib/batik-awt-util.jar;" + "c:/batik/batik-1.6/lib/batik-dom.jar;" + + "c:/batik/batik-1.6/lib/batik-svggen.jar;" + File.pathSeparator + ".." + File.separator + "lib" + File.separator + + "test" + File.separator + "aspectjrt.jar"; + // look at dependant projects - if (dependants!=null) { + if (dependants != null) { for (Iterator iter = dependants.iterator(); iter.hasNext();) { - cp = AjdeInteractionTestbed.getFile((String)iter.next(),"bin")+File.pathSeparator+cp; + cp = AjdeInteractionTestbed.getFile((String) iter.next(), "bin") + File.pathSeparator + cp; } } - //System.err.println("For project "+projectPath+" getClasspath() returning "+cp); + // System.err.println("For project "+projectPath+" getClasspath() returning "+cp); return cp; } @@ -91,17 +87,18 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio public Map getJavaOptionsMap() { log("ICompilerConfiguration.getJavaOptionsMap()"); - if (javaOptionsMap != null && !javaOptionsMap.isEmpty() ) return javaOptionsMap; - + if (javaOptionsMap != null && !javaOptionsMap.isEmpty()) + return javaOptionsMap; + Hashtable ht = new Hashtable(); - ht.put("org.eclipse.jdt.core.compiler.compliance","1.5"); - ht.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform","1.5"); - ht.put("org.eclipse.jdt.core.compiler.source","1.5"); - return ht; + ht.put("org.eclipse.jdt.core.compiler.compliance", "1.5"); + ht.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.5"); + ht.put("org.eclipse.jdt.core.compiler.source", "1.5"); + return ht; } public String getNonStandardOptions() { - log("ICompilerConfiguration.getNonStandardOptions( " + nonstandardoptions +")"); + log("ICompilerConfiguration.getNonStandardOptions( " + nonstandardoptions + ")"); return nonstandardoptions; } @@ -125,59 +122,88 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio public List getProjectSourceFilesChanged() { log("ICompilerConfiguration.getProjectSourceFilesChanged()"); - return null; + return modifiedFiles; } public Map getSourcePathResources() { log("ICompilerConfiguration.getSourcePathResources()"); return sourcePathResources; } - + public void log(String s) { - if (verbose) System.out.println(s); + if (verbose) + System.out.println(s); } - + public void addDependancy(String projectItDependsOn) { if (dependants == null) { dependants = new ArrayList(); } dependants.add(projectItDependsOn); } - + // -------------------- setter methods useful for testing --------------- public void setAspectPath(Set aspectPath) { this.aspectPath = aspectPath; + this.changed |= ICompilerConfiguration.ASPECTPATH_CHANGED; } public void setInpath(Set inpath) { this.inpath = inpath; + this.changed |= ICompilerConfiguration.INPATH_CHANGED; } public void setOutjar(String outjar) { this.outjar = outjar; + this.changed |= ICompilerConfiguration.OUTJAR_CHANGED; } public void setJavaOptions(Map javaOptions) { this.javaOptionsMap = javaOptions; + this.changed |= ICompilerConfiguration.JAVAOPTIONS_CHANGED; } - + public void setNonStandardOptions(String options) { this.nonstandardoptions = options; + this.changed |= ICompilerConfiguration.NONSTANDARDOPTIONS_CHANGED; } public void setProjectSourceFiles(List projectSourceFiles) { this.projectSourceFiles = projectSourceFiles; + this.changed |= ICompilerConfiguration.PROJECTSOURCEFILES_CHANGED; + } + + public void addProjectSourceFileChanged(File f) { + if (this.modifiedFiles == null) { + this.modifiedFiles = new ArrayList(); + } + if (f != null) { + modifiedFiles.add(f); + } } public void setSourcePathResources(Map sourcePathResources) { this.sourcePathResources = sourcePathResources; + this.changed |= ICompilerConfiguration.PROJECTSOURCERESOURCES_CHANGED; } - - public void setOutputLocationManager(IOutputLocationManager manager) { + + public void setOutputLocationManager(IOutputLocationManager manager) { this.outputLocationManager = manager; } - + public void setClasspath(String path) { this.classPath = path; + this.changed |= ICompilerConfiguration.CLASSPATH_CHANGED; } + + public int getConfigurationChanges() { + return changed; + // return EVERYTHING; + } + + public void configurationRead() { + changed = NO_CHANGES; + modifiedFiles = null; + } + } diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index f04d349da..b22ae0f6c 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -20,6 +20,7 @@ import java.util.Iterator; import java.util.List; import java.util.Set; +import org.aspectj.ajde.core.ICompilerConfiguration; import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory; import org.aspectj.ajdt.internal.core.builder.AjState; import org.aspectj.ajdt.internal.core.builder.IncrementalStateManager; @@ -36,45 +37,26 @@ import org.aspectj.tools.ajc.Ajc; import org.aspectj.util.FileUtil; /** - * The superclass knows all about talking through Ajde to the compiler. - * The superclass isn't in charge of knowing how to simulate overlays - * for incremental builds, that is in here. As is the ability to - * generate valid build configs based on a directory structure. To - * support this we just need access to a sandbox directory - this - * sandbox is managed by the superclass (it only assumes all builds occur - * in // ) + * The superclass knows all about talking through Ajde to the compiler. The superclass isn't in charge of knowing how to simulate + * overlays for incremental builds, that is in here. As is the ability to generate valid build configs based on a directory + * structure. To support this we just need access to a sandbox directory - this sandbox is managed by the superclass (it only + * assumes all builds occur in // ) * - * The idea is you can initialize multiple projects in the sandbox and - * they can all be built independently, hopefully exploiting - * incremental compilation. Between builds you can alter the contents - * of a project using the alter() method that overlays some set of - * new files onto the current set (adding new files/changing existing - * ones) - you can then drive a new build and check it behaves as - * expected. + * The idea is you can initialize multiple projects in the sandbox and they can all be built independently, hopefully exploiting + * incremental compilation. Between builds you can alter the contents of a project using the alter() method that overlays some set + * of new files onto the current set (adding new files/changing existing ones) - you can then drive a new build and check it behaves + * as expected. */ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed { /* - A.aj - package pack; - public aspect A { - pointcut p() : call(* C.method - before() : p() { // line 7 - } - } - - C.java - package pack; - public class C { - public void method1() { - method2(); // line 6 - } - public void method2() { } - public void method3() { - method2(); // line 13 - } - - }*/ + * A.aj package pack; public aspect A { pointcut p() : call( C.method before() : p() { // line 7 } } + * + * C.java package pack; public class C { public void method1() { method2(); // line 6 } public void method2() { } public void + * method3() { method2(); // line 13 } + * + * } + */ public void testDontLoseAdviceMarkers_pr134471() { try { // see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=false; @@ -82,45 +64,40 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa build("P4"); Ajc.dumpAJDEStructureModel("after full build where advice is applying"); // should be 4 relationship entries - + // In inc1 the first advised line is 'commented out' - alter("P4","inc1"); + alter("P4", "inc1"); build("P4"); checkWasntFullBuild(); Ajc.dumpAJDEStructureModel("after inc build where first advised line is gone"); // should now be 2 relationship entries - + // This will be the line 6 entry in C.java - IProgramElement codeElement = findCode(checkForNode("pack","C",true)); - + IProgramElement codeElement = findCode(checkForNode("pack", "C", true)); + // This will be the line 7 entry in A.java - IProgramElement advice = findAdvice(checkForNode("pack","A",true)); - + IProgramElement advice = findAdvice(checkForNode("pack", "A", true)); + IRelationshipMap asmRelMap = AsmManager.getDefault().getRelationshipMap(); - assertEquals("There should be two relationships in the relationship map", - 2,asmRelMap.getEntries().size()); - + assertEquals("There should be two relationships in the relationship map", 2, asmRelMap.getEntries().size()); + for (Iterator iter = asmRelMap.getEntries().iterator(); iter.hasNext();) { String sourceOfRelationship = (String) iter.next(); - IProgramElement ipe = AsmManager.getDefault().getHierarchy() - .findElementForHandle(sourceOfRelationship); - assertNotNull("expected to find IProgramElement with handle " - + sourceOfRelationship + " but didn't",ipe); + IProgramElement ipe = AsmManager.getDefault().getHierarchy().findElementForHandle(sourceOfRelationship); + assertNotNull("expected to find IProgramElement with handle " + sourceOfRelationship + " but didn't", ipe); if (ipe.getKind().equals(IProgramElement.Kind.ADVICE)) { - assertEquals("expected source of relationship to be " + - advice.toString() + " but found " + - ipe.toString(),advice,ipe); + assertEquals("expected source of relationship to be " + advice.toString() + " but found " + ipe.toString(), + advice, ipe); } else if (ipe.getKind().equals(IProgramElement.Kind.CODE)) { - assertEquals("expected source of relationship to be " + - codeElement.toString() + " but found " + - ipe.toString(),codeElement,ipe); + assertEquals( + "expected source of relationship to be " + codeElement.toString() + " but found " + ipe.toString(), + codeElement, ipe); } else { - fail("found unexpected relationship source " + ipe - + " with kind " + ipe.getKind()+" when looking up handle: "+sourceOfRelationship); + fail("found unexpected relationship source " + ipe + " with kind " + ipe.getKind() + + " when looking up handle: " + sourceOfRelationship); } List relationships = asmRelMap.get(ipe); - assertNotNull("expected " + ipe.getName() +" to have some " + - "relationships",relationships); + assertNotNull("expected " + ipe.getName() + " to have some " + "relationships", relationships); for (Iterator iterator = relationships.iterator(); iterator.hasNext();) { Relationship rel = (Relationship) iterator.next(); List targets = rel.getTargets(); @@ -128,43 +105,40 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa String t = (String) iterator2.next(); IProgramElement link = AsmManager.getDefault().getHierarchy().findElementForHandle(t); if (ipe.getKind().equals(IProgramElement.Kind.ADVICE)) { - assertEquals("expected target of relationship to be " + - codeElement.toString() + " but found " + - link.toString(),codeElement,link); + assertEquals("expected target of relationship to be " + codeElement.toString() + " but found " + + link.toString(), codeElement, link); } else if (ipe.getKind().equals(IProgramElement.Kind.CODE)) { - assertEquals("expected target of relationship to be " + - advice.toString() + " but found " + - link.toString(),advice,link); + assertEquals("expected target of relationship to be " + advice.toString() + " but found " + + link.toString(), advice, link); } else { - fail("found unexpected relationship source " + ipe.getName() - + " with kind " + ipe.getKind()); + fail("found unexpected relationship source " + ipe.getName() + " with kind " + ipe.getKind()); } - } + } } } - + } finally { // see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=true; - //configureBuildStructureModel(false); + // configureBuildStructureModel(false); } } - + public void testIncrementalItdsWithMultipleAspects_pr173729() { initialiseProject("PR173729"); build("PR173729"); checkWasFullBuild(); - alter("PR173729","inc1"); + alter("PR173729", "inc1"); build("PR173729"); checkWasntFullBuild(); } - + // Compile a single simple project public void testTheBasics() { initialiseProject("P1"); build("P1"); // This first build will be batch build("P1"); checkWasntFullBuild(); - checkCompileWeaveCount("P1",0,0); + checkCompileWeaveCount("P1", 0, 0); } // source code doesnt matter, we are checking invalid path handling @@ -173,74 +147,62 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa File f = new File("foo.jar"); Set s = new HashSet(); s.add(f); - configureAspectPath("P1",s); + configureAspectPath("P1", s); build("P1"); // This first build will be batch - checkForError("P1","invalid aspectpath entry"); + checkForError("P1", "invalid aspectpath entry"); } - - + /** - * 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 + * 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); - }*/ - - + /* + * 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() { + AjdeInteractionTestbed.VERBOSE = true; initialiseProject("P1"); build("P1"); // This first build will be batch - alter("P1","inc1"); // adds a single class + alter("P1", "inc1"); // adds a single class + build("P1"); + checkCompileWeaveCount("P1", 1, -1); build("P1"); - checkCompileWeaveCount("P1",1,-1); - build("P1"); - checkCompileWeaveCount("P1",0,-1); + checkCompileWeaveCount("P1", 0, -1); } - - + // Make simple changes to a project, adding a class and an aspect public void testAddingAnAspect() { initialiseProject("P1"); - build("P1"); // build 1, weave 1 - alter("P1","inc1"); // adds a class - alter("P1","inc2"); // adds an aspect - build("P1"); // build 1, + build("P1"); // build 1, weave 1 + alter("P1", "inc1"); // adds a class + alter("P1", "inc2"); // adds an aspect + build("P1"); // build 1, long timeTakenForFullBuildAndWeave = getTimeTakenForBuild("P1"); - checkWasFullBuild(); // it *will* be a full build under the new - // "back-to-the-source strategy - checkCompileWeaveCount("P1",5,3); // we compile X and A (the delta) find out that - // an aspect has changed, go back to the source - // and compile X,A,C, then weave them all. + checkWasFullBuild(); // it *will* be a full build under the new + // "back-to-the-source strategy + checkCompileWeaveCount("P1", 5, 3); // we compile X and A (the delta) find out that + // an aspect has changed, go back to the source + // and compile X,A,C, then weave them all. build("P1"); long timeTakenForSimpleIncBuild = getTimeTakenForBuild("P1"); // I don't think this test will have timing issues as the times should be *RADICALLY* different - // On my config, first build time is 2093ms and the second is 30ms - assertTrue("Should not take longer for the trivial incremental build! first="+timeTakenForFullBuildAndWeave+ - "ms second="+timeTakenForSimpleIncBuild+"ms", - timeTakenForSimpleIncBuild(C) ctor to watch out for when checking for structural changes - * + * The C.java file modified in this test has an inner class - this means the inner class has a this$0 field and (C) ctor + * to watch out for when checking for structural changes + * */ - public void testStateManagement3() { - File binDirForInterproject1 = new File(getFile("interprojectdeps1","bin")); - + public void testStateManagement3() { + File binDirForInterproject1 = new File(getFile("interprojectdeps1", "bin")); + initialiseProject("interprojectdeps1"); build("interprojectdeps1"); // full build AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(binDirForInterproject1); - assertTrue("There should be state for project P1",ajs!=null); - assertTrue("Should be no struc changes as its a full build: "+ - ajs.getNumberOfStructuralChangesSinceLastFullBuild(), - ajs.getNumberOfStructuralChangesSinceLastFullBuild()==0); - - - alter("interprojectdeps1","inc1"); // adds a space to C.java + assertTrue("There should be state for project P1", ajs != null); + assertTrue("Should be no struc changes as its a full build: " + ajs.getNumberOfStructuralChangesSinceLastFullBuild(), ajs + .getNumberOfStructuralChangesSinceLastFullBuild() == 0); + + alter("interprojectdeps1", "inc1"); // adds a space to C.java build("interprojectdeps1"); checkWasntFullBuild(); - ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("interprojectdeps1","bin"))); - assertTrue("There should be state for project interprojectdeps1",ajs!=null); + ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("interprojectdeps1", "bin"))); + assertTrue("There should be state for project interprojectdeps1", ajs != null); checkWasntFullBuild(); - assertTrue("Shouldn't be any structural changes but there were "+ - ajs.getNumberOfStructuralChangesSinceLastFullBuild(), - ajs.getNumberOfStructuralChangesSinceLastFullBuild()==0); + assertTrue("Shouldn't be any structural changes but there were " + ajs.getNumberOfStructuralChangesSinceLastFullBuild(), + ajs.getNumberOfStructuralChangesSinceLastFullBuild() == 0); } - + /** - * The C.java file modified in this test has an inner class - which has two ctors - this checks - * how they are mangled with an instance of C. - * + * The C.java file modified in this test has an inner class - which has two ctors - this checks how they are mangled with an + * instance of C. + * */ - public void testStateManagement4() { - File binDirForInterproject2 = new File(getFile("interprojectdeps2","bin")); - + public void testStateManagement4() { + File binDirForInterproject2 = new File(getFile("interprojectdeps2", "bin")); + initialiseProject("interprojectdeps2"); build("interprojectdeps2"); // full build AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(binDirForInterproject2); - assertTrue("There should be state for project interprojectdeps2",ajs!=null); - assertTrue("Should be no struc changes as its a full build: "+ - ajs.getNumberOfStructuralChangesSinceLastFullBuild(), - ajs.getNumberOfStructuralChangesSinceLastFullBuild()==0); - - - alter("interprojectdeps2","inc1"); // minor change to C.java + assertTrue("There should be state for project interprojectdeps2", ajs != null); + assertTrue("Should be no struc changes as its a full build: " + ajs.getNumberOfStructuralChangesSinceLastFullBuild(), ajs + .getNumberOfStructuralChangesSinceLastFullBuild() == 0); + + alter("interprojectdeps2", "inc1"); // minor change to C.java build("interprojectdeps2"); checkWasntFullBuild(); - ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("interprojectdeps2","bin"))); - assertTrue("There should be state for project interprojectdeps1",ajs!=null); + ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("interprojectdeps2", "bin"))); + assertTrue("There should be state for project interprojectdeps1", ajs != null); checkWasntFullBuild(); - assertTrue("Shouldn't be any structural changes but there were "+ - ajs.getNumberOfStructuralChangesSinceLastFullBuild(), - ajs.getNumberOfStructuralChangesSinceLastFullBuild()==0); + assertTrue("Shouldn't be any structural changes but there were " + ajs.getNumberOfStructuralChangesSinceLastFullBuild(), + ajs.getNumberOfStructuralChangesSinceLastFullBuild() == 0); } - + /** - * The C.java file modified in this test has an inner class - it has two ctors but - * also a reference to C.this in it - which will give rise to an accessor being - * created in C - * + * The C.java file modified in this test has an inner class - it has two ctors but also a reference to C.this in it - which will + * give rise to an accessor being created in C + * */ - public void testStateManagement5() { - File binDirForInterproject3 = new File(getFile("interprojectdeps3","bin")); - + public void testStateManagement5() { + File binDirForInterproject3 = new File(getFile("interprojectdeps3", "bin")); + initialiseProject("interprojectdeps3"); build("interprojectdeps3"); // full build AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(binDirForInterproject3); - assertTrue("There should be state for project interprojectdeps3",ajs!=null); - assertTrue("Should be no struc changes as its a full build: "+ - ajs.getNumberOfStructuralChangesSinceLastFullBuild(), - ajs.getNumberOfStructuralChangesSinceLastFullBuild()==0); - - - alter("interprojectdeps3","inc1"); // minor change to C.java + assertTrue("There should be state for project interprojectdeps3", ajs != null); + assertTrue("Should be no struc changes as its a full build: " + ajs.getNumberOfStructuralChangesSinceLastFullBuild(), ajs + .getNumberOfStructuralChangesSinceLastFullBuild() == 0); + + alter("interprojectdeps3", "inc1"); // minor change to C.java build("interprojectdeps3"); checkWasntFullBuild(); - ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("interprojectdeps3","bin"))); - assertTrue("There should be state for project interprojectdeps1",ajs!=null); + ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("interprojectdeps3", "bin"))); + assertTrue("There should be state for project interprojectdeps1", ajs != null); checkWasntFullBuild(); - assertTrue("Shouldn't be any structural changes but there were "+ - ajs.getNumberOfStructuralChangesSinceLastFullBuild(), - ajs.getNumberOfStructuralChangesSinceLastFullBuild()==0); + assertTrue("Shouldn't be any structural changes but there were " + ajs.getNumberOfStructuralChangesSinceLastFullBuild(), + ajs.getNumberOfStructuralChangesSinceLastFullBuild() == 0); } - + /** - * Now the most complex test. Create a dependancy between two projects. Building - * one may affect whether the other does an incremental or full build. The - * structural information recorded in the state object should be getting used - * to control whether a full build is necessary... + * Now the most complex test. Create a dependancy between two projects. Building one may affect whether the other does an + * incremental or full build. The structural information recorded in the state object should be getting used to control whether + * a full build is necessary... */ public void testBuildingDependantProjects() { initialiseProject("P1"); initialiseProject("P2"); - configureNewProjectDependency("P2","P1"); - + configureNewProjectDependency("P2", "P1"); + build("P1"); build("P2"); // now everything is consistent and compiled - alter("P1","inc1"); // adds a second class + alter("P1", "inc1"); // adds a second class build("P1"); build("P2"); // although a second class was added - P2 can't be using it, so we don't full build here :) checkWasntFullBuild(); - alter("P1","inc3"); // structurally changes one of the classes + alter("P1", "inc3"); // structurally changes one of the classes build("P1"); build("P2"); // build notices the structural change, but is incremental of I and J as they depend on C checkWasntFullBuild(); - alter("P1","inc4"); + alter("P1", "inc4"); build("P1"); build("P2"); // build sees a change but works out its not structural checkWasntFullBuild(); } - - + public void testPr85132() { initialiseProject("PR85132"); build("PR85132"); - alter("PR85132","inc1"); + alter("PR85132", "inc1"); build("PR85132"); } @@ -603,562 +528,521 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa public void testPr125405() { initialiseProject("PR125405"); build("PR125405"); - checkCompileWeaveCount("PR125405",1,1); - alter("PR125405","inc1"); + checkCompileWeaveCount("PR125405", 1, 1); + alter("PR125405", "inc1"); build("PR125405"); // "only abstract aspects can have type parameters" - checkForError("PR125405","only abstract aspects can have type parameters"); - alter("PR125405","inc2"); + checkForError("PR125405", "only abstract aspects can have type parameters"); + alter("PR125405", "inc2"); build("PR125405"); - checkCompileWeaveCount("PR125405",1,1); - assertTrue("Should be no errors, but got "+getErrorMessages("PR125405"), - getErrorMessages("PR125405").size()==0); + checkCompileWeaveCount("PR125405", 1, 1); + assertTrue("Should be no errors, but got " + getErrorMessages("PR125405"), getErrorMessages("PR125405").size() == 0); } - + public void testPr128618() { initialiseProject("PR128618_1"); initialiseProject("PR128618_2"); - configureNewProjectDependency("PR128618_2","PR128618_1"); - assertTrue("there should be no warning messages before we start", - getWarningMessages("PR128618_1").isEmpty()); - assertTrue("there should be no warning messages before we start", - getWarningMessages("PR128618_2").isEmpty()); - + configureNewProjectDependency("PR128618_2", "PR128618_1"); + assertTrue("there should be no warning messages before we start", getWarningMessages("PR128618_1").isEmpty()); + assertTrue("there should be no warning messages before we start", getWarningMessages("PR128618_2").isEmpty()); + build("PR128618_1"); build("PR128618_2"); List l = getWarningMessages("PR128618_2"); - + // there should be one warning against "PR128618_2" List warnings = getWarningMessages("PR128618_2"); - assertTrue("Should be one warning, but there are #"+warnings.size(),warnings.size()==1); - IMessage msg = (IMessage)(getWarningMessages("PR128618_2").get(0)); - assertEquals("warning should be against the FFDC.aj resource","FFDC.aj",msg.getSourceLocation().getSourceFile().getName()); + assertTrue("Should be one warning, but there are #" + warnings.size(), warnings.size() == 1); + IMessage msg = (IMessage) (getWarningMessages("PR128618_2").get(0)); + assertEquals("warning should be against the FFDC.aj resource", "FFDC.aj", msg.getSourceLocation().getSourceFile().getName()); - - alter("PR128618_2","inc1"); + alter("PR128618_2", "inc1"); build("PR128618_2"); - + checkWasntFullBuild(); - IMessage msg2 = (IMessage)(getWarningMessages("PR128618_2").get(0)); - assertEquals("warning should be against the FFDC.aj resource","FFDC.aj",msg2.getSourceLocation().getSourceFile().getName()); + IMessage msg2 = (IMessage) (getWarningMessages("PR128618_2").get(0)); + assertEquals("warning should be against the FFDC.aj resource", "FFDC.aj", msg2.getSourceLocation().getSourceFile() + .getName()); assertFalse("a new warning message should have been generated", msg.equals(msg2)); } - + public void testPr92837() { initialiseProject("PR92837"); build("PR92837"); - alter("PR92837","inc1"); + alter("PR92837", "inc1"); build("PR92837"); } -// See open generic itd bug mentioning 119570 -// public void testPr119570() { -// initialiseProject("PR119570"); -// build("PR119570"); -// assertNoErrors("PR119570"); -// } - -// public void testPr119570_212783_2() { -// initialiseProject("PR119570_2"); -// build("PR119570_2"); -// List l = getWarningMessages("PR119570_2"); -// assertTrue("Should be no warnings, but got "+l,l.size()==0); -// assertNoErrors("PR119570_2"); -// } -// -// public void testPr119570_212783_3() { -// initialiseProject("pr119570_3"); -// build("pr119570_3"); -// List l = getWarningMessages("pr119570_3"); -// assertTrue("Should be no warnings, but got "+l,l.size()==0); -// assertNoErrors("pr119570_3"); -// } - - + // See open generic itd bug mentioning 119570 + // public void testPr119570() { + // initialiseProject("PR119570"); + // build("PR119570"); + // assertNoErrors("PR119570"); + // } + + // public void testPr119570_212783_2() { + // initialiseProject("PR119570_2"); + // build("PR119570_2"); + // List l = getWarningMessages("PR119570_2"); + // assertTrue("Should be no warnings, but got "+l,l.size()==0); + // assertNoErrors("PR119570_2"); + // } + // + // public void testPr119570_212783_3() { + // initialiseProject("pr119570_3"); + // build("pr119570_3"); + // List l = getWarningMessages("pr119570_3"); + // assertTrue("Should be no warnings, but got "+l,l.size()==0); + // assertNoErrors("pr119570_3"); + // } + // If you fiddle with the compiler options - you must manually reset the options at the end of the test public void testPr117209() { try { initialiseProject("pr117209"); - configureNonStandardCompileOptions("pr117209","-proceedOnError"); + configureNonStandardCompileOptions("pr117209", "-proceedOnError"); build("pr117209"); - checkCompileWeaveCount("pr117209",6,5); + checkCompileWeaveCount("pr117209", 6, 5); } finally { - //MyBuildOptionsAdapter.reset(); + // MyBuildOptionsAdapter.reset(); } } - + public void testPr114875() { // temporary problem with this on linux, think it is a filesystem lastmodtime issue - if (System.getProperty("os.name","").toLowerCase().equals("linux")) return; + if (System.getProperty("os.name", "").toLowerCase().equals("linux")) + return; initialiseProject("pr114875"); build("pr114875"); - alter("pr114875","inc1"); + alter("pr114875", "inc1"); build("pr114875"); checkWasFullBuild(); - alter("pr114875","inc2"); + alter("pr114875", "inc2"); build("pr114875"); - checkWasFullBuild(); // back to the source for an aspect change + checkWasFullBuild(); // back to the source for an aspect change } - + public void testPr117882() { -// AjdeInteractionTestbed.VERBOSE=true; -// AjdeInteractionTestbed.configureBuildStructureModel(true); + // AjdeInteractionTestbed.VERBOSE=true; + // AjdeInteractionTestbed.configureBuildStructureModel(true); initialiseProject("PR117882"); build("PR117882"); checkWasFullBuild(); - alter("PR117882","inc1"); + alter("PR117882", "inc1"); build("PR117882"); - checkWasFullBuild(); // back to the source for an aspect -// AjdeInteractionTestbed.VERBOSE=false; -// AjdeInteractionTestbed.configureBuildStructureModel(false); + checkWasFullBuild(); // back to the source for an aspect + // AjdeInteractionTestbed.VERBOSE=false; + // AjdeInteractionTestbed.configureBuildStructureModel(false); } - + public void testPr117882_2() { -// AjdeInteractionTestbed.VERBOSE=true; -// AjdeInteractionTestbed.configureBuildStructureModel(true); + // AjdeInteractionTestbed.VERBOSE=true; + // AjdeInteractionTestbed.configureBuildStructureModel(true); initialiseProject("PR117882_2"); build("PR117882_2"); checkWasFullBuild(); - alter("PR117882_2","inc1"); + alter("PR117882_2", "inc1"); build("PR117882_2"); - checkWasFullBuild(); // back to the source... - //checkCompileWeaveCount(1,4); - //fullBuild("PR117882_2"); - //checkWasFullBuild(); -// AjdeInteractionTestbed.VERBOSE=false; -// AjdeInteractionTestbed.configureBuildStructureModel(false); - } - + checkWasFullBuild(); // back to the source... + // checkCompileWeaveCount(1,4); + // fullBuild("PR117882_2"); + // checkWasFullBuild(); + // AjdeInteractionTestbed.VERBOSE=false; + // AjdeInteractionTestbed.configureBuildStructureModel(false); + } + public void testPr115251() { - //AjdeInteractionTestbed.VERBOSE=true; + // AjdeInteractionTestbed.VERBOSE=true; initialiseProject("PR115251"); build("PR115251"); checkWasFullBuild(); - alter("PR115251","inc1"); + alter("PR115251", "inc1"); build("PR115251"); - checkWasFullBuild(); // back to the source + checkWasFullBuild(); // back to the source } - public void testPr220255_InfiniteBuildHasMember() { - AjdeInteractionTestbed.VERBOSE=true; + AjdeInteractionTestbed.VERBOSE = true; initialiseProject("pr220255"); - configureNonStandardCompileOptions("pr220255","-XhasMember"); + configureNonStandardCompileOptions("pr220255", "-XhasMember"); build("pr220255"); checkWasFullBuild(); - alter("pr220255","inc1"); + alter("pr220255", "inc1"); build("pr220255"); - checkWasntFullBuild(); + checkWasntFullBuild(); } public void testPr157054() { initialiseProject("PR157054"); - configureNonStandardCompileOptions("PR157054","-showWeaveInfo"); - configureShowWeaveInfoMessages("PR157054",true); + configureNonStandardCompileOptions("PR157054", "-showWeaveInfo"); + configureShowWeaveInfoMessages("PR157054", true); build("PR157054"); checkWasFullBuild(); List weaveMessages = getWeavingMessages("PR157054"); - assertTrue("Should be two weaving messages but there are "+weaveMessages.size(),weaveMessages.size()==2); - alter("PR157054","inc1"); + assertTrue("Should be two weaving messages but there are " + weaveMessages.size(), weaveMessages.size() == 2); + alter("PR157054", "inc1"); build("PR157054"); weaveMessages = getWeavingMessages("PR157054"); - assertTrue("Should be three weaving messages but there are "+weaveMessages.size(),weaveMessages.size()==3); + assertTrue("Should be three weaving messages but there are " + weaveMessages.size(), weaveMessages.size() == 3); checkWasntFullBuild(); fullBuild("PR157054"); weaveMessages = getWeavingMessages("PR157054"); - assertTrue("Should be three weaving messages but there are "+weaveMessages.size(),weaveMessages.size()==3); + assertTrue("Should be three weaving messages but there are " + weaveMessages.size(), weaveMessages.size() == 3); } - - /** - * Checks we aren't leaking mungers across compiles (accumulating multiple instances of the same one that - * all do the same thing). On the first compile the munger is added late on - so at the time we set - * the count it is still zero. On the subsequent compiles we know about this extra one. + * Checks we aren't leaking mungers across compiles (accumulating multiple instances of the same one that all do the same + * thing). On the first compile the munger is added late on - so at the time we set the count it is still zero. On the + * subsequent compiles we know about this extra one. */ public void testPr141956_IncrementallyCompilingAtAj() { initialiseProject("PR141956"); build("PR141956"); - assertTrue("Should be zero but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==0); - alter("PR141956","inc1"); + assertTrue("Should be zero but reports " + EclipseFactory.debug_mungerCount, EclipseFactory.debug_mungerCount == 0); + alter("PR141956", "inc1"); build("PR141956"); - assertTrue("Should be two but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==2); - alter("PR141956","inc1"); + assertTrue("Should be two but reports " + EclipseFactory.debug_mungerCount, EclipseFactory.debug_mungerCount == 2); + alter("PR141956", "inc1"); build("PR141956"); - assertTrue("Should be two but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==2); - alter("PR141956","inc1"); + assertTrue("Should be two but reports " + EclipseFactory.debug_mungerCount, EclipseFactory.debug_mungerCount == 2); + alter("PR141956", "inc1"); build("PR141956"); - assertTrue("Should be two but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==2); - alter("PR141956","inc1"); + assertTrue("Should be two but reports " + EclipseFactory.debug_mungerCount, EclipseFactory.debug_mungerCount == 2); + alter("PR141956", "inc1"); build("PR141956"); - assertTrue("Should be two but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==2); - } - - -// public void testPr124399() { -// AjdeInteractionTestbed.VERBOSE=true; -// configureBuildStructureModel(true); -// initialiseProject("PR124399"); -// build("PR124399"); -// checkWasFullBuild(); -// alter("PR124399","inc1"); -// build("PR124399"); -// checkWasntFullBuild(); -// } - + assertTrue("Should be two but reports " + EclipseFactory.debug_mungerCount, EclipseFactory.debug_mungerCount == 2); + } + + // public void testPr124399() { + // AjdeInteractionTestbed.VERBOSE=true; + // configureBuildStructureModel(true); + // initialiseProject("PR124399"); + // build("PR124399"); + // checkWasFullBuild(); + // alter("PR124399","inc1"); + // build("PR124399"); + // checkWasntFullBuild(); + // } + public void testPr121384() { -// AjdeInteractionTestbed.VERBOSE=true; -// AsmManager.setReporting("c:/foo.txt",true,true,true,false); + // AjdeInteractionTestbed.VERBOSE=true; + // AsmManager.setReporting("c:/foo.txt",true,true,true,false); initialiseProject("pr121384"); - configureNonStandardCompileOptions("pr121384","-showWeaveInfo"); - build("pr121384"); + configureNonStandardCompileOptions("pr121384", "-showWeaveInfo"); + build("pr121384"); checkWasFullBuild(); - alter("pr121384","inc1"); + alter("pr121384", "inc1"); build("pr121384"); checkWasntFullBuild(); } - -/* public void testPr111779() { - super.VERBOSE=true; - initialiseProject("PR111779"); - build("PR111779"); - alter("PR111779","inc1"); - build("PR111779"); - } -*/ + /* + * public void testPr111779() { super.VERBOSE=true; initialiseProject("PR111779"); build("PR111779"); alter("PR111779","inc1"); + * build("PR111779"); } + */ public void testPr93310_1() { initialiseProject("PR93310_1"); build("PR93310_1"); checkWasFullBuild(); - String fileC2 = getWorkingDir().getAbsolutePath() + File.separatorChar + "PR93310_1" + File.separatorChar + "src" + File.separatorChar + "pack" + File.separatorChar + "C2.java"; + String fileC2 = getWorkingDir().getAbsolutePath() + File.separatorChar + "PR93310_1" + File.separatorChar + "src" + + File.separatorChar + "pack" + File.separatorChar + "C2.java"; (new File(fileC2)).delete(); - alter("PR93310_1","inc1"); + alter("PR93310_1", "inc1"); build("PR93310_1"); checkWasFullBuild(); - int l = AjdeInteractionTestbed.MyStateListener.detectedDeletions.size(); - assertTrue("Expected one deleted file to be noticed, but detected: "+l,l==1); - String name = (String)AjdeInteractionTestbed.MyStateListener.detectedDeletions.get(0); - assertTrue("Should end with C2.java but is "+name,name.endsWith("C2.java")); + int l = AjdeInteractionTestbed.MyStateListener.detectedDeletions.size(); + assertTrue("Expected one deleted file to be noticed, but detected: " + l, l == 1); + String name = (String) AjdeInteractionTestbed.MyStateListener.detectedDeletions.get(0); + assertTrue("Should end with C2.java but is " + name, name.endsWith("C2.java")); } - + public void testPr93310_2() { initialiseProject("PR93310_2"); build("PR93310_2"); checkWasFullBuild(); - String fileC2 = getWorkingDir().getAbsolutePath() + File.separatorChar + "PR93310_2" + File.separatorChar + "src" + File.separatorChar + "pack" + File.separatorChar + "C2.java"; + String fileC2 = getWorkingDir().getAbsolutePath() + File.separatorChar + "PR93310_2" + File.separatorChar + "src" + + File.separatorChar + "pack" + File.separatorChar + "C2.java"; (new File(fileC2)).delete(); - alter("PR93310_2","inc1"); + alter("PR93310_2", "inc1"); build("PR93310_2"); checkWasFullBuild(); - int l = AjdeInteractionTestbed.MyStateListener.detectedDeletions.size(); - assertTrue("Expected one deleted file to be noticed, but detected: "+l,l==1); - String name = (String)AjdeInteractionTestbed.MyStateListener.detectedDeletions.get(0); - assertTrue("Should end with C2.java but is "+name,name.endsWith("C2.java")); + int l = AjdeInteractionTestbed.MyStateListener.detectedDeletions.size(); + assertTrue("Expected one deleted file to be noticed, but detected: " + l, l == 1); + String name = (String) AjdeInteractionTestbed.MyStateListener.detectedDeletions.get(0); + assertTrue("Should end with C2.java but is " + name, name.endsWith("C2.java")); } - - // Stage1: Compile two files, pack.A and pack.A1 - A1 sets a protected field in A. + + // Stage1: Compile two files, pack.A and pack.A1 - A1 sets a protected field in A. // Stage2: make the field private in class A > gives compile error // Stage3: Add a new aspect whilst there is a compile error ! public void testPr113531() { initialiseProject("PR113531"); build("PR113531"); - assertTrue("build should have compiled ok", - getErrorMessages("PR113531").isEmpty()); - alter("PR113531","inc1"); + assertTrue("build should have compiled ok", getErrorMessages("PR113531").isEmpty()); + alter("PR113531", "inc1"); build("PR113531"); - assertEquals("error message should be 'foo cannot be resolved' ", - "foo cannot be resolved", - ((IMessage)getErrorMessages("PR113531").get(0)) - .getMessage()); - alter("PR113531","inc2"); + assertEquals("error message should be 'foo cannot be resolved' ", "foo cannot be resolved", ((IMessage) getErrorMessages( + "PR113531").get(0)).getMessage()); + alter("PR113531", "inc2"); build("PR113531"); - assertTrue("There should be no exceptions handled:\n" - +getCompilerErrorMessages("PR113531"), - getCompilerErrorMessages("PR113531").isEmpty()); - assertEquals("error message should be 'foo cannot be resolved' ", - "foo cannot be resolved", - ((IMessage)getErrorMessages("PR113531").get(0)) - .getMessage()); + assertTrue("There should be no exceptions handled:\n" + getCompilerErrorMessages("PR113531"), getCompilerErrorMessages( + "PR113531").isEmpty()); + assertEquals("error message should be 'foo cannot be resolved' ", "foo cannot be resolved", ((IMessage) getErrorMessages( + "PR113531").get(0)).getMessage()); } // Stage 1: Compile the 4 files, pack.A2 extends pack.A1 (aspects) where - // A2 uses a protected field in A1 and pack.C2 extends pack.C1 (classes) - // where C2 uses a protected field in C1 + // A2 uses a protected field in A1 and pack.C2 extends pack.C1 (classes) + // where C2 uses a protected field in C1 // Stage 2: make the field private in class C1 ==> compile errors in C2 // Stage 3: make the field private in aspect A1 whilst there's the compile - // error. + // error. // There shouldn't be a BCExcpetion saying can't find delegate for pack.C2 public void testPr119882() { initialiseProject("PR119882"); build("PR119882"); - assertTrue("build should have compiled ok",getErrorMessages("PR119882").isEmpty()); - alter("PR119882","inc1"); + assertTrue("build should have compiled ok", getErrorMessages("PR119882").isEmpty()); + alter("PR119882", "inc1"); build("PR119882"); - //fullBuild("PR119882"); + // fullBuild("PR119882"); List errors = getErrorMessages("PR119882"); - assertTrue("Should be at least one error, but got none",errors.size()==1); - assertEquals("error message should be 'i cannot be resolved' ", - "i cannot be resolved", - ((IMessage)errors.get(0)) - .getMessage()); - alter("PR119882","inc2"); + assertTrue("Should be at least one error, but got none", errors.size() == 1); + assertEquals("error message should be 'i cannot be resolved' ", "i cannot be resolved", ((IMessage) errors.get(0)) + .getMessage()); + alter("PR119882", "inc2"); build("PR119882"); - assertTrue("There should be no exceptions handled:\n" - +getCompilerErrorMessages("PR119882"), - getCompilerErrorMessages("PR119882").isEmpty()); - assertEquals("error message should be 'i cannot be resolved' ", - "i cannot be resolved", - ((IMessage)errors.get(0)) - .getMessage()); + assertTrue("There should be no exceptions handled:\n" + getCompilerErrorMessages("PR119882"), getCompilerErrorMessages( + "PR119882").isEmpty()); + assertEquals("error message should be 'i cannot be resolved' ", "i cannot be resolved", ((IMessage) errors.get(0)) + .getMessage()); } - + public void testPr112736() { initialiseProject("PR112736"); build("PR112736"); checkWasFullBuild(); - String fileC2 = getWorkingDir().getAbsolutePath() + File.separatorChar + "PR112736" + File.separatorChar + "src" + File.separatorChar + "pack" + File.separatorChar + "A.java"; + String fileC2 = getWorkingDir().getAbsolutePath() + File.separatorChar + "PR112736" + File.separatorChar + "src" + + File.separatorChar + "pack" + File.separatorChar + "A.java"; (new File(fileC2)).delete(); - alter("PR112736","inc1"); + alter("PR112736", "inc1"); build("PR112736"); checkWasFullBuild(); } - + /** * We have problems with multiple rewrites of a pointcut across incremental builds. */ public void testPr113257() { initialiseProject("PR113257"); build("PR113257"); - alter("PR113257","inc1"); + alter("PR113257", "inc1"); build("PR113257"); - checkWasFullBuild(); // back to the source - alter("PR113257","inc1"); + checkWasFullBuild(); // back to the source + alter("PR113257", "inc1"); build("PR113257"); } public void testPr123612() { initialiseProject("PR123612"); build("PR123612"); - alter("PR123612","inc1"); + alter("PR123612", "inc1"); build("PR123612"); checkWasFullBuild(); // back to the source } - - //Bugzilla Bug 152257 - Incremental compiler doesn't handle exception declaration correctly + + // Bugzilla Bug 152257 - Incremental compiler doesn't handle exception declaration correctly public void testPr152257() { initialiseProject("PR152257"); - configureNonStandardCompileOptions("PR152257","-XnoInline"); + configureNonStandardCompileOptions("PR152257", "-XnoInline"); build("PR152257"); List errors = getErrorMessages("PR152257"); - assertTrue("Should be no warnings, but there are #"+errors.size(),errors.size()==0); + assertTrue("Should be no warnings, but there are #" + errors.size(), errors.size() == 0); checkWasFullBuild(); - alter("PR152257","inc1"); + alter("PR152257", "inc1"); build("PR152257"); errors = getErrorMessages("PR152257"); - assertTrue("Should be no warnings, but there are #"+errors.size(),errors.size()==0); + assertTrue("Should be no warnings, but there are #" + errors.size(), errors.size() == 0); checkWasntFullBuild(); } - public void testPr128655() { initialiseProject("pr128655"); - configureNonStandardCompileOptions("pr128655","-showWeaveInfo"); - configureShowWeaveInfoMessages("pr128655",true); + configureNonStandardCompileOptions("pr128655", "-showWeaveInfo"); + configureShowWeaveInfoMessages("pr128655", true); build("pr128655"); List firstBuildMessages = getWeavingMessages("pr128655"); - assertTrue("Should be at least one message about the dec @type, but there were none",firstBuildMessages.size()>0); - alter("pr128655","inc1"); + assertTrue("Should be at least one message about the dec @type, but there were none", firstBuildMessages.size() > 0); + alter("pr128655", "inc1"); build("pr128655"); checkWasntFullBuild(); // back to the source List secondBuildMessages = getWeavingMessages("pr128655"); // check they are the same for (int i = 0; i < firstBuildMessages.size(); i++) { - IMessage m1 = (IMessage)firstBuildMessages.get(i); - IMessage m2 = (IMessage)secondBuildMessages.get(i); + IMessage m1 = (IMessage) firstBuildMessages.get(i); + IMessage m2 = (IMessage) secondBuildMessages.get(i); if (!m1.toString().equals(m2.toString())) { - System.err.println("Message during first build was: "+m1); - System.err.println("Message during second build was: "+m1); - fail("The two messages should be the same, but are not: \n"+m1+"!="+m2); + System.err.println("Message during first build was: " + m1); + System.err.println("Message during second build was: " + m1); + fail("The two messages should be the same, but are not: \n" + m1 + "!=" + m2); } } } - + // Similar to above, but now the annotation is in the default package public void testPr128655_2() { initialiseProject("pr128655_2"); - configureNonStandardCompileOptions("pr128655_2","-showWeaveInfo"); + configureNonStandardCompileOptions("pr128655_2", "-showWeaveInfo"); configureShowWeaveInfoMessages("pr128655_2", true); build("pr128655_2"); List firstBuildMessages = getWeavingMessages("pr128655_2"); - assertTrue("Should be at least one message about the dec @type, but there were none",firstBuildMessages.size()>0); - alter("pr128655_2","inc1"); + assertTrue("Should be at least one message about the dec @type, but there were none", firstBuildMessages.size() > 0); + alter("pr128655_2", "inc1"); build("pr128655_2"); checkWasntFullBuild(); // back to the source List secondBuildMessages = getWeavingMessages("pr128655_2"); // check they are the same for (int i = 0; i < firstBuildMessages.size(); i++) { - IMessage m1 = (IMessage)firstBuildMessages.get(i); - IMessage m2 = (IMessage)secondBuildMessages.get(i); + IMessage m1 = (IMessage) firstBuildMessages.get(i); + IMessage m2 = (IMessage) secondBuildMessages.get(i); if (!m1.toString().equals(m2.toString())) { - System.err.println("Message during first build was: "+m1); - System.err.println("Message during second build was: "+m1); - fail("The two messages should be the same, but are not: \n"+m1+"!="+m2); + System.err.println("Message during first build was: " + m1); + System.err.println("Message during second build was: " + m1); + fail("The two messages should be the same, but are not: \n" + m1 + "!=" + m2); } } } - + // test for comment #31 - NPE public void testPr129163() { initialiseProject("PR129613"); build("PR129613"); - alter("PR129613","inc1"); + alter("PR129613", "inc1"); build("PR129613"); - assertTrue("There should be no exceptions handled:\n"+getCompilerErrorMessages("PR129613"), - getCompilerErrorMessages("PR129613").isEmpty()); + assertTrue("There should be no exceptions handled:\n" + getCompilerErrorMessages("PR129613"), getCompilerErrorMessages( + "PR129613").isEmpty()); assertEquals("warning message should be 'no match for this type name: File [Xlint:invalidAbsoluteTypeName]' ", - "no match for this type name: File [Xlint:invalidAbsoluteTypeName]", - ((IMessage)getWarningMessages("PR129613").get(0)) - .getMessage()); + "no match for this type name: File [Xlint:invalidAbsoluteTypeName]", ((IMessage) getWarningMessages("PR129613") + .get(0)).getMessage()); } - + // test for comment #0 - adding a comment to a class file shouldn't // cause us to go back to source and recompile everything. To force this // to behave like AJDT we need to include the aspect in 'inc1' so that - // when AjState looks at its timestamp it thinks the aspect has been modified. - // The logic within CrosscuttingMembers should then work out correctly - // that there haven't really been any changes within the aspect and so + // when AjState looks at its timestamp it thinks the aspect has been modified. + // The logic within CrosscuttingMembers should then work out correctly + // that there haven't really been any changes within the aspect and so // we shouldn't go back to source. public void testPr129163_2() { // want to behave like AJDT initialiseProject("pr129163_2"); build("pr129163_2"); checkWasFullBuild(); - alter("pr129163_2","inc1"); + alter("pr129163_2", "inc1"); build("pr129163_2"); - checkWasntFullBuild(); // shouldn't be a full build because the - // aspect hasn't changed + checkWasntFullBuild(); // shouldn't be a full build because the + // aspect hasn't changed } - + public void testIncrementalIntelligence_Scenario01() { - AjdeInteractionTestbed.VERBOSE=true; - initialiseProject("Project1"); - initialiseProject("Project2"); - configureNewProjectDependency("Project2", "Project1"); - build("Project1"); - build("Project2"); - - alter("Project1", "inc1"); // white space change to ClassA - no impact - build("Project1"); - build("Project2"); - checkWasntFullBuild(); // not a structural change so ignored - - alter("Project1", "inc2"); // structural change to ClassB - new method! - build("Project1"); - build("Project2"); - checkWasntFullBuild(); // not a type that Project2 depends on so ignored - - alter("Project1", "inc3"); // structural change to ClassA - build("Project1"); - build("Project2"); - checkWasntFullBuild(); // Just need to recompile ClassAExtender - checkCompileWeaveCount("Project2", 1, 1); - checkCompiled("Project2", "ClassAExtender"); - - alter("Project2", "inc1"); // New type that depends on ClassAExtender - build("Project1"); - build("Project2"); - checkWasntFullBuild(); // Just build ClassAExtenderExtender - - alter("Project1", "inc4"); // another structural change to ClassA - build("Project1"); - build("Project2"); - checkWasntFullBuild(); // Should rebuild ClassAExtender and ClassAExtenderExtender - checkCompileWeaveCount("Project2", 2, 2); - checkCompiled("Project2", "ClassAExtenderExtender"); - - - } - + AjdeInteractionTestbed.VERBOSE = true; + initialiseProject("Project1"); + initialiseProject("Project2"); + configureNewProjectDependency("Project2", "Project1"); + build("Project1"); + build("Project2"); + + alter("Project1", "inc1"); // white space change to ClassA - no impact + build("Project1"); + build("Project2"); + checkWasntFullBuild(); // not a structural change so ignored + + alter("Project1", "inc2"); // structural change to ClassB - new method! + build("Project1"); + build("Project2"); + checkWasntFullBuild(); // not a type that Project2 depends on so ignored + + alter("Project1", "inc3"); // structural change to ClassA + build("Project1"); + setNextChangeResponse("Project2", ICompilerConfiguration.EVERYTHING); // See pr245566 comment 3 + build("Project2"); + checkWasntFullBuild(); // Just need to recompile ClassAExtender + checkCompileWeaveCount("Project2", 1, 1); + checkCompiled("Project2", "ClassAExtender"); + + alter("Project2", "inc1"); // New type that depends on ClassAExtender + build("Project1"); + build("Project2"); + checkWasntFullBuild(); // Just build ClassAExtenderExtender + + alter("Project1", "inc4"); // another structural change to ClassA + build("Project1"); + setNextChangeResponse("Project2", ICompilerConfiguration.EVERYTHING); // See pr245566 comment 3 + build("Project2"); + checkWasntFullBuild(); // Should rebuild ClassAExtender and ClassAExtenderExtender + checkCompileWeaveCount("Project2", 2, 2); + checkCompiled("Project2", "ClassAExtenderExtender"); + + } + private void checkCompiled(String projectName, String typeNameSubstring) { - List files = getCompiledFiles(projectName); - boolean found = false; - for (Iterator iterator = files.iterator(); iterator.hasNext();) { - String object = (String) iterator.next(); - if (object.indexOf(typeNameSubstring) != -1) - found = true; - } - assertTrue("Did not find '" + typeNameSubstring + "' in list of compiled files", found); - } - - // Case001: renaming a private field in a type -/* public void testPrReducingDependentBuilds_001_221427() { - AjdeInteractionTestbed.VERBOSE=true; - IncrementalStateManager.debugIncrementalStates=true; - initialiseProject("P221427_1"); - initialiseProject("P221427_2"); - configureNewProjectDependency("P221427_2","P221427_1"); - - build("P221427_1"); - build("P221427_2"); - alter("P221427_1","inc1"); // rename private class in super project - MyStateListener.reset(); - build("P221427_1"); - build("P221427_2"); - - AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("P221427_1","bin"))); - assertTrue("There should be state for project P221427_1",ajs!=null); - //System.out.println(MyStateListener.getInstance().getDecisions()); - checkWasntFullBuild(); - assertTrue("Should be one structural change but there were "+ - ajs.getNumberOfStructuralChangesSinceLastFullBuild(), - ajs.getNumberOfStructuralChangesSinceLastFullBuild()==1); - - } - - // Case002: changing a class to final that is extended in a dependent project - public void testPrReducingDependentBuilds_002_221427() { - AjdeInteractionTestbed.VERBOSE=true; - IncrementalStateManager.debugIncrementalStates=true; - initialiseProject("P221427_3"); - initialiseProject("P221427_4"); - configureNewProjectDependency("P221427_4","P221427_3"); - - build("P221427_3"); - build("P221427_4"); // build OK, type in super project is non-final - alter("P221427_3","inc1"); // change class declaration in super-project to final - MyStateListener.reset(); - build("P221427_3"); - build("P221427_4"); // build FAIL, type in super project is now final - - AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("P221427_3","bin"))); - assertTrue("There should be state for project P221427_3",ajs!=null); - System.out.println(MyStateListener.getInstance().getDecisions()); - - List errors = getErrorMessages("P221427_4"); - if (errors.size()!=1) { - if (errors.size()==0) fail("Expected error about not being able to extend final class"); - for (Iterator iterator = errors.iterator(); iterator.hasNext();) { - Object object = (Object) iterator.next(); - System.out.println(object); - } - fail("Expected 1 error but got "+errors.size()); + List files = getCompiledFiles(projectName); + boolean found = false; + for (Iterator iterator = files.iterator(); iterator.hasNext();) { + String object = (String) iterator.next(); + if (object.indexOf(typeNameSubstring) != -1) + found = true; } -// assertTrue("Shouldn't be one structural change but there were "+ -// ajs.getNumberOfStructuralChangesSinceLastFullBuild(), -// ajs.getNumberOfStructuralChangesSinceLastFullBuild()==1); - - }*/ + assertTrue("Did not find '" + typeNameSubstring + "' in list of compiled files", found); + } + + // Case001: renaming a private field in a type + /* + * public void testPrReducingDependentBuilds_001_221427() { AjdeInteractionTestbed.VERBOSE=true; + * IncrementalStateManager.debugIncrementalStates=true; initialiseProject("P221427_1"); initialiseProject("P221427_2"); + * configureNewProjectDependency("P221427_2","P221427_1"); + * + * build("P221427_1"); build("P221427_2"); alter("P221427_1","inc1"); // rename private class in super project + * MyStateListener.reset(); build("P221427_1"); build("P221427_2"); + * + * AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("P221427_1","bin"))); + * assertTrue("There should be state for project P221427_1",ajs!=null); + * //System.out.println(MyStateListener.getInstance().getDecisions()); checkWasntFullBuild(); + * assertTrue("Should be one structural change but there were "+ ajs.getNumberOfStructuralChangesSinceLastFullBuild(), + * ajs.getNumberOfStructuralChangesSinceLastFullBuild()==1); + * + * } + * + * // Case002: changing a class to final that is extended in a dependent project public void + * testPrReducingDependentBuilds_002_221427() { AjdeInteractionTestbed.VERBOSE=true; + * IncrementalStateManager.debugIncrementalStates=true; initialiseProject("P221427_3"); initialiseProject("P221427_4"); + * configureNewProjectDependency("P221427_4","P221427_3"); + * + * build("P221427_3"); build("P221427_4"); // build OK, type in super project is non-final alter("P221427_3","inc1"); // change + * class declaration in super-project to final MyStateListener.reset(); build("P221427_3"); build("P221427_4"); // build FAIL, + * type in super project is now final + * + * AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("P221427_3","bin"))); + * assertTrue("There should be state for project P221427_3",ajs!=null); + * System.out.println(MyStateListener.getInstance().getDecisions()); + * + * List errors = getErrorMessages("P221427_4"); if (errors.size()!=1) { if (errors.size()==0) + * fail("Expected error about not being able to extend final class"); for (Iterator iterator = errors.iterator(); + * iterator.hasNext();) { Object object = (Object) iterator.next(); System.out.println(object); } + * fail("Expected 1 error but got "+errors.size()); } // assertTrue("Shouldn't be one structural change but there were "+ // + * ajs.getNumberOfStructuralChangesSinceLastFullBuild(), // ajs.getNumberOfStructuralChangesSinceLastFullBuild()==1); + * + * } + */ // test for comment #6 - simulates AJDT core builder test testBug99133a - - // changing the contents of a method within a class shouldn't force a + // changing the contents of a method within a class shouldn't force a // full build of a dependant project. To force this to behave like AJDT // 'inc1' of the dependant project should just be a copy of 'base' so that - // AjState thinks somethings changed within the dependant project and - // we do a build. Similarly, 'inc1' of the project depended on should + // AjState thinks somethings changed within the dependant project and + // we do a build. Similarly, 'inc1' of the project depended on should // include the aspect even though nothing's changed within it. This causes - // AjState to think that the aspect has changed. Together its then up to + // AjState to think that the aspect has changed. Together its then up to // logic within CrosscuttingMembers and various equals methods to decide // correctly that we don't have to go back to source. public void testPr129163_3() { @@ -1166,32 +1050,30 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa build("PR129163_4"); checkWasFullBuild(); // should be a full build because initializing project initialiseProject("PR129163_3"); - configureNewProjectDependency("PR129163_3","PR129163_4"); + configureNewProjectDependency("PR129163_3", "PR129163_4"); build("PR129163_3"); checkWasFullBuild(); // should be a full build because initializing project - alter("PR129163_4","inc1"); + alter("PR129163_4", "inc1"); build("PR129163_4"); checkWasntFullBuild(); // should be an incremental build because although - // "inc1" includes the aspect A1.aj, it actually hasn't - // changed so we shouldn't go back to source - alter("PR129163_3","inc1"); + // "inc1" includes the aspect A1.aj, it actually hasn't + // changed so we shouldn't go back to source + alter("PR129163_3", "inc1"); build("PR129163_3"); checkWasntFullBuild(); // should be an incremental build because nothing has - // changed within the class and no aspects have changed - // within the running of the test + // changed within the class and no aspects have changed + // within the running of the test } - public void testPr133117() { -// System.gc(); -// System.exit(); + // System.gc(); + // System.exit(); initialiseProject("PR133117"); - configureNonStandardCompileOptions("PR133117","-Xlint:warning"); + configureNonStandardCompileOptions("PR133117", "-Xlint:warning"); build("PR133117"); - assertTrue("There should only be one xlint warning message reported:\n" - +getWarningMessages("PR133117"), - getWarningMessages("PR133117").size()==1); - alter("PR133117","inc1"); + assertTrue("There should only be one xlint warning message reported:\n" + getWarningMessages("PR133117"), + getWarningMessages("PR133117").size() == 1); + alter("PR133117", "inc1"); build("PR133117"); List warnings = getWarningMessages("PR133117"); List noGuardWarnings = new ArrayList(); @@ -1201,116 +1083,112 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa noGuardWarnings.add(element); } } - assertTrue("There should only be two Xlint:noGuardForLazyTjp warning message reported:\n" - +noGuardWarnings,noGuardWarnings.size() == 2); + assertTrue("There should only be two Xlint:noGuardForLazyTjp warning message reported:\n" + noGuardWarnings, + noGuardWarnings.size() == 2); } - + public void testPr131505() { initialiseProject("PR131505"); - configureNonStandardCompileOptions("PR131505","-outxml"); + configureNonStandardCompileOptions("PR131505", "-outxml"); build("PR131505"); checkWasFullBuild(); - String outputDir = getWorkingDir().getAbsolutePath() + File.separatorChar - + "PR131505" + File.separatorChar + "bin"; + String outputDir = getWorkingDir().getAbsolutePath() + File.separatorChar + "PR131505" + File.separatorChar + "bin"; // aop.xml file shouldn't contain any aspects - checkXMLAspectCount("PR131505","",0, outputDir); + checkXMLAspectCount("PR131505", "", 0, outputDir); // add a new aspect A which should be included in the aop.xml file - alter("PR131505","inc1"); + alter("PR131505", "inc1"); build("PR131505"); checkWasFullBuild(); - checkXMLAspectCount("PR131505","",1, outputDir); - checkXMLAspectCount("PR131505","A",1, outputDir); + checkXMLAspectCount("PR131505", "", 1, outputDir); + checkXMLAspectCount("PR131505", "A", 1, outputDir); // make changes to the class file which shouldn't affect the contents // of the aop.xml file - alter("PR131505","inc2"); + alter("PR131505", "inc2"); build("PR131505"); checkWasntFullBuild(); - checkXMLAspectCount("PR131505","",1, outputDir); - checkXMLAspectCount("PR131505","A",1, outputDir); + checkXMLAspectCount("PR131505", "", 1, outputDir); + checkXMLAspectCount("PR131505", "A", 1, outputDir); // add another new aspect A1 which should also be included in the aop.xml file // ...there should be no duplicate entries in the file - alter("PR131505","inc3"); + alter("PR131505", "inc3"); build("PR131505"); checkWasFullBuild(); - checkXMLAspectCount("PR131505","",2, outputDir); - checkXMLAspectCount("PR131505","A1",1, outputDir); - checkXMLAspectCount("PR131505","A",1, outputDir); + checkXMLAspectCount("PR131505", "", 2, outputDir); + checkXMLAspectCount("PR131505", "A1", 1, outputDir); + checkXMLAspectCount("PR131505", "A", 1, outputDir); // delete aspect A1 which meanss that aop.xml file should only contain A - File a1 = new File(getWorkingDir().getAbsolutePath() - + File.separatorChar + "PR131505" + File.separatorChar + "A1.aj"); + File a1 = new File(getWorkingDir().getAbsolutePath() + File.separatorChar + "PR131505" + File.separatorChar + "A1.aj"); a1.delete(); build("PR131505"); checkWasFullBuild(); - checkXMLAspectCount("PR131505","",1, outputDir); - checkXMLAspectCount("PR131505","A1",0, outputDir); - checkXMLAspectCount("PR131505","A",1, outputDir); + checkXMLAspectCount("PR131505", "", 1, outputDir); + checkXMLAspectCount("PR131505", "A1", 0, outputDir); + checkXMLAspectCount("PR131505", "A", 1, outputDir); // add another aspect called A which is in a different package, both A // and pkg.A should be included in the aop.xml file - alter("PR131505","inc4"); + alter("PR131505", "inc4"); build("PR131505"); checkWasFullBuild(); - checkXMLAspectCount("PR131505","",2, outputDir); - checkXMLAspectCount("PR131505","A",1, outputDir); - checkXMLAspectCount("PR131505","pkg.A",1, outputDir); + checkXMLAspectCount("PR131505", "", 2, outputDir); + checkXMLAspectCount("PR131505", "A", 1, outputDir); + checkXMLAspectCount("PR131505", "pkg.A", 1, outputDir); } public void testPr136585() { initialiseProject("PR136585"); build("PR136585"); - alter("PR136585","inc1"); + alter("PR136585", "inc1"); build("PR136585"); - assertTrue("There should be no errors reported:\n"+getErrorMessages("PR136585"), - getErrorMessages("PR136585").isEmpty()); + assertTrue("There should be no errors reported:\n" + getErrorMessages("PR136585"), getErrorMessages("PR136585").isEmpty()); } - + public void testPr133532() { initialiseProject("PR133532"); build("PR133532"); - alter("PR133532","inc1"); + alter("PR133532", "inc1"); build("PR133532"); - alter("PR133532","inc2"); + alter("PR133532", "inc2"); build("PR133532"); - assertTrue("There should be no errors reported:\n"+getErrorMessages("PR133532"), - getErrorMessages("PR133532").isEmpty()); + assertTrue("There should be no errors reported:\n" + getErrorMessages("PR133532"), getErrorMessages("PR133532").isEmpty()); } - + public void testPr133532_2() { initialiseProject("pr133532_2"); build("pr133532_2"); - alter("pr133532_2","inc2"); + alter("pr133532_2", "inc2"); build("pr133532_2"); - assertTrue("There should be no errors reported:\n"+getErrorMessages("pr133532_2"), - getErrorMessages("pr133532_2").isEmpty()); + assertTrue("There should be no errors reported:\n" + getErrorMessages("pr133532_2"), getErrorMessages("pr133532_2") + .isEmpty()); String decisions = AjdeInteractionTestbed.MyStateListener.getDecisions(); - String expect="Need to recompile 'A.aj'"; - assertTrue("Couldn't find build decision: '"+expect+"' in the list of decisions made:\n"+decisions, - decisions.indexOf(expect)!=-1); + String expect = "Need to recompile 'A.aj'"; + assertTrue("Couldn't find build decision: '" + expect + "' in the list of decisions made:\n" + decisions, decisions + .indexOf(expect) != -1); } - + public void testPr133532_3() { initialiseProject("PR133532_3"); build("PR133532_3"); - alter("PR133532_3","inc1"); + alter("PR133532_3", "inc1"); build("PR133532_3"); - assertTrue("There should be no errors reported:\n"+getErrorMessages("PR133532_3"), - getErrorMessages("PR133532_3").isEmpty()); + assertTrue("There should be no errors reported:\n" + getErrorMessages("PR133532_3"), getErrorMessages("PR133532_3") + .isEmpty()); } - + public void testPr134541() { initialiseProject("PR134541"); build("PR134541"); - assertEquals("[Xlint:adviceDidNotMatch] should be associated with line 5",5, - ((IMessage)getWarningMessages("PR134541").get(0)).getSourceLocation().getLine()); - alter("PR134541","inc1"); + assertEquals("[Xlint:adviceDidNotMatch] should be associated with line 5", 5, ((IMessage) getWarningMessages("PR134541") + .get(0)).getSourceLocation().getLine()); + alter("PR134541", "inc1"); build("PR134541"); if (AsmManager.getDefault().getHandleProvider().dependsOnLocation()) - checkWasFullBuild(); // the line number has changed... but nothing structural about the code - else - checkWasntFullBuild(); // the line number has changed... but nothing structural about the code - assertEquals("[Xlint:adviceDidNotMatch] should now be associated with line 7",7, - ((IMessage)getWarningMessages("PR134541").get(0)).getSourceLocation().getLine()); + checkWasFullBuild(); // the line number has changed... but nothing structural about the code + else + checkWasntFullBuild(); // the line number has changed... but nothing structural about the code + assertEquals("[Xlint:adviceDidNotMatch] should now be associated with line 7", 7, + ((IMessage) getWarningMessages("PR134541").get(0)).getSourceLocation().getLine()); } - + public void testJDTLikeHandleProviderWithLstFile_pr141730() { IElementHandleProvider handleProvider = AsmManager.getDefault().getHandleProvider(); AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider()); @@ -1320,15 +1198,15 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa initialiseProject("JDTLikeHandleProvider"); build("JDTLikeHandleProvider"); IHierarchy top = AsmManager.getDefault().getHierarchy(); - IProgramElement pe = top.findElementForType("pkg","A"); - String expectedHandle = "JDTLikeHandleProvider"); - // add a line which shouldn't change the handle - alter("JDTLikeHandleProvider","inc1"); + IProgramElement pe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ADVICE, + "before(): "); + // add a line which shouldn't change the handle + alter("JDTLikeHandleProvider", "inc1"); build("JDTLikeHandleProvider"); checkWasntFullBuild(); IHierarchy top2 = AsmManager.getDefault().getHierarchy(); - IProgramElement pe2 = top.findElementForLabel(top2.getRoot(), - IProgramElement.Kind.ADVICE,"before(): "); - assertEquals("expected advice to be on line " + pe.getSourceLocation().getLine() + 1 - + " but was on " + pe2.getSourceLocation().getLine(), - pe.getSourceLocation().getLine()+1,pe2.getSourceLocation().getLine()); - assertEquals("expected advice to have handle " + pe.getHandleIdentifier() - + " but found handle " + pe2.getHandleIdentifier(), - pe.getHandleIdentifier(),pe2.getHandleIdentifier()); + IProgramElement pe2 = top.findElementForLabel(top2.getRoot(), IProgramElement.Kind.ADVICE, + "before(): "); + assertEquals("expected advice to be on line " + pe.getSourceLocation().getLine() + 1 + " but was on " + + pe2.getSourceLocation().getLine(), pe.getSourceLocation().getLine() + 1, pe2.getSourceLocation().getLine()); + assertEquals("expected advice to have handle " + pe.getHandleIdentifier() + " but found handle " + + pe2.getHandleIdentifier(), pe.getHandleIdentifier(), pe2.getHandleIdentifier()); } finally { AsmManager.getDefault().setHandleProvider(handleProvider); } } - + public void testSwappingAdviceAndHandles_pr141730() { IElementHandleProvider handleProvider = AsmManager.getDefault().getHandleProvider(); AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider()); @@ -1365,38 +1241,31 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa build("JDTLikeHandleProvider"); IHierarchy top = AsmManager.getDefault().getHierarchy(); - IProgramElement call = top.findElementForLabel(top.getRoot(), - IProgramElement.Kind.ADVICE, "after(): callPCD.."); - IProgramElement exec = top.findElementForLabel(top.getRoot(), - IProgramElement.Kind.ADVICE, "after(): execPCD.."); - // swap the two after advice statements over. This forces + IProgramElement call = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ADVICE, "after(): callPCD.."); + IProgramElement exec = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ADVICE, "after(): execPCD.."); + // swap the two after advice statements over. This forces // a full build which means 'after(): callPCD..' will now // be the second after advice in the file and have the same // handle as 'after(): execPCD..' originally did. - alter("JDTLikeHandleProvider","inc2"); + alter("JDTLikeHandleProvider", "inc2"); build("JDTLikeHandleProvider"); checkWasFullBuild(); - + IHierarchy top2 = AsmManager.getDefault().getHierarchy(); - IProgramElement newCall = top2.findElementForLabel(top2.getRoot(), - IProgramElement.Kind.ADVICE, "after(): callPCD.."); - IProgramElement newExec = top2.findElementForLabel(top2.getRoot(), - IProgramElement.Kind.ADVICE, "after(): execPCD.."); - - assertEquals("after swapping places, expected 'after(): callPCD..' " + - "to be on line " + newExec.getSourceLocation().getLine() + - " but was on line " + call.getSourceLocation().getLine(), - newExec.getSourceLocation().getLine(), - call.getSourceLocation().getLine()); - assertEquals("after swapping places, expected 'after(): callPCD..' " + - "to have handle " + exec.getHandleIdentifier() + - " (because was full build) but had " + newCall.getHandleIdentifier(), - exec.getHandleIdentifier(), newCall.getHandleIdentifier()); + IProgramElement newCall = top2.findElementForLabel(top2.getRoot(), IProgramElement.Kind.ADVICE, "after(): callPCD.."); + IProgramElement newExec = top2.findElementForLabel(top2.getRoot(), IProgramElement.Kind.ADVICE, "after(): execPCD.."); + + assertEquals("after swapping places, expected 'after(): callPCD..' " + "to be on line " + + newExec.getSourceLocation().getLine() + " but was on line " + call.getSourceLocation().getLine(), newExec + .getSourceLocation().getLine(), call.getSourceLocation().getLine()); + assertEquals("after swapping places, expected 'after(): callPCD..' " + "to have handle " + exec.getHandleIdentifier() + + " (because was full build) but had " + newCall.getHandleIdentifier(), exec.getHandleIdentifier(), newCall + .getHandleIdentifier()); } finally { AsmManager.getDefault().setHandleProvider(handleProvider); } } - + public void testInitializerCountForJDTLikeHandleProvider_pr141730() { IElementHandleProvider handleProvider = AsmManager.getDefault().getHandleProvider(); AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider()); @@ -1406,146 +1275,140 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa String expected = "JDTLikeHandleProvider 1); + assertTrue("expected there to be more than the one compliance level" + " error but only found that one", + errors.size() > 1); } - + } /** - * If the user has specified that they want Java 6 compliance - * and selected classfile and source file level settings to be - * 5.0 then expect an error saying that we don't support java 6. + * If the user has specified that they want Java 6 compliance and selected classfile and source file level settings to be 5.0 + * then expect an error saying that we don't support java 6. */ public void testPR164384_2() { initialiseProject("PR164384"); Hashtable javaOptions = new Hashtable(); - javaOptions.put("org.eclipse.jdt.core.compiler.compliance","1.6"); - javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform","1.5"); - javaOptions.put("org.eclipse.jdt.core.compiler.source","1.5"); - configureJavaOptionsMap("PR164384",javaOptions); - + javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.5"); + javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.5"); + configureJavaOptionsMap("PR164384", javaOptions); + build("PR164384"); List errors = getErrorMessages("PR164384"); if (getCompilerForProjectWithName("PR164384").isJava6Compatible()) { - assertTrue("There should be no errors:\n"+errors,errors.isEmpty()); + assertTrue("There should be no errors:\n" + errors, errors.isEmpty()); } else { String expectedError = "Java 6.0 compliance level is unsupported"; - String found = ((IMessage)errors.get(0)).getMessage(); - assertEquals("Expected 'Java 6.0 compliance level is unsupported'" + - " error message but found " + found,expectedError,found); + String found = ((IMessage) errors.get(0)).getMessage(); + assertEquals("Expected 'Java 6.0 compliance level is unsupported'" + " error message but found " + found, + expectedError, found); // This is because the 'Java 6.0 compliance' error is an 'error' // rather than an 'abort'. Aborts are really for compiler exceptions. - assertTrue("expected there to be more than the one compliance level" + - " error but only found that one",errors.size() > 1); + assertTrue("expected there to be more than the one compliance level" + " error but only found that one", + errors.size() > 1); } } - + /** - * If the user has specified that they want Java 6 compliance - * and set the classfile level to be 6.0 and source file level - * to be 5.0 then expect an error saying that we don't support - * java 6. + * If the user has specified that they want Java 6 compliance and set the classfile level to be 6.0 and source file level to be + * 5.0 then expect an error saying that we don't support java 6. */ public void testPR164384_3() { initialiseProject("PR164384"); Hashtable javaOptions = new Hashtable(); - javaOptions.put("org.eclipse.jdt.core.compiler.compliance","1.6"); - javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform","1.6"); - javaOptions.put("org.eclipse.jdt.core.compiler.source","1.5"); - configureJavaOptionsMap("PR164384",javaOptions); - + javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.5"); + configureJavaOptionsMap("PR164384", javaOptions); + build("PR164384"); List errors = getErrorMessages("PR164384"); - + if (getCompilerForProjectWithName("PR164384").isJava6Compatible()) { - assertTrue("There should be no errros:\n"+errors,errors.isEmpty()); + assertTrue("There should be no errros:\n" + errors, errors.isEmpty()); } else { String expectedError = "Java 6.0 compliance level is unsupported"; - String found = ((IMessage)errors.get(0)).getMessage(); - assertEquals("Expected 'Java 6.0 compliance level is unsupported'" + - " error message but found " + found,expectedError,found); + String found = ((IMessage) errors.get(0)).getMessage(); + assertEquals("Expected 'Java 6.0 compliance level is unsupported'" + " error message but found " + found, + expectedError, found); // This is because the 'Java 6.0 compliance' error is an 'error' // rather than an 'abort'. Aborts are really for compiler exceptions. - assertTrue("expected there to be more than the one compliance level" + - " error but only found that one",errors.size() > 1); + assertTrue("expected there to be more than the one compliance level" + " 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 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("inpathTesting",s); + configureInPath("inpathTesting", s); build("inpathTesting"); // the declare warning matches one place so expect one warning message List warnings = getWarningMessages("inpathTesting"); - assertTrue("Expected there to be one warning message but found " - + warnings.size() + ": " + warnings, warnings.size() == 1); - + assertTrue("Expected there to be one warning message but found " + warnings.size() + ": " + warnings, warnings.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 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); - + 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 warnings = getWarningMessages("inpathTesting"); - assertTrue("Expected there to be two warning message but found " - + warnings.size() + ": " + warnings, warnings.size() == 2); + assertTrue("Expected there to be two warning message but found " + warnings.size() + ": " + warnings, warnings.size() == 2); } - + // --- helper code --- - + /** - * Retrieve program elements related to this one regardless of the relationship. A JUnit assertion is - * made that the number that the 'expected' number are found. + * Retrieve program elements related to this one regardless of the relationship. A JUnit assertion is made that the number that + * the 'expected' number are found. * * @param programElement Program element whose related elements are to be found * @param expected the number of expected related elements */ - private List/*IProgramElement*/ getRelatedElements(IProgramElement programElement,int expected) { + private List/* IProgramElement */getRelatedElements(IProgramElement programElement, int expected) { List relatedElements = getRelatedElements(programElement); StringBuffer debugString = new StringBuffer(); - if (relatedElements!=null) { - for (Iterator iter = relatedElements.iterator(); iter.hasNext();) { + if (relatedElements != null) { + for (Iterator iter = relatedElements.iterator(); iter.hasNext();) { String element = (String) iter.next(); - debugString.append(AsmManager.getDefault().getHierarchy().findElementForHandle(element).toLabelString()).append("\n"); + debugString.append(AsmManager.getDefault().getHierarchy().findElementForHandle(element).toLabelString()).append( + "\n"); } } - assertTrue("Should be "+expected+" element"+(expected>1?"s":"")+" related to this one '"+programElement+ - "' but found :\n "+debugString,relatedElements!=null && relatedElements.size()==1); + assertTrue("Should be " + expected + " element" + (expected > 1 ? "s" : "") + " related to this one '" + programElement + + "' but found :\n " + debugString, relatedElements != null && relatedElements.size() == 1); return relatedElements; } - + private IProgramElement getFirstRelatedElement(IProgramElement programElement) { - List rels = getRelatedElements(programElement,1); - return AsmManager.getDefault().getHierarchy().findElementForHandle((String)rels.get(0)); + List rels = getRelatedElements(programElement, 1); + return AsmManager.getDefault().getHierarchy().findElementForHandle((String) rels.get(0)); } - - - private List/*IProgramElement*/ getRelatedElements(IProgramElement advice) { + private List/* IProgramElement */getRelatedElements(IProgramElement advice) { List output = null; IRelationshipMap map = AsmManager.getDefault().getRelationshipMap(); - List/*IRelationship*/ rels = (List)map.get(advice); - if (rels==null) fail("Did not find any related elements!"); + List/* IRelationship */rels = map.get(advice); + if (rels == null) + fail("Did not find any related elements!"); for (Iterator iter = rels.iterator(); iter.hasNext();) { IRelationship element = (IRelationship) iter.next(); - List/*String*/ targets = element.getTargets(); - if (output==null) output = new ArrayList(); + List/* String */targets = element.getTargets(); + if (output == null) + output = new ArrayList(); output.addAll(targets); } return output; } - + private IProgramElement findAdvice(IProgramElement ipe) { - return findAdvice(ipe,1); + return findAdvice(ipe, 1); } - - private IProgramElement findAdvice(IProgramElement ipe,int whichOne) { - if (ipe.getKind()==IProgramElement.Kind.ADVICE) { - whichOne=whichOne-1; - if (whichOne==0) return ipe; + + private IProgramElement findAdvice(IProgramElement ipe, int whichOne) { + if (ipe.getKind() == IProgramElement.Kind.ADVICE) { + whichOne = whichOne - 1; + if (whichOne == 0) + return ipe; } List kids = ipe.getChildren(); for (Iterator iter = kids.iterator(); iter.hasNext();) { IProgramElement kid = (IProgramElement) iter.next(); - IProgramElement found = findAdvice(kid,whichOne); - if (found!=null) return found; + IProgramElement found = findAdvice(kid, whichOne); + if (found != null) + return found; } return null; } - + /** * Finds the first 'code' program element below the element supplied - will return null if there aren't any */ private IProgramElement findCode(IProgramElement ipe) { - return findCode(ipe,-1); + return findCode(ipe, -1); } - + /** - * Searches a hierarchy of program elements for a 'code' element at the specified line number, a line number - * of -1 means just return the first one you find + * Searches a hierarchy of program elements for a 'code' element at the specified line number, a line number of -1 means just + * return the first one you find */ - private IProgramElement findCode(IProgramElement ipe,int linenumber) { - if (ipe.getKind()==IProgramElement.Kind.CODE) { - if (linenumber==-1 || ipe.getSourceLocation().getLine()==linenumber) return ipe; + private IProgramElement findCode(IProgramElement ipe, int linenumber) { + if (ipe.getKind() == IProgramElement.Kind.CODE) { + if (linenumber == -1 || ipe.getSourceLocation().getLine() == linenumber) + return ipe; } List kids = ipe.getChildren(); for (Iterator iter = kids.iterator(); iter.hasNext();) { IProgramElement kid = (IProgramElement) iter.next(); - IProgramElement found = findCode(kid,linenumber); - if (found!=null) return found; + IProgramElement found = findCode(kid, linenumber); + if (found != null) + return found; } return null; } - - + // other possible tests: // - memory usage (freemem calls?) // - relationship map // --------------------------------------------------------------------------------------------------- - private IProgramElement checkForNode(String packageName,String typeName,boolean shouldBeFound) { - IProgramElement ipe = AsmManager.getDefault().getHierarchy().findElementForType(packageName,typeName); + private IProgramElement checkForNode(String packageName, String typeName, boolean shouldBeFound) { + IProgramElement ipe = AsmManager.getDefault().getHierarchy().findElementForType(packageName, typeName); if (shouldBeFound) { - if (ipe==null) printModel(); - assertTrue("Should have been able to find '"+packageName+"."+typeName+"' in the asm",ipe!=null); + if (ipe == null) + printModel(); + assertTrue("Should have been able to find '" + packageName + "." + typeName + "' in the asm", ipe != null); } else { - if (ipe!=null) printModel(); - assertTrue("Should have NOT been able to find '"+packageName+"."+typeName+"' in the asm",ipe==null); + if (ipe != null) + printModel(); + assertTrue("Should have NOT been able to find '" + packageName + "." + typeName + "' in the asm", ipe == null); } - return ipe; + return ipe; } - private void printModel() { try { - AsmManager.dumptree(AsmManager.getDefault().getHierarchy().getRoot(),0); + AsmManager.dumptree(AsmManager.getDefault().getHierarchy().getRoot(), 0); } catch (IOException e) { e.printStackTrace(); } } - + private static void log(String msg) { - if (VERBOSE) System.out.println(msg); + if (VERBOSE) + System.out.println(msg); } - private File getProjectRelativePath(String p,String filename) { - File projDir = new File(getWorkingDir(),p); - return new File(projDir,filename); + 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); + private File getProjectOutputRelativePath(String p, String filename) { + File projDir = new File(getWorkingDir(), p); + return new File(projDir, "bin" + File.separator + filename); } private void assertNoErrors(String projectName) { - assertTrue("Should be no errors, but got "+getErrorMessages(projectName),getErrorMessages(projectName).size()==0); + assertTrue("Should be no errors, but got " + getErrorMessages(projectName), getErrorMessages(projectName).size() == 0); } - + } \ No newline at end of file -- 2.39.5