WingtipsSpringBoot2WebfluxConfiguration { @Bean @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE) public WingtipsSpringWebfluxWebFilter wingtipsSpringWebfluxWebFilter() { if (wingtipsProperties.isWingtipsDisabled()) { return null; } if (customSpringWebfluxWebFilter != null) { return null; } return WingtipsSpringWebfluxWebFilter .newBuilder() .withUserIdHeaderKeys(extractUserIdHeaderKeysAsList(wingtipsProperties)) .withTagAndNamingStrategy(extractTagAndNamingStrategy(wingtipsProperties)) .withTagAndNamingAdapter(extractTagAndNamingAdapter(wingtipsProperties)) .build(); } @Autowired  WingtipsSpringBoot2WebfluxConfiguration(WingtipsSpringBoot2WebfluxProperties wingtipsProperties); @Bean @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE) WingtipsSpringWebfluxWebFilter wingtipsSpringWebfluxWebFilter(); @Bean WingtipsReactorInitializer reactorInitializer();  }
@DataProvider(value = { "true | USER_ID_HEADER_KEYS_PROP_IS_SET", "true | TAG_AND_NAMING_STRATEGY_PROP_IS_SET", "true | TAG_AND_NAMING_ADAPTER_PROP_IS_SET", "true | ALL_PROPS_ARE_SET", "false | USER_ID_HEADER_KEYS_PROP_IS_SET", "false | TAG_AND_NAMING_STRATEGY_PROP_IS_SET", "false | TAG_AND_NAMING_ADAPTER_PROP_IS_SET", "false | ALL_PROPS_ARE_SET" }, splitBy = "\\|") @SuppressWarnings("unchecked") @Test public void wingtipsRequestTracingFilter_returns_WingtipsSpringWebfluxWebFilter_with_expected_values( boolean appFilterOverrideIsNull, PropertiesScenario scenario ) { WingtipsSpringWebfluxWebFilter appFilterOverride = (appFilterOverrideIsNull) ? null : mock(WingtipsSpringWebfluxWebFilter.class); WingtipsSpringBoot2WebfluxProperties props = generateProps( false, scenario.userIdHeaderKeys, null, scenario.tagAndNamingStrategy, scenario.tagAndNamingAdapter, false ); WingtipsSpringBoot2WebfluxConfiguration conf = new WingtipsSpringBoot2WebfluxConfiguration(props); conf.customSpringWebfluxWebFilter = appFilterOverride; WingtipsSpringWebfluxWebFilter filterBean = conf.wingtipsSpringWebfluxWebFilter(); if (appFilterOverride == null) { assertThat(filterBean) .isNotNull() .isInstanceOf(WingtipsSpringWebfluxWebFilter.class); List<String> filterBeanUserIdHeaderKeys = (List<String>) Whitebox.getInternalState(filterBean, "userIdHeaderKeys"); HttpTagAndSpanNamingStrategy<ServerWebExchange, ServerHttpResponse> filterBeanTagStrategy = (HttpTagAndSpanNamingStrategy<ServerWebExchange, ServerHttpResponse>) Whitebox.getInternalState(filterBean, "tagAndNamingStrategy"); HttpTagAndSpanNamingAdapter<ServerWebExchange, ServerHttpResponse> filterBeanTagAdapter = (HttpTagAndSpanNamingAdapter<ServerWebExchange, ServerHttpResponse>) Whitebox.getInternalState(filterBean, "tagAndNamingAdapter"); assertThat(filterBeanUserIdHeaderKeys).isEqualTo(scenario.getExpectedUserIdHeaderKeyList()); assertThat(filterBeanTagStrategy).isInstanceOf(scenario.getExpectedTagStrategyClass()); assertThat(filterBeanTagAdapter).isInstanceOf(scenario.getExpectedTagAdapterClass()); assertThat(filterBean.getOrder()).isEqualTo(Ordered.HIGHEST_PRECEDENCE); } else { assertThat(filterBean).isNull(); } }
@Test public void wingtipsRequestTracingFilter_returns_null_if_WingtipsSpringBootProperties_indicates_disabled() { WingtipsSpringBoot2WebfluxProperties props = generateProps(true, null, null, null, null, false); WingtipsSpringBoot2WebfluxConfiguration conf = new WingtipsSpringBoot2WebfluxConfiguration(props); assertThat(conf.wingtipsSpringWebfluxWebFilter()).isNull(); }