You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2022/04/09 14:33:08 UTC

[shardingsphere] branch master updated: Decouple JDBCDriverURLRecognizerEngine and DatabaseTypeAwareSPI (#16706)

This is an automated email from the ASF dual-hosted git repository.

panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 3a2922d10d6 Decouple JDBCDriverURLRecognizerEngine and DatabaseTypeAwareSPI (#16706)
3a2922d10d6 is described below

commit 3a2922d10d66b02e26fe60e87d73e56e302b8cf8
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Apr 9 22:33:01 2022 +0800

    Decouple JDBCDriverURLRecognizerEngine and DatabaseTypeAwareSPI (#16706)
---
 .../infra/database/type/DatabaseTypeAwareSPI.java  | 35 ----------------------
 .../recognizer/JDBCDriverURLRecognizerEngine.java  | 17 ++++-------
 .../jdbc/recognizer/impl/H2Recognizer.java         | 10 +++----
 .../jdbc/recognizer/impl/MySQLRecognizer.java      | 10 +++----
 .../jdbc/recognizer/impl/OpenGaussRecognizer.java  | 10 +++----
 .../jdbc/recognizer/impl/OracleRecognizer.java     | 10 +++----
 .../recognizer/impl/P6SpyDriverRecognizer.java     | 29 +++++-------------
 .../jdbc/recognizer/impl/PostgreSQLRecognizer.java | 10 +++----
 .../jdbc/recognizer/impl/SQLServerRecognizer.java  | 10 +++----
 .../spi/JDBCDriverComposeURLRecognizer.java        |  6 ++--
 .../recognizer/spi/JDBCDriverURLRecognizer.java    | 11 +++++--
 ...ion.jdbc.recognizer.spi.JDBCDriverURLRecognizer |  2 +-
 .../recognizer/impl/P6SpyDriverRecognizerTest.java |  6 ----
 13 files changed, 55 insertions(+), 111 deletions(-)

diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeAwareSPI.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeAwareSPI.java
deleted file mode 100644
index 39a96c6931e..00000000000
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeAwareSPI.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.database.type;
-
-/**
- * Database type aware SPI.
- */
-public interface DatabaseTypeAwareSPI {
-    
-    /**
-     * Get database type.
-     * 
-     * <p>
-     *     The value of database type must registered by SPI for {@code org.apache.shardingsphere.spi.database.DatabaseType}.
-     * </p>
-     * 
-     * @return database type
-     */
-    String getDatabaseType();
-}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/JDBCDriverURLRecognizerEngine.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/JDBCDriverURLRecognizerEngine.java
index 41af6439530..c9ad9b3fb64 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/JDBCDriverURLRecognizerEngine.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/JDBCDriverURLRecognizerEngine.java
@@ -22,10 +22,7 @@ import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.infra.exception.ShardingSphereException;
 import org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.spi.JDBCDriverComposeURLRecognizer;
 import org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.spi.JDBCDriverURLRecognizer;
-
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.ServiceLoader;
+import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
 
 /**
  * JDBC driver URL recognizer engine.
@@ -33,12 +30,8 @@ import java.util.ServiceLoader;
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
 public final class JDBCDriverURLRecognizerEngine {
     
-    private static final Collection<JDBCDriverURLRecognizer> JDBC_DRIVER_URL_RECOGNIZERS = new LinkedList<>();
-    
     static {
-        for (JDBCDriverURLRecognizer each : ServiceLoader.load(JDBCDriverURLRecognizer.class)) {
-            JDBC_DRIVER_URL_RECOGNIZERS.add(each);
-        }
+        ShardingSphereServiceLoader.register(JDBCDriverURLRecognizer.class);
     }
     
     /**
@@ -48,7 +41,7 @@ public final class JDBCDriverURLRecognizerEngine {
      * @return JDBC driver URL recognizer
      */
     public static JDBCDriverURLRecognizer getJDBCDriverURLRecognizer(final String url) {
-        JDBCDriverURLRecognizer result = JDBC_DRIVER_URL_RECOGNIZERS.stream().filter(each -> isMatchURL(url, each)).findAny()
+        JDBCDriverURLRecognizer result = ShardingSphereServiceLoader.getSingletonServiceInstances(JDBCDriverURLRecognizer.class).stream().filter(each -> isMatchURL(url, each)).findAny()
                 .orElseThrow(() -> new ShardingSphereException("Cannot resolve JDBC url `%s`. Please implements `%s` and add to SPI.", url, JDBCDriverURLRecognizer.class.getName()));
         if (result instanceof JDBCDriverComposeURLRecognizer) {
             return ((JDBCDriverComposeURLRecognizer) result).getDriverURLRecognizer(url);
@@ -56,7 +49,7 @@ public final class JDBCDriverURLRecognizerEngine {
         return result;
     }
     
-    private static boolean isMatchURL(final String url, final JDBCDriverURLRecognizer jdbcDriverURLRecognizer) {
-        return jdbcDriverURLRecognizer.getURLPrefixes().stream().anyMatch(url::startsWith);
+    private static boolean isMatchURL(final String url, final JDBCDriverURLRecognizer recognizer) {
+        return recognizer.getURLPrefixes().stream().anyMatch(url::startsWith);
     }
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/H2Recognizer.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/H2Recognizer.java
index 34895783da4..e8fcc265e68 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/H2Recognizer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/H2Recognizer.java
@@ -27,11 +27,6 @@ import java.util.Collections;
  */
 public final class H2Recognizer implements JDBCDriverURLRecognizer {
     
-    @Override
-    public String getDatabaseType() {
-        return "H2";
-    }
-    
     @Override
     public Collection<String> getURLPrefixes() {
         return Collections.singleton("jdbc:h2:");
@@ -41,4 +36,9 @@ public final class H2Recognizer implements JDBCDriverURLRecognizer {
     public String getDriverClassName() {
         return "org.h2.Driver";
     }
+    
+    @Override
+    public String getDatabaseType() {
+        return "H2";
+    }
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/MySQLRecognizer.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/MySQLRecognizer.java
index 53a476e32a0..5a5c85aa80a 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/MySQLRecognizer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/MySQLRecognizer.java
@@ -27,11 +27,6 @@ import java.util.Collections;
  */
 public final class MySQLRecognizer implements JDBCDriverURLRecognizer {
     
-    @Override
-    public String getDatabaseType() {
-        return "MySQL";
-    }
-    
     @Override
     public Collection<String> getURLPrefixes() {
         return Collections.singleton("jdbc:mysql:");
@@ -46,4 +41,9 @@ public final class MySQLRecognizer implements JDBCDriverURLRecognizer {
             return "com.mysql.jdbc.Driver";
         }
     }
+    
+    @Override
+    public String getDatabaseType() {
+        return "MySQL";
+    }
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/OpenGaussRecognizer.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/OpenGaussRecognizer.java
index 06d511df218..8e723b020ba 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/OpenGaussRecognizer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/OpenGaussRecognizer.java
@@ -27,11 +27,6 @@ import java.util.Collections;
  */
 public final class OpenGaussRecognizer implements JDBCDriverURLRecognizer {
     
-    @Override
-    public String getDatabaseType() {
-        return "openGauss";
-    }
-    
     @Override
     public Collection<String> getURLPrefixes() {
         return Collections.singleton("jdbc:opengauss:");
@@ -41,4 +36,9 @@ public final class OpenGaussRecognizer implements JDBCDriverURLRecognizer {
     public String getDriverClassName() {
         return "org.opengauss.Driver";
     }
+    
+    @Override
+    public String getDatabaseType() {
+        return "openGauss";
+    }
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/OracleRecognizer.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/OracleRecognizer.java
index 6ef5b324fd1..88c68f9f3ad 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/OracleRecognizer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/OracleRecognizer.java
@@ -27,11 +27,6 @@ import java.util.Collections;
  */
 public final class OracleRecognizer implements JDBCDriverURLRecognizer {
     
-    @Override
-    public String getDatabaseType() {
-        return "Oracle";
-    }
-    
     @Override
     public Collection<String> getURLPrefixes() {
         return Collections.singleton("jdbc:oracle:");
@@ -41,4 +36,9 @@ public final class OracleRecognizer implements JDBCDriverURLRecognizer {
     public String getDriverClassName() {
         return "oracle.jdbc.driver.OracleDriver";
     }
+    
+    @Override
+    public String getDatabaseType() {
+        return "Oracle";
+    }
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/P6SpyDriverRecognizer.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/P6SpyDriverRecognizer.java
index c052c0a9c9e..8340395fc8d 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/P6SpyDriverRecognizer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/P6SpyDriverRecognizer.java
@@ -30,12 +30,9 @@ import java.util.Collections;
  */
 public final class P6SpyDriverRecognizer implements JDBCDriverComposeURLRecognizer {
     
-    public static final String DRIVER_CLASS_NAME = "com.p6spy.engine.spy.P6SpyDriver";
-    
     @Override
     public JDBCDriverURLRecognizer getDriverURLRecognizer(final String url) {
-        String realUrl = extractRealUrl(url);
-        JDBCDriverURLRecognizer driverURLRecognizer = JDBCDriverURLRecognizerEngine.getJDBCDriverURLRecognizer(realUrl);
+        JDBCDriverURLRecognizer driverURLRecognizer = JDBCDriverURLRecognizerEngine.getJDBCDriverURLRecognizer(url.replace("p6spy:", ""));
         return new JDBCDriverURLRecognizer() {
             
             @Override
@@ -45,7 +42,7 @@ public final class P6SpyDriverRecognizer implements JDBCDriverComposeURLRecogniz
             
             @Override
             public String getDriverClassName() {
-                return DRIVER_CLASS_NAME;
+                return "com.p6spy.engine.spy.P6SpyDriver";
             }
             
             @Override
@@ -55,21 +52,6 @@ public final class P6SpyDriverRecognizer implements JDBCDriverComposeURLRecogniz
         };
     }
     
-    /**
-     * Parses out the real JDBC connection URL by removing "p6spy:".
-     *
-     * @param url the connection URL
-     * @return the parsed URL
-     */
-    private String extractRealUrl(final String url) {
-        return url.replace("p6spy:", "");
-    }
-    
-    @Override
-    public String getDatabaseType() {
-        throw new ShardingSphereException("Unsupported getDatabaseType method!");
-    }
-    
     @Override
     public Collection<String> getURLPrefixes() {
         return Collections.singleton("jdbc:p6spy:");
@@ -77,6 +59,11 @@ public final class P6SpyDriverRecognizer implements JDBCDriverComposeURLRecogniz
     
     @Override
     public String getDriverClassName() {
-        return DRIVER_CLASS_NAME;
+        return "com.p6spy.engine.spy.P6SpyDriver";
+    }
+    
+    @Override
+    public String getDatabaseType() {
+        throw new ShardingSphereException("Unsupported getDatabaseType method!");
     }
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/PostgreSQLRecognizer.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/PostgreSQLRecognizer.java
index bec86f3256f..ba7d9a921f8 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/PostgreSQLRecognizer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/PostgreSQLRecognizer.java
@@ -27,11 +27,6 @@ import java.util.Collections;
  */
 public final class PostgreSQLRecognizer implements JDBCDriverURLRecognizer {
     
-    @Override
-    public String getDatabaseType() {
-        return "PostgreSQL";
-    }
-    
     @Override
     public Collection<String> getURLPrefixes() {
         return Collections.singleton("jdbc:postgresql:");
@@ -41,4 +36,9 @@ public final class PostgreSQLRecognizer implements JDBCDriverURLRecognizer {
     public String getDriverClassName() {
         return "org.postgresql.Driver";
     }
+    
+    @Override
+    public String getDatabaseType() {
+        return "PostgreSQL";
+    }
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/SQLServerRecognizer.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/SQLServerRecognizer.java
index 13bc983a62a..b84ea455050 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/SQLServerRecognizer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/SQLServerRecognizer.java
@@ -27,11 +27,6 @@ import java.util.Collection;
  */
 public final class SQLServerRecognizer implements JDBCDriverURLRecognizer {
     
-    @Override
-    public String getDatabaseType() {
-        return "SQLServer";
-    }
-    
     @Override
     public Collection<String> getURLPrefixes() {
         return Arrays.asList("jdbc:sqlserver:", "jdbc:microsoft:sqlserver:");
@@ -41,4 +36,9 @@ public final class SQLServerRecognizer implements JDBCDriverURLRecognizer {
     public String getDriverClassName() {
         return "com.microsoft.sqlserver.jdbc.SQLServerDriver";
     }
+    
+    @Override
+    public String getDatabaseType() {
+        return "SQLServer";
+    }
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/spi/JDBCDriverComposeURLRecognizer.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/spi/JDBCDriverComposeURLRecognizer.java
index 3c7d0fd4ff6..a5722a59857 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/spi/JDBCDriverComposeURLRecognizer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/spi/JDBCDriverComposeURLRecognizer.java
@@ -23,10 +23,10 @@ package org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.sp
 public interface JDBCDriverComposeURLRecognizer extends JDBCDriverURLRecognizer {
     
     /**
-     * get url recognizer base on url.
+     * Get driver URL recognizer.
      *
-     * @param url jdbc url
-     * @return jdbc url recognizer
+     * @param url jdbc URL
+     * @return driver URL recognizer
      */
     JDBCDriverURLRecognizer getDriverURLRecognizer(String url);
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/spi/JDBCDriverURLRecognizer.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/spi/JDBCDriverURLRecognizer.java
index 51534020a69..d2e0b631f96 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/spi/JDBCDriverURLRecognizer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/spi/JDBCDriverURLRecognizer.java
@@ -17,14 +17,12 @@
 
 package org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.spi;
 
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeAwareSPI;
-
 import java.util.Collection;
 
 /**
  * JDBC driver URL recognizer.
  */
-public interface JDBCDriverURLRecognizer extends DatabaseTypeAwareSPI {
+public interface JDBCDriverURLRecognizer {
     
     /**
      * Get JDBC URL prefixes.
@@ -39,4 +37,11 @@ public interface JDBCDriverURLRecognizer extends DatabaseTypeAwareSPI {
      * @return driver class name
      */
     String getDriverClassName();
+    
+    /**
+     * Get database type.
+     *
+     * @return database type
+     */
+    String getDatabaseType();
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.spi.JDBCDriverURLRecognizer b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.spi.JDBCDriverURLRecognizer
index 3a86eb76ae0..028e3d6fa65 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.spi.JDBCDriverURLRecognizer
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.spi.JDBCDriverURLRecognizer
@@ -15,8 +15,8 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl.MySQLRecognizer
 org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl.PostgreSQLRecognizer
+org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl.MySQLRecognizer
 org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl.OpenGaussRecognizer
 org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl.OracleRecognizer
 org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl.SQLServerRecognizer
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/P6SpyDriverRecognizerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/P6SpyDriverRecognizerTest.java
index 87c402761ab..7108fd3e294 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/P6SpyDriverRecognizerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/P6SpyDriverRecognizerTest.java
@@ -32,10 +32,4 @@ public final class P6SpyDriverRecognizerTest {
     public void getURLPrefixes() {
         assertThat(recognizer.getURLPrefixes(), is(Collections.singleton("jdbc:p6spy:")));
     }
-    
-    @Test
-    public void getDriverClassName() {
-        assertThat(recognizer.getDriverClassName(), is(P6SpyDriverRecognizer.DRIVER_CLASS_NAME));
-    }
-    
 }