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/13 08:45:35 UTC

[GitHub] [shardingsphere] GeniusQ opened a new pull request #6819: Add more test case for HintManager (apache#6712)

GeniusQ opened a new pull request #6819:
URL: https://github.com/apache/shardingsphere/pull/6819


   Fixes #6712.
   
   Changes proposed in this pull request:
   -Add more test case for HintManager
   


----------------------------------------------------------------
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 #6819: Add test case for RuleSchemaMetaData(#6731)

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


   


----------------------------------------------------------------
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 #6819: Add test case for RuleSchemaMetaData(#6731)

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


   ## Pull Request Test Coverage Report for [Build 13809](https://coveralls.io/builds/32781286)
   
   * **0** of **0**   changed or added relevant lines in **0** files are covered.
   * No unchanged relevant lines lost coverage.
   * Overall coverage increased (+**0.02%**) to **58.423%**
   
   ---
   
   
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/32781286/badge)](https://coveralls.io/builds/32781286) |
   | :-- | --: |
   | Change from base [Build 13804](https://coveralls.io/builds/32777884): |  0.02% |
   | Covered Lines: | 13210 |
   | Relevant Lines: | 22611 |
   
   ---
   ##### 💛  - [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] coveralls edited a comment on pull request #6819: Add test case for RuleSchemaMetaData(#6731)

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


   ## Pull Request Test Coverage Report for [Build 13801](https://coveralls.io/builds/32777162)
   
   * **0** of **0**   changed or added relevant lines in **0** files are covered.
   * No unchanged relevant lines lost coverage.
   * Overall coverage remained the same at **58.33%**
   
   ---
   
   
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/32777162/badge)](https://coveralls.io/builds/32777162) |
   | :-- | --: |
   | Change from base [Build 13799](https://coveralls.io/builds/32776977): |  0.0% |
   | Covered Lines: | 13185 |
   | Relevant Lines: | 22604 |
   
   ---
   ##### 💛  - [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] coveralls edited a comment on pull request #6819: Add test case for RuleSchemaMetaData(#6731)

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


   ## Pull Request Test Coverage Report for [Build 13907](https://coveralls.io/builds/32855619)
   
   * **0** of **0**   changed or added relevant lines in **0** files are covered.
   * **148** unchanged lines in **5** files lost coverage.
   * Overall coverage decreased (**-0.07%**) to **60.217%**
   
   ---
   
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [shardingsphere-kernel/shardingsphere-kernel-context/src/main/java/org/apache/shardingsphere/kernel/context/SchemaContext.java](https://coveralls.io/builds/32855619/source?filename=shardingsphere-kernel%2Fshardingsphere-kernel-context%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fkernel%2Fcontext%2FSchemaContext.java#L48) | 1 | 0% |
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/statement/dml/SelectStatementContext.java](https://coveralls.io/builds/32855619/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-binder%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fbinder%2Fstatement%2Fdml%2FSelectStatementContext.java#L99) | 7 | 89.39% |
   | [shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/query/QueryBackendHandler.java](https://coveralls.io/builds/32855619/source?filename=shardingsphere-proxy%2Fshardingsphere-proxy-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fproxy%2Fbackend%2Ftext%2Fquery%2FQueryBackendHandler.java#L57) | 8 | 0% |
   | [shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/TextProtocolBackendHandlerFactory.java](https://coveralls.io/builds/32855619/source?filename=shardingsphere-proxy%2Fshardingsphere-proxy-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fproxy%2Fbackend%2Ftext%2FTextProtocolBackendHandlerFactory.java#L77) | 8 | 75.76% |
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/MySQLVisitor.java](https://coveralls.io/builds/32855619/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-dialect%2Fshardingsphere-sql-parser-mysql%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fmysql%2Fvisitor%2FMySQLVisitor.java#L119) | 124 | 0% |
   <!-- | **Total:** | **148** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/32855619/badge)](https://coveralls.io/builds/32855619) |
   | :-- | --: |
   | Change from base [Build 13876](https://coveralls.io/builds/32825979): |  -0.07% |
   | Covered Lines: | 13715 |
   | Relevant Lines: | 22776 |
   
   ---
   ##### 💛  - [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] GeniusQ commented on a change in pull request #6819: Add test case for RuleSchemaMetaData(#6731)

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



##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/RuleSchemaMetaDataTest.java
##########
@@ -0,0 +1,30 @@
+/*
+ * 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.metadata.schema;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+
+public class RuleSchemaMetaDataTest {
+    @Test
+    public void assertNewInstance() {
+        RuleSchemaMetaData obj = new RuleSchemaMetaData(null, null);
+        assertNotNull("RuleSchemaMetaData is null", obj);
+    }

Review comment:
       ok




----------------------------------------------------------------
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 #6819: Add test case for RuleSchemaMetaData(#6731)

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


   ## Pull Request Test Coverage Report for [Build 13877](https://coveralls.io/builds/32826688)
   
   * **0** of **0**   changed or added relevant lines in **0** files are covered.
   * No unchanged relevant lines lost coverage.
   * Overall coverage increased (+**0.02%**) to **60.308%**
   
   ---
   
   
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/32826688/badge)](https://coveralls.io/builds/32826688) |
   | :-- | --: |
   | Change from base [Build 13876](https://coveralls.io/builds/32825979): |  0.02% |
   | Covered Lines: | 13723 |
   | Relevant Lines: | 22755 |
   
   ---
   ##### 💛  - [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] GeniusQ commented on a change in pull request #6819: Add test case for RuleSchemaMetaData(#6731)

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



##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/hint/HintManagerTest.java
##########
@@ -111,6 +111,32 @@ public void assertIsDatabaseShardingOnlyWithoutSet() {
         assertFalse(HintManager.isDatabaseShardingOnly());
     }
     
+    @Test
+    public void assertAddDatabaseShardingValueOnlyDatabaseSharding() {
+        try (HintManager hintManager = HintManager.getInstance()) {
+            hintManager.setDatabaseShardingValue(1);
+            assertTrue(HintManager.isDatabaseShardingOnly());
+            hintManager.addDatabaseShardingValue("logic_table", 2);
+            assertFalse(HintManager.isDatabaseShardingOnly());
+            assertThat(HintManager.getDatabaseShardingValues("logic_table").size(), is(1));
+            assertTrue(HintManager.getDatabaseShardingValues("logic_table").contains(2));
+            hintManager.close();

Review comment:
       ok, i fix it now.




----------------------------------------------------------------
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 #6819: Add test case for RuleSchemaMetaData(#6731)

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



##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/RuleSchemaMetaDataTest.java
##########
@@ -0,0 +1,30 @@
+/*
+ * 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.metadata.schema;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+
+public class RuleSchemaMetaDataTest {
+    @Test
+    public void assertNewInstance() {
+        RuleSchemaMetaData obj = new RuleSchemaMetaData(null, null);
+        assertNotNull("RuleSchemaMetaData is null", obj);
+    }

Review comment:
       The assertion of new instance does not make sense.
   Please add test case for `getSchemaMetaData`

##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/hint/HintManagerTest.java
##########
@@ -111,6 +111,32 @@ public void assertIsDatabaseShardingOnlyWithoutSet() {
         assertFalse(HintManager.isDatabaseShardingOnly());
     }
     
+    @Test
+    public void assertAddDatabaseShardingValueOnlyDatabaseSharding() {
+        try (HintManager hintManager = HintManager.getInstance()) {
+            hintManager.setDatabaseShardingValue(1);
+            assertTrue(HintManager.isDatabaseShardingOnly());
+            hintManager.addDatabaseShardingValue("logic_table", 2);
+            assertFalse(HintManager.isDatabaseShardingOnly());
+            assertThat(HintManager.getDatabaseShardingValues("logic_table").size(), is(1));
+            assertTrue(HintManager.getDatabaseShardingValues("logic_table").contains(2));
+            hintManager.close();

Review comment:
       Is it necessary to call `close` again?
   `Try with resources` is close the resource.

##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/hint/HintManagerTest.java
##########
@@ -111,6 +111,32 @@ public void assertIsDatabaseShardingOnlyWithoutSet() {
         assertFalse(HintManager.isDatabaseShardingOnly());
     }
     
+    @Test
+    public void assertAddDatabaseShardingValueOnlyDatabaseSharding() {
+        try (HintManager hintManager = HintManager.getInstance()) {
+            hintManager.setDatabaseShardingValue(1);
+            assertTrue(HintManager.isDatabaseShardingOnly());
+            hintManager.addDatabaseShardingValue("logic_table", 2);
+            assertFalse(HintManager.isDatabaseShardingOnly());
+            assertThat(HintManager.getDatabaseShardingValues("logic_table").size(), is(1));
+            assertTrue(HintManager.getDatabaseShardingValues("logic_table").contains(2));
+            hintManager.close();
+        }
+    }
+    
+    @Test
+    public void assertAddTableShardingValueOnlyDatabaseSharding() {
+        try (HintManager hintManager = HintManager.getInstance()) {
+            hintManager.setDatabaseShardingValue(1);
+            assertTrue(HintManager.isDatabaseShardingOnly());
+            hintManager.addTableShardingValue("logic_table", 2);
+            assertFalse(HintManager.isDatabaseShardingOnly());
+            assertThat(HintManager.getTableShardingValues("logic_table").size(), is(1));
+            assertTrue(HintManager.getTableShardingValues("logic_table").contains(2));
+            hintManager.close();

Review comment:
       Is it necessary to call `close` again?
   Try with resources is close the resource.




----------------------------------------------------------------
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 #6819: Add test case for RuleSchemaMetaData(#6731)

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



##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/RuleSchemaMetaDataTest.java
##########
@@ -0,0 +1,37 @@
+/*
+ * 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.metadata.schema;
+
+import org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaData;
+import org.apache.shardingsphere.sql.parser.binder.metadata.table.TableMetaData;
+import org.junit.Test;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.assertNotNull;
+
+public class RuleSchemaMetaDataTest {

Review comment:
       1. Please add final if the class is not design for extension;
   2. Please keep one blank line between class definition and method.




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