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/10/08 12:39:05 UTC

[GitHub] [shardingsphere] jacksparrow414 opened a new pull request #7714: Add test case for ShardingConditionEngineFactory

jacksparrow414 opened a new pull request #7714:
URL: https://github.com/apache/shardingsphere/pull/7714


   Fixes #7692 .
   
   Changes proposed in this pull request:
   - Add test case for ShardingConditionEngineFactory
   


----------------------------------------------------------------
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] tristaZero merged pull request #7714: Add test case for ShardingConditionEngineFactory

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


   


----------------------------------------------------------------
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-io edited a comment on pull request #7714: Add test case for ShardingConditionEngineFactory

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






----------------------------------------------------------------
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-io commented on pull request #7714: Add test case for ShardingConditionEngineFactory

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


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/7714?src=pr&el=h1) Report
   > Merging [#7714](https://codecov.io/gh/apache/shardingsphere/pull/7714?src=pr&el=desc) into [master](https://codecov.io/gh/apache/shardingsphere/commit/a55e6a36cbe9475fdf5a0684a679b8820eb533ee?el=desc) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/7714/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/7714?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff            @@
   ##             master    #7714   +/-   ##
   =========================================
     Coverage     32.81%   32.81%           
     Complexity     2377     2377           
   =========================================
     Files          1411     1411           
     Lines        104664   104664           
     Branches       9462     9462           
   =========================================
     Hits          34348    34348           
     Misses        67634    67634           
     Partials       2682     2682           
   ```
   
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/7714?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/7714?src=pr&el=footer). Last update [a55e6a3...ae6d819](https://codecov.io/gh/apache/shardingsphere/pull/7714?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] tristaZero commented on a change in pull request #7714: Add test case for ShardingConditionEngineFactory

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



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/ShardingConditionEngineFactoryTest.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.sharding.route.engine.condition.engine;
+
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.infra.metadata.schema.RuleSchemaMetaData;
+import org.apache.shardingsphere.infra.schema.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.sql.LogicSQL;
+import org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.InsertClauseShardingConditionEngine;
+import org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.WhereClauseShardingConditionEngine;
+import org.apache.shardingsphere.sharding.rule.ShardingRule;
+import org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaData;
+import org.apache.shardingsphere.sql.parser.binder.statement.SQLStatementContext;
+import org.apache.shardingsphere.sql.parser.binder.statement.dml.InsertStatementContext;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public final class ShardingConditionEngineFactoryTest {
+    
+    @Mock
+    private LogicSQL logicSQL;
+    
+    @Mock
+    private ShardingRule shardingRule;
+    
+    @Before
+    public void setUp() {
+        ShardingSphereSchema shardingSphereSchema = mock(ShardingSphereSchema.class);
+        when(logicSQL.getSchema()).thenReturn(shardingSphereSchema);
+        ShardingSphereMetaData shardingSphereMetaData = mock(ShardingSphereMetaData.class);
+        when(shardingSphereSchema.getMetaData()).thenReturn(shardingSphereMetaData);
+        RuleSchemaMetaData ruleSchemaMetaData = mock(RuleSchemaMetaData.class);
+        when(shardingSphereMetaData.getRuleSchemaMetaData()).thenReturn(ruleSchemaMetaData);
+        SchemaMetaData schemaMetaData = mock(SchemaMetaData.class);
+        when(ruleSchemaMetaData.getConfiguredSchemaMetaData()).thenReturn(schemaMetaData);
+        

Review comment:
       Please remove this redundant blank line.




----------------------------------------------------------------
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-io commented on pull request #7714: Add test case for ShardingConditionEngineFactory

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


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/7714?src=pr&el=h1) Report
   > Merging [#7714](https://codecov.io/gh/apache/shardingsphere/pull/7714?src=pr&el=desc) into [master](https://codecov.io/gh/apache/shardingsphere/commit/a55e6a36cbe9475fdf5a0684a679b8820eb533ee?el=desc) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/7714/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/7714?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff            @@
   ##             master    #7714   +/-   ##
   =========================================
     Coverage     32.81%   32.81%           
     Complexity     2377     2377           
   =========================================
     Files          1411     1411           
     Lines        104664   104664           
     Branches       9462     9462           
   =========================================
     Hits          34348    34348           
     Misses        67634    67634           
     Partials       2682     2682           
   ```
   
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/7714?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/7714?src=pr&el=footer). Last update [a55e6a3...ae6d819](https://codecov.io/gh/apache/shardingsphere/pull/7714?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] codecov-io edited a comment on pull request #7714: Add test case for ShardingConditionEngineFactory

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


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/7714?src=pr&el=h1) Report
   > Merging [#7714](https://codecov.io/gh/apache/shardingsphere/pull/7714?src=pr&el=desc) into [master](https://codecov.io/gh/apache/shardingsphere/commit/7a60d48a99da68214bd88550ce91e1d86c263af8?el=desc) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/7714/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/7714?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff            @@
   ##             master    #7714   +/-   ##
   =========================================
     Coverage     32.82%   32.82%           
     Complexity     2377     2377           
   =========================================
     Files          1411     1411           
     Lines        104664   104664           
     Branches       9462     9462           
   =========================================
     Hits          34353    34353           
     Misses        67630    67630           
     Partials       2681     2681           
   ```
   
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/7714?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/7714?src=pr&el=footer). Last update [7a60d48...c4e771b](https://codecov.io/gh/apache/shardingsphere/pull/7714?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] codecov-io edited a comment on pull request #7714: Add test case for ShardingConditionEngineFactory

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


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/7714?src=pr&el=h1) Report
   > Merging [#7714](https://codecov.io/gh/apache/shardingsphere/pull/7714?src=pr&el=desc) into [master](https://codecov.io/gh/apache/shardingsphere/commit/7a60d48a99da68214bd88550ce91e1d86c263af8?el=desc) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/7714/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/7714?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff            @@
   ##             master    #7714   +/-   ##
   =========================================
     Coverage     32.82%   32.82%           
     Complexity     2377     2377           
   =========================================
     Files          1411     1411           
     Lines        104664   104664           
     Branches       9462     9462           
   =========================================
     Hits          34353    34353           
     Misses        67630    67630           
     Partials       2681     2681           
   ```
   
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/7714?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/7714?src=pr&el=footer). Last update [7a60d48...c4e771b](https://codecov.io/gh/apache/shardingsphere/pull/7714?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] tristaZero commented on a change in pull request #7714: Add test case for ShardingConditionEngineFactory

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



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/ShardingConditionEngineFactoryTest.java
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.sharding.route.engine.condition.engine;
+
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.infra.metadata.schema.RuleSchemaMetaData;
+import org.apache.shardingsphere.infra.schema.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.sql.LogicSQL;
+import org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.InsertClauseShardingConditionEngine;
+import org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.WhereClauseShardingConditionEngine;
+import org.apache.shardingsphere.sharding.rule.ShardingRule;
+import org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaData;
+import org.apache.shardingsphere.sql.parser.binder.statement.SQLStatementContext;
+import org.apache.shardingsphere.sql.parser.binder.statement.dml.InsertStatementContext;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public final class ShardingConditionEngineFactoryTest {
+    
+    @Mock
+    private LogicSQL logicSQL;
+    
+    @Mock
+    private ShardingRule shardingRule;
+    
+    @Before
+    public void setUp() {
+        ShardingSphereSchema shardingSphereSchema = mock(ShardingSphereSchema.class);
+        when(logicSQL.getSchema()).thenReturn(shardingSphereSchema);
+        ShardingSphereMetaData shardingSphereMetaData = mock(ShardingSphereMetaData.class);
+        when(shardingSphereSchema.getMetaData()).thenReturn(shardingSphereMetaData);
+        RuleSchemaMetaData ruleSchemaMetaData = mock(RuleSchemaMetaData.class);
+        when(shardingSphereMetaData.getRuleSchemaMetaData()).thenReturn(ruleSchemaMetaData);
+        SchemaMetaData schemaMetaData = mock(SchemaMetaData.class);
+        when(ruleSchemaMetaData.getConfiguredSchemaMetaData()).thenReturn(schemaMetaData);
+        

Review comment:
       Please remove this redundant blank line.




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