You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "strongduanmu (via GitHub)" <gi...@apache.org> on 2023/03/03 00:27:41 UTC

[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #24429: Add apollo driver url provider

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