GH-1077 Update AWSLambdaUtils.java with null check
Resolves #1077 by checking for a null package, which can happen when the inputType is a Message that encloses a primitive generic type Update AWSTypesMessageConverter.java Added additional fixes for #1077 in AWTypesMessageConverter Update FunctionInvokerTests.java Added unit tests to verify fix for #1077 Checkstyle fix Resolves #1078
This commit is contained in:
committed by
Oleg Zhurakousky
parent
f33b4e4919
commit
1f188e8e36
@@ -1407,6 +1407,21 @@ public class FunctionInvokerTests {
|
||||
assertThat(result.get("body")).isEqualTo("\"olleh\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrimitiveMessage() throws Exception {
|
||||
System.setProperty("MAIN_CLASS", PrimitiveConfiguration.class.getName());
|
||||
System.setProperty("spring.cloud.function.definition", "returnByteArrayAsMessage");
|
||||
FunctionInvoker invoker = new FunctionInvoker();
|
||||
|
||||
String testString = "{ \"message\": \"Hello, world!\" }";
|
||||
InputStream targetStream = new ByteArrayInputStream(testString.getBytes());
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
invoker.handleRequest(targetStream, output, null);
|
||||
|
||||
String result = output.toString();
|
||||
assertThat(result).isEqualTo(testString);
|
||||
}
|
||||
|
||||
@EnableAutoConfiguration
|
||||
@Configuration
|
||||
public static class AuthorizerConfiguration {
|
||||
@@ -1811,6 +1826,17 @@ public class FunctionInvokerTests {
|
||||
}
|
||||
}
|
||||
|
||||
@EnableAutoConfiguration
|
||||
@Configuration
|
||||
public static class PrimitiveConfiguration {
|
||||
@Bean
|
||||
public Function<Message<byte[]>, byte[]> returnByteArrayAsMessage() {
|
||||
return v -> {
|
||||
return v.getPayload();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static class Person {
|
||||
private String name;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user