Revert "* Simplify functionalTracingEnabled variable logic"

This reverts commit d37f603aa4.
This commit is contained in:
Soby Chacko
2022-02-11 12:41:27 -05:00
parent 610d93c860
commit 5a024de166
2 changed files with 3 additions and 38 deletions

View File

@@ -38,8 +38,9 @@ public abstract class FunctionAroundWrapper implements BiFunction<Object, Functi
@Override
public final Object apply(Object input, FunctionInvocationWrapper targetFunction) {
String functionalTracingEnabledStr = System.getProperty("spring.sleuth.function.enabled", "true");
boolean functionalTracingEnabled = Boolean.parseBoolean(functionalTracingEnabledStr);
String functionalTracingEnabledStr = System.getProperty("spring.sleuth.function.enabled");
boolean functionalTracingEnabled =
!StringUtils.hasText(functionalTracingEnabledStr) || Boolean.parseBoolean(functionalTracingEnabledStr);
if (functionalTracingEnabled) {
return this.doApply(input, targetFunction);
}

View File

@@ -566,16 +566,6 @@ public class BeanFactoryAwareFunctionRegistryTests {
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" })
@Test
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
@Configuration
protected static class SampleFunctionConfiguration {