Add support for empty function.bean

If there is a unique function it should be unambiguous. This change
also supports multiple functions, but the naming is unhelpful then
("function[0,1,2,]").
This commit is contained in:
Dave Syer
2018-11-12 14:07:36 +00:00
parent 9c6c7d09d4
commit cd89f45191
4 changed files with 69 additions and 8 deletions

View File

@@ -20,6 +20,7 @@ import org.junit.Ignore;
import org.junit.Test;
import org.springframework.cloud.function.context.FunctionCatalog;
import org.springframework.cloud.function.context.FunctionRegistration;
import org.springframework.cloud.function.test.Doubler;
import org.springframework.cloud.function.test.FunctionApp;
import org.springframework.cloud.function.test.FunctionRegistrar;
@@ -43,14 +44,13 @@ public class ApplicationRunnerTests {
}
@Test
@Ignore // related to boot 2.1 no bean override change
public void functional() {
ApplicationRunner runner = new ApplicationRunner(getClass().getClassLoader(),
FunctionRegistrar.class.getName());
runner.run();
assertThat(runner.containsBean(Doubler.class.getName())).isTrue();
assertThat(runner.getBean(Doubler.class.getName())).isNotNull();
assertThat(runner.containsBean(Doubler.class.getName())).isFalse();
assertThat(runner.getBean(FunctionCatalog.class.getName())).isNotNull();
assertThat(runner.getBeanNames(FunctionRegistration.class.getName())).hasSize(2);
runner.close();
}
}