Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code review config center #3096

Merged
merged 9 commits into from
Jan 2, 2019
Merged

Code review config center #3096

merged 9 commits into from
Jan 2, 2019

Conversation

beiwei30
Copy link
Member

What is the purpose of the change

XXXXX

Brief changelog

XXXXX

Verifying this change

XXXXX

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a GITHUB_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GITHUB issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [Dubbo-XXX] Fix UnknownException when host config not exist #XXX. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn clean install -DskipTests=false & mvn clean test-compile failsafe:integration-test to make sure unit-test and integration-test pass.
  • If this contribution is large, please follow the Software Donation Guide.

@codecov-io
Copy link

codecov-io commented Dec 29, 2018

Codecov Report

Merging #3096 into master will decrease coverage by 0.05%.
The diff coverage is 41.42%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3096      +/-   ##
============================================
- Coverage      63.6%   63.54%   -0.06%     
  Complexity       75       75              
============================================
  Files           653      652       -1     
  Lines         28218    28186      -32     
  Branches       4803     4792      -11     
============================================
- Hits          17947    17911      -36     
- Misses         8002     8016      +14     
+ Partials       2269     2259      -10
Impacted Files Coverage Δ Complexity Δ
...pache/dubbo/common/config/SystemConfiguration.java 60% <ø> (ø) 0 <0> (ø) ⬇️
...figcenter/support/nop/NopDynamicConfiguration.java 83.33% <ø> (+23.33%) 0 <0> (ø) ⬇️
.../dubbo/common/config/EnvironmentConfiguration.java 0% <ø> (ø) 0 <0> (ø) ⬇️
...e/dubbo/common/config/PropertiesConfiguration.java 66.66% <ø> (ø) 0 <0> (ø) ⬇️
...che/dubbo/common/config/InmemoryConfiguration.java 57.14% <ø> (ø) 0 <0> (ø) ⬇️
...ter/support/apollo/ApolloDynamicConfiguration.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...pache/dubbo/configcenter/DynamicConfiguration.java 100% <100%> (ø) 0 <0> (ø) ⬇️
...bbo/common/config/AbstractPrefixConfiguration.java 100% <100%> (ø) 0 <0> (ø) ⬇️
.../org/apache/dubbo/common/config/Configuration.java 34.37% <34.37%> (ø) 0 <0> (?)
...he/dubbo/common/config/CompositeConfiguration.java 62.06% <50%> (+1.35%) 0 <0> (ø) ⬇️
... and 23 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f99f015...cd15713. Read the comment docs.

@@ -45,7 +45,10 @@ public Object getProperty(String key, Object defaultValue) {
value = getInternalProperty(prefix + key);
}
if (value == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be simplified with

if (value == null) {
     value = getInternalProperty(key);
 }
 return value!=null? value:defaultValue;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if (value == null) {
value = defaultValue;
}
return value;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be simplified with
return value!=null? value : defaultValue?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

key = key.substring(0, i) + "/" + key.substring(i + 1);
public Object getInternalProperty(String key) {
ChildData childData = treeCache.getCurrentData(key);
if (childData != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be simplified with
return childData!=null ?return new String(childData.getData(), StandardCharsets.UTF_8) :null;

return null;
// when group is null, we are fetching governance rules.
// for example, key=org.apache.dubbo.DemoService.configurators
else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any possibility of key having null?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In reality, key passed to here will never be null.

@@ -56,7 +56,7 @@ public void addConfiguration(int pos, Configuration configuration) {
}

@Override
protected Object getInternalProperty(String key) {
public Object getInternalProperty(String key) {
Configuration firstMatchingConfiguration = null;
for (Configuration config : configList) {
try {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better to do a non-empty check and remove the try block?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the behaviour to print log.

@chickenlj chickenlj merged commit e8bcdb0 into apache:master Jan 2, 2019
khanimteyaz pushed a commit to khanimteyaz/incubator-dubbo that referenced this pull request Jan 18, 2019
* polish javadoc

* git rid of template class for apollo

* get rid of template class for NopDynamicConfiguration

* get rid of tempate class for ZookeeperDynamicConfiguration

* get rid of AbstractDynamicConfiguration

* get rid of AbstractConfiguration

* fix compilation error

* fix compilation error

* polish code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants