Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[performance] AbstractJavaModelTests: avoid needless sleep #3525

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2324,21 +2324,21 @@ public void run(IProgressMonitor monitor) throws CoreException {
IProject sameProject = getWorkspaceRoot().getProject(projectName);
assertEquals("Returned project doesn't match same project from workspace: " + sameProject + " vs " + project, sameProject, project);

List<IJavaProject> javaProjects = List.of(getJavaModel().getJavaProjects());
boolean foundInModel = javaProjects.stream().anyMatch(p -> projectName.equals(p.getElementName()));
if (!foundInModel) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
waitForAutoBuild();
waitForManualRefresh();
javaProjects = List.of(getJavaModel().getJavaProjects());
foundInModel = javaProjects.stream().anyMatch(p -> projectName.equals(p.getElementName()));
}
boolean isNestedWorkspaceCall = isWorkspaceRuleAlreadyInUse(getWorkspaceRoot());
if (!isNestedWorkspaceCall) {
List<IJavaProject> javaProjects = List.of(getJavaModel().getJavaProjects());
boolean foundInModel = javaProjects.stream().anyMatch(p -> projectName.equals(p.getElementName()));
if (!foundInModel) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
waitForAutoBuild();
waitForManualRefresh();
javaProjects = List.of(getJavaModel().getJavaProjects());
foundInModel = javaProjects.stream().anyMatch(p -> projectName.equals(p.getElementName()));
}
assertTrue("Project '" + projectName + "' should be present in JavaModel, but we found only: " + javaProjects, foundInModel);
} else {
// No assert here, caller has to check it *after* the workspace task
Expand Down
Loading