You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "totalo (via GitHub)" <gi...@apache.org> on 2023/03/02 14:56:46 UTC
[GitHub] [shardingsphere] totalo opened a new pull request, #24429: Add apollo driver url provider
totalo opened a new pull request, #24429:
URL: https://github.com/apache/shardingsphere/pull/24429
Fixes #23388.
Changes proposed in this pull request:
- Add apollo driver url provider
---
Before committing this PR, I'm sure that I have checked the following options:
- [x] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
- [x] I have self-reviewed the commit code.
- [x] I have (or in comment I request) added corresponding labels for the pull request.
- [x] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
- [x] I have made corresponding changes to the documentation.
- [x] I have added corresponding unit tests for my changes.
--
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@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] totalo commented on a diff in pull request #24429: Add apollo driver url provider
Posted by "totalo (via GitHub)" <gi...@apache.org>.
totalo commented on code in PR #24429:
URL: https://github.com/apache/shardingsphere/pull/24429#discussion_r1123941165
##########
jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/driver/ShardingSphereDriverURLManagerTest.java:
##########
@@ -46,4 +58,14 @@ public void assertToAbsolutePathConfigurationFile() {
byte[] actual = ShardingSphereDriverURLManager.getContent("jdbc:shardingsphere:absolutepath:" + absolutePath);
assertThat(actual.length, is(fooDriverConfigLength));
}
+
+ @org.junit.jupiter.api.Test
Review Comment:
Because of using junit5 `MockStatic`, it is the new API.
##########
jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/driver/ShardingSphereDriverURLManagerTest.java:
##########
@@ -46,4 +58,14 @@ public void assertToAbsolutePathConfigurationFile() {
byte[] actual = ShardingSphereDriverURLManager.getContent("jdbc:shardingsphere:absolutepath:" + absolutePath);
assertThat(actual.length, is(fooDriverConfigLength));
}
+
+ @org.junit.jupiter.api.Test
+ public void assertToApolloConfigurationFile() {
+ ConfigFile configFile = mock(ConfigFile.class);
+ when(configFile.getContent()).thenReturn("config content");
+ when(ConfigService.getConfigFile(Mockito.anyString(), Mockito.any(ConfigFileFormat.class))).thenReturn(configFile);
Review Comment:
done.
--
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@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] totalo commented on a diff in pull request #24429: Add apollo driver url provider
Posted by "totalo (via GitHub)" <gi...@apache.org>.
totalo commented on code in PR #24429:
URL: https://github.com/apache/shardingsphere/pull/24429#discussion_r1123940572
##########
docs/document/content/dev-manual/data-source.en.md:
##########
@@ -96,7 +96,20 @@ ShardingSphere driver URL provider
### Implementation classes
-| *Configuration Type* | *Description* | *Fully-qualified class name* |
-|-----------------------------------------|---------------------------------------| ---------------------------- |
-| jdbc:shardingsphere:classpath:<path> | The classpath driver URL provider | [`org.apache.shardingsphere.driver.jdbc.core.driver.spi.ClasspathDriverURLProvider`](https://github.com/apache/shardingsphere/blob/master/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/ClasspathDriverURLProvider.java) |
+| *Configuration Type* | *Description* | *Fully-qualified class name* |
+|-----------------------------------------|---------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| jdbc:shardingsphere:classpath:<path> | The classpath driver URL provider | [`org.apache.shardingsphere.driver.jdbc.core.driver.spi.ClasspathDriverURLProvider`](https://github.com/apache/shardingsphere/blob/master/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/ClasspathDriverURLProvider.java) |
| jdbc:shardingsphere:absolutepath:<path> | The absolute path driver URL provider | [`org.apache.shardingsphere.driver.jdbc.core.driver.spi.AbsolutePathDriverURLProvider`](https://github.com/apache/shardingsphere/blob/master/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/AbsolutePathDriverURLProvider.java) |
+| jdbc:shardingsphere:apollo:<namespace> | The apollo driver URL provider | [`org.apache.shardingsphere.driver.jdbc.core.driver.spi.ApolloDriverURLProvider`](https://github.com/apache/shardingsphere/blob/master/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/ApolloDriverURLProvider.java) |
+
+### Notice
+
+When you use the Apollo loader, you need to add the corresponding apollo pom dependency, currently available at version `1.9.0`, as follows:
Review Comment:
Yes, done.
--
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@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #24429: Add apollo driver url provider
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on code in PR #24429:
URL: https://github.com/apache/shardingsphere/pull/24429#discussion_r1123902599
##########
docs/document/content/dev-manual/data-source.cn.md:
##########
@@ -113,7 +113,20 @@ ShardingSphere 驱动 URL 提供器
### 已知实现
-| *配置标识* | *详细说明* | *全限定类名* |
-|-----------------------------------------|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| jdbc:shardingsphere:classpath:<path> | 驱动的类路径加载器 | [`org.apache.shardingsphere.driver.jdbc.core.driver.spi.ClasspathDriverURLProvider`](https://github.com/apache/shardingsphere/blob/master/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/ClasspathDriverURLProvider.java) |
-| jdbc:shardingsphere:absolutepath:<path> | 驱动的绝对路径加载器 | [`org.apache.shardingsphere.driver.jdbc.core.driver.spi.AbsolutePathDriverURLProvider`](https://github.com/apache/shardingsphere/blob/master/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/AbsolutePathDriverURLProvider.java) |
+| *配置标识* | *详细说明* | *全限定类名* |
+|-----------------------------------------|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| jdbc:shardingsphere:classpath:<path> | 驱动的类路径加载器 | [`org.apache.shardingsphere.driver.jdbc.core.driver.spi.ClasspathDriverURLProvider`](https://github.com/apache/shardingsphere/blob/master/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/ClasspathDriverURLProvider.java) |
+| jdbc:shardingsphere:absolutepath:<path> | 驱动的绝对路径加载器 | [`org.apache.shardingsphere.driver.jdbc.core.driver.spi.AbsolutePathDriverURLProvider`](https://github.com/apache/shardingsphere/blob/master/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/AbsolutePathDriverURLProvider.java) |
+| jdbc:shardingsphere:apollo:<namespace> | 驱动的 Apollo 加载器 | [`org.apache.shardingsphere.driver.jdbc.core.driver.spi.ApolloDriverURLProvider`](https://github.com/apache/shardingsphere/blob/master/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/ApolloDriverURLProvider.java) |
+
+### 注意
+
+当您使用 Apollo 加载器时,需要添加对应的 apollo 的pom依赖,目前适配的版本为 `1.9.0` , 如下:
Review Comment:
Please put a space before and after `pom`.
##########
jdbc/core/pom.xml:
##########
@@ -188,7 +188,7 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
-
Review Comment:
Please keep the indent format.
##########
docs/document/content/dev-manual/data-source.en.md:
##########
@@ -96,7 +96,20 @@ ShardingSphere driver URL provider
### Implementation classes
-| *Configuration Type* | *Description* | *Fully-qualified class name* |
-|-----------------------------------------|---------------------------------------| ---------------------------- |
-| jdbc:shardingsphere:classpath:<path> | The classpath driver URL provider | [`org.apache.shardingsphere.driver.jdbc.core.driver.spi.ClasspathDriverURLProvider`](https://github.com/apache/shardingsphere/blob/master/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/ClasspathDriverURLProvider.java) |
+| *Configuration Type* | *Description* | *Fully-qualified class name* |
+|-----------------------------------------|---------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| jdbc:shardingsphere:classpath:<path> | The classpath driver URL provider | [`org.apache.shardingsphere.driver.jdbc.core.driver.spi.ClasspathDriverURLProvider`](https://github.com/apache/shardingsphere/blob/master/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/ClasspathDriverURLProvider.java) |
| jdbc:shardingsphere:absolutepath:<path> | The absolute path driver URL provider | [`org.apache.shardingsphere.driver.jdbc.core.driver.spi.AbsolutePathDriverURLProvider`](https://github.com/apache/shardingsphere/blob/master/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/AbsolutePathDriverURLProvider.java) |
+| jdbc:shardingsphere:apollo:<namespace> | The apollo driver URL provider | [`org.apache.shardingsphere.driver.jdbc.core.driver.spi.ApolloDriverURLProvider`](https://github.com/apache/shardingsphere/blob/master/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/ApolloDriverURLProvider.java) |
+
+### Notice
+
+When you use the Apollo loader, you need to add the corresponding apollo pom dependency, currently available at version `1.9.0`, as follows:
Review Comment:
Do you think `Apollo driver url provider` is better?
##########
jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/driver/ShardingSphereDriverURLManagerTest.java:
##########
@@ -46,4 +58,14 @@ public void assertToAbsolutePathConfigurationFile() {
byte[] actual = ShardingSphereDriverURLManager.getContent("jdbc:shardingsphere:absolutepath:" + absolutePath);
assertThat(actual.length, is(fooDriverConfigLength));
}
+
+ @org.junit.jupiter.api.Test
Review Comment:
Why not use `org.junit.Test` here?
##########
jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/driver/ShardingSphereDriverURLManagerTest.java:
##########
@@ -46,4 +58,14 @@ public void assertToAbsolutePathConfigurationFile() {
byte[] actual = ShardingSphereDriverURLManager.getContent("jdbc:shardingsphere:absolutepath:" + absolutePath);
assertThat(actual.length, is(fooDriverConfigLength));
}
+
+ @org.junit.jupiter.api.Test
+ public void assertToApolloConfigurationFile() {
+ ConfigFile configFile = mock(ConfigFile.class);
+ when(configFile.getContent()).thenReturn("config content");
+ when(ConfigService.getConfigFile(Mockito.anyString(), Mockito.any(ConfigFileFormat.class))).thenReturn(configFile);
Review Comment:
Please remove `Mockito`.
--
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@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] codecov-commenter commented on pull request #24429: Add apollo driver url provider
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #24429:
URL: https://github.com/apache/shardingsphere/pull/24429#issuecomment-1452079422
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/24429?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 [#24429](https://codecov.io/gh/apache/shardingsphere/pull/24429?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4e9226e) into [master](https://codecov.io/gh/apache/shardingsphere/commit/7425026a04f1ec94ced76375292bd5ba558bc617?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7425026) will **decrease** coverage by `0.04%`.
> The diff coverage is `24.52%`.
> :exclamation: Current head 4e9226e differs from pull request most recent head 554204e. Consider uploading reports for the commit 554204e to get more accurate results
```diff
@@ Coverage Diff @@
## master #24429 +/- ##
============================================
- Coverage 49.97% 49.93% -0.04%
- Complexity 1583 1584 +1
============================================
Files 3254 3257 +3
Lines 53565 53569 +4
Branches 9868 9863 -5
============================================
- Hits 26770 26752 -18
- Misses 24403 24422 +19
- Partials 2392 2395 +3
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/24429?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...ite/context/EncryptSQLRewriteContextDecorator.java](https://codecov.io/gh/apache/shardingsphere/pull/24429?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmVhdHVyZXMvZW5jcnlwdC9jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbmNyeXB0L3Jld3JpdGUvY29udGV4dC9FbmNyeXB0U1FMUmV3cml0ZUNvbnRleHREZWNvcmF0b3IuamF2YQ==) | `12.90% <0.00%> (ø)` | |
| [...eadwritesplitting/rule/ReadwriteSplittingRule.java](https://codecov.io/gh/apache/shardingsphere/pull/24429?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmVhdHVyZXMvcmVhZHdyaXRlLXNwbGl0dGluZy9jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9yZWFkd3JpdGVzcGxpdHRpbmcvcnVsZS9SZWFkd3JpdGVTcGxpdHRpbmdSdWxlLmphdmE=) | `45.36% <0.00%> (-11.35%)` | :arrow_down: |
| [...ng/strategy/ReadwriteSplittingStrategyFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/24429?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmVhdHVyZXMvcmVhZHdyaXRlLXNwbGl0dGluZy9jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9yZWFkd3JpdGVzcGxpdHRpbmcvc3RyYXRlZ3kvUmVhZHdyaXRlU3BsaXR0aW5nU3RyYXRlZ3lGYWN0b3J5LmphdmE=) | `33.33% <0.00%> (-52.39%)` | :arrow_down: |
| [...rategy/type/DynamicReadwriteSplittingStrategy.java](https://codecov.io/gh/apache/shardingsphere/pull/24429?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmVhdHVyZXMvcmVhZHdyaXRlLXNwbGl0dGluZy9jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9yZWFkd3JpdGVzcGxpdHRpbmcvc3RyYXRlZ3kvdHlwZS9EeW5hbWljUmVhZHdyaXRlU3BsaXR0aW5nU3RyYXRlZ3kuamF2YQ==) | `33.33% <ø> (-66.67%)` | :arrow_down: |
| [...eadwriteSplittingStrategyConfigurationSwapper.java](https://codecov.io/gh/apache/shardingsphere/pull/24429?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmVhdHVyZXMvcmVhZHdyaXRlLXNwbGl0dGluZy9jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9yZWFkd3JpdGVzcGxpdHRpbmcveWFtbC9zd2FwcGVyL3N0cmF0ZWd5L1lhbWxEeW5hbWljUmVhZHdyaXRlU3BsaXR0aW5nU3RyYXRlZ3lDb25maWd1cmF0aW9uU3dhcHBlci5qYXZh) | `20.00% <0.00%> (+3.33%)` | :arrow_up: |
| [...ore/ReadwriteSplittingDistSQLStatementVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/24429?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmVhdHVyZXMvcmVhZHdyaXRlLXNwbGl0dGluZy9kaXN0c3FsL3BhcnNlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcmVhZHdyaXRlc3BsaXR0aW5nL2Rpc3RzcWwvcGFyc2VyL2NvcmUvUmVhZHdyaXRlU3BsaXR0aW5nRGlzdFNRTFN0YXRlbWVudFZpc2l0b3IuamF2YQ==) | `0.00% <ø> (ø)` | |
| [.../parser/segment/ReadwriteSplittingRuleSegment.java](https://codecov.io/gh/apache/shardingsphere/pull/24429?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZmVhdHVyZXMvcmVhZHdyaXRlLXNwbGl0dGluZy9kaXN0c3FsL3N0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcmVhZHdyaXRlc3BsaXR0aW5nL2Rpc3RzcWwvcGFyc2VyL3NlZ21lbnQvUmVhZHdyaXRlU3BsaXR0aW5nUnVsZVNlZ21lbnQuamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [...ra/binder/statement/CommonSQLStatementContext.java](https://codecov.io/gh/apache/shardingsphere/pull/24429?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5mcmEvYmluZGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9iaW5kZXIvc3RhdGVtZW50L0NvbW1vblNRTFN0YXRlbWVudENvbnRleHQuamF2YQ==) | `77.27% <0.00%> (-3.68%)` | :arrow_down: |
| [...he/shardingsphere/infra/hint/HintValueContext.java](https://codecov.io/gh/apache/shardingsphere/pull/24429?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5mcmEvY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9oaW50L0hpbnRWYWx1ZUNvbnRleHQuamF2YQ==) | `100.00% <ø> (ø)` | |
| [.../shardingsphere/infra/rewrite/SQLRewriteEntry.java](https://codecov.io/gh/apache/shardingsphere/pull/24429?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5mcmEvcmV3cml0ZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvaW5mcmEvcmV3cml0ZS9TUUxSZXdyaXRlRW50cnkuamF2YQ==) | `78.26% <0.00%> (-7.46%)` | :arrow_down: |
| ... and [24 more](https://codecov.io/gh/apache/shardingsphere/pull/24429?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
: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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu merged pull request #24429: Add apollo driver url provider
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu merged PR #24429:
URL: https://github.com/apache/shardingsphere/pull/24429
--
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@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org