Skip to content
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 @@ -44,6 +44,7 @@
import java.util.Vector;
import java.util.concurrent.atomic.AtomicReference;
import org.assertj.core.api.ObjectAssert;
import org.eclipse.core.internal.resources.ContentDescriptionManager;
import org.eclipse.core.internal.resources.MarkerManager;
import org.eclipse.core.internal.resources.MarkerReader;
import org.eclipse.core.internal.resources.Resource;
Expand Down Expand Up @@ -208,6 +209,8 @@ public void setUp() throws Exception {
prefs.putBoolean(ResourcesPlugin.PREF_AUTO_REFRESH, false);
Job.getJobManager().wakeUp(ResourcesPlugin.FAMILY_AUTO_REFRESH);
Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_REFRESH, null);
ResourcesPlugin.getWorkspace().addResourceChangeListener(LOG_RESOURCE_DELTA);
cancelAndJoin(ContentDescriptionManager.FAMILY_DESCRIPTION_CACHE_FLUSH);
}


Expand Down Expand Up @@ -958,7 +961,6 @@ public void testMarkerDeltasMoveFolder(TestInfo testInfo) throws CoreException {
*/
@Test
public void testMarkerDeltasMoveFile(TestInfo testInfo) throws CoreException {
ResourcesPlugin.getWorkspace().addResourceChangeListener(LOG_RESOURCE_DELTA);
IWorkspaceRoot root = getWorkspace().getRoot();
final IProject project = root.getProject("MyProject");
IFolder folder = project.getFolder("folder");
Expand Down Expand Up @@ -1006,7 +1008,7 @@ public void testMarkerDeltasMoveFile(TestInfo testInfo) throws CoreException {
* Tests the appearance of marker changes in the resource delta.
*/
@Test
public void testMarkerDeltasMoveProject() throws CoreException {
public void testMarkerDeltasMoveProject() throws Exception {
// Create and register a listener.
final MarkersChangeListener listener = new MarkersChangeListener();
setResourceChangeListener(listener);
Expand Down Expand Up @@ -1036,6 +1038,7 @@ public void testMarkerDeltasMoveProject() throws CoreException {
IPath destination = IPath.fromOSString(project.getName() + "move");
project.move(destination, true, createTestMonitor());
}
cancelAndJoin(ContentDescriptionManager.FAMILY_DESCRIPTION_CACHE_FLUSH);

// verify marker deltas
IResourceVisitor visitor = resource -> {
Expand Down Expand Up @@ -1393,6 +1396,11 @@ public void testSetGetAttribute2() throws CoreException {
}
}

private static void cancelAndJoin(Object family) throws Exception {
Job.getJobManager().cancel(family);
Job.getJobManager().join(family, null);
}

private static void logDeltaEvent(IResourceChangeEvent event) {
StringBuilder s = new StringBuilder();
s.append("Logging resource change event");
Expand Down
Loading