Skip to content

Commit 6d557b4

Browse files
author
Ace Nassri
authored
functions: remove redundant GCS sample (GoogleCloudPlatform#3368)
1 parent 8425d86 commit 6d557b4

File tree

9 files changed

+13
-351
lines changed

9 files changed

+13
-351
lines changed

functions/helloworld/hello-gcs-generic/pom.xml

Lines changed: 0 additions & 99 deletions
This file was deleted.

functions/helloworld/hello-gcs-generic/src/main/java/functions/HelloGcsGeneric.java

Lines changed: 0 additions & 40 deletions
This file was deleted.

functions/helloworld/hello-gcs-generic/src/main/java/functions/eventpojos/GcsEvent.java

Lines changed: 0 additions & 72 deletions
This file was deleted.

functions/helloworld/hello-gcs-generic/src/test/java/functions/HelloGcsGenericTest.java

Lines changed: 0 additions & 65 deletions
This file was deleted.

functions/helloworld/hello-gcs-generic/src/test/java/functions/eventpojos/MockContext.java

Lines changed: 0 additions & 48 deletions
This file was deleted.

functions/helloworld/hello-gcs/src/main/java/functions/HelloGcs.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package functions;
1818

1919
// [START functions_helloworld_storage]
20-
2120
import com.google.cloud.functions.BackgroundFunction;
2221
import com.google.cloud.functions.Context;
2322
import functions.eventpojos.GcsEvent;
@@ -28,12 +27,14 @@ public class HelloGcs implements BackgroundFunction<GcsEvent> {
2827

2928
@Override
3029
public void accept(GcsEvent event, Context context) {
31-
if ("google.storage.object.finalize".equals(context.eventType())) {
32-
// Default event type for GCS-triggered functions
33-
logger.info(String.format("File %s uploaded.", event.getName()));
34-
} else {
35-
logger.warning(String.format("Unsupported event type: %s", context.eventType()));
36-
}
30+
logger.info("Event: " + context.eventId());
31+
logger.info("Event Type: " + context.eventType());
32+
logger.info("Bucket: " + event.getBucket());
33+
logger.info("File: " + event.getName());
34+
logger.info("Metageneration: " + event.getMetageneration());
35+
logger.info("Created: " + event.getTimeCreated());
36+
logger.info("Updated: " + event.getUpdated());
3737
}
3838
}
39+
3940
// [END functions_helloworld_storage]

functions/helloworld/hello-gcs/src/test/java/functions/ExampleIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public void helloGcs_shouldRunWithFunctionsFramework() throws Throwable {
109109

110110
// Verify desired name value is present
111111
assertThat(stdoutBytes.toString(StandardCharsets.UTF_8)).contains(
112-
String.format("File %s uploaded.", name));
112+
String.format("File: %s", name));
113113
}
114114
}
115115
// [END functions_storage_integration_test]

functions/helloworld/hello-gcs/src/test/java/functions/ExampleSystemTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void helloGcs_shouldRunOnGcf() {
9696

9797
// Keep retrying until the logs contain the desired invocation's log entry
9898
// (If the invocation failed, the retry process will eventually time out)
99-
String expected = String.format("File %s uploaded.", filename);
99+
String expected = String.format("File: %s", filename);
100100
RetryRegistry registry = RetryRegistry.of(RetryConfig.custom()
101101
.maxAttempts(8)
102102
.intervalFunction(IntervalFunction.ofExponentialBackoff(1000, 2))

0 commit comments

Comments
 (0)