Skip to content

Commit

Permalink
Update to Milestone 2 of the CloudEvents SDK. (#56)
Browse files Browse the repository at this point in the history
Temporarily switch the Functions Framework to use a SNAPSHOT version of the API.
  • Loading branch information
eamonnmcmanus authored Sep 3, 2020
1 parent a114c01 commit 1ca4d06
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion functions-framework-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<dependency>
<groupId>io.cloudevents</groupId>
<artifactId>cloudevents-api</artifactId>
<version>2.0.0-milestone1</version>
<version>2.0.0-milestone2</version>
</dependency>
</dependencies>

Expand Down
6 changes: 3 additions & 3 deletions invoker/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@
<dependency>
<groupId>io.cloudevents</groupId>
<artifactId>cloudevents-api</artifactId>
<version>2.0.0-milestone1</version>
<version>2.0.0-milestone2</version>
</dependency>
<dependency>
<groupId>io.cloudevents</groupId>
<artifactId>cloudevents-core</artifactId>
<version>2.0.0-milestone1</version>
<version>2.0.0-milestone2</version>
</dependency>
<dependency>
<groupId>io.cloudevents</groupId>
<artifactId>cloudevents-json-jackson</artifactId>
<version>2.0.0-milestone1</version>
<version>2.0.0-milestone2</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.google.cloud.functions.invoker;

import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toMap;

import com.google.cloud.functions.BackgroundFunction;
Expand All @@ -32,7 +31,7 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.lang.reflect.Type;
import java.time.ZonedDateTime;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -132,7 +131,7 @@ private static Event parseLegacyEvent(HttpServletRequest req) throws IOException
}

private static Context contextFromCloudEvent(CloudEvent cloudEvent) {
ZonedDateTime timestamp = Optional.ofNullable(cloudEvent.getTime()).orElse(ZonedDateTime.now());
OffsetDateTime timestamp = Optional.ofNullable(cloudEvent.getTime()).orElse(OffsetDateTime.now());
String timestampString = DateTimeFormatter.ISO_INSTANT.format(timestamp);
// We don't have an obvious replacement for the Context.resource field, which with legacy events
// corresponded to a value present for some proprietary Google event types.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -121,7 +121,7 @@ private static CloudEvent sampleCloudEvent(File snoopFile) {
.withDataSchema(URI.create("/schema"))
.withDataContentType("application/json")
.withData(("{\"a\": 2, \"b\": 3, \"targetFile\": \"" + snoopFile + "\"}").getBytes(UTF_8))
.withTime(ZonedDateTime.of(2018, 4, 5, 17, 31, 0, 0, ZoneOffset.UTC))
.withTime(OffsetDateTime.of(2018, 4, 5, 17, 31, 0, 0, ZoneOffset.UTC))
.build();
}

Expand Down
2 changes: 1 addition & 1 deletion invoker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<dependency>
<groupId>com.google.cloud.functions</groupId>
<artifactId>functions-framework-api</artifactId>
<version>1.0.2</version>
<version>1.0.3-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down

0 comments on commit 1ca4d06

Please sign in to comment.