gh-608 issue
This commit is contained in:
@@ -563,6 +563,20 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
|||||||
assertThat(productJson).isEqualTo(new String(result.getPayload()));
|
assertThat(productJson).isEqualTo(new String(result.getPayload()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGH_608_C() {
|
||||||
|
ApplicationContext context = new SpringApplicationBuilder(MessageFunctionConfiguration.class)
|
||||||
|
.run("--logging.level.org.springframework.cloud.function=DEBUG",
|
||||||
|
"--spring.main.lazy-initialization=true");
|
||||||
|
FunctionCatalog catalog = context.getBean(FunctionCatalog.class);
|
||||||
|
|
||||||
|
String productJson = "{\"key\":\"someKey\",\"data\": {\"name\":\"bike\"}}";
|
||||||
|
|
||||||
|
FunctionInvocationWrapper function = catalog.lookup("echoGenericObjectFlux", "application/json");
|
||||||
|
Message<byte[]> result = ((Flux<Message<byte[]>>) function.apply(productJson)).blockFirst();
|
||||||
|
assertThat(new String(result.getPayload())).isEqualTo("\"bike\"");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGH_609() {
|
public void testGH_609() {
|
||||||
FunctionCatalog catalog = this.configureCatalog(SampleFunctionConfiguration.class);
|
FunctionCatalog catalog = this.configureCatalog(SampleFunctionConfiguration.class);
|
||||||
@@ -833,6 +847,11 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
|||||||
public Function<Flux<Message<Product>>, Flux<Message<Product>>> echoFlux() {
|
public Function<Flux<Message<Product>>, Flux<Message<Product>>> echoFlux() {
|
||||||
return x -> x;
|
return x -> x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Function<Flux<Message<Event<String, Person>>>, Flux<String>> echoGenericObjectFlux() {
|
||||||
|
return x -> x.map(eventMessage -> eventMessage.getPayload().getData().getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EnableAutoConfiguration
|
@EnableAutoConfiguration
|
||||||
|
|||||||
Reference in New Issue
Block a user