Revert "* Simplify functionalTracingEnabled variable logic"
This reverts commit d37f603aa4.
This commit is contained in:
@@ -38,8 +38,9 @@ public abstract class FunctionAroundWrapper implements BiFunction<Object, Functi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Object apply(Object input, FunctionInvocationWrapper targetFunction) {
|
public final Object apply(Object input, FunctionInvocationWrapper targetFunction) {
|
||||||
String functionalTracingEnabledStr = System.getProperty("spring.sleuth.function.enabled", "true");
|
String functionalTracingEnabledStr = System.getProperty("spring.sleuth.function.enabled");
|
||||||
boolean functionalTracingEnabled = Boolean.parseBoolean(functionalTracingEnabledStr);
|
boolean functionalTracingEnabled =
|
||||||
|
!StringUtils.hasText(functionalTracingEnabledStr) || Boolean.parseBoolean(functionalTracingEnabledStr);
|
||||||
if (functionalTracingEnabled) {
|
if (functionalTracingEnabled) {
|
||||||
return this.doApply(input, targetFunction);
|
return this.doApply(input, targetFunction);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -566,16 +566,6 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
|||||||
assertThat(result.getHeaders().get("after")).isEqualTo("bar");
|
assertThat(result.getHeaders().get("after")).isEqualTo("bar");
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
|
||||||
@Test
|
|
||||||
public void testWrappedWithAroundAdviseNotMessageReturnConfiguration() {
|
|
||||||
FunctionCatalog catalog = this.configureCatalog(WrappedWithAroundAdviseNotMessageReturnConfiguration.class);
|
|
||||||
Function f = catalog.lookup("uppercase");
|
|
||||||
Message result = (Message) f.apply(MessageBuilder.withPayload("hello").setHeader("myHeader", "myValue").build());
|
|
||||||
assertThat(result.getHeaders()).containsEntry("myHeader", "myValue").containsEntry("advised", "true");
|
|
||||||
assertThat(result.getPayload()).isEqualTo("HELLO");
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
@Test
|
@Test
|
||||||
public void testEachElementInFluxIsProcessed() {
|
public void testEachElementInFluxIsProcessed() {
|
||||||
@@ -927,32 +917,6 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EnableAutoConfiguration
|
|
||||||
@Configuration
|
|
||||||
protected static class WrappedWithAroundAdviseNotMessageReturnConfiguration {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public Function<Message<String>, String> uppercase() {
|
|
||||||
return v -> v.getPayload().toUpperCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public FunctionAroundWrapper wrapper() {
|
|
||||||
return new FunctionAroundWrapper() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Object doApply(Object input, FunctionInvocationWrapper targetFunction) {
|
|
||||||
// in this test we know input is a Message
|
|
||||||
Message<?> mInput = (Message<?>) input;
|
|
||||||
Message<?> advisedMessage = MessageBuilder.fromMessage(mInput).setHeader("advised", "true").build();
|
|
||||||
Object result = targetFunction.apply(advisedMessage);
|
|
||||||
assertThat(result).isInstanceOf(Message.class);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EnableAutoConfiguration
|
@EnableAutoConfiguration
|
||||||
@Configuration
|
@Configuration
|
||||||
protected static class SampleFunctionConfiguration {
|
protected static class SampleFunctionConfiguration {
|
||||||
|
|||||||
Reference in New Issue
Block a user