You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2022/06/11 06:10:18 UTC

[GitHub] [incubator-shenyu] renzhuyan opened a new pull request, #3529: fix springcloud client lossless registration

renzhuyan opened a new pull request, #3529:
URL: https://github.com/apache/incubator-shenyu/pull/3529

   <!-- Describe your PR here; eg. Fixes #3484 -->
   
   <!--
   Thank you for proposing a pull request. This template will guide you through the essential steps necessary for a pull request.
   -->
   Make sure that:
   
   - [ ] You have read the [contribution guidelines](https://shenyu.apache.org/community/contributor-guide).
   - [ ] You submit test cases (unit or integration tests) that back your changes.
   - [ ] Your local test passed `./mvnw clean install -Dmaven.javadoc.skip=true`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] renzhuyan commented on a diff in pull request #3529: [ISSUE #3484] fix springcloud client lossless registration

Posted by GitBox <gi...@apache.org>.
renzhuyan commented on code in PR #3529:
URL: https://github.com/apache/incubator-shenyu/pull/3529#discussion_r894997275


##########
shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/main/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientBeanListener.java:
##########
@@ -46,21 +46,22 @@
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.Properties;
 
 /**
- * The type Shenyu client bean post processor.
+ * The type Shenyu client bean listener.
  */
-public class SpringCloudClientBeanPostProcessor implements BeanPostProcessor {
+public class SpringCloudClientBeanListener implements ApplicationListener<ContextRefreshedEvent> {

Review Comment:
   ok, i renamed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] renzhuyan commented on a diff in pull request #3529: [ISSUE #3484] fix springcloud client lossless registration

Posted by GitBox <gi...@apache.org>.
renzhuyan commented on code in PR #3529:
URL: https://github.com/apache/incubator-shenyu/pull/3529#discussion_r894997376


##########
shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/main/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientBeanListener.java:
##########
@@ -101,24 +102,34 @@ public SpringCloudClientBeanPostProcessor(final PropertiesConfig clientConfig,
         mappingAnnotation.add(RequestMapping.class);
         publisher.start(shenyuClientRegisterRepository);
     }
-    
+
     @Override
-    public Object postProcessAfterInitialization(@NonNull final Object bean, @NonNull final String beanName) throws BeansException {
+    public void onApplicationEvent(final ContextRefreshedEvent contextRefreshedEvent) {
+        if (Objects.nonNull(contextRefreshedEvent.getApplicationContext().getParent())) {
+            return;
+        }

Review Comment:
   I will remove



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] dragon-zhang merged pull request #3529: [ISSUE #3484] fix springcloud client lossless registration

Posted by GitBox <gi...@apache.org>.
dragon-zhang merged PR #3529:
URL: https://github.com/apache/incubator-shenyu/pull/3529


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3529: [ISSUE #3484] fix springcloud client lossless registration

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3529:
URL: https://github.com/apache/incubator-shenyu/pull/3529#discussion_r894985875


##########
shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/test/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientBeanPostProcessorTest.java:
##########
@@ -89,12 +91,12 @@ public void testWithShenyuClientAnnotation() {
         registerUtilsMockedStatic.when(() -> RegisterUtils.doLogin(any(), any(), any())).thenReturn(Optional.of("token"));
         registerUtilsMockedStatic.when(() -> RegisterUtils.doRegister(any(), any(), any()))
                 .thenAnswer((Answer<Void>) invocation -> null);
-        SpringCloudClientBeanPostProcessor springCloudClientBeanPostProcessor = buildSpringCloudClientBeanPostProcessor(false);
-        assertThat(springCloudClientTestBean, equalTo(springCloudClientBeanPostProcessor.postProcessAfterInitialization(springCloudClientTestBean, "normalBean")));
+        SpringCloudClientBeanListener springCloudClientBeanListener = buildSpringCloudClientBeanPostProcessor(false);
+        springCloudClientBeanListener.onApplicationEvent(contextRefreshedEvent);
         registerUtilsMockedStatic.close();

Review Comment:
   missed `assert` judge.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3529: [ISSUE #3484] fix springcloud client lossless registration

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3529:
URL: https://github.com/apache/incubator-shenyu/pull/3529#discussion_r894984627


##########
shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/main/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientBeanListener.java:
##########
@@ -46,21 +46,22 @@
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.Properties;
 
 /**
- * The type Shenyu client bean post processor.
+ * The type Shenyu client bean listener.
  */
-public class SpringCloudClientBeanPostProcessor implements BeanPostProcessor {
+public class SpringCloudClientBeanListener implements ApplicationListener<ContextRefreshedEvent> {

Review Comment:
   please rename to `SpringCloudClientEventListener`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] renzhuyan commented on a diff in pull request #3529: [ISSUE #3484] fix springcloud client lossless registration

Posted by GitBox <gi...@apache.org>.
renzhuyan commented on code in PR #3529:
URL: https://github.com/apache/incubator-shenyu/pull/3529#discussion_r894997546


##########
shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/test/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientBeanPostProcessorTest.java:
##########
@@ -89,12 +91,12 @@ public void testWithShenyuClientAnnotation() {
         registerUtilsMockedStatic.when(() -> RegisterUtils.doLogin(any(), any(), any())).thenReturn(Optional.of("token"));
         registerUtilsMockedStatic.when(() -> RegisterUtils.doRegister(any(), any(), any()))
                 .thenAnswer((Answer<Void>) invocation -> null);
-        SpringCloudClientBeanPostProcessor springCloudClientBeanPostProcessor = buildSpringCloudClientBeanPostProcessor(false);
-        assertThat(springCloudClientTestBean, equalTo(springCloudClientBeanPostProcessor.postProcessAfterInitialization(springCloudClientTestBean, "normalBean")));
+        SpringCloudClientBeanListener springCloudClientBeanListener = buildSpringCloudClientBeanPostProcessor(false);
+        springCloudClientBeanListener.onApplicationEvent(contextRefreshedEvent);
         registerUtilsMockedStatic.close();

Review Comment:
   Method has no return value. I added the call count vetify.



##########
shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/test/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientBeanPostProcessorTest.java:
##########
@@ -58,29 +58,31 @@ public final class SpringCloudClientBeanPostProcessorTest {
 
     private final MockedStatic<RegisterUtils> registerUtilsMockedStatic = mockStatic(RegisterUtils.class);
 
-    private final SpringCloudClientTestBean springCloudClientTestBean = new SpringCloudClientTestBean();
+    @Mock
+    private ApplicationContext applicationContext;
+
+    private ContextRefreshedEvent contextRefreshedEvent;
 
     @BeforeEach
     public void init() {
         when(env.getProperty("spring.application.name")).thenReturn("spring-cloud-test");
+        contextRefreshedEvent = new ContextRefreshedEvent(applicationContext);
     }
 
     @Test
     public void testShenyuBeanProcess() {
         registerUtilsMockedStatic.when(() -> RegisterUtils.doLogin(any(), any(), any())).thenReturn(Optional.of("token"));
         // config with full
-        SpringCloudClientBeanPostProcessor springCloudClientBeanPostProcessor = buildSpringCloudClientBeanPostProcessor(true);
-        assertThat(springCloudClientTestBean, equalTo(springCloudClientBeanPostProcessor.postProcessAfterInitialization(springCloudClientTestBean, "springCloudClientTestBean")));
+        SpringCloudClientBeanListener springCloudClientBeanListener = buildSpringCloudClientBeanPostProcessor(true);
+        springCloudClientBeanListener.onApplicationEvent(contextRefreshedEvent);
         registerUtilsMockedStatic.close();

Review Comment:
   Method has no return value. I added the call count vetify.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3529: [ISSUE #3484] fix springcloud client lossless registration

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3529:
URL: https://github.com/apache/incubator-shenyu/pull/3529#discussion_r894985913


##########
shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/test/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientBeanPostProcessorTest.java:
##########
@@ -58,29 +58,31 @@ public final class SpringCloudClientBeanPostProcessorTest {
 
     private final MockedStatic<RegisterUtils> registerUtilsMockedStatic = mockStatic(RegisterUtils.class);
 
-    private final SpringCloudClientTestBean springCloudClientTestBean = new SpringCloudClientTestBean();
+    @Mock
+    private ApplicationContext applicationContext;
+
+    private ContextRefreshedEvent contextRefreshedEvent;
 
     @BeforeEach
     public void init() {
         when(env.getProperty("spring.application.name")).thenReturn("spring-cloud-test");
+        contextRefreshedEvent = new ContextRefreshedEvent(applicationContext);
     }
 
     @Test
     public void testShenyuBeanProcess() {
         registerUtilsMockedStatic.when(() -> RegisterUtils.doLogin(any(), any(), any())).thenReturn(Optional.of("token"));
         // config with full
-        SpringCloudClientBeanPostProcessor springCloudClientBeanPostProcessor = buildSpringCloudClientBeanPostProcessor(true);
-        assertThat(springCloudClientTestBean, equalTo(springCloudClientBeanPostProcessor.postProcessAfterInitialization(springCloudClientTestBean, "springCloudClientTestBean")));
+        SpringCloudClientBeanListener springCloudClientBeanListener = buildSpringCloudClientBeanPostProcessor(true);
+        springCloudClientBeanListener.onApplicationEvent(contextRefreshedEvent);
         registerUtilsMockedStatic.close();

Review Comment:
   missed `assert` judge.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3529: [ISSUE #3484] fix springcloud client lossless registration

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3529:
URL: https://github.com/apache/incubator-shenyu/pull/3529#discussion_r894985347


##########
shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/main/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientBeanListener.java:
##########
@@ -101,24 +102,34 @@ public SpringCloudClientBeanPostProcessor(final PropertiesConfig clientConfig,
         mappingAnnotation.add(RequestMapping.class);
         publisher.start(shenyuClientRegisterRepository);
     }
-    
+
     @Override
-    public Object postProcessAfterInitialization(@NonNull final Object bean, @NonNull final String beanName) throws BeansException {
+    public void onApplicationEvent(final ContextRefreshedEvent contextRefreshedEvent) {
+        if (Objects.nonNull(contextRefreshedEvent.getApplicationContext().getParent())) {
+            return;
+        }

Review Comment:
   What is the point of doing this?
   ```java
   if (Objects.nonNull(contextRefreshedEvent.getApplicationContext().getParent())) {
       return;
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] codecov-commenter commented on pull request #3529: [ISSUE #3484] fix springcloud client lossless registration

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #3529:
URL: https://github.com/apache/incubator-shenyu/pull/3529#issuecomment-1152866829

   # [Codecov](https://codecov.io/gh/apache/incubator-shenyu/pull/3529?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#3529](https://codecov.io/gh/apache/incubator-shenyu/pull/3529?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (97dd692) into [master](https://codecov.io/gh/apache/incubator-shenyu/commit/66d9c137f7123b14507fef1a3cbf2216a6cf2d10?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (66d9c13) will **decrease** coverage by `0.41%`.
   > The diff coverage is `38.46%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3529      +/-   ##
   ============================================
   - Coverage     62.81%   62.39%   -0.42%     
   + Complexity     5572     5525      -47     
   ============================================
     Files           842      842              
     Lines         23343    23353      +10     
     Branches       2115     2118       +3     
   ============================================
   - Hits          14663    14572      -91     
   - Misses         7333     7436     +103     
   + Partials       1347     1345       -2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-shenyu/pull/3529?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...pringcloud/init/SpringCloudClientBeanListener.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3529/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWNsaWVudC9zaGVueXUtY2xpZW50LWh0dHAvc2hlbnl1LWNsaWVudC1zcHJpbmdjbG91ZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hlbnl1L2NsaWVudC9zcHJpbmdjbG91ZC9pbml0L1NwcmluZ0Nsb3VkQ2xpZW50QmVhbkxpc3RlbmVyLmphdmE=) | `18.47% <33.33%> (ø)` | |
   | [...ingcloud/ShenyuSpringCloudClientConfiguration.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3529/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXNwcmluZy1ib290LXN0YXJ0ZXIvc2hlbnl1LXNwcmluZy1ib290LXN0YXJ0ZXItY2xpZW50L3NoZW55dS1zcHJpbmctYm9vdC1zdGFydGVyLWNsaWVudC1zcHJpbmdjbG91ZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hlbnl1L3NwcmluZ2Jvb3Qvc3RhcnRlci9jbGllbnQvc3ByaW5nY2xvdWQvU2hlbnl1U3ByaW5nQ2xvdWRDbGllbnRDb25maWd1cmF0aW9uLmphdmE=) | `100.00% <100.00%> (ø)` | |
   | [...plugin/logging/rocketmq/LoggingRocketMQPlugin.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3529/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLXJvY2tldG1xL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvcGx1Z2luL2xvZ2dpbmcvcm9ja2V0bXEvTG9nZ2luZ1JvY2tldE1RUGx1Z2luLmphdmE=) | `22.72% <0.00%> (-72.73%)` | :arrow_down: |
   | [...ache/shenyu/plugin/grpc/cache/GrpcClientCache.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3529/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWdycGMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vZ3JwYy9jYWNoZS9HcnBjQ2xpZW50Q2FjaGUuamF2YQ==) | `75.00% <0.00%> (-25.00%)` | :arrow_down: |
   | [...ogging/rocketmq/body/LoggingServerHttpRequest.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3529/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLXJvY2tldG1xL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvcGx1Z2luL2xvZ2dpbmcvcm9ja2V0bXEvYm9keS9Mb2dnaW5nU2VydmVySHR0cFJlcXVlc3QuamF2YQ==) | `0.00% <0.00%> (-20.00%)` | :arrow_down: |
   | [.../apache/shenyu/admin/model/dto/BatchCommonDTO.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3529/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZHRvL0JhdGNoQ29tbW9uRFRPLmphdmE=) | `50.00% <0.00%> (-7.15%)` | :arrow_down: |
   | [...apache/shenyu/admin/model/dto/AuthPathWarpDTO.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3529/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZHRvL0F1dGhQYXRoV2FycERUTy5qYXZh) | `57.14% <0.00%> (-7.15%)` | :arrow_down: |
   | [...org/apache/shenyu/admin/model/dto/AuthPathDTO.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3529/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vbW9kZWwvZHRvL0F1dGhQYXRoRFRPLmphdmE=) | `58.82% <0.00%> (-5.89%)` | :arrow_down: |
   | [...nyu/plugin/motan/cache/ApplicationConfigCache.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3529/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLW1vdGFuL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvcGx1Z2luL21vdGFuL2NhY2hlL0FwcGxpY2F0aW9uQ29uZmlnQ2FjaGUuamF2YQ==) | `52.00% <0.00%> (-5.00%)` | :arrow_down: |
   | ... and [26 more](https://codecov.io/gh/apache/incubator-shenyu/pull/3529/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-shenyu/pull/3529?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-shenyu/pull/3529?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [66d9c13...97dd692](https://codecov.io/gh/apache/incubator-shenyu/pull/3529?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3529: [ISSUE #3484] fix springcloud client lossless registration

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3529:
URL: https://github.com/apache/incubator-shenyu/pull/3529#discussion_r894985913


##########
shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/test/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientBeanPostProcessorTest.java:
##########
@@ -58,29 +58,31 @@ public final class SpringCloudClientBeanPostProcessorTest {
 
     private final MockedStatic<RegisterUtils> registerUtilsMockedStatic = mockStatic(RegisterUtils.class);
 
-    private final SpringCloudClientTestBean springCloudClientTestBean = new SpringCloudClientTestBean();
+    @Mock
+    private ApplicationContext applicationContext;
+
+    private ContextRefreshedEvent contextRefreshedEvent;
 
     @BeforeEach
     public void init() {
         when(env.getProperty("spring.application.name")).thenReturn("spring-cloud-test");
+        contextRefreshedEvent = new ContextRefreshedEvent(applicationContext);
     }
 
     @Test
     public void testShenyuBeanProcess() {
         registerUtilsMockedStatic.when(() -> RegisterUtils.doLogin(any(), any(), any())).thenReturn(Optional.of("token"));
         // config with full
-        SpringCloudClientBeanPostProcessor springCloudClientBeanPostProcessor = buildSpringCloudClientBeanPostProcessor(true);
-        assertThat(springCloudClientTestBean, equalTo(springCloudClientBeanPostProcessor.postProcessAfterInitialization(springCloudClientTestBean, "springCloudClientTestBean")));
+        SpringCloudClientBeanListener springCloudClientBeanListener = buildSpringCloudClientBeanPostProcessor(true);
+        springCloudClientBeanListener.onApplicationEvent(contextRefreshedEvent);
         registerUtilsMockedStatic.close();

Review Comment:
   missed assert judge.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3529: [ISSUE #3484] fix springcloud client lossless registration

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3529:
URL: https://github.com/apache/incubator-shenyu/pull/3529#discussion_r895002345


##########
shenyu-client/shenyu-client-http/shenyu-client-springcloud/src/test/java/org/apache/shenyu/client/springcloud/init/SpringCloudClientBeanPostProcessorTest.java:
##########
@@ -89,12 +102,13 @@ public void testWithShenyuClientAnnotation() {
         registerUtilsMockedStatic.when(() -> RegisterUtils.doLogin(any(), any(), any())).thenReturn(Optional.of("token"));
         registerUtilsMockedStatic.when(() -> RegisterUtils.doRegister(any(), any(), any()))
                 .thenAnswer((Answer<Void>) invocation -> null);
-        SpringCloudClientBeanPostProcessor springCloudClientBeanPostProcessor = buildSpringCloudClientBeanPostProcessor(false);
-        assertThat(springCloudClientTestBean, equalTo(springCloudClientBeanPostProcessor.postProcessAfterInitialization(springCloudClientTestBean, "normalBean")));
+        SpringCloudClientEventListener springCloudClientEventListener = buildSpringCloudClientBeanPostProcessor(false);
+        springCloudClientEventListener.onApplicationEvent(contextRefreshedEvent);
+        verify(applicationContext, times(1)).getBeansWithAnnotation(any());
         registerUtilsMockedStatic.close();
     }
 
-    private SpringCloudClientBeanPostProcessor buildSpringCloudClientBeanPostProcessor(final boolean full) {
+    private SpringCloudClientEventListener buildSpringCloudClientBeanPostProcessor(final boolean full) {

Review Comment:
   rename to `buildSpringCloudClienttEventListener`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org