use of com.google.devtools.build.lib.buildtool.BuildResult in project bazel by bazelbuild.
the class BuildEventStreamerTest method testSimpleStream.
@Test
public void testSimpleStream() {
// Verify that a well-formed event is passed through and that completion of the
// build clears the pending progress-update event.
RecordingBuildEventTransport transport = new RecordingBuildEventTransport();
BuildEventStreamer streamer = new BuildEventStreamer(ImmutableSet.<BuildEventTransport>of(transport));
BuildEvent startEvent = new GenericBuildEvent(testId("Initial"), ImmutableSet.of(ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventId.buildFinished()));
streamer.buildEvent(startEvent);
List<BuildEvent> afterFirstEvent = transport.getEvents();
assertThat(afterFirstEvent).hasSize(1);
assertEquals(startEvent.getEventId(), afterFirstEvent.get(0).getEventId());
streamer.buildEvent(new BuildCompleteEvent(new BuildResult(0)));
List<BuildEvent> finalStream = transport.getEvents();
assertThat(finalStream).hasSize(3);
assertEquals(BuildEventId.buildFinished(), finalStream.get(1).getEventId());
assertEquals(ProgressEvent.INITIAL_PROGRESS_UPDATE, finalStream.get(2).getEventId());
}
Aggregations