Skip to content

Commit

Permalink
Internal change.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 427578600
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Feb 9, 2022
1 parent 11a48ca commit f526477
Show file tree
Hide file tree
Showing 74 changed files with 66 additions and 295 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ public void testNegativeTimeout() throws Exception {
}

@GwtIncompatible // threads

public void testOverflowTimeout() throws Exception {
// First, sanity check that naive multiplication would really overflow to a negative number:
long nanosPerSecond = NANOSECONDS.convert(1, SECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ protected final void tearDown() {
thrownByExecutionThread);
}


public void testServiceStartStop() throws Exception {
WaitOnRunService service = new WaitOnRunService();
assertFalse(service.startUpCalled);
Expand All @@ -85,7 +84,6 @@ public void testServiceStartStop() throws Exception {
executionThread.join();
}


public void testServiceStopIdempotence() throws Exception {
WaitOnRunService service = new WaitOnRunService();

Expand All @@ -102,7 +100,6 @@ public void testServiceStopIdempotence() throws Exception {
executionThread.join();
}


public void testServiceExitingOnItsOwn() throws Exception {
WaitOnRunService service = new WaitOnRunService();
service.expectedShutdownState = Service.State.RUNNING;
Expand Down Expand Up @@ -173,7 +170,6 @@ protected Executor executor() {
}
}


public void testServiceThrowOnStartUp() throws Exception {
ThrowOnStartUpService service = new ThrowOnStartUpService();
assertFalse(service.startUpCalled);
Expand Down Expand Up @@ -212,7 +208,6 @@ protected Executor executor() {
}
}


public void testServiceThrowOnRun() throws Exception {
ThrowOnRunService service = new ThrowOnRunService();

Expand All @@ -229,7 +224,6 @@ public void testServiceThrowOnRun() throws Exception {
assertEquals(Service.State.FAILED, service.state());
}


public void testServiceThrowOnRunAndThenAgainOnShutDown() throws Exception {
ThrowOnRunService service = new ThrowOnRunService();
service.throwOnShutDown = true;
Expand Down Expand Up @@ -271,7 +265,6 @@ protected Executor executor() {
}
}


public void testServiceThrowOnShutDown() throws Exception {
ThrowOnShutDown service = new ThrowOnShutDown();

Expand Down Expand Up @@ -331,7 +324,6 @@ public void execute(Runnable command) {}
protected void run() throws Exception {}
}


public void testStopWhileStarting_runNotCalled() throws Exception {
final CountDownLatch started = new CountDownLatch(1);
FakeService service =
Expand Down Expand Up @@ -361,7 +353,6 @@ public void testStop_noStart() {
assertEquals(0, service.shutdownCalled);
}


public void testDefaultService() throws InterruptedException {
WaitOnRunService service = new WaitOnRunService();
service.startAsync().awaitRunning();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import junit.framework.TestCase;

/** Tests for {@link AbstractFuture} with the cancellation cause system property set */
@AndroidIncompatible // custom classloading

public class AbstractFutureCancellationCauseTest extends TestCase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
*
* @author Brian Stoler
*/

public class AbstractFutureTest extends TestCase {
public void testSuccess() throws ExecutionException, InterruptedException {
final Object value = new Object();
Expand Down Expand Up @@ -292,6 +291,7 @@ public String pendingToString() {
* derived from observing how much time actually passed for various operations.
*/
@SuppressWarnings({"DeprecatedThreadMethods", "ThreadPriorityCheck"})
@AndroidIncompatible // Thread.suspend
public void testToString_delayedTimeout() throws Exception {
TimedWaiterThread thread =
new TimedWaiterThread(new AbstractFuture<Object>() {}, 2, TimeUnit.SECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public class AbstractIdleServiceTest extends TestCase {

// Functional tests using real thread. We only verify publicly visible state.
// Interaction assertions are done by the single-threaded unit tests.

public static class FunctionalTest extends TestCase {

private static class DefaultService extends AbstractIdleService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
*
* @author Luke Sandberg
*/

public class AbstractScheduledServiceTest extends TestCase {

volatile Scheduler configuration = newFixedDelaySchedule(0, 10, MILLISECONDS);
Expand Down Expand Up @@ -442,7 +441,6 @@ public int compareTo(Delayed other) {
}
}


public void testFixedDelayScheduleFarFuturePotentiallyOverflowingScheduleIsNeverReached()
throws Exception {
TestAbstractScheduledCustomService service =
Expand All @@ -463,7 +461,6 @@ protected Scheduler scheduler() {
service.awaitTerminated();
}


public void testCustomSchedulerFarFuturePotentiallyOverflowingScheduleIsNeverReached()
throws Exception {
TestAbstractScheduledCustomService service =
Expand Down Expand Up @@ -499,7 +496,6 @@ protected Schedule getNextSchedule() throws Exception {
}
}


public void testCustomSchedule_startStop() throws Exception {
final CyclicBarrier firstBarrier = new CyclicBarrier(2);
final CyclicBarrier secondBarrier = new CyclicBarrier(2);
Expand Down Expand Up @@ -530,7 +526,6 @@ public void run() {
future.cancel(false);
}


public void testCustomSchedulerServiceStop() throws Exception {
TestAbstractScheduledCustomService service = new TestAbstractScheduledCustomService();
service.startAsync().awaitRunning();
Expand All @@ -544,7 +539,6 @@ public void testCustomSchedulerServiceStop() throws Exception {
assertEquals(1, service.numIterations.get());
}


public void testCustomScheduler_deadlock() throws InterruptedException, BrokenBarrierException {
final CyclicBarrier inGetNextSchedule = new CyclicBarrier(2);
// This will flakily deadlock, so run it multiple times to increase the flake likelihood
Expand Down Expand Up @@ -575,7 +569,6 @@ protected Schedule getNextSchedule() throws Exception {
}
}


public void testBig() throws Exception {
TestAbstractScheduledCustomService service =
new TestAbstractScheduledCustomService() {
Expand Down Expand Up @@ -635,7 +628,6 @@ protected Schedule getNextSchedule() throws Exception {
}
}


public void testCustomSchedulerFailure() throws Exception {
TestFailingCustomScheduledService service = new TestFailingCustomScheduledService();
service.startAsync().awaitRunning();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ protected void doStop() {
}
}


public void testAwaitTerminated() throws Exception {
final NoOpService service = new NoOpService();
Thread waiter =
Expand All @@ -348,7 +347,6 @@ public void run() {
assertFalse(waiter.isAlive());
}


public void testAwaitTerminated_FailedService() throws Exception {
final ManualSwitchedService service = new ManualSwitchedService();
final AtomicReference<Throwable> exception = Atomics.newReference();
Expand Down Expand Up @@ -376,7 +374,6 @@ public void run() {
assertThat(exception.get()).hasCauseThat().isEqualTo(EXCEPTION);
}


public void testThreadedServiceStartAndWaitStopAndWait() throws Throwable {
ThreadedService service = new ThreadedService();
RecordingListener listener = RecordingListener.record(service);
Expand All @@ -394,7 +391,6 @@ public void testThreadedServiceStartAndWaitStopAndWait() throws Throwable {
listener.getStateHistory());
}


public void testThreadedServiceStopIdempotence() throws Throwable {
ThreadedService service = new ThreadedService();

Expand All @@ -410,7 +406,6 @@ public void testThreadedServiceStopIdempotence() throws Throwable {
throwIfSet(thrownByExecutionThread);
}


public void testThreadedServiceStopIdempotenceAfterWait() throws Throwable {
ThreadedService service = new ThreadedService();

Expand All @@ -428,7 +423,6 @@ public void testThreadedServiceStopIdempotenceAfterWait() throws Throwable {
throwIfSet(thrownByExecutionThread);
}


public void testThreadedServiceStopIdempotenceDoubleWait() throws Throwable {
ThreadedService service = new ThreadedService();

Expand Down Expand Up @@ -661,7 +655,6 @@ public void testFailureCause_throwsIfNotFailed() {
}
}


public void testAddListenerAfterFailureDoesntCauseDeadlock() throws InterruptedException {
final StartFailingService service = new StartFailingService();
service.startAsync();
Expand All @@ -681,7 +674,6 @@ public void run() {
assertFalse(thread + " is deadlocked", thread.isAlive());
}


public void testListenerDoesntDeadlockOnStartAndWaitFromRunning() throws Exception {
final NoOpThreadedService service = new NoOpThreadedService();
service.addListener(
Expand All @@ -696,7 +688,6 @@ public void running() {
service.stopAsync();
}


public void testListenerDoesntDeadlockOnStopAndWaitFromTerminated() throws Exception {
final NoOpThreadedService service = new NoOpThreadedService();
service.addListener(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ public void testCompareAndSet() {
}

/** compareAndSet in one thread enables another waiting for value to succeed */

public void testCompareAndSetInMultipleThreads() throws InterruptedException {
final AtomicDoubleArray a = new AtomicDoubleArray(1);
a.set(0, 1.0);
Expand Down Expand Up @@ -294,7 +293,6 @@ public void realRun() {
* Multiple threads using same array of counters successfully update a number of times equal to
* total count
*/

public void testCountingInMultipleThreads() throws InterruptedException {
final AtomicDoubleArray aa = new AtomicDoubleArray(SIZE);
for (int i = 0; i < SIZE; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

package com.google.common.util.concurrent;


/** Unit test for {@link AtomicDouble}. */
public class AtomicDoubleTest extends JSR166TestCase {

Expand Down Expand Up @@ -97,7 +96,6 @@ public void testCompareAndSet() {
}

/** compareAndSet in one thread enables another waiting for value to succeed */

public void testCompareAndSetInMultipleThreads() throws Exception {
final AtomicDouble at = new AtomicDouble(1.0);
Thread t =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
* @author mike nonemacher
*/
@GwtIncompatible // threads

public class AtomicLongMapBasherTest extends TestCase {
private final Random random = new Random(301);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@ public void testDifferentLockFactories_policyExecution() {
lockD.lock();
}


public void testReentrantLock_tryLock() throws Exception {
LockingThread thread = new LockingThread(lockA);
thread.start();
Expand All @@ -454,7 +453,6 @@ public void testReentrantLock_tryLock() throws Exception {
assertTrue(lockA.tryLock());
}


public void testReentrantWriteLock_tryLock() throws Exception {
LockingThread thread = new LockingThread(writeLockA);
thread.start();
Expand All @@ -468,7 +466,6 @@ public void testReentrantWriteLock_tryLock() throws Exception {
assertTrue(readLockA.tryLock());
}


public void testReentrantReadLock_tryLock() throws Exception {
LockingThread thread = new LockingThread(readLockA);
thread.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public class ExecutionListTest extends TestCase {

private final ExecutionList list = new ExecutionList();


public void testRunOnPopulatedList() throws Exception {
Executor exec = Executors.newCachedThreadPool();
CountDownLatch countDownLatch = new CountDownLatch(3);
Expand Down Expand Up @@ -67,7 +66,6 @@ public void run() {
assertEquals(1, runCalled.get());
}


public void testExecute_idempotentConcurrently() throws InterruptedException {
final CountDownLatch okayToRun = new CountDownLatch(1);
final AtomicInteger runCalled = new AtomicInteger();
Expand Down Expand Up @@ -103,7 +101,6 @@ public void run() {
assertEquals(1, runCalled.get());
}


public void testAddAfterRun() throws Exception {
// Run the previous test
testRunOnPopulatedList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public void testCancellationDoesNotViolateSerialization() {
assertThat(thirdCallable.called).isTrue();
}


public void testCancellationMultipleThreads() throws Exception {
final BlockingCallable blockingCallable = new BlockingCallable();
ListenableFuture<Void> unused = serializer.submit(blockingCallable, executor);
Expand Down Expand Up @@ -116,7 +115,6 @@ public Boolean call() {
assertThat(getDone(future2)).isFalse();
}


public void testSecondTaskWaitsForFirstEvenIfCancelled() throws Exception {
final BlockingCallable blockingCallable = new BlockingCallable();
ListenableFuture<Void> future1 = serializer.submit(blockingCallable, executor);
Expand Down Expand Up @@ -327,7 +325,6 @@ private static final class LongHolder {
private static final int DIRECT_EXECUTIONS_PER_THREAD = 100;

@GwtIncompatible // threads

public void testAvoidsStackOverflow_multipleThreads() throws Exception {
final LongHolder holder = new LongHolder();
final ArrayList<ListenableFuture<Integer>> lengthChecks = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ public ListenableFuture<Integer> apply(Integer input) {
assertThat(f.get()).isEqualTo(2);
}


@GwtIncompatible // withTimeout
public void testWithTimeout() throws Exception {
ScheduledExecutorService executor = newScheduledThreadPool(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public void testGetCheckedUntimed_exceptionClassUsedInitCause() {

public static final class WillBeUnloadedException extends Exception {}


@AndroidIncompatible // "Parent ClassLoader may not be null"; maybe avoidable if we try?
public void testGetChecked_classUnloading() throws Exception {
WeakReference<?> classUsedByGetChecked = doTestClassUnloading();
GcFinalization.awaitClear(classUsedByGetChecked);
Expand Down
Loading

0 comments on commit f526477

Please sign in to comment.