Skip to content

Commit

Permalink
[FLINK-32843][JUnit5 Migration] Remove the TestingComponentMainThread…
Browse files Browse the repository at this point in the history
…Executor.Resource
  • Loading branch information
RocMarshal committed Apr 27, 2024
1 parent d6499fc commit bf8d5cf
Showing 1 changed file with 0 additions and 40 deletions.
Expand Up @@ -28,7 +28,6 @@
import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.rules.ExternalResource;

import javax.annotation.Nonnull;

Expand Down Expand Up @@ -72,45 +71,6 @@ public ComponentMainThreadExecutor getMainThreadExecutor() {
return mainThreadExecutor;
}

/**
* @deprecated Use {@link TestingComponentMainThreadExecutor.Extension} instead. Test resource
* for convenience.
*/
@Deprecated
public static class Resource extends ExternalResource {

private long shutdownTimeoutMillis;
private TestingComponentMainThreadExecutor componentMainThreadTestExecutor;
private ScheduledExecutorService innerExecutorService;

public Resource() {
this(500L);
}

public Resource(long shutdownTimeoutMillis) {
this.shutdownTimeoutMillis = shutdownTimeoutMillis;
}

@Override
protected void before() {
this.innerExecutorService = Executors.newSingleThreadScheduledExecutor();
this.componentMainThreadTestExecutor =
new TestingComponentMainThreadExecutor(
ComponentMainThreadExecutorServiceAdapter.forSingleThreadExecutor(
innerExecutorService));
}

@Override
protected void after() {
ExecutorUtils.gracefulShutdown(
shutdownTimeoutMillis, TimeUnit.MILLISECONDS, innerExecutorService);
}

public TestingComponentMainThreadExecutor getComponentMainThreadTestExecutor() {
return componentMainThreadTestExecutor;
}
}

/** Test extension for convenience. */
public static class Extension implements BeforeAllCallback, AfterAllCallback {
private final long shutdownTimeoutMillis;
Expand Down

0 comments on commit bf8d5cf

Please sign in to comment.