Search in sources :

Example 6 with GenericBuildEvent

use of com.google.devtools.build.lib.buildeventstream.GenericBuildEvent in project bazel by bazelbuild.

the class BuildEventStreamerTest method testReodering.

@Test
public void testReodering() {
    // Verify that an event requiring to be posted after another one is indeed.
    RecordingBuildEventTransport transport = new RecordingBuildEventTransport();
    BuildEventStreamer streamer = new BuildEventStreamer(ImmutableSet.<BuildEventTransport>of(transport));
    BuildEventId expectedId = testId("the target");
    BuildEvent startEvent = new GenericBuildEvent(testId("Initial"), ImmutableSet.<BuildEventId>of(ProgressEvent.INITIAL_PROGRESS_UPDATE, expectedId));
    BuildEvent rootCause = new GenericBuildEvent(testId("failure event"), ImmutableSet.<BuildEventId>of());
    BuildEvent failedTarget = new GenericOrderEvent(expectedId, ImmutableSet.<BuildEventId>of(rootCause.getEventId()));
    streamer.buildEvent(startEvent);
    streamer.buildEvent(failedTarget);
    streamer.buildEvent(rootCause);
    List<BuildEvent> allEventsSeen = transport.getEvents();
    assertThat(allEventsSeen).hasSize(4);
    assertEquals(startEvent.getEventId(), allEventsSeen.get(0).getEventId());
    BuildEvent linkEvent = allEventsSeen.get(1);
    assertEquals(ProgressEvent.INITIAL_PROGRESS_UPDATE, linkEvent.getEventId());
    assertEquals(rootCause.getEventId(), allEventsSeen.get(2).getEventId());
    assertEquals(failedTarget.getEventId(), allEventsSeen.get(3).getEventId());
}
Also used : GenericBuildEvent(com.google.devtools.build.lib.buildeventstream.GenericBuildEvent) BuildEventId(com.google.devtools.build.lib.buildeventstream.BuildEventId) BuildEvent(com.google.devtools.build.lib.buildeventstream.BuildEvent) GenericBuildEvent(com.google.devtools.build.lib.buildeventstream.GenericBuildEvent) Test(org.junit.Test)

Aggregations

BuildEvent (com.google.devtools.build.lib.buildeventstream.BuildEvent)6 GenericBuildEvent (com.google.devtools.build.lib.buildeventstream.GenericBuildEvent)6 Test (org.junit.Test)6 BuildResult (com.google.devtools.build.lib.buildtool.BuildResult)3 BuildCompleteEvent (com.google.devtools.build.lib.buildtool.buildevent.BuildCompleteEvent)3 BuildEventId (com.google.devtools.build.lib.buildeventstream.BuildEventId)2 BuildEventWithOrderConstraint (com.google.devtools.build.lib.buildeventstream.BuildEventWithOrderConstraint)1