Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
270,300
void () { List<Integer> disposeLog = new ArrayList<>(); List<Integer> childLog = new ArrayList<>(); for (int i = 0; i < 3; i++) { int taskId = i; myQueue.addTask(new TaskWithEquivalentObject("child") { @Override public void perform(@NotNull ProgressIndicator indicator) { childLog.add(taskId); } @Override public void di...
testNewTaskIsRunWhenMerged
270,301
void (@NotNull ProgressIndicator indicator) { childLog.add(taskId); }
perform
270,302
void () { disposeLog.add(taskId); }
dispose
270,303
void () { List<String> disposeLog = new ArrayList<>(); List<String> childLog = new ArrayList<>(); class TaskWithId implements MergeableQueueTask<TaskWithId> { protected final String taskId; TaskWithId(String taskId) { this.taskId = taskId; } @Override public void perform(@NotNull ProgressIndicator indicator) { childLog...
testMergedTaskIsRunWhenMerged
270,304
void (@NotNull ProgressIndicator indicator) { childLog.add(taskId); }
perform
270,305
void () { disposeLog.add(taskId); }
dispose
270,306
TaskWithId (@NotNull TaskWithId taskFromQueue) { String newId = taskFromQueue.taskId + " " + taskId; return new TaskWithId(newId); }
tryMergeWith
270,307
void () { List<Integer> disposeLog = new ArrayList<>(); List<Integer> childLog = new ArrayList<>(); MergeableQueueTask<?> task = new LoggingTask(1, childLog, disposeLog); myQueue.addTask(task); myQueue.cancelTask(task); runAllTasks(); Assert.assertEquals("Cancelled task must not run " + childLog, Collections.emptyList(...
testCancelledTask
270,308
void () { List<Integer> disposeLog = new ArrayList<>(); List<Integer> childLog = new ArrayList<>(); for (int i = 0; i < 3; i++) { int taskId = i; myQueue.addTask(new TaskWithEquivalentObject("child") { @Override public void perform(@NotNull ProgressIndicator indicator) { childLog.add(taskId); } @Override public void di...
testMergedTaskShouldDispose
270,309
void (@NotNull ProgressIndicator indicator) { childLog.add(taskId); }
perform
270,310
void () { disposeLog.add(taskId); }
dispose
270,311
void () { List<Integer> disposeLog = new ArrayList<>(); List<Integer> childLog = new ArrayList<>(); TaskWithEquivalentObject task = new TaskWithEquivalentObject("child") { @Override public void perform(@NotNull ProgressIndicator indicator) { childLog.add(1); } @Override public void dispose() { disposeLog.add(1); } }; m...
testTasksAreDisposed
270,312
void (@NotNull ProgressIndicator indicator) { childLog.add(1); }
perform
270,313
void () { disposeLog.add(1); }
dispose
270,314
void () { List<Integer> disposeLog = new ArrayList<>(); List<Integer> childLog = new ArrayList<>(); for (int i = 1; i <= 3; i++) { int taskId = i; myQueue.addTask(new TaskWithEquivalentObject("child") { @Override public void perform(@NotNull ProgressIndicator indicator) { childLog.add(taskId); } @Override public void d...
testMergedTasksShouldNotReserveEarlierSlots
270,315
void (@NotNull ProgressIndicator indicator) { childLog.add(taskId); }
perform
270,316
void () { disposeLog.add(taskId); }
dispose
270,317
void (@NotNull ProgressIndicator indicator) { childLog.add(-taskId); }
perform
270,318
void () { disposeLog.add(-taskId); }
dispose
270,319
void () { AtomicReference<Boolean> isDisposed = new AtomicReference<>(); myQueue.addTask(new TaskWithEquivalentObject("any") { @Override public void perform(@NotNull ProgressIndicator indicator) { } @Override public void dispose() { isDisposed.set(true); } }); MergingTaskQueue.QueuedTask<?> task = myQueue.extractNextTa...
testRunningTaskShouldNotBeDisposed
270,320
void (@NotNull ProgressIndicator indicator) { }
perform
270,321
void () { isDisposed.set(true); }
dispose
270,322
void () { CyclicBarrier b = new CyclicBarrier(2); AtomicReference<Boolean> isRun = new AtomicReference<>(); myQueue.addTask(new TaskWithEquivalentObject("any") { @Override public void perform(@NotNull ProgressIndicator indicator) { for (int i = 0; i < 2; i++) { await(b); } isRun.set(indicator.isCanceled()); } }); Threa...
testRunningTaskIndicatorShouldBeCancelledOnDisposeRunningTasks
270,323
void (@NotNull ProgressIndicator indicator) { for (int i = 0; i < 2; i++) { await(b); } isRun.set(indicator.isCanceled()); }
perform
270,324
void () { for (int i = 0; i < 1000; i++) { TaskWithEquivalentObject task = new TaskWithEquivalentObject("q-" + i) { @Override public void perform(@NotNull ProgressIndicator indicator) { } }; myQueue.addTask(task); if (i % 3 == 0) { Disposer.dispose(task); } if (i % 3 == 1) { myQueue.cancelTask(task); } } runAllTasks();...
testNoLeaks
270,325
void (@NotNull ProgressIndicator indicator) { }
perform
270,326
void () { final AtomicBoolean myDisposeFlag = new AtomicBoolean(false); TaskWithEquivalentObject task = new TaskWithEquivalentObject(this) { @Override public void perform(@NotNull ProgressIndicator indicator) { } @Override public void dispose() { myDisposeFlag.set(true); } }; myQueue.addTask(task); myQueue.disposePendi...
testNoDisposeLeaksOnClose
270,327
void (@NotNull ProgressIndicator indicator) { }
perform
270,328
void () { myDisposeFlag.set(true); }
dispose
270,329
void () { final AtomicBoolean myDisposeFlag = new AtomicBoolean(false); TaskWithEquivalentObject task = new TaskWithEquivalentObject(this) { @Override public void perform(@NotNull ProgressIndicator indicator) { } @Override public void dispose() { myDisposeFlag.set(true); } }; myQueue.addTask(task); myQueue.cancelAllTas...
testNoDisposeLeaksOnClose2
270,330
void (@NotNull ProgressIndicator indicator) { }
perform
270,331
void () { myDisposeFlag.set(true); }
dispose
270,332
void () { final AtomicBoolean myDisposeFlag = new AtomicBoolean(false); TaskWithEquivalentObject task = new TaskWithEquivalentObject(this) { @Override public void perform(@NotNull ProgressIndicator indicator) { } @Override public void dispose() { myDisposeFlag.set(true); } }; myQueue.addTask(task); myQueue.cancelTask(t...
testNoDisposeLeaksOnClose3
270,333
void (@NotNull ProgressIndicator indicator) { }
perform
270,334
void () { myDisposeFlag.set(true); }
dispose
270,335
void () { AtomicInteger counter = new AtomicInteger(0); Random random = new Random(); Supplier<LoggingTask> taskFactory = () -> new LoggingTask(counter.incrementAndGet(), (thiz, other) -> { return switch (random.nextInt(4)) { case 0 -> thiz; case 1 -> other; case 2 -> new LoggingTask(counter.incrementAndGet(), thiz.try...
testSubmittedTasksCounterDoesNotDecrease
270,336
void () { SubmissionReceipt receiptWhenAdded = myQueue.addTask(new LoggingTask(1, null, null)); SubmissionReceipt receiptWhenQueried = myQueue.getLatestSubmissionReceipt(); assertEquals(receiptWhenAdded, receiptWhenQueried); assertFalse(receiptWhenAdded.isAfter(receiptWhenQueried)); assertFalse(receiptWhenQueried.isAft...
testGetLatestSubmissionReceipt
270,337
void (@NotNull CyclicBarrier b) { try { b.await(); } catch (Exception e) { LOG.error(e); } }
await
270,338
void () { while (true) { try (MergingTaskQueue.QueuedTask<?> nextTask = myQueue.extractNextTask()) { if (nextTask == null) return; nextTask.executeTask(); } } }
runAllTasks
270,339
void () { /////////////////// try order: parent,child ///////////////////////// List<Integer> executedTasks = new ArrayList<>(); ParentTask parent = new ParentTask(1, executedTasks); ChildTask child = new ChildTask(2, executedTasks); myQueue.addTask(parent); myQueue.addTask(child); runAllTasks(); // Parent should not b...
testTasksFromTheSameClassHierarchyAlwaysMergedFromChildSide
270,340
void () { myConfigurable = new HttpConfigurable(); myConfigurable.USE_HTTP_PROXY = true; myConfigurable.PROXY_TYPE_IS_SOCKS = false; myConfigurable.PROXY_HOST = "proxy"; myConfigurable.PROXY_PORT = 1234; mySelector = new IdeaWideProxySelector(myConfigurable); }
setUp
270,341
void (@NotNull Project project, boolean isSave) { if (isSave) { StoreUtil.saveSettings(project, true); } PlatformTestUtil.forceCloseProjectWithoutSaving(project); }
closeProject
270,342
void () { Object same = new Object(); CancellablePromise<String> promise = WriteAction.compute(() -> { CancellablePromise<String> promise1 = ReadAction.nonBlocking(() -> "y").coalesceBy(same).submit(AppExecutorUtil.getAppExecutorService()); assertFalse(promise1.isCancelled()); CancellablePromise<String> promise2 = Read...
testCoalesceEqual
270,343
void () { Pair<CancellablePromise<String>, CancellablePromise<String>> promises = WriteAction.compute( () -> Pair.create(ReadAction.nonBlocking(() -> "x").coalesceBy(new Object()).submit(AppExecutorUtil.getAppExecutorService()), ReadAction.nonBlocking(() -> "y").coalesceBy(new Object()).submit(AppExecutorUtil.getAppExe...
testDoNotCoalesceDifferent
270,344
void () { ProgressIndicator outerIndicator = new EmptyProgressIndicator(); CancellablePromise<Object> promise = ReadAction .nonBlocking(() -> { //noinspection InfiniteLoopStatement while (true) { ProgressManager.getInstance().getProgressIndicator().checkCanceled(); } }) .wrapProgress(outerIndicator) .submit(AppExecutor...
testStopExecutionWhenOuterProgressIndicatorStopped
270,345
void () { ProgressIndicator outerIndicator = new ProgressIndicatorBase(); outerIndicator.setIndeterminate(false); waitForPromise(ReadAction .nonBlocking(() -> { ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); indicator.setText("X"); indicator.setFraction(0.5); assertEquals("X", outer...
testPropagateVisualChangesToOuterIndicator
270,346
void () { int count = 1000; AtomicInteger executionCount = new AtomicInteger(); Executor countingExecutor = r -> AppExecutorUtil.getAppExecutorService().execute(() -> { executionCount.incrementAndGet(); r.run(); }); List<CancellablePromise<?>> submissions = new ArrayList<>(); WriteAction.run(() -> { for (int i = 0; i <...
testDoNotSpawnZillionThreadsForManyCoalescedSubmissions
270,347
void () { AtomicInteger executionCount = new AtomicInteger(); Executor executor = r -> { executionCount.incrementAndGet(); AppExecutorUtil.getAppExecutorService().execute(r); }; assertEquals("x", waitForPromise(WriteAction.compute(() -> { Promise<String> promise = ReadAction.nonBlocking(() -> "x").submit(executor); ass...
testDoNotSubmitToExecutorUntilWriteActionFinishes
270,348
void () { NonBlockingReadAction<Void> ra = ReadAction.nonBlocking(() -> {}); String shouldBeUnique = "Equality should be unique"; assertThrows(IllegalArgumentException.class, shouldBeUnique, () -> { ra.coalesceBy((Object)null); }); assertThrows(IllegalArgumentException.class, shouldBeUnique, () -> { ra.coalesceBy(getPr...
testProhibitCoalescingByCommonObjects
270,349
void () { //RC: current implementation treat lambdas from the same class as 'same place' -- i.e. they are OK to use // with same .coalesceBy key. Hence the need to create the Inner class here -- to clearly show 'those 2 lambdas // are of different origins': DefaultLogger.disableStderrDumping(getTestRootDisposable()); O...
testReportConflictForSameCoalesceFromDifferentPlaces
270,350
void () { Object leak = new Object() { }; Disposable disposable = Disposer.newDisposable(); Disposer.dispose(disposable); try { CancellablePromise<String> p = ReadAction .nonBlocking(() -> "a") .expireWith(disposable) .coalesceBy(leak) .submit(AppExecutorUtil.getAppExecutorService()); assertTrue(p.isCancelled()); LeakH...
testDoNotLeakFirstCancelledCoalescedAction
270,351
void () { ProgressIndicator outerIndicator = new EmptyProgressIndicator(); Disposable disposable = Disposer.newDisposable(); try { Future<?> future = ApplicationManager.getApplication().executeOnPooledThread(() -> { assertThrows(ProcessCanceledException.class, () -> { ReadAction.nonBlocking(() -> { outerIndicator.cance...
testDoNotLeakDisposablesOnCancelledIndicator
270,352
void () { setupUncommittedDocument(); AtomicBoolean started = new AtomicBoolean(); Future<?> future = ApplicationManager.getApplication().executeOnPooledThread(() -> { String s = ReadAction.nonBlocking(() -> { started.set(true); return ""; }).withDocumentsCommitted(getProject()).executeSynchronously(); assertEquals("",...
testSyncExecutionHonorsConstraints
270,353
void () { ((PsiDocumentManagerImpl)PsiDocumentManager.getInstance(getProject())).disableBackgroundCommit(getTestRootDisposable()); PsiFile file = createFile("a.txt", ""); WriteCommandAction.runWriteCommandAction(getProject(), () -> file.getViewProvider().getDocument().insertString(0, "a")); }
setupUncommittedDocument
270,354
void (Future<?> future) { PlatformTestUtil.waitForFuture(future, 1000); }
waitForFuture
270,355
void () { Disposable disposable = Disposer.newDisposable(); Disposer.dispose(disposable); Future<?> future = ApplicationManager.getApplication().executeOnPooledThread(() -> { assertThrows(ProcessCanceledException.class, () -> { ReadAction.nonBlocking(() -> "").expireWhen(() -> true).executeSynchronously(); }); assertTh...
testSyncExecutionThrowsPCEWhenExpired
270,356
void () { AtomicInteger attemptCount = new AtomicInteger(); int limit = 10; Future<?> future = ApplicationManager.getApplication().executeOnPooledThread(() -> { assertEquals("a", ReadAction.nonBlocking(() -> { if (attemptCount.incrementAndGet() < limit) { //noinspection InfiniteLoopStatement while (true) { ProgressMana...
testSyncExecutionIsCancellable
270,357
void () { waitForFuture(ApplicationManager.getApplication().executeOnPooledThread(() -> { ReadAction.run(() -> assertEquals("a", ReadAction.nonBlocking(() -> "a").executeSynchronously())); })); }
testSyncExecutionWorksInsideReadAction
270,358
void () { setupUncommittedDocument(); waitForFuture(ApplicationManager.getApplication().executeOnPooledThread(() -> { ReadAction.run(() -> { assertThrows(IllegalStateException.class, "cannot be satisfied", () -> ReadAction.nonBlocking(() -> "a").withDocumentsCommitted(getProject()).executeSynchronously()); }); })); }
testSyncExecutionFailsInsideReadActionWhenConstraintsAreNotSatisfied
270,359
void () { setupUncommittedDocument(); Semaphore mayStartWrite = new Semaphore(1); Future<?> future = ApplicationManager.getApplication().executeOnPooledThread(() -> { ReadAction.run(() -> { mayStartWrite.up(); assertEquals("a", ReadAction.nonBlocking(() -> { return "a"; }).executeSynchronously()); }); }); assertTrue(ma...
testSyncExecutionCompletesInsideReadActionWhenWriteActionIsPending
270,360
void () { ProgressIndicatorBase outer = new ProgressIndicatorBase(); waitForFuture(ApplicationManager.getApplication().executeOnPooledThread(() -> { ProgressManager.getInstance().runProcess(() -> { assertThrows(ProcessCanceledException.class, () -> { ReadAction.nonBlocking(() -> { outer.cancel(); ProgressManager.checkC...
testSyncExecutionThrowsPCEWhenOuterIndicatorIsCanceled
270,361
void () { PlatformTestUtil.startPerformanceTest("NBRA cancellation", 500, () -> { WriteAction.run(() -> { for (int i = 0; i < 100_000; i++) { ReadAction.nonBlocking(() -> {}).coalesceBy(this).submit(AppExecutorUtil.getAppExecutorService()).cancel(); } }); }).assertTiming(); }
testCancellationPerformance
270,362
void () { watchLoggedExceptions(loggedError -> { // unchecked is rethrown assertThrows(UnsupportedOperationException.class, () -> ReadAction.nonBlocking(() -> { throw new UnsupportedOperationException(); }).executeSynchronously()); assertNull(loggedError.get()); // checked is wrapped assertThrows(ExecutionException.cla...
testDoNotLogSyncExceptions
270,363
void (Consumer<? super AtomicReference<Throwable>> runnable) { AtomicReference<Throwable> loggedError = new AtomicReference<>(); LoggedErrorProcessor.executeWith(new LoggedErrorProcessor() { @Override public @NotNull Set<Action> processError(@NotNull String category, @NotNull String message, String @NotNull [] details,...
watchLoggedExceptions
270,364
Set<Action> (@NotNull String category, @NotNull String message, String @NotNull [] details, @Nullable Throwable t) { assertNotNull(t); loggedError.set(t); return Action.NONE; }
processError
270,365
void (CancellablePromise<Object> promise, AtomicReference<Throwable> loggedError, BoundedTaskExecutor executor) { Throwable cause = null; try { waitForFuture(promise); } catch (Throwable e) { cause = ExceptionUtil.getRootCause(e); } assertInstanceOf(cause, UnsupportedOperationException.class); try { executor.waitAllTas...
assertLogsAndThrowsUOE
270,366
void () { AtomicInteger count = new AtomicInteger(); Callable<String> computation = () -> { if (count.incrementAndGet() < 10) { throw new ServiceNotReadyException(); } return "x"; }; CancellablePromise<String> future1 = ReadAction.nonBlocking(computation).submit(AppExecutorUtil.getAppExecutorService()); assertEquals("x...
testTryAgainOnServiceNotReadyException
270,367
void () { DefaultLogger.disableStderrDumping(getTestRootDisposable()); assertThrows(Throwable.class, SubmissionTracker.ARE_CURRENTLY_ACTIVE, () -> { WriteAction.run(() -> { for (int i = 0; i < 1000; i++) { ReadAction.nonBlocking(() -> {}).submit(AppExecutorUtil.getAppExecutorService()); } }); }); }
testReportTooManyUnboundedCalls
270,368
void () { ExecutorService executor = AppExecutorUtil.createBoundedApplicationPoolExecutor(StringUtil.capitalize(getName()), 10); for (int i = 0; i < 50; i++) { List<Disposable> parents = IntStreamEx.range(100).mapToObj(__ -> Disposer.newDisposable()).toList(); List<Future<?>> futures = new ArrayList<>(); for (Disposabl...
test_submit_doesNot_fail_without_readAction_when_parent_isDisposed
270,369
void () { ExecutorService executor = AppExecutorUtil.createBoundedApplicationPoolExecutor(StringUtil.capitalize(getName()), 10); for (int i = 0; i < 50; i++) { List<Disposable> disposables = IntStreamEx.range(100).mapToObj(__ -> Disposer.newDisposable()).toList(); List<Future<?>> futuresList = new ArrayList<>(); for (D...
test_executeSynchronously_doesNot_return_null_with_not_nullable_callable
270,370
void () { assertThat(createAppInfo(new XmlElement("company", Map.of("name", "Google Inc."), List.of(), null)).getShortCompanyName()).isEqualTo("Google"); assertThat(createAppInfo(new XmlElement("company", Map.of("name", "JetBrains s.r.o."), List.of(), null)).getShortCompanyName()).isEqualTo("JetBrains"); assertThat(cre...
shortenCompanyName
270,371
void () { var host = "IntellijIdeaRulezzz"; PlatformTestUtil.withSystemProperty(ApplicationInfoImpl.IDEA_PLUGINS_HOST_PROPERTY, host, () -> { var info = createAppInfo(); assertThat(info.getPluginManagerUrl()).contains(host).doesNotContain(ApplicationInfoImpl.DEFAULT_PLUGINS_HOST); assertThat(info.getPluginsListUrl()).c...
pluginsHostProperty
270,372
ApplicationInfoImpl (@NotNull XmlElement @NotNull ... content) { var children = new ArrayList<>(List.of(content)); children.add(new XmlElement("icon", Map.of("svg", "xxx.svg", "svg-small", "xxx.svg"), List.of(), null)); children.add(new XmlElement("plugins", Map.of(), List.of(), null)); return new ApplicationInfoImpl(n...
createAppInfo
270,373
void () { runReadWrites(500_000, 500_000, 2000); }
testRead50Write50LockPerformance
270,374
void () { runReadWrites(50_000_000, 0, 10_000); }
testRead100Write0LockPerformance
270,375
void (final int readIterations, final int writeIterations, int expectedMs) { NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); // someone might've submitted a task depending on app events which we disable now final ApplicationImpl application = (ApplicationImpl)ApplicationManager.getApplication(); Disposable disp...
runReadWrites
270,376
void (boolean condition, String msg) { if (!condition) { exception = new Exception(msg); throw new RuntimeException(msg); } }
assertThat
270,377
void (@NotNull ProgressIndicator indicator) { try { assertFalse(ApplicationManager.getApplication().isReadAccessAllowed()); assertFalse(ApplicationManager.getApplication().isDispatchThread()); ApplicationManager.getApplication().assertIsNonDispatchThread(); } catch (Exception e) { exception = e; } }
run
270,378
Void () { // It's critical there are no collisions in the thread-local map ReflectionUtil.resetField(Thread.currentThread(), myThreadLocalsField); for (int r = 0; r < readIterations; r++) { ReadMostlyRWLock.Reader reader = lock.startRead(); assertNotNull(reader); lock.endRead(reader); } return null; }
call
270,379
void (Future<?> future) { try { future.get(10_000, TimeUnit.MILLISECONDS); } catch (Exception e) { throw new RuntimeException(e); } }
waitForFuture
270,380
void () { assertThrows(IOException.class, () -> WriteCommandAction.runWriteCommandAction(getProject(), (ThrowableComputable<ThrowableRunnable<?>, IOException>)() -> { throw new IOException("aaaah"); })); }
testWriteCommandActionMustThrowRelevantException
270,381
void () { Disposable disposable = Disposer.newDisposable(); try { AtomicInteger nestingCount = new AtomicInteger(); ApplicationImpl application = (ApplicationImpl)ApplicationManager.getApplication(); application.addApplicationListener(new ApplicationListener() { @Override public void beforeWriteActionStart(@NotNull Obj...
testMustNotAllowStartingWriteActionFromWithinWriteActionListener
270,382
void (@NotNull Object action) { nestingCount.incrementAndGet(); assertTrue(application.isWriteIntentLockAcquired()); assertEquals(nestingCount.get() > 1, application.isWriteAccessAllowed()); assertTrue(application.isWriteActionPending()); assertThrows(IllegalStateException.class,()->application.runWriteAction(() -> {})...
beforeWriteActionStart
270,383
void (@NotNull Object action) { assertTrue(application.isWriteIntentLockAcquired()); assertTrue(application.isWriteActionInProgress()); assertTrue(application.isWriteAccessAllowed()); assertFalse(application.isWriteActionPending()); // jury is still out on whether we should allow starting write action from here //asser...
writeActionStarted
270,384
void (@NotNull Object action) { assertTrue(application.isWriteIntentLockAcquired()); assertTrue(application.isWriteAccessAllowed()); assertTrue(application.isWriteActionInProgress()); assertFalse(application.isWriteActionPending()); if (nestingCount.get() < 2) { // strange to allow it but this is how reformat works app...
writeActionFinished
270,385
void (@NotNull Object action) { assertTrue(application.isWriteIntentLockAcquired()); assertFalse(application.isWriteAccessAllowed()); assertFalse(application.isWriteActionInProgress()); assertFalse(application.isWriteActionPending()); if (nestingCount.get() < 2) { // strange to allow it but this is how a lot of code is...
afterWriteActionFinished
270,386
void () { Disposable disposable = Disposer.newDisposable(); try { ProgressManager.getInstance(); assertNotNull(ProgressManager.getInstanceOrNull()); MockApplication application = new MockApplication(disposable); ApplicationManager.setApplication(application, disposable); assertNull(ProgressManager.getInstanceOrNull());...
testCleanersAreRunOnApplicationReset
270,387
List<Object[]> () { List<Object[]> result = new ArrayList<>(); result.add(new Boolean[]{true, false}); if (StartupUtil.isImplicitReadOnEDTDisabled()) { result.add(new Boolean[]{true, true}); } result.add(new Boolean[]{false, false}); return result; }
dataOnEdt
270,388
boolean () { return myOnEdt; }
runInDispatchThread
270,389
void () { TestTask task = new TestTask().withAssertion(() -> ApplicationManager.getApplication().isWriteIntentLockAcquired()); ProgressResult<?> result = computeAssertingExceptionConditionally( myOnEdt && myReleaseIWLockOnRun, () -> new ProgressRunner<>(task) .onThread(ProgressRunner.ThreadToUse.WRITE) .withProgress(ne...
testToWriteThreadWithEmptyIndicatorSync
270,390
void () { TestTask task = new TestTask().withAssertion(() -> ApplicationManager.getApplication().isWriteIntentLockAcquired()); ProgressResult<?> result = computeAssertingExceptionConditionally( myOnEdt && myReleaseIWLockOnRun, () -> new ProgressRunner<>(task) .onThread(ProgressRunner.ThreadToUse.WRITE) .withProgress(cr...
testToWriteThreadWithProgressWindowSync
270,391
void () { // Running sync task on pooled thread from EDT w/o event polling can lead to deadlock if pooled thread will try to invokeAndWait. BooleanSupplier assertion = ApplicationManager.getApplication().isDispatchThread() ? () -> ApplicationManager.getApplication().isWriteIntentLockAcquired() : () -> !ApplicationManag...
testToPooledThreadWithEmptyIndicatorSync
270,392
void () { TestTask task = new TestTask().withAssertion(() -> !ApplicationManager.getApplication().isWriteIntentLockAcquired()); ProgressResult<?> result = computeAssertingExceptionConditionally( myOnEdt && myReleaseIWLockOnRun, () -> new ProgressRunner<>(task) .onThread(ProgressRunner.ThreadToUse.POOLED) .withProgress(...
testToPooledThreadWithProgressWindowSync
270,393
void () { DefaultLogger.disableStderrDumping(getTestRootDisposable()); final String failureMessage = "Expected Failure"; ProgressResult<?> result = computeAssertingExceptionConditionally( myOnEdt && myReleaseIWLockOnRun, () -> { return new ProgressRunner<>(() -> UIUtil.invokeAndWaitIfNeeded(() -> { throw new RuntimeExc...
testPumpingExceptionPropagation
270,394
void () { var t = new RuntimeException(); class ThrowingIndicator extends EmptyProgressIndicator implements BlockingProgressIndicator { @Override public void startBlocking(@NotNull Runnable init, @NotNull CompletableFuture<?> stopCondition) { // "enter" modality init.run(); // wait for task future to complete try { sto...
testStartBlockingExceptionPropagation
270,395
void (@NotNull Runnable init, @NotNull CompletableFuture<?> stopCondition) { // "enter" modality init.run(); // wait for task future to complete try { stopCondition.get(1000, TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { throw new RuntimeException(e); } throw t; }
startBlocking
270,396
void (ProgressIndicator progressIndicator) { for (int iter = 0; iter < 100 && !progressIndicator.isRunning(); ++iter) { TimeoutUtil.sleep(1); } }
ensureProgressIsRunning
270,397
void () { if (EDT.isCurrentThreadEdt()) { ApplicationManagerEx.getApplicationEx().runUnlockingIntendedWrite(() -> { PlatformTestUtil.dispatchAllEventsInIdeEventQueue(); PlatformTestUtil.dispatchAllEventsInIdeEventQueue(); return null; }); } else if (ApplicationManager.getApplication().isWriteIntentLockAcquired()) { Lat...
dispatchEverything
270,398
void () { if (!myAssertion.getAsBoolean()) { throw new AssertionError("Supplied assertion failed", myStacktrace); } mySemaphore.waitFor(); ProgressManager.checkCanceled(); TimeoutUtil.sleep(1); if (!myAssertion.getAsBoolean()) { throw new AssertionError("Supplied assertion failed", myStacktrace); } myFinished = true; }
run
270,399
void () { LaterInvocator.leaveModal(myWindow1); }
run