Java Code Examples for com.google.protobuf.Any#getDefaultInstance()
The following examples show how to use
com.google.protobuf.Any#getDefaultInstance() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WellKnownTypeMarshaller.java From curiostack with MIT License | 4 votes |
AnyMarshaller() { super(Any.getDefaultInstance()); }
Example 2
Source File: BuildEventServiceProtoUtilTest.java From bazel with Apache License 2.0 | 4 votes |
@Test public void testStreamEvents() { Timestamp firstEventTimestamp = Timestamps.fromMillis(clock.advanceMillis(100)); Any anything = Any.getDefaultInstance(); assertThat(BES_PROTO_UTIL.bazelEvent(1, firstEventTimestamp, anything)) .isEqualTo( PublishBuildToolEventStreamRequest.newBuilder() .addAllNotificationKeywords(EXPECTED_KEYWORDS) .setProjectId(PROJECT_ID) .setOrderedBuildEvent( OrderedBuildEvent.newBuilder() .setStreamId( StreamId.newBuilder() .setBuildId(BUILD_REQUEST_ID) .setInvocationId(BUILD_INVOCATION_ID) .setComponent(BuildComponent.TOOL)) .setSequenceNumber(1) .setEvent( BuildEvent.newBuilder() .setEventTime(firstEventTimestamp) .setBazelEvent(anything)) .build()) .build()); Timestamp secondEventTimestamp = Timestamps.fromMillis(clock.advanceMillis(100)); assertThat(BES_PROTO_UTIL.bazelEvent(2, secondEventTimestamp, anything)) .isEqualTo( PublishBuildToolEventStreamRequest.newBuilder() .setProjectId(PROJECT_ID) .setOrderedBuildEvent( OrderedBuildEvent.newBuilder() .setStreamId( StreamId.newBuilder() .setBuildId(BUILD_REQUEST_ID) .setInvocationId(BUILD_INVOCATION_ID) .setComponent(BuildComponent.TOOL)) .setSequenceNumber(2) .setEvent( BuildEvent.newBuilder() .setEventTime(secondEventTimestamp) .setBazelEvent(anything)) .build()) .build()); Timestamp thirdEventTimestamp = Timestamps.fromMillis(clock.advanceMillis(100)); assertThat(BES_PROTO_UTIL.streamFinished(3, thirdEventTimestamp)) .isEqualTo( PublishBuildToolEventStreamRequest.newBuilder() .setProjectId(PROJECT_ID) .setOrderedBuildEvent( OrderedBuildEvent.newBuilder() .setStreamId( StreamId.newBuilder() .setBuildId(BUILD_REQUEST_ID) .setInvocationId(BUILD_INVOCATION_ID) .setComponent(BuildComponent.TOOL)) .setSequenceNumber(3) .setEvent( BuildEvent.newBuilder() .setEventTime(thirdEventTimestamp) .setComponentStreamFinished( BuildComponentStreamFinished.newBuilder() .setType(FinishType.FINISHED))) .build()) .build()); }