diff options
author | nharmata <nharmata@google.com> | 2017-05-09 13:53:19 -0400 |
---|---|---|
committer | Kristina Chodorow <kchodorow@google.com> | 2017-05-10 13:35:26 -0400 |
commit | 8040b0b7690420be2f92071e635cd1d7f18a38e9 (patch) | |
tree | 65e69733d7f18757399bf2ce535dbf00eaf3643b /src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java | |
parent | 370b4846dc530c9cbb270e4fd15150ec164f7a74 (diff) |
Introduce an EvaluationProgressReceiver implementation that does nothing.
This is useful for dealing with all the existing implementations in the face of
interface changes that are irrelevant.
RELNOTES: None
PiperOrigin-RevId: 155525021
Diffstat (limited to 'src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java | 116 |
1 files changed, 10 insertions, 106 deletions
diff --git a/src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java b/src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java index 2ab03467ba..5c99c94420 100644 --- a/src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java +++ b/src/test/java/com/google/devtools/build/skyframe/EagerInvalidatorTest.java @@ -23,7 +23,6 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import com.google.common.base.Supplier; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.google.common.collect.Sets; @@ -182,28 +181,12 @@ public class EagerInvalidatorTest { public void receiverWorks() throws Exception { final Set<SkyKey> invalidated = Sets.newConcurrentHashSet(); DirtyTrackingProgressReceiver receiver = new DirtyTrackingProgressReceiver( - new EvaluationProgressReceiver() { + new EvaluationProgressReceiver.NullEvaluationProgressReceiver() { @Override public void invalidated(SkyKey skyKey, InvalidationState state) { Preconditions.checkState(state == expectedState()); invalidated.add(skyKey); } - - @Override - public void enqueueing(SkyKey skyKey) { - throw new UnsupportedOperationException(); - } - - @Override - public void computed(SkyKey skyKey, long elapsedTimeNanos) { - throw new UnsupportedOperationException(); - } - - @Override - public void evaluated(SkyKey skyKey, Supplier<SkyValue> skyValueSupplier, - EvaluationState state) { - throw new UnsupportedOperationException(); - } }); graph = new InMemoryGraphImpl(); set("a", "a"); @@ -225,28 +208,12 @@ public class EagerInvalidatorTest { public void receiverIsNotifiedAboutNodesInError() throws Exception { final Set<SkyKey> invalidated = Sets.newConcurrentHashSet(); DirtyTrackingProgressReceiver receiver = new DirtyTrackingProgressReceiver( - new EvaluationProgressReceiver() { + new EvaluationProgressReceiver.NullEvaluationProgressReceiver() { @Override public void invalidated(SkyKey skyKey, InvalidationState state) { Preconditions.checkState(state == expectedState()); invalidated.add(skyKey); } - - @Override - public void enqueueing(SkyKey skyKey) { - throw new UnsupportedOperationException(); - } - - @Override - public void computed(SkyKey skyKey, long elapsedTimeNanos) { - throw new UnsupportedOperationException(); - } - - @Override - public void evaluated(SkyKey skyKey, Supplier<SkyValue> skyValueSupplier, - EvaluationState state) { - throw new UnsupportedOperationException(); - } }); // Given a graph consisting of two nodes, "a" and "ab" such that "ab" depends on "a", @@ -270,28 +237,12 @@ public class EagerInvalidatorTest { public void invalidateValuesNotInGraph() throws Exception { final Set<SkyKey> invalidated = Sets.newConcurrentHashSet(); DirtyTrackingProgressReceiver receiver = new DirtyTrackingProgressReceiver( - new EvaluationProgressReceiver() { + new EvaluationProgressReceiver.NullEvaluationProgressReceiver() { @Override public void invalidated(SkyKey skyKey, InvalidationState state) { Preconditions.checkState(state == InvalidationState.DIRTY); invalidated.add(skyKey); } - - @Override - public void enqueueing(SkyKey skyKey) { - throw new UnsupportedOperationException(); - } - - @Override - public void computed(SkyKey skyKey, long elapsedTimeNanos) { - throw new UnsupportedOperationException(); - } - - @Override - public void evaluated(SkyKey skyKey, Supplier<SkyValue> skyValueSupplier, - EvaluationState state) { - throw new UnsupportedOperationException(); - } }); graph = new InMemoryGraphImpl(); invalidateWithoutError(receiver, skyKey("a")); @@ -390,7 +341,7 @@ public class EagerInvalidatorTest { final Thread mainThread = Thread.currentThread(); final AtomicReference<SkyKey> badKey = new AtomicReference<>(); DirtyTrackingProgressReceiver receiver = new DirtyTrackingProgressReceiver( - new EvaluationProgressReceiver() { + new EvaluationProgressReceiver.NullEvaluationProgressReceiver() { @Override public void invalidated(SkyKey skyKey, InvalidationState state) { if (skyKey.equals(child)) { @@ -409,22 +360,6 @@ public class EagerInvalidatorTest { // thread is already interrupted. } } - - @Override - public void enqueueing(SkyKey skyKey) { - throw new UnsupportedOperationException(); - } - - @Override - public void computed(SkyKey skyKey, long elapsedTimeNanos) { - throw new UnsupportedOperationException(); - } - - @Override - public void evaluated( - SkyKey skyKey, Supplier<SkyValue> skyValueSupplier, EvaluationState state) { - throw new UnsupportedOperationException(); - } }); try { invalidateWithoutError(receiver, child); @@ -438,27 +373,11 @@ public class EagerInvalidatorTest { assertFalse(isInvalidated(parent)); assertNotNull(graph.get(null, Reason.OTHER, parent).getValue()); receiver = new DirtyTrackingProgressReceiver( - new EvaluationProgressReceiver() { + new EvaluationProgressReceiver.NullEvaluationProgressReceiver() { @Override public void invalidated(SkyKey skyKey, InvalidationState state) { invalidated.add(skyKey); } - - @Override - public void enqueueing(SkyKey skyKey) { - throw new UnsupportedOperationException(); - } - - @Override - public void computed(SkyKey skyKey, long elapsedTimeNanos) { - throw new UnsupportedOperationException(); - } - - @Override - public void evaluated(SkyKey skyKey, Supplier<SkyValue> skyValueSupplier, - EvaluationState state) { - throw new UnsupportedOperationException(); - } }); invalidateWithoutError(receiver); assertTrue(invalidated.contains(parent)); @@ -529,7 +448,8 @@ public class EagerInvalidatorTest { int countDownStart = validValuesToDo > 0 ? random.nextInt(validValuesToDo) : 0; final CountDownLatch countDownToInterrupt = new CountDownLatch(countDownStart); final DirtyTrackingProgressReceiver receiver = - new DirtyTrackingProgressReceiver(new EvaluationProgressReceiver() { + new DirtyTrackingProgressReceiver( + new EvaluationProgressReceiver.NullEvaluationProgressReceiver() { @Override public void invalidated(SkyKey skyKey, InvalidationState state) { countDownToInterrupt.countDown(); @@ -544,22 +464,6 @@ public class EagerInvalidatorTest { "Main thread was not interrupted"); } } - - @Override - public void enqueueing(SkyKey skyKey) { - throw new UnsupportedOperationException(); - } - - @Override - public void computed(SkyKey skyKey, long elapsedTimeNanos) { - throw new UnsupportedOperationException(); - } - - @Override - public void evaluated( - SkyKey skyKey, Supplier<SkyValue> skyValueSupplier, EvaluationState state) { - throw new UnsupportedOperationException(); - } }); try { invalidate(graph, receiver, @@ -639,7 +543,7 @@ public class EagerInvalidatorTest { public void dirtyTrackingProgressReceiverWorksWithDeletingInvalidator() throws Exception { setupInvalidatableGraph(); DirtyTrackingProgressReceiver receiver = new DirtyTrackingProgressReceiver( - new TrackingProgressReceiver()); + new EvaluationProgressReceiver.NullEvaluationProgressReceiver()); // Dirty the node, and ensure that the tracker is aware of it: Iterable<SkyKey> diff1 = ImmutableList.of(skyKey("a")); @@ -713,8 +617,8 @@ public class EagerInvalidatorTest { @Test public void dirtyTrackingProgressReceiverWorksWithDirtyingInvalidator() throws Exception { setupInvalidatableGraph(); - DirtyTrackingProgressReceiver receiver = - new DirtyTrackingProgressReceiver(new TrackingProgressReceiver()); + DirtyTrackingProgressReceiver receiver = new DirtyTrackingProgressReceiver( + new EvaluationProgressReceiver.NullEvaluationProgressReceiver()); // Dirty the node, and ensure that the tracker is aware of it: invalidate(graph, receiver, skyKey("a")); |