Skip to content

Commit

Permalink
feat: [eventarcpublishing] Introduce the event publishing using JSON …
Browse files Browse the repository at this point in the history
…representation of CloudEvents (#8730)

* feat: Introduce the event publishing using JSON representation of CloudEvents

Clients can now use either the Protobuf or the JSON CloudEvents representation
when interacting with Eventarc Publishing API. This change benefits both
Channel and ChannelConnection consumers.

PiperOrigin-RevId: 486208303

Source-Link: googleapis/googleapis@079ef84

Source-Link: googleapis/googleapis-gen@dd62dfc
Copy-Tag: eyJwIjoiamF2YS1ldmVudGFyYy1wdWJsaXNoaW5nLy5Pd2xCb3QueWFtbCIsImgiOiJkZDYyZGZjMTc0YWJiMjViZjJlNTBhMmE1NDY1MWRhNzBkYWVkNzgxIn0=

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Nov 8, 2022
1 parent ba1a887 commit ae2f0fe
Show file tree
Hide file tree
Showing 10 changed files with 901 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
* PublishChannelConnectionEventsRequest.newBuilder()
* .setChannelConnection("channelConnection-1932021695")
* .addAllEvents(new ArrayList<Any>())
* .addAllTextEvents(new ArrayList<String>())
* .build();
* PublishChannelConnectionEventsResponse response =
* publisherClient.publishChannelConnectionEvents(request);
Expand Down Expand Up @@ -202,6 +203,7 @@ public PublisherStub getStub() {
* PublishChannelConnectionEventsRequest.newBuilder()
* .setChannelConnection("channelConnection-1932021695")
* .addAllEvents(new ArrayList<Any>())
* .addAllTextEvents(new ArrayList<String>())
* .build();
* PublishChannelConnectionEventsResponse response =
* publisherClient.publishChannelConnectionEvents(request);
Expand Down Expand Up @@ -233,6 +235,7 @@ public final PublishChannelConnectionEventsResponse publishChannelConnectionEven
* PublishChannelConnectionEventsRequest.newBuilder()
* .setChannelConnection("channelConnection-1932021695")
* .addAllEvents(new ArrayList<Any>())
* .addAllTextEvents(new ArrayList<String>())
* .build();
* ApiFuture<PublishChannelConnectionEventsResponse> future =
* publisherClient.publishChannelConnectionEventsCallable().futureCall(request);
Expand Down Expand Up @@ -264,6 +267,7 @@ public final PublishChannelConnectionEventsResponse publishChannelConnectionEven
* PublishEventsRequest.newBuilder()
* .setChannel("channel738950403")
* .addAllEvents(new ArrayList<Any>())
* .addAllTextEvents(new ArrayList<String>())
* .build();
* PublishEventsResponse response = publisherClient.publishEvents(request);
* }
Expand Down Expand Up @@ -293,6 +297,7 @@ public final PublishEventsResponse publishEvents(PublishEventsRequest request) {
* PublishEventsRequest.newBuilder()
* .setChannel("channel738950403")
* .addAllEvents(new ArrayList<Any>())
* .addAllTextEvents(new ArrayList<String>())
* .build();
* ApiFuture<PublishEventsResponse> future =
* publisherClient.publishEventsCallable().futureCall(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
* PublishChannelConnectionEventsRequest.newBuilder()
* .setChannelConnection("channelConnection-1932021695")
* .addAllEvents(new ArrayList<Any>())
* .addAllTextEvents(new ArrayList<String>())
* .build();
* PublishChannelConnectionEventsResponse response =
* publisherClient.publishChannelConnectionEvents(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public void publishChannelConnectionEventsTest() throws Exception {
.setChannelConnection(
"projects/project-748/locations/location-748/channelConnections/channelConnection-748")
.addAllEvents(new ArrayList<Any>())
.addAllTextEvents(new ArrayList<String>())
.build();

PublishChannelConnectionEventsResponse actualResponse =
Expand Down Expand Up @@ -117,6 +118,7 @@ public void publishChannelConnectionEventsExceptionTest() throws Exception {
.setChannelConnection(
"projects/project-748/locations/location-748/channelConnections/channelConnection-748")
.addAllEvents(new ArrayList<Any>())
.addAllTextEvents(new ArrayList<String>())
.build();
client.publishChannelConnectionEvents(request);
Assert.fail("No exception raised");
Expand All @@ -134,6 +136,7 @@ public void publishEventsTest() throws Exception {
PublishEventsRequest.newBuilder()
.setChannel("projects/project-2616/locations/location-2616/channels/channel-2616")
.addAllEvents(new ArrayList<Any>())
.addAllTextEvents(new ArrayList<String>())
.build();

PublishEventsResponse actualResponse = client.publishEvents(request);
Expand Down Expand Up @@ -166,6 +169,7 @@ public void publishEventsExceptionTest() throws Exception {
PublishEventsRequest.newBuilder()
.setChannel("projects/project-2616/locations/location-2616/channels/channel-2616")
.addAllEvents(new ArrayList<Any>())
.addAllTextEvents(new ArrayList<String>())
.build();
client.publishEvents(request);
Assert.fail("No exception raised");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public void publishChannelConnectionEventsTest() throws Exception {
PublishChannelConnectionEventsRequest.newBuilder()
.setChannelConnection("channelConnection-1932021695")
.addAllEvents(new ArrayList<Any>())
.addAllTextEvents(new ArrayList<String>())
.build();

PublishChannelConnectionEventsResponse actualResponse =
Expand All @@ -100,6 +101,7 @@ public void publishChannelConnectionEventsTest() throws Exception {

Assert.assertEquals(request.getChannelConnection(), actualRequest.getChannelConnection());
Assert.assertEquals(request.getEventsList(), actualRequest.getEventsList());
Assert.assertEquals(request.getTextEventsList(), actualRequest.getTextEventsList());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
Expand All @@ -116,6 +118,7 @@ public void publishChannelConnectionEventsExceptionTest() throws Exception {
PublishChannelConnectionEventsRequest.newBuilder()
.setChannelConnection("channelConnection-1932021695")
.addAllEvents(new ArrayList<Any>())
.addAllTextEvents(new ArrayList<String>())
.build();
client.publishChannelConnectionEvents(request);
Assert.fail("No exception raised");
Expand All @@ -133,6 +136,7 @@ public void publishEventsTest() throws Exception {
PublishEventsRequest.newBuilder()
.setChannel("channel738950403")
.addAllEvents(new ArrayList<Any>())
.addAllTextEvents(new ArrayList<String>())
.build();

PublishEventsResponse actualResponse = client.publishEvents(request);
Expand All @@ -144,6 +148,7 @@ public void publishEventsTest() throws Exception {

Assert.assertEquals(request.getChannel(), actualRequest.getChannel());
Assert.assertEquals(request.getEventsList(), actualRequest.getEventsList());
Assert.assertEquals(request.getTextEventsList(), actualRequest.getTextEventsList());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
Expand All @@ -160,6 +165,7 @@ public void publishEventsExceptionTest() throws Exception {
PublishEventsRequest.newBuilder()
.setChannel("channel738950403")
.addAllEvents(new ArrayList<Any>())
.addAllTextEvents(new ArrayList<String>())
.build();
client.publishEvents(request);
Assert.fail("No exception raised");
Expand Down
Loading

0 comments on commit ae2f0fe

Please sign in to comment.