fix:fix junit not working bug.

pull/96/head
SkyeBeFreeman 3 years ago
parent 30a30c8f32
commit e29d6b4b4a

@ -178,6 +178,13 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<inherited>true</inherited>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit4</artifactId>
<version>2.22.2</version>
</dependency>
</dependencies>
<configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>

@ -56,7 +56,7 @@ public class Metadata2HeaderRestTemplateInterceptor implements ClientHttpRequest
// add new metadata and cover old
String metadataStr = httpRequest.getHeaders().getFirst(MetadataConstant.HeaderName.CUSTOM_METADATA);
if (!StringUtils.isNotBlank(metadataStr)) {
if (StringUtils.isNotBlank(metadataStr)) {
Map<String, String> headerMetadataMap = JacksonUtils.deserialize2Map(metadataStr);
for (String key : headerMetadataMap.keySet()) {
metadataContext.putTransitiveCustomMetadata(key, headerMetadataMap.get(key));

@ -19,6 +19,7 @@ package com.tencent.cloud.metadata.core.intercepter;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.stream.Collectors;
import com.tencent.cloud.common.constant.MetadataConstant;
import com.tencent.cloud.common.metadata.MetadataContextHolder;
@ -31,12 +32,17 @@ import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
@ -83,6 +89,12 @@ public class Metadata2HeaderFeignInterceptorTest {
return URLDecoder.decode(customMetadataStr, "UTF-8") + systemMetadataStr;
}
@Bean
@ConditionalOnMissingBean
public HttpMessageConverters messageConverters(ObjectProvider<HttpMessageConverter<?>> converters) {
return new HttpMessageConverters(converters.orderedStream().collect(Collectors.toList()));
}
@FeignClient(name = "test-feign", url = "http://localhost:8081")
public interface TestFeign {

@ -5,6 +5,8 @@ spring:
exclude:
- org.springframework.cloud.gateway.config.GatewayAutoConfiguration
cloud:
gateway:
enabled: false
tencent:
metadata:
content:

@ -52,7 +52,8 @@ public class PolarisFeignBeanPostProcessor implements BeanPostProcessor, BeanFac
private Object wrapper(Object bean) {
if (isNeedWrap(bean)) {
if (bean instanceof RetryableFeignBlockingLoadBalancerClient || bean instanceof FeignBlockingLoadBalancerClient) {
if (bean instanceof RetryableFeignBlockingLoadBalancerClient
|| bean instanceof FeignBlockingLoadBalancerClient) {
Client delegate;
if (bean instanceof RetryableFeignBlockingLoadBalancerClient) {
delegate = ((RetryableFeignBlockingLoadBalancerClient) bean).getDelegate();

@ -53,7 +53,6 @@ public class PolarisLoadBalancerClientConfiguration {
*/
private static final int REACTIVE_SERVICE_INSTANCE_SUPPLIER_ORDER = 193827465;
@Bean
@ConditionalOnMissingBean
public ReactorLoadBalancer<ServiceInstance> polarisLoadBalancer(Environment environment,

@ -78,4 +78,5 @@ public class MetadataFirstScgFilter implements GlobalFilter, Ordered {
return chain.filter(exchange);
}
}

@ -5,6 +5,8 @@ spring:
exclude:
- org.springframework.cloud.gateway.config.GatewayAutoConfiguration
cloud:
gateway:
enabled: false
tencent:
metadata:
content:

Loading…
Cancel
Save