From 9432cdbcb0c52c946ade74e16b705167dcc687db Mon Sep 17 00:00:00 2001 From: Haotian Zhang <928016560@qq.com> Date: Wed, 6 Jul 2022 20:21:07 +0800 Subject: [PATCH] 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. --- CHANGELOG.md | 39 --------------- changes/changes-1.6.0.md | 42 +++++++++++++++++ pom.xml | 2 +- spring-cloud-tencent-dependencies/pom.xml | 2 +- .../service/callee/CustomMetadata.java | 3 +- .../PostInitPolarisSDKContextTest.java | 47 +++++++++++++------ 6 files changed, 78 insertions(+), 57 deletions(-) create mode 100644 changes/changes-1.6.0.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 81941578..06c1f817 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,42 +1,3 @@ # 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
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) diff --git a/changes/changes-1.6.0.md b/changes/changes-1.6.0.md new file mode 100644 index 00000000..81941578 --- /dev/null +++ b/changes/changes-1.6.0.md @@ -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
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) diff --git a/pom.xml b/pom.xml index 945ba7d2..d13aac07 100644 --- a/pom.xml +++ b/pom.xml @@ -86,7 +86,7 @@ - 1.6.0-Hoxton.SR12 + 1.7.0-Hoxton.SR12-SNAPSHOT Hoxton.SR12 diff --git a/spring-cloud-tencent-dependencies/pom.xml b/spring-cloud-tencent-dependencies/pom.xml index 3bd68965..2027ffae 100644 --- a/spring-cloud-tencent-dependencies/pom.xml +++ b/spring-cloud-tencent-dependencies/pom.xml @@ -70,7 +70,7 @@ - 1.6.0-Hoxton.SR12 + 1.7.0-Hoxton.SR12-SNAPSHOT 1.7.0 1.2.11 4.5.1 diff --git a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/CustomMetadata.java b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/CustomMetadata.java index 9504e975..fbfa2261 100644 --- a/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/CustomMetadata.java +++ b/spring-cloud-tencent-examples/polaris-discovery-example/discovery-callee-service/src/main/java/com/tencent/cloud/polaris/discovery/service/callee/CustomMetadata.java @@ -27,7 +27,8 @@ import org.springframework.stereotype.Component; /** * custom metadata for instance. - *@author lepdou 2022-06-16 + * + * @author lepdou 2022-06-16 */ @Component public class CustomMetadata implements InstanceMetadataProvider { diff --git a/spring-cloud-tencent-polaris-context/src/test/java/com/tencent/cloud/polaris/context/PostInitPolarisSDKContextTest.java b/spring-cloud-tencent-polaris-context/src/test/java/com/tencent/cloud/polaris/context/PostInitPolarisSDKContextTest.java index 13a0f6f7..bc7ae23b 100644 --- a/spring-cloud-tencent-polaris-context/src/test/java/com/tencent/cloud/polaris/context/PostInitPolarisSDKContextTest.java +++ b/spring-cloud-tencent-polaris-context/src/test/java/com/tencent/cloud/polaris/context/PostInitPolarisSDKContextTest.java @@ -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; import com.tencent.cloud.common.metadata.StaticMetadataManager; import com.tencent.polaris.api.plugin.common.ValueContext; import com.tencent.polaris.api.plugin.route.LocationLevel; import com.tencent.polaris.client.api.SDKContext; +import org.assertj.core.api.Assertions; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; import static org.mockito.Mockito.when; @@ -22,29 +38,30 @@ import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class PostInitPolarisSDKContextTest { + private static final String REGION = "region"; + private static final String ZONE = "zone"; + private static final String CAMPUS = "campus"; @Mock private SDKContext sdkContext; @Mock private StaticMetadataManager staticMetadataManager; - private static final String region = "region"; - - private static final String zone = "zone"; - - private static final String campus = "campus"; - @Test - public void PostInitPolarisSDKContextTest() { + public void testConstructor() { ValueContext valueContext = new ValueContext(); when(sdkContext.getValueContext()).thenReturn(valueContext); - when(staticMetadataManager.getRegion()).thenReturn(region); - when(staticMetadataManager.getZone()).thenReturn(zone); - when(staticMetadataManager.getCampus()).thenReturn(campus); + when(staticMetadataManager.getRegion()).thenReturn(REGION); + when(staticMetadataManager.getZone()).thenReturn(ZONE); + when(staticMetadataManager.getCampus()).thenReturn(CAMPUS); new PostInitPolarisSDKContext(sdkContext, staticMetadataManager); - assertThat(valueContext.getValue(LocationLevel.region.name()), is(region)); - assertThat(valueContext.getValue(LocationLevel.zone.name()), is(zone)); - assertThat(valueContext.getValue(LocationLevel.campus.name()), is(campus)); + String regionName = valueContext.getValue(LocationLevel.region.name()); + String zoneName = valueContext.getValue(LocationLevel.zone.name()); + String campusName = valueContext.getValue(LocationLevel.campus.name()); + + Assertions.assertThat(regionName).isEqualTo(REGION); + Assertions.assertThat(zoneName).isEqualTo(ZONE); + Assertions.assertThat(campusName).isEqualTo(CAMPUS); } }