From 4de029dffd62c15517b15a3f1ca33f153737f1b4 Mon Sep 17 00:00:00 2001 From: fxingyuan Date: Fri, 22 May 2020 14:14:08 +0200 Subject: [PATCH] add test --- docs/src/main/asciidoc/adapters/aws-intro.adoc | 14 ++++---------- .../com/example/SampleApplicationMvcTests.java | 6 ++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/src/main/asciidoc/adapters/aws-intro.adoc b/docs/src/main/asciidoc/adapters/aws-intro.adoc index 5549565bd..222189034 100644 --- a/docs/src/main/asciidoc/adapters/aws-intro.adoc +++ b/docs/src/main/asciidoc/adapters/aws-intro.adoc @@ -59,20 +59,14 @@ to use. The next section will explain you how you can accomplish just that. ==== AWS Request Handlers The adapter has a couple of generic request handlers that you can use. The most generic is (and the one we used in the Getting Started section) -is `org.springframework.cloud.function.adapter.aws.FunctionInvoke` which is the implementation of AWS's `RequestStreamHandler`. +is `org.springframework.cloud.function.adapter.aws.FunctionInvoker` which is the implementation of AWS's `RequestStreamHandler`. User doesn't need to do anything other then specify it as 'handler' on AWS dashborad when deploying function. It will handle most of the case including Kinesis, streaming etc. . - -The most generic is -`SpringBootStreamHandler`, which uses a Jackson `ObjectMapper` provided by Spring Boot to serialize and deserialize the objects -in the function. There is also a `SpringBootRequestHandler` which you can extend, and provide the input and output types as type -parameters (enabling AWS to inspect the class and do the JSON conversions itself). - -If your app has more than one `@Bean` of type `Function` etc. then you can choose the one to use by configuring `function.name` -(e.g. as `FUNCTION_NAME` environment variable in AWS). The functions are extracted from the Spring Cloud `FunctionCatalog` -(searching first for `Function` then `Consumer` and finally `Supplier`). +If your app has more than one `@Bean` of type `Function` etc. then you can choose the one to use by configuring `spring.cloud.function.definition` +property or environment variable. The functions are extracted from the Spring Cloud `FunctionCatalog`. In the event you don't specify `spring.cloud.function.definition` +the framework will attempt to find a default following the search order where it searches first for `Function` then `Consumer` and finally `Supplier`). diff --git a/spring-cloud-function-samples/function-sample/src/test/java/com/example/SampleApplicationMvcTests.java b/spring-cloud-function-samples/function-sample/src/test/java/com/example/SampleApplicationMvcTests.java index e41b79c81..018652151 100644 --- a/spring-cloud-function-samples/function-sample/src/test/java/com/example/SampleApplicationMvcTests.java +++ b/spring-cloud-function-samples/function-sample/src/test/java/com/example/SampleApplicationMvcTests.java @@ -48,6 +48,12 @@ public void words() throws Exception { mockMvc.perform(asyncDispatch(result)).andExpect(content().string("[\"foo\",\"bar\"]")); } + @Test + public void wordsAndUppercase() throws Exception { + MvcResult result = this.mockMvc.perform(get("/words|uppercase")).andReturn(); + mockMvc.perform(asyncDispatch(result)).andExpect(content().string("[\"FOO\",\"BAR\"]")); + } + @Test public void uppercase() throws Exception { MvcResult result = this.mockMvc.perform(post("/uppercase").contentType(MediaType.TEXT_PLAIN).content("foo")).andReturn();