Added test for previous commit
This commit is contained in:
@@ -187,6 +187,9 @@ class FunctionArchiveDeployer extends JarLauncher {
|
||||
|
||||
private boolean isBootApplicationWithMain() {
|
||||
try {
|
||||
if (this.getArchive().getManifest() == null) {
|
||||
return false;
|
||||
}
|
||||
return StringUtils.hasText(this.getArchive().getManifest().getMainAttributes().getValue("Start-Class"));
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
@@ -46,6 +46,7 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
||||
* and {@link SmartLifecycle#stop()} operations.
|
||||
* <br>
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Eric Bottard
|
||||
*
|
||||
* @since 3.0
|
||||
*
|
||||
|
||||
@@ -86,6 +86,26 @@ public class FunctionDeployerTests {
|
||||
assertThat(results.get(1)).isEqualTo("STACY");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithSimplestJarExploaded() throws Exception {
|
||||
String[] args = new String[] {
|
||||
"--spring.cloud.function.location=target/it/simplestjar/target/classes",
|
||||
"--spring.cloud.function.function-class=function.example.UpperCaseFunction" };
|
||||
|
||||
ApplicationContext context = SpringApplication.run(DeployerApplication.class, args);
|
||||
FunctionCatalog catalog = context.getBean(FunctionCatalog.class);
|
||||
Function<String, String> function = catalog.lookup("upperCaseFunction");
|
||||
|
||||
assertThat(function.apply("bob")).isEqualTo("BOB");
|
||||
assertThat(function.apply("stacy")).isEqualTo("STACY");
|
||||
|
||||
Function<Flux<String>, Flux<String>> functionAsFlux = catalog.lookup("upperCaseFunction");
|
||||
|
||||
List<String> results = functionAsFlux.apply(Flux.just("bob", "stacy")).collectList().block();
|
||||
assertThat(results.get(0)).isEqualTo("BOB");
|
||||
assertThat(results.get(1)).isEqualTo("STACY");
|
||||
}
|
||||
|
||||
/*
|
||||
* Target function `class UpperCaseFunction implements Function<String, String>`
|
||||
* No Main/Start class present, no Spring configuration
|
||||
|
||||
Reference in New Issue
Block a user