diff options
author | Jay Arthanareeswaran | 2015-10-20 17:34:47 +0000 |
---|---|---|
committer | Jay Arthanareeswaran | 2015-10-21 06:39:51 +0000 |
commit | e447d89530bf9d3a43064d5916817ebccc4e6812 (patch) | |
tree | 5ea6a65c12e245b53be0cfeda94878cae6461933 /org.eclipse.jdt.core.tests.builder | |
parent | 3bd57b45443ee6cb04b06e9af49f405bde64925e (diff) | |
download | eclipse.jdt.core-e447d89530bf9d3a43064d5916817ebccc4e6812.tar.gz eclipse.jdt.core-e447d89530bf9d3a43064d5916817ebccc4e6812.tar.xz eclipse.jdt.core-e447d89530bf9d3a43064d5916817ebccc4e6812.zip |
Bug 464369 - Fixing tests in IncrementalTests and MultiProjectTests
Calling waitForManualRefresh and waitForAutoBuild to ensure delta
processor and build has enough time to complete.
Change-Id: I2f03af2ebbe2bf38acce849138bfb64c2d97b7d8
Diffstat (limited to 'org.eclipse.jdt.core.tests.builder')
3 files changed, 205 insertions, 26 deletions
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java index 9f6716fe60..a19de48609 100644 --- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java +++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java @@ -39,8 +39,7 @@ public BuildpathTests(String name) { } public static Test suite() { -// return buildTestSuite(BuildpathTests.class); - return buildTestSuite(BuildpathTests.class, BYTECODE_DECLARATION_ORDER); + return buildTestSuite(BuildpathTests.class); } @Override protected void setUp() throws Exception { @@ -179,8 +178,9 @@ public void testClosedProject() throws JavaModelException, IOException { options.put(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, JavaCore.IGNORE); JavaCore.setOptions(options); env.closeProject(project1Path); - + env.waitForManualRefresh(); incrementalBuild(); + env.waitForAutoBuild(); expectingOnlyProblemsFor(new IPath[] {project2Path, project3Path}); expectingOnlySpecificProblemFor(project2Path, new Problem("Build path", "Project 'CP2' is missing required Java project: 'CP1'", project2Path, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR) //$NON-NLS-1$ //$NON-NLS-2$ @@ -230,8 +230,9 @@ public void testCorruptBuilder() throws JavaModelException { JavaCore.setOptions(options); env.removeBinaryClass(outputFolderPackage, "Test"); //$NON-NLS-1$ - + env.waitForManualRefresh(); incrementalBuild(); + env.waitForAutoBuild(); expectingNoProblems(); env.removeProject(project1Path); } @@ -249,6 +250,7 @@ public void testCorruptBuilder2() throws JavaModelException { ); fullBuild(); + env.waitForAutoBuild(); expectingNoProblems(); IPath outputFolderPackage = bin.append("p"); //$NON-NLS-1$ @@ -260,6 +262,7 @@ public void testCorruptBuilder2() throws JavaModelException { ); incrementalBuild(); + env.waitForAutoBuild(); expectingOnlySpecificProblemFor(subTest, new Problem("", "p.Test cannot be resolved to a type", subTest, 40, 46, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$) env.addClass(src, "p", "Test", //$NON-NLS-1$ //$NON-NLS-2$ @@ -268,6 +271,7 @@ public void testCorruptBuilder2() throws JavaModelException { ); fullBuild(); + env.waitForAutoBuild(); expectingNoProblems(); Hashtable options = JavaCore.getOptions(); @@ -275,7 +279,7 @@ public void testCorruptBuilder2() throws JavaModelException { JavaCore.setOptions(options); env.removeBinaryClass(outputFolderPackage, "Test"); //$NON-NLS-1$ - + env.waitForManualRefresh(); incrementalBuild(); expectingNoProblems(); env.removeProject(project1Path); @@ -318,6 +322,7 @@ public void testChangeExternalFolder() throws CoreException { ); fullBuild(projectPath); + env.waitForAutoBuild(); expectingNoProblems(); String externalClassFile = externalLib + File.separator + "p" + File.separator + "X.class"; @@ -342,6 +347,7 @@ public void testChangeExternalFolder() throws CoreException { env.waitForManualRefresh(); incrementalBuild(projectPath); + env.waitForAutoBuild(); expectingProblemsFor( classY, "Problem : The method foo() is undefined for the type X [ resource : </Project/q/Y.java> range : <54,57> category : <50> severity : <2>]" @@ -665,6 +671,7 @@ public void testMissingLibrary2() throws JavaModelException { ); fullBuild(); + env.waitForAutoBuild(); expectingSpecificProblemFor( projectPath, new Problem("", "The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project", projectPath, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ @@ -687,6 +694,7 @@ public void testMissingLibrary2() throws JavaModelException { env.addExternalJars(projectPath, Util.getJavaClassLibs()); incrementalBuild(); + env.waitForAutoBuild(); expectingNoProblems(); expectingPresenceOf(new IPath[]{ bin.append("p2").append("Test1.class"), //$NON-NLS-1$ //$NON-NLS-2$ @@ -704,19 +712,23 @@ public void testMissingLibrary3() throws JavaModelException { fullBuild(); expectingNoProblems(); project.setOption(JavaCore.CORE_INCOMPLETE_CLASSPATH, CompilerOptions.WARNING); + env.waitForManualRefresh(); env.addLibrary(projectPath, projectPath.append("/lib/dummy.jar"), null, null); fullBuild(); + env.waitForAutoBuild(); expectingSpecificProblemFor( projectPath, new Problem("Build path", "Project 'Project' is missing required library: 'lib/dummy.jar'", projectPath, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)); project.setOption(JavaCore.CORE_INCOMPLETE_CLASSPATH, CompilerOptions.ERROR); + env.waitForManualRefresh(); // force classpath change delta - should not have to do this IClasspathEntry[] classpath = project.getRawClasspath(); IPath outputLocation; project.setRawClasspath(null, outputLocation = project.getOutputLocation(), false, null); project.setRawClasspath(classpath, outputLocation, false, null); fullBuild(); + env.waitForAutoBuild(); expectingSpecificProblemFor( projectPath, new Problem("", "The project cannot be built until build path errors are resolved", projectPath, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR)); @@ -734,7 +746,9 @@ public void testMissingLibrary4() throws JavaModelException { fullBuild(); expectingNoProblems(); env.addLibrary(projectPath, projectPath.append("/lib/dummy.jar"), null, null); + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingSpecificProblemFor( projectPath, new Problem("", "The project cannot be built until build path errors are resolved", projectPath, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR)); @@ -742,7 +756,9 @@ public void testMissingLibrary4() throws JavaModelException { projectPath, new Problem("Build path", "Project 'Project' is missing required library: 'lib/dummy.jar'", projectPath, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR)); project.setOption(JavaCore.CORE_INCOMPLETE_CLASSPATH, CompilerOptions.WARNING); + env.waitForManualRefresh(); incrementalBuild(); + env.waitForManualRefresh(); expectingSpecificProblemFor( projectPath, new Problem("Build path", "Project 'Project' is missing required library: 'lib/dummy.jar'", projectPath, -1, -1, CategorizedProblem.CAT_BUILDPATH, @@ -768,7 +784,9 @@ public void testIncompatibleJdkLEvelOnProject() throws JavaModelException { // Change project incompatible jdk level preferences to warning, perform incremental build and expect 1 problem project.setOption(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, CompilerOptions.WARNING); + env.waitForManualRefresh(); incrementalBuild(); + env.waitForAutoBuild(); long projectRuntimeJDKLevel = CompilerOptions.versionToJdkLevel(projectRuntime); int max = classlibs.length; List expectedProblems = new ArrayList(); @@ -784,7 +802,9 @@ public void testIncompatibleJdkLEvelOnProject() throws JavaModelException { // Change project incompatible jdk level preferences to error, perform incremental build and expect 2 problems project.setOption(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, CompilerOptions.ERROR); + env.waitForManualRefresh(); incrementalBuild(); + env.waitForAutoBuild(); expectedProblems = new ArrayList(); for (int i = 0; i < max; i++) { @@ -819,6 +839,7 @@ public void testIncompatibleJdkLEvelOnWksp() throws JavaModelException { // Build it expecting no problem fullBuild(); + env.waitForAutoBuild(); expectingNoProblems(); // Build incompatible jdk level problem string @@ -828,8 +849,9 @@ public void testIncompatibleJdkLEvelOnWksp() throws JavaModelException { Arrays.sort(classlibs); // Change workspace incompatible jdk level preferences to warning, perform incremental build and expect 1 problem preferences.put(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, JavaCore.WARNING); + env.waitForManualRefresh(); incrementalBuild(); - + env.waitForAutoBuild(); List expectedProblems = new ArrayList(); int max = classlibs.length; for (int i = 0; i < max; i++) { @@ -844,8 +866,9 @@ public void testIncompatibleJdkLEvelOnWksp() throws JavaModelException { // Change workspace incompatible jdk level preferences to error, perform incremental build and expect 2 problems preferences.put(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, JavaCore.ERROR); + env.waitForManualRefresh(); incrementalBuild(); - + env.waitForAutoBuild(); expectedProblems = new ArrayList(); for (int i = 0; i < max; i++) { String path = project.getPackageFragmentRoot(classlibs[i]).getPath().makeRelative().toString(); @@ -887,6 +910,7 @@ public void testMissingProject() throws JavaModelException { env.removeProject(project1Path); incrementalBuild(); + env.waitForAutoBuild(); expectingOnlyProblemsFor(project2Path); expectingOnlySpecificProblemsFor(project2Path, new Problem[] { @@ -899,6 +923,7 @@ public void testMissingProject() throws JavaModelException { env.addExternalJars(project1Path, Util.getJavaClassLibs()); incrementalBuild(); + env.waitForAutoBuild(); expectingNoProblems(); //---------------------------- @@ -907,9 +932,11 @@ public void testMissingProject() throws JavaModelException { Hashtable options = JavaCore.getOptions(); options.put(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, JavaCore.IGNORE); JavaCore.setOptions(options); + env.waitForManualRefresh(); env.removeProject(project1Path); incrementalBuild(); + env.waitForAutoBuild(); expectingOnlyProblemsFor(project2Path); expectingOnlySpecificProblemFor(project2Path, new Problem("Build path", "Project 'MP2' is missing required Java project: 'MP1'", project2Path, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR) //$NON-NLS-1$ //$NON-NLS-2$ @@ -919,6 +946,7 @@ public void testMissingProject() throws JavaModelException { env.addExternalJars(project1Path, Util.getJavaClassLibs()); incrementalBuild(); + env.waitForAutoBuild(); expectingNoProblems(); env.removeProject(project1Path); env.removeProject(project2Path); @@ -955,9 +983,11 @@ public void testMissingOptionalProject() throws JavaModelException { Hashtable options = JavaCore.getOptions(); options.put(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, JavaCore.IGNORE); JavaCore.setOptions(options); + env.waitForManualRefresh(); env.removeProject(project1Path); incrementalBuild(); + env.waitForAutoBuild(); expectingNoProblems(); project1Path = env.addProject("MP1"); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java index ce194007df..a16c35903f 100644 --- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java +++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java @@ -69,6 +69,7 @@ public class IncrementalTests extends BuilderTests { "Problem : The type CC is already defined [ resource : </Project/src/p/D.java> range : <37,39> category : <-1> severity : <2>]" ); expectingSpecificProblemsFor(pathToD, new Problem[] {new Problem("", "The type CC is already defined", pathToD, 37, 39, -1, IMarker.SEVERITY_ERROR)}); + env.removeProject(projectPath); } public void testDefaultPackage() throws JavaModelException { @@ -90,6 +91,7 @@ public class IncrementalTests extends BuilderTests { incrementalBuild(projectPath); expectingNoProblems(); + env.removeProject(projectPath); } public void testDefaultPackage2() throws JavaModelException { @@ -111,6 +113,7 @@ public class IncrementalTests extends BuilderTests { incrementalBuild(projectPath); expectingNoProblems(); + env.removeProject(projectPath); } public void testNewJCL() { @@ -148,6 +151,7 @@ public class IncrementalTests extends BuilderTests { incrementalBuild(); expectingNoProblems(); + env.removeProject(projectPath); } /* @@ -208,6 +212,7 @@ public class IncrementalTests extends BuilderTests { incrementalBuild(projectPath); expectingNoProblems(); + env.removeProject(projectPath); } /* @@ -278,6 +283,7 @@ public class IncrementalTests extends BuilderTests { incrementalBuild(projectPath); expectingNoProblems(); + env.removeProject(projectPath); } /* @@ -348,6 +354,7 @@ public class IncrementalTests extends BuilderTests { incrementalBuild(projectPath); expectingNoProblems(); + env.removeProject(projectPath); } public void testMoveSecondaryType() throws JavaModelException { @@ -401,6 +408,7 @@ public class IncrementalTests extends BuilderTests { incrementalBuild(projectPath); expectingNoProblems(); + env.removeProject(projectPath); } public void testMoveMemberType() throws JavaModelException { @@ -471,6 +479,7 @@ public class IncrementalTests extends BuilderTests { new Problem[]{ new Problem("", "The import p.ZA is never used", new Path("/Project/src/p/AB.java"), 35, 39, CategorizedProblem.CAT_UNNECESSARY_CODE, IMarker.SEVERITY_WARNING), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ }); + env.removeProject(projectPath); } public void testMovePackage() throws JavaModelException { @@ -496,6 +505,7 @@ public class IncrementalTests extends BuilderTests { incrementalBuild(projectPath); expectingNoProblems(); + env.removeProject(projectPath); } public void testMovePackage2() throws JavaModelException { @@ -533,6 +543,7 @@ public class IncrementalTests extends BuilderTests { incrementalBuild(projectPath); expectingNoProblems(); + env.removeProject(projectPath); } public void testMemberTypeFromClassFile() throws JavaModelException { @@ -585,6 +596,7 @@ public class IncrementalTests extends BuilderTests { incrementalBuild(projectPath); org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = previous; expectingNoProblems(); + env.removeProject(projectPath); } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=372418 @@ -645,6 +657,7 @@ public class IncrementalTests extends BuilderTests { fullBuild(projectPath1); org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = previous; expectingNoProblems(); + env.removeProject(projectPath1); } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=377401 @@ -701,6 +714,7 @@ public class IncrementalTests extends BuilderTests { fullBuild(projectPath1); org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = previous; expectingNoProblems(); + env.removeProject(projectPath1); } // http://dev.eclipse.org/bugs/show_bug.cgi?id=27658 @@ -751,6 +765,7 @@ public class IncrementalTests extends BuilderTests { new Problem[]{ new Problem("", "The type java.lang.Object cannot have a superclass or superinterfaces", new Path("/Project/src/java/lang/Object.java"), 33, 39, CategorizedProblem.CAT_INTERNAL, IMarker.SEVERITY_ERROR), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ }); + env.removeProject(projectPath); } catch(StackOverflowError e){ assertTrue("Infinite loop in cycle detection", false); //$NON-NLS-1$ @@ -793,6 +808,7 @@ public class IncrementalTests extends BuilderTests { incrementalBuild(); expectingProblemsFor(x, "???"); expectingNoPresenceOf(bin.append("X.class")); //$NON-NLS-1$ + env.removeProject(projectPath); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=100631 @@ -837,6 +853,7 @@ public class IncrementalTests extends BuilderTests { incrementalBuild(projectPath); expectingNoProblems(); + env.removeProject(projectPath); } finally { org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = max; } @@ -898,6 +915,7 @@ public class IncrementalTests extends BuilderTests { incrementalBuild(projectPath); expectingNoProblems(); + env.removeProject(projectPath); } finally { org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = max; } @@ -945,6 +963,7 @@ public class IncrementalTests extends BuilderTests { incrementalBuild(projectPath); expectingSpecificProblemFor(yPath, new Problem("Y", "Zork cannot be resolved to a type", yPath, 34, 38, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ expectingNoProblemsFor(xPath); + env.removeProject(projectPath); } public void testSecondaryType() throws JavaModelException { @@ -972,6 +991,7 @@ public class IncrementalTests extends BuilderTests { org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = max; } expectingNoProblems(); + env.removeProject(projectPath); } // http://dev.eclipse.org/bugs/show_bug.cgi?id=196200 - variation @@ -1013,6 +1033,7 @@ public class IncrementalTests extends BuilderTests { ); incrementalBuild(projectPath); expectingSpecificProblemFor(xPath, new Problem("X", "This method has a constructor name", xPath, 73, 76, CategorizedProblem.CAT_CODE_STYLE, IMarker.SEVERITY_WARNING)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(projectPath); } // http://dev.eclipse.org/bugs/show_bug.cgi?id=196200 - variation @@ -1057,6 +1078,7 @@ public class IncrementalTests extends BuilderTests { ); incrementalBuild(projectPath); expectingSpecificProblemFor(xPath, new Problem("X", "This method has a constructor name", xPath, 73, 76, CategorizedProblem.CAT_CODE_STYLE, IMarker.SEVERITY_WARNING)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(projectPath); } // http://dev.eclipse.org/bugs/show_bug.cgi?id=196200 - variation @@ -1101,6 +1123,7 @@ public class IncrementalTests extends BuilderTests { ); incrementalBuild(projectPath); expectingSpecificProblemFor(xPath, new Problem("X", "This method has a constructor name", xPath, 73, 76, CategorizedProblem.CAT_CODE_STYLE, IMarker.SEVERITY_WARNING)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(projectPath); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=334377 public void testBug334377() throws JavaModelException { @@ -1165,6 +1188,7 @@ public class IncrementalTests extends BuilderTests { incrementalBuild(projectPath); expectingNoProblems(); + env.removeProject(projectPath); } finally { org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = max; JavaCore.setOptions(options); @@ -1189,8 +1213,9 @@ public class IncrementalTests extends BuilderTests { "import w.I;\n" + "import w.W;\n" + "public class A {}"); //$NON-NLS-1$ - + env.waitForManualRefresh(); fullBuild(projectPath); + env.waitForAutoBuild(); expectingSpecificProblemFor(wPath, new Problem("W", "w.I cannot be resolved to a type", wPath, 37, 40, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ expectingSpecificProblemFor(aPath, new Problem("A", "The import w.I cannot be resolved", aPath, 18, 21, CategorizedProblem.CAT_IMPORT, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ @@ -1200,7 +1225,10 @@ public class IncrementalTests extends BuilderTests { "import w.W;\n" + "public class A {}"); //$NON-NLS-1$ + env.waitForManualRefresh(); incrementalBuild(projectPath); + env.waitForAutoBuild(); expectingSpecificProblemFor(aPath, new Problem("A", "The import w.I cannot be resolved", aPath, 18, 21, CategorizedProblem.CAT_IMPORT, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(projectPath); } } diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java index 504bd1af99..3ca58177ed 100644 --- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java +++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java @@ -75,8 +75,9 @@ public class MultiProjectTests extends BuilderTests { "public class C {\n"+ //$NON-NLS-1$ "}\n" //$NON-NLS-1$ ); - + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingNoProblems(); //---------------------------- @@ -87,9 +88,13 @@ public class MultiProjectTests extends BuilderTests { " int x;\n"+ //$NON-NLS-1$ "}\n" //$NON-NLS-1$ ); - + env.waitForManualRefresh(); incrementalBuild(); + env.waitForAutoBuild(); expectingCompiledClasses(new String[]{"A", "B"}); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(project1Path); + env.removeProject(project2Path); + env.removeProject(project3Path); } // 14103 - avoid recompiling unaffected sources in dependent projects @@ -135,7 +140,9 @@ public class MultiProjectTests extends BuilderTests { "}\n" //$NON-NLS-1$ ); + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingNoProblems(); //---------------------------- @@ -153,9 +160,13 @@ public class MultiProjectTests extends BuilderTests { " int x; //structural change\n"+ //$NON-NLS-1$ "}\n" //$NON-NLS-1$ ); - + env.waitForManualRefresh(); incrementalBuild(); + env.waitForAutoBuild(); expectingCompiledClasses(new String[]{"A", "Unreferenced"}); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(project1Path); + env.removeProject(project2Path); + env.removeProject(project3Path); } public void testRemoveField() throws JavaModelException { @@ -192,8 +203,9 @@ public class MultiProjectTests extends BuilderTests { " }\n"+ //$NON-NLS-1$ "}\n" //$NON-NLS-1$ ); - + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingNoProblems(); //---------------------------- @@ -203,9 +215,12 @@ public class MultiProjectTests extends BuilderTests { "public class A {\n"+ //$NON-NLS-1$ "}\n" //$NON-NLS-1$ ); - + env.waitForManualRefresh(); incrementalBuild(); + env.waitForAutoBuild(); expectingSpecificProblemFor(b, new Problem("B.foo()", "x cannot be resolved or is not a field", b, 61, 62, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(project1Path); + env.removeProject(project2Path); } public void testCompileOrder() throws JavaModelException { @@ -267,7 +282,9 @@ public class MultiProjectTests extends BuilderTests { ); env.setBuildOrder(new String[]{"P1", "P3", "P2"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingCompilingOrder(new String[]{"p1.X", "p3.Z", "p2.Y"}); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ IPath workspaceRootPath = env.getWorkspaceRootPath(); @@ -277,6 +294,9 @@ public class MultiProjectTests extends BuilderTests { new Problem("p1", "W cannot be resolved to a type", c1, 31, 32, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)//$NON-NLS-1$ //$NON-NLS-2$ }); JavaCore.setOptions(options); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); } public void testCycle1() throws JavaModelException { @@ -360,7 +380,9 @@ public class MultiProjectTests extends BuilderTests { try { env.setBuildOrder(new String[]{"P1", "P2", "P3"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p3.Z", "p1.X", "p2.Y", "p3.Z", "p1.X"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$//$NON-NLS-6$//$NON-NLS-7$ expectingOnlySpecificProblemFor(p1, new Problem("p1", "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2, P3}", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ @@ -370,6 +392,9 @@ public class MultiProjectTests extends BuilderTests { JavaCore.setOptions(options); } finally { env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); } } @@ -454,8 +479,9 @@ public class MultiProjectTests extends BuilderTests { try { env.setBuildOrder(new String[]{"P1", "P2", "P3"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ + env.waitForManualRefresh(); fullBuild(); - + env.waitForAutoBuild(); expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p3.Z", "p1.X", "p2.Y", "p3.Z", "p1.X"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$//$NON-NLS-7$ expectingOnlySpecificProblemFor(p1,new Problem("p1", "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2, P3}", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ expectingOnlySpecificProblemsFor(p2,new Problem[]{ @@ -467,6 +493,9 @@ public class MultiProjectTests extends BuilderTests { JavaCore.setOptions(options); } finally { env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); } } @@ -551,7 +580,9 @@ public class MultiProjectTests extends BuilderTests { try { env.setBuildOrder(new String[]{"P1", "P2", "P3"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p3.Z", "p1.X", "p2.Y", "p3.Z", "p1.X"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$//$NON-NLS-7$ expectingOnlySpecificProblemFor(p1,new Problem("p1", "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2, P3}", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ @@ -568,7 +599,7 @@ public class MultiProjectTests extends BuilderTests { "}\n" //$NON-NLS-1$ ); incrementalBuild(); - + env.waitForAutoBuild(); expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p3.Z"}); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ expectingOnlySpecificProblemFor(p1,new Problem("p1", "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2, P3}", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ expectingOnlySpecificProblemsFor(p2,new Problem[]{ @@ -580,6 +611,9 @@ public class MultiProjectTests extends BuilderTests { JavaCore.setOptions(options); } finally { env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); } } public void testCycle4() throws JavaModelException { @@ -653,7 +687,9 @@ public class MultiProjectTests extends BuilderTests { try { env.setBuildOrder(new String[]{"P1", "P2", "P3"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingCompilingOrder(new String[]{"p2.Y", "p3.Z", "p2.Y"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ expectingOnlySpecificProblemFor(p1,new Problem("p1", "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2, P3}", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ @@ -680,6 +716,7 @@ public class MultiProjectTests extends BuilderTests { "}\n" //$NON-NLS-1$ ); incrementalBuild(); + env.waitForAutoBuild(); expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p3.Z", "p1.X", "p2.Y"}); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ expectingOnlySpecificProblemFor(p1,new Problem("p1", "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2, P3}", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ expectingOnlySpecificProblemFor(p2,new Problem("p2", "A cycle was detected in the build path of project 'P2'. The cycle consists of projects {P1, P2, P3}", p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING));//$NON-NLS-1$ //$NON-NLS-2$ @@ -688,6 +725,9 @@ public class MultiProjectTests extends BuilderTests { JavaCore.setOptions(options); } finally { env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); } } @@ -744,7 +784,9 @@ public class MultiProjectTests extends BuilderTests { try { env.setBuildOrder(new String[]{"P1", "P2"});//$NON-NLS-1$ //$NON-NLS-2$ + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingCompilingOrder(new String[]{"p1.X", "p2.Y", "p1.X", "p2.Y"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ expectingOnlySpecificProblemsFor(p1,new Problem[]{ @@ -768,7 +810,7 @@ public class MultiProjectTests extends BuilderTests { ); incrementalBuild(); - + env.waitForAutoBuild(); expectingCompilingOrder(new String[]{"p11.XX", "p22.YY", "p2.Y", "p1.X"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$ expectingOnlySpecificProblemsFor(p1,new Problem[]{ new Problem("p1", "The import p22 is never used", c1, 32, 35, CategorizedProblem.CAT_UNNECESSARY_CODE, IMarker.SEVERITY_WARNING),//$NON-NLS-1$ //$NON-NLS-2$ @@ -782,6 +824,8 @@ public class MultiProjectTests extends BuilderTests { JavaCore.setOptions(options); } finally { env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); } } @@ -854,8 +898,9 @@ public void testCycle6() throws JavaModelException { env.addRequiredProject(p3, p2, accessiblePaths, forbiddenPaths, false); try { + env.waitForManualRefresh(); fullBuild(); - + env.waitForAutoBuild(); expectingOnlySpecificProblemsFor(p1,new Problem[]{ new Problem("p1", "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2, P3}", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)//$NON-NLS-1$ //$NON-NLS-2$ }); @@ -868,6 +913,9 @@ public void testCycle6() throws JavaModelException { } finally { JavaCore.setOptions(options); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); } } @@ -940,8 +988,9 @@ public void testCycle7() throws JavaModelException { env.addRequiredProject(p3, p2, accessiblePaths, forbiddenPaths, false); try { + env.waitForManualRefresh(); fullBuild(); - + env.waitForAutoBuild(); expectingOnlySpecificProblemsFor(p1,new Problem[]{ new Problem("p1", "A cycle was detected in the build path of project 'P1'. The cycle consists of projects {P1, P2, P3}", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)//$NON-NLS-1$ //$NON-NLS-2$ }); @@ -954,6 +1003,9 @@ public void testCycle7() throws JavaModelException { } finally { JavaCore.setOptions(options); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); } } @@ -993,9 +1045,12 @@ public void testCycle7() throws JavaModelException { "public class D extends p.internal.B {\n"+ //$NON-NLS-1$ "}\n" //$NON-NLS-1$ ); - + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingSpecificProblemFor(project2Path, new Problem("", "Access restriction: The type 'B' is not API (restriction on required project 'Project1')", d, 23, 35, CategorizedProblem.CAT_RESTRICTION, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(project1Path); + env.removeProject(project2Path); } /* @@ -1033,8 +1088,9 @@ public void testCycle7() throws JavaModelException { "public class C extends p.api.A {\n"+ //$NON-NLS-1$ "}\n" //$NON-NLS-1$ ); - + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingNoProblems(); //---------------------------- @@ -1046,7 +1102,10 @@ public void testCycle7() throws JavaModelException { ); incrementalBuild(); + env.waitForAutoBuild(); expectingSpecificProblemFor(project2Path, new Problem("", "Access restriction: The type 'B' is not API (restriction on required project 'Project1')", d, 23, 35, CategorizedProblem.CAT_RESTRICTION, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(project1Path); + env.removeProject(project2Path); } /* @@ -1088,8 +1147,9 @@ public void testCycle7() throws JavaModelException { "public class D extends p.internal.B {\n"+ //$NON-NLS-1$ "}\n" //$NON-NLS-1$ ); - + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingSpecificProblemFor(project2Path, new Problem("", "Access restriction: The type 'B' is not API (restriction on required project 'Project1')", d, 23, 35, CategorizedProblem.CAT_RESTRICTION, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ //---------------------------- @@ -1099,7 +1159,10 @@ public void testCycle7() throws JavaModelException { env.addRequiredProject(project2Path, project1Path, new IPath[] {}, new IPath[] {}, false); incrementalBuild(); + env.waitForAutoBuild(); expectingNoProblems(); + env.removeProject(project1Path); + env.removeProject(project2Path); } /* @@ -1140,7 +1203,10 @@ public void testCycle7() throws JavaModelException { ); fullBuild(); + env.waitForAutoBuild(); expectingSpecificProblemFor(project2Path, new Problem("", "Access restriction: The type 'B' is not API (restriction on required project 'Project1')", d, 23, 35, CategorizedProblem.CAT_RESTRICTION, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(project1Path); + env.removeProject(project2Path); } /* @@ -1178,8 +1244,9 @@ public void testCycle7() throws JavaModelException { "public class C extends p.api.A {\n"+ //$NON-NLS-1$ "}\n" //$NON-NLS-1$ ); - + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingNoProblems(); //---------------------------- @@ -1191,7 +1258,10 @@ public void testCycle7() throws JavaModelException { ); incrementalBuild(); + env.waitForAutoBuild(); expectingSpecificProblemFor(project2Path, new Problem("", "Access restriction: The type 'B' is not API (restriction on required project 'Project1')", d, 23, 35, CategorizedProblem.CAT_RESTRICTION, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(project1Path); + env.removeProject(project2Path); } /* @@ -1233,8 +1303,9 @@ public void testCycle7() throws JavaModelException { "public class D extends p.internal.B {\n"+ //$NON-NLS-1$ "}\n" //$NON-NLS-1$ ); - + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingSpecificProblemFor(project2Path, new Problem("", "Access restriction: The type 'B' is not API (restriction on required project 'Project1')", d, 23, 35, CategorizedProblem.CAT_RESTRICTION, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ //---------------------------- @@ -1244,7 +1315,10 @@ public void testCycle7() throws JavaModelException { env.addRequiredProject(project2Path, project1Path, new IPath[] {}, new IPath[] {}, false); incrementalBuild(); + env.waitForAutoBuild(); expectingNoProblems(); + env.removeProject(project1Path); + env.removeProject(project2Path); } /* @@ -1290,9 +1364,13 @@ public void testCycle7() throws JavaModelException { "public class B extends p.A {\n"+ //$NON-NLS-1$ "}\n" //$NON-NLS-1$ ); - + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingNoProblems(); + env.removeProject(project1Path); + env.removeProject(project2Path); + env.removeProject(project3Path); } /* @@ -1338,9 +1416,13 @@ public void testCycle7() throws JavaModelException { "public class B extends p.A {\n"+ //$NON-NLS-1$ "}\n" //$NON-NLS-1$ ); - + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingSpecificProblemFor(project3Path, new Problem("", "Discouraged access: The type 'A' is not API (restriction on required project 'Project2')", b, 35, 38, CategorizedProblem.CAT_RESTRICTION, IMarker.SEVERITY_WARNING)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(project1Path); + env.removeProject(project2Path); + env.removeProject(project3Path); } public void testMissingRequiredBinaries() throws JavaModelException { @@ -1390,7 +1472,9 @@ public void testCycle7() throws JavaModelException { ); try { + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingOnlySpecificProblemsFor(p1,new Problem[]{ new Problem("p1", "The type p3.Z cannot be resolved. It is indirectly referenced from required .class files", x, 48, 49, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ @@ -1398,6 +1482,9 @@ public void testCycle7() throws JavaModelException { }); } finally { env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p1); + env.removeProject(p3); } } @@ -1416,7 +1503,9 @@ public void test100_class_folder_exported() throws JavaModelException { "public class A {\n" + "}\n" ); + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingNoProblems(); env.removePackageFragmentRoot(P1, ""); env.addClassFolder(P1, P1.append("bin"), true); @@ -1430,8 +1519,12 @@ public void test100_class_folder_exported() throws JavaModelException { "public class X {\n" + " A f;\n" + "}"); + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingNoProblems(); + env.removeProject(P1); + env.removeProject(P2); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=159118 @@ -1463,13 +1556,17 @@ public void test101_class_folder_non_exported() throws JavaModelException { "public class X {\n" + " A f;\n" + "}"); + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingSpecificProblemsFor(P2, new Problem[] { new Problem("", "The import p cannot be resolved", c, 7 , 8, CategorizedProblem.CAT_IMPORT, IMarker.SEVERITY_ERROR), new Problem("", "A cannot be resolved to a type", c, 31 , 32, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)}); + env.removeProject(P1); + env.removeProject(P2); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=164622 @@ -1514,7 +1611,9 @@ public void test102_missing_required_binaries() throws JavaModelException { ); try { + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingOnlySpecificProblemsFor(p3, new Problem[]{ new Problem("p3", "The project was not built since its build path is incomplete. Cannot find the class file for I. Fix the build path then try building this project", @@ -1525,6 +1624,9 @@ public void test102_missing_required_binaries() throws JavaModelException { }); } finally { env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); } } @@ -1571,7 +1673,9 @@ public void test103_missing_required_binaries() throws JavaModelException { ); try { + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingOnlySpecificProblemsFor(p3, new Problem[]{ new Problem("p3", "The project was not built since its build path is incomplete. Cannot find the class file for I. Fix the build path then try building this project", @@ -1582,6 +1686,10 @@ public void test103_missing_required_binaries() throws JavaModelException { }); } finally { env.setBuildOrder(null); + env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); } } @@ -1644,16 +1752,24 @@ public void test104_missing_required_binaries() throws CoreException { ); try { + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingNoProblems(); IFile gcaFile = (IFile) env.getWorkspace().getRoot().findMember(gca); gcaFile.touch(null); + env.waitForManualRefresh(); incrementalBuild(p2); + env.waitForAutoBuild(); expectingNoProblems(); } finally { env.setBuildOrder(null); + env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p0); } } @@ -1715,8 +1831,13 @@ public void test438923() throws JavaModelException { // for Project1 env.addRequiredProject(p2, p1); env.addRequiredProject(p3, p2); - + env.waitForManualRefresh(); fullBuild(); + env.waitForAutoBuild(); expectingNoProblems(); + env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); } } |