You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/10/02 07:00:55 UTC

[shardingsphere] branch master updated: [Issue #20396]-Add unit test for DefaultSQLParserRuleConfigurationBuilder (#21291)

This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 90f0d472abe [Issue #20396]-Add unit test for DefaultSQLParserRuleConfigurationBuilder (#21291)
90f0d472abe is described below

commit 90f0d472abe6d881352b9aed8629f450323ee62a
Author: Abhinav Koppula <ab...@gmail.com>
AuthorDate: Sun Oct 2 12:30:47 2022 +0530

    [Issue #20396]-Add unit test for DefaultSQLParserRuleConfigurationBuilder (#21291)
    
    * [Issue #20396]-Add unit test for DefaultSQLParserRuleConfigurationBuilder
    
    * [ReviewComment]-Renamed actualResult to actual
---
 ...faultSQLParserRuleConfigurationBuilderTest.java | 49 ++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/shardingsphere-kernel/shardingsphere-parser/shardingsphere-parser-core/src/test/java/org/apache/shardingsphere/parser/rule/builder/DefaultSQLParserRuleConfigurationBuilderTest.java b/shardingsphere-kernel/shardingsphere-parser/shardingsphere-parser-core/src/test/java/org/apache/shardingsphere/parser/rule/builder/DefaultSQLParserRuleConfigurationBuilderTest.java
new file mode 100644
index 00000000000..4aa9ee645ff
--- /dev/null
+++ b/shardingsphere-kernel/shardingsphere-parser/shardingsphere-parser-core/src/test/java/org/apache/shardingsphere/parser/rule/builder/DefaultSQLParserRuleConfigurationBuilderTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.parser.rule.builder;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertFalse;
+import static org.hamcrest.Matchers.is;
+
+import org.apache.shardingsphere.parser.config.SQLParserRuleConfiguration;
+import org.apache.shardingsphere.parser.constant.SQLParserOrder;
+import org.junit.Test;
+
+public final class DefaultSQLParserRuleConfigurationBuilderTest {
+    
+    @Test
+    public void assertBuild() {
+        SQLParserRuleConfiguration actual = new DefaultSQLParserRuleConfigurationBuilder().build();
+        assertFalse(actual.isSqlCommentParseEnabled());
+        assertThat(actual.getParseTreeCache().getInitialCapacity(), is(128));
+        assertThat(actual.getParseTreeCache().getMaximumSize(), is(1024L));
+        assertThat(actual.getSqlStatementCache().getInitialCapacity(), is(2000));
+        assertThat(actual.getSqlStatementCache().getMaximumSize(), is(65535L));
+    }
+    
+    @Test
+    public void assertGetOrder() {
+        assertThat(new DefaultSQLParserRuleConfigurationBuilder().getOrder(), is(SQLParserOrder.ORDER));
+    }
+    
+    @Test
+    public void assertGetTypeClass() {
+        assertThat(new DefaultSQLParserRuleConfigurationBuilder().getTypeClass().toString(), is(SQLParserRuleBuilder.class.toString()));
+    }
+}