Formatting

This commit is contained in:
spencergibb
2025-04-22 12:52:26 -04:00
parent b1abe379cf
commit abd126f02e
3 changed files with 13 additions and 11 deletions

View File

@@ -203,8 +203,8 @@ public class RouteDefinitionRouteLocator implements RouteLocator {
}
return predicates.stream()
.map(nextPredicate -> lookup(routeDefinition, nextPredicate))
.reduce(AsyncPredicate.from(exchange -> true), AsyncPredicate::and);
.map(nextPredicate -> lookup(routeDefinition, nextPredicate))
.reduce(AsyncPredicate.from(exchange -> true), AsyncPredicate::and);
}
@SuppressWarnings("unchecked")

View File

@@ -91,13 +91,13 @@ public class GatewayPredicateVisitorTests {
PathRoutePredicateFactory pathRoutePredicateFactory = new PathRoutePredicateFactory(webFluxProperties);
PathRoutePredicateFactory.Config config = new PathRoutePredicateFactory.Config()
.setPatterns(List.of("/temp/**"))
.setMatchTrailingSlash(true);
.setPatterns(List.of("/temp/**"))
.setMatchTrailingSlash(true);
Predicate<ServerWebExchange> predicate = pathRoutePredicateFactory.apply(config);
ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("http://127.0.0.1:8080/gw/api/v1/temp/test")
.build());
ServerWebExchange exchange = MockServerWebExchange
.from(MockServerHttpRequest.get("http://127.0.0.1:8080/gw/api/v1/temp/test").build());
assertThat(predicate.test(exchange)).isEqualTo(true);
}
@@ -109,13 +109,13 @@ public class GatewayPredicateVisitorTests {
PathRoutePredicateFactory pathRoutePredicateFactory = new PathRoutePredicateFactory(webFluxProperties);
PathRoutePredicateFactory.Config config = new PathRoutePredicateFactory.Config()
.setPatterns(List.of("/temp/**"))
.setMatchTrailingSlash(true);
.setPatterns(List.of("/temp/**"))
.setMatchTrailingSlash(true);
Predicate<ServerWebExchange> predicate = pathRoutePredicateFactory.apply(config);
ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("http://127.0.0.1:8080/gw/api/v1/temp/test")
.build());
ServerWebExchange exchange = MockServerWebExchange
.from(MockServerHttpRequest.get("http://127.0.0.1:8080/gw/api/v1/temp/test").build());
assertThat(predicate.test(exchange)).isEqualTo(true);
@@ -139,4 +139,5 @@ public class GatewayPredicateVisitorTests {
LinkedHashSet<URI> uris = webExchange.getRequiredAttribute(GATEWAY_ORIGINAL_REQUEST_URL_ATTR);
assertThat(uris).contains(exchange.getRequest().getURI());
}
}

View File

@@ -55,7 +55,8 @@ public class PathRoutePredicatePathContainerAttrBenchMarkTests {
PathRoutePredicateFactory.Config config = new PathRoutePredicateFactory.Config()
.setPatterns(Collections.singletonList(PATH_PATTERN_PREFIX + i))
.setMatchTrailingSlash(true);
Predicate<ServerWebExchange> predicate = new PathRoutePredicateFactory(new WebFluxProperties()).apply(config);
Predicate<ServerWebExchange> predicate = new PathRoutePredicateFactory(new WebFluxProperties())
.apply(config);
predicates.add(predicate);
}
}