Skip to content
Merged
Show file tree
Hide file tree
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 @@ -57,12 +57,12 @@
import org.eclipse.core.tests.harness.TestBarrier2;
import org.eclipse.core.tests.harness.TestJob;
import org.eclipse.core.tests.resources.util.WorkspaceResetExtension;
import org.junit.function.ThrowingRunnable;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.function.Executable;

/**
* This class tests public API related to building and to build specifications.
Expand Down Expand Up @@ -553,7 +553,7 @@ public void testChangeDynamicBuildOrderDuringPreBuild() throws Throwable {
// Ensure the builder is instantiated
workspace.build(IncrementalProjectBuilder.FULL_BUILD, createTestMonitor());

final AtomicReference<ThrowingRunnable> exceptionInMainThreadCallback = new AtomicReference<>(
final AtomicReference<Executable> exceptionInMainThreadCallback = new AtomicReference<>(
Function::identity);

// Add pre-build listener that swap around the dependencies
Expand Down Expand Up @@ -614,7 +614,7 @@ public void testChangeDynamicBuildOrderDuringPreBuild() throws Throwable {
verifier.assertLifecycleEvents();
verifier.reset();

exceptionInMainThreadCallback.get().run();
exceptionInMainThreadCallback.get().execute();
} finally {
getWorkspace().removeResourceChangeListener(buildListener);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
import org.eclipse.core.tests.internal.builders.TestBuilder.BuilderRuleCallback;
import org.eclipse.core.tests.resources.TestUtil;
import org.eclipse.core.tests.resources.util.WorkspaceResetExtension;
import org.junit.function.ThrowingRunnable;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.function.Executable;

/**
* This class tests extended functionality (since 3.6) which allows
Expand Down Expand Up @@ -140,7 +140,7 @@ public IProject[] build(int kind, Map<String, String> args, IProgressMonitor mon
}
});

final AtomicReference<ThrowingRunnable> exceptionInMainThreadCallback = new AtomicReference<>(Function::identity);
final AtomicReference<Executable> exceptionInMainThreadCallback = new AtomicReference<>(Function::identity);
Job j = new Job("build job") {
@Override
protected IStatus run(IProgressMonitor monitor) {
Expand All @@ -167,7 +167,7 @@ protected IStatus run(IProgressMonitor monitor) {
j.cancel();
tb.waitForStatus(TestBarrier2.STATUS_DONE);

exceptionInMainThreadCallback.get().run();
exceptionInMainThreadCallback.get().execute();
}

/**
Expand Down Expand Up @@ -238,7 +238,7 @@ public IProject[] build(int kind, Map<String, String> args, IProgressMonitor mon
}
});

final AtomicReference<ThrowingRunnable> exceptionInMainThreadCallback = new AtomicReference<>(
final AtomicReference<Executable> exceptionInMainThreadCallback = new AtomicReference<>(
Function::identity);
// Run the build
Job j = new Job("build job1") {
Expand Down Expand Up @@ -266,7 +266,7 @@ protected IStatus run(IProgressMonitor monitor) {
tb2.setStatus(TestBarrier2.STATUS_WAIT_FOR_DONE);
tb2.waitForStatus(TestBarrier2.STATUS_DONE);

exceptionInMainThreadCallback.get().run();
exceptionInMainThreadCallback.get().execute();
}

HashSet<ISchedulingRule> getRulesAsSet(ISchedulingRule rule) {
Expand Down Expand Up @@ -523,7 +523,7 @@ public IProject[] build(int kind, Map<String, String> args, IProgressMonitor mon
// };
// invokeTestBug343256(project, getRules, buildRules, tb1, tb2, j);

final AtomicReference<ThrowingRunnable> exceptionInMainThreadCallback = new AtomicReference<>(
final AtomicReference<Executable> exceptionInMainThreadCallback = new AtomicReference<>(
Function::identity);
// IWorkspace.build(IBuildConfiguration[],...)
j = new Job("IWorkspace.build(IBuildConfiguration[],...)") {
Expand All @@ -541,7 +541,7 @@ protected IStatus run(IProgressMonitor monitor) {
};
invokeTestBug343256(project, getRules, buildRules, tb1, tb2, j);

exceptionInMainThreadCallback.get().run();
exceptionInMainThreadCallback.get().execute();
// Test Auto-build
// j = new Job("Auto-build") {
// protected IStatus run(IProgressMonitor monitor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.tests.resources.util.FileStoreAutoDeleteExtension;
import org.junit.function.ThrowingRunnable;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.api.function.Executable;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
Expand Down Expand Up @@ -102,7 +102,7 @@ public void resourceChanged(IResourceChangeEvent event) {
}
}

private static final ThrowingRunnable NOOP_RUNNABLE = () -> {
private static final Executable NOOP_RUNNABLE = () -> {
};
protected static final String VERIFIER_NAME = "TestListener";
IFile file1; //below folder1
Expand Down Expand Up @@ -272,7 +272,7 @@ public void tearDown() throws Exception {
*/
@Test
public void test_1GDK9OG() throws Throwable {
final AtomicReference<ThrowingRunnable> listenerInMainThreadCallback = new AtomicReference<>(NOOP_RUNNABLE);
final AtomicReference<Executable> listenerInMainThreadCallback = new AtomicReference<>(NOOP_RUNNABLE);
// create the resource change listener
IResourceChangeListener listener = event -> {
try {
Expand Down Expand Up @@ -324,7 +324,7 @@ public void run(IProgressMonitor monitor) throws CoreException {
// cleanup: ensure that the listener is removed
getWorkspace().removeResourceChangeListener(listener);
}
listenerInMainThreadCallback.get().run();
listenerInMainThreadCallback.get().execute();
}

@Test
Expand Down Expand Up @@ -403,7 +403,7 @@ public void testAddProject() throws CoreException {
*/
@Test
public void testBug45996() throws Throwable {
final AtomicReference<ThrowingRunnable> listenerInMainThreadCallback = new AtomicReference<>(NOOP_RUNNABLE);
final AtomicReference<Executable> listenerInMainThreadCallback = new AtomicReference<>(NOOP_RUNNABLE);
// create the resource change listener
IResourceChangeListener listener = event -> {
try {
Expand Down Expand Up @@ -447,7 +447,7 @@ public void run(IProgressMonitor monitor) throws CoreException {
// cleanup: ensure that the listener is removed
getWorkspace().removeResourceChangeListener(listener);
}
listenerInMainThreadCallback.get().run();
listenerInMainThreadCallback.get().execute();
}

@Test
Expand Down Expand Up @@ -721,7 +721,7 @@ public void testDeleteMoveFile() throws CoreException {

@Test
public void testDeleteProject() throws Throwable {
final AtomicReference<ThrowingRunnable> listenerInMainThreadCallback = new AtomicReference<>(NOOP_RUNNABLE);
final AtomicReference<Executable> listenerInMainThreadCallback = new AtomicReference<>(NOOP_RUNNABLE);
//test that marker deltas are fired when projects are deleted
verifier.reset();
final IMarker marker = project1.createMarker(IMarker.TASK);
Expand Down Expand Up @@ -760,7 +760,7 @@ public void resourceChanged(IResourceChangeEvent event) {
} finally {
getWorkspace().removeResourceChangeListener(listener);
}
listenerInMainThreadCallback.get().run();
listenerInMainThreadCallback.get().execute();
}

@Test
Expand Down Expand Up @@ -968,16 +968,16 @@ public void resourceChanged(final IResourceChangeEvent event) {
*/
@Test
public void testHiddenPhantomChanges() throws Throwable {
final AtomicReference<ThrowingRunnable> listenerInMainThreadCallback = new AtomicReference<>(NOOP_RUNNABLE);
final AtomicReference<Executable> listenerInMainThreadCallback = new AtomicReference<>(NOOP_RUNNABLE);
final IWorkspace workspace = getWorkspace();
final IFolder phantomFolder = project1.getFolder("PhantomFolder");
final IFile phantomFile = folder1.getFile("PhantomFile");
final IResource[] phantomResources = new IResource[] {phantomFolder, phantomFile};
final QualifiedName partner = new QualifiedName("Test", "Infected");
IResourceChangeListener listener = event -> {
ThrowingRunnable oldCallback = listenerInMainThreadCallback.get();
Executable oldCallback = listenerInMainThreadCallback.get();
listenerInMainThreadCallback.set(() -> {
oldCallback.run();
oldCallback.execute();
// make sure the delta doesn't include the phantom members
assertNotDeltaIncludes(event.getDelta(), phantomResources);
// make sure a visitor does not find phantom members
Expand Down Expand Up @@ -1011,7 +1011,7 @@ public void testHiddenPhantomChanges() throws Throwable {
} finally {
workspace.removeResourceChangeListener(listener);
}
listenerInMainThreadCallback.get().run();
listenerInMainThreadCallback.get().execute();
}

/**
Expand All @@ -1020,15 +1020,15 @@ public void testHiddenPhantomChanges() throws Throwable {
*/
@Test
public void testHiddenTeamPrivateChanges() throws Throwable {
final AtomicReference<ThrowingRunnable> listenerInMainThreadCallback = new AtomicReference<>(NOOP_RUNNABLE);
final AtomicReference<Executable> listenerInMainThreadCallback = new AtomicReference<>(NOOP_RUNNABLE);
IWorkspace workspace = getWorkspace();
final IFolder teamPrivateFolder = project1.getFolder("TeamPrivateFolder");
final IFile teamPrivateFile = folder1.getFile("TeamPrivateFile");
final IResource[] privateResources = new IResource[] {teamPrivateFolder, teamPrivateFile};
IResourceChangeListener listener = event -> {
ThrowingRunnable oldCallback = listenerInMainThreadCallback.get();
Executable oldCallback = listenerInMainThreadCallback.get();
listenerInMainThreadCallback.set(() -> {
oldCallback.run();
oldCallback.execute();
// make sure the delta doesn't include the team private members
assertNotDeltaIncludes(event.getDelta(), privateResources);
// make sure a visitor does not find team private members
Expand Down Expand Up @@ -1066,7 +1066,7 @@ public void testHiddenTeamPrivateChanges() throws Throwable {
} finally {
workspace.removeResourceChangeListener(listener);
}
listenerInMainThreadCallback.get().run();
listenerInMainThreadCallback.get().execute();
}

@Test
Expand Down Expand Up @@ -1321,7 +1321,7 @@ public void resourceChanged(IResourceChangeEvent event) {

@Test
public void testAutoPublishService() throws Throwable {
final AtomicReference<ThrowingRunnable> logListenerInMainThreadCallback = new AtomicReference<>(NOOP_RUNNABLE);
final AtomicReference<Executable> logListenerInMainThreadCallback = new AtomicReference<>(NOOP_RUNNABLE);
class Loggy implements LogListener {
public boolean done = false;
@Override
Expand Down Expand Up @@ -1392,7 +1392,7 @@ public void resourceChanged(IResourceChangeEvent event) {
assertEquals(IResourceChangeEvent.POST_CHANGE, listener1.eventType);
assertEquals(IResourceChangeEvent.POST_BUILD, listener2.eventType);
assertEquals(IResourceChangeEvent.POST_CHANGE, listener3.eventType);
logListenerInMainThreadCallback.get().run();
logListenerInMainThreadCallback.get().execute();
}

public boolean waitUntil(BooleanSupplier condition) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
import org.eclipse.core.internal.filesystem.local.LocalFileNativesManager;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.tests.harness.PerformanceTestRunner;
import org.junit.function.ThrowingRunnable;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.function.Executable;

/**
* Benchmarks basic operations on the IFileStore interface
Expand Down Expand Up @@ -109,11 +109,11 @@ public void testStoreNotExitsNio() throws Throwable {
});
}

private static void withNatives(boolean natives, ThrowingRunnable runnable) throws Throwable {
private static void withNatives(boolean natives, Executable runnable) throws Throwable {
try {
assertEquals(natives, LocalFileNativesManager.setUsingNative(natives),
"can't set natives to the desired value");
runnable.run();
runnable.execute();
} finally {
LocalFileNativesManager.reset();
}
Expand Down
Loading