gh-608 issue
This commit is contained in:
committed by
Oleg Zhurakousky
parent
376aae2d67
commit
2c82cf91f8
@@ -563,6 +563,20 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
||||
assertThat(f.get().getHeaders().get(MessageHeaders.CONTENT_TYPE)).isEqualTo(MimeTypeUtils.parseMimeType("text/*"));
|
||||
}
|
||||
|
||||
@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
|
||||
public void testGH_609() {
|
||||
FunctionCatalog catalog = this.configureCatalog(SampleFunctionConfiguration.class);
|
||||
@@ -822,6 +836,11 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Flux<Message<Event<String, Person>>>, Flux<String>> echoGenericObjectFlux() {
|
||||
return x -> x.map(eventMessage -> eventMessage.getPayload().getData().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@EnableAutoConfiguration
|
||||
|
||||
Reference in New Issue
Block a user