use of com.google.common.eventbus.EventBus in project bazel by bazelbuild.
the class TestResultAnalyzerTest method createMocks.
@Before
public final void createMocks() throws Exception {
Path mockPath = mock(Path.class);
OptionsParser testSpecificOptions = OptionsParser.newOptionsParser(TestSummaryOptions.class, ExecutionOptions.class);
EventBus mockBus = mock(EventBus.class);
underTest = new TestResultAnalyzer(mockPath, testSpecificOptions.getOptions(TestSummaryOptions.class), testSpecificOptions.getOptions(ExecutionOptions.class), mockBus);
}
use of com.google.common.eventbus.EventBus in project bazel by bazelbuild.
the class ParallelEvaluatorTest method signalValueEnqueuedAndEvaluated.
@Test
public void signalValueEnqueuedAndEvaluated() throws Exception {
final Set<SkyKey> enqueuedValues = Sets.newConcurrentHashSet();
final Set<SkyKey> evaluatedValues = Sets.newConcurrentHashSet();
EvaluationProgressReceiver progressReceiver = new EvaluationProgressReceiver() {
@Override
public void invalidated(SkyKey skyKey, InvalidationState state) {
throw new IllegalStateException();
}
@Override
public void enqueueing(SkyKey skyKey) {
enqueuedValues.add(skyKey);
}
@Override
public void computed(SkyKey skyKey, long elapsedTimeNanos) {
}
@Override
public void evaluated(SkyKey skyKey, Supplier<SkyValue> skyValueSupplier, EvaluationState state) {
evaluatedValues.add(skyKey);
}
};
ExtendedEventHandler reporter = new Reporter(new EventBus(), new EventHandler() {
@Override
public void handle(Event e) {
throw new IllegalStateException();
}
});
MemoizingEvaluator aug = new InMemoryMemoizingEvaluator(ImmutableMap.of(GraphTester.NODE_TYPE, tester.getFunction()), new RecordingDifferencer(), progressReceiver);
SequentialBuildDriver driver = new SequentialBuildDriver(aug);
tester.getOrCreate("top1").setComputedValue(CONCATENATE).addDependency("d1").addDependency("d2");
tester.getOrCreate("top2").setComputedValue(CONCATENATE).addDependency("d3");
tester.getOrCreate("top3");
assertThat(enqueuedValues).isEmpty();
assertThat(evaluatedValues).isEmpty();
tester.set("d1", new StringValue("1"));
tester.set("d2", new StringValue("2"));
tester.set("d3", new StringValue("3"));
driver.evaluate(ImmutableList.of(GraphTester.toSkyKey("top1")), false, 200, reporter);
assertThat(enqueuedValues).containsExactlyElementsIn(Arrays.asList(GraphTester.toSkyKeys("top1", "d1", "d2")));
assertThat(evaluatedValues).containsExactlyElementsIn(Arrays.asList(GraphTester.toSkyKeys("top1", "d1", "d2")));
enqueuedValues.clear();
evaluatedValues.clear();
driver.evaluate(ImmutableList.of(GraphTester.toSkyKey("top2")), false, 200, reporter);
assertThat(enqueuedValues).containsExactlyElementsIn(Arrays.asList(GraphTester.toSkyKeys("top2", "d3")));
assertThat(evaluatedValues).containsExactlyElementsIn(Arrays.asList(GraphTester.toSkyKeys("top2", "d3")));
enqueuedValues.clear();
evaluatedValues.clear();
driver.evaluate(ImmutableList.of(GraphTester.toSkyKey("top1")), false, 200, reporter);
assertThat(enqueuedValues).isEmpty();
assertThat(evaluatedValues).containsExactlyElementsIn(Arrays.asList(GraphTester.toSkyKeys("top1")));
}
use of com.google.common.eventbus.EventBus in project bazel by bazelbuild.
the class ParallelEvaluatorTest method makeEvaluator.
private ParallelEvaluator makeEvaluator(ProcessableGraph graph, ImmutableMap<SkyFunctionName, ? extends SkyFunction> builders, boolean keepGoing, EventFilter storedEventFilter) {
Version oldGraphVersion = graphVersion;
graphVersion = graphVersion.next();
return new ParallelEvaluator(graph, oldGraphVersion, builders, new Reporter(new EventBus(), eventCollector), new MemoizingEvaluator.EmittedEventState(), storedEventFilter, keepGoing, 150, revalidationReceiver);
}
use of com.google.common.eventbus.EventBus in project bazel by bazelbuild.
the class EagerInvalidatorTest method eval.
protected <T extends SkyValue> EvaluationResult<T> eval(boolean keepGoing, SkyKey... keys) throws InterruptedException {
Reporter reporter = new Reporter(new EventBus());
ParallelEvaluator evaluator = new ParallelEvaluator(graph, graphVersion, tester.getSkyFunctionMap(), reporter, new MemoizingEvaluator.EmittedEventState(), InMemoryMemoizingEvaluator.DEFAULT_STORED_EVENT_FILTER, keepGoing, 200, new DirtyTrackingProgressReceiver(null));
graphVersion = graphVersion.next();
return evaluator.eval(ImmutableList.copyOf(keys));
}
use of com.google.common.eventbus.EventBus in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTestBase method buildTarget.
private void buildTarget(String target) throws Exception {
AnalysisResult analysisResult = update(ImmutableList.of(target), ImmutableList.of(AndroidStudioInfoAspect.NAME), false, LOADING_PHASE_THREADS, true, new EventBus());
Collection<AspectValue> aspects = analysisResult.getAspects();
assertThat(aspects.size()).isEqualTo(1);
AspectValue value = aspects.iterator().next();
this.configuredAspect = value.getConfiguredAspect();
assertThat(configuredAspect.getName()).isEqualTo(AndroidStudioInfoAspect.NAME);
}
Aggregations