aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/google')
-rw-r--r--src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java3
-rw-r--r--src/test/java/com/google/devtools/build/lib/buildeventstream/transports/BUILD1
-rw-r--r--src/test/java/com/google/devtools/build/lib/buildeventstream/transports/BinaryFormatFileTransportTest.java13
-rw-r--r--src/test/java/com/google/devtools/build/lib/buildeventstream/transports/BuildEventTransportFactoryTest.java13
-rw-r--r--src/test/java/com/google/devtools/build/lib/buildeventstream/transports/JsonFormatFileTransportTest.java6
-rw-r--r--src/test/java/com/google/devtools/build/lib/buildeventstream/transports/TextFormatFileTransportTest.java6
-rw-r--r--src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java7
7 files changed, 39 insertions, 10 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java b/src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java
index 2b3afda7cd..45cded6792 100644
--- a/src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java
+++ b/src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java
@@ -26,6 +26,7 @@ import com.google.devtools.build.lib.actions.ActionExecutedEvent;
import com.google.devtools.build.lib.actions.ActionExecutedEvent.ErrorTiming;
import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
import com.google.devtools.build.lib.authandtls.AuthAndTLSOptions;
+import com.google.devtools.build.lib.buildeventstream.BuildEventProtocolOptions;
import com.google.devtools.build.lib.buildeventstream.PathConverter;
import com.google.devtools.build.lib.buildeventstream.transports.BinaryFormatFileTransport;
import com.google.devtools.build.lib.buildeventstream.transports.BuildEventStreamOptions;
@@ -112,6 +113,8 @@ public class BazelBuildEventServiceModuleTest {
when(optionsProvider.getOptions(BuildEventServiceOptions.class)).thenReturn(besOptions);
when(optionsProvider.getOptions(AuthAndTLSOptions.class))
.thenReturn(Options.getDefaults(AuthAndTLSOptions.class));
+ when(optionsProvider.getOptions(BuildEventProtocolOptions.class))
+ .thenReturn(Options.getDefaults(BuildEventProtocolOptions.class));
}
@After
diff --git a/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/BUILD b/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/BUILD
index f8d35d5f20..e39b9d378d 100644
--- a/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/BUILD
+++ b/src/test/java/com/google/devtools/build/lib/buildeventstream/transports/BUILD
@@ -21,6 +21,7 @@ java_test(
"//src/main/java/com/google/devtools/build/lib/buildeventstream/proto:build_event_stream_java_proto",
"//src/main/java/com/google/devtools/build/lib/buildeventstream/transports",
"//src/main/java/com/google/devtools/build/lib/vfs",
+ "//src/main/java/com/google/devtools/common/options",
"//src/test/java/com/google/devtools/build/lib:packages_testutil",
"//third_party:guava",
"//third_party:junit4",
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 0940ab3fb6..51951e4f8a 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
@@ -20,11 +20,13 @@ 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.BuildEventContext;
+import com.google.devtools.build.lib.buildeventstream.BuildEventProtocolOptions;
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;
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.TargetComplete;
import com.google.devtools.build.lib.buildeventstream.PathConverter;
+import com.google.devtools.common.options.Options;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
@@ -44,6 +46,8 @@ import org.mockito.MockitoAnnotations;
/** Tests {@link BinaryFormatFileTransport}. **/
@RunWith(JUnit4.class)
public class BinaryFormatFileTransportTest {
+ private final BuildEventProtocolOptions defaultOpts =
+ Options.getDefaults(BuildEventProtocolOptions.class);
@Rule public TemporaryFolder tmp = new TemporaryFolder();
@@ -72,7 +76,7 @@ public class BinaryFormatFileTransportTest {
.build();
when(buildEvent.asStreamProto(Matchers.<BuildEventContext>any())).thenReturn(started);
BinaryFormatFileTransport transport =
- new BinaryFormatFileTransport(output.getAbsolutePath(), pathConverter);
+ new BinaryFormatFileTransport(output.getAbsolutePath(), defaultOpts, pathConverter);
transport.sendBuildEvent(buildEvent, artifactGroupNamer);
BuildEventStreamProtos.BuildEvent progress =
@@ -108,7 +112,8 @@ public class BinaryFormatFileTransportTest {
.setStarted(BuildStarted.newBuilder().setCommand("build"))
.build();
when(buildEvent.asStreamProto(Matchers.<BuildEventContext>any())).thenReturn(started);
- BinaryFormatFileTransport transport = new BinaryFormatFileTransport(path, pathConverter);
+ BinaryFormatFileTransport transport =
+ new BinaryFormatFileTransport(path, defaultOpts, pathConverter);
transport.sendBuildEvent(buildEvent, artifactGroupNamer);
transport.close().get();
@@ -129,7 +134,7 @@ public class BinaryFormatFileTransportTest {
when(buildEvent.asStreamProto(Matchers.<BuildEventContext>any())).thenReturn(started);
BinaryFormatFileTransport transport =
- new BinaryFormatFileTransport(output.getAbsolutePath(), pathConverter);
+ new BinaryFormatFileTransport(output.getAbsolutePath(), defaultOpts, pathConverter);
// Close the stream.
transport.out.close();
@@ -156,7 +161,7 @@ public class BinaryFormatFileTransportTest {
when(buildEvent.asStreamProto(Matchers.<BuildEventContext>any())).thenReturn(started);
BinaryFormatFileTransport transport =
- new BinaryFormatFileTransport(output.getAbsolutePath(), pathConverter);
+ new BinaryFormatFileTransport(output.getAbsolutePath(), defaultOpts, pathConverter);
transport.sendBuildEvent(buildEvent, artifactGroupNamer);
Future<Void> closeFuture = transport.close();
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 ccbd9dbc18..e5d5133cca 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
@@ -23,10 +23,12 @@ 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.BuildEventContext;
+import com.google.devtools.build.lib.buildeventstream.BuildEventProtocolOptions;
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;
import com.google.devtools.build.lib.buildeventstream.PathConverter;
+import com.google.devtools.common.options.Options;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.Future;
@@ -59,6 +61,9 @@ public class BuildEventTransportFactoryTest {
.setStarted(BuildStarted.newBuilder().setCommand("build"))
.build();
+ private final BuildEventProtocolOptions protocolOpts =
+ Options.getDefaults(BuildEventProtocolOptions.class);
+
@Rule public TemporaryFolder tmp = new TemporaryFolder();
@Mock public BuildEventStreamOptions options;
@@ -87,7 +92,7 @@ public class BuildEventTransportFactoryTest {
when(options.getBuildEventTextFilePathConversion()).thenReturn(true);
when(options.getBuildEventBinaryFile()).thenReturn("");
ImmutableSet<BuildEventTransport> transports =
- BuildEventTransportFactory.createFromOptions(options, pathConverter);
+ BuildEventTransportFactory.createFromOptions(options, protocolOpts, pathConverter);
assertThat(FluentIterable.from(transports).transform(GET_CLASS))
.containsExactly(TextFormatFileTransport.class);
sendEventsAndClose(buildEvent, transports);
@@ -101,7 +106,7 @@ public class BuildEventTransportFactoryTest {
when(options.getBuildEventBinaryFile()).thenReturn(binaryFile.getAbsolutePath());
when(options.getBuildEventBinaryFilePathConversion()).thenReturn(true);
ImmutableSet<BuildEventTransport> transports =
- BuildEventTransportFactory.createFromOptions(options, pathConverter);
+ BuildEventTransportFactory.createFromOptions(options, protocolOpts, pathConverter);
assertThat(FluentIterable.from(transports).transform(GET_CLASS))
.containsExactly(BinaryFormatFileTransport.class);
sendEventsAndClose(buildEvent, transports);
@@ -117,7 +122,7 @@ public class BuildEventTransportFactoryTest {
when(options.getBuildEventBinaryFilePathConversion()).thenReturn(true);
when(options.getBuildEventTextFilePathConversion()).thenReturn(true);
ImmutableSet<BuildEventTransport> transports =
- BuildEventTransportFactory.createFromOptions(options, pathConverter);
+ BuildEventTransportFactory.createFromOptions(options, protocolOpts, pathConverter);
assertThat(FluentIterable.from(transports).transform(GET_CLASS))
.containsExactly(TextFormatFileTransport.class, BinaryFormatFileTransport.class);
sendEventsAndClose(buildEvent, transports);
@@ -129,7 +134,7 @@ public class BuildEventTransportFactoryTest {
public void testCreatesNoTransports() throws IOException {
when(options.getBuildEventTextFile()).thenReturn("");
ImmutableSet<BuildEventTransport> transports =
- BuildEventTransportFactory.createFromOptions(options, pathConverter);
+ BuildEventTransportFactory.createFromOptions(options, protocolOpts, pathConverter);
assertThat(transports).isEmpty();
}
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 f051891358..e667a7d787 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
@@ -20,9 +20,11 @@ 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.BuildEventContext;
+import com.google.devtools.build.lib.buildeventstream.BuildEventProtocolOptions;
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;
+import com.google.devtools.common.options.Options;
import com.google.protobuf.util.JsonFormat;
import java.io.File;
import java.io.FileInputStream;
@@ -44,6 +46,8 @@ import org.mockito.MockitoAnnotations;
/** Tests {@link TextFormatFileTransport}. * */
@RunWith(JUnit4.class)
public class JsonFormatFileTransportTest {
+ private final BuildEventProtocolOptions defaultOpts =
+ Options.getDefaults(BuildEventProtocolOptions.class);
@Rule public TemporaryFolder tmp = new TemporaryFolder();
@@ -72,7 +76,7 @@ public class JsonFormatFileTransportTest {
.build();
when(buildEvent.asStreamProto(Matchers.<BuildEventContext>any())).thenReturn(started);
JsonFormatFileTransport transport =
- new JsonFormatFileTransport(output.getAbsolutePath(), pathConverter);
+ new JsonFormatFileTransport(output.getAbsolutePath(), defaultOpts, pathConverter);
transport.sendBuildEvent(buildEvent, artifactGroupNamer);
transport.close().get();
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 9a552d8c26..c3ad19d0d6 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
@@ -22,11 +22,13 @@ 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.BuildEventContext;
+import com.google.devtools.build.lib.buildeventstream.BuildEventProtocolOptions;
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;
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.TargetComplete;
import com.google.devtools.build.lib.buildeventstream.PathConverter;
+import com.google.devtools.common.options.Options;
import com.google.protobuf.TextFormat;
import java.io.File;
import java.nio.charset.StandardCharsets;
@@ -45,6 +47,8 @@ import org.mockito.MockitoAnnotations;
/** Tests {@link TextFormatFileTransport}. **/
@RunWith(JUnit4.class)
public class TextFormatFileTransportTest {
+ private final BuildEventProtocolOptions defaultOpts =
+ Options.getDefaults(BuildEventProtocolOptions.class);
@Rule public TemporaryFolder tmp = new TemporaryFolder();
@@ -73,7 +77,7 @@ public class TextFormatFileTransportTest {
.build();
when(buildEvent.asStreamProto(Matchers.<BuildEventContext>any())).thenReturn(started);
TextFormatFileTransport transport =
- new TextFormatFileTransport(output.getAbsolutePath(), pathConverter);
+ new TextFormatFileTransport(output.getAbsolutePath(), defaultOpts, pathConverter);
transport.sendBuildEvent(buildEvent, artifactGroupNamer);
BuildEventStreamProtos.BuildEvent progress =
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 5a0ea34e55..d50717d9a7 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
@@ -43,6 +43,7 @@ import com.google.devtools.build.lib.buildeventstream.ArtifactGroupNamer;
import com.google.devtools.build.lib.buildeventstream.BuildEvent;
import com.google.devtools.build.lib.buildeventstream.BuildEventContext;
import com.google.devtools.build.lib.buildeventstream.BuildEventId;
+import com.google.devtools.build.lib.buildeventstream.BuildEventProtocolOptions;
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos;
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildEventId.NamedSetOfFilesId;
import com.google.devtools.build.lib.buildeventstream.BuildEventTransport;
@@ -62,6 +63,7 @@ import com.google.devtools.build.lib.testutil.FoundationTestCase;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.Root;
+import com.google.devtools.common.options.Options;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -118,6 +120,11 @@ public class BuildEventStreamerTest extends FoundationTestCase {
}
};
}
+
+ @Override
+ public BuildEventProtocolOptions getOptions() {
+ return Options.getDefaults(BuildEventProtocolOptions.class);
+ }
}));
}