GH-1210 Add S3EventSerializer logic to ensure S3Event deserialization

Resolves #1210
This commit is contained in:
Oleg Zhurakousky
2024-12-17 17:11:48 +01:00
parent 536b49775e
commit 93f0c5e358
3 changed files with 38 additions and 2 deletions

View File

@@ -999,6 +999,18 @@ public class FunctionInvokerTests {
assertThat(result).contains("s3SchemaVersion");
}
@Test
public void testS3EventAsOutput() throws Exception {
System.setProperty("MAIN_CLASS", S3Configuration.class.getName());
System.setProperty("spring.cloud.function.definition", "outputS3Event");
FunctionInvoker invoker = new FunctionInvoker();
InputStream targetStream = new ByteArrayInputStream(this.s3Event.getBytes());
ByteArrayOutputStream output = new ByteArrayOutputStream();
invoker.handleRequest(targetStream, output, null);
assertThat(output.toByteArray()).isNotNull();
}
@Test
public void testS3Event() throws Exception {
System.setProperty("MAIN_CLASS", S3Configuration.class.getName());
@@ -1679,6 +1691,13 @@ public class FunctionInvokerTests {
@EnableAutoConfiguration
@Configuration
public static class S3Configuration {
@Bean
public Function<S3Event, S3Event> outputS3Event() {
return v -> {
return v;
};
}
@Bean
public Function<String, String> echoString() {
return v -> v;