GH-654 Remove FunctionProperties injection from MessageRoutingCallbackRSocketTests

This commit is contained in:
Oleg Zhurakousky
2021-02-24 13:31:31 +01:00
parent 410d494467
commit 1f43bbce28
3 changed files with 3 additions and 5 deletions

View File

@@ -37,8 +37,7 @@ public interface MessageRoutingCallback {
* Determines the name of the function definition to route incoming {@link Message}. * Determines the name of the function definition to route incoming {@link Message}.
* *
* @param message instance of incoming {@link Message} * @param message instance of incoming {@link Message}
* @param functionProperties instance of {@link FunctionProperties}
* @return the name of the route-to function definition * @return the name of the route-to function definition
*/ */
String functionDefinition(Message<?> message, FunctionProperties functionProperties); String functionDefinition(Message<?> message);
} }

View File

@@ -174,7 +174,7 @@ public class RoutingFunction implements Function<Object, Object> {
private FunctionInvocationWrapper functionFromCallback(Object input) { private FunctionInvocationWrapper functionFromCallback(Object input) {
if (input instanceof Message) { if (input instanceof Message) {
String functionDefinition = this.routingCallback.functionDefinition((Message<?>) input, this.functionProperties); String functionDefinition = this.routingCallback.functionDefinition((Message<?>) input);
if (StringUtils.hasText(functionDefinition)) { if (StringUtils.hasText(functionDefinition)) {
return this.functionFromDefinition(functionDefinition); return this.functionFromDefinition(functionDefinition);
} }

View File

@@ -25,7 +25,6 @@ import reactor.test.StepVerifier;
import org.springframework.boot.WebApplicationType; import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.function.context.FunctionProperties;
import org.springframework.cloud.function.context.MessageRoutingCallback; import org.springframework.cloud.function.context.MessageRoutingCallback;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@@ -110,7 +109,7 @@ public class MessageRoutingCallbackRSocketTests {
public MessageRoutingCallback customRouter() { public MessageRoutingCallback customRouter() {
return new MessageRoutingCallback() { return new MessageRoutingCallback() {
@Override @Override
public String functionDefinition(Message<?> message, FunctionProperties functionProperties) { public String functionDefinition(Message<?> message) {
return (String) message.getHeaders().get("func_name"); return (String) message.getHeaders().get("func_name");
} }
}; };