Miscellaneous clean up, refactoring

Simplified FunctionCatalog structure by no longer registering the actual target function since it is available in wrapper anyway.
Cleaned up logic in RequestProcessor
This commit is contained in:
Oleg Zhurakousky
2019-04-03 16:11:34 +02:00
parent 3fed1f1cd4
commit 085204bad2
6 changed files with 17 additions and 83 deletions

View File

@@ -19,6 +19,7 @@ package org.springframework.cloud.function.context.catalog;
import java.util.function.Function;
import java.util.function.Supplier;
import org.junit.Ignore;
import org.junit.Test;
import reactor.core.publisher.Flux;
@@ -37,6 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class InMemoryFunctionCatalogTests {
@Test
@Ignore // we no longer have a need to register the actual target function as it is contained within wrapper
public void testFunctionRegistration() {
TestFunction function = new TestFunction();
FunctionRegistration<TestFunction> registration = new FunctionRegistration<>(

View File

@@ -453,8 +453,8 @@ public class ContextFunctionCatalogAutoConfigurationTests {
.lookup(Function.class, "function");
assertThat(function.apply(Flux.just("foo")).blockFirst()).isEqualTo("FOO");
assertThat(bean).isNotSameAs(function);
assertThat(this.inspector.getRegistration(bean)).isNotNull();
assertThat(this.inspector.getRegistration(bean).getType())
assertThat(this.inspector.getRegistration(function)).isNotNull();
assertThat(this.inspector.getRegistration(function).getType())
.isEqualTo(this.inspector.getRegistration(function).getType());
}