Skip to content

[SCB-2187]read yaml from config center#2268

Closed
kaister3 wants to merge 11 commits intoapache:masterfrom
kaister3:yaml_config
Closed

[SCB-2187]read yaml from config center#2268
kaister3 wants to merge 11 commits intoapache:masterfrom
kaister3:yaml_config

Conversation

@kaister3
Copy link
Copy Markdown
Contributor

@kaister3 kaister3 commented Mar 2, 2021

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

  • Make sure there is a JIRA issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [SCB-XXX] Fixes bug in ApproximateQuantiles, where you replace SCB-XXX with the appropriate JIRA issue.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean install -Pit to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

@kaister3 kaister3 changed the title read yaml from config center [SCB-2187]read yaml from config center Mar 2, 2021
} else {
TestMgr.check(18, RegistrationManager.INSTANCE.getMicroservice().getPaths().size());
}
TestMgr.check(18, RegistrationManager.INSTANCE.getMicroservice().getPaths().size());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not correct, change 17 -> 18, 18 -> 19. Because this project is shared in demo-spring-boot-transport

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no wonder it fails in demo-spring-boot-transport test cases -_-''

config:
client:
# serverUri: http://127.0.0.1:30113
serverUri: http://127.0.0.1:30113
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Because intergartion tests do not install config center, so you can not submit this test case now.


try {
fileSourceList = configCenterClient.getFileSources();
} catch (NullPointerException e) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  1. use IDE formatter in etc folder to format code
  2. do not catch NullPointerException, figure out when NullPointerException is thrown, and add null check .


fileSourceList.forEach(fileName -> {
if (configuration.containsKey(fileName)) {
System.out.println("read yaml file: " + fileName);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove this log


private void replaceConfig(Map<String, Object> configuration, String fileName) {
Object tempConfig = configuration.get(fileName);
configuration.remove(fileName);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems remove fileName will cause update contents will not availale.

configuration.putAll(properties);
} catch (ClassCastException e) {
LOGGER.warn("yaml file has incorrect format");
e.printStackTrace();
Copy link
Copy Markdown
Contributor

@liubao68 liubao68 Mar 8, 2021

Choose a reason for hiding this comment

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

  1. remove e.printStackTrace();, using LOGGER.warn("yaml file has incorrect format", e);
  2. when will ClassCastException thrown? seems this catch statement will never happen.

@kaister3 kaister3 closed this Mar 8, 2021
@kaister3 kaister3 reopened this Mar 9, 2021
@kaister3 kaister3 closed this Mar 9, 2021
@kaister3 kaister3 deleted the yaml_config branch March 9, 2021 04:20
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.

2 participants