You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/08/30 09:45:58 UTC

[GitHub] [shardingsphere] xbkaishui opened a new pull request #7151: Add more test of DatabaseProtocolFrontendEngineFactory

xbkaishui opened a new pull request #7151:
URL: https://github.com/apache/shardingsphere/pull/7151


   Fixes #7012.
   
   Changes proposed in this pull request:
   - Add test case when newInstance is not null 
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] codecov-commenter edited a comment on pull request #7151: Add more test of DatabaseProtocolFrontendEngineFactory

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #7151:
URL: https://github.com/apache/shardingsphere/pull/7151#issuecomment-683441219


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/7151?src=pr&el=h1) Report
   > Merging [#7151](https://codecov.io/gh/apache/shardingsphere/pull/7151?src=pr&el=desc) into [master](https://codecov.io/gh/apache/shardingsphere/commit/5f638a4e9ee91df8d14b93363bff80241e8c7657?el=desc) will **increase** coverage by `0.09%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/7151/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/7151?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #7151      +/-   ##
   ============================================
   + Coverage     75.46%   75.55%   +0.09%     
     Complexity      469      469              
   ============================================
     Files          1221     1221              
     Lines         21725    21757      +32     
     Branches       3934     3939       +5     
   ============================================
   + Hits          16395    16439      +44     
   + Misses         4304     4291      -13     
   - Partials       1026     1027       +1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/7151?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...istry/listener/DataSourceStateChangedListener.java](https://codecov.io/gh/apache/shardingsphere/pull/7151/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS1jb3JlLXJlZ2lzdHJ5L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9nb3Zlcm5hbmNlL2NvcmUvcmVnaXN0cnkvbGlzdGVuZXIvRGF0YVNvdXJjZVN0YXRlQ2hhbmdlZExpc3RlbmVyLmphdmE=) | `66.66% <0.00%> (-4.77%)` | `0.00% <0.00%> (ø%)` | |
   | [...e/governance/core/registry/RegistryCenterNode.java](https://codecov.io/gh/apache/shardingsphere/pull/7151/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS1jb3JlLXJlZ2lzdHJ5L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9nb3Zlcm5hbmNlL2NvcmUvcmVnaXN0cnkvUmVnaXN0cnlDZW50ZXJOb2RlLmphdmE=) | `95.45% <0.00%> (-4.55%)` | `0.00% <0.00%> (ø%)` | |
   | [...roxy/backend/text/admin/UnicastBackendHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/7151/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2FkbWluL1VuaWNhc3RCYWNrZW5kSGFuZGxlci5qYXZh) | `30.76% <0.00%> (-2.57%)` | `0.00% <0.00%> (ø%)` | |
   | [.../internal/schema/JDBCGovernanceSchemaContexts.java](https://codecov.io/gh/apache/shardingsphere/pull/7151/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtamRiYy9zaGFyZGluZ3NwaGVyZS1qZGJjLWdvdmVybmFuY2Uvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RyaXZlci9nb3Zlcm5hbmNlL2ludGVybmFsL3NjaGVtYS9KREJDR292ZXJuYW5jZVNjaGVtYUNvbnRleHRzLmphdmE=) | `57.14% <0.00%> (ø)` | `1.00% <0.00%> (ø%)` | |
   | [...phere/governance/core/registry/RegistryCenter.java](https://codecov.io/gh/apache/shardingsphere/pull/7151/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS1jb3JlLXJlZ2lzdHJ5L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9nb3Zlcm5hbmNlL2NvcmUvcmVnaXN0cnkvUmVnaXN0cnlDZW50ZXIuamF2YQ==) | `87.50% <0.00%> (ø)` | `0.00% <0.00%> (ø%)` | |
   | [...ore/registry/listener/RegistryListenerManager.java](https://codecov.io/gh/apache/shardingsphere/pull/7151/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS1jb3JlLXJlZ2lzdHJ5L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9nb3Zlcm5hbmNlL2NvcmUvcmVnaXN0cnkvbGlzdGVuZXIvUmVnaXN0cnlMaXN0ZW5lck1hbmFnZXIuamF2YQ==) | `100.00% <0.00%> (ø)` | `0.00% <0.00%> (ø%)` | |
   | [.../sql/segment/dml/item/ColumnProjectionSegment.java](https://codecov.io/gh/apache/shardingsphere/pull/7151/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvc2VnbWVudC9kbWwvaXRlbS9Db2x1bW5Qcm9qZWN0aW9uU2VnbWVudC5qYXZh) | | | |
   | [...ement/dal/dialect/mysql/AnalyzeTableStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/7151/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvc3RhdGVtZW50L2RhbC9kaWFsZWN0L215c3FsL0FuYWx5emVUYWJsZVN0YXRlbWVudC5qYXZh) | | | |
   | [...phere/sql/parser/sql/constant/AggregationType.java](https://codecov.io/gh/apache/shardingsphere/pull/7151/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvY29uc3RhbnQvQWdncmVnYXRpb25UeXBlLmphdmE=) | | | |
   | [...arser/sql/statement/ddl/DropDatabaseStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/7151/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvc3RhdGVtZW50L2RkbC9Ecm9wRGF0YWJhc2VTdGF0ZW1lbnQuamF2YQ==) | | | |
   | ... and [287 more](https://codecov.io/gh/apache/shardingsphere/pull/7151/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/7151?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/7151?src=pr&el=footer). Last update [5f638a4...9d2ee6a](https://codecov.io/gh/apache/shardingsphere/pull/7151?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on a change in pull request #7151: Add more test of DatabaseProtocolFrontendEngineFactory

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #7151:
URL: https://github.com/apache/shardingsphere/pull/7151#discussion_r480166160



##########
File path: shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/MockDatabaseProtocolFrontendEngine.java
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.proxy.frontend;
+
+import org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
+import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
+import org.apache.shardingsphere.proxy.frontend.engine.AuthenticationEngine;
+import org.apache.shardingsphere.proxy.frontend.engine.CommandExecuteEngine;
+import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
+
+public class MockDatabaseProtocolFrontendEngine implements DatabaseProtocolFrontendEngine {

Review comment:
       The class `MockDatabaseProtocolFrontendEngine` is not really mocked. `DatabaseProtocolFrontendEngineFixture` may better.

##########
File path: shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/MockDatabaseProtocolFrontendEngine.java
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.proxy.frontend;
+
+import org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
+import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
+import org.apache.shardingsphere.proxy.frontend.engine.AuthenticationEngine;
+import org.apache.shardingsphere.proxy.frontend.engine.CommandExecuteEngine;
+import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
+
+public class MockDatabaseProtocolFrontendEngine implements DatabaseProtocolFrontendEngine {

Review comment:
       It is unnecessary update mockito now.
   We can leave `MockDatabaseProtocolFrontendEngine` there. 
   But I find the problem is the class `MockDatabaseProtocolFrontendEngine` is not load via SPI, is it?




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] xbkaishui commented on a change in pull request #7151: Add more test of DatabaseProtocolFrontendEngineFactory

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



[GitHub] [shardingsphere] codecov-commenter commented on pull request #7151: Add more test of DatabaseProtocolFrontendEngineFactory

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #7151:
URL: https://github.com/apache/shardingsphere/pull/7151#issuecomment-683441219


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/7151?src=pr&el=h1) Report
   > Merging [#7151](https://codecov.io/gh/apache/shardingsphere/pull/7151?src=pr&el=desc) into [master](https://codecov.io/gh/apache/shardingsphere/commit/5f638a4e9ee91df8d14b93363bff80241e8c7657?el=desc) will **increase** coverage by `0.01%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/7151/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/7151?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #7151      +/-   ##
   ============================================
   + Coverage     75.46%   75.48%   +0.01%     
     Complexity      469      469              
   ============================================
     Files          1221     1221              
     Lines         21725    21725              
     Branches       3934     3934              
   ============================================
   + Hits          16395    16399       +4     
   + Misses         4304     4301       -3     
   + Partials       1026     1025       -1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/7151?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...rontend/DatabaseProtocolFrontendEngineFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/7151/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktZnJvbnRlbmQvc2hhcmRpbmdzcGhlcmUtcHJveHktZnJvbnRlbmQtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvZnJvbnRlbmQvRGF0YWJhc2VQcm90b2NvbEZyb250ZW5kRW5naW5lRmFjdG9yeS5qYXZh) | `100.00% <0.00%> (+57.14%)` | `0.00% <0.00%> (ø%)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/7151?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/7151?src=pr&el=footer). Last update [5f638a4...0a74560](https://codecov.io/gh/apache/shardingsphere/pull/7151?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] coveralls edited a comment on pull request #7151: Add more test of DatabaseProtocolFrontendEngineFactory

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #7151:
URL: https://github.com/apache/shardingsphere/pull/7151#issuecomment-683415945


   ## Pull Request Test Coverage Report for [Build 14325](https://coveralls.io/builds/33117923)
   
   * **0** of **0**   changed or added relevant lines in **0** files are covered.
   * **4016** unchanged lines in **9** files lost coverage.
   * Overall coverage increased (+**0.05%**) to **35.668%**
   
   ---
   
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-registry/src/main/java/org/apache/shardingsphere/governance/core/registry/listener/DataSourceStateChangedListener.java](https://coveralls.io/builds/33117923/source?filename=shardingsphere-governance%2Fshardingsphere-governance-core%2Fshardingsphere-governance-core-registry%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fgovernance%2Fcore%2Fregistry%2Flistener%2FDataSourceStateChangedListener.java#L51) | 1 | 88.89% |
   | [shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/internal/schema/JDBCGovernanceSchemaContexts.java](https://coveralls.io/builds/33117923/source?filename=shardingsphere-jdbc%2Fshardingsphere-jdbc-governance%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fdriver%2Fgovernance%2Finternal%2Fschema%2FJDBCGovernanceSchemaContexts.java#L64) | 1 | 64.29% |
   | [shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/splitter/InventoryDataTaskSplitter.java](https://coveralls.io/builds/33117923/source?filename=shardingsphere-scaling%2Fshardingsphere-scaling-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fscaling%2Fcore%2Fjob%2Fpreparer%2Fsplitter%2FInventoryDataTaskSplitter.java#L148) | 1 | 98.51% |
   | [shardingsphere-proxy/shardingsphere-proxy-governance/src/main/java/org/apache/shardingsphere/proxy/governance/schema/ProxyGovernanceSchemaContexts.java](https://coveralls.io/builds/33117923/source?filename=shardingsphere-proxy%2Fshardingsphere-proxy-governance%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fproxy%2Fgovernance%2Fschema%2FProxyGovernanceSchemaContexts.java#L80) | 2 | 10.71% |
   | [shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-schema/src/main/java/org/apache/shardingsphere/governance/core/schema/GovernanceSchemaContexts.java](https://coveralls.io/builds/33117923/source?filename=shardingsphere-governance%2Fshardingsphere-governance-core%2Fshardingsphere-governance-core-schema%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fgovernance%2Fcore%2Fschema%2FGovernanceSchemaContexts.java#L107) | 3 | 96.67% |
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/target/generated-sources/antlr4/org/apache/shardingsphere/sql/parser/autogen/SQLServerStatementBaseVisitor.java](https://coveralls.io/builds/33117923/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-dialect%2Fshardingsphere-sql-parser-sqlserver%2Ftarget%2Fgenerated-sources%2Fantlr4%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fautogen%2FSQLServerStatementBaseVisitor.java#L160) | 3 | 1.17% |
   | [shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/UnicastBackendHandler.java](https://coveralls.io/builds/33117923/source?filename=shardingsphere-proxy%2Fshardingsphere-proxy-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fproxy%2Fbackend%2Ftext%2Fadmin%2FUnicastBackendHandler.java#L55) | 6 | 33.33% |
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/impl/SQLServerDMLVisitor.java](https://coveralls.io/builds/33117923/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-dialect%2Fshardingsphere-sql-parser-sqlserver%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsqlserver%2Fvisitor%2Fimpl%2FSQLServerDMLVisitor.java#L255) | 13 | 94.98% |
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/target/generated-sources/antlr4/org/apache/shardingsphere/sql/parser/autogen/SQLServerStatementParser.java](https://coveralls.io/builds/33117923/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-dialect%2Fshardingsphere-sql-parser-sqlserver%2Ftarget%2Fgenerated-sources%2Fantlr4%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fautogen%2FSQLServerStatementParser.java#L719) | 3986 | 30.08% |
   <!-- | **Total:** | **4016** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/33117923/badge)](https://coveralls.io/builds/33117923) |
   | :-- | --: |
   | Change from base [Build 14253](https://coveralls.io/builds/33096511): |  0.05% |
   | Covered Lines: | 35602 |
   | Relevant Lines: | 99816 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu merged pull request #7151: Add more test of DatabaseProtocolFrontendEngineFactory

Posted by GitBox <gi...@apache.org>.
terrymanu merged pull request #7151:
URL: https://github.com/apache/shardingsphere/pull/7151


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] coveralls edited a comment on pull request #7151: Add more test of DatabaseProtocolFrontendEngineFactory

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #7151:
URL: https://github.com/apache/shardingsphere/pull/7151#issuecomment-683415945


   ## Pull Request Test Coverage Report for [Build 14264](https://coveralls.io/builds/33098598)
   
   * **0** of **0**   changed or added relevant lines in **0** files are covered.
   * No unchanged relevant lines lost coverage.
   * Overall coverage increased (+**0.003%**) to **35.622%**
   
   ---
   
   
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/33098598/badge)](https://coveralls.io/builds/33098598) |
   | :-- | --: |
   | Change from base [Build 14253](https://coveralls.io/builds/33096511): |  0.003% |
   | Covered Lines: | 35540 |
   | Relevant Lines: | 99770 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] xbkaishui commented on a change in pull request #7151: Add more test of DatabaseProtocolFrontendEngineFactory

Posted by GitBox <gi...@apache.org>.
xbkaishui commented on a change in pull request #7151:
URL: https://github.com/apache/shardingsphere/pull/7151#discussion_r479865347



##########
File path: shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/MockDatabaseProtocolFrontendEngine.java
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.proxy.frontend;
+
+import org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
+import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
+import org.apache.shardingsphere.proxy.frontend.engine.AuthenticationEngine;
+import org.apache.shardingsphere.proxy.frontend.engine.CommandExecuteEngine;
+import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
+
+public class MockDatabaseProtocolFrontendEngine implements DatabaseProtocolFrontendEngine {

Review comment:
       I went deep into the mockito fr
   amework,  it is not easy to mock static method, 
   If we want to use this, we need update version to 3.x,  is it necessary? 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] xbkaishui commented on a change in pull request #7151: Add more test of DatabaseProtocolFrontendEngineFactory

Posted by GitBox <gi...@apache.org>.
xbkaishui commented on a change in pull request #7151:
URL: https://github.com/apache/shardingsphere/pull/7151#discussion_r479783532



##########
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)

Review comment:
       sorry , forgot to remove 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] coveralls commented on pull request #7151: Add more test of DatabaseProtocolFrontendEngineFactory

Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #7151:
URL: https://github.com/apache/shardingsphere/pull/7151#issuecomment-683415945


   ## Pull Request Test Coverage Report for [Build 14257](https://coveralls.io/builds/33097049)
   
   * **0** of **0**   changed or added relevant lines in **0** files are covered.
   * No unchanged relevant lines lost coverage.
   * Overall coverage increased (+**0.003%**) to **35.622%**
   
   ---
   
   
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/33097049/badge)](https://coveralls.io/builds/33097049) |
   | :-- | --: |
   | Change from base [Build 14253](https://coveralls.io/builds/33096511): |  0.003% |
   | Covered Lines: | 35540 |
   | Relevant Lines: | 99770 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] xbkaishui commented on a change in pull request #7151: Add more test of DatabaseProtocolFrontendEngineFactory

Posted by GitBox <gi...@apache.org>.
xbkaishui commented on a change in pull request #7151:
URL: https://github.com/apache/shardingsphere/pull/7151#discussion_r479783505



##########
File path: shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/MockDatabaseProtocolFrontendEngine.java
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.proxy.frontend;
+
+import org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
+import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
+import org.apache.shardingsphere.proxy.frontend.engine.AuthenticationEngine;
+import org.apache.shardingsphere.proxy.frontend.engine.CommandExecuteEngine;
+import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
+
+public class MockDatabaseProtocolFrontendEngine implements DatabaseProtocolFrontendEngine {

Review comment:
       Nop, Currently implement of DatabaseProtocolFrontendEngineFactory is using class newInstance method to renew a instance of class, it is hard to mock.

##########
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() {

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:
users@infra.apache.org



[GitHub] [shardingsphere] xbkaishui commented on pull request #7151: Add more test of DatabaseProtocolFrontendEngineFactory

Posted by GitBox <gi...@apache.org>.
xbkaishui commented on pull request #7151:
URL: https://github.com/apache/shardingsphere/pull/7151#issuecomment-683413498


   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:
users@infra.apache.org



[GitHub] [shardingsphere] coveralls edited a comment on pull request #7151: Add more test of DatabaseProtocolFrontendEngineFactory

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #7151:
URL: https://github.com/apache/shardingsphere/pull/7151#issuecomment-683415945


   ## Pull Request Test Coverage Report for [Build 14310](https://coveralls.io/builds/33113474)
   
   * **0** of **0**   changed or added relevant lines in **0** files are covered.
   * **4016** unchanged lines in **9** files lost coverage.
   * Overall coverage increased (+**0.03%**) to **35.653%**
   
   ---
   
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-registry/src/main/java/org/apache/shardingsphere/governance/core/registry/listener/DataSourceStateChangedListener.java](https://coveralls.io/builds/33113474/source?filename=shardingsphere-governance%2Fshardingsphere-governance-core%2Fshardingsphere-governance-core-registry%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fgovernance%2Fcore%2Fregistry%2Flistener%2FDataSourceStateChangedListener.java#L51) | 1 | 88.89% |
   | [shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/internal/schema/JDBCGovernanceSchemaContexts.java](https://coveralls.io/builds/33113474/source?filename=shardingsphere-jdbc%2Fshardingsphere-jdbc-governance%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fdriver%2Fgovernance%2Finternal%2Fschema%2FJDBCGovernanceSchemaContexts.java#L64) | 1 | 64.29% |
   | [shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/splitter/InventoryDataTaskSplitter.java](https://coveralls.io/builds/33113474/source?filename=shardingsphere-scaling%2Fshardingsphere-scaling-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fscaling%2Fcore%2Fjob%2Fpreparer%2Fsplitter%2FInventoryDataTaskSplitter.java#L148) | 1 | 98.51% |
   | [shardingsphere-proxy/shardingsphere-proxy-governance/src/main/java/org/apache/shardingsphere/proxy/governance/schema/ProxyGovernanceSchemaContexts.java](https://coveralls.io/builds/33113474/source?filename=shardingsphere-proxy%2Fshardingsphere-proxy-governance%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fproxy%2Fgovernance%2Fschema%2FProxyGovernanceSchemaContexts.java#L80) | 2 | 10.71% |
   | [shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-schema/src/main/java/org/apache/shardingsphere/governance/core/schema/GovernanceSchemaContexts.java](https://coveralls.io/builds/33113474/source?filename=shardingsphere-governance%2Fshardingsphere-governance-core%2Fshardingsphere-governance-core-schema%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fgovernance%2Fcore%2Fschema%2FGovernanceSchemaContexts.java#L107) | 3 | 96.67% |
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/target/generated-sources/antlr4/org/apache/shardingsphere/sql/parser/autogen/SQLServerStatementBaseVisitor.java](https://coveralls.io/builds/33113474/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-dialect%2Fshardingsphere-sql-parser-sqlserver%2Ftarget%2Fgenerated-sources%2Fantlr4%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fautogen%2FSQLServerStatementBaseVisitor.java#L160) | 3 | 1.17% |
   | [shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/UnicastBackendHandler.java](https://coveralls.io/builds/33113474/source?filename=shardingsphere-proxy%2Fshardingsphere-proxy-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fproxy%2Fbackend%2Ftext%2Fadmin%2FUnicastBackendHandler.java#L55) | 6 | 33.33% |
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/impl/SQLServerDMLVisitor.java](https://coveralls.io/builds/33113474/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-dialect%2Fshardingsphere-sql-parser-sqlserver%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fsqlserver%2Fvisitor%2Fimpl%2FSQLServerDMLVisitor.java#L255) | 13 | 94.98% |
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/target/generated-sources/antlr4/org/apache/shardingsphere/sql/parser/autogen/SQLServerStatementParser.java](https://coveralls.io/builds/33113474/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-dialect%2Fshardingsphere-sql-parser-sqlserver%2Ftarget%2Fgenerated-sources%2Fantlr4%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fautogen%2FSQLServerStatementParser.java#L719) | 3986 | 30.08% |
   <!-- | **Total:** | **4016** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/33113474/badge)](https://coveralls.io/builds/33113474) |
   | :-- | --: |
   | Change from base [Build 14253](https://coveralls.io/builds/33096511): |  0.03% |
   | Covered Lines: | 35587 |
   | Relevant Lines: | 99816 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on a change in pull request #7151: Add more test of DatabaseProtocolFrontendEngineFactory

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #7151:
URL: https://github.com/apache/shardingsphere/pull/7151#discussion_r480165623



##########
File path: shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/MockDatabaseProtocolFrontendEngine.java
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.proxy.frontend;
+
+import org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
+import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
+import org.apache.shardingsphere.proxy.frontend.engine.AuthenticationEngine;
+import org.apache.shardingsphere.proxy.frontend.engine.CommandExecuteEngine;
+import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
+
+public class MockDatabaseProtocolFrontendEngine implements DatabaseProtocolFrontendEngine {
+    
+    public MockDatabaseProtocolFrontendEngine() {
+    }
+    
+    @Override
+    public String getDatabaseType() {
+        return new MySQLDatabaseType().getName();

Review comment:
       It is better to define a new type here, `FIXTURE` maybe a good name than `MySQL`

##########
File path: shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/DatabaseProtocolFrontendEngineFactoryTest.java
##########
@@ -18,12 +18,22 @@
 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.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
 import org.junit.Test;
 
+import static org.junit.Assert.assertNotNull;
+
 public final class DatabaseProtocolFrontendEngineFactoryTest {
     
     @Test(expected = UnsupportedOperationException.class)
     public void assertNewInstanceWhenUnsupported() {
         DatabaseProtocolFrontendEngineFactory.newInstance(DatabaseTypes.getActualDatabaseType("Oracle"));
     }
+    
+    @Test
+    public void assertNewInstanceMySQL() {

Review comment:
       The name of `assertNewInstanceMySQL` is inaccurate, please consider change it. 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on a change in pull request #7151: Add more test of DatabaseProtocolFrontendEngineFactory

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #7151:
URL: https://github.com/apache/shardingsphere/pull/7151#discussion_r479781982



##########
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)

Review comment:
       Why use `@RunWith(MockitoJUnitRunner.class)` if not filed use @Mock?




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on a change in pull request #7151: Add more test of DatabaseProtocolFrontendEngineFactory

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #7151:
URL: https://github.com/apache/shardingsphere/pull/7151#discussion_r479782074



##########
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() {

Review comment:
       It is better to rename `Mysql` to `MySQL`

##########
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:
       Please use static import for `Assert.assertNotNull`

##########
File path: shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/MockDatabaseProtocolFrontendEngine.java
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.proxy.frontend;
+
+import org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
+import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
+import org.apache.shardingsphere.proxy.frontend.engine.AuthenticationEngine;
+import org.apache.shardingsphere.proxy.frontend.engine.CommandExecuteEngine;
+import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
+
+public class MockDatabaseProtocolFrontendEngine implements DatabaseProtocolFrontendEngine {

Review comment:
       Do we really need this class? Can we use mock to instead this one?




----------------------------------------------------------------
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:
users@infra.apache.org