From 26e586d798f36faff23ae46cf120fd4bbeb36846 Mon Sep 17 00:00:00 2001 From: ulfjack Date: Thu, 17 May 2018 08:42:13 -0700 Subject: Rename BuildEventConverters to BuildEventContext This is in preparation for adding options to the class, which can be used to modify the behavior of build events posted to the BEP. PiperOrigin-RevId: 196997573 --- .../transports/BinaryFormatFileTransportTest.java | 14 +++++++------- .../transports/BuildEventTransportFactoryTest.java | 4 ++-- .../transports/JsonFormatFileTransportTest.java | 4 ++-- .../transports/TextFormatFileTransportTest.java | 8 ++++---- .../devtools/build/lib/runtime/BuildEventStreamerTest.java | 10 +++++----- 5 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src/test') diff --git a/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/BinaryFormatFileTransportTest.java b/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/BinaryFormatFileTransportTest.java index fb3aea441b..0940ab3fb6 100644 --- a/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/BinaryFormatFileTransportTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/BinaryFormatFileTransportTest.java @@ -19,7 +19,7 @@ import static org.mockito.Mockito.when; import com.google.devtools.build.lib.buildeventstream.ArtifactGroupNamer; import com.google.devtools.build.lib.buildeventstream.BuildEvent; -import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; +import com.google.devtools.build.lib.buildeventstream.BuildEventContext; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildStarted; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.Progress; @@ -70,21 +70,21 @@ public class BinaryFormatFileTransportTest { BuildEventStreamProtos.BuildEvent.newBuilder() .setStarted(BuildStarted.newBuilder().setCommand("build")) .build(); - when(buildEvent.asStreamProto(Matchers.any())).thenReturn(started); + when(buildEvent.asStreamProto(Matchers.any())).thenReturn(started); BinaryFormatFileTransport transport = new BinaryFormatFileTransport(output.getAbsolutePath(), pathConverter); transport.sendBuildEvent(buildEvent, artifactGroupNamer); BuildEventStreamProtos.BuildEvent progress = BuildEventStreamProtos.BuildEvent.newBuilder().setProgress(Progress.newBuilder()).build(); - when(buildEvent.asStreamProto(Matchers.any())).thenReturn(progress); + when(buildEvent.asStreamProto(Matchers.any())).thenReturn(progress); transport.sendBuildEvent(buildEvent, artifactGroupNamer); BuildEventStreamProtos.BuildEvent completed = BuildEventStreamProtos.BuildEvent.newBuilder() .setCompleted(TargetComplete.newBuilder().setSuccess(true)) .build(); - when(buildEvent.asStreamProto(Matchers.any())).thenReturn(completed); + when(buildEvent.asStreamProto(Matchers.any())).thenReturn(completed); transport.sendBuildEvent(buildEvent, artifactGroupNamer); transport.close().get(); @@ -107,7 +107,7 @@ public class BinaryFormatFileTransportTest { BuildEventStreamProtos.BuildEvent.newBuilder() .setStarted(BuildStarted.newBuilder().setCommand("build")) .build(); - when(buildEvent.asStreamProto(Matchers.any())).thenReturn(started); + when(buildEvent.asStreamProto(Matchers.any())).thenReturn(started); BinaryFormatFileTransport transport = new BinaryFormatFileTransport(path, pathConverter); transport.sendBuildEvent(buildEvent, artifactGroupNamer); @@ -126,7 +126,7 @@ public class BinaryFormatFileTransportTest { BuildEventStreamProtos.BuildEvent.newBuilder() .setStarted(BuildStarted.newBuilder().setCommand("build")) .build(); - when(buildEvent.asStreamProto(Matchers.any())).thenReturn(started); + when(buildEvent.asStreamProto(Matchers.any())).thenReturn(started); BinaryFormatFileTransport transport = new BinaryFormatFileTransport(output.getAbsolutePath(), pathConverter); @@ -153,7 +153,7 @@ public class BinaryFormatFileTransportTest { BuildEventStreamProtos.BuildEvent.newBuilder() .setStarted(BuildStarted.newBuilder().setCommand("build")) .build(); - when(buildEvent.asStreamProto(Matchers.any())).thenReturn(started); + when(buildEvent.asStreamProto(Matchers.any())).thenReturn(started); BinaryFormatFileTransport transport = new BinaryFormatFileTransport(output.getAbsolutePath(), pathConverter); diff --git a/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/BuildEventTransportFactoryTest.java b/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/BuildEventTransportFactoryTest.java index 5e22269292..ccbd9dbc18 100644 --- a/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/BuildEventTransportFactoryTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/BuildEventTransportFactoryTest.java @@ -22,7 +22,7 @@ import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableSet; import com.google.devtools.build.lib.buildeventstream.ArtifactGroupNamer; import com.google.devtools.build.lib.buildeventstream.BuildEvent; -import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; +import com.google.devtools.build.lib.buildeventstream.BuildEventContext; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildStarted; import com.google.devtools.build.lib.buildeventstream.BuildEventTransport; @@ -71,7 +71,7 @@ public class BuildEventTransportFactoryTest { @Before public void before() { MockitoAnnotations.initMocks(this); - when(buildEvent.asStreamProto(Matchers.any())) + when(buildEvent.asStreamProto(Matchers.any())) .thenReturn(BUILD_EVENT_AS_PROTO); } diff --git a/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/JsonFormatFileTransportTest.java b/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/JsonFormatFileTransportTest.java index a1414de41d..f051891358 100644 --- a/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/JsonFormatFileTransportTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/JsonFormatFileTransportTest.java @@ -19,7 +19,7 @@ import static org.mockito.Mockito.when; import com.google.devtools.build.lib.buildeventstream.ArtifactGroupNamer; import com.google.devtools.build.lib.buildeventstream.BuildEvent; -import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; +import com.google.devtools.build.lib.buildeventstream.BuildEventContext; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildStarted; import com.google.devtools.build.lib.buildeventstream.PathConverter; @@ -70,7 +70,7 @@ public class JsonFormatFileTransportTest { BuildEventStreamProtos.BuildEvent.newBuilder() .setStarted(BuildStarted.newBuilder().setCommand("build")) .build(); - when(buildEvent.asStreamProto(Matchers.any())).thenReturn(started); + when(buildEvent.asStreamProto(Matchers.any())).thenReturn(started); JsonFormatFileTransport transport = new JsonFormatFileTransport(output.getAbsolutePath(), pathConverter); transport.sendBuildEvent(buildEvent, artifactGroupNamer); diff --git a/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/TextFormatFileTransportTest.java b/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/TextFormatFileTransportTest.java index d2ae4a8f72..9a552d8c26 100644 --- a/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/TextFormatFileTransportTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/TextFormatFileTransportTest.java @@ -21,7 +21,7 @@ import com.google.common.base.Joiner; import com.google.common.io.Files; import com.google.devtools.build.lib.buildeventstream.ArtifactGroupNamer; import com.google.devtools.build.lib.buildeventstream.BuildEvent; -import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; +import com.google.devtools.build.lib.buildeventstream.BuildEventContext; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildStarted; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.Progress; @@ -71,21 +71,21 @@ public class TextFormatFileTransportTest { BuildEventStreamProtos.BuildEvent.newBuilder() .setStarted(BuildStarted.newBuilder().setCommand("build")) .build(); - when(buildEvent.asStreamProto(Matchers.any())).thenReturn(started); + when(buildEvent.asStreamProto(Matchers.any())).thenReturn(started); TextFormatFileTransport transport = new TextFormatFileTransport(output.getAbsolutePath(), pathConverter); transport.sendBuildEvent(buildEvent, artifactGroupNamer); BuildEventStreamProtos.BuildEvent progress = BuildEventStreamProtos.BuildEvent.newBuilder().setProgress(Progress.newBuilder()).build(); - when(buildEvent.asStreamProto(Matchers.any())).thenReturn(progress); + when(buildEvent.asStreamProto(Matchers.any())).thenReturn(progress); transport.sendBuildEvent(buildEvent, artifactGroupNamer); BuildEventStreamProtos.BuildEvent completed = BuildEventStreamProtos.BuildEvent.newBuilder() .setCompleted(TargetComplete.newBuilder().setSuccess(true)) .build(); - when(buildEvent.asStreamProto(Matchers.any())).thenReturn(completed); + when(buildEvent.asStreamProto(Matchers.any())).thenReturn(completed); transport.sendBuildEvent(buildEvent, artifactGroupNamer); transport.close().get(); diff --git a/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java b/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java index 0235a3aca6..5a0ea34e55 100644 --- a/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java +++ b/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java @@ -41,7 +41,7 @@ import com.google.devtools.build.lib.analysis.config.FragmentOptions; import com.google.devtools.build.lib.buildeventstream.AnnounceBuildEventTransportsEvent; import com.google.devtools.build.lib.buildeventstream.ArtifactGroupNamer; import com.google.devtools.build.lib.buildeventstream.BuildEvent; -import com.google.devtools.build.lib.buildeventstream.BuildEventConverters; +import com.google.devtools.build.lib.buildeventstream.BuildEventContext; import com.google.devtools.build.lib.buildeventstream.BuildEventId; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildEventId.NamedSetOfFilesId; @@ -103,7 +103,7 @@ public class BuildEventStreamerTest extends FoundationTestCase { events.add(event); eventsAsProtos.add( event.asStreamProto( - new BuildEventConverters() { + new BuildEventContext() { @Override public ArtifactGroupNamer artifactGroupNamer() { return namer; @@ -166,7 +166,7 @@ public class BuildEventStreamerTest extends FoundationTestCase { } @Override - public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { + public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventContext converters) { return GenericBuildEvent.protoChaining(this).build(); } @@ -210,7 +210,7 @@ public class BuildEventStreamerTest extends FoundationTestCase { } @Override - public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { + public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventContext converters) { BuildEventStreamProtos.NamedSetOfFiles.Builder builder = BuildEventStreamProtos.NamedSetOfFiles.newBuilder(); for (NestedSet artifactset : artifacts) { @@ -255,7 +255,7 @@ public class BuildEventStreamerTest extends FoundationTestCase { } @Override - public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) { + public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventContext converters) { return GenericBuildEvent.protoChaining(this).build(); } } -- cgit v1.2.3