This commit is contained in:
2026-08-14 16:06:27 +08:00
parent 87eb1aa72f
commit 87e919f3c4
54 changed files with 984 additions and 175 deletions
@@ -4,6 +4,8 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.gateway.config.GatewayProperties;
import org.springframework.http.server.PathContainer;
import org.springframework.web.util.pattern.PathPatternParser;
import static org.assertj.core.api.Assertions.assertThat;
@@ -101,8 +103,11 @@ class GatewayFileRouteConfigurationTest {
assertThat(route.getUri().toString()).isEqualTo("lb://audit-service");
assertThat(route.getPredicates()).singleElement().satisfies(predicate -> {
assertThat(predicate.getName()).isEqualTo("Path");
assertThat(String.join(",", predicate.getArgs().values()))
.contains("/api/platform/v1/audit/**");
String pattern = String.join(",", predicate.getArgs().values());
assertThat(pattern).contains("/api/platform/v1/audit/**");
var matcher = PathPatternParser.defaultInstance.parse("/api/platform/v1/audit/**");
assertThat(matcher.matches(PathContainer.parsePath("/api/platform/v1/audit/logs"))).isTrue();
assertThat(matcher.matches(PathContainer.parsePath("/api/platform/v1/audit/logs/8"))).isTrue();
});
}
}