Skip to content

Commit 609035b

Browse files
committed
Revert "* Simplify functionalTracingEnabled variable logic"
This reverts commit 159c82e.
1 parent 7704c2f commit 609035b

File tree

2 files changed

+3
-38
lines changed

2 files changed

+3
-38
lines changed

spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/FunctionAroundWrapper.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ public abstract class FunctionAroundWrapper implements BiFunction<Object, Functi
3838

3939
@Override
4040
public final Object apply(Object input, FunctionInvocationWrapper targetFunction) {
41-
String functionalTracingEnabledStr = System.getProperty("spring.sleuth.function.enabled", "true");
42-
boolean functionalTracingEnabled = Boolean.parseBoolean(functionalTracingEnabledStr);
41+
String functionalTracingEnabledStr = System.getProperty("spring.sleuth.function.enabled");
42+
boolean functionalTracingEnabled =
43+
!StringUtils.hasText(functionalTracingEnabledStr) || Boolean.parseBoolean(functionalTracingEnabledStr);
4344
if (functionalTracingEnabled) {
4445
return this.doApply(input, targetFunction);
4546
}

spring-cloud-function-context/src/test/java/org/springframework/cloud/function/context/catalog/BeanFactoryAwareFunctionRegistryTests.java

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -570,16 +570,6 @@ public void testWrappedWithAroundAdviseConfiguration() {
570570
assertThat(result.getHeaders().get("after")).isEqualTo("bar");
571571
}
572572

573-
@SuppressWarnings({ "rawtypes", "unchecked" })
574-
@Test
575-
public void testWrappedWithAroundAdviseNotMessageReturnConfiguration() {
576-
FunctionCatalog catalog = this.configureCatalog(WrappedWithAroundAdviseNotMessageReturnConfiguration.class);
577-
Function f = catalog.lookup("uppercase");
578-
Message result = (Message) f.apply(MessageBuilder.withPayload("hello").setHeader("myHeader", "myValue").build());
579-
assertThat(result.getHeaders()).containsEntry("myHeader", "myValue").containsEntry("advised", "true");
580-
assertThat(result.getPayload()).isEqualTo("HELLO");
581-
}
582-
583573
@SuppressWarnings({ "rawtypes", "unchecked" })
584574
@Test
585575
public void testEachElementInFluxIsProcessed() {
@@ -931,32 +921,6 @@ protected Object doApply(Object input, FunctionInvocationWrapper targetFunction)
931921
}
932922
}
933923

934-
@EnableAutoConfiguration
935-
@Configuration
936-
protected static class WrappedWithAroundAdviseNotMessageReturnConfiguration {
937-
938-
@Bean
939-
public Function<Message<String>, String> uppercase() {
940-
return v -> v.getPayload().toUpperCase();
941-
}
942-
943-
@Bean
944-
public FunctionAroundWrapper wrapper() {
945-
return new FunctionAroundWrapper() {
946-
947-
@Override
948-
protected Object doApply(Object input, FunctionInvocationWrapper targetFunction) {
949-
// in this test we know input is a Message
950-
Message<?> mInput = (Message<?>) input;
951-
Message<?> advisedMessage = MessageBuilder.fromMessage(mInput).setHeader("advised", "true").build();
952-
Object result = targetFunction.apply(advisedMessage);
953-
assertThat(result).isInstanceOf(Message.class);
954-
return result;
955-
}
956-
};
957-
}
958-
}
959-
960924
@EnableAutoConfiguration
961925
@Configuration
962926
protected static class SampleFunctionConfiguration {

0 commit comments

Comments
 (0)