Skip to content

Commit 0cbd5e8

Browse files
committed
Revert "* Simplify functionalTracingEnabled variable logic"
This reverts commit 49e027a.
1 parent a8ac826 commit 0cbd5e8

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
@@ -566,16 +566,6 @@ public void testWrappedWithAroundAdviseConfiguration() {
566566
assertThat(result.getHeaders().get("after")).isEqualTo("bar");
567567
}
568568

569-
@SuppressWarnings({ "rawtypes", "unchecked" })
570-
@Test
571-
public void testWrappedWithAroundAdviseNotMessageReturnConfiguration() {
572-
FunctionCatalog catalog = this.configureCatalog(WrappedWithAroundAdviseNotMessageReturnConfiguration.class);
573-
Function f = catalog.lookup("uppercase");
574-
Message result = (Message) f.apply(MessageBuilder.withPayload("hello").setHeader("myHeader", "myValue").build());
575-
assertThat(result.getHeaders()).containsEntry("myHeader", "myValue").containsEntry("advised", "true");
576-
assertThat(result.getPayload()).isEqualTo("HELLO");
577-
}
578-
579569
@SuppressWarnings({ "rawtypes", "unchecked" })
580570
@Test
581571
public void testEachElementInFluxIsProcessed() {
@@ -927,32 +917,6 @@ protected Object doApply(Object input, FunctionInvocationWrapper targetFunction)
927917
}
928918
}
929919

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

0 commit comments

Comments
 (0)