You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by GitBox <gi...@apache.org> on 2022/11/30 13:23:11 UTC

[GitHub] [incubator-eventmesh] weihubeats opened a new pull request, #2323: Simplify CloudEventUtils code

weihubeats opened a new pull request, #2323:
URL: https://github.com/apache/incubator-eventmesh/pull/2323

   
   
   Fixes https://github.com/apache/incubator-eventmesh/issues/2322
   
   ### Motivation
   
   *Explain the content here.*
   *Explain why you want to make the changes and what problem you're trying to solve.*
   
   
   
   ### Modifications
   
   *Describe the modifications you've done.*
   
   
   
   ### Documentation
   
   - Does this pull request introduce a new feature? (yes / no)
   - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
   - If a feature is not applicable for documentation, explain why?
   - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
   


-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] weihubeats commented on a diff in pull request #2323: [ISSUE #2322] Simplify CloudEventUtils code

Posted by GitBox <gi...@apache.org>.
weihubeats commented on code in PR #2323:
URL: https://github.com/apache/incubator-eventmesh/pull/2323#discussion_r1036626235


##########
eventmesh-connector-plugin/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/utils/CloudEventUtils.java:
##########
@@ -42,53 +43,39 @@ public static SendResult convertSendResult(
 
     public static Message msgConvert(MessageExt rmqMsg) {
         Message message = new Message();
-        if (rmqMsg.getTopic() != null) {
-            message.setTopic(rmqMsg.getTopic());
-        }
-
-        if (rmqMsg.getKeys() != null) {
-            message.setKeys(rmqMsg.getKeys());
-        }
-
-        if (rmqMsg.getTags() != null) {
-            message.setTags(rmqMsg.getTags());
-        }
-
+        initProperty(rmqMsg, message, MessageExt::getTopic, Message::setTopic);
+        initProperty(rmqMsg, message, MessageExt::getKeys, Message::setKeys);
+        initProperty(rmqMsg, message, MessageExt::getTags, Message::setTags);
         if (rmqMsg.getBody() != null) {

Review Comment:
   What is the meaning of the same function mode, not quite understand



-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx commented on a diff in pull request #2323: [ISSUE #2322] Simplify CloudEventUtils code

Posted by GitBox <gi...@apache.org>.
jonyangx commented on code in PR #2323:
URL: https://github.com/apache/incubator-eventmesh/pull/2323#discussion_r1036624793


##########
eventmesh-connector-plugin/eventmesh-connector-rocketmq/src/main/java/org/apache/eventmesh/connector/rocketmq/utils/CloudEventUtils.java:
##########
@@ -42,53 +43,39 @@ public static SendResult convertSendResult(
 
     public static Message msgConvert(MessageExt rmqMsg) {
         Message message = new Message();
-        if (rmqMsg.getTopic() != null) {
-            message.setTopic(rmqMsg.getTopic());
-        }
-
-        if (rmqMsg.getKeys() != null) {
-            message.setKeys(rmqMsg.getKeys());
-        }
-
-        if (rmqMsg.getTags() != null) {
-            message.setTags(rmqMsg.getTags());
-        }
-
+        initProperty(rmqMsg, message, MessageExt::getTopic, Message::setTopic);
+        initProperty(rmqMsg, message, MessageExt::getKeys, Message::setKeys);
+        initProperty(rmqMsg, message, MessageExt::getTags, Message::setTags);
         if (rmqMsg.getBody() != null) {

Review Comment:
   suggest using the same function pattern refactor it.



-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] jonyangx merged pull request #2323: [ISSUE #2322] Simplify CloudEventUtils code

Posted by GitBox <gi...@apache.org>.
jonyangx merged PR #2323:
URL: https://github.com/apache/incubator-eventmesh/pull/2323


-- 
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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] codecov[bot] commented on pull request #2323: Simplify CloudEventUtils code

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #2323:
URL: https://github.com/apache/incubator-eventmesh/pull/2323#issuecomment-1332187952

   # [Codecov](https://codecov.io/gh/apache/incubator-eventmesh/pull/2323?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 [#2323](https://codecov.io/gh/apache/incubator-eventmesh/pull/2323?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0b24f23) into [master](https://codecov.io/gh/apache/incubator-eventmesh/commit/8c31f73ffa7a2ad5e02273cd9d4aa7128bd05a4c?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (8c31f73) will **decrease** coverage by `0.01%`.
   > The diff coverage is `76.19%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #2323      +/-   ##
   ============================================
   - Coverage     11.72%   11.71%   -0.02%     
   + Complexity      894      892       -2     
   ============================================
     Files           471      471              
     Lines         27810    27803       -7     
     Branches       3007     3001       -6     
   ============================================
   - Hits           3262     3256       -6     
   - Misses        24248    24251       +3     
   + Partials        300      296       -4     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-eventmesh/pull/2323?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...mesh/connector/rocketmq/utils/CloudEventUtils.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/2323/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-ZXZlbnRtZXNoLWNvbm5lY3Rvci1wbHVnaW4vZXZlbnRtZXNoLWNvbm5lY3Rvci1yb2NrZXRtcS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZXZlbnRtZXNoL2Nvbm5lY3Rvci9yb2NrZXRtcS91dGlscy9DbG91ZEV2ZW50VXRpbHMuamF2YQ==) | `50.00% <76.19%> (+9.70%)` | :arrow_up: |
   | [...tandalone/broker/task/HistoryMessageClearTask.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/2323/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-ZXZlbnRtZXNoLWNvbm5lY3Rvci1wbHVnaW4vZXZlbnRtZXNoLWNvbm5lY3Rvci1zdGFuZGFsb25lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9ldmVudG1lc2gvY29ubmVjdG9yL3N0YW5kYWxvbmUvYnJva2VyL3Rhc2svSGlzdG9yeU1lc3NhZ2VDbGVhclRhc2suamF2YQ==) | `29.41% <0.00%> (-17.65%)` | :arrow_down: |
   | [...mesh/connector/standalone/broker/MessageQueue.java](https://codecov.io/gh/apache/incubator-eventmesh/pull/2323/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-ZXZlbnRtZXNoLWNvbm5lY3Rvci1wbHVnaW4vZXZlbnRtZXNoLWNvbm5lY3Rvci1zdGFuZGFsb25lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9ldmVudG1lc2gvY29ubmVjdG9yL3N0YW5kYWxvbmUvYnJva2VyL01lc3NhZ2VRdWV1ZS5qYXZh) | `32.46% <0.00%> (-7.80%)` | :arrow_down: |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?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: dev-unsubscribe@eventmesh.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org