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/11/26 13:11:53 UTC

[GitHub] [shardingsphere] laingke opened a new pull request #8366: test: Testcase for ParseTreeCacheBuilder

laingke opened a new pull request #8366:
URL: https://github.com/apache/shardingsphere/pull/8366


   Update #8238
   
   Changes proposed in this pull request:
   - add testcase for ParseTreeCacheBuilder


----------------------------------------------------------------
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] laingke commented on pull request #8366: test: Testcase for ParseTreeCacheBuilder

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


   Sorry, I make a mistake. I will close it and rePR.


----------------------------------------------------------------
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 #8366: test: Testcase for ParseTreeCacheBuilder

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


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8366?src=pr&el=h1) Report
   > Merging [#8366](https://codecov.io/gh/apache/shardingsphere/pull/8366?src=pr&el=desc) (2605845) into [master](https://codecov.io/gh/apache/shardingsphere/commit/c3f4d5967f8265e4b06ef2163396db54d3f09014?el=desc) (c3f4d59) will **increase** coverage by `0.02%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/8366/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/8366?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #8366      +/-   ##
   ============================================
   + Coverage     73.45%   73.47%   +0.02%     
     Complexity      606      606              
   ============================================
     Files          1500     1500              
     Lines         23872    23872              
     Branches       4222     4222              
   ============================================
   + Hits          17534    17539       +5     
   + Misses         5170     5165       -5     
     Partials       1168     1168              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/8366?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...re/sql/parser/core/cache/ParseTreeCacheLoader.java](https://codecov.io/gh/apache/shardingsphere/pull/8366/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWVuZ2luZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9jb3JlL2NhY2hlL1BhcnNlVHJlZUNhY2hlTG9hZGVyLmphdmE=) | `60.00% <0.00%> (+60.00%)` | `0.00% <0.00%> (ø%)` | |
   | [...e/sql/parser/core/cache/ParseTreeCacheBuilder.java](https://codecov.io/gh/apache/shardingsphere/pull/8366/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWVuZ2luZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9jb3JlL2NhY2hlL1BhcnNlVHJlZUNhY2hlQnVpbGRlci5qYXZh) | `100.00% <0.00%> (+100.00%)` | `0.00% <0.00%> (ø%)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8366?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/8366?src=pr&el=footer). Last update [c3f4d59...2605845](https://codecov.io/gh/apache/shardingsphere/pull/8366?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 #8366: test: Testcase for ParseTreeCacheBuilder

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



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/test/java/org/apache/shardingsphere/sql/parser/core/cache/ParseTreeCacheBuilderTest.java
##########
@@ -0,0 +1,53 @@
+/*
+ * 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.sql.parser.core.cache;
+
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.LoadingCache;
+import org.antlr.v4.runtime.tree.ParseTree;
+import org.apache.shardingsphere.sql.parser.api.CacheOption;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * ParseTreeCacheBuilder Testcase.
+ */
+public class ParseTreeCacheBuilderTest {
+
+    private CacheOption option;
+
+    private String databaseType;
+
+    /**
+     * define cacheOption & databaseType.
+     */
+    @Before
+    public void setUp() {
+        option = new CacheOption(128, 1024L, 4);
+        databaseType = "MySQL";
+    }
+
+    @Test
+    public void build() {
+        LoadingCache<String, ParseTree> loadingCache = CacheBuilder.newBuilder().softValues()
+                .initialCapacity(option.getInitialCapacity()).maximumSize(option.getMaximumSize()).concurrencyLevel(option.getConcurrencyLevel()).build(new ParseTreeCacheLoader(databaseType));
+
+        Assert.assertEquals(loadingCache.asMap(), ParseTreeCacheBuilder.build(option, databaseType).asMap());

Review comment:
       1. Please use static import for Assert
   2. Please use assertThat instead of assertEquals




----------------------------------------------------------------
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] laingke closed pull request #8366: test: Testcase for ParseTreeCacheBuilder

Posted by GitBox <gi...@apache.org>.
laingke closed pull request #8366:
URL: https://github.com/apache/shardingsphere/pull/8366


   


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