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 302cb47 add MySQL install component statement (#12979)
302cb47 is described below
commit 302cb476eee3dc1072e516dfecd6457b82a22409
Author: Thanoshan MV <[email protected]>
AuthorDate: Mon Oct 11 07:25:20 2021 +0530
add MySQL install component statement (#12979)
---
.../impl/MySQLDALStatementSQLVisitor.java | 15 ++++++
.../impl/MySQLDCLStatementSQLVisitor.java | 6 ---
.../statement/impl/MySQLStatementSQLVisitor.java | 6 +++
.../core/database/visitor/SQLVisitorRule.java | 2 +
.../mysql/dal/MySQLInstallComponentStatement.java | 35 +++++++++++++
.../asserts/statement/dal/DALStatementAssert.java | 5 ++
.../dal/impl/InstallComponentStatementAssert.java | 57 ++++++++++++++++++++++
.../jaxb/cases/domain/SQLParserTestCases.java | 5 ++
.../segment/impl/component/ExpectedComponent.java | 33 +++++++++++++
.../dal/InstallComponentStatementTestCase.java | 36 ++++++++++++++
.../src/main/resources/case/dal/install.xml | 28 +++++++++++
.../main/resources/sql/supported/dal/install.xml | 22 +++++++++
12 files changed, 244 insertions(+), 6 deletions(-)
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
index 005f1be..dcbc1e1 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
@@ -24,12 +24,14 @@ import
org.apache.shardingsphere.sql.parser.api.visitor.type.DALSQLVisitor;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.AnalyzeTableContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.CacheIndexContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ChecksumTableContext;
+import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ComponentNameContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.CreateLoadableFunctionContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ExplainContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ExplainableStatementContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.FlushContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.FromSchemaContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.FromTableContext;
+import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.InstallComponentContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.InstallPluginContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.KillContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.LoadIndexInfoContext;
@@ -91,6 +93,7 @@ import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQ
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLCreateLoadableFunctionStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLExplainStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLFlushStatement;
+import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLInstallComponentStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLInstallPluginStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLKillStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLLoadIndexInfoStatement;
@@ -123,6 +126,7 @@ import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQ
import java.util.Collection;
import java.util.LinkedList;
+import java.util.List;
import java.util.Properties;
/**
@@ -530,4 +534,15 @@ public final class MySQLDALStatementSQLVisitor extends
MySQLStatementSQLVisitor
public ASTNode visitCreateLoadableFunction(final
CreateLoadableFunctionContext ctx) {
return new MySQLCreateLoadableFunctionStatement();
}
+
+ @Override
+ public ASTNode visitInstallComponent(final InstallComponentContext ctx) {
+ MySQLInstallComponentStatement result = new
MySQLInstallComponentStatement();
+ List<String> components = new LinkedList<>();
+ for (ComponentNameContext each : ctx.componentName()) {
+ components.add(((StringLiteralValue)
visit(each.string_())).getValue());
+ }
+ result.getComponents().addAll(components);
+ return result;
+ }
}
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDCLStatementSQLVisitor.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDCLStatementSQLVisitor.java
index 80d275a..92e1317 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDCLStatementSQLVisitor.java
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDCLStatementSQLVisitor.java
@@ -86,7 +86,6 @@ import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.StaticP
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.StaticPrivilegeTriggerContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.StaticPrivilegeUpdateContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.StaticPrivilegeUsageContext;
-import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.String_Context;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.TlsOptionContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.UserNameContext;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.ACLTypeEnum;
@@ -570,11 +569,6 @@ public final class MySQLDCLStatementSQLVisitor extends
MySQLStatementSQLVisitor
}
@Override
- public ASTNode visitString_(final String_Context ctx) {
- return new StringLiteralValue(ctx.getText());
- }
-
- @Override
public ASTNode visitCreateUserEntryIdentifiedWith(final
CreateUserEntryIdentifiedWithContext ctx) {
UserSegment result = (UserSegment) visit(ctx.userName());
result.setStartIndex(ctx.start.getStartIndex());
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLStatementSQLVisitor.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLStatementSQLVisitor.java
index eb5264e..72d8c9a 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLStatementSQLVisitor.java
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLStatementSQLVisitor.java
@@ -103,6 +103,7 @@ import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.SimpleE
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.SingleTableClauseContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.SpecialFunctionContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.StringLiteralsContext;
+import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.String_Context;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.SubqueryContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.SubstringFunctionContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.TableAliasRefListContext;
@@ -246,6 +247,11 @@ public abstract class MySQLStatementSQLVisitor extends
MySQLStatementBaseVisitor
}
@Override
+ public ASTNode visitString_(final String_Context ctx) {
+ return new StringLiteralValue(ctx.getText());
+ }
+
+ @Override
public final ASTNode visitNumberLiterals(final NumberLiteralsContext ctx) {
return new NumberLiteralValue(ctx.getText());
}
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
index 6689aec..5bf806a 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
@@ -262,6 +262,8 @@ public enum SQLVisitorRule {
LOAD("Load", SQLStatementType.DAL),
+ INSTALL("Install", SQLStatementType.DAL),
+
CALL("Call", SQLStatementType.DML),
CHANGE_MASTER("ChangeMaster", SQLStatementType.RL),
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLInstallComponentStatement.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLInstallComponentStatement.java
new file mode 100644
index 0000000..b4ffb12
--- /dev/null
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLInstallComponentStatement.java
@@ -0,0 +1,35 @@
+/*
+ * 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.sql.dialect.statement.mysql.dal;
+
+import lombok.Getter;
+import
org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement;
+import
org.apache.shardingsphere.sql.parser.sql.common.statement.dal.DALStatement;
+import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.MySQLStatement;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * MySQL install component statement.
+ */
+@Getter
+public final class MySQLInstallComponentStatement extends AbstractSQLStatement
implements DALStatement, MySQLStatement {
+
+ private final List<String> components = new LinkedList<>();
+}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/DALStatementAssert.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/DALStatementAssert.java
index 9624410..af75f45 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/DALStatementAssert.java
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/DALStatementAssert.java
@@ -22,6 +22,7 @@ import lombok.NoArgsConstructor;
import
org.apache.shardingsphere.sql.parser.sql.common.statement.dal.DALStatement;
import
org.apache.shardingsphere.sql.parser.sql.common.statement.dal.ExplainStatement;
import
org.apache.shardingsphere.sql.parser.sql.common.statement.dal.SetStatement;
+import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLInstallComponentStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowColumnsStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowCreateTableStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowCreateTriggerStatement;
@@ -34,6 +35,7 @@ import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQ
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.dal.PostgreSQLShowStatement;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.ExplainStatementAssert;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.InstallComponentStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.MySQLUseStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.SetParameterStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.ShowColumnsStatementAssert;
@@ -47,6 +49,7 @@ import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.ShowTablesStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ExplainStatementTestCase;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.InstallComponentStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.SetParameterStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowColumnsStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowCreateTableStatementTestCase;
@@ -97,6 +100,8 @@ public final class DALStatementAssert {
ShowStatementAssert.assertIs(assertContext,
(PostgreSQLShowStatement) actual, (ShowStatementTestCase) expected);
} else if (actual instanceof SetStatement) {
SetParameterStatementAssert.assertIs(assertContext, (SetStatement)
actual, (SetParameterStatementTestCase) expected);
+ } else if (actual instanceof MySQLInstallComponentStatement) {
+ InstallComponentStatementAssert.assertIs(assertContext,
(MySQLInstallComponentStatement) actual, (InstallComponentStatementTestCase)
expected);
}
}
}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/InstallComponentStatementAssert.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/InstallComponentStatementAssert.java
new file mode 100644
index 0000000..d5c68c8
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/InstallComponentStatementAssert.java
@@ -0,0 +1,57 @@
+/*
+ * 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.test.sql.parser.parameterized.asserts.statement.dal.impl;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLInstallComponentStatement;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.component.ExpectedComponent;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.InstallComponentStatementTestCase;
+
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Install component statement assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class InstallComponentStatementAssert {
+
+ /**
+ * Assert install component statement is correct with expected install
component statement test case.
+ *
+ * @param assertContext assert context
+ * @param actual actual install component statement
+ * @param expected expected install component statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext,
final MySQLInstallComponentStatement actual, final
InstallComponentStatementTestCase expected) {
+ assertThat(assertContext.getText("Actual components size assertion
error: "), actual.getComponents().size(), is(expected.getComponents().size()));
+ assertComponents(assertContext, actual.getComponents(),
expected.getComponents());
+ }
+
+ private static void assertComponents(final SQLCaseAssertContext
assertContext, final List<String> actual, final List<ExpectedComponent>
expected) {
+ int count = 0;
+ for (String each : actual) {
+ assertThat(assertContext.getText("Actual component value does not
match: "), each, is(expected.get(count).getName()));
+ count++;
+ }
+ }
+}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
index 1529e38..9d13b51 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
@@ -22,6 +22,7 @@ import lombok.Getter;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.CommonStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ExplainStatementTestCase;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.InstallComponentStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.SetParameterStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowColumnsStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ShowCreateTableStatementTestCase;
@@ -604,6 +605,9 @@ public final class SQLParserTestCases {
@XmlElement(name = "drop-schema")
private final List<DropSchemaStatementTestCase> dropSchemaTestCase = new
LinkedList<>();
+ @XmlElement(name = "install-component")
+ private final List<InstallComponentStatementTestCase>
installComponentTestCase = new LinkedList<>();
+
/**
* Get all SQL parser test cases.
*
@@ -753,6 +757,7 @@ public final class SQLParserTestCases {
putAll(createSchemaTestCase, result);
putAll(alterSchemaTestCase, result);
putAll(dropSchemaTestCase, result);
+ putAll(installComponentTestCase, result);
return result;
}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/component/ExpectedComponent.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/component/ExpectedComponent.java
new file mode 100644
index 0000000..bf7c28c
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/component/ExpectedComponent.java
@@ -0,0 +1,33 @@
+/*
+ * 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.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.component;
+
+import lombok.Getter;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.AbstractExpectedSQLSegment;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * Expected component.
+ */
+@Getter
+public final class ExpectedComponent extends AbstractExpectedSQLSegment {
+
+ @XmlAttribute(name = "name")
+ private String name;
+}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/InstallComponentStatementTestCase.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/InstallComponentStatementTestCase.java
new file mode 100644
index 0000000..70c4e42
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/InstallComponentStatementTestCase.java
@@ -0,0 +1,36 @@
+/*
+ * 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.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal;
+
+import lombok.Getter;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.component.ExpectedComponent;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
+
+import javax.xml.bind.annotation.XmlElement;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Install component statement test case.
+ */
+@Getter
+public final class InstallComponentStatementTestCase extends SQLParserTestCase
{
+
+ @XmlElement(name = "component")
+ private final List<ExpectedComponent> components = new LinkedList<>();
+}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/install.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/install.xml
new file mode 100644
index 0000000..bfd62c0
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/install.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<sql-parser-test-cases>
+ <install-component sql-case-id="install_component">
+ <component name="file://component1" start-index="18" stop-index="36"/>
+ </install-component>
+
+ <install-component sql-case-id="install_components">
+ <component name="file://component1" start-index="18" stop-index="36"/>
+ <component name="file://component2" start-index="39" stop-index="57"/>
+ </install-component>
+</sql-parser-test-cases>
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dal/install.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dal/install.xml
new file mode 100644
index 0000000..168ffae
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dal/install.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<sql-cases>
+ <sql-case id="install_component" value="INSTALL COMPONENT
'file://component1'" db-types="MySQL" />
+ <sql-case id="install_components" value="INSTALL COMPONENT
'file://component1', 'file://component2'" db-types="MySQL" />
+</sql-cases>