feat:update to 1.7.0-Hoxton.SR12-SNAPSHOT. (#401)

* feat:update to 1.7.0-Hoxton.SR12-SNAPSHOT.

* feat:update to 1.7.0-Hoxton.SR12-SNAPSHOT.
pull/428/head
Haotian Zhang 2 years ago committed by GitHub
parent 35567d57aa
commit 9432cdbcb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,42 +1,3 @@
# Change Log # Change Log
--- ---
- [UT: Add config module unit test](https://github.com/Tencent/spring-cloud-tencent/pull/229)
- [Feature: Add config change listener feature support](https://github.com/Tencent/spring-cloud-tencent/pull/220)
- [Feature: Support spring cloud gateway routers](https://github.com/Tencent/spring-cloud-tencent/pull/230)
- [Feature: Add instance metadata spi for registration](https://github.com/Tencent/spring-cloud-tencent/pull/244)
- [Bugfix: fix guava version conflict bug & fix router strong dependency on LoadBalancerClientFilter](https://github.com/Tencent/spring-cloud-tencent/pull/236)
- [Upgrade: fix third-party lib CVEs & upgrade core spring libs version](https://github.com/Tencent/spring-cloud-tencent/pull/237)
- [change escape way into encode](https://github.com/Tencent/spring-cloud-tencent/pull/251)
- [feat:support reading configuration from application.yml or application.properties.](https://github.com/Tencent/spring-cloud-tencent/pull/259)
- [fix:fix ClassNotFoundException while not importing openfeign when using circuit-breaker module.](https://github.com/Tencent/spring-cloud-tencent/pull/269)
- [Update GitHub Actions workflow](https://github.com/Tencent/spring-cloud-tencent/pull/273)
- [fix:fix TypeNotPresentException in @ConditionalOnClass of router.](https://github.com/Tencent/spring-cloud-tencent/pull/276)
- [fix:solve the chaos code problem on rejectTips.](https://github.com/Tencent/spring-cloud-tencent/pull/279)
- [fix:solve ratelimit-callee-service UnknownHostException.](https://github.com/Tencent/spring-cloud-tencent/pull/281)
- [fix:refactor to use text/html resolve chaos problem on rejectTips](https://github.com/Tencent/spring-cloud-tencent/pull/285)
- [UT: add metadata-transfer unit test](https://github.com/Tencent/spring-cloud-tencent/pull/294)
- [Feature:add restTemplate Report Polaris](https://github.com/Tencent/spring-cloud-tencent/pull/272)
- [Use jdk constants instead of magic variables](https://github.com/Tencent/spring-cloud-tencent/pull/313)
- [Fix the current limiting effect is that other requests cannot be processed when queuing at a constant speed](https://github.com/Tencent/spring-cloud-tencent/pull/316)
- [Fix config file format misspell](https://github.com/Tencent/spring-cloud-tencent/pull/319)
- [UT: improve test coverage for load balancer unit test](https://github.com/Tencent/spring-cloud-tencent/pull/325)
- [optimize polaris load balancer test code format](https://github.com/Tencent/spring-cloud-tencent/pull/333)
- [feat:Add GitHub action of codecov.yml.](https://github.com/Tencent/spring-cloud-tencent/pull/328)
- [Feature: add spring cloud tencent logo](https://github.com/Tencent/spring-cloud-tencent/pull/329)
- [Feature: Optimize static metadata manager](https://github.com/Tencent/spring-cloud-tencent/pull/327)
- [Feature: support actuator for sct core components](https://github.com/Tencent/spring-cloud-tencent/pull/343)
- [test:update junit of metadata.](https://github.com/Tencent/spring-cloud-tencent/pull/340)
- [Optimize code style & unit test case](https://github.com/Tencent/spring-cloud-tencent/pull/336)
- [rm code: Condition 'null != interceptors' is always 'true' ](https://github.com/Tencent/spring-cloud-tencent/pull/342)
- [fix: shutdown thread pool before the container closes](https://github.com/Tencent/spring-cloud-tencent/pull/353)
- [docs:update logo in README.](https://github.com/Tencent/spring-cloud-tencent/pull/358)
- [Refator JacksonUtils and JacksonUtilsTest](https://github.com/Tencent/spring-cloud-tencent/pull/365)
- [refactor:optimize project and code.](https://github.com/Tencent/spring-cloud-tencent/pull/368)
- [docs: Fix javadoc <br /> error](https://github.com/Tencent/spring-cloud-tencent/pull/371)
- [UT: add Polaris LoadBalancer unit test](https://github.com/Tencent/spring-cloud-tencent/pull/373)
- [docs:update docs](https://github.com/Tencent/spring-cloud-tencent/pull/378)
- [docs:optimize example](https://github.com/Tencent/spring-cloud-tencent/pull/385)
- [Optimize starters auto-configuration. (main)](https://github.com/Tencent/spring-cloud-tencent/pull/391/files)
- [Feature: format code](https://github.com/Tencent/spring-cloud-tencent/pull/394)
- [test: add PostInitPolarisSDKContextTest](https://github.com/Tencent/spring-cloud-tencent/pull/397)

@ -0,0 +1,42 @@
# Change Log
---
- [UT: Add config module unit test](https://github.com/Tencent/spring-cloud-tencent/pull/229)
- [Feature: Add config change listener feature support](https://github.com/Tencent/spring-cloud-tencent/pull/220)
- [Feature: Support spring cloud gateway routers](https://github.com/Tencent/spring-cloud-tencent/pull/230)
- [Feature: Add instance metadata spi for registration](https://github.com/Tencent/spring-cloud-tencent/pull/244)
- [Bugfix: fix guava version conflict bug & fix router strong dependency on LoadBalancerClientFilter](https://github.com/Tencent/spring-cloud-tencent/pull/236)
- [Upgrade: fix third-party lib CVEs & upgrade core spring libs version](https://github.com/Tencent/spring-cloud-tencent/pull/237)
- [change escape way into encode](https://github.com/Tencent/spring-cloud-tencent/pull/251)
- [feat:support reading configuration from application.yml or application.properties.](https://github.com/Tencent/spring-cloud-tencent/pull/259)
- [fix:fix ClassNotFoundException while not importing openfeign when using circuit-breaker module.](https://github.com/Tencent/spring-cloud-tencent/pull/269)
- [Update GitHub Actions workflow](https://github.com/Tencent/spring-cloud-tencent/pull/273)
- [fix:fix TypeNotPresentException in @ConditionalOnClass of router.](https://github.com/Tencent/spring-cloud-tencent/pull/276)
- [fix:solve the chaos code problem on rejectTips.](https://github.com/Tencent/spring-cloud-tencent/pull/279)
- [fix:solve ratelimit-callee-service UnknownHostException.](https://github.com/Tencent/spring-cloud-tencent/pull/281)
- [fix:refactor to use text/html resolve chaos problem on rejectTips](https://github.com/Tencent/spring-cloud-tencent/pull/285)
- [UT: add metadata-transfer unit test](https://github.com/Tencent/spring-cloud-tencent/pull/294)
- [Feature:add restTemplate Report Polaris](https://github.com/Tencent/spring-cloud-tencent/pull/272)
- [Use jdk constants instead of magic variables](https://github.com/Tencent/spring-cloud-tencent/pull/313)
- [Fix the current limiting effect is that other requests cannot be processed when queuing at a constant speed](https://github.com/Tencent/spring-cloud-tencent/pull/316)
- [Fix config file format misspell](https://github.com/Tencent/spring-cloud-tencent/pull/319)
- [UT: improve test coverage for load balancer unit test](https://github.com/Tencent/spring-cloud-tencent/pull/325)
- [optimize polaris load balancer test code format](https://github.com/Tencent/spring-cloud-tencent/pull/333)
- [feat:Add GitHub action of codecov.yml.](https://github.com/Tencent/spring-cloud-tencent/pull/328)
- [Feature: add spring cloud tencent logo](https://github.com/Tencent/spring-cloud-tencent/pull/329)
- [Feature: Optimize static metadata manager](https://github.com/Tencent/spring-cloud-tencent/pull/327)
- [Feature: support actuator for sct core components](https://github.com/Tencent/spring-cloud-tencent/pull/343)
- [test:update junit of metadata.](https://github.com/Tencent/spring-cloud-tencent/pull/340)
- [Optimize code style & unit test case](https://github.com/Tencent/spring-cloud-tencent/pull/336)
- [rm code: Condition 'null != interceptors' is always 'true' ](https://github.com/Tencent/spring-cloud-tencent/pull/342)
- [fix: shutdown thread pool before the container closes](https://github.com/Tencent/spring-cloud-tencent/pull/353)
- [docs:update logo in README.](https://github.com/Tencent/spring-cloud-tencent/pull/358)
- [Refator JacksonUtils and JacksonUtilsTest](https://github.com/Tencent/spring-cloud-tencent/pull/365)
- [refactor:optimize project and code.](https://github.com/Tencent/spring-cloud-tencent/pull/368)
- [docs: Fix javadoc <br /> error](https://github.com/Tencent/spring-cloud-tencent/pull/371)
- [UT: add Polaris LoadBalancer unit test](https://github.com/Tencent/spring-cloud-tencent/pull/373)
- [docs:update docs](https://github.com/Tencent/spring-cloud-tencent/pull/378)
- [docs:optimize example](https://github.com/Tencent/spring-cloud-tencent/pull/385)
- [Optimize starters auto-configuration. (main)](https://github.com/Tencent/spring-cloud-tencent/pull/391/files)
- [Feature: format code](https://github.com/Tencent/spring-cloud-tencent/pull/394)
- [test: add PostInitPolarisSDKContextTest](https://github.com/Tencent/spring-cloud-tencent/pull/397)

@ -86,7 +86,7 @@
<properties> <properties>
<!-- Project revision --> <!-- Project revision -->
<revision>1.6.0-Hoxton.SR12</revision> <revision>1.7.0-Hoxton.SR12-SNAPSHOT</revision>
<!-- Spring Cloud --> <!-- Spring Cloud -->
<spring.cloud.version>Hoxton.SR12</spring.cloud.version> <spring.cloud.version>Hoxton.SR12</spring.cloud.version>

@ -70,7 +70,7 @@
</developers> </developers>
<properties> <properties>
<revision>1.6.0-Hoxton.SR12</revision> <revision>1.7.0-Hoxton.SR12-SNAPSHOT</revision>
<polaris.version>1.7.0</polaris.version> <polaris.version>1.7.0</polaris.version>
<logback.version>1.2.11</logback.version> <logback.version>1.2.11</logback.version>
<mocktio.version>4.5.1</mocktio.version> <mocktio.version>4.5.1</mocktio.version>

@ -27,6 +27,7 @@ import org.springframework.stereotype.Component;
/** /**
* custom metadata for instance. * custom metadata for instance.
*
* @author lepdou 2022-06-16 * @author lepdou 2022-06-16
*/ */
@Component @Component

@ -1,16 +1,32 @@
/*
* Tencent is pleased to support the open source community by making Spring Cloud Tencent available.
*
* Copyright (C) 2019 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.polaris.context; package com.tencent.cloud.polaris.context;
import com.tencent.cloud.common.metadata.StaticMetadataManager; import com.tencent.cloud.common.metadata.StaticMetadataManager;
import com.tencent.polaris.api.plugin.common.ValueContext; import com.tencent.polaris.api.plugin.common.ValueContext;
import com.tencent.polaris.api.plugin.route.LocationLevel; import com.tencent.polaris.api.plugin.route.LocationLevel;
import com.tencent.polaris.client.api.SDKContext; import com.tencent.polaris.client.api.SDKContext;
import org.assertj.core.api.Assertions;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -22,29 +38,30 @@ import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class PostInitPolarisSDKContextTest { public class PostInitPolarisSDKContextTest {
private static final String REGION = "region";
private static final String ZONE = "zone";
private static final String CAMPUS = "campus";
@Mock @Mock
private SDKContext sdkContext; private SDKContext sdkContext;
@Mock @Mock
private StaticMetadataManager staticMetadataManager; private StaticMetadataManager staticMetadataManager;
private static final String region = "region";
private static final String zone = "zone";
private static final String campus = "campus";
@Test @Test
public void PostInitPolarisSDKContextTest() { public void testConstructor() {
ValueContext valueContext = new ValueContext(); ValueContext valueContext = new ValueContext();
when(sdkContext.getValueContext()).thenReturn(valueContext); when(sdkContext.getValueContext()).thenReturn(valueContext);
when(staticMetadataManager.getRegion()).thenReturn(region); when(staticMetadataManager.getRegion()).thenReturn(REGION);
when(staticMetadataManager.getZone()).thenReturn(zone); when(staticMetadataManager.getZone()).thenReturn(ZONE);
when(staticMetadataManager.getCampus()).thenReturn(campus); when(staticMetadataManager.getCampus()).thenReturn(CAMPUS);
new PostInitPolarisSDKContext(sdkContext, staticMetadataManager); new PostInitPolarisSDKContext(sdkContext, staticMetadataManager);
assertThat(valueContext.getValue(LocationLevel.region.name()), is(region)); String regionName = valueContext.getValue(LocationLevel.region.name());
assertThat(valueContext.getValue(LocationLevel.zone.name()), is(zone)); String zoneName = valueContext.getValue(LocationLevel.zone.name());
assertThat(valueContext.getValue(LocationLevel.campus.name()), is(campus)); String campusName = valueContext.getValue(LocationLevel.campus.name());
Assertions.assertThat(regionName).isEqualTo(REGION);
Assertions.assertThat(zoneName).isEqualTo(ZONE);
Assertions.assertThat(campusName).isEqualTo(CAMPUS);
} }
} }

Loading…
Cancel
Save