@Test public void storageData() throws IOException { Event legacyEvent = legacyEventForResource("storage.json"); CloudEvent cloudEvent = GcfEvents.convertToCloudEvent(legacyEvent); Map<String, Object> data = cloudEventDataJson(cloudEvent); assertThat(data).containsAtLeast( "bucket", "some-bucket", "timeCreated", "2020-04-23T07:38:57.230Z", "generation", "1587627537231057", "metageneration", "1", "size", "352"); }
static CloudEvent convertToCloudEvent(Event legacyEvent) { String eventType = legacyEvent.getContext().eventType(); EventAdapter eventAdapter = EVENT_TYPE_MAPPING.get(eventType); if (eventAdapter == null) { throw new IllegalArgumentException("Unrecognized event type \"" + eventType + "\""); } return eventAdapter.convertToCloudEvent(legacyEvent); }
GcfEvents { static CloudEvent convertToCloudEvent(Event legacyEvent) { String eventType = legacyEvent.getContext().eventType(); EventAdapter eventAdapter = EVENT_TYPE_MAPPING.get(eventType); if (eventAdapter == null) { throw new IllegalArgumentException("Unrecognized event type \"" + eventType + "\""); } return eventAdapter.convertToCloudEvent(legacyEvent); } }
GcfEvents { static CloudEvent convertToCloudEvent(Event legacyEvent) { String eventType = legacyEvent.getContext().eventType(); EventAdapter eventAdapter = EVENT_TYPE_MAPPING.get(eventType); if (eventAdapter == null) { throw new IllegalArgumentException("Unrecognized event type \"" + eventType + "\""); } return eventAdapter.convertToCloudEvent(legacyEvent); }  }
GcfEvents { static CloudEvent convertToCloudEvent(Event legacyEvent) { String eventType = legacyEvent.getContext().eventType(); EventAdapter eventAdapter = EVENT_TYPE_MAPPING.get(eventType); if (eventAdapter == null) { throw new IllegalArgumentException("Unrecognized event type \"" + eventType + "\""); } return eventAdapter.convertToCloudEvent(legacyEvent); }   }
GcfEvents { static CloudEvent convertToCloudEvent(Event legacyEvent) { String eventType = legacyEvent.getContext().eventType(); EventAdapter eventAdapter = EVENT_TYPE_MAPPING.get(eventType); if (eventAdapter == null) { throw new IllegalArgumentException("Unrecognized event type \"" + eventType + "\""); } return eventAdapter.convertToCloudEvent(legacyEvent); }    }