xbkaishui commented on a change in pull request #7151:
URL: https://github.com/apache/shardingsphere/pull/7151#discussion_r479783613
##########
File path:
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/DatabaseProtocolFrontendEngineFactoryTest.java
##########
@@ -18,12 +18,35 @@
package org.apache.shardingsphere.proxy.frontend;
import org.apache.shardingsphere.infra.database.type.DatabaseTypes;
+import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
+import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
+import
org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
+import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
+import java.lang.reflect.Method;
+
+@RunWith(MockitoJUnitRunner.class)
public final class DatabaseProtocolFrontendEngineFactoryTest {
+ @Before
+ public void init() throws Exception {
+ Method method =
ShardingSphereServiceLoader.class.getDeclaredMethod("registerServiceClass",
Class.class, Object.class);
+ method.setAccessible(true);
+ method.invoke(null, DatabaseProtocolFrontendEngine.class, new
MockDatabaseProtocolFrontendEngine());
+ }
+
@Test(expected = UnsupportedOperationException.class)
public void assertNewInstanceWhenUnsupported() {
DatabaseProtocolFrontendEngineFactory.newInstance(DatabaseTypes.getActualDatabaseType("Oracle"));
}
+
+ @Test
+ public void assertNewInstanceMysql() {
+ DatabaseProtocolFrontendEngine databaseProtocolFrontendEngine =
DatabaseProtocolFrontendEngineFactory.newInstance(new MySQLDatabaseType());
+ Assert.assertNotNull(databaseProtocolFrontendEngine);
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.
For queries about this service, please contact Infrastructure at:
[email protected]