pull/1635/head
shedfreewu 2 months ago
parent b114ecc273
commit c6805d21fa

@ -1,3 +1,19 @@
/*
* Tencent is pleased to support the open source community by making spring-cloud-tencent available.
*
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the BSD 3-Clause License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*
* Unless required by applicable law or agreed to in writing, software distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package com.tencent.cloud.metadata.core;
import java.util.Map;

@ -74,7 +74,7 @@
<revision>2.0.3.0-2024.0.1-SNAPSHOT</revision>
<!-- Polaris SDK version -->
<polaris.version>2.0.2.0</polaris.version>
<polaris.version>2.0.3.0-SNAPSHOT</polaris.version>
<!-- Dependencies -->
<springdoc.version>2.2.0</springdoc.version>

@ -1,3 +1,19 @@
/*
* Tencent is pleased to support the open source community by making spring-cloud-tencent available.
*
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the BSD 3-Clause License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*
* Unless required by applicable law or agreed to in writing, software distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package com.tencent.tsf.gateway.core.model;
import java.io.Serializable;

@ -35,6 +35,7 @@ import org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAut
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.cloud.gateway.config.GatewayAutoConfiguration;
import org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -139,5 +140,10 @@ class GatewayPluginAutoConfigurationTest {
PolarisConfigProperties polarisConfigProperties() {
return new PolarisConfigProperties();
}
@Bean
LoadBalancerClientFactory loadBalancerClientFactory() {
return mock(LoadBalancerClientFactory.class);
}
}
}

@ -27,6 +27,7 @@ import org.springframework.mock.http.server.reactive.MockServerHttpRequest;
import org.springframework.mock.web.server.MockServerWebExchange;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.GATEWAY_PREDICATE_PATH_CONTAINER_ATTR;
/**
* Tests for {@link ContextRoutePredicateFactory}.
@ -34,6 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class ContextRoutePredicateFactoryTest {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withBean(ContextGatewayPropertiesManager.class)
.withBean(ContextRoutePredicateFactory.class);
@Test
@ -50,7 +52,12 @@ class ContextRoutePredicateFactoryTest {
GatewayPredicate gatewayPredicate = (GatewayPredicate) factory.apply(config);
gatewayPredicate.toString();
Assertions.assertTrue(gatewayPredicate.test(null));
MockServerWebExchange exchange = MockServerWebExchange.from(
MockServerHttpRequest.get("/test").build());
exchange.getAttributes().put(GATEWAY_PREDICATE_PATH_CONTAINER_ATTR, "mock");
Assertions.assertTrue(gatewayPredicate.test(exchange));
Assertions.assertEquals(config, gatewayPredicate.getConfig());
});
}

@ -75,6 +75,7 @@ public class EnhancedFeignBeanPostProcessor implements BeanPostProcessor, BeanFa
);
}
}
return createPolarisFeignClient((Client) bean);
}
return bean;
}

Loading…
Cancel
Save